Browse Source

feat(api): 临时hack interceptors

gemercheung 3 năm trước cách đây
mục cha
commit
22803ed2a5

+ 1 - 1
mock/advertisement/selectAll.ts

@@ -28,7 +28,7 @@ const demoList = (() => {
 
 export default [
   {
-    url: '/basic-api/zfb/rotation/selectAll',
+    url: '/zfb-api/zfb/rotation/selectAll',
     timeout: 1000,
     method: 'get',
     response: ({ query }) => {

+ 1 - 1
mock/advertisement/selectId.ts

@@ -28,7 +28,7 @@ const demoList = (() => {
 
 export default [
   {
-    url: '/basic-api/zfb/rotation/selectAll',
+    url: '/zfb-api/zfb/rotation/selectAll',
     timeout: 1000,
     method: 'get',
     response: ({ query }) => {

+ 3 - 3
src/api/account/index.ts

@@ -2,9 +2,9 @@ import { defHttp } from '/@/utils/http/axios';
 import { GetAccountInfoModel } from './model';
 
 enum Api {
-  ACCOUNT_INFO = '/account/getAccountInfo',
-  SESSION_TIMEOUT = '/user/sessionTimeout',
-  TOKEN_EXPIRED = '/user/tokenExpired',
+  ACCOUNT_INFO = '/basic-api/account/getAccountInfo',
+  SESSION_TIMEOUT = '/basic-api/user/sessionTimeout',
+  TOKEN_EXPIRED = '/basic-api/user/tokenExpired',
 }
 
 // Get personal center-basic settings

+ 5 - 1
src/utils/http/axios/index.ts

@@ -58,7 +58,11 @@ const transform: AxiosTransform = {
       Reflect.has(data, 'code') &&
       (code === ResultEnum.SUCCESS || code === ResultEnum.NORMAL);
     if (hasSuccess) {
-      return result || data;
+      if (typeof message === 'object' && Reflect.has(message, 'pageSize')) {
+        return message;
+      } else {
+        return result || data;
+      }
     }
 
     // 在此处根据自己项目的实际情况对不同的code执行不同的操作

+ 7 - 0
src/views/dashboard/corporation/index.vue

@@ -154,6 +154,13 @@
         tableSetting: { fullScreen: true },
         showIndexColumn: false,
         rowKey: 'id',
+        //TODO
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'total',
+        },
         actionColumn: {
           width: 160,
           title: '操作',

+ 7 - 0
src/views/dashboard/corporation/verify.vue

@@ -96,6 +96,13 @@
         tableSetting: { fullScreen: true },
         showIndexColumn: false,
         rowKey: 'id',
+        //TODO
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'total',
+        },
       });
       // pagination.value = { pageSize: 20 };
       return {

+ 1 - 1
types/axios.d.ts

@@ -28,7 +28,7 @@ export interface RequestOptions {
 export interface Result<T = any> {
   code: number;
   type: 'success' | 'error' | 'warning';
-  message: string;
+  message: string | T;
   result: T;
 }