index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="container">
  3. <page-title>牵头领导及部门</page-title>
  4. <view class="cards-list">
  5. <view class="card" v-for="(item,index) in projectList" :key="index">
  6. <card-title :numerator="index+1" :denominator="listTotal" isSpecial></card-title>
  7. <view class="card-name">
  8. <view class="card-name-title">
  9. <text class="card-name-description">所属单位</text>
  10. </view>
  11. <text class="card-name-text">{{item.unitName || "--"}}</text>
  12. </view>
  13. <view class="card-item">
  14. <view class="card-item-name">所属科室</view>
  15. <view class="card-item-content">{{item.departName || "--"}}</view>
  16. </view>
  17. <view class="card-item">
  18. <view class="card-item-name">建设地点</view>
  19. <view class="card-item-content">{{item.buildAddress || "--"}}</view>
  20. </view>
  21. <view class="card-item">
  22. <view class="card-item-name">领导姓名</view>
  23. <view class="card-item-content">{{item.userName || "--"}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <empty-show v-if="projectList.length===0"></empty-show>
  28. <u-loading-page :loading="loading"></u-loading-page>
  29. </view>
  30. </template>
  31. <script setup>
  32. import {
  33. ref
  34. } from 'vue';
  35. import {
  36. onLoad,
  37. onUnload,
  38. onPullDownRefresh,
  39. onReachBottom,
  40. onPageScroll
  41. } from "@dcloudio/uni-app";
  42. import {
  43. getProjectLeadlist,
  44. } from "@/api/work/projectInfo.js";
  45. import {
  46. addFocus,
  47. cancelFocus
  48. } from "@/api/work/focus.js";
  49. function backToBefore() {
  50. uni.reLaunch({
  51. url: "/pages/index"
  52. });
  53. };
  54. let scrollTop = ref(0)
  55. let loading = ref(true)
  56. // 参数
  57. let searchInfo = ref({
  58. // pageNo: 1,
  59. // pageSize: 10,
  60. subId: ''
  61. })
  62. // 触底加载flag
  63. let moreListFlag = true
  64. // 获取列表
  65. let projectList = ref([]);
  66. let listTotal = ref(0);
  67. function getList() {
  68. // if(searchInfo.value.pageNo == 1){
  69. loading.value = true
  70. // }
  71. getProjectLeadlist(searchInfo.value).then(res => {
  72. loading.value = false
  73. projectList.value = projectList.value.concat(res.data.list);
  74. // listTotal.value = res.data.total;
  75. // if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
  76. // .length)) moreListFlag = false;
  77. }).catch(() => {
  78. loading.value = false
  79. })
  80. }
  81. // function goToDetail(id, subName) {
  82. // uni.navigateTo({
  83. // url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  84. // })
  85. // }
  86. // function goToPage(url) {
  87. // uni.navigateTo({
  88. // url
  89. // })
  90. // }
  91. // function goToReport(type, subId, subName) {
  92. // uni.navigateTo({
  93. // url: `/pages/projectInfo/report/index?type=${type}&subId=${subId}&subName=${subName}`
  94. // })
  95. // }
  96. onLoad((options) => {
  97. // uni.$on('projectInfoSearch', resolve => {
  98. // searchInfo.value = Object.assign(searchInfo.value, resolve);
  99. // searchInfo.value.pageNo = 1;
  100. // projectList.value = [];
  101. // listTotal.value = 0;
  102. // moreListFlag = true;
  103. // getList();
  104. // });
  105. console.log(options);
  106. searchInfo.value.subId = options.subId
  107. getList();
  108. });
  109. onUnload(() => {
  110. // uni.$off('projectInfoSearch');
  111. })
  112. onPageScroll((e) => {
  113. scrollTop.value = e.scrollTop
  114. })
  115. onPullDownRefresh(() => {
  116. // searchInfo.value.pageNo = 1;
  117. projectList.value = [];
  118. moreListFlag = true;
  119. try {
  120. getList();
  121. } finally {
  122. uni.stopPullDownRefresh()
  123. }
  124. })
  125. // onReachBottom(() => {
  126. // if (!moreListFlag) {
  127. // return uni.showToast({
  128. // title: "已经到底了。",
  129. // icon: "none",
  130. // duration: 2000
  131. // })
  132. // }
  133. // searchInfo.value.pageNo++;
  134. // getList();
  135. // })
  136. </script>
  137. <style lang="scss" scoped>
  138. </style>