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