Просмотр исходного кода

feat(frontend): add API functions and page registration for service role apply

Xiaogang Liao 3 месяцев назад
Родитель
Сommit
624553b428
2 измененных файлов с 40 добавлено и 3 удалено
  1. 8 2
      cfc-frontend/pages.json
  2. 32 1
      cfc-frontend/utils/api.js

+ 8 - 2
cfc-frontend/pages.json

@@ -1225,10 +1225,16 @@
     {
       "root": "pages/member-detail",
       "pages": [
+{
+          "path": "report-detail",
+          "style": {
+            "navigationBarTitleText": "报告详情"
+          }
+        },
         {
-          "path": "member-detail",
+          "path": "service-role-apply",
           "style": {
-            "navigationBarTitleText": "成员详情"
+            "navigationBarTitleText": "服务角色申请"
           }
         }
       ]

+ 32 - 1
cfc-frontend/utils/api.js

@@ -2178,4 +2178,35 @@ export const cancelAppointment = (id) => {
 // 统一报告管理
 export const getReportSummaryList = (params) => request('/api/report-summary/list', 'POST', params)
 export const getReportSummaryDetail = (id) => request('/api/report-summary/detail/' + id, 'POST', {})
-export const downloadReportSummary = (id) => request('/api/report-summary/download/' + id, 'POST', {})
+export const downloadReportSummary = (id) => request('/api/report-summary/download/' + id, 'POST', {})
+
+// 服务角色统一申请
+export const submitServiceRoleApply = (data) => {
+    return request('/api/service-role/apply', 'POST', data)
+}
+
+export const getMyServiceRoleApply = () => {
+    return request('/api/service-role/my-apply', 'POST', {})
+}
+
+export const uploadServiceRoleImage = (filePath) => {
+    return new Promise((resolve, reject) => {
+        uni.uploadFile({
+            url: BASE_URL + '/api/service-role/upload-image',
+            filePath: filePath,
+            name: 'file',
+            header: {
+                'Authorization': 'Bearer ' + uni.getStorageSync('token')
+            },
+            success: (res) => {
+                if (res.statusCode === 200) {
+                    const data = JSON.parse(res.data)
+                    resolve(data)
+                } else {
+                    reject(new Error('上传失败'))
+                }
+            },
+            fail: reject
+        })
+    })
+}