Sfoglia il codice sorgente

fix(report-list): 删除重复的 methods 块,修复 'Unexpected end of input'

文件在 L139 有一个完整的 methods: { ... } 块(startCollectPolling → adjustBinding),
但 L298 又出现了一个相同的 methods: { ... } 块,导致整个 script 语法结构断裂:

  L139: methods: {   ← 第一个 methods 块(正确)
  ...
  L297: },
  L298: methods: {   ← 重复,整块内容照抄了 L139–L297
  ...
  L509: }
  L510: }
  L511: }
  L512: </script>

Node 报 'Unexpected end of input'(L422),是因为重复块内部的多层闭括号
把 methods 对象的闭合、export default 的闭合都提前结束了,导致后续 </script>
和 style 被当作 script 的一部分解析。

修复:删除 L298–L510 的重复块,在原 methods 块末尾补充 }; 闭合。

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
liaoxg 3 giorni fa
parent
commit
ce33709af0
1 ha cambiato i file con 1 aggiunte e 213 eliminazioni
  1. 1 213
      cfc-frontend/pages/health/report-list.vue

+ 1 - 213
cfc-frontend/pages/health/report-list.vue

@@ -295,219 +295,7 @@ export default {
         uni.showToast({ title: '删除失败', icon: 'none' })
       })
     },
-    methods: {
-    startCollectPolling() {
-      var self = this
-      if (self.collectTimer) {
-        clearInterval(self.collectTimer)
-      }
-      self.loadCollectingReports()
-      self.collectTimer = setInterval(function() {
-        self.loadCollectingReports()
-      }, 6000)
-    },
-    loadCollectingReports() {
-      var self = this
-      var prevCount = self.collectingReports.length
-      getCollectingReports().then(function(res) {
-        if (res.code === 200) {
-          var list = res.data || []
-          self.collectingReports = list
-          // 采集卡片消失后刷新列表,让刚入库的报告立刻出现
-          if (prevCount > 0 && list.length < prevCount) {
-            self.loadData()
-          }
-        }
-      }).catch(function() {
-        // 采集进度轮询失败静默,下一轮重试
-      })
-    },
-    loadMembers() {
-      var self = this
-      getFamilyMemberList({}).then(function(res) {
-        if (res.code === 200 && Array.isArray(res.data)) {
-          // _filterId 预计算,供 :class 内联比较使用(小程序 :class 禁止方法调用)
-          var list = []
-          for (var i = 0; i < res.data.length; i++) {
-            var m = res.data[i]
-            list.push({
-              id: m.id,
-              nickname: m.nickname,
-              avatar: m.avatar,
-              _filterId: m.id || m.userId
-            })
-          }
-          self.members = list
-        }
-      }).catch(function(e) {
-        console.log('获取家庭成员失败', e)
-      })
-    },
-    selectAllMembers() {
-      if (this.selectedMemberId === null) return
-      this.selectedMemberId = null
-      this.loadData()
-    },
-    selectMember(item) {
-      var filterId = item._filterId
-      if (this.selectedMemberId === filterId) return
-      this.selectedMemberId = filterId
-      this.loadData()
-    },
-    loadData() {
-      var self = this
-      self.loading = true
-      getReportList(self.selectedMemberId).then(function(res) {
-        self.reports = res.data || []
-      }).catch(function(e) {
-        console.log('获取报告列表失败', e)
-        uni.showToast({ title: '加载失败', icon: 'none' })
-      }).finally(function() {
-        self.loading = false
-      })
-    },
-    goToDetail(reportId, reportType) {
-  		var url
-  		if (reportType === 'gut_flora') {
-  			url = '/pages/health/gut-flora-detail?reportId=' + reportId
-  		} else if (reportType === 'dan') {
-  			url = '/pages/dan-assessment/report-result?reportId=' + reportId
-  		} else {
-  			url = '/pages/health/report-detail?reportType=' + (reportType || 'gut_flora') + '&reportId=' + reportId
-  		}
-  		uni.navigateTo({ url: url })
-  	},
-    onRowClick(item) {
-      // 刚滑动过,忽略本次点击
-      if (this.touchDidMove) {
-        this.touchDidMove = false
-        return
-      }
-      // 行处于打开态,点击先收起
-      if (this.openMap[item.id]) {
-        this.$set(this.openMap, item.id, false)
-        return
-      }
-      this.goToDetail(item.id, item.reportType)
-    },
-    onTouchStart(e, item) {
-      // 先收起其它已打开行
-      if (this.curId !== null && this.curId !== item.id && this.openMap[this.curId]) {
-        this.$set(this.openMap, this.curId, false)
-      }
-      var touch = e.touches[0]
-      this.curId = item.id
-      this.startX = touch.clientX
-      this.startY = touch.clientY
-      this.touchDidMove = false
-      this.baseOffset = this.openMap[item.id] ? -80 : 0
-      this.moveOffset = this.baseOffset
-    },
-    onTouchMove(e) {
-      if (this.curId === null) return
-      var touch = e.touches[0]
-      var dx = touch.clientX - this.startX
-      var dy = touch.clientY - this.startY
-      // 横向滑动(水平分量大于垂直分量)
-      if (Math.abs(dx) > Math.abs(dy)) {
-        this.touchDidMove = Math.abs(dx) > 10
-        var offset = this.baseOffset + dx
-        if (offset < -80) offset = -80
-        if (offset > 0) offset = 0
-        this.moveOffset = offset
-      }
-    },
-    onTouchEnd() {
-      if (this.curId === null) return
-      // 位移超过阈值则打开,否则收起
-      var shouldOpen = this.moveOffset < -20
-      this.$set(this.openMap, this.curId, shouldOpen)
-      this.moveOffset = shouldOpen ? -80 : 0
-      this.curId = null
-    },
-    goToUpload() {
-      uni.navigateTo({ url: '/pages/health/report-upload' })
-    },
-    confirmDelete(item) {
-      var self = this
-      uni.showModal({
-        title: '删除报告',
-        content: '确定删除该健康报告吗?删除后不可恢复。',
-        confirmColor: '#F56C6C',
-        success: function(res) {
-          if (!res.confirm) return
-          self.doDelete(item)
-        }
-      })
-    },
-    doDelete(item) {
-      var self = this
-      deleteReport(item.id).then(function(res) {
-        if (res.code === 200) {
-          uni.showToast({ title: '已删除', icon: 'success' })
-          self.loadData()
-        } else {
-          uni.showToast({ title: res.message || '删除失败', icon: 'none' })
-        }
-      }).catch(function(e) {
-        console.log('删除报告失败', e)
-        uni.showToast({ title: '删除失败', icon: 'none' })
-      })
-    },
-    formatDate(dateStr) {
-      if (!dateStr) return '--'
-      var d = parseDate(dateStr)
-      if (!d) return dateStr
-      var y = d.getFullYear()
-      var m = ('' + (d.getMonth() + 1)).padStart(2, '0')
-      var day = ('' + d.getDate()).padStart(2, '0')
-      return y + '-' + m + '-' + day
-    },
-    formatDateTime(dateStr) {
-      if (!dateStr) return '--'
-      var d = parseDate(dateStr)
-      if (!d) return dateStr
-      var y = d.getFullYear()
-      var m = ('' + (d.getMonth() + 1)).padStart(2, '0')
-      var day = ('' + d.getDate()).padStart(2, '0')
-      var h = ('' + d.getHours()).padStart(2, '0')
-      var min = ('' + d.getMinutes()).padStart(2, '0')
-      return y + '-' + m + '-' + day + ' ' + h + ':' + min
-    },
-    // 调整归属(仅在 subjectId 为空(无归属)的报告上显示)
-    adjustBinding(item) {
-      var self = this
-      // 弹出选择操作
-      uni.showActionSheet({
-        itemList: ['绑定新归属', '解除归属'],
-        itemColor: '#1890ff',
-        success: function(res) {
-          if (res.tapIndex === 0) {
-            // 绑定新归属:提示需选择成员,当前小程序端简化处理
-            uni.showModal({
-              title: '选择归属成员',
-              content: '请在管理端选择归属成员后操作',
-              showCancel: false,
-              confirmText: '确定'
-            })
-          } else {
-            // 解除归属:subjectId 设为 null
-            reassignReport(item.id, null).then(function(resp) {
-              if (resp.code === 200) {
-                uni.showToast({ title: '归属已解除', icon: 'success' })
-                self.loadData()
-              } else {
-                uni.showToast({ title: resp.message || '解除归属失败', icon: 'none' })
-              }
-            }).catch(function(e) {
-              console.log('解除归属失败', e)
-              uni.showToast({ title: '操作失败', icon: 'none' })
-            })
-          }
-        }
-      })
-    }
-  }
+  },
 }
 </script>