1、修改本地开发ip
This commit is contained in:
parent
e895946567
commit
f36d4a8599
@ -20,7 +20,7 @@ const isWhiteList = (path: string) => {
|
|||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
// 仅仅限本地无token调试时候,不做token校验
|
// 仅仅限本地无token调试时候,不做token校验
|
||||||
/* next();
|
/* next();
|
||||||
return;*/
|
return;*/
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
to.meta.title && useSettingsStore().setTitle(to.meta.title as string);
|
to.meta.title && useSettingsStore().setTitle(to.meta.title as string);
|
||||||
|
@ -1,47 +1,39 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { reactive } from 'vue';
|
|
||||||
import { listPmsProductCategory } from '@/api/pms/productCategory';
|
import { listPmsProductCategory } from '@/api/pms/productCategory';
|
||||||
import { allBrand } from '@/api/pms/brand';
|
import { allBrand } from '@/api/pms/brand';
|
||||||
import { areaSelect } from '@/api/system/common.js';
|
import { areaSelect } from '@/api/system/common.js';
|
||||||
|
|
||||||
export const useMallStore = defineStore('mall', () => {
|
export const useMallStore = defineStore('mall', () => {
|
||||||
const state = reactive({
|
const state = ref({
|
||||||
productCategories: [],
|
productCategories: [],
|
||||||
brandList: [],
|
brandList: [],
|
||||||
areaSelect: [],
|
areaSelect: []
|
||||||
aaaaaaa: 'store开发测试'
|
|
||||||
});
|
});
|
||||||
const aaaaaaa = ref('store开发测试');
|
|
||||||
const changeAAA = (info: any) => {
|
|
||||||
aaaaaaa.value = info;
|
|
||||||
};
|
|
||||||
const loadProductCategories = async (force: any = false) => {
|
const loadProductCategories = async (force: any = false) => {
|
||||||
if (!force && state.productCategories.length > 0) {
|
if (!force && state.value.productCategories.length > 0) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
return listPmsProductCategory({}).then((res: any) => {
|
return listPmsProductCategory({}).then((res: any) => {
|
||||||
state.productCategories = res;
|
state.value.productCategories = res;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const loadAreaSelect = async (force: any = false) => {
|
const loadAreaSelect = async (force: any = false) => {
|
||||||
if (!force && state.areaSelect.length > 0) {
|
if (!force && state.value.areaSelect.length > 0) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
return areaSelect({}).then((res) => {
|
return areaSelect({}).then((res) => {
|
||||||
state.areaSelect = res.data;
|
state.value.areaSelect = res.data;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const loadBrandList = async (force: any = false) => {
|
const loadBrandList = async (force: any = false) => {
|
||||||
if (!force && state.brandList.length > 0) {
|
if (!force && state.value.brandList.length > 0) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
return allBrand({}).then((res: any) => {
|
return allBrand({}).then((res: any) => {
|
||||||
state.brandList = res;
|
state.value.brandList = res;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
changeAAA,
|
|
||||||
aaaaaaa,
|
|
||||||
state,
|
state,
|
||||||
loadProductCategories,
|
loadProductCategories,
|
||||||
loadAreaSelect,
|
loadAreaSelect,
|
||||||
|
@ -124,7 +124,6 @@ service.interceptors.response.use(
|
|||||||
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
return Promise.resolve(res.data);
|
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
if (!isRelogin.show) {
|
if (!isRelogin.show) {
|
||||||
@ -148,7 +147,7 @@ service.interceptors.response.use(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
|
||||||
} else if (code === HttpStatus.SERVER_ERROR) {
|
} else if (code === HttpStatus.SERVER_ERROR || code === HttpStatus.NOT_FOUND) {
|
||||||
ElMessage({ message: msg, type: 'error' });
|
ElMessage({ message: msg, type: 'error' });
|
||||||
return Promise.reject(new Error(msg));
|
return Promise.reject(new Error(msg));
|
||||||
} else if (code === HttpStatus.WARN) {
|
} else if (code === HttpStatus.WARN) {
|
||||||
|
@ -24,7 +24,8 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
open: true,
|
open: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
[env.VITE_APP_BASE_API]: {
|
[env.VITE_APP_BASE_API]: {
|
||||||
target: 'http://192.168.1.250:8080',
|
// target: 'http://192.168.1.250:8080',
|
||||||
|
target: 'http://192.168.1.13:8080',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''),
|
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user