Commit 2129f1a9 authored by Bill's avatar Bill

fix: 修改socket

parent 2e048a87
......@@ -23,6 +23,11 @@ let extraRoutes: never[] = [];
const userLoginLists = [
'/login',
]
// 登录后的路由白名单
const loginWhiteList = [
'/home',
]
const whiteLists = [
'/',
...userLoginLists,
......@@ -99,9 +104,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
return
}
const authInfo = getAuth()
// 是否登录
if (getAuth()) {
if (authInfo) {
const { query, pathname } = location
console.log(pathname);
const routeAuthUrls = getRouters()
if (userLoginLists.includes(pathname)) {
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
......@@ -109,6 +116,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
return ;
}
// 登录之后 能力中心的首页应该变为可以访问, 无论是否在权限中
if (loginWhiteList.includes(location.pathname)) {
return
}
// 固定配置, 出现此参数说明需携带参数校验权限路由
if (query.page_type && routeAuthUrls.find(authPath => {
const parseUrl = queryString.parseUrl(authPath)
......
......@@ -70,7 +70,7 @@ const RightContent: React.FC<{}> = (props) => {
const webSocketInit = useCallback(() => {
console.log(ws.current)
if (SOCKET_URL && /ws\:\/\//.test(SOCKET_URL) && (!ws.current || ws.current.readyState === 3) && userInfo) {
const url = `${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberId}&token=${userInfo.token}&source=${99}`
const url = `${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberRoleId}&token=${userInfo.token}&source=${99}`
ws.current = new WebSocket(url);
ws.current.onopen = (e) => {
console.log(e)
......
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