teacherDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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?.documentName?.split('.')?.[1] || ''))">
  39. <cjx-previewOffice :value="item.documentUrl" :name="item.documentName" :type="getFileTypeBySuffix(item?.documentName?.split('.')?.[1] || '')">
  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. state.reviewDetail = resdata;
  134. }
  135. })
  136. }
  137. //通过
  138. const HandlePassHonor = () => {
  139. HandleRejectOrPass(1)
  140. }
  141. //驳回
  142. const HandleRejectHonor = () => {
  143. popupDelDialogRef.value.OpenDialog();
  144. }
  145. //驳回 确定按钮
  146. const DialogConfirm = () => {
  147. if(state.rejectReason == '' || state.rejectReason == null){
  148. uni.showToast({
  149. title: '请填写驳回原因!',
  150. icon: 'none'
  151. })
  152. return false
  153. }
  154. HandleRejectOrPass(2)
  155. }
  156. const HandleRejectOrPass = (status) => {
  157. const params = {
  158. honorDataId: state.id,
  159. honorStatus: status
  160. }
  161. if(status == 2){
  162. params.content = state.rejectReason;
  163. }
  164. audioHonorData(params).then(res=>{
  165. if(res.code == 200){
  166. uni.showToast({
  167. title: status == 2?'驳回成功!':'审核通过!',
  168. icon: 'none'
  169. })
  170. uni.setStorageSync('isLoadHonorAuditList', true);//刷新荣誉审核列表
  171. GoBack();
  172. }
  173. })
  174. }
  175. //预览
  176. const OpenPreviewFileDialog = (item) => {
  177. const fileNameSuffix = item?.documentName?.split('.')?.[1] || '';
  178. const fileType = getFileTypeBySuffix(fileNameSuffix);
  179. console.log(fileType,899)
  180. state.previewPopup.fileType = fileType?fileType:fileNameSuffix;
  181. state.previewPopup.filePath = item.documentUrl;
  182. state.previewPopup.fileName = item.documentName;
  183. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  184. // #ifdef H5
  185. nextTick(()=>{//h5文件预览
  186. webPreviewFile.value && webPreviewFile.value.preview({
  187. url: item.documentUrl,
  188. type: fileType
  189. });
  190. })
  191. // #endif
  192. // #ifdef APP-PLUS
  193. if(fileType == 'pptx'){
  194. imgVideoPreview.value.OpenDialog();
  195. }
  196. // #endif
  197. }else{
  198. imgVideoPreview.value.OpenDialog();
  199. }
  200. }
  201. //下载
  202. const ToDownloadFile = (item) => {
  203. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  204. let type = '';
  205. if(fileType == 'image'){
  206. type = '1';//1:图片 2 文档
  207. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  208. type = '2';
  209. }else if(fileType == 'video'){
  210. type = '3';
  211. }else {
  212. type = '';
  213. }
  214. ssdownload?.value?.toDownload({
  215. type:type,
  216. src:item.filePath,
  217. fileName:item.fileName
  218. });
  219. }
  220. const GoBack = () => {
  221. uni.navigateBack({
  222. delta: 1
  223. });
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. .page_body{
  228. height: 100%;
  229. min-height: auto;
  230. }
  231. .page_content{
  232. height: calc(100% - 290rpx);
  233. &.no_show_ft{
  234. height: calc(100% - 96rpx);
  235. }
  236. flex-direction: column;
  237. flex-wrap: initial;
  238. overflow: auto;
  239. .row_item{
  240. display: flex;
  241. width: 100%;
  242. padding: 32rpx 0;
  243. border-bottom: 2rpx solid #F3F3F3;
  244. .row_label{
  245. font-weight: 400;
  246. font-size: 28rpx;
  247. color: #666666;
  248. flex-shrink: 0;
  249. margin-right: 10rpx;
  250. }
  251. .row_value{
  252. flex: 1;
  253. font-weight: 400;
  254. font-size: 28rpx;
  255. color: #333333;
  256. text-align: right;
  257. display: flex;
  258. justify-content: flex-end;
  259. word-break: break-all;
  260. flex-wrap: wrap;
  261. &.img_list{
  262. // gap: 32rpx 24rpx;
  263. // .img_item{
  264. // width: 240rpx;
  265. // height: 140rpx;
  266. // background-color: #FFFFFF;
  267. // border-radius: 12rpx;
  268. // border: 2rpx solid #CED1D8;
  269. // display: inline-flex;
  270. // align-items: center;
  271. // justify-content: center;
  272. // .pic{
  273. // width: 240rpx;
  274. // height: 140rpx;
  275. // }
  276. // }
  277. :deep(.uv-upload__wrap){
  278. gap: 24rpx 32rpx;
  279. .uv-upload__wrap__preview{
  280. background-color: #FFFFFF;
  281. border-radius: 20rpx;
  282. border: 2rpx solid #CED1D8;
  283. box-sizing: border-box;
  284. margin: 0;
  285. .uv-upload__deletable{
  286. top:10rpx;
  287. right: 10rpx;
  288. background-color: transparent;
  289. height: 32rpx;
  290. width: 32rpx;
  291. border: 2rpx solid #999999;
  292. border-radius: 50%;
  293. .uvicon-close{
  294. color:#999999 !important;
  295. font-size: 11rpx !important;
  296. }
  297. }
  298. .uv-upload__deletable__icon{
  299. transform: scale(1);
  300. top:50%;
  301. right: 50%;
  302. transform: translate(50%, -50%);
  303. }
  304. .uv-upload__success{
  305. border-width: 20rpx;
  306. }
  307. }
  308. }
  309. }
  310. &.document_list{
  311. gap: 24rpx;
  312. .document_item{
  313. width: 100%;
  314. padding: 20rpx 0 18rpx 15rpx;
  315. display: flex;
  316. background-color: #FFFFFF;
  317. border-radius: 20rpx;
  318. border: 2rpx solid #EBEEF5;
  319. .file{
  320. width: 80rpx;
  321. height: 80rpx;
  322. margin-right: 16rpx;
  323. flex-shrink: 0;
  324. }
  325. .file_name{
  326. flex: 1;
  327. display: flex;
  328. flex-direction: column;
  329. .name{
  330. font-weight: 500;
  331. font-size: 28rpx;
  332. text-align: left;
  333. color: #333333;
  334. }
  335. .file_size_date{
  336. display: flex;
  337. width: 100%;
  338. text-align: left;
  339. font-weight: 400;
  340. font-size: 24rpx;
  341. color: #999999;
  342. margin-top: 8rpx;
  343. gap: 20rpx;
  344. .file_size{
  345. white-space: nowrap;
  346. }
  347. .file_date{
  348. white-space: nowrap;
  349. }
  350. }
  351. }
  352. :deep(.container){
  353. width: auto;
  354. .file_content{
  355. width: auto;
  356. }
  357. }
  358. .preview_btn{
  359. width: 96rpx;
  360. box-sizing: border-box;
  361. text-align: left;
  362. font-weight: 400;
  363. font-size: 28rpx;
  364. color: #2E64FA;
  365. padding:20rpx 0 0 16rpx;
  366. }
  367. }
  368. }
  369. }
  370. }
  371. }
  372. .page_foot{
  373. position: fixed;
  374. left:0;
  375. right: 0;
  376. bottom: 0;
  377. padding: 40rpx 24rpx 38rpx 24rpx;
  378. box-shadow: inset 0px 2rpx 0px 0px #F3F3F3;
  379. background-color:#FFFFFF;
  380. gap: 30rpx;
  381. display: flex;
  382. .btn{
  383. height: 90rpx;
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. border-radius: 8rpx;
  388. font-weight: 500;
  389. font-size: 28rpx;
  390. flex: 1;
  391. box-sizing: border-box;
  392. }
  393. .btn_reject{
  394. border: 2rpx solid #F56C6C;
  395. color: #F56C6C;
  396. }
  397. .btn_pass{
  398. background-color: #2E64FA !important;
  399. color: #FFFFFF;
  400. }
  401. }
  402. .dialog_content_input{
  403. width: 100%;
  404. display: flex;
  405. flex-direction: column;
  406. box-sizing: border-box;
  407. .dialog_desc{
  408. font-weight: 400;
  409. font-size: 32rpx;
  410. color: #303133;
  411. }
  412. :deep(.uni-easyinput){
  413. margin-top: 20rpx;
  414. font-size: 28rpx;
  415. .is-input-border{
  416. border-radius: 8rpx;
  417. border-color: #E9E9E9 !important;
  418. }
  419. .uni-easyinput__content-textarea{
  420. height: 400rpx;
  421. min-height: 400rpx;
  422. font-size: 28rpx;
  423. margin:20rpx 24rpx 20rpx 14rpx;
  424. }
  425. .input-padding{
  426. padding-left: 10rpx;
  427. }
  428. }
  429. }
  430. </style>