honorDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" :title="state.honorName" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content">
  6. <view class="row_item">
  7. <view class="row_label">荣誉类型:</view>
  8. <view class="row_value">{{state.detail?.honorTypeName}}</view>
  9. </view>
  10. <view class="row_item" v-for="item in (state.detail?.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.detail?.honorDataCertList || [])" :key="item.id">
  18. <image class="pic" mode="aspectFit" :src="item.picUrl"></image>
  19. </view> -->
  20. <uv-upload :maxCount="state.detail?.honorDataCertList?.length || 0" :deletable="false" :fileList="state.detail?.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.detail?.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>
  54. <!-- 图片 视频预览 -->
  55. <popupPreviewFile ref="imgVideoPreview" :fileType="state.previewPopup.fileType" :fileName="state.previewPopup.fileName" :filePath="state.previewPopup.filePath" @ToDownloadFile="ToDownloadFile"></popupPreviewFile>
  56. <!-- 默认指H5端 此插件只支持h5 PDF、Word、Excel、PPTX、TXT预览-->
  57. <!-- #ifdef H5 -->
  58. <wg-h5-preview-file ref="webPreviewFile" />
  59. <!-- #endif -->
  60. <!-- 文件、图片下载 -->
  61. <ss-download ref="ssdownload"></ss-download>
  62. </template>
  63. <script setup>
  64. import navBar from '@/components/navBar.vue';
  65. import uvUpload from '@/uni_modules/uv-upload/components/uv-upload/uv-upload.vue';
  66. import ssDownload from '@/uni_modules/ss-download/components/ss-download/ss-download.vue';
  67. import popupPreviewFile from '@/components/popupPreviewFile.vue';//图片 音视频 zip等预览
  68. // #ifdef H5
  69. import wgH5PreviewFile from '@/components/wg-h5-preview-file/wg-h5-preview-file.vue';//web端文件预览 'word','excel','pptx','pdf','txt'
  70. // #endif
  71. // #ifdef APP-PLUS
  72. import cjxPreviewOffice from '@/uni_modules/cjx-previewOffice/components/cjx-previewOffice/cjx-previewOffice.vue';//APP端文件预览 'word','excel','pdf','txt'
  73. // #endif
  74. import {queryHonorTeacherDetail} from '@/reqApi/teacherHonor.js';
  75. import { getFileTypeBySuffix } from '@/common/common.js';
  76. import {
  77. reactive,
  78. ref,
  79. nextTick
  80. } from 'vue';
  81. import { onLoad } from '@dcloudio/uni-app';
  82. const state = reactive({
  83. id:'',//id
  84. honorName:'',
  85. loading:false,
  86. detail:{},
  87. previewPopup:{//文件预览弹框
  88. fileType:'',
  89. filePath:'',
  90. fileName:''
  91. }
  92. })
  93. const popupDelDialogRef = ref(null);
  94. const ssdownload = ref(null);
  95. const imgVideoPreview = ref(null);//图片 视频
  96. const webPreviewFile = ref(null);//web端文件预览
  97. const appPreviewOfficeRef = ref(null);//APP端文件预览
  98. onLoad((option) => {
  99. state.id = option.id;
  100. state.honorName = decodeURIComponent(option.honorName);
  101. GetHonorTeacherDetail();
  102. })
  103. //查询荣誉审核资质信息详情数据接口
  104. const GetHonorTeacherDetail = () => {
  105. queryHonorTeacherDetail(state.id).then(res=>{
  106. if(res.code == 200){
  107. const resdata = res.data || null;
  108. const honorDataCertList = resdata?.honorDataCertList || [];
  109. resdata.honorDataCertList = honorDataCertList.map(item=>({
  110. ...item,
  111. url:item.picUrl
  112. }))
  113. state.detail = resdata;
  114. }
  115. })
  116. }
  117. //预览
  118. const OpenPreviewFileDialog = (item) => {
  119. const fileNameSuffix = item?.documentName?.split('.')?.[1] || '';
  120. const fileType = getFileTypeBySuffix(fileNameSuffix);
  121. console.log(fileType,899)
  122. state.previewPopup.fileType = fileType?fileType:fileNameSuffix;
  123. state.previewPopup.filePath = item.documentUrl;
  124. state.previewPopup.fileName = item.documentName;
  125. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  126. // #ifdef H5
  127. nextTick(()=>{//h5文件预览
  128. webPreviewFile.value && webPreviewFile.value.preview({
  129. url: item.documentUrl,
  130. type: fileType
  131. });
  132. })
  133. // #endif
  134. // #ifdef APP-PLUS
  135. if(fileType == 'pptx'){
  136. imgVideoPreview.value.OpenDialog();
  137. }
  138. // #endif
  139. }else{
  140. imgVideoPreview.value.OpenDialog();
  141. }
  142. }
  143. //下载
  144. const ToDownloadFile = (item) => {
  145. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  146. let type = '';
  147. if(fileType == 'image'){
  148. type = '1';//1:图片 2 文档
  149. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  150. type = '2';
  151. }else if(fileType == 'video'){
  152. type = '3';
  153. }else {
  154. type = '';
  155. }
  156. ssdownload?.value?.toDownload({
  157. type:type,
  158. src:item.filePath,
  159. fileName:item.fileName
  160. });
  161. }
  162. const GoBack = () => {
  163. uni.navigateBack({
  164. delta: 1
  165. });
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .page_body{
  170. height: 100%;
  171. min-height: auto;
  172. }
  173. .page_content{
  174. height: calc(100% - 96rpx);
  175. flex-direction: column;
  176. flex-wrap: initial;
  177. overflow: auto;
  178. .row_item{
  179. display: flex;
  180. width: 100%;
  181. padding: 32rpx 0;
  182. border-bottom: 2rpx solid #F3F3F3;
  183. .row_label{
  184. font-weight: 400;
  185. font-size: 28rpx;
  186. color: #666666;
  187. flex-shrink: 0;
  188. margin-right: 10rpx;
  189. }
  190. .row_value{
  191. flex: 1;
  192. font-weight: 400;
  193. font-size: 28rpx;
  194. color: #333333;
  195. text-align: right;
  196. display: flex;
  197. justify-content: flex-end;
  198. word-break: break-all;
  199. flex-wrap: wrap;
  200. &.img_list{
  201. gap: 32rpx 24rpx;
  202. .img_item{
  203. width: 240rpx;
  204. height: 140rpx;
  205. background-color: #FFFFFF;
  206. border-radius: 12rpx;
  207. border: 2rpx solid #CED1D8;
  208. display: inline-flex;
  209. align-items: center;
  210. justify-content: center;
  211. .pic{
  212. width: 240rpx;
  213. height: 140rpx;
  214. }
  215. }
  216. }
  217. &.document_list{
  218. gap: 24rpx;
  219. .document_item{
  220. width: 100%;
  221. padding: 20rpx 0 18rpx 15rpx;
  222. display: flex;
  223. background-color: #FFFFFF;
  224. border-radius: 20rpx;
  225. border: 2rpx solid #EBEEF5;
  226. .file{
  227. width: 80rpx;
  228. height: 80rpx;
  229. margin-right: 16rpx;
  230. flex-shrink: 0;
  231. }
  232. .file_name{
  233. flex: 1;
  234. display: flex;
  235. flex-direction: column;
  236. .name{
  237. font-weight: 500;
  238. font-size: 28rpx;
  239. text-align: left;
  240. color: #333333;
  241. }
  242. .file_size_date{
  243. display: flex;
  244. width: 100%;
  245. text-align: left;
  246. font-weight: 400;
  247. font-size: 24rpx;
  248. color: #999999;
  249. margin-top: 8rpx;
  250. gap: 20rpx;
  251. .file_size{
  252. white-space: nowrap;
  253. }
  254. .file_date{
  255. white-space: nowrap;
  256. }
  257. }
  258. }
  259. :deep(.container){
  260. width: auto;
  261. .file_content{
  262. width: auto;
  263. }
  264. }
  265. .preview_btn{
  266. width: 96rpx;
  267. box-sizing: border-box;
  268. text-align: left;
  269. font-weight: 400;
  270. font-size: 28rpx;
  271. color: #2E64FA;
  272. padding:20rpx 0 0 16rpx;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. }
  279. </style>