Commit ac38c1ed authored by GuanHua's avatar GuanHua

fix;登录后访问渠道商城地址,点击会员中心提示无权限的问题

parent 903a58b6
...@@ -179,11 +179,17 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) { ...@@ -179,11 +179,17 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
if (whiteLists.includes(location.pathname)) { if (whiteLists.includes(location.pathname)) {
return return
} }
const authInfo = getAuth()
// 是否登录 // 是否登录
if (getAuth()) { if (authInfo) {
const routeAuthUrls = getRouters() let routeAuthUrls = getRouters()
if (!routeAuthUrls || routeAuthUrls.length === 0) {
const { urls } = authInfo
routeAuthUrls = urls
setRouters(urls)
}
const { pathname } = location const { pathname } = location
if (userLoginLists.includes(pathname)) { if (userLoginLists.includes(pathname)) {
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页 // 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
...@@ -208,7 +214,7 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) { ...@@ -208,7 +214,7 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
return; return;
} }
// 无权限访问时 // 无权限访问时
console.log(pathname) // console.log(pathname)
history.replace('/memberCenter/noAuth') history.replace('/memberCenter/noAuth')
} else { } else {
if (whiteLists.includes(location.pathname)) { if (whiteLists.includes(location.pathname)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment