Commit f5e7e4f4 authored by chenqikuai's avatar chenqikuai

fix: 修复客服经理在聊天页面时,其他地方登录该账号,结果该处提示的错误不符合当前场景的bug

parent 154f1e5e
......@@ -243,12 +243,14 @@ router.beforeEach((to, from, next) => {
() => {
next()
},
() => {
Toast('由于您现在是不在岗状态所以无法进入聊天!')
(mark: boolean | undefined) => {
/* 如果有mark为false,则表示检查聊天权限的逻辑走到了调用接口,但是返回auth为false */
mark === false &&
Toast('由于您现在是不在岗状态所以无法进入聊天!')
},
)
}else{
next();
} else {
next()
}
}
} else {
......
......@@ -12,18 +12,21 @@ export function authCheck(cb: Function) {
}
}
/**
*
* @param cb 有权限时回调
* @param cb2 没有权限时回调 什么时候没有权限?本地无token,用户在其他地方登录,不在岗或被禁用了
*/
export async function chatAuthCheck(cb: Function, cb2?: Function) {
const msg = getUserMsg()
if (msg?.role === eRole.user) {
cb();
}
else if (msg?.role === eRole.staff) {
cb()
} else if (msg?.role === eRole.staff) {
const ret = await getStaffOnDutyStatus()
if (ret.code === 200 && ret.data) {
console.log('cb');
cb()
} else {
cb2 && cb2()
cb2 && cb2(ret.data)
}
} else {
cb2 && cb2()
......
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