Ver código fonte

feat: add growth record API functions and page registrations

Add 5 new API functions: uploadAndParseReport (uni.uploadFile wrapper), createGrowthRecordFromUpload, createGrowthSupplement, checkGrowthDuplicate, getGrowthSupplements. Register upload.vue and supplement.vue pages in pages.json under growth subpackage.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
liaoxg 4 meses atrás
pai
commit
e0cb9188bc
2 arquivos alterados com 49 adições e 0 exclusões
  1. 8 0
      cfc-frontend/pages.json
  2. 41 0
      cfc-frontend/utils/api.js

+ 8 - 0
cfc-frontend/pages.json

@@ -488,6 +488,14 @@
         {
           "path": "assessment-result",
           "style": { "navigationBarTitleText": "测评报告" }
+        },
+        {
+          "path": "upload",
+          "style": { "navigationBarTitleText": "上传测评报告" }
+        },
+        {
+          "path": "supplement",
+          "style": { "navigationBarTitleText": "补充测评材料" }
         }
       ]
     },

+ 41 - 0
cfc-frontend/utils/api.js

@@ -755,6 +755,47 @@ export const deleteGrowthRecord = (id) => {
   return request('/api/growth/record/' + id + '/delete', 'POST')
 }
 
+export const uploadAndParseReport = (filePath) => {
+  return new Promise((resolve, reject) => {
+    const token = uni.getStorageSync('token')
+    uni.uploadFile({
+      url: BASE_URL + '/api/growth/record/upload-and-parse',
+      filePath: filePath,
+      name: 'file',
+      header: {
+        'Authorization': token ? 'Bearer ' + token : ''
+      },
+      success: (res) => {
+        const data = JSON.parse(res.data)
+        if (data.code === 200) {
+          resolve(data)
+        } else {
+          reject(data)
+        }
+      },
+      fail: (err) => {
+        reject(err)
+      }
+    })
+  })
+}
+
+export const createGrowthRecordFromUpload = (data) => {
+  return request('/api/growth/record/create-from-upload', 'POST', data)
+}
+
+export const createGrowthSupplement = (data) => {
+  return request('/api/growth/record/supplement', 'POST', data)
+}
+
+export const checkGrowthDuplicate = (data) => {
+  return request('/api/growth/record/check-duplicate', 'POST', data)
+}
+
+export const getGrowthSupplements = (id) => {
+  return request('/api/growth/record/' + id + '/supplements', 'POST')
+}
+
 // 成长规划师模块API
 export const getTeamMembers = () => {
   return request('/api/guide/team/members', 'POST')