update 增加菜单权限校验
This commit is contained in:
+24
-10
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" name="login-mini" setup>
|
||||
import { getCodeInfo, getUserInfo } from '/@/api/user';
|
||||
import { getAuth, getCodeInfo, getUserInfo } from '/@/api/user';
|
||||
import { onMounted, reactive, ref, toRaw, watch } from 'vue';
|
||||
import codeImg from '/@/assets/images/checkcode.png';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
@@ -102,6 +102,7 @@
|
||||
import { getAuthCache } from '/@/utils/auth.ts';
|
||||
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
|
||||
import { getCurrentPath, PageEnum, setBaseLogin, toHomeByLogoutPath, toLoginByNowPath } from '/@/enum/pageEnum.ts';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@@ -188,15 +189,28 @@
|
||||
);
|
||||
|
||||
if (userInfo) {
|
||||
notification.success({
|
||||
message: t('login.loginSuccessTitle'),
|
||||
description: `${t('login.loginSuccessDesc')}: ${userInfo.realname}`,
|
||||
duration: 3,
|
||||
});
|
||||
|
||||
let path = toHomeByNowPath();
|
||||
setBaseLogin(route.path);
|
||||
router.replace({ path: path });
|
||||
try {
|
||||
let { code, result, message: msg } = await getAuth();
|
||||
let authCode = ['emergency:screen:show:yinchuan', 'emergency:screen:show:xian'];
|
||||
if (code == 200) {
|
||||
let flag = result?.codeList?.find((item) => authCode.includes(item));
|
||||
if (!flag) {
|
||||
return message.warn('您没有权限访问大屏,请联系管理员!');
|
||||
}
|
||||
} else {
|
||||
return message.warn(msg);
|
||||
}
|
||||
notification.success({
|
||||
message: t('login.loginSuccessTitle'),
|
||||
description: `${t('login.loginSuccessDesc')}: ${userInfo.realname}`,
|
||||
duration: 3,
|
||||
});
|
||||
let path = toHomeByNowPath();
|
||||
setBaseLogin(route.path);
|
||||
router.replace({ path: path });
|
||||
} catch (e) {
|
||||
message.warn(e);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
notification.error({
|
||||
|
||||
Reference in New Issue
Block a user