Browse Source

feat(other): 调试接口

Yi 2 years ago
parent
commit
edb1154a40

+ 3 - 3
.env-config.ts

@@ -4,13 +4,13 @@ type ServiceEnv = Record<ServiceEnvType, ServiceEnvConfig>;
 /** 不同请求服务的环境配置 */
 const serviceEnv: ServiceEnv = {
   dev: {
-    url: 'http://localhost:8080'
+    url: 'http://192.168.1.70:8000'
   },
   test: {
-    url: 'http://localhost:8080'
+    url: 'http://192.168.1.70:8000'
   },
   prod: {
-    url: 'http://localhost:8080'
+    url: 'http://192.168.1.70:8000'
   }
 };
 

+ 7 - 2
src/service/api/event.ts

@@ -3,8 +3,13 @@ import { adapterOfFetchEventList, adapterOfFetchFieldList } from '@/service/api/
 import { backgroundRequest } from '../request';
 
 /** 获取用户列表 */
-export const fetchFieldList = async () => {
-  const data = await backgroundRequest.post<ApiBackground.Field[] | null>('/kpt/field/search');
+export const fetchFieldList = async (page: number, page_size: number, name: string) => {
+  const param = {
+    page,
+    page_size,
+    name
+  };
+  const data = await backgroundRequest.post<ApiBackground.Field[] | null>('/kpt/field/search', param);
   return adapter(adapterOfFetchFieldList, data);
 };
 

+ 1 - 1
src/service/request/index.ts

@@ -9,4 +9,4 @@ export const request = createRequest({ baseURL: isHttpProxy ? proxyPattern : url
 
 export const mockRequest = createRequest({ baseURL: '/mock' });
 
-export const backgroundRequest = createRequest({ baseURL: '/api/v1' });
+export const backgroundRequest = createRequest({ baseURL: 'http://192.168.1.70:8000/api/v1' });

+ 0 - 1
src/service/request/request.ts

@@ -20,7 +20,6 @@ interface RequestParam {
  */
 export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: Service.BackendResultConfig) {
   const customInstance = new CustomAxiosInstance(axiosConfig, backendConfig);
-
   /**
    * 异步promise请求
    * @param param - 请求参数

+ 2 - 2
src/views/background/field/index.vue

@@ -49,7 +49,7 @@ function setTableData(data: BackgroundField.Field[]) {
 
 async function getTableData() {
   startLoading();
-  const { data } = await fetchFieldList();
+  const { data } = await fetchFieldList(1, 10, fieldName.value);
   if (data) {
     setTimeout(() => {
       setTableData(data);
@@ -168,7 +168,7 @@ function handleSearch() {
   if (!fieldName.value) {
     window.$message?.warning('请输入字段名称');
   } else {
-    console.log(fieldName.value);
+    startLoading();
   }
 }