|
@@ -1,21 +1,20 @@
|
|
|
-import Vue from 'vue'
|
|
|
+// import Vue from 'vue'
|
|
|
import App from './App'
|
|
|
import store from './vuex/store'
|
|
|
import routes from './routes'
|
|
|
|
|
|
-import VueRouter from 'vue-router'
|
|
|
-Vue.use(VueRouter)
|
|
|
+// import VueRouter from 'vue-router'
|
|
|
+// Vue.use(VueRouter)
|
|
|
|
|
|
-import ElementUI from 'element-ui'
|
|
|
+// import ElementUI from 'element-ui'
|
|
|
+// Vue.use(ElementUI)
|
|
|
|
|
|
-Vue.use(ElementUI)
|
|
|
-
|
|
|
-import Vuex from 'vuex'
|
|
|
-Vue.use(Vuex)
|
|
|
+// import Vuex from 'vuex'
|
|
|
+// Vue.use(Vuex)
|
|
|
|
|
|
import http from './http'
|
|
|
import port from './port'
|
|
|
-import echarts from 'echarts'
|
|
|
+// import echarts from 'echarts'
|
|
|
import $ from 'jquery'
|
|
|
|
|
|
Vue.prototype.http = http
|
|
@@ -25,7 +24,7 @@ Vue.prototype.echarts = echarts
|
|
|
import VueClipboard from 'vue-clipboard2'
|
|
|
Vue.use(VueClipboard)
|
|
|
|
|
|
-import 'element-ui/lib/theme-chalk/index.css'
|
|
|
+// import 'element-ui/lib/theme-chalk/index.css'
|
|
|
import 'font-awesome/css/font-awesome.min.css'
|
|
|
import './assets/iconfont/iconfont.css'
|
|
|
|
|
@@ -38,61 +37,18 @@ import 'nprogress/nprogress.css'
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
NProgress.start();
|
|
|
- if(to.name != '邀请') {
|
|
|
- if (to.path == '/login') {
|
|
|
- sessionStorage.removeItem('user');
|
|
|
- }
|
|
|
-
|
|
|
- let user = JSON.parse(sessionStorage.getItem('user'));
|
|
|
- if (!user && to.path != '/login') {
|
|
|
- next({ path: '/login' })
|
|
|
- } else {
|
|
|
- if(user){
|
|
|
- for(var i in routes){
|
|
|
- if(routes[i].name == "基础管理" && user.parentId != 0){
|
|
|
- routes[i].hidden = true
|
|
|
- } else if(routes[i].name == "基础管理"){
|
|
|
- routes[i].hidden = false
|
|
|
- }
|
|
|
-
|
|
|
- if(routes[i].name == "项目管理" && user.parentId > 1){
|
|
|
- var children = routes[i].children;
|
|
|
- for(var j in children){
|
|
|
-
|
|
|
- if(children[j].name == "人员管理"){
|
|
|
- if(user.isManager == 0){
|
|
|
- children[j].hidden = true
|
|
|
- } else {
|
|
|
- children[j].hidden = false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(children[j].name == "权限管理"){
|
|
|
- if(user.isManager == 0){
|
|
|
- children[j].hidden = true
|
|
|
- } else {
|
|
|
- children[j].hidden = false
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else if(routes[i].name == "项目管理") {
|
|
|
- var children = routes[i].children;
|
|
|
- for(var j in children){
|
|
|
- if(children[j].name != "项目详情"){
|
|
|
- children[j].hidden = false
|
|
|
- }
|
|
|
-
|
|
|
- if(children[j].name == "权限管理"){
|
|
|
- if((user.parentId == 0 || user.parentId == 1) && user.isManager == 0){
|
|
|
- children[j].hidden = true
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- next()
|
|
|
- }
|
|
|
+ if (to.path == '/register') {
|
|
|
+ next();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (to.path == '/login') {
|
|
|
+ sessionStorage.removeItem('user');
|
|
|
+ }
|
|
|
+
|
|
|
+ let user = JSON.parse(sessionStorage.getItem('user'));
|
|
|
+ if (!user && to.path != '/login') {
|
|
|
+ next({ path: '/login' })
|
|
|
} else {
|
|
|
next()
|
|
|
}
|