Explorar el Código

fix(frontend): 移除前端身份参数传递——前端只传memberId,不传userId/familyId/childId

- 移除 api.js 全局 X-User-Id 请求头(request + langgraphRequest 两处)
- 移除 pages/promotion/material.vue 本地 _request 的 X-User-Id 头
- 测评 wrapper(getMy/ChildAssessmentResults)改为无参发送 {}
- 测评页面(results/apply/purchase)停传 userId
- 删除 mind/index.vue 两个指向不存在端点的死调用(/api/mind/report/*)
- 移除 report-upload/meal-config/bind-invite 的 familyId/family_id 传参
- parent-index.vue getPendingWishes() 去实参(wrapper 已忽略)
Xiaogang Liao hace 2 meses
padre
commit
3d0df0fdce

+ 0 - 2
cfc-frontend/pages/assessment/apply.vue

@@ -315,9 +315,7 @@ export default {
             uni.showToast({ title: res.message || '预约失败', icon: 'none' })
             uni.showToast({ title: res.message || '预约失败', icon: 'none' })
           }
           }
         } else {
         } else {
-          const userId = uni.getStorageSync('userId')
           const res = await createAssessmentAppointment({
           const res = await createAssessmentAppointment({
-            userId: userId,
             memberId: this.selectedChildId,
             memberId: this.selectedChildId,
             teacherId: this.selectedGuideId,
             teacherId: this.selectedGuideId,
             assessorId: this.selectedGuideId,
             assessorId: this.selectedGuideId,

+ 0 - 2
cfc-frontend/pages/assessment/purchase.vue

@@ -274,12 +274,10 @@ export default {
       this.submitting = true
       this.submitting = true
       uni.showLoading({ title: '创建订单中...' })
       uni.showLoading({ title: '创建订单中...' })
 
 
-      var userId = uni.getStorageSync('userId')
       var self = this
       var self = this
 
 
       try {
       try {
         var createRes = await createAssessmentOrder({
         var createRes = await createAssessmentOrder({
-          userId: userId,
           memberId: memberId,
           memberId: memberId,
           guideId: this.selectedGuideId,
           guideId: this.selectedGuideId,
           guideName: this.selectedGuideName,
           guideName: this.selectedGuideName,

+ 2 - 4
cfc-frontend/pages/assessment/results.vue

@@ -189,12 +189,10 @@ export default {
   methods: {
   methods: {
     async loadData() {
     async loadData() {
       try {
       try {
-        const userId = uni.getStorageSync('userId')
-        
         // 并行获取数据
         // 并行获取数据
         const [myRes, childRes] = await Promise.all([
         const [myRes, childRes] = await Promise.all([
-          getMyAssessmentResults(userId),
-          getChildAssessmentResults(userId)
+          getMyAssessmentResults(),
+          getChildAssessmentResults()
         ])
         ])
 
 
         if (myRes.code === 200) {
         if (myRes.code === 200) {

+ 2 - 5
cfc-frontend/pages/diet/meal-config.vue

@@ -82,13 +82,12 @@ export default {
     loadMembers: function() {
     loadMembers: function() {
       var self = this
       var self = this
       var token = uni.getStorageSync('token')
       var token = uni.getStorageSync('token')
-      var familyId = uni.getStorageSync('familyId')
-      if (!token || !familyId) return
+      if (!token) return
       
       
       uni.request({
       uni.request({
         url: this.getApiUrl('/api/family/member/list'),
         url: this.getApiUrl('/api/family/member/list'),
         method: 'POST',
         method: 'POST',
-        data: { familyId: familyId },
+        data: {},
         header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
         header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
         success: function(res) {
         success: function(res) {
           if (res.data && res.data.code === 200 && res.data.data) {
           if (res.data && res.data.code === 200 && res.data.data) {
@@ -147,11 +146,9 @@ export default {
       var self = this
       var self = this
       this.saving = true
       this.saving = true
       
       
-      var familyId = uni.getStorageSync('familyId')
       var promises = this.mealTypes.map(function(meal) {
       var promises = this.mealTypes.map(function(meal) {
         var config = self.mealConfigs[meal.value] || {}
         var config = self.mealConfigs[meal.value] || {}
         return saveMealConfig({
         return saveMealConfig({
-          family_id: familyId,
           date_type: self.dateType,
           date_type: self.dateType,
           meal_type: meal.value,
           meal_type: meal.value,
           participant_member_ids: JSON.stringify(config.participantMemberIds || '[]')
           participant_member_ids: JSON.stringify(config.participantMemberIds || '[]')

+ 0 - 1
cfc-frontend/pages/guide/bind/invite.vue

@@ -155,7 +155,6 @@ export default {
           data: {
           data: {
             guideId: this.guideId,
             guideId: this.guideId,
             bindToken: this.inviteToken,
             bindToken: this.inviteToken,
-            familyId: this.selectedFamily.id,
             serviceType: this.serviceType.value,
             serviceType: this.serviceType.value,
             servicePrice: this.servicePrice
             servicePrice: this.servicePrice
           }
           }

+ 2 - 2
cfc-frontend/pages/health-pkg/report-upload.vue

@@ -265,7 +265,7 @@ export default {
       if (self.selectedFile) {
       if (self.selectedFile) {
         // PDF文件上传
         // PDF文件上传
         uni.uploadFile({
         uni.uploadFile({
-          url: apiPath + '?familyId=' + self.familyId + (self.memberId ? '&memberId=' + self.memberId : ''),
+          url: apiPath + (self.memberId ? '?memberId=' + self.memberId : ''),
           filePath: filePath,
           filePath: filePath,
           name: 'file',
           name: 'file',
           header: {
           header: {
@@ -289,7 +289,7 @@ export default {
       } else if (self.photoPath) {
       } else if (self.photoPath) {
         // 图片上传
         // 图片上传
         uni.uploadFile({
         uni.uploadFile({
-          url: apiPath + '?type=image&familyId=' + self.familyId + (self.memberId ? '&memberId=' + self.memberId : ''),
+          url: apiPath + '?type=image' + (self.memberId ? '&memberId=' + self.memberId : ''),
           filePath: filePath,
           filePath: filePath,
           name: 'file',
           name: 'file',
           header: {
           header: {

+ 1 - 1
cfc-frontend/pages/home-pages/parent-index.vue

@@ -765,7 +765,7 @@ export default {
         this.pendingReviewTasks = allReviewTasks.slice(0, 3)
         this.pendingReviewTasks = allReviewTasks.slice(0, 3)
 
 
         try {
         try {
-          const wishRes = await getPendingWishes(this._familyId)
+          const wishRes = await getPendingWishes()
           this.pendingReviewWishes = wishRes.data || []
           this.pendingReviewWishes = wishRes.data || []
         } catch (e) {
         } catch (e) {
           console.log('获取待处理心愿失败', e)
           console.log('获取待处理心愿失败', e)

+ 1 - 70
cfc-frontend/pages/mind/index.vue

@@ -274,11 +274,7 @@ components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnerg
     },
     },
     
     
     // 家庭天盘 - 每日运势数据
     // 家庭天盘 - 每日运势数据
-    dailyFortuneData: null,
-
-    // 心理报告上传
-    uploadedReports: [],
-    reportUploadLoading: false
+    dailyFortuneData: null
     }
     }
   },
   },
   computed: {
   computed: {
@@ -532,54 +528,6 @@ components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnerg
         })
         })
     },
     },
 
 
-    // ===== 心理报告上传 =====
-    chooseAndUploadReport: function() {
-      var self = this
-      uni.chooseImage({
-        count: 1,
-        sizeType: ['original', 'compressed'],
-        sourceType: ['album', 'camera'],
-        success: function(chooseRes) {
-          self.reportUploadLoading = true
-          var tempFilePath = chooseRes.tempFilePaths[0]
-          var fileName = '心理报告_' + Date.now() + '.jpg'
-
-          uni.uploadFile({
-            url: config.baseUrl + '/api/mind/report/upload',
-            filePath: tempFilePath,
-            name: 'report',
-            formData: {
-              familyId: self.currentChildId || ''
-            },
-            header: {
-              'Authorization': 'Bearer ' + uni.getStorageSync('token')
-            },
-            success: function(uploadRes) {
-              self.reportUploadLoading = false
-              if (uploadRes.statusCode === 200) {
-                var result = JSON.parse(uploadRes.data)
-                if (result.code === 200) {
-                  self.uploadedReports.unshift(result.data)
-                  uni.showToast({ title: '上传成功', icon: 'success' })
-                } else {
-                  uni.showToast({ title: result.message || '上传失败', icon: 'none' })
-                }
-              } else {
-                uni.showToast({ title: '上传失败: ' + uploadRes.statusCode, icon: 'none' })
-              }
-            },
-            fail: function(err) {
-              self.reportUploadLoading = false
-              uni.showToast({ title: '上传失败: ' + (err.errMsg || ''), icon: 'none' })
-            }
-          })
-        },
-        fail: function() {
-          // 用户取消选择
-        }
-      })
-    },
-
     viewReport: function(report) {
     viewReport: function(report) {
       if (report && report.fileUrl) {
       if (report && report.fileUrl) {
         uni.downloadFile({
         uni.downloadFile({
@@ -598,23 +546,6 @@ components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnerg
       }
       }
     },
     },
 
 
-    loadUploadedReports: function() {
-      var self = this
-      uni.request({
-        url: config.baseUrl + '/api/mind/report/list',
-        method: 'POST',
-        data: { familyId: self.currentChildId || '' },
-        header: {
-          'Authorization': 'Bearer ' + uni.getStorageSync('token')
-        },
-        success: function(res) {
-          if (res.data && res.data.code === 200 && res.data.data) {
-            self.uploadedReports = res.data.data
-          }
-        }
-      })
-    },
-
     formatDate: function(dateStr) {
     formatDate: function(dateStr) {
       if (!dateStr) return ''
       if (!dateStr) return ''
       var d = parseDate(dateStr)
       var d = parseDate(dateStr)

+ 0 - 1
cfc-frontend/pages/promotion/material.vue

@@ -82,7 +82,6 @@ function _request(url, method, data) {
       data: data || {},
       data: data || {},
       header: {
       header: {
         'Content-Type': 'application/json',
         'Content-Type': 'application/json',
-        'X-User-Id': uni.getStorageSync('userId') || '',
         'Authorization': token ? 'Bearer ' + token : ''
         'Authorization': token ? 'Bearer ' + token : ''
       },
       },
       success: function(res) {
       success: function(res) {

+ 4 - 9
cfc-frontend/utils/api.js

@@ -42,7 +42,6 @@ const request = (url, method = 'POST', data = {}, options = {}) => {
       data: data,
       data: data,
       header: {
       header: {
         'Content-Type': 'application/json',
         'Content-Type': 'application/json',
-        'X-User-Id': uni.getStorageSync('userId') || '',
         'Authorization': token ? `Bearer ${token}` : ''
         'Authorization': token ? `Bearer ${token}` : ''
       },
       },
       success: (res) => {
       success: (res) => {
@@ -115,7 +114,6 @@ const langgraphRequest = (opts) => {
 
 
   return new Promise((resolve, reject) => {
   return new Promise((resolve, reject) => {
     var token = uni.getStorageSync('token')
     var token = uni.getStorageSync('token')
-    var userId = uni.getStorageSync('userId') || ''
 
 
     uni.request({
     uni.request({
       url: LANGGRAPH_URL + langgraphPath,
       url: LANGGRAPH_URL + langgraphPath,
@@ -123,7 +121,6 @@ const langgraphRequest = (opts) => {
       data: langgraphBody,
       data: langgraphBody,
       header: {
       header: {
         'Content-Type': 'application/json',
         'Content-Type': 'application/json',
-        'X-User-Id': userId,
         'Authorization': token ? ('Bearer ' + token) : ''
         'Authorization': token ? ('Bearer ' + token) : ''
       },
       },
       timeout: 30000,
       timeout: 30000,
@@ -893,13 +890,13 @@ export const handleAlipayCallback = (params) => {
 }
 }
 
 
 // 获取我的测评报告
 // 获取我的测评报告
-export const getMyAssessmentResults = (userId) => {
-  return request('/api/dan-assessment/my-results', 'POST', { userId })
+export const getMyAssessmentResults = () => {
+  return request('/api/dan-assessment/my-results', 'POST', {})
 }
 }
 
 
 // 获取下级成长规划师的测评报告
 // 获取下级成长规划师的测评报告
-export const getChildAssessmentResults = (userId) => {
-  return request('/api/dan-assessment/child-results', 'POST', { userId })
+export const getChildAssessmentResults = () => {
+  return request('/api/dan-assessment/child-results', 'POST', {})
 }
 }
 
 
 // 获取测评报告详情
 // 获取测评报告详情
@@ -2024,8 +2021,6 @@ export const withdrawFamilyEarnings = (data) => request('/api/earnings/admin/wit
 export const getTodayTasksByCategory = (memberId, category) => {
 export const getTodayTasksByCategory = (memberId, category) => {
   return request('/api/tasks/today', 'POST', { memberId: memberId, category: category })
   return request('/api/tasks/today', 'POST', { memberId: memberId, category: category })
 
 
-  return request('/api/tasks/today', 'POST', { childId: childId, category: category })
-
 }
 }
 export const getTaskHistoryByCategory = (memberId, category, page, size) => {
 export const getTaskHistoryByCategory = (memberId, category, page, size) => {
   return request('/api/tasks/history', 'POST', { memberId: memberId, category: category, page: page || 1, size: size || 10 })
   return request('/api/tasks/history', 'POST', { memberId: memberId, category: category, page: page || 1, size: size || 10 })