index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <script setup>
  2. import {
  3. ref
  4. } from 'vue'
  5. import {
  6. onLoad,
  7. onUnload,
  8. onPullDownRefresh,
  9. onReachBottom,
  10. onPageScroll
  11. } from "@dcloudio/uni-app"
  12. import {
  13. getOverseeList,
  14. } from "@/api/work/oversee.js"
  15. function backToBefore() {
  16. uni.reLaunch({
  17. url: "/pages/index"
  18. });
  19. };
  20. let scrollTop = ref(0)
  21. let loading = ref(true)
  22. // 参数
  23. let searchInfo = ref({
  24. pageNo: 1,
  25. pageSize: 10,
  26. })
  27. let show = ref(false)
  28. let content = ref('')
  29. function wacthMore(e) {
  30. show.value = true
  31. content.value = e
  32. }
  33. function searchClick() {
  34. goToPage('/pages/oversee/search/index')
  35. }
  36. function getList() {
  37. if (searchInfo.value.pageNo == 1) {
  38. loading.value = true
  39. }
  40. getOverseeList(searchInfo.value).then(res => {
  41. loading.value = false;
  42. itemList.value = itemList.value.concat(res.data.list)
  43. listTotal.value = res.data.total
  44. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
  45. .length)) moreListFlag = false;
  46. }).catch(() => {
  47. loading.value = false
  48. })
  49. }
  50. let itemList = ref([])
  51. let listTotal = ref(0)
  52. // 触底加载flag
  53. let moreListFlag = true
  54. function gotoDetail(type, id, subName) {
  55. if (type === "project") {
  56. uni.navigateTo({
  57. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  58. })
  59. } else {
  60. uni.navigateTo({
  61. url: `/pages/oversee/detail/index?id=${id}`
  62. })
  63. }
  64. }
  65. function goToPage(url) {
  66. uni.navigateTo({
  67. url
  68. })
  69. }
  70. onLoad((options) => {
  71. uni.$on('overseeSearch', resolve => {
  72. searchInfo.value = Object.assign({
  73. pageNo: 1,
  74. pageSize: 10
  75. }, resolve);
  76. searchInfo.value.pageNo = 1;
  77. itemList.value = [];
  78. listTotal.value = 0;
  79. moreListFlag =
  80. true;
  81. getList();
  82. })
  83. searchInfo.value = Object.assign(searchInfo.value, options, {
  84. projectsStatus: options.status
  85. });
  86. searchInfo.value.status = null;
  87. getList();
  88. });
  89. onUnload(() => {
  90. uni.$off('overseeSearch');
  91. });
  92. onPageScroll((e) => {
  93. scrollTop.value = e.scrollTop
  94. })
  95. onPullDownRefresh(() => {
  96. searchInfo.value.pageNo = 1;
  97. itemList.value = [];
  98. moreListFlag = true;
  99. try {
  100. getList();
  101. } finally {
  102. uni.stopPullDownRefresh()
  103. }
  104. })
  105. onReachBottom(() => {
  106. if (!moreListFlag) {
  107. return uni.showToast({
  108. title: "已经到底了。",
  109. icon: "none",
  110. duration: 2000
  111. })
  112. }
  113. searchInfo.value.pageNo++;
  114. getList();
  115. })
  116. </script>
  117. <template>
  118. <view class="container">
  119. <page-title @searchClick='searchClick' showSearch>问题清单</page-title>
  120. <view class="cards-list">
  121. <view class="card" v-for="(item,index) in itemList" :key="index">
  122. <view v-if="item.usersub == 1">
  123. <view style="height:20rpx"></view>
  124. <view class="special-item">
  125. <card-title :numerator="index+1" :denominator="listTotal" isSpecial></card-title>
  126. <view class="card-name">
  127. <view class="card-name-title">
  128. <text class="card-name-description">申报单位</text>
  129. </view>
  130. <text class="card-name-text">{{item.unitTitle || "--"}}</text>
  131. </view>
  132. </view>
  133. </view>
  134. <view v-else>
  135. <card-title :numerator="index+1" :denominator="listTotal"></card-title>
  136. <!-- 申报单位 -->
  137. <view class="card-name">
  138. <view class="card-name-title">
  139. <text class="card-name-description">申报单位</text>
  140. </view>
  141. <text class="card-name-text">{{item.unitTitle || "--"}}</text>
  142. </view>
  143. </view>
  144. <view class="card-item">
  145. <view class="card-item-name">项目名称</view>
  146. <view class="card-item-content">{{item.sub_name || "--"}}</view>
  147. </view>
  148. <view class="card-item">
  149. <view class="card-item-name">当前状态</view>
  150. <view class="card-item-content">{{item.status || "--"}}</view>
  151. </view>
  152. <view class="card-item">
  153. <view class="card-item-name">问题描述</view>
  154. <view class="card-item-content">
  155. <view class="text">
  156. {{item.title || "--"}}
  157. </view>
  158. <view class="morebtn" @click="wacthMore(item.title)">
  159. 查看更多
  160. </view>
  161. </view>
  162. </view>
  163. <view class="card-item">
  164. <view class="card-item-name">要求解决日期</view>
  165. <view class="card-item-content">{{item.date_conf || "--"}}</view>
  166. </view>
  167. <view class="card-item">
  168. <view class="card-btn" @click="gotoDetail('project',item.sub_id,item.sub_name)">项目查看</view>
  169. <view class="card-btn empty-btn" @click="gotoDetail('problem',item.id)">问题查看</view>
  170. </view>
  171. <view class="card-icon" :class="item.stu === '已关闭' ? 'question-closed' : 'question-not-close'"></view>
  172. </view>
  173. <empty-show v-if=" itemList.length===0"></empty-show>
  174. </view>
  175. <u-back-top :scroll-top="scrollTop"></u-back-top>
  176. <u-popup :show="show" mode='center' @close="show=false" bgColor='transparent'>
  177. <view class="popup-box">
  178. <view class="box-title">问题描述</view>
  179. <view class="box-icon"><u-icon name="close" size="20" @click="show=false"></u-icon></view>
  180. <scroll-view scroll-y="true" style="height: 700rpx;">
  181. <text class="box-text">{{content}}</text>
  182. </scroll-view>
  183. </view>
  184. </u-popup>
  185. <u-loading-page :loading="loading"></u-loading-page>
  186. </view>
  187. </template>
  188. <style lang="scss" scoped>
  189. .text {
  190. overflow: hidden;
  191. word-break: break-all;
  192. text-overflow: ellipsis;
  193. display: -webkit-box;
  194. -webkit-box-orient: vertical;
  195. -webkit-line-clamp: 3;
  196. }
  197. .popup-box {
  198. position: relative;
  199. width: 90vw;
  200. margin: auto;
  201. background-color: #fff;
  202. padding: 40rpx;
  203. border-radius: 20rpx;
  204. // font-size: 30;
  205. .box-icon {
  206. position: absolute;
  207. top: 40rpx;
  208. right: 40rpx;
  209. }
  210. .box-title {
  211. width: 100%;
  212. font-size: 40rpx;
  213. font-weight: 500;
  214. font-family: OPPOSans-M;
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. padding-bottom: 20rpx;
  219. }
  220. .box-text {
  221. letter-spacing: 3rpx;
  222. }
  223. }
  224. .morebtn {
  225. float: right;
  226. margin-top: 20rpx;
  227. width: 190rpx;
  228. display: flex;
  229. justify-content: center;
  230. align-items: center;
  231. padding: 10rpx 0 10rpx 0;
  232. font-size: 20rpx;
  233. border-radius: 28rpx;
  234. background-color: #1869F6;
  235. color: #fff;
  236. }
  237. </style>