submitDetail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" title="提交材料" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content_height">
  6. <view class="page_content padding_btm">
  7. <view class="task_title">{{state?.details?.taskName}}</view>
  8. <view class="task_class_collect">
  9. <text class="class_item">{{state?.details?.departmentName}}</text>
  10. <text class="class_item">{{state?.details?.materialCategoryName}}</text>
  11. <text class="class_item">{{state?.details?.createdBy}}</text>
  12. </view>
  13. <view class="task_time">
  14. <view class="time_day">
  15. <text class="time_item">{{state?.details?.startTime}}</text>
  16. <text class="time_item">至</text>
  17. <text class="time_item">{{state?.details?.endTime}}</text>
  18. <text class="time_item" v-if="state?.details?.taskStatus === 1 && remainingDays(state?.details?.endTime) > 0">剩余{{remainingDays(state?.details?.endTime)}}天</text>
  19. </view>
  20. <view :class="['task_status', statusClassMap[state?.details?.taskStatus]]">
  21. {{taskStatusMap[state?.details?.taskStatus]}}
  22. </view>
  23. </view>
  24. <view :class="['task_desc',{'over':!state.isExpand}]">
  25. 采集要求:{{state?.details?.collectionRequire}}
  26. </view>
  27. <view class="task_desc_all">
  28. 采集要求:{{state?.details?.collectionRequire}}
  29. </view>
  30. <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
  31. class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
  32. :type="!state.isExpand?'down':'up'"></uni-icons></view>
  33. </view>
  34. <!-- 间隔 -->
  35. <view class="row_gap"></view>
  36. <view class="page_content">
  37. <view class="target_status">
  38. <view class="target_tag">
  39. <template v-for="text in ['departmentName','departmentGroupName','subjectName','gradeName','classTypeName','className']">
  40. <text class="info_text" v-if="state?.targetFileList?.[text]" :key="text">{{state?.targetFileList?.[text]}}</text>
  41. </template>
  42. </view>
  43. <template v-if="state?.details?.auditMechanism === 1">
  44. <view v-if="state?.targetFileList?.targetStatus=== 1" class="status_tag notSubmitList">
  45. <text>待提交</text>
  46. </view>
  47. <view v-if="state?.targetFileList?.targetStatus=== 3" class="status_tag reviewReasonList">
  48. <text>已驳回</text>
  49. </view>
  50. <view v-if="state?.targetFileList?.targetStatus=== 2" class="status_tag notReviewList">
  51. <text>审核中</text>
  52. </view>
  53. <view v-if="state?.targetFileList?.targetStatus=== 4" class="status_tag reviewList">
  54. <text>已提交</text>
  55. </view>
  56. </template>
  57. <template v-if="state?.details?.auditMechanism === 0">
  58. <view v-if="state?.targetFileList?.targetStatus=== 1" class="status_tag notSubmitList">
  59. <text>待提交</text>
  60. </view>
  61. <view v-else class="status_tag reviewList">
  62. <text>已提交</text>
  63. </view>
  64. </template>
  65. </view>
  66. <!-- 上传按钮 提交状态 1待提交 2审核中 3已驳回 4已提交 -->
  67. <!-- maxSize:单文件上限 MB;0 表示不限制 maxCount:列表最多文件数 -->
  68. <kex-file-uploader
  69. ref="fileUploader"
  70. v-model="files"
  71. mode="headless"
  72. :multiple="true"
  73. :auto-upload="true"
  74. :upload-url="`${apiBaseUrl}/api/v1/teach/oss/file/oss/upload_file_list`"
  75. :upload-options="{
  76. name: 'files',
  77. header: {
  78. Authorization: token
  79. },
  80. formData: {
  81. taskId:state.taskId,
  82. targetId:state.targetId
  83. },
  84. }"
  85. :max-count="20"
  86. :maxSize="100"
  87. formats="doc,docx,xls,xlsx,ppt,pptx,png,jpg,jpeg,gif,bmp"
  88. @uploadSuccess="onUploadSuccess">
  89. </kex-file-uploader>
  90. <view class="upload_box" @click="FileChooseUploader" v-if="state?.targetFileList?.targetStatus === 1 && state?.details?.taskStatus !== 2">
  91. <image class="upload_icon" src="@/static/image/icon/upload_icon.png"></image>
  92. <view class="upload_text">
  93. <view class="upload_title">点击上传文件</view>
  94. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  95. </view>
  96. </view>
  97. <view class="upload_box" v-if="(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4) && state?.details?.taskStatus !== 2">
  98. <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
  99. <view class="upload_text">
  100. <view class="upload_title">点击重新编辑可再提交</view>
  101. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  102. </view>
  103. </view>
  104. <view class="upload_box" v-if="state?.targetFileList?.targetStatus === 3 && state?.details?.taskStatus !== 2">
  105. <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
  106. <view class="upload_text">
  107. <view class="upload_title">请先删除全部文件,再提交调整后的合规材料</view>
  108. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  109. </view>
  110. </view>
  111. <view class="upload_box" v-if="state?.details?.taskStatus == 2">
  112. <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
  113. <view class="upload_text">
  114. <view class="upload_title">已结束不可再提交</view>
  115. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  116. </view>
  117. </view>
  118. <view class="list_item" @click="OpenPreviewFile(item)" v-for="item in (state?.targetFileList?.taskTargetFileVos || [])" :Key="item.id">
  119. <!-- #ifdef APP-PLUS -->
  120. <!-- app端处理 -->
  121. <template v-if="['word','excel','pdf','txt'].includes(getFileTypeBySuffix(item.fileType))">
  122. <cjx-previewOffice :value="item.filePath" :name="item.fileName" :type="getFileTypeBySuffix(item.fileType)">
  123. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  124. <view class="file_info">
  125. <view class="file_name">{{item.fileName}}</view>
  126. <view class="file_size">
  127. <text>{{getFileSize(item.fileSize)}}</text>
  128. <text>{{ item.createTime }}</text>
  129. </view>
  130. </view>
  131. <view class="file_btn">
  132. <text @click.stop="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
  133. <text class="download" @click.stop="ToDownloadFile(item)">下载</text>
  134. </view>
  135. </cjx-previewOffice>
  136. </template>
  137. <template v-else>
  138. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  139. <view class="file_info">
  140. <view class="file_name">{{item.fileName}}</view>
  141. <view class="file_size">
  142. <text>{{getFileSize(item.fileSize)}}</text>
  143. <text>{{ item.createTime }}</text>
  144. </view>
  145. </view>
  146. <view class="file_btn">
  147. <text @click.stop="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
  148. <text class="download" @click.stop="ToDownloadFile(item)">下载</text>
  149. </view>
  150. </template>
  151. <!-- #endif -->
  152. <!-- #ifndef APP-PLUS -->
  153. <!-- 不包含app端 -->
  154. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  155. <view class="file_info">
  156. <view class="file_name">{{item.fileName}}</view>
  157. <view class="file_size">
  158. <text>{{getFileSize(item.fileSize)}}</text>
  159. <text>{{ item.createTime }}</text>
  160. </view>
  161. </view>
  162. <view class="file_btn">
  163. <text @click.stop="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
  164. <text class="download" @click.stop="ToDownloadFile(item)">下载</text>
  165. </view>
  166. <!-- #endif -->
  167. </view>
  168. </view>
  169. </view>
  170. <view class="page_foot" v-if="state?.details?.taskStatus!=2">
  171. <!-- 提交状态 1待提交 2审核中 3已驳回 4已提交 -->
  172. <template v-if="(state?.targetFileList?.targetStatus === 1 || state?.targetFileList?.targetStatus === 3)">
  173. <view @click="DeleteAllFiles" :class="['del',{'disabled':!state?.targetFileList?.taskTargetFileVos?.length}]">删除全部</view>
  174. <view :class="['submit',{'disabled':state?.targetFileList?.targetStatus === 3}]" @click="UpdateTaskTarget">提交</view>
  175. </template>
  176. <template v-else>
  177. <view class="del disabled">删除全部</view>
  178. <view class="submit" @click="UpdateTaskTargetReset">重新编辑</view>
  179. </template>
  180. </view>
  181. <!-- 删除确认框 -->
  182. <popupDialog ref="popupConfirmDialogRef" :showFootBorder="true" :content="state.confirmDialog.content" @DialogConfirm="DialogConfirm" />
  183. <!-- 图片 视频预览 -->
  184. <popupPreviewFile ref="imgVideoPreview" :fileType="state.previewPopup.fileType" :fileName="state.previewPopup.fileName" :filePath="state.previewPopup.filePath" @ToDownloadFile="ToDownloadFile"></popupPreviewFile>
  185. <!-- 默认指H5端 此插件只支持h5 PDF、Word、Excel、PPTX、TXT预览-->
  186. <!-- #ifdef H5 -->
  187. <wg-h5-preview-file ref="webPreviewFile" />
  188. <!-- #endif -->
  189. <!-- 文件、图片下载 -->
  190. <ss-download ref="ssdownload"></ss-download>
  191. </view>
  192. </template>
  193. <script setup>
  194. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  195. import ssDownload from '@/uni_modules/ss-download/components/ss-download/ss-download.vue';
  196. import popupDialog from '@/components/popupDialog.vue';
  197. import popupPreviewFile from '@/components/popupPreviewFile.vue';//图片 音视频 zip等预览
  198. // #ifdef H5
  199. import wgH5PreviewFile from '@/components/wg-h5-preview-file/wg-h5-preview-file.vue';//web端文件预览 'word','excel','pptx','pdf','txt'
  200. // #endif
  201. // #ifdef APP-PLUS
  202. import cjxPreviewOffice from '@/uni_modules/cjx-previewOffice/components/cjx-previewOffice/cjx-previewOffice.vue';//APP端文件预览 'word','excel','pdf','txt'
  203. // #endif
  204. import navBar from '@/components/navBar.vue';
  205. import { remainingDays,getFileSize,getFileTypeBySuffix } from '@/common/common.js';
  206. import {getTaskTargetFileList,DeleteFileList,DelTaskTargetFileList,updateTaskTarget,uploadTaskTargetFileList} from '@/reqApi/notification.js';
  207. import {onLoad} from '@dcloudio/uni-app';
  208. import config from '@/config.js'; // 引入配置文件
  209. import {
  210. reactive,
  211. ref,
  212. nextTick,
  213. getCurrentInstance,
  214. computed,
  215. onMounted
  216. } from 'vue';
  217. const state = reactive({
  218. taskId: '', //任务id
  219. targetId:'',//
  220. auditStatus:'',//审核状态
  221. showExpandBtn: false, //是否显示展开按钮
  222. isExpand: false, //是否展开
  223. details: {}, //详情信息
  224. targetFileList:{},
  225. confirmDialog:{
  226. type:'',
  227. content:'',
  228. fileUrls:[],
  229. targetFileIds:[]
  230. },
  231. previewPopup:{
  232. fileType:'',
  233. filePath:'',
  234. fileName:''
  235. }
  236. });
  237. const popupConfirmDialogRef = ref(null);
  238. const imgVideoPreview = ref(null);//图片 视频
  239. const webPreviewFile = ref(null);//web端文件预览
  240. const appPreviewOfficeRef = ref(null);//APP端文件预览
  241. const fileUploader = ref(null);
  242. const ssdownload = ref(null);//下载
  243. const files = ref([]);
  244. const token = ref(uni.getStorageSync('token'));
  245. const apiBaseUrl = ref('');
  246. const statusClassMap = {
  247. 1: 'status_published',
  248. 2: 'status_closed'
  249. };
  250. const taskStatusMap = {
  251. 1: '进行中',
  252. 2: '已结束'
  253. };
  254. onLoad((option) => {
  255. state.taskId = option.taskId;
  256. state.targetId = option.targetId;
  257. state.auditStatus = Number(option.auditStatus);
  258. })
  259. onMounted(() => {
  260. state.details = uni.getStorageSync('submitMaterialDetailInfo') || {};
  261. uni.removeStorageSync('isLoadSubmitMaterialTaskDetail');//返回是否重新更新任务详情数据
  262. uni.removeStorageSync('isLoadSubmitMaterialIndex');//返回是否重新更新提交材料首页
  263. getApiBaseUrl();//上传接口地址
  264. GetTaskTargetFileList(true);
  265. });
  266. //上传接口地址
  267. const getApiBaseUrl = () => {
  268. if (process.env.NODE_ENV === 'development') {//本地开发环境
  269. const SYSTEM_INFO = uni.getSystemInfoSync();//获取系统信息的同步接口
  270. apiBaseUrl.value = SYSTEM_INFO.uniPlatform === 'web' ? config.proxyBaseUrl:config.apiBaseUrl;//读取配置文件的apiBaseUrl变量
  271. } else {//生产/测试环境
  272. apiBaseUrl.value = config.apiBaseUrl
  273. }
  274. }
  275. //选择文件上传
  276. const FileChooseUploader = () => {
  277. fileUploader.value && fileUploader.value.choose();
  278. }
  279. const onUploadSuccess = ({
  280. index,
  281. file, // 当前文件
  282. url, // 优先为解析出的远程地址
  283. statusCode,
  284. data, // 解析后的服务端 JSON(失败则为原始字符串)
  285. res, // 原始回调
  286. fileList // 当前全部
  287. }) => {
  288. console.log(res)
  289. const result = JSON.parse(res.data || res.result);
  290. const list = result?.data || [];
  291. const fileInfoList = list.map(item => ({
  292. ...item,
  293. filePath: item.fileUrl
  294. }))
  295. UploadTargetFileList(fileInfoList);
  296. }
  297. //具体采集任务保存上传的文件地址
  298. const UploadTargetFileList = (fileInfoList) => {
  299. uploadTaskTargetFileList({
  300. fileInfoList,
  301. taskId:state.taskId,
  302. targetId:state.targetId
  303. }).then(res=>{
  304. if (res.code === 200) {
  305. uni.showToast({
  306. title: '上传成功!',
  307. icon: 'none'
  308. });
  309. GetTaskTargetFileList(false,'upload');
  310. }
  311. })
  312. }
  313. //预览
  314. const OpenPreviewFile = (item) => {
  315. const fileType = getFileTypeBySuffix(item.fileType);
  316. state.previewPopup.fileType = fileType?fileType:item.fileType;
  317. state.previewPopup.filePath = item.filePath;
  318. state.previewPopup.fileName = item.fileName;
  319. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  320. // #ifdef H5
  321. nextTick(()=>{//h5文件预览
  322. webPreviewFile.value && webPreviewFile.value.preview({
  323. url: item.filePath,
  324. type: fileType
  325. });
  326. })
  327. // #endif
  328. // #ifdef APP-PLUS
  329. if(fileType == 'pptx'){
  330. imgVideoPreview.value.OpenDialog();
  331. }
  332. // #endif
  333. }else{
  334. imgVideoPreview.value.OpenDialog();
  335. }
  336. // const fileType = item.fileType;
  337. // if(IsImageExts(fileType)){//图片预览
  338. // state.previewPopup.filePath = item.filePath;
  339. // imgVideoPreview.value.OpenDialog();
  340. // }else{//文件预览
  341. // // 1. 先下载文件到本地临时目录
  342. // uni.downloadFile({
  343. // url: item.filePath,
  344. // success: (downloadRes) => {
  345. // if (downloadRes.statusCode === 200) {
  346. // // 2. 下载成功后,得到临时文件路径 tempFilePath
  347. // const localPath = downloadRes.tempFilePath;
  348. // // 3. 构造 file 对象(必须有 path)
  349. // const fileObj = {
  350. // name: item.fileName,
  351. // path: localPath, // 关键字段
  352. // size: item.fileSize // 可选
  353. // };
  354. // // 4. 调用 kex-file-uploader 的 openDocument 方法预览
  355. // fileUploader.value?.openDocument({
  356. // file: fileObj,
  357. // success: () => console.log('预览成功'),
  358. // fail: (err) => console.error('预览失败', err)
  359. // });
  360. // }
  361. // },
  362. // fail: (err) => {
  363. // uni.showToast({ title: '文件下载失败', icon: 'none' });
  364. // }
  365. // });
  366. // }
  367. }
  368. //下载
  369. const ToDownloadFile = (item) => {
  370. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  371. let type = '';
  372. if(fileType == 'image'){
  373. type = '1';//1:图片 2 文档
  374. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  375. type = '2';
  376. }else{
  377. type = '';
  378. }
  379. ssdownload?.value?.toDownload({
  380. type:type,
  381. src:item.filePath,
  382. fileName:item.fileName
  383. });
  384. }
  385. // 展开收起切换
  386. const toggleExpand = () => {
  387. state.isExpand = !state.isExpand;
  388. }
  389. //获取当前教师提交的文件列表
  390. const GetTaskTargetFileList = (init,type) => {
  391. getTaskTargetFileList(state.targetId).then(res=>{
  392. if(res.code == 200){
  393. state.targetFileList = res.data || {};
  394. //对比审核状态是否发生变化同时更新缓存数据
  395. if(!init){
  396. uni.setStorageSync('isLoadSubmitMaterialIndex',true);//返回是否重新更新提交材料首页
  397. updateCacheData(type);
  398. }
  399. }
  400. })
  401. }
  402. //单个删除
  403. const HandleDeleteFileList = (item) => {
  404. if(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4){
  405. return false
  406. }
  407. const { filePath, id } = item;
  408. state.confirmDialog = {
  409. type:'del',
  410. content:'是否删除当前文件?',
  411. fileUrls:[filePath],
  412. targetFileIds:[id]
  413. };
  414. popupConfirmDialogRef.value.OpenDialog();
  415. }
  416. //删除全部
  417. const DeleteAllFiles = () => {
  418. let fileUrls = [],targetFileIds = [];
  419. const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  420. if(taskTargetFileVos.length > 0){
  421. taskTargetFileVos.forEach(item => {
  422. fileUrls.push(item.filePath);
  423. targetFileIds.push(item.id)
  424. })
  425. state.confirmDialog = {
  426. type:'del',
  427. content:'是否删除全部当前文件?',
  428. fileUrls:fileUrls,
  429. targetFileIds:targetFileIds
  430. };
  431. popupConfirmDialogRef.value.OpenDialog();
  432. }
  433. }
  434. //提交
  435. const UpdateTaskTarget = () => {
  436. const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  437. if(taskTargetFileVos.length == 0){
  438. uni.showToast({
  439. title: '请上传提交文件!',
  440. icon: 'none'
  441. });
  442. return false
  443. }
  444. state.confirmDialog = {
  445. type:'submit',
  446. content:'是否提交当前任务?',
  447. fileUrls:[],
  448. targetFileIds:[]
  449. };
  450. popupConfirmDialogRef.value.OpenDialog();
  451. }
  452. //重新提交
  453. const UpdateTaskTargetReset = () => {
  454. state.confirmDialog = {
  455. type:'submit',
  456. content:'是否重新编辑当前任务?',
  457. fileUrls:[],
  458. targetFileIds:[]
  459. };
  460. popupConfirmDialogRef.value.OpenDialog();
  461. }
  462. //确定删除 确定提交
  463. const DialogConfirm = () => {
  464. if(state.confirmDialog.type == 'del'){//单个删除 批量删除
  465. DelFileList();
  466. }else if(state.confirmDialog.type == 'submit') {//提交
  467. submitTaskTarget();
  468. }
  469. }
  470. const DelFileList = async() => {
  471. const res = await DeleteFileList({ fileUrls: state.confirmDialog.fileUrls })
  472. if (res.code !== 200) {
  473. uni.showToast({
  474. title: res.msg,
  475. icon: 'none'
  476. });
  477. return false
  478. }
  479. const resData = await DelTaskTargetFileList({
  480. targetId: state.targetId,
  481. targetFileIds: state.confirmDialog.targetFileIds
  482. })
  483. if (resData.code === 200) {
  484. uni.showToast({
  485. title: '删除成功!',
  486. icon: 'none'
  487. });
  488. GetTaskTargetFileList(false,'del');
  489. }
  490. }
  491. //提交
  492. const submitTaskTarget = () => {
  493. updateTaskTarget(state.targetId).then(res => {
  494. if (res.code === 200) {
  495. uni.showToast({
  496. title: '提交成功!',
  497. icon: 'none'
  498. });
  499. GetTaskTargetFileList(false,'submit');
  500. }
  501. })
  502. }
  503. //对比审核状态是否发生变化同时更新缓存数据
  504. const updateCacheData = (type) => {
  505. const targetStatus = state?.targetFileList?.targetStatus;
  506. let taskTargetList = state?.details?.taskTargetVos || [];
  507. if (state.auditStatus !== targetStatus) {
  508. // 状态变化,删除目标项
  509. taskTargetList.forEach(item=>{
  510. if(item.id == state.targetId){
  511. item.isShow = 1;//删除状态
  512. }
  513. })
  514. } else {
  515. // 状态未变且非提交(上传或删除)操作,更新文件列表
  516. if (type !== 'submit'){
  517. const targetItem = taskTargetList.find(item => item.id === state.targetId);
  518. if (targetItem) {
  519. targetItem.taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  520. targetItem.fileNum = targetItem.taskTargetFileVos.length;
  521. }
  522. }else{
  523. taskTargetList.forEach(item=>{
  524. if(item.id == state.targetId){
  525. item.isShow = 0;//显示
  526. }
  527. })
  528. }
  529. }
  530. // 关键:将结果写回 state
  531. if (state?.details) {
  532. state.details.taskTargetVos = taskTargetList;
  533. uni.setStorageSync('submitMaterialDetailInfo',state.details);
  534. uni.setStorageSync('isLoadSubmitMaterialTaskDetail',true);//返回是否重新更新任务详情数据
  535. }
  536. }
  537. //返回
  538. const GoBack = () => {
  539. uni.navigateBack({
  540. delta: 1
  541. });
  542. }
  543. </script>
  544. <style scoped lang="scss">
  545. .page_body{
  546. height: 100%;
  547. }
  548. .page_content_height{
  549. display: flex;
  550. flex-direction: column;
  551. width: 100%;
  552. height: calc(100% - 240rpx);
  553. overflow: auto;
  554. }
  555. .page_content {
  556. &.padding_btm {
  557. padding-bottom: 24rpx;
  558. .task_title {
  559. font-weight: 500;
  560. font-size: 32rpx;
  561. color: #333333;
  562. margin-top: 24rpx;
  563. }
  564. .task_class_collect {
  565. display: inline-flex;
  566. align-items: center;
  567. flex-wrap: wrap;
  568. width: 100%;
  569. margin-top: 16rpx;
  570. gap: 16rpx;
  571. .class_item {
  572. font-weight: 400;
  573. font-size: 24rpx;
  574. color: #999999;
  575. }
  576. }
  577. .task_time {
  578. display: flex;
  579. align-items: flex-start;
  580. width: 100%;
  581. margin-top: 16rpx;
  582. .time_day {
  583. display: inline-flex;
  584. align-items: center;
  585. flex-wrap: wrap;
  586. flex: 1;
  587. .time_item {
  588. font-weight: 400;
  589. font-size: 24rpx;
  590. line-height: 48rpx;
  591. color: #999999;
  592. &:nth-child(2) {
  593. margin: 0 8rpx;
  594. }
  595. &:nth-child(4) {
  596. color: #2E64FA;
  597. margin-left: 16rpx;
  598. }
  599. }
  600. }
  601. .task_status {
  602. display: inline-flex;
  603. align-items: center;
  604. height: 48rpx;
  605. padding: 0 12rpx;
  606. border-radius: 8rpx;
  607. font-weight: 400;
  608. font-size: 24rpx;
  609. &.status_pending {
  610. background: rgba(46, 100, 250, 0.1);
  611. color: #2E64FA;
  612. }
  613. &.status_published {
  614. background: rgba(82, 196, 26, 0.1);
  615. color: #2BC644;
  616. }
  617. &.status_closed {
  618. background: #6666661a;
  619. color: #666666;
  620. }
  621. }
  622. }
  623. .task_desc {
  624. margin-top: 24rpx;
  625. display: flex;
  626. width: 100%;
  627. padding-top: 24rpx;
  628. border-top: 2rpx solid #F3F3F3;
  629. font-weight: 400;
  630. font-size: 28rpx;
  631. color: #999999;
  632. line-height: 44rpx;
  633. box-sizing: border-box;
  634. position: relative;
  635. &.over {
  636. max-height: 168rpx;
  637. overflow: hidden;
  638. transition: all 0.25s;
  639. display: -webkit-box;
  640. -webkit-line-clamp: 3;
  641. -webkit-box-orient: vertical;
  642. }
  643. }
  644. .task_desc_all {
  645. display: flex;
  646. width: 100%;
  647. padding-top: 24rpx;
  648. border-top: 2rpx solid #F3F3F3;
  649. font-weight: 400;
  650. font-size: 28rpx;
  651. color: #999999;
  652. line-height: 44rpx;
  653. box-sizing: border-box;
  654. position: absolute;
  655. left: -9999px;
  656. top: 0;
  657. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  658. pointer-events: none;
  659. }
  660. .expand_btn {
  661. width: 100%;
  662. height: 40rpx;
  663. background-color: #FFFFFF;
  664. display: flex;
  665. justify-content: flex-end;
  666. align-items: center;
  667. .expand_text {
  668. font-weight: 400;
  669. font-size: 28rpx;
  670. color: #2E64FA;
  671. margin-right: 8rpx;
  672. }
  673. .expand_icon {
  674. font-size: 32rpx !important;
  675. color: #2E64FA !important;
  676. }
  677. }
  678. }
  679. }
  680. .row_gap {
  681. background-color: #F8F9FD;
  682. width: 100%;
  683. height: 24rpx;
  684. }
  685. .target_status {
  686. width: 100%;
  687. display: flex;
  688. align-items: center;
  689. padding: 24rpx 0;
  690. border-bottom: 2rpx solid #F3F3F3;
  691. .target_tag{
  692. flex: 1;
  693. font-weight: 500;
  694. font-size: 32rpx;
  695. color: #333333;
  696. .info_text{
  697. flex-shrink: 0;
  698. margin-right: 12rpx;
  699. }
  700. }
  701. .status_tag{
  702. font-size: 24rpx;
  703. text-align: center;
  704. padding: 8rpx 12rpx;
  705. font-weight: 400;
  706. border-radius: 8rpx;
  707. flex-shrink: 0;
  708. &.notSubmitList {
  709. background: rgba(46,100,250,0.1);
  710. color: #2E64FA;
  711. }
  712. &.notReviewList {
  713. background: rgba(251,159,52,0.1);
  714. color: #FB9F34;
  715. }
  716. &.reviewReasonList {
  717. background: rgba(245,108,108,0.1);
  718. color: #F56C6C;
  719. }
  720. &.reviewList {
  721. background: rgba(43,198,68,0.1);
  722. color: #2BC644;
  723. }
  724. }
  725. }
  726. .upload_box{
  727. margin-top: 24rpx;
  728. width: 100%;
  729. background-color: #FAFBFF;
  730. border-radius: 20rpx;
  731. border: 2rpx dashed #CCCED4;
  732. display: flex;
  733. box-sizing: border-box;
  734. align-items: center;
  735. padding: 22rpx 0 22rpx 40rpx;
  736. .upload_icon{
  737. width: 64rpx;
  738. height: 64rpx;
  739. margin-right: 24rpx;
  740. flex-shrink: 0;
  741. }
  742. .upload_text{
  743. flex:1;
  744. display: flex;
  745. flex-direction: column;
  746. .upload_title{
  747. font-weight: 400;
  748. font-size: 28rpx;
  749. color: #666666;
  750. }
  751. .upload_desc{
  752. margin-top: 8rpx;
  753. font-weight: 400;
  754. font-size: 20rpx;
  755. color: #CCCED4;
  756. }
  757. }
  758. }
  759. .list_item {
  760. display: flex;
  761. align-items: center;
  762. width: 100%;
  763. padding: 20rpx 24rpx;
  764. background: #FFFFFF;
  765. border-radius: 20rpx;
  766. border: 2rpx solid #EBEEF5;
  767. box-sizing: border-box;
  768. margin-top: 24rpx;
  769. gap:20rpx;
  770. .file_icon{
  771. flex-shrink: 0;
  772. width: 80rpx;
  773. height: 80rpx;
  774. }
  775. .file_info{
  776. flex:1;
  777. display: flex;
  778. flex-direction: column;
  779. overflow: hidden;
  780. .file_name{
  781. width: 100%;
  782. font-weight: 500;
  783. font-size: 28rpx;
  784. color: #333333;
  785. overflow: hidden;
  786. white-space: nowrap;
  787. text-overflow: ellipsis;
  788. }
  789. .file_size{
  790. display: flex;
  791. width: 100%;
  792. gap: 20rpx;
  793. font-weight: 400;
  794. font-size: 24rpx;
  795. color: #999999;
  796. margin-top: 8rpx;
  797. }
  798. }
  799. .file_btn{
  800. flex-shrink: 0;
  801. display: flex;
  802. gap:24rpx;
  803. font-weight: 400;
  804. font-size: 28rpx;
  805. .del{
  806. color: #F56C6C;
  807. &.disabled{
  808. color: #C0C4CC;
  809. }
  810. }
  811. .download{
  812. color: #2E64FA;
  813. }
  814. }
  815. }
  816. .page_foot{
  817. position: fixed;
  818. display: flex;
  819. align-items: center;
  820. left: 0;
  821. right: 0;
  822. bottom: 0;
  823. padding: 0 24rpx;
  824. height: 130rpx;
  825. background-color: #FFFFFF;
  826. gap: 32rpx;
  827. .del{
  828. display: flex;
  829. align-items: center;
  830. justify-content: center;
  831. width: 240rpx;
  832. height: 90rpx;
  833. box-sizing: border-box;
  834. border-radius: 8rpx;
  835. border: 2rpx solid #F56C6C;
  836. font-weight: 400;
  837. font-size: 28rpx;
  838. color: #F56C6C;
  839. &.disabled{
  840. color: #C0C4CC;
  841. border: 2rpx solid #C0C4CC;
  842. }
  843. }
  844. .submit {
  845. flex:1;
  846. height: 90rpx;
  847. background-color: #2E64FA;
  848. border-radius: 8rpx;
  849. display: flex;
  850. justify-content: center;
  851. align-items: center;
  852. font-weight: 500;
  853. font-size: 28rpx;
  854. color: #FFFFFF;
  855. &.disabled{
  856. background-color: #C0C4CC;
  857. }
  858. }
  859. }
  860. </style>