teacherDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" :title="state.pageTitle" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <view :class="['page_content',{'no_show_ft':state.pageFoot=='0'}]">
  6. <view class="row_item">
  7. <view class="row_label">荣誉类型:</view>
  8. <view class="row_value">{{state.reviewDetail?.honorTypeName}}</view>
  9. </view>
  10. <view class="row_item" v-for="item in (state.reviewDetail?.honorDataList || [])" :key="item.id">
  11. <view class="row_label">{{item?.honorDictLibName ?? ''}}:</view>
  12. <view class="row_value">{{item?.honorDictLibValue ?? ''}}</view>
  13. </view>
  14. <view class="row_item">
  15. <view class="row_label">荣誉证书:</view>
  16. <view class="row_value img_list">
  17. <!-- <view class="img_item" v-for="item in (state.reviewDetail?.honorDataCertList || [])" :key="item.id">
  18. <image class="pic" mode="aspectFit" :src="item.picUrl"></image>
  19. </view> -->
  20. <uv-upload :maxCount="state.reviewDetail?.honorDataCertList?.length || 0" :deletable="false" :fileList="state.reviewDetail?.honorDataCertList" width="240rpx" height="140rpx" multiple :previewFullImage="true">
  21. </uv-upload>
  22. </view>
  23. </view>
  24. <view class="row_item">
  25. <view class="row_label">佐证材料:</view>
  26. <view class="row_value document_list">
  27. <view class="document_item" v-for="item in (state.reviewDetail?.supportDocumentList || [])" :key="item.id">
  28. <image class="file" src="@/static/image/icon/file.png"></image>
  29. <view class="file_name">
  30. <view class="name">{{item.documentName}}</view>
  31. <view class="file_size_date">
  32. <view class="file_size">{{item.fileSize}}</view>
  33. <view class="file_date">{{item.createdAt}}</view>
  34. </view>
  35. </view>
  36. <!-- #ifdef APP-PLUS -->
  37. <!-- app端处理 -->
  38. <template v-if="['word','excel','pdf','txt'].includes(getFileTypeBySuffix(item.fileNameSuffix || ''))">
  39. <cjx-previewOffice :value="item.documentUrl" :name="item.documentName" :type="getFileTypeBySuffix(item?.fileNameSuffix || '')">
  40. <view class="preview_btn" @click="OpenPreviewFileDialog(item)">预览</view>
  41. </cjx-previewOffice>
  42. </template>
  43. <view v-else class="preview_btn" @click="OpenPreviewFileDialog(item)">预览</view>
  44. <!-- #endif -->
  45. <!-- #ifndef APP-PLUS -->
  46. <!-- 不包含app端 -->
  47. <view class="preview_btn" @click="OpenPreviewFileDialog(item)">预览</view>
  48. <!-- #endif -->
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="page_foot" v-if="state.pageFoot=='1'">
  54. <button v-if="state.reviewDetail?.honorStatus != 2" class="btn btn_reject" type="primary" plain="true" :loading="state.loading" @click="HandleRejectHonor">驳回</button>
  55. <button v-if="state.reviewDetail?.honorStatus != 1" class="btn btn_pass" type="primary" :loading="state.loading" @click="HandlePassHonor">通过</button>
  56. </view>
  57. <customPopupDialog ref="popupDelDialogRef" title="驳回" dialogWidth="702" :isMaskClick="false" :showDialogClose="false" @DialogConfirm="DialogConfirm">
  58. <view class="dialog_content_input">
  59. <view class="dialog_desc">请填写驳回原因方便教师修改</view>
  60. <uni-easyinput type="textarea" v-model="state.rejectReason" :style="state.easyinputStyle" placeholderStyle="font-weight: 400;font-size: 28rpx;color: #999999;" placeholder="请输入驳回原因…"></uni-easyinput>
  61. </view>
  62. </customPopupDialog>
  63. <!-- 图片 视频预览 -->
  64. <popupPreviewFile ref="imgVideoPreview" :fileType="state.previewPopup.fileType" :fileName="state.previewPopup.fileName" :filePath="state.previewPopup.filePath" @ToDownloadFile="ToDownloadFile"></popupPreviewFile>
  65. <!-- 默认指H5端 此插件只支持h5 PDF、Word、Excel、PPTX、TXT预览-->
  66. <!-- #ifdef H5 -->
  67. <wg-h5-preview-file ref="webPreviewFile" />
  68. <!-- #endif -->
  69. <!-- 文件、图片下载 -->
  70. <ss-download ref="ssdownload"></ss-download>
  71. </view>
  72. </template>
  73. <script setup>
  74. import navBar from '@/components/navBar.vue';
  75. import uvUpload from '@/uni_modules/uv-upload/components/uv-upload/uv-upload.vue';
  76. import customPopupDialog from '@/components/customPopupDialog.vue';
  77. import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue';
  78. import ssDownload from '@/uni_modules/ss-download/components/ss-download/ss-download.vue';
  79. import popupPreviewFile from '@/components/popupPreviewFile.vue';//图片 音视频 zip等预览
  80. // #ifdef H5
  81. import wgH5PreviewFile from '@/components/wg-h5-preview-file/wg-h5-preview-file.vue';//web端文件预览 'word','excel','pptx','pdf','txt'
  82. // #endif
  83. // #ifdef APP-PLUS
  84. import cjxPreviewOffice from '@/uni_modules/cjx-previewOffice/components/cjx-previewOffice/cjx-previewOffice.vue';//APP端文件预览 'word','excel','pdf','txt'
  85. // #endif
  86. import {queryReviewDetail,audioHonorData} from '@/reqApi/teacherHonor.js';
  87. import {
  88. reactive,
  89. ref,
  90. nextTick
  91. } from 'vue';
  92. import { getFileTypeBySuffix } from '@/common/common.js';
  93. import { onLoad } from '@dcloudio/uni-app';
  94. const state = reactive({
  95. id:'',//id
  96. pageTitle:'',
  97. pageFoot:'0',
  98. loading:false,
  99. reviewDetail:{},
  100. rejectReason:'',//驳回原因
  101. easyinputStyle:{
  102. color: '#303133',
  103. borderColor: '#E9E9E9'
  104. },
  105. previewPopup:{//文件预览弹框
  106. fileType:'',
  107. filePath:'',
  108. fileName:''
  109. }
  110. })
  111. const popupDelDialogRef = ref(null);
  112. const ssdownload = ref(null);
  113. const imgVideoPreview = ref(null);//图片 视频
  114. const webPreviewFile = ref(null);//web端文件预览
  115. const appPreviewOfficeRef = ref(null);//APP端文件预览
  116. onLoad((option) => {
  117. state.id = option.id;
  118. state.pageTitle = option.pageTitle;
  119. state.pageFoot = option.pageFoot;//是否显示页脚
  120. uni.setStorageSync('isLoadHonorAuditList', false);
  121. GetReviewDetail();
  122. })
  123. //查询荣誉审核资质信息详情数据接口
  124. const GetReviewDetail = () => {
  125. queryReviewDetail(state.id).then(res=>{
  126. if(res.code == 200){
  127. const resdata = res.data || null;
  128. const honorDataCertList = resdata?.honorDataCertList || [];
  129. resdata.honorDataCertList = honorDataCertList.map(item=>({
  130. ...item,
  131. url:item.picUrl
  132. }))
  133. const supportDocumentList = resdata?.supportDocumentList || [];
  134. resdata.supportDocumentList = supportDocumentList.map(item=>{
  135. const fileNameSuffix = GetFileNameSuffix(item.documentName);
  136. return{
  137. ...item,
  138. fileNameSuffix
  139. }
  140. })
  141. state.reviewDetail = resdata;
  142. }
  143. })
  144. }
  145. //获取文件后缀名称
  146. const GetFileNameSuffix = (documentName) => {
  147. const documentNameArr = documentName?.split('.') || [];
  148. const lens = documentNameArr.length;
  149. const fileNameSuffix = lens?documentNameArr[lens - 1]:'';
  150. return fileNameSuffix
  151. }
  152. //通过
  153. const HandlePassHonor = () => {
  154. HandleRejectOrPass(1)
  155. }
  156. //驳回
  157. const HandleRejectHonor = () => {
  158. popupDelDialogRef.value.OpenDialog();
  159. }
  160. //驳回 确定按钮
  161. const DialogConfirm = () => {
  162. if(state.rejectReason == '' || state.rejectReason == null){
  163. uni.showToast({
  164. title: '请填写驳回原因!',
  165. icon: 'none'
  166. })
  167. return false
  168. }
  169. HandleRejectOrPass(2)
  170. }
  171. const HandleRejectOrPass = (status) => {
  172. const params = {
  173. honorDataId: state.id,
  174. honorStatus: status
  175. }
  176. if(status == 2){
  177. params.content = state.rejectReason;
  178. }
  179. audioHonorData(params).then(res=>{
  180. if(res.code == 200){
  181. uni.showToast({
  182. title: status == 2?'驳回成功!':'审核通过!',
  183. icon: 'none'
  184. })
  185. uni.setStorageSync('isLoadHonorAuditList', true);//刷新荣誉审核列表
  186. GoBack();
  187. }
  188. })
  189. }
  190. //预览
  191. const OpenPreviewFileDialog = (item) => {
  192. const fileType = getFileTypeBySuffix(item.fileNameSuffix);
  193. console.log(fileType,899)
  194. state.previewPopup.fileType = fileType?fileType:item.fileNameSuffix;
  195. state.previewPopup.filePath = item.documentUrl;
  196. state.previewPopup.fileName = item.documentName;
  197. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  198. // #ifdef H5
  199. nextTick(()=>{//h5文件预览
  200. webPreviewFile.value && webPreviewFile.value.preview({
  201. url: item.documentUrl,
  202. type: fileType
  203. });
  204. })
  205. // #endif
  206. // #ifdef APP-PLUS
  207. if(fileType == 'pptx'){
  208. imgVideoPreview.value.OpenDialog();
  209. }
  210. // #endif
  211. }else{
  212. imgVideoPreview.value.OpenDialog();
  213. }
  214. }
  215. //下载
  216. const ToDownloadFile = (item) => {
  217. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  218. let type = '';
  219. if(fileType == 'image'){
  220. type = '1';//1:图片 2 文档
  221. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  222. type = '2';
  223. }else if(fileType == 'video'){
  224. type = '3';
  225. }else {
  226. type = '';
  227. }
  228. ssdownload?.value?.toDownload({
  229. type:type,
  230. src:item.filePath,
  231. fileName:item.fileName
  232. });
  233. }
  234. const GoBack = () => {
  235. uni.navigateBack({
  236. delta: 1
  237. });
  238. }
  239. </script>
  240. <style lang="scss" scoped>
  241. .page_body{
  242. height: 100%;
  243. min-height: auto;
  244. }
  245. .page_content{
  246. height: calc(100% - 290rpx);
  247. &.no_show_ft{
  248. height: calc(100% - 96rpx);
  249. }
  250. flex-direction: column;
  251. flex-wrap: initial;
  252. overflow: auto;
  253. .row_item{
  254. display: flex;
  255. width: 100%;
  256. padding: 32rpx 0;
  257. border-bottom: 2rpx solid #F3F3F3;
  258. .row_label{
  259. font-weight: 400;
  260. font-size: 28rpx;
  261. color: #666666;
  262. flex-shrink: 0;
  263. margin-right: 10rpx;
  264. }
  265. .row_value{
  266. flex: 1;
  267. font-weight: 400;
  268. font-size: 28rpx;
  269. color: #333333;
  270. text-align: right;
  271. display: flex;
  272. justify-content: flex-end;
  273. word-break: break-all;
  274. flex-wrap: wrap;
  275. &.img_list{
  276. // gap: 32rpx 24rpx;
  277. // .img_item{
  278. // width: 240rpx;
  279. // height: 140rpx;
  280. // background-color: #FFFFFF;
  281. // border-radius: 12rpx;
  282. // border: 2rpx solid #CED1D8;
  283. // display: inline-flex;
  284. // align-items: center;
  285. // justify-content: center;
  286. // .pic{
  287. // width: 240rpx;
  288. // height: 140rpx;
  289. // }
  290. // }
  291. :deep(.uv-upload__wrap){
  292. gap: 24rpx 32rpx;
  293. .uv-upload__wrap__preview{
  294. background-color: #FFFFFF;
  295. border-radius: 20rpx;
  296. border: 2rpx solid #CED1D8;
  297. box-sizing: border-box;
  298. margin: 0;
  299. .uv-upload__deletable{
  300. top:10rpx;
  301. right: 10rpx;
  302. background-color: transparent;
  303. height: 32rpx;
  304. width: 32rpx;
  305. border: 2rpx solid #999999;
  306. border-radius: 50%;
  307. .uvicon-close{
  308. color:#999999 !important;
  309. font-size: 11rpx !important;
  310. }
  311. }
  312. .uv-upload__deletable__icon{
  313. transform: scale(1);
  314. top:50%;
  315. right: 50%;
  316. transform: translate(50%, -50%);
  317. }
  318. .uv-upload__success{
  319. border-width: 20rpx;
  320. }
  321. }
  322. }
  323. }
  324. &.document_list{
  325. gap: 24rpx;
  326. .document_item{
  327. width: 100%;
  328. padding: 20rpx 0 18rpx 15rpx;
  329. display: flex;
  330. background-color: #FFFFFF;
  331. border-radius: 20rpx;
  332. border: 2rpx solid #EBEEF5;
  333. .file{
  334. width: 80rpx;
  335. height: 80rpx;
  336. margin-right: 16rpx;
  337. flex-shrink: 0;
  338. }
  339. .file_name{
  340. flex: 1;
  341. display: flex;
  342. flex-direction: column;
  343. .name{
  344. font-weight: 500;
  345. font-size: 28rpx;
  346. text-align: left;
  347. color: #333333;
  348. }
  349. .file_size_date{
  350. display: flex;
  351. width: 100%;
  352. text-align: left;
  353. font-weight: 400;
  354. font-size: 24rpx;
  355. color: #999999;
  356. margin-top: 8rpx;
  357. gap: 20rpx;
  358. .file_size{
  359. white-space: nowrap;
  360. }
  361. .file_date{
  362. white-space: nowrap;
  363. }
  364. }
  365. }
  366. :deep(.container){
  367. width: auto;
  368. .file_content{
  369. width: auto;
  370. }
  371. }
  372. .preview_btn{
  373. width: 96rpx;
  374. box-sizing: border-box;
  375. text-align: left;
  376. font-weight: 400;
  377. font-size: 28rpx;
  378. color: #2E64FA;
  379. padding:20rpx 0 0 16rpx;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. .page_foot{
  387. position: fixed;
  388. left:0;
  389. right: 0;
  390. bottom: 0;
  391. padding: 40rpx 24rpx 38rpx 24rpx;
  392. box-shadow: inset 0px 2rpx 0px 0px #F3F3F3;
  393. background-color:#FFFFFF;
  394. gap: 30rpx;
  395. display: flex;
  396. .btn{
  397. height: 90rpx;
  398. display: flex;
  399. justify-content: center;
  400. align-items: center;
  401. border-radius: 8rpx;
  402. font-weight: 500;
  403. font-size: 28rpx;
  404. flex: 1;
  405. box-sizing: border-box;
  406. }
  407. .btn_reject{
  408. border: 2rpx solid #F56C6C;
  409. color: #F56C6C;
  410. }
  411. .btn_pass{
  412. background-color: #2E64FA !important;
  413. color: #FFFFFF;
  414. }
  415. }
  416. .dialog_content_input{
  417. width: 100%;
  418. display: flex;
  419. flex-direction: column;
  420. box-sizing: border-box;
  421. .dialog_desc{
  422. font-weight: 400;
  423. font-size: 32rpx;
  424. color: #303133;
  425. }
  426. :deep(.uni-easyinput){
  427. margin-top: 20rpx;
  428. font-size: 28rpx;
  429. .is-input-border{
  430. border-radius: 8rpx;
  431. border-color: #E9E9E9 !important;
  432. }
  433. .uni-easyinput__content-textarea{
  434. height: 400rpx;
  435. min-height: 400rpx;
  436. font-size: 28rpx;
  437. margin:20rpx 24rpx 20rpx 14rpx;
  438. }
  439. .input-padding{
  440. padding-left: 10rpx;
  441. }
  442. }
  443. }
  444. </style>