update 增加菜单权限校验
This commit is contained in:
@@ -5,6 +5,7 @@ enum Api {
|
||||
Login = '/sys/login',
|
||||
Logout = '/sys/logout',
|
||||
GetUserInfo = '/sys/user/getUserInfo',
|
||||
auth = '/sys/permission/getPermCode',
|
||||
}
|
||||
|
||||
export const getCodeInfo = (params: any) => get(Api.getInputCode + `/${params}`);
|
||||
@@ -27,6 +28,10 @@ export function getUserInfo() {
|
||||
});
|
||||
}
|
||||
|
||||
export function getAuth() {
|
||||
return get(Api.auth);
|
||||
}
|
||||
|
||||
export function doLogout() {
|
||||
return get(Api.Logout);
|
||||
}
|
||||
@@ -234,18 +234,6 @@
|
||||
return Promise.all(hospitalPromises);
|
||||
}
|
||||
|
||||
// function getHospitalList(hospitalList, userLocation) {
|
||||
// hospitalList.forEach(async (item) => {
|
||||
// item.distance = getDistance(userLocation, [item.lon, item.lat]);
|
||||
// let { time, routeList } = await getDriveTime(userLocation, [item.lon, item.lat]);
|
||||
// item.driveTime = time;
|
||||
// item.routeList = routeList;
|
||||
// item.userLocation = userLocation;
|
||||
// console.log('time', item.driveTime);
|
||||
// });
|
||||
// return hospitalList;
|
||||
// }
|
||||
|
||||
function getDistance(userLocation, destination) {
|
||||
const value = Map.getDistance(userLocation, destination);
|
||||
return value > 1000 ? (value / 1000).toFixed(2) + 'km' : value + 'm';
|
||||
|
||||
+16
-2
@@ -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) {
|
||||
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