index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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" @DialogConfirm="DialogConfirm">
  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 {
  80. reactive,
  81. ref,
  82. onMounted,
  83. nextTick
  84. } from 'vue';
  85. const state = reactive({
  86. queryStr: '',
  87. countList:{
  88. honorCount:'',//全部荣誉
  89. reViewCount:'',//待审核
  90. overCount:'',//已完成
  91. overruleCount:''//已驳回
  92. },
  93. isLoading:true,//加载中
  94. tableData:[],
  95. popupDialog:{
  96. title:'',
  97. id:'',//荣誉id
  98. deleteStatus:0//0 可删 1 不可删
  99. },
  100. popupDelDialog:{
  101. content:''
  102. }
  103. })
  104. //提示框
  105. const popupDialogRef = ref(null);
  106. const popupDelDialogRef = ref(null);
  107. onMounted(() => {
  108. OnLoadData();
  109. });
  110. const OnLoadData = () => {
  111. state.isLoading = true;
  112. queryHonorTypeOverView({
  113. queryStr:state.queryStr
  114. }).then(res=>{
  115. if(res.code == 200 && res.data){
  116. const { honorCount, reViewCount, overCount, overruleCount,tableData } = res.data;
  117. state.countList.honorCount = honorCount || 0;
  118. state.countList.reViewCount = reViewCount || 0;
  119. state.countList.overCount = overCount || 0;
  120. state.countList.overruleCount = overruleCount || 0;
  121. state.tableData = tableData || [];
  122. }else{
  123. state.countList.honorCount = '';
  124. state.countList.reViewCount = '';
  125. state.countList.overCount = '';
  126. state.countList.overruleCount = '';
  127. state.tableData = [];
  128. }
  129. }).finally(()=>{
  130. state.isLoading = false;
  131. })
  132. }
  133. //搜索
  134. const CommonFilterData = (searchWord,filterPicker,tabsSelected,type) => {
  135. if(type=='search'){
  136. state.queryStr = searchWord;
  137. OnLoadData();
  138. }
  139. }
  140. //编辑 删除
  141. const ShowMorePopupDialog = (title,id,deleteStatus) => {
  142. state.popupDialog.title = title;
  143. state.popupDialog.id = id;
  144. state.popupDelDialog.deleteStatus = deleteStatus;
  145. popupDialogRef.value.OpenDialog('bottom');
  146. }
  147. //删除弹框
  148. const DeleteHonorTypeItem = () => {
  149. if(state.popupDelDialog.deleteStatus == 1) return false
  150. state.popupDelDialog.content = `确定要删除【${state.popupDialog.title}】吗?`;
  151. popupDelDialogRef.value.OpenDialog();
  152. }
  153. //确定删除
  154. const DialogDelConfirm = () => {
  155. deleteHonorType(state.popupDialog.id).then(res=>{
  156. if(res.code == 200){
  157. uni.showToast({
  158. title: '删除成功!',
  159. icon: 'none'
  160. });
  161. OnLoadData();
  162. }else{
  163. uni.showToast({
  164. title: res.msg,
  165. icon: 'none'
  166. });
  167. }
  168. })
  169. }
  170. //新建或编辑荣誉类型
  171. const AddEditHonorType = (type) => {
  172. const id = type=='add'?'':state.popupDialog.id;
  173. uni.navigateTo({
  174. url: `/pages/teacherHonor/honorOverview/honorTypeDetail?id=${id}`
  175. });
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. .count_list{
  180. width: 100%;
  181. display: flex;
  182. margin-top: 32rpx;
  183. gap: 20rpx;
  184. .count_item{
  185. display: flex;
  186. align-items: center;
  187. flex-direction: column;
  188. width: calc((100% - 60rpx) / 4);
  189. background-color: #F7FAFF;
  190. border-radius: 20rpx;
  191. border: 2rpx solid #E4E7ED;
  192. padding: 18rpx 16rpx 16rpx;
  193. height: 136rpx;
  194. box-sizing: border-box;
  195. .title{
  196. font-weight: 400;
  197. font-size: 28rpx;
  198. color: #666666;
  199. text-align: center;
  200. }
  201. .count{
  202. margin-top: 6rpx;
  203. font-weight: 600;
  204. font-size: 48rpx;
  205. color: #333333;
  206. }
  207. }
  208. }
  209. .list_title{
  210. width: 100%;
  211. display: flex;
  212. margin-top: 40rpx;
  213. justify-content: space-between;
  214. align-items: center;
  215. .title{
  216. font-weight: 500;
  217. font-size: 32rpx;
  218. color: #333333;
  219. }
  220. .add_btn{
  221. width: 204rpx;
  222. height: 72rpx;
  223. display: flex;
  224. align-items: center;
  225. justify-content: center;
  226. background-color: #2E64FA;
  227. border-radius: 8rpx;
  228. border: 2rpx solid #2E64FA;
  229. color: #FFFFFF;
  230. .btn_icon{
  231. color: #FFFFFF !important;
  232. font-size: 28rpx !important;
  233. margin-right: 8rpx;
  234. }
  235. .btn_text{
  236. font-size: 28rpx;
  237. color: #FFFFFF;
  238. line-height: 44rpx;
  239. }
  240. }
  241. }
  242. .honor_list{
  243. width: 100%;
  244. display: flex;
  245. flex-wrap: wrap;
  246. gap: 22rpx;
  247. padding-top: 22rpx;
  248. .list_item{
  249. display: flex;
  250. flex-direction: column;
  251. width: calc((100% - 22rpx) / 2);
  252. background: linear-gradient( 180deg, #EDF4FF 0%, #FFFFFF 100%);
  253. border-radius: 20rpx;
  254. border: 2rpx solid #E4E7ED;
  255. margin-top: 10rpx;
  256. padding: 24rpx;
  257. box-sizing: border-box;
  258. .item_name{
  259. display: flex;
  260. align-items: center;
  261. width: 100%;
  262. .name{
  263. font-weight: 500;
  264. font-size: 36rpx;
  265. color: #333333;
  266. margin-right: 8rpx;
  267. flex:1;
  268. white-space: nowrap;
  269. overflow: hidden;
  270. text-overflow: ellipsis;
  271. }
  272. .more_icon{
  273. display: inline-flex;
  274. align-items: center;
  275. justify-content: center;
  276. width: 32rpx;
  277. height: 32rpx;
  278. }
  279. }
  280. .item_sum{
  281. display: flex;
  282. align-items: center;
  283. flex-wrap: wrap;
  284. width: 100%;
  285. margin-top: 38rpx;
  286. .cup,.seal{
  287. width: 32rpx;
  288. height: 32rpx;
  289. margin-right: 8rpx;
  290. }
  291. .sum,.audit{
  292. font-weight: 400;
  293. font-size: 28rpx;
  294. }
  295. .sum{
  296. color: #2E64FA;
  297. margin-right: 24rpx;
  298. }
  299. .audit{
  300. color: #F56C6C;
  301. }
  302. }
  303. }
  304. }
  305. .popup_content{
  306. display: flex;
  307. width: 100%;
  308. height: 360rpx;
  309. flex-direction: column;
  310. margin-top: 8rpx;
  311. .content_item{
  312. display: flex;
  313. width: 100%;
  314. height: 88rpx;
  315. padding: 0 48rpx;
  316. box-sizing: border-box;
  317. margin-top: 16rpx;
  318. align-items: center;
  319. justify-content: space-between;
  320. .content_item_left{
  321. display: flex;
  322. height:100%;
  323. align-items: center;
  324. .img{
  325. width: 32rpx;
  326. height: 32rpx;
  327. margin-right: 16rpx;
  328. }
  329. .text{
  330. font-weight: 400;
  331. font-size: 32rpx;
  332. color: #333333;
  333. &.red{
  334. color: #F56C6C;
  335. }
  336. &.disabled{
  337. color: #bbb;
  338. }
  339. }
  340. }
  341. }
  342. }
  343. </style>