修改token为access_token

This commit is contained in:
smallwei 2018-03-25 19:46:24 +08:00
parent 0383ca744b
commit 29f01214c3
2 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,6 @@
// see http://vuejs-templates.github.io/webpack for documentation. // see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path') var path = require('path')
var baseUrl = 'http://218.70.11.118:7777'; var baseUrl = 'http://192.168.0.101:9999';
module.exports = { module.exports = {
build: { build: {
env: require('./prod.env'), env: require('./prod.env'),

View File

@ -5,6 +5,7 @@ import { vaildUtil } from '@/util/yun';
import { setTitle } from '@/util/util'; import { setTitle } from '@/util/util';
import { validatenull } from '@/util/validate'; import { validatenull } from '@/util/validate';
import { asyncRouterMap } from '@/router/router' import { asyncRouterMap } from '@/router/router'
import { Duplex } from 'stream';
function hasPermission(roles, permissionRoles) { function hasPermission(roles, permissionRoles) {
if (!permissionRoles) return true if (!permissionRoles) return true
return roles.some(role => permissionRoles.indexOf(role) >= 0) return roles.some(role => permissionRoles.indexOf(role) >= 0)
@ -14,7 +15,7 @@ const lockPage = '/lock'
router.addRoutes(asyncRouterMap); // 动态添加可访问路由表 router.addRoutes(asyncRouterMap); // 动态添加可访问路由表
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
store.commit('SET_TAG', to.query.src ? to.query.src : to.path); store.commit('SET_TAG', to.query.src ? to.query.src : to.path);
if (store.getters.token) { // determine if there has token if (store.getters.access_token) { // determine if there has token
/* has token*/ /* has token*/
if (store.getters.isLock && to.path != lockPage) { if (store.getters.isLock && to.path != lockPage) {
next({ path: lockPage }) next({ path: lockPage })
@ -73,10 +74,12 @@ function findMenuParent(tag) {
return false; return false;
} }
})[0]; })[0];
tagCurrent.push({ if (!validatenull(tagCurrent)) {
label: currentPathObj.label, tagCurrent.push({
value: currentPathObj.path label: currentPathObj.label,
}); value: currentPathObj.path
});
}
tagCurrent.push(tag); tagCurrent.push(tag);
return tagCurrent; return tagCurrent;
@ -85,7 +88,6 @@ router.afterEach((to, from) => {
setTimeout(() => { setTimeout(() => {
const tag = store.getters.tag; const tag = store.getters.tag;
setTitle(tag.label); setTitle(tag.label);
alert(findMenuParent(tag));
store.commit('SET_TAG_CURRENT', findMenuParent(tag)); store.commit('SET_TAG_CURRENT', findMenuParent(tag));
}, 0); }, 0);
}) })