diff --git a/.env b/.env index 3c2b7310..733a8577 100644 --- a/.env +++ b/.env @@ -2,10 +2,10 @@ VITE_DEV_PORT = '8001' # development path -VITE_DEV_PATH = / +VITE_DEV_PATH = '/' # production path -VITE_PRO_PATH = / +VITE_PRO_PATH = '/' # spa-title VITE_GLOB_APP_TITLE = GoView diff --git a/src/api/http.ts b/src/api/http.ts index 8984d137..2738217f 100644 --- a/src/api/http.ts +++ b/src/api/http.ts @@ -1,34 +1,35 @@ import axiosInstance from './axios' import { RequestEnum, ContentTypeEnum } from '@/enums/httpEnum' -// 缓存处理 -const filterUrl = (url: string) => { - return url.indexOf('?') !== -1 ? `${url}&time=${new Date().getTime()}` : `${url}?time=${new Date().getTime()}` -} - -export const get = (params: object, url: string) => { +export const get = (url: string, params: object) => { return axiosInstance({ - url: filterUrl(url), + url: url, method: RequestEnum.GET, - params + params, }) } -export const post = (params: object, url: string, headersType: string) => { +export const post = (url: string, params: object, headersType: string) => { return axiosInstance({ url: url, method: RequestEnum.POST, data: params, headers: { - 'Content-Type': headersType || ContentTypeEnum.JSON - } + 'Content-Type': headersType || ContentTypeEnum.JSON, + }, }) } -export const del = (params: object, url: string) => { +export const del = (url: string, params: object) => { return axiosInstance({ - url: filterUrl(url), + url: url, method: RequestEnum.DELETE, - params + params, }) -} \ No newline at end of file +} + +export default { + get, + post, + del, +} diff --git a/src/api/mock/index.js b/src/api/mock/index.js new file mode 100644 index 00000000..084afc54 --- /dev/null +++ b/src/api/mock/index.js @@ -0,0 +1,13 @@ +import Mock from 'mockjs' +import test from './test.mock' +Mock.setup({ + timeout: '300-600' +}) + +// 单个X数据 +const featchMockData = '/api/mockData' +Mock.mock(/\/api\/test(|\?\S*)$/, 'get', test.featchMockData) + +export { + featchMockData +} \ No newline at end of file diff --git a/src/api/mock/test.mock.js b/src/api/mock/test.mock.js new file mode 100644 index 00000000..71be5933 --- /dev/null +++ b/src/api/mock/test.mock.js @@ -0,0 +1,42 @@ +export default { + // 轮播图 + featchMockData: { + status: 200, + msg: "请求成功", + data: { + dimensions: ["product", "data1", "data2"], + source: [ + { + 'product': '@name', + 'data1|100-900': 3, + 'data2|100-900': 3, + }, + { + 'product': '@name', + 'data1|100-900': 3, + 'data2|100-900': 3, + }, + { + 'product': '@name', + 'data1|100-900': 3, + 'data2|100-900': 3, + }, + { + 'product': '@name', + 'data1|100-900': 3, + 'data2|100-900': 3, + }, + { + 'product': '@name', + 'data1|100-900': 3, + 'data2|100-900': 3, + }, + { + 'product': '@name', + 'data1|100-900': 3, + 'data2|100-900': 3, + }, + ] + } + } +} \ No newline at end of file diff --git a/src/components/GoSkeleton/index.vue b/src/components/GoSkeleton/index.vue index 3e3826da..394e6b03 100644 --- a/src/components/GoSkeleton/index.vue +++ b/src/components/GoSkeleton/index.vue @@ -1,14 +1,14 @@