123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- import Vue from 'vue'
- import VueRouter from 'vue-router'
- const Home = () => import('@/views/Home.vue')
- const register = ()=>import('@/views/register.vue')
- const login = ()=>import('@/views/Login.vue')
- const userinfo = ()=>import('@/views/userinfo.vue')
- const edit = ()=>import('@/views/Edit.vue')
- const article = ()=>import('@/views/Article.vue')
- const editcategory = ()=>import('@/views/EditCategory.vue')
- const workbench = ()=>import('@/views/workbench.vue')
- const cwAttendanceDec = ()=>import('@/views/cwAttendanceDec.vue')
- const user = ()=>import('@/views/user.vue')
- const leave = ()=>import('@/views/leave.vue')
- const approval = ()=>import('@/views/approval.vue')
- const details = ()=>import('@/views/details.vue')
- const record = ()=>import('@/views/record.vue')
- const ecord = ()=>import('@/views/ecord.vue')
- const ubmit = ()=>import('@/views/ubmit.vue')
- const lock = ()=>import('@/views/lock.vue')
- const ttendance = ()=>import('@/views/ttendance.vue')
- const set = ()=>import('@/views/set.vue')
- const number = ()=>import('@/views/number.vue')
- const assword = ()=>import('@/views/assword.vue')
- const nformation = ()=>import('@/views/nformation.vue')
- const ord = ()=>import('@/views/ord.vue')
- const proval = ()=>import('@/views/proval.vue')
- Vue.use(VueRouter)
- const routes = [
- {
- path:'/',
- component:Home,
- meta:{
- keepalive:true
- }
- },
- {
- path:'/home',
- component:Home,
- meta:{
- keepalive:true
- }
- },
- {
- path:'/register',
- component:register
- },
- {
- path:'/login',
- component:login
- },
- {
- path:'/userinfo',
- component:userinfo,
- meta:{
- istoken:true
- }
- },
- {
- path:'/user',
- component:user
-
- },
- {
- path:'/edit',
- component:edit,
- meta:{
- istoken:true
- }
- },
- {
- path:'/article/:id',
- component:article
- },
- {
- path:'/editcategory',
- component:editcategory
- },
- {
- path:'/workbench',
- component:workbench
- },
- {
- path:'/cwAttendanceDec',
- component:cwAttendanceDec
- },{
- path:'/leave',
- component:leave
- },
- {
- path:'/approval',
- component:approval
- },
- {
- path:'/details',
- component:details
- },
- {
- path:'/record',
- component:record
- },
- {
- path:'/ecord',
- component:ecord
- },
- {
- path:'/ubmit',
- component:ubmit
- },
- {
- path:'/lock',
- component:lock
- },
- {
- path:'/ttendance',
- component:ttendance
- },
- {
- path:'/set',
- component:set
- },
- {
- path:'/number',
- component:number
- },
- {
- path:'/assword',
- component:assword
- },
- {
- path:'/nformation',
- component:nformation
- },
- {
- path:'/ord',
- component:ord
- },
- {
- path:'/proval',
- component:proval
- }
- ]
- const router = new VueRouter({
- routes,
- mode:'history'
- })
- router.beforeEach((to,from,next) => {
- if((!localStorage.getItem('token') || !localStorage.getItem('id'))&&to.meta.istoken == true){
- router.push('/login')
- Vue.prototype.$msg.fail('请重新登录')
- return
- }
- next()
- })
- export default router
|