|
@@ -1,31 +1,36 @@
|
|
|
import store from '@/store'
|
|
|
import menus from '@/data/menus'
|
|
|
+import Vue from 'vue';
|
|
|
+import {Message} from 'element-ui';
|
|
|
+
|
|
|
+Vue.prototype.$message = Message;
|
|
|
+let vm = new Vue()
|
|
|
|
|
|
function toLogin() {
|
|
|
- let ssoServer = process.env.SSO_SERVER
|
|
|
- let redirectUrl = window.location.protocol + '//' + window.location.host
|
|
|
- console.log('tologin ', `${ssoServer}/login?redirectUrl=${redirectUrl}/auth`)
|
|
|
- window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}/auth`
|
|
|
+ let ssoServer = process.env.SSO_SERVER
|
|
|
+ let redirectUrl = window.location.protocol + '//' + window.location.host
|
|
|
+ console.log('tologin ', `${ssoServer}/login?redirectUrl=${redirectUrl}/auth`)
|
|
|
+ window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}/auth`
|
|
|
}
|
|
|
|
|
|
function checkMenu(menu, ps) {
|
|
|
- let result = { name: menu.name, icon: menu.icon, path: menu.path }
|
|
|
- if (menu.children) {
|
|
|
-
|
|
|
- result.children = []
|
|
|
- menu.children.forEach(child => {
|
|
|
- let submenu = checkMenu(child, ps)
|
|
|
- if (submenu) {
|
|
|
- result.children.push(submenu)
|
|
|
- }
|
|
|
- })
|
|
|
- return result.children.length > 0 ? result : null
|
|
|
- } else if (menu.opts) {
|
|
|
- return menu.opts.some(opt => ps[opt.permission]) ? result : null
|
|
|
- } else {
|
|
|
-
|
|
|
- return result
|
|
|
- }
|
|
|
+ let result = {name: menu.name, icon: menu.icon, path: menu.path}
|
|
|
+ if (menu.children) {
|
|
|
+
|
|
|
+ result.children = []
|
|
|
+ menu.children.forEach(child => {
|
|
|
+ let submenu = checkMenu(child, ps)
|
|
|
+ if (submenu) {
|
|
|
+ result.children.push(submenu)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return result.children.length > 0 ? result : null
|
|
|
+ } else if (menu.opts) {
|
|
|
+ return menu.opts.some(opt => ps[opt.permission]) ? result : null
|
|
|
+ } else {
|
|
|
+
|
|
|
+ return result
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export default {
|
|
@@ -36,25 +41,31 @@ export default {
|
|
|
* @param {*} next
|
|
|
*/
|
|
|
routerBeforeEach: async function(to, from, next) {
|
|
|
- console.log('router before ', to)
|
|
|
-
|
|
|
- next()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ console.log('router before ', to)
|
|
|
+ if (to.path == '/supplement' && !Object.keys(to.params).length) {
|
|
|
+ vm.$message.warning('产品设计中')
|
|
|
+ return next('/')
|
|
|
+ } else {
|
|
|
+ next()
|
|
|
+ }
|
|
|
+
|
|
|
+ next()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
toNoUser(){
|
|
|
console.log(this)
|