import { onSubmitCheck_Api } from "@/api/task.js" /** * 跳转任务提交/查看页面 * type : 0 - 单任务 , 1 - 多任务 * receiveTaskId: 单任务领取ID, * receiveChildTaskId: 多任务领取子ID * checkPage: 是否查看详情 */ const pageList = { taskAuditDetails: '/pages/task/task-audit', submitDetails: '/pages/task/submit-task', } let onSubmint_val_loading = false; export const onSubmint_val = async (type = null, task_info = null, checkPage = false, page = 'taskAuditDetails') => { console.log('task_info = ', task_info, onSubmint_val_loading, pageList[page]) if (!pageList[page]) { uni.showToast({ title: '跳转页面错误', icon: 'none' }) return } if (type !== null && task_info && !onSubmint_val_loading) { onSubmint_val_loading = true let path = `${pageList[page]}?&checkPage=${checkPage}`; try { if (!checkPage) { const Check_val = await onSubmitCheck_Api(task_info.receiveChildTaskId) if (!Check_val || Check_val.code !== 200) { throw new Error('编辑审核不通过') } } if (type === 0) { // 单任务 path = `${path}&receiveTaskId=${task_info.receiveTaskId}` } else { // 多任务下子任务 path = `${path}&receiveChildTaskId=${task_info.receiveChildTaskId}` }; console.log('checkPage = ' , checkPage , path) if (checkPage) { uni.navigateTo({ url: path }) } else { uni.navigateTo({ url: path }) } onSubmint_val_loading = false } catch (e) { onSubmint_val_loading = false //TODO handle the exception } } }