缺少404页面

This commit is contained in:
caoqianming 2021-03-26 10:10:40 +08:00
parent 0da68d63f3
commit 5b76549a19
7 changed files with 40 additions and 34 deletions

View File

@ -31,11 +31,6 @@ import Layout from '@/layout'
* all perms can be accessed
*/
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/',
component: Layout,
@ -47,6 +42,16 @@ export const constantRoutes = [
meta: { title: '首页', icon: 'dashboard' }
}]
},
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/404'),
hidden: true
},
{
path: '/myinfo',
component: Layout,
@ -248,21 +253,22 @@ export const asyncRoutes = [
}
]
},
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router

View File

@ -95,18 +95,22 @@ const actions = {
return new Promise((resolve, reject) => {
getInfo(state.token).then(response => {
const { data } = response
if (!data) {
reject('验证失败,重新登陆.')
}
const { perms, name, avatar } = data
// perms must be a non-empty array
if (!perms || perms.length <= 0) {
reject('没有任何权限!')
}
commit('SET_PERMS', perms)
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
}).catch(error => {
reject(error)
})

View File

@ -406,7 +406,6 @@ export default {
this.multipleSelection = val;
},
filterChange(obj) {
console.log(obj)
for (let key in obj) {
this.listQuery[key] = obj[key][0];
}

View File

@ -256,7 +256,6 @@ export default {
},
getList() {
this.listLoading = true;
console.log(this.listQuery)
getInspectionList(this.listQuery).then((response) => {
if (response.data) {
this.istList = response.data;
@ -272,7 +271,6 @@ export default {
data.group_by = key;
getInspectionGroup(data).then((response) => {
this.groupBy[key] = response.data;
console.log(this.groupBy);
});
}
},

View File

@ -58,7 +58,7 @@
<div slot="header" class="clearfix">
<span>待办任务提醒</span>
</div>
<div class="litem" @click="goRecord('待上报')" v-if="!checkPermission(['record_confirm'])">
<div class="litem" @click="goRecord('待上报')" v-if="!checkPermission(['record_confirm']) && checkPermission(['record_up'])">
<el-link class="desc">
您有
<span style="color:red">{{todos.toup}}</span>
@ -66,13 +66,13 @@
</el-link>
</div>
<div class="litem">
<el-link class="desc" @click="goRecord('待整改')" v-if="!checkPermission(['record_confirm'])">
<el-link class="desc" @click="goRecord('待整改')" v-if="!checkPermission(['record_confirm']) && checkPermission(['record_up'])">
您有
<span style="color:red">{{todos.tozg}}</span>
条记录待整改
</el-link>
</div>
<div class="litem" @click="goRecord('已上报')">
<div class="litem" @click="goRecord('已上报')" v-if="checkPermission(['record_confirm'])">
<el-link class="desc" v-if="todos.toconfirm">
您有
<span style="color:red">{{todos.toconfirm}}</span>

View File

@ -175,7 +175,6 @@ export default {
},
deleteFile(index){
this.$confirm('确定删除该文件, 是否继续?', {type:'error'}).then(() => {
console.log(index)
this.fileList.splice(index)
}).catch(e=>{})
},

View File

@ -394,7 +394,7 @@ export default {
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {