diff --git a/ZR.Vue/.env.development b/ZR.Vue/.env.development index 7ee997f..e4fd273 100644 --- a/ZR.Vue/.env.development +++ b/ZR.Vue/.env.development @@ -6,4 +6,4 @@ ENV = 'development' VUE_APP_BASE_API = 'http://localhost:8888/' # 路由前缀 -VUE_APP_ROUTER_PREFIX = '/admin' +VUE_APP_ROUTER_PREFIX = '/' diff --git a/ZR.Vue/src/components/Breadcrumb/index.vue b/ZR.Vue/src/components/Breadcrumb/index.vue index 97603c4..b1e9041 100644 --- a/ZR.Vue/src/components/Breadcrumb/index.vue +++ b/ZR.Vue/src/components/Breadcrumb/index.vue @@ -10,60 +10,57 @@ diff --git a/ZR.Vue/src/router/index.js b/ZR.Vue/src/router/index.js index 8cd2d6a..6296a97 100644 --- a/ZR.Vue/src/router/index.js +++ b/ZR.Vue/src/router/index.js @@ -25,17 +25,14 @@ import Layout from '@/layout' */ // 公共路由 -export const constantRoutes = [ - { +export const constantRoutes = [{ path: '/redirect', component: Layout, hidden: true, - children: [ - { - path: '/redirect/:path(.*)', - component: (resolve) => require(['@/views/redirect'], resolve) - } - ] + children: [{ + path: '/redirect/:path(.*)', + component: (resolve) => require(['@/views/redirect'], resolve) + }] }, { path: '/login', @@ -56,56 +53,25 @@ export const constantRoutes = [ path: '', component: Layout, redirect: 'index', - children: [ - { - path: 'index', - component: (resolve) => require(['@/views/index'], resolve), - name: '首页', - meta: { title: '首页', icon: 'icon1', noCache: true, affix: true } - } - ], - hidden: true + children: [{ + path: 'index', + component: (resolve) => require(['@/views/index'], resolve), + name: 'Index', + meta: { title: '首页', icon: 'dashboard', affix: true } + }], }, - // { - // path: '', - // component: Layout, - // redirect: 'index', - // children: [ - // { - // path: 'dashboard', - // component: (resolve) => require(['@/views/index_v1'], resolve), - // name: '控制台', - // meta: { title: '控制台', icon: 'dashboard', noCache: true, affix: true } - // } - // ] - // }, { path: '/user', component: Layout, hidden: true, redirect: 'noredirect', - children: [ - { - path: 'profile', - component: (resolve) => require(['@/views/system/user/profile/index'], resolve), - name: 'Profile', - meta: { title: '个人中心', icon: 'user' } - } - ] + children: [{ + path: 'profile', + component: (resolve) => require(['@/views/system/user/profile/index'], resolve), + name: 'Profile', + meta: { title: '个人中心', icon: 'user' } + }] }, - // { - // path: '/dict', - // component: Layout, - // hidden: true, - // children: [ - // { - // path: 'type/data/:dictId(\\d+)', - // component: (resolve) => require(['@/views/system/dict/data'], resolve), - // name: 'Data', - // meta: { title: '字典数据', icon: '' } - // } - // ] - // } ] export default new Router({ @@ -113,4 +79,4 @@ export default new Router({ mode: 'history', // 去掉url中的# // scrollBehavior: () => ({ y: 0 }), routes: constantRoutes -}) +}) \ No newline at end of file diff --git a/ZR.Vue/src/store/modules/permission.js b/ZR.Vue/src/store/modules/permission.js index 0872b64..093d46d 100644 --- a/ZR.Vue/src/store/modules/permission.js +++ b/ZR.Vue/src/store/modules/permission.js @@ -21,10 +21,10 @@ const permission = { }, SET_TOPBAR_ROUTES: (state, routes) => { // 顶部导航菜单默认添加统计报表栏指向首页 - const index = [{ - path: 'index', - meta: { title: '统计报表', icon: 'dashboard' } - }] + // const index = [{ + // path: 'index', + // meta: { title: '系统首页', icon: 'dashboard' } + // }] state.topbarRouters = routes; //.concat(index); }, SET_SIDEBAR_ROUTERS: (state, routes) => { diff --git a/ZR.Vue/src/store/modules/settings.js b/ZR.Vue/src/store/modules/settings.js index cf0cce9..907cede 100644 --- a/ZR.Vue/src/store/modules/settings.js +++ b/ZR.Vue/src/store/modules/settings.js @@ -4,34 +4,34 @@ const { theme, sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLo const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '' const state = { - theme: storageSetting.theme || theme, //主题颜色 - sideTheme: storageSetting.sideTheme || sideTheme, //侧边主题样式 - topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, - showSettings: showSettings, - tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView, - fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader, - sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo, - // dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle + theme: storageSetting.theme || theme, //主题颜色 + sideTheme: storageSetting.sideTheme || sideTheme, //侧边主题样式 + topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, + showSettings: showSettings, + tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView, + fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader, + sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo, + // dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle } const mutations = { - CHANGE_SETTING: (state, { key, value }) => { - if (state.hasOwnProperty(key)) { - state[key] = value - } + CHANGE_SETTING: (state, { key, value }) => { + if (state.hasOwnProperty(key)) { + state[key] = value } + } } const actions = { - //修改布局设置 - changeSetting({ commit }, data) { - commit('CHANGE_SETTING', data) - } + //修改布局设置 + changeSetting({ commit }, data) { + commit('CHANGE_SETTING', data) + } } export default { - namespaced: true, - state, - mutations, - actions + namespaced: true, + state, + mutations, + actions } \ No newline at end of file diff --git a/ZR.Vue/src/store/modules/tagsView.js b/ZR.Vue/src/store/modules/tagsView.js index 2e30d15..0714cb8 100644 --- a/ZR.Vue/src/store/modules/tagsView.js +++ b/ZR.Vue/src/store/modules/tagsView.js @@ -62,6 +62,40 @@ const mutations = { break } } + }, + + DEL_RIGHT_VIEWS: (state, view) => { + const index = state.visitedViews.findIndex(v => v.path === view.path) + if (index === -1) { + return + } + state.visitedViews = state.visitedViews.filter((item, idx) => { + if (idx <= index || (item.meta && item.meta.affix)) { + return true + } + const i = state.cachedViews.indexOf(item.name) + if (i > -1) { + state.cachedViews.splice(i, 1) + } + return false + }) + }, + + DEL_LEFT_VIEWS: (state, view) => { + const index = state.visitedViews.findIndex(v => v.path === view.path) + if (index === -1) { + return + } + state.visitedViews = state.visitedViews.filter((item, idx) => { + if (idx >= index || (item.meta && item.meta.affix)) { + return true + } + const i = state.cachedViews.indexOf(item.name) + if (i > -1) { + state.cachedViews.splice(i, 1) + } + return false + }) } } @@ -148,7 +182,21 @@ const actions = { updateVisitedView({ commit }, view) { commit('UPDATE_VISITED_VIEW', view) - } + }, + + delRightTags({ commit }, view) { + return new Promise(resolve => { + commit('DEL_RIGHT_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, + + delLeftTags({ commit }, view) { + return new Promise(resolve => { + commit('DEL_LEFT_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, } export default { @@ -156,4 +204,4 @@ export default { state, mutations, actions -} +} \ No newline at end of file