wlzboy
2025-12-25 ae478a3d5dab28dd598d39f27429e4a544b15ad2
app/pagesTask/detail.vue
@@ -1014,16 +1014,27 @@
            title: '检查附件...'
          });
          
          const response = await checkTaskConsentAttachment(this.taskId);
          // 注意:这里会被请求拦截器处理,code !== 200 时会 reject
          const response = await checkTaskConsentAttachment(this.taskId).catch(err => {
            // 拦截器 reject 的情况,返回一个默认对象
            console.log('请求被拦截器 reject,err:', err);
            return { code: -1, msg: '未上传知情同意书' };
          });
          
          uni.hideLoading();
          console.log('检查附件结果:', response);
          
          if (response.code === 200) {
          // 后台返回 code: 200 表示已上传,code: -1 表示未上传
          if (response && response.code === 200) {
            // 已上传知情同意书,继续更新状态
            console.log('已上传知情同意书,继续完成任务');
            this.getLocationAndUpdateStatus(status, remark);
          } else {
            // 未上传知情同意书,显示提示
            this.$modal.confirm('任务未上传知情同意书,无法完成任务。是否现在去上传?').then(() => {
            // 未上传知情同意书或其他错误,阻止完成
            const message = (response && response.msg) || '任务未上传知情同意书,无法完成任务';
            console.log('未上传知情同意书,阻止完成');
            this.$modal.confirm(message + '。是否现在去上传?').then(() => {
              // 滚动到附件上传区域
              this.$nextTick(() => {
                uni.pageScrollTo({
@@ -1035,12 +1046,10 @@
          }
        } catch (error) {
          uni.hideLoading();
          console.error('检查附件失败:', error);
          console.error('检查附件异常:', error);
          
          // 如果检查失败,询问用户是否继续
          this.$modal.confirm('检查附件状态失败,是否继续完成任务?').then(() => {
            this.getLocationAndUpdateStatus(status, remark);
          }).catch(() => {});
          // 如果检查失败(网络异常等),不允许完成任务
          this.$modal.showToast('检查附件状态失败,无法完成任务');
        }
      },