Przeglądaj źródła

fix(frontend): 家庭地址编辑与区域匹配页面消除 $http 引用并接入真实接口

两页面均引用不存在的 $http 且部分接口路径后端不存在:address-edit 改用 getFamilyDetail/updateFamilyAddress(POST 对齐项目约定),street-match 改用 matchByStreet 与新增 count 接口。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Xiaogang Liao 3 miesięcy temu
rodzic
commit
49cc2e9ce8

+ 3 - 2
cfc-frontend/pages/family/address-edit.vue

@@ -24,6 +24,7 @@
 
 
 <script>
 <script>
 import AddressPicker from '@/components/address-picker.vue'
 import AddressPicker from '@/components/address-picker.vue'
+import { getFamilyDetail, updateFamilyAddress } from '@/utils/api.js'
 
 
 export default {
 export default {
   components: {
   components: {
@@ -52,7 +53,7 @@ export default {
   methods: {
   methods: {
     async loadFamilyInfo() {
     async loadFamilyInfo() {
       try {
       try {
-        const res = await this.$http.get(`/api/families/${this.familyId}`)
+        const res = await getFamilyDetail(this.familyId)
         const family = res.data
         const family = res.data
         
         
         if (family) {
         if (family) {
@@ -85,7 +86,7 @@ export default {
       
       
       this.loading = true
       this.loading = true
       try {
       try {
-        await this.$http.put(`/api/families/${this.familyId}/address`, {
+        await updateFamilyAddress(this.familyId, {
           streetId: this.formData.streetId,
           streetId: this.formData.streetId,
           province: this.formData.province,
           province: this.formData.province,
           city: this.formData.city,
           city: this.formData.city,

+ 4 - 7
cfc-frontend/pages/match/street-match.vue

@@ -46,6 +46,7 @@
 
 
 <script>
 <script>
 import AddressPicker from '@/components/address-picker.vue'
 import AddressPicker from '@/components/address-picker.vue'
+import { matchByStreet, countFamiliesByStreetIds, countTeachersByStreetIds } from '@/utils/api.js'
 
 
 export default {
 export default {
   components: {
   components: {
@@ -74,7 +75,7 @@ export default {
       this.matching = true
       this.matching = true
       try {
       try {
         // 获取匹配范围
         // 获取匹配范围
-        const matchRes = await this.$http.get(`/api/streets/${this.filterStreetId}/match`)
+        const matchRes = await matchByStreet(this.filterStreetId)
         this.matchResult = matchRes.data
         this.matchResult = matchRes.data
         
         
         // 统计各级别的家庭数
         // 统计各级别的家庭数
@@ -103,9 +104,7 @@ export default {
     async countFamilies(streetIds) {
     async countFamilies(streetIds) {
       if (!streetIds || streetIds.length === 0) return 0
       if (!streetIds || streetIds.length === 0) return 0
       try {
       try {
-        const res = await this.$http.get('/api/admin/families/count', {
-          params: { streetIds: streetIds.join(',') }
-        })
+        const res = await countFamiliesByStreetIds(streetIds)
         return res.data || 0
         return res.data || 0
       } catch (e) {
       } catch (e) {
         return 0
         return 0
@@ -115,9 +114,7 @@ export default {
     async countTeachers(streetIds) {
     async countTeachers(streetIds) {
       if (!streetIds || streetIds.length === 0) return 0
       if (!streetIds || streetIds.length === 0) return 0
       try {
       try {
-        const res = await this.$http.get('/api/admin/teachers/count', {
-          params: { streetIds: streetIds.join(',') }
-        })
+        const res = await countTeachersByStreetIds(streetIds)
         return res.data || 0
         return res.data || 0
       } catch (e) {
       } catch (e) {
         return 0
         return 0