'admin-21.03.15:添加开发/线上环境配置.env、修复tagsView页面设置隐藏时不显示的问题'

This commit is contained in:
lyt 2021-03-15 18:36:32 +08:00
parent 8c64de8393
commit 577a1cdac6
6 changed files with 2195 additions and 6 deletions

5
.env.development Normal file
View File

@ -0,0 +1,5 @@
# 本地环境
ENV = 'development'
# 本地环境接口地址
VITE_API_URL = 'http://localhost:10000/'

5
.env.production Normal file
View File

@ -0,0 +1,5 @@
# 线上环境
ENV = 'production'
# 线上环境接口地址
VITE_API_URL = 'https://gitee.com/gitee.io'

4
source.d.ts vendored
View File

@ -3,6 +3,4 @@ declare module '*.png';
declare module '*.jpg';
declare module '*.scss';
declare module '*.ts';
declare module 'qrcodejs2-fixes';
declare module 'element-plus';
declare module 'element-plus/lib/locale/lang/zh-cn';
declare module '*.js';

View File

@ -5,7 +5,7 @@ import router, { resetRoute } from '/@/router/index.ts';
// 配置新建一个 axios 实例
const service = axios.create({
baseURL: 'http://localhost:10000/',
baseURL: import.meta.env.VITE_API_URL as any,
timeout: 50000,
headers: { 'Content-Type': 'application/json' },
});

View File

@ -107,7 +107,7 @@ export default {
if (state.tagsViewList.some((v: any) => v.path === path)) return false;
const item = state.tagsViewRoutesList.find((v: any) => v.path === path);
if (item.meta.isLink && !item.meta.isIframe) return false;
if (!item.meta.isHide) state.tagsViewList.push({ ...item });
state.tagsViewList.push({ ...item });
addBrowserSetSession(state.tagsViewList);
};
// 2 tagsView
@ -157,6 +157,16 @@ export default {
screenfulls.request(element);
});
};
// 7 `isHide`
const removeCurrentTagsView = (from: any) => {
const { meta, path } = from;
state.tagsViewList.map((v: any, k: number) => {
if (meta.isHide && path === v.path) {
state.tagsViewList.splice(k, 1);
addBrowserSetSession(state.tagsViewList);
}
});
};
//
const onCurrentContextmenuClick = (data: any) => {
let { id, path } = data;
@ -318,7 +328,8 @@ export default {
initSortable();
});
//
onBeforeRouteUpdate((to) => {
onBeforeRouteUpdate((to, from) => {
removeCurrentTagsView(from);
state.routePath = to.path;
addTagsView(to.path);
getTagsRefsIndex(to.path);

2170
yarn.lock Normal file

File diff suppressed because it is too large Load Diff