fix: 修复: 🧩 校验测试
This commit is contained in:
parent
b1d9b00eb1
commit
e60684b7c2
|
@ -14,6 +14,11 @@ server {
|
||||||
proxy_pass http://192.168.3.98:1001;
|
proxy_pass http://192.168.3.98:1001;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# mock 跨域
|
||||||
|
location ~/api/ {
|
||||||
|
proxy_pass http://192.168.3.98:1001;
|
||||||
|
}
|
||||||
|
|
||||||
error_page 404 404.html;
|
error_page 404 404.html;
|
||||||
|
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
|
import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||||
*/
|
*/
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history:
|
history:
|
||||||
process.env.NODE_ENV === 'production' ? createWebHashHistory(process.env.BASE_URL) : createWebHashHistory(process.env.BASE_URL),
|
process.env.NODE_ENV === 'production' ? createWebHashHistory(process.env.BASE_URL) : createWebHistory(process.env.BASE_URL),
|
||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const request = axios.create({
|
||||||
|
baseURL: '/mock',
|
||||||
|
timeout: 10000,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 请求拦截器
|
||||||
|
request.interceptors.request.use(config => {
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 响应拦截器
|
||||||
|
request.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
return Promise.reject(new Error('网络错误'));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export default request;
|
|
@ -27,6 +27,10 @@ module.exports = defineConfig({
|
||||||
target: process.env.VUE_APP_URL,
|
target: process.env.VUE_APP_URL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
|
'/mock': {
|
||||||
|
target: process.env.VUE_APP_URL,
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
|
|
Loading…
Reference in New Issue