honorAuditDetail.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="200" :title="state.honorTypeName" :defaultTabValue="state.honorStatus" :tabList="state.tabList" :onlyTitle="false" :showHeadSearchInput="false" :showFilterPicker="false" :showTabs="true" :showTabBtns="false" rightWidth="0rpx" @CommonFilterData="CommonFilterData" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content">
  6. <scroll-view
  7. class="scroll_view_y"
  8. :scroll-top="state.scrollTop"
  9. scroll-y="true"
  10. :refresher-enabled="false"
  11. :enable-back-to-top="true"
  12. :show-scrollbar="false"
  13. :scroll-with-animation="true"
  14. refresher-default-style="none"
  15. refresher-background="#F8F9FD"
  16. :refresher-triggered="state.isRefreshing"
  17. @scrolltolower="OnLoadMore"
  18. @refresherrefresh="OnRefresh"
  19. @scroll="OnScroll">
  20. <view class="refresh_loading" v-if="state.isRefreshing"><uni-load-more status="loading" /></view>
  21. <view class="page_list">
  22. <view class="count">
  23. <template v-if="state.honorStatus === '0'">共 {{state.reViewCount}} 人</template>
  24. <template v-if="state.honorStatus === '1'">共 {{state.overCount}} 人</template>
  25. <template v-if="state.honorStatus === '2'">共 {{state.overruleCount}} 人</template>
  26. </view>
  27. <view class="list_item" v-for="item in state.pageList" :key="item.id" @click="GoTeacherDetail(item.id,item.teacherName)">
  28. <view class="name_btn">
  29. <view class="teacher_name">{{item.teacherName}}</view>
  30. <view class="btn">{{state.honorStatus === '0'?'审核':'查看'}}</view>
  31. </view>
  32. <view class="created_at">上传时间:{{item.createdAt}}</view>
  33. </view>
  34. </view>
  35. <view class="no_data" v-if="!state.isLoading && state.pageList.length == 0">
  36. <image class="no_data_img" src="@/static/image/bg/no_data.png"></image>
  37. <text class="no_data_text">暂无数据</text>
  38. </view>
  39. <uni-load-more v-if="state.pageList.length > 0" :status="state.loadStatus" />
  40. </scroll-view>
  41. </view>
  42. </view>
  43. </template>
  44. <script setup>
  45. import navBar from '@/components/navBar.vue';
  46. import {queryHonorReviewDetailList} from '@/reqApi/teacherHonor.js';
  47. import {
  48. reactive,
  49. onUnmounted,
  50. nextTick
  51. } from 'vue';
  52. import { onLoad,onShow } from '@dcloudio/uni-app';
  53. const state = reactive({
  54. tabList:[{
  55. label:'待审核',
  56. value:'0'
  57. },{
  58. label:'已审核',
  59. value:'1'
  60. },{
  61. label:'已驳回',
  62. value:'2',
  63. }],
  64. pageLists:[],//全部数据
  65. pageList:[],//列表数据
  66. reViewCount:0,//待审核数量
  67. overCount:0,//已审核数量
  68. overruleCount:0,//驳回数量
  69. honorTypeId:'',//荣誉类型id
  70. honorTypeName:'',//荣誉类型
  71. honorStatus:'',//审核状态
  72. pageSize: 30,
  73. pageNum: 1,
  74. pages:0,
  75. scrollTop:0,
  76. oldScrollTop:0,
  77. isRefreshing:false,//设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
  78. isLoading:true,//加载中
  79. noMoreData:false,//没有更多数据了
  80. loadStatus:'more',//loading状态
  81. })
  82. onShow(()=>{
  83. const isLoadHonorAuditList = uni.getStorageSync('isLoadHonorAuditList');
  84. if(isLoadHonorAuditList){//审核驳回通过返回刷新列表
  85. OnLoadData(true);
  86. }
  87. })
  88. onLoad((option) => {
  89. state.honorTypeId = option.honorTypeId;
  90. state.honorTypeName = decodeURIComponent(option.honorTypeName);
  91. state.honorStatus = option.honorStatus;
  92. OnLoadData(true);
  93. });
  94. onUnmounted(()=>{
  95. uni.setStorageSync('isLoadHonorAuditList', false);
  96. })
  97. //切换条件选择器
  98. const CommonFilterData = (filterOptions,type) => {
  99. const { tabsSelected } = filterOptions;
  100. state.honorStatus = tabsSelected;
  101. OnLoadData(true)
  102. }
  103. /*
  104. *获取数据
  105. * initPage:初始分页 从第一开始
  106. */
  107. const OnLoadData = (initPage) => {
  108. state.isLoading = true;
  109. state.loadStatus = 'loading';
  110. if (initPage) {
  111. // uni.showLoading({
  112. // title: '加载中'
  113. // });
  114. state.pageNum = 1;//如果是下拉刷新、重新查询 默认加载第一页
  115. queryHonorReviewDetailList({
  116. honorTypeId:state.honorTypeId,
  117. honorStatus:state.honorStatus
  118. }).then(res=>{
  119. if(res.code == 200){
  120. const tableData = res?.data?.detailList || [];
  121. state.reViewCount = res?.data?.reViewCount || 0;//待审核数量
  122. state.overCount = res?.data?.overCount || 0;//已审核数量
  123. state.overruleCount = res?.data?.overruleCount || 0;//驳回数量
  124. state.pageLists = tableData;//全部数据
  125. const total = tableData?.length || 0;//总数
  126. state.pages = Math.ceil(total / state.pageSize);//总页数
  127. //默认加载
  128. state.pageList = state.pageLists.slice(0, state.pageSize);
  129. //没有更多了
  130. state.noMoreData = state.pageNum == state.pages;
  131. //分页+1
  132. state.pageNum++;
  133. state.isLoading = false;
  134. state.isRefreshing = false;//下拉刷新未被触发
  135. state.loadStatus = state.noMoreData?'no-more':'more';
  136. }
  137. }).finally(()=>{
  138. // uni.hideLoading();
  139. //返回到页面顶部
  140. if(initPage){
  141. GoTop();
  142. }
  143. })
  144. }else{
  145. const start = (state.pageNum - 1) * state.pageSize;
  146. const end = start + state.pageSize;
  147. const list = state.pageLists.slice(start, end);
  148. state.pageList = [...state.pageList, ...list];
  149. state.noMoreData = state.pageNum == state.pages;
  150. state.pageNum++;
  151. setTimeout(() => {
  152. state.isLoading = false;
  153. state.isRefreshing = false; //下拉刷新未被触发
  154. state.loadStatus = state.noMoreData?'no-more':'more';
  155. }, 0)
  156. }
  157. }
  158. // 自定义下拉刷新被触发 下拉刷新
  159. const OnRefresh = () =>{
  160. state.isRefreshing = true;//下拉刷新已经被触发
  161. OnLoadData(true);
  162. }
  163. //滚动到底部/右边 触发上拉刷新
  164. const OnLoadMore = () => {
  165. if (state.isLoading || state.noMoreData) return;
  166. OnLoadData(false);
  167. }
  168. // 滚动时触发
  169. const OnScroll = (e) => {
  170. state.oldScrollTop = e.detail.scrollTop;
  171. }
  172. //返回到顶部
  173. const GoTop = () => {
  174. // 解决view层不同步的问题
  175. state.scrollTop = state.oldScrollTop;
  176. nextTick(() => {
  177. state.scrollTop = 0
  178. });
  179. }
  180. //返回
  181. const GoBack = () => {
  182. uni.navigateBack({
  183. delta: 1
  184. });
  185. }
  186. const GoTeacherDetail = (id,teacherName) => {
  187. uni.navigateTo({
  188. url: `/pages/teacherHonor/honorAudit/teacherDetail?id=${id}&pageTitle=${teacherName}&pageFoot=1`
  189. });
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .page_body{
  194. height: 100%;
  195. min-height: auto;
  196. .page_content{
  197. height: calc(100% - 200rpx);
  198. .scroll_view_y{
  199. height: 100%;
  200. .refresh_loading{
  201. padding: 10rpx 0;
  202. }
  203. }
  204. .page_list{
  205. display: flex;
  206. width: 100%;
  207. flex-direction: column;
  208. .count{
  209. display: flex;
  210. align-items: center;
  211. width: 100%;
  212. height: 88rpx;
  213. border-top: 2rpx solid #F3F3F3;
  214. border-bottom: 2rpx solid #F3F3F3;
  215. font-weight: 400;
  216. font-size: 28rpx;
  217. color: #333333;
  218. }
  219. .list_item{
  220. display: flex;
  221. width: 100%;
  222. flex-direction: column;
  223. padding:24rpx 0;
  224. border-bottom: 2rpx solid #F3F3F3;
  225. .name_btn{
  226. display: flex;
  227. width: 100%;
  228. align-items: center;
  229. .teacher_name{
  230. flex: 1;
  231. font-weight: 500;
  232. font-size: 32rpx;
  233. color: #333333;
  234. white-space: nowrap;
  235. overflow: hidden;
  236. text-overflow: ellipsis;
  237. }
  238. .btn{
  239. display: inline-flex;
  240. align-items: center;
  241. justify-content: center;
  242. width: 104rpx;
  243. height: 64rpx;
  244. border-radius: 8rpx;
  245. border: 2rpx solid #2E64FA;
  246. font-weight: 400;
  247. font-size: 28rpx;
  248. color: #2E64FA;
  249. }
  250. }
  251. .created_at{
  252. display: flex;
  253. width: 100%;
  254. margin-top: 16rpx;
  255. font-weight: 400;
  256. font-size: 24rpx;
  257. color: #999999;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. </style>