update 增加菜单权限校验
This commit is contained in:
+6
-1
@@ -5,6 +5,7 @@ enum Api {
|
|||||||
Login = '/sys/login',
|
Login = '/sys/login',
|
||||||
Logout = '/sys/logout',
|
Logout = '/sys/logout',
|
||||||
GetUserInfo = '/sys/user/getUserInfo',
|
GetUserInfo = '/sys/user/getUserInfo',
|
||||||
|
auth = '/sys/permission/getPermCode',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getCodeInfo = (params: any) => get(Api.getInputCode + `/${params}`);
|
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() {
|
export function doLogout() {
|
||||||
return get(Api.Logout);
|
return get(Api.Logout);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,18 +234,6 @@
|
|||||||
return Promise.all(hospitalPromises);
|
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) {
|
function getDistance(userLocation, destination) {
|
||||||
const value = Map.getDistance(userLocation, destination);
|
const value = Map.getDistance(userLocation, destination);
|
||||||
return value > 1000 ? (value / 1000).toFixed(2) + 'km' : value + 'm';
|
return value > 1000 ? (value / 1000).toFixed(2) + 'km' : value + 'm';
|
||||||
|
|||||||
+24
-10
@@ -91,7 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" name="login-mini" setup>
|
<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 { onMounted, reactive, ref, toRaw, watch } from 'vue';
|
||||||
import codeImg from '/@/assets/images/checkcode.png';
|
import codeImg from '/@/assets/images/checkcode.png';
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
@@ -102,6 +102,7 @@
|
|||||||
import { getAuthCache } from '/@/utils/auth.ts';
|
import { getAuthCache } from '/@/utils/auth.ts';
|
||||||
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
|
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
|
||||||
import { getCurrentPath, PageEnum, setBaseLogin, toHomeByLogoutPath, toLoginByNowPath } from '/@/enum/pageEnum.ts';
|
import { getCurrentPath, PageEnum, setBaseLogin, toHomeByLogoutPath, toLoginByNowPath } from '/@/enum/pageEnum.ts';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -188,15 +189,28 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
notification.success({
|
try {
|
||||||
message: t('login.loginSuccessTitle'),
|
let { code, result, message: msg } = await getAuth();
|
||||||
description: `${t('login.loginSuccessDesc')}: ${userInfo.realname}`,
|
let authCode = ['emergency:screen:show:yinchuan', 'emergency:screen:show:xian'];
|
||||||
duration: 3,
|
if (code == 200) {
|
||||||
});
|
let flag = result?.codeList?.find((item) => authCode.includes(item));
|
||||||
|
if (!flag) {
|
||||||
let path = toHomeByNowPath();
|
return message.warn('您没有权限访问大屏,请联系管理员!');
|
||||||
setBaseLogin(route.path);
|
}
|
||||||
router.replace({ path: path });
|
} 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) {
|
} catch (error) {
|
||||||
notification.error({
|
notification.error({
|
||||||
|
|||||||
Reference in New Issue
Block a user