update
This commit is contained in:
parent
7d5e0721df
commit
27f3c15f76
@ -23,14 +23,13 @@ export const useContextMenu = (tagList) => {
|
|||||||
state.visible = false;
|
state.visible = false;
|
||||||
},
|
},
|
||||||
refreshSelectedTag (tag) {
|
refreshSelectedTag (tag) {
|
||||||
store.dispatch("tags/delCacheList", tag).then(() => {
|
store.dispatch("tags/delCacheList", tag)
|
||||||
const { fullPath } = tag;
|
const { fullPath } = tag;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
router.replace({
|
router.replace({
|
||||||
path: "/redirect" + fullPath,
|
path: "/redirect" + fullPath,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
closeTag (tag) {
|
closeTag (tag) {
|
||||||
if (isAffix(tag)) return;
|
if (isAffix(tag)) return;
|
||||||
@ -38,21 +37,18 @@ export const useContextMenu = (tagList) => {
|
|||||||
const closedTagIndex = tagList.value.findIndex(
|
const closedTagIndex = tagList.value.findIndex(
|
||||||
(item) => item.fullPath === tag.fullPath
|
(item) => item.fullPath === tag.fullPath
|
||||||
);
|
);
|
||||||
store.dispatch("tags/delTag", tag).then(() => {
|
store.dispatch("tags/delTag", tag)
|
||||||
if (isActive(tag)) {
|
if (isActive(tag)) {
|
||||||
toLastTag(closedTagIndex - 1);
|
toLastTag(closedTagIndex - 1);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
closeOtherTags () {
|
closeOtherTags () {
|
||||||
store.dispatch("tags/delOtherTags", state.selectedTag).then(() => {
|
store.dispatch("tags/delOtherTags", state.selectedTag)
|
||||||
router.push(state.selectedTag);
|
router.push(state.selectedTag);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
closeAllTags () {
|
closeAllTags () {
|
||||||
store.dispatch("tags/delAllTags").then(() => {
|
store.dispatch("tags/delAllTags")
|
||||||
router.push("/");
|
router.push("/");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,19 @@
|
|||||||
|
import store from '@/store'
|
||||||
|
|
||||||
|
const checkUserinfo = (code) => {
|
||||||
|
const userinfo = store.state.account.userinfo
|
||||||
|
if (!!userinfo) {
|
||||||
|
return `/error/${code}`
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
const Layout = () => import('@/layout/index.vue')
|
const Layout = () => import('@/layout/index.vue')
|
||||||
const Error = () => import("@/views/error/index.vue");
|
const Error = () => import("@/views/error/index.vue");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/error',
|
path: '/error',
|
||||||
@ -42,6 +54,9 @@ export default [
|
|||||||
component: Error,
|
component: Error,
|
||||||
props: {
|
props: {
|
||||||
error: '403'
|
error: '403'
|
||||||
|
},
|
||||||
|
beforeEnter () {
|
||||||
|
return checkUserinfo('403')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -50,14 +65,20 @@ export default [
|
|||||||
component: Error,
|
component: Error,
|
||||||
props: {
|
props: {
|
||||||
error: '500'
|
error: '500'
|
||||||
|
},
|
||||||
|
beforeEnter () {
|
||||||
|
return checkUserinfo('500')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/:pathMatch(.*)*',
|
path: '/:pathMatch(.*)',
|
||||||
name: 'not-found',
|
name: 'not-found',
|
||||||
component: Error,
|
component: Error,
|
||||||
props: {
|
props: {
|
||||||
error: '404'
|
error: '404'
|
||||||
|
},
|
||||||
|
beforeEnter () {
|
||||||
|
return checkUserinfo('404')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -1,8 +1,15 @@
|
|||||||
|
const Layout = () => import('@/layout/index.vue')
|
||||||
const Redirect = () => import("@/views/redirect/index.vue");
|
const Redirect = () => import("@/views/redirect/index.vue");
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/redirect/:path(.*)',
|
path: '/redirect/:path(.*)',
|
||||||
|
component: Layout,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
component: Redirect,
|
component: Redirect,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -87,73 +87,37 @@ const actions = {
|
|||||||
commit('ADD_CACHE_LIST', tag)
|
commit('ADD_CACHE_LIST', tag)
|
||||||
},
|
},
|
||||||
|
|
||||||
delTag ({ dispatch, state }, tag) {
|
delTag ({ dispatch }, tag) {
|
||||||
return new Promise(resolve => {
|
|
||||||
dispatch('delTagList', tag)
|
dispatch('delTagList', tag)
|
||||||
dispatch('delCacheList', tag)
|
dispatch('delCacheList', tag)
|
||||||
resolve({
|
|
||||||
tagList: [...state.tagList],
|
|
||||||
cacheList: [...state.cacheList]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
delTagList ({ commit, state }, tag) {
|
delTagList ({ commit }, tag) {
|
||||||
return new Promise(resolve => {
|
|
||||||
commit('DEL_TAG_LIST', tag)
|
commit('DEL_TAG_LIST', tag)
|
||||||
resolve([...state.tagList])
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
delCacheList ({ commit, state }, tag) {
|
delCacheList ({ commit }, tag) {
|
||||||
return new Promise(resolve => {
|
|
||||||
commit('DEL_CACHE_LIST', tag)
|
commit('DEL_CACHE_LIST', tag)
|
||||||
resolve([...state.cacheList])
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delOtherTags ({ dispatch, state }, tag) {
|
delOtherTags ({ dispatch }, tag) {
|
||||||
return new Promise(resolve => {
|
|
||||||
dispatch('delOtherTagList', tag)
|
dispatch('delOtherTagList', tag)
|
||||||
dispatch('delOtherCacheList', tag)
|
dispatch('delOtherCacheList', tag)
|
||||||
resolve({
|
|
||||||
tagList: [...state.tagList],
|
|
||||||
cacheList: [...state.cacheList]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
delOtherTagList ({ commit, state }, tag) {
|
delOtherTagList ({ commit }, tag) {
|
||||||
return new Promise(resolve => {
|
|
||||||
commit('DEL_OTHER_TAG_LIST', tag)
|
commit('DEL_OTHER_TAG_LIST', tag)
|
||||||
resolve([...state.tagList])
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
delOtherCacheList ({ commit, state }, tag) {
|
delOtherCacheList ({ commit }, tag) {
|
||||||
return new Promise(resolve => {
|
|
||||||
commit('DEL_OTHER_CACHE_LIST', tag)
|
commit('DEL_OTHER_CACHE_LIST', tag)
|
||||||
resolve([...state.cacheList])
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delAllTags ({ dispatch, state }) {
|
delAllTags ({ dispatch }) {
|
||||||
return new Promise(resolve => {
|
|
||||||
dispatch('delAllTagList')
|
dispatch('delAllTagList')
|
||||||
dispatch('delAllCacheList')
|
dispatch('delAllCacheList')
|
||||||
resolve({
|
|
||||||
tagList: [...state.tagList],
|
|
||||||
cacheList: [...state.cacheList]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
delAllTagList ({ commit, state }) {
|
delAllTagList ({ commit }) {
|
||||||
return new Promise(resolve => {
|
|
||||||
commit('DEL_ALL_TAG_LIST')
|
commit('DEL_ALL_TAG_LIST')
|
||||||
resolve([...state.tagList])
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
delAllCacheList ({ commit, state }) {
|
delAllCacheList ({ commit }) {
|
||||||
return new Promise(resolve => {
|
|
||||||
commit('DEL_ALL_CACHE_LIST')
|
commit('DEL_ALL_CACHE_LIST')
|
||||||
resolve([...state.cacheList])
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTagList ({ commit }, tag) {
|
updateTagList ({ commit }, tag) {
|
||||||
|
|||||||
@ -2,48 +2,29 @@
|
|||||||
<div class="error">
|
<div class="error">
|
||||||
<template v-if="error === '403'">
|
<template v-if="error === '403'">
|
||||||
<span class="code-403">403</span>
|
<span class="code-403">403</span>
|
||||||
<svg-icon
|
<svg-icon name="error-icons-403" class="error-img" />
|
||||||
name="error-icons-403"
|
|
||||||
class="error-img"
|
|
||||||
/>
|
|
||||||
<h2 class="title">您无权访问此页面</h2>
|
<h2 class="title">您无权访问此页面</h2>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="error === '500'">
|
<template v-else-if="error === '500'">
|
||||||
<svg-icon
|
<svg-icon name="error-icons-500" class="error-img" />
|
||||||
name="error-icons-500"
|
|
||||||
class="error-img"
|
|
||||||
/>
|
|
||||||
<h2 class="title">服务器出错了</h2>
|
<h2 class="title">服务器出错了</h2>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="error === '404'">
|
<template v-else-if="error === '404'">
|
||||||
<svg-icon
|
<svg-icon name="error-icons-404" class="error-img" />
|
||||||
name="error-icons-404"
|
|
||||||
class="error-img"
|
|
||||||
/>
|
|
||||||
<h2 class="title">您访问的页面不存在</h2>
|
<h2 class="title">您访问的页面不存在</h2>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<router-link to="/">
|
<router-link to="/">
|
||||||
<el-button type="primary">返回首页</el-button>
|
<el-button type="primary">返回首页</el-button>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
import { useStore } from "vuex";
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: ["error"],
|
props: ["error"],
|
||||||
setup({ error }) {
|
|
||||||
const store = useStore();
|
|
||||||
const router = useRouter();
|
|
||||||
if (!!store.state.account.userinfo) {
|
|
||||||
router.replace(`/error/${error}`);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user