Browse Source

fix: 内联弹窗逻辑到 pickFile/takePhoto,消除方法调用链断裂问题

ensureAgreed 方法在运行时调用失败(console 显示 pickFile clicked 后无 ensureAgree called),直接将弹窗逻辑内联到 pickFile/takePhoto 中
liaoxg 1 tháng trước cách đây
mục cha
commit
dc16e97b15
1 tập tin đã thay đổi với 34 bổ sung4 xóa
  1. 34 4
      cfc-frontend/pages/health/report-upload.vue

+ 34 - 4
cfc-frontend/pages/health/report-upload.vue

@@ -190,13 +190,43 @@ export default {
     },
     // ===== 拍照上传 =====
     takePhoto() {
-      console.log('[report-upload] takePhoto clicked')
-      this.ensureAgreed(true)
+      console.log('[report-upload] takePhoto clicked, agreed=', this.agreedToTerms)
+      if (this.agreedToTerms) {
+        this.startPick(true)
+        return
+      }
+      uni.showModal({
+        title: '数据使用声明',
+        content: '上传报告即代表您同意平台使用本报告数据进行分析,为您提供个性化健康解决方案;未经您授权,平台不会以任何形式将您的报告内容提供给其他任何个人或机构。点击「同意并继续」即表示您已阅读并同意。',
+        confirmText: '同意并继续',
+        cancelText: '暂不',
+        success: (res) => {
+          if (res.confirm) {
+            this.agreedToTerms = true
+            this.startPick(true)
+          }
+        }
+      })
     },
     // ===== 文件上传 =====
     pickFile() {
-      console.log('[report-upload] pickFile clicked')
-      this.ensureAgreed(false)
+      console.log('[report-upload] pickFile clicked, agreed=', this.agreedToTerms)
+      if (this.agreedToTerms) {
+        this.startPick(false)
+        return
+      }
+      uni.showModal({
+        title: '数据使用声明',
+        content: '上传报告即代表您同意平台使用本报告数据进行分析,为您提供个性化健康解决方案;未经您授权,平台不会以任何形式将您的报告内容提供给其他任何个人或机构。点击「同意并继续」即表示您已阅读并同意。',
+        confirmText: '同意并继续',
+        cancelText: '暂不',
+        success: (res) => {
+          if (res.confirm) {
+            this.agreedToTerms = true
+            this.startPick(false)
+          }
+        }
+      })
     },
     // 上传文件 → 自动跳转确认页(确认页按 draftId 触发解析并自动刷新显示结果)
     uploadAndGoConfirm(filePath, type) {