wlzboy
2025-12-25 ae478a3d5dab28dd598d39f27429e4a544b15ad2
app/pages/task/index.vue
@@ -940,12 +940,19 @@
          title: '检查附件...'
        });
        
        const response = await checkTaskConsentAttachment(taskId);
        // 注意:这里会被请求拦截器处理,code !== 200 时会 reject
        const response = await checkTaskConsentAttachment(taskId).catch(err => {
          // 拦截器 reject 的情况,返回一个默认对象
          console.log('请求被拦截器 reject,err:', err);
          return { code: -1, msg: '未上传知情同意书' };
        });
        
        uni.hideLoading();
        console.log('检查附件结果:', response);
        
        if (response.code === 200) {
        if (response && response.code === 200) {
          // 已上传知情同意书,继续更新状态
          console.log('已上传知情同意书,继续完成任务');
          this.$modal
            .confirm("确认任务已完成?")
            .then(() => {
@@ -953,8 +960,11 @@
            })
            .catch(() => {});
        } else {
          // 未上传知情同意书,显示提示
          this.$modal.confirm('任务未上传知情同意书,无法完成任务。是否现在去上传?').then(() => {
          // 未上传知情同意书或其他错误,阻止完成
          const message = (response && response.msg) || '任务未上传知情同意书,无法完成任务';
          console.log('未上传知情同意书,阻止完成');
          this.$modal.confirm(message + '。是否现在去上传?').then(() => {
            // 跳转到任务详情页上传附件
            uni.navigateTo({
              url: `/pagesTask/detail?id=${taskId}`
@@ -963,12 +973,10 @@
        }
      } catch (error) {
        uni.hideLoading();
        console.error('检查附件失败:', error);
        console.error('检查附件异常:', error);
        
        // 如果检查失败,询问用户是否继续
        this.$modal.confirm('检查附件状态失败,是否继续完成任务?').then(() => {
          this.updateTaskStatus(taskId, status, remark);
        }).catch(() => {});
        // 如果检查失败(网络异常等),不允许完成任务
        this.$modal.showToast('检查附件状态失败,无法完成任务');
      }
    },