index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <!-- 头部 -->
  3. <nav-bar height="120" backPath="workspace" title="教师专业发展" :showHeaderborder="true" :showFilterPicker="false" :showTabs="false" :onlyTitle="false" rightWidth="0rpx" @CommonFilterData="CommonFilterData"></nav-bar>
  4. <view class="page_content">
  5. <view class="count_list">
  6. <view class="count_item">
  7. <text class="title">全部荣誉</text>
  8. <text class="count">{{state.countList.honorCount}}</text>
  9. </view>
  10. <view class="count_item">
  11. <text class="title">待审核</text>
  12. <text class="count">{{state.countList.reViewCount}}</text>
  13. </view>
  14. <view class="count_item">
  15. <text class="title">已完成</text>
  16. <text class="count">{{state.countList.overCount}}</text>
  17. </view>
  18. <view class="count_item">
  19. <text class="title">已驳回</text>
  20. <text class="count">{{state.countList.overruleCount}}</text>
  21. </view>
  22. </view>
  23. <view class="list_title">
  24. <view class="title">荣誉类型</view>
  25. <view class="add_btn" @click="AddEditHonorType('add')">
  26. <uni-icons class="btn_icon" type="plusempty"></uni-icons>
  27. <text class="btn_text">新建类型</text>
  28. </view>
  29. </view>
  30. <view class="honor_list">
  31. <template v-if="state.tableData.length > 0">
  32. <view class="list_item" v-for="item in state.tableData" :key="item.honorTypeId">
  33. <view class="item_name">
  34. <text class="name">{{item.honorTypeName}}</text>
  35. <view class="more_icon" @click="ShowMorePopupDialog(item.honorTypeName,item.honorTypeId,item.deleteStatus)">
  36. <uni-icons type="more-filled" style="color: #999999;font-size: 32rpx;"></uni-icons>
  37. </view>
  38. </view>
  39. <view class="item_sum">
  40. <image class="cup" src="@/static/image/icon/honor_cup.png"></image>
  41. <view class="sum">共{{item.number}}项</view>
  42. <template v-if="Number(item.reviewStatus) === 0">
  43. <image class="seal" src="@/static/image/icon/honor_seal.png"></image>
  44. <view class="audit">需审核</view>
  45. </template>
  46. </view>
  47. </view>
  48. </template>
  49. <no-data v-if="!state.isLoading && state.tableData.length == 0" />
  50. </view>
  51. </view>
  52. <custom-popup-dialog ref="popupDialogRef" :title="state.popupDialog.title" :isMaskClick="true" :showDialogClose="false" :showDialogFooter="false">
  53. <view class="popup_content">
  54. <view class="content_item" @click="AddEditHonorType('edit')">
  55. <view class="content_item_left">
  56. <image class="img" src="/static/image/icon/edit.png"></image>
  57. <text class="text">编辑</text>
  58. </view>
  59. <uni-icons class="content_item_right" type="right" style="color: #333333;font-size: 36rpx;"></uni-icons>
  60. </view>
  61. <view class="content_item" @click="DeleteHonorTypeItem">
  62. <view class="content_item_left">
  63. <image class="img" src="/static/image/icon/delete.png"></image>
  64. <text :class="['text',{'red':state.popupDelDialog.deleteStatus!=1,'disabled':state.popupDelDialog.deleteStatus==1}]">删除</text>
  65. </view>
  66. </view>
  67. </view>
  68. </custom-popup-dialog>
  69. <!-- 删除确认框 -->
  70. <popup-dialog ref="popupDelDialogRef" :showFootBorder="true" :content="state.popupDelDialog.content" @DialogConfirm="DialogDelConfirm" />
  71. </template>
  72. <script setup>
  73. import navBar from '@/components/nav-bar.vue';
  74. import noData from '@/components/no-data.vue';
  75. import customPopupDialog from '@/components/custom-popup-dialog.vue';
  76. import popupDialog from '@/components/popup-dialog.vue';
  77. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  78. import {queryHonorTypeOverView,deleteHonorType} from '@/reqApi/teacherHonor.js';
  79. import { onShow } from '@dcloudio/uni-app';
  80. import {
  81. reactive,
  82. ref,
  83. onMounted,
  84. onUnmounted,
  85. nextTick
  86. } from 'vue';
  87. const state = reactive({
  88. queryStr: '',
  89. countList:{
  90. honorCount:'',//全部荣誉
  91. reViewCount:'',//待审核
  92. overCount:'',//已完成
  93. overruleCount:''//已驳回
  94. },
  95. isLoading:true,//加载中
  96. tableData:[],
  97. popupDialog:{
  98. title:'',
  99. id:'',//荣誉id
  100. deleteStatus:0//0 可删 1 不可删
  101. },
  102. popupDelDialog:{
  103. content:''
  104. }
  105. })
  106. //提示框
  107. const popupDialogRef = ref(null);
  108. const popupDelDialogRef = ref(null);
  109. onShow(()=>{
  110. const isLoadHonorOverview = uni.getStorageSync('isLoadHonorOverview');
  111. if(isLoadHonorOverview){
  112. OnLoadData();
  113. }
  114. })
  115. onMounted(() => {
  116. OnLoadData();
  117. });
  118. onUnmounted(()=>{
  119. uni.setStorageSync('isLoadHonorOverview', false);
  120. })
  121. const OnLoadData = () => {
  122. state.isLoading = true;
  123. queryHonorTypeOverView({
  124. queryStr:state.queryStr
  125. }).then(res=>{
  126. if(res.code == 200 && res.data){
  127. const { honorCount, reViewCount, overCount, overruleCount,tableData } = res.data;
  128. state.countList.honorCount = honorCount || 0;
  129. state.countList.reViewCount = reViewCount || 0;
  130. state.countList.overCount = overCount || 0;
  131. state.countList.overruleCount = overruleCount || 0;
  132. state.tableData = tableData || [];
  133. }else{
  134. state.countList.honorCount = '';
  135. state.countList.reViewCount = '';
  136. state.countList.overCount = '';
  137. state.countList.overruleCount = '';
  138. state.tableData = [];
  139. }
  140. }).finally(()=>{
  141. state.isLoading = false;
  142. })
  143. }
  144. //搜索
  145. const CommonFilterData = (filterOptions,type) => {
  146. if(type=='search'){
  147. state.queryStr = filterOptions.searchWord;
  148. OnLoadData();
  149. }
  150. }
  151. //编辑 删除
  152. const ShowMorePopupDialog = (title,id,deleteStatus) => {
  153. state.popupDialog.title = title;
  154. state.popupDialog.id = id;
  155. state.popupDelDialog.deleteStatus = deleteStatus;
  156. popupDialogRef.value.OpenDialog('bottom');
  157. }
  158. //删除弹框
  159. const DeleteHonorTypeItem = () => {
  160. if(state.popupDelDialog.deleteStatus == 1) return false
  161. state.popupDelDialog.content = `确定要删除【${state.popupDialog.title}】吗?`;
  162. popupDelDialogRef.value.OpenDialog();
  163. }
  164. //确定删除
  165. const DialogDelConfirm = () => {
  166. deleteHonorType(state.popupDialog.id).then(res=>{
  167. if(res.code == 200){
  168. uni.showToast({
  169. title: '删除成功!',
  170. icon: 'none'
  171. });
  172. OnLoadData();
  173. }else{
  174. uni.showToast({
  175. title: res.msg,
  176. icon: 'none'
  177. });
  178. }
  179. })
  180. }
  181. //新建或编辑荣誉类型
  182. const AddEditHonorType = (type) => {
  183. const id = type=='add'?'':state.popupDialog.id;
  184. if(type=='edit'){
  185. popupDialogRef.value.CloseDialog();
  186. }
  187. uni.navigateTo({
  188. url: `/pages/teacherHonor/honorOverview/honorTypeDetail?id=${id}`
  189. });
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .count_list{
  194. width: 100%;
  195. display: flex;
  196. margin-top: 32rpx;
  197. gap: 20rpx;
  198. .count_item{
  199. display: flex;
  200. align-items: center;
  201. flex-direction: column;
  202. width: calc((100% - 60rpx) / 4);
  203. background-color: #F7FAFF;
  204. border-radius: 20rpx;
  205. border: 2rpx solid #E4E7ED;
  206. padding: 18rpx 16rpx 16rpx;
  207. height: 136rpx;
  208. box-sizing: border-box;
  209. .title{
  210. font-weight: 400;
  211. font-size: 28rpx;
  212. color: #666666;
  213. text-align: center;
  214. }
  215. .count{
  216. margin-top: 6rpx;
  217. font-weight: 600;
  218. font-size: 48rpx;
  219. color: #333333;
  220. }
  221. }
  222. }
  223. .list_title{
  224. width: 100%;
  225. display: flex;
  226. margin-top: 40rpx;
  227. justify-content: space-between;
  228. align-items: center;
  229. .title{
  230. font-weight: 500;
  231. font-size: 32rpx;
  232. color: #333333;
  233. }
  234. .add_btn{
  235. width: 204rpx;
  236. height: 72rpx;
  237. display: flex;
  238. align-items: center;
  239. justify-content: center;
  240. background-color: #2E64FA;
  241. border-radius: 8rpx;
  242. border: 2rpx solid #2E64FA;
  243. color: #FFFFFF;
  244. .btn_icon{
  245. color: #FFFFFF !important;
  246. font-size: 28rpx !important;
  247. margin-right: 8rpx;
  248. }
  249. .btn_text{
  250. font-size: 28rpx;
  251. color: #FFFFFF;
  252. line-height: 44rpx;
  253. }
  254. }
  255. }
  256. .honor_list{
  257. width: 100%;
  258. display: flex;
  259. flex-wrap: wrap;
  260. gap: 22rpx;
  261. padding-top: 22rpx;
  262. .list_item{
  263. display: flex;
  264. flex-direction: column;
  265. width: calc((100% - 22rpx) / 2);
  266. background: linear-gradient( 180deg, #EDF4FF 0%, #FFFFFF 100%);
  267. border-radius: 20rpx;
  268. border: 2rpx solid #E4E7ED;
  269. margin-top: 10rpx;
  270. padding: 24rpx;
  271. box-sizing: border-box;
  272. .item_name{
  273. display: flex;
  274. align-items: center;
  275. width: 100%;
  276. .name{
  277. font-weight: 500;
  278. font-size: 36rpx;
  279. color: #333333;
  280. margin-right: 8rpx;
  281. flex:1;
  282. white-space: nowrap;
  283. overflow: hidden;
  284. text-overflow: ellipsis;
  285. }
  286. .more_icon{
  287. display: inline-flex;
  288. align-items: center;
  289. justify-content: center;
  290. width: 32rpx;
  291. height: 32rpx;
  292. }
  293. }
  294. .item_sum{
  295. display: flex;
  296. align-items: center;
  297. flex-wrap: wrap;
  298. width: 100%;
  299. margin-top: 38rpx;
  300. .cup,.seal{
  301. width: 32rpx;
  302. height: 32rpx;
  303. margin-right: 8rpx;
  304. }
  305. .sum,.audit{
  306. font-weight: 400;
  307. font-size: 28rpx;
  308. }
  309. .sum{
  310. color: #2E64FA;
  311. margin-right: 24rpx;
  312. }
  313. .audit{
  314. color: #F56C6C;
  315. }
  316. }
  317. }
  318. }
  319. .popup_content{
  320. display: flex;
  321. width: 100%;
  322. height: 360rpx;
  323. flex-direction: column;
  324. margin-top: 8rpx;
  325. .content_item{
  326. display: flex;
  327. width: 100%;
  328. height: 88rpx;
  329. padding: 0 48rpx;
  330. box-sizing: border-box;
  331. margin-top: 16rpx;
  332. align-items: center;
  333. justify-content: space-between;
  334. .content_item_left{
  335. display: flex;
  336. height:100%;
  337. align-items: center;
  338. .img{
  339. width: 32rpx;
  340. height: 32rpx;
  341. margin-right: 16rpx;
  342. }
  343. .text{
  344. font-weight: 400;
  345. font-size: 32rpx;
  346. color: #333333;
  347. &.red{
  348. color: #F56C6C;
  349. }
  350. &.disabled{
  351. color: #bbb;
  352. }
  353. }
  354. }
  355. }
  356. }
  357. </style>