worker.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <view class="container">
  4. <view>
  5. <view class="worker-box" v-for="(item,index) in list" :key="index">
  6. <view class="worker-box-info">
  7. <view class="worker-box-avator">
  8. <image :src="item.headImage" mode="aspectFit"></image>
  9. </view>
  10. <view class="worker-box-body">
  11. <view class="worker-box-title">
  12. <text>{{item.realName}}</text>
  13. </view>
  14. <view class="worker-box-desc">
  15. <text v-if="item.gender == 1">男</text>
  16. <text v-if="item.gender == 2">女</text>
  17. | {{item.age}}岁 | {{item.work}}年护理经验
  18. </view>
  19. <view class="worker-box-desc">
  20. <rich-text :nodes="item.content"></rich-text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. var app = getApp();
  31. export default {
  32. data() {
  33. return {
  34. list: [],
  35. page: 1,
  36. size: 10,
  37. flag: 0
  38. }
  39. },
  40. onLoad() {
  41. var orgId = this.getUrlCode('orgId');
  42. if(orgId){
  43. uni.setStorageSync(app.globalData.storagePre+'orgId',orgId);
  44. app.globalData.userinfo.orgId = orgId;
  45. }else{
  46. orgId = uni.getStorageSync(app.globalData.storagePre+'orgId');
  47. if(orgId){
  48. app.globalData.userinfo.orgId = orgId;
  49. }else{
  50. uni.showToast({
  51. title: '参数错误',
  52. icon: 'none',
  53. duration: 2000
  54. })
  55. }
  56. }
  57. },
  58. onShow() {
  59. var that = this;
  60. app.ajaxReadyCallback = res => { //各个接口统一回调方法
  61. var apiname = res.data.apiname;
  62. console.log(res);
  63. if(apiname == 'worker'){
  64. that.list = res.data.data;
  65. if (that.list.length < that.size) {
  66. that.flag = 1;
  67. } else {
  68. that.page++;
  69. }
  70. }
  71. }
  72. if(app.globalData.userinfo.orgId){
  73. this.flag = 0;
  74. this.page = 1;
  75. this.getWorkerList();
  76. }
  77. },
  78. onPullDownRefresh() {
  79. this.flag = 0;
  80. this.page = 1;
  81. this.getWorkerList();
  82. },
  83. onReachBottom() { //上拉加载
  84. this.getWorkerList();
  85. },
  86. methods: {
  87. getWorkerList(){
  88. if(this.flag == 1){
  89. return;
  90. }
  91. app.ajax({
  92. url: app.globalData.serverUrl + 'worker/lists',
  93. type: 'POST',
  94. apiname: 'worker',
  95. data: {
  96. page: this.page,
  97. size: this.size
  98. }
  99. });
  100. },
  101. getUrlCode (name) {
  102. return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
  103. },
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. page{
  109. // background-color: #FFFFFF;
  110. }
  111. .org-title{
  112. position: fixed;
  113. z-index: 1000;
  114. left: 0;
  115. top: 0;
  116. width: 100%;
  117. height: 90rpx;
  118. line-height: 90rpx;
  119. padding: 20rpx;
  120. font-size: 34rpx;
  121. font-weight: 500;
  122. color: #FFFFFF;
  123. }
  124. .swiper{
  125. width: 100%;
  126. height: 579rpx;
  127. }
  128. .slide-image{
  129. width: 750rpx;
  130. height: 579rpx;
  131. }
  132. .book-btn{
  133. width: 100%;
  134. height: 180rpx;
  135. margin-bottom: 20rpx;
  136. }
  137. .book-phone{
  138. width: 100%;
  139. height: 90rpx;
  140. line-height: 90rpx;
  141. border-radius: 45rpx;
  142. color: #FF7576;
  143. font-size: 34rpx;
  144. border: 1rpx solid #FF7576;
  145. text-align: center;
  146. font-weight: bold;
  147. }
  148. .book-phone image{
  149. width: 30rpx;
  150. height: 30rpx;
  151. margin-right: 20rpx;
  152. }
  153. .worker-title{
  154. height: 90rpx;
  155. line-height: 90rpx;
  156. color: #333333;
  157. font-size: 32rpx;
  158. font-weight: bold;
  159. }
  160. .worker-title-more{
  161. color: #999999;
  162. font-size: 28rpx;
  163. font-weight: 400;
  164. }
  165. .worker-title-more image{
  166. width: 26rpx;
  167. height: 26rpx;
  168. }
  169. </style>