# big-event **Repository Path**: spacesouls/big-event ## Basic Information - **Project Name**: big-event - **Description**: 大事件文章管理系统,可以保存个人编写的文章,支持对文章分类以及文章进行增删改查操作,对文章更好地分类,基于Vue框架实现的前端项目,通过axios向后端发送请求,实现前后端分离。 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-12-06 - **Last Updated**: 2022-12-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: 前端, Vue, Vuex, JavaScript, HTML ## README # vue-event ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). ### 项目介绍: 大事件文章管理系统,可以保存个人编写的文章,支持对文章分类以及文章进行增删改查操作,对文章更好地分类,基于Vue框架实现的前端项目,通过axios向后端发送请求,实现前后端分离。 ### 组件库: Vue、Vuex、Vue-Router、axios、Element-UI、dayjs ### 路由: ``` import Vue from 'vue' import VueRouter from 'vue-router' import store from '@/store' Vue.use(VueRouter) const routes = [ { path: '/', component: () => import('@/views/layout'), redirect: '/home', children: [ { path: '/home', component: () => import('@/views/home') }, { path: '/user-info', component: () => import('@/views/user/userinfo') }, { path: '/user-avatar', component: () => import('@/views/user/userpic') }, { path: '/user-pwd', component: () => import('@/views/user/userPwd') }, { path: '/art-cate', component: () => import('@/views/article/artCate') }, { path: 'art-list', component: () => import('@/views/article/artList') } ] }, { path: '/info', name: 'info', component: () => import('@/views/article/artInfo') }, { path: '/register', component: () => import('@/views/register') }, { path: '/login', component: () => import('@/views/login') } ] const router = new VueRouter({ routes }) let whiteList = ['/login','/register'] router.beforeEach((to, from, next) => { const token = store.state.token if(token) { if(!store.state.userinfo.username) { store.dispatch('toGetUserInfo') } next() }else{ if(whiteList.includes(to.path)){ next() }else{ next('/login') } } }) export default router ```