|
@@ -73,6 +73,7 @@ import { DictionaryStore } from '/@/stores/dictionary';
|
|
|
import { SystemConfigStore } from '/@/stores/systemConfig';
|
|
|
import { Md5 } from 'ts-md5';
|
|
|
import { errorMessage } from '/@/utils/message';
|
|
|
+import emitter from '/@/utils/emitter'
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -177,6 +178,23 @@ export default defineComponent({
|
|
|
useUserInfo().setUserInfos();
|
|
|
};
|
|
|
|
|
|
+ emitter.on('scan-wecomLogin', (userInfo: any) => {
|
|
|
+ if (userInfo.loginInfo.code == 2000) {
|
|
|
+ Session.set('token', userInfo.loginInfo.data.access)
|
|
|
+ Cookies.set('username', userInfo.loginInfo.data.name)
|
|
|
+ if (!themeConfig.value.isRequestRoutes) {
|
|
|
+ // 前端控制路由,2、请注意执行顺序
|
|
|
+ // console.log('成功获取token,开始初始化前端路由')
|
|
|
+ initFrontEndControlRoutes()
|
|
|
+ loginSuccess()
|
|
|
+ } else {
|
|
|
+ initBackEndControlRoutes()
|
|
|
+ loginSuccess()
|
|
|
+ }
|
|
|
+ emitter.off('scan-wecomLogin')
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
// 登录成功后的跳转
|
|
|
const loginSuccess = () => {
|
|
|
//登录成功获取用户信息,获取系统字典数据
|