Commit 2dd2fbbf authored by 张伯涛's avatar 张伯涛

修改

parent 3b44e346
......@@ -31,17 +31,27 @@ router.beforeEach(async (to, from, next) => {
} else {
try {
const { permissions } = await userStore.getUserInfo();
if (permissions && permissions.length > 0) {
//'/controlPlatform/control'登录后的跳转的特殊路由
if (to.path === "/controlPlatform/control") {
if (permissions && permissions.length > 0) {
const accessRoutes = await userStore.generateRoutes();
accessRoutes.forEach((route) => {
router.addRoute(route);
});
next({ path: accessRoutes[0].children?.[0].path, replace: true }); // 跳转登录用户的第一个菜单
// next({ ...to, replace: true });
} else {
userStore.logout().then((_) => {
alert("用户无权限");
next(`/login`);
});
}
} else {
const accessRoutes = await userStore.generateRoutes();
accessRoutes.forEach((route) => {
router.addRoute(route);
});
next({ ...to, replace: true });
} else {
userStore.logout().then((_) => {
alert("用户无权限");
next(`/login`);
});
}
} catch (error) {
// 移除 token 并跳转登录页
......
......@@ -69,93 +69,93 @@
</el-form-item>
</el-tooltip>
<!-- 验证码 -->
<div v-if="captchaType === 'MATH' || captchaType === 'CHAR'">
<el-form-item prop="code">
<span class="p-2">
<svg-icon icon-class="captcha" />
</span>
<el-input
v-model="loginData.code"
auto-complete="off"
:placeholder="$t('login.captchaCode')"
class="w-[60%]"
@keyup.enter="handleLogin"
/>
<div class="captcha">
<el-image
:src="captchaBase64"
@click="getCaptcha"
:style="{ height: captchaHeight }"
class="w-[120px] h-[48px] cursor-pointer"
>
<template #error>
<div class="image-slot">
<i-ep-picture />
</div>
</template>
</el-image>
</div>
</el-form-item>
</div>
<el-form-item
v-if="captchaType === 'BLOCK' || captchaType === 'WORD'"
prop="code"
>
<div
class="my_btn"
@click="
() => {
if (!verifyFlag) {
verifyShowFlag = true;
}
}
"
>
<div
class="my_radar_btn"
:class="[
verifyFlag ? 'my_radar_btn_success' : 'my_radar_btn_verify',
]"
>
<div class="my_radar_tip">
<el-popover
:visible="verifyShowFlag"
placement="right"
popper-class="verifyPopover"
width="345"
>
<Verify
ref="verify"
:mode="'fixed'"
:captcha-type="captchaType"
:img-size="{ width: '323px', height: '155px' }"
@success="capctchaCheckSuccess"
/>
<template #reference>
<el-button v-if="!verifyFlag" class="my_radar_tip_blue" />
<div v-if="verifyFlag" class="geetest_success_box">
<div class="geetest_success_show">
<div class="geetest_success_pie"></div>
<div class="geetest_success_filter"></div>
<div class="geetest_success_mask"></div>
</div>
<div class="geetest_success_correct">
<div class="geetest_success_icon"></div>
</div>
</div>
</template>
</el-popover>
</div>
<div class="my_radar_text">
{{ verifyFlag ? "验证成功" : "点击按钮进行验证" }}
</div>
</div>
</div>
</el-form-item>
<!-- &lt;!&ndash; 验证码 &ndash;&gt;-->
<!-- <div v-if="captchaType === 'MATH' || captchaType === 'CHAR'">-->
<!-- <el-form-item prop="code">-->
<!-- <span class="p-2">-->
<!-- <svg-icon icon-class="captcha" />-->
<!-- </span>-->
<!-- <el-input-->
<!-- v-model="loginData.code"-->
<!-- auto-complete="off"-->
<!-- :placeholder="$t('login.captchaCode')"-->
<!-- class="w-[60%]"-->
<!-- @keyup.enter="handleLogin"-->
<!-- />-->
<!-- <div class="captcha">-->
<!-- <el-image-->
<!-- :src="captchaBase64"-->
<!-- @click="getCaptcha"-->
<!-- :style="{ height: captchaHeight }"-->
<!-- class="w-[120px] h-[48px] cursor-pointer"-->
<!-- >-->
<!-- <template #error>-->
<!-- <div class="image-slot">-->
<!-- <i-ep-picture />-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-image>-->
<!-- </div>-->
<!-- </el-form-item>-->
<!-- </div>-->
<!-- <el-form-item-->
<!-- v-if="captchaType === 'BLOCK' || captchaType === 'WORD'"-->
<!-- prop="code"-->
<!-- >-->
<!-- <div-->
<!-- class="my_btn"-->
<!-- @click="-->
<!-- () => {-->
<!-- if (!verifyFlag) {-->
<!-- verifyShowFlag = true;-->
<!-- }-->
<!-- }-->
<!-- "-->
<!-- >-->
<!-- <div-->
<!-- class="my_radar_btn"-->
<!-- :class="[-->
<!-- verifyFlag ? 'my_radar_btn_success' : 'my_radar_btn_verify',-->
<!-- ]"-->
<!-- >-->
<!-- <div class="my_radar_tip">-->
<!-- <el-popover-->
<!-- :visible="verifyShowFlag"-->
<!-- placement="right"-->
<!-- popper-class="verifyPopover"-->
<!-- width="345"-->
<!-- >-->
<!-- <Verify-->
<!-- ref="verify"-->
<!-- :mode="'fixed'"-->
<!-- :captcha-type="captchaType"-->
<!-- :img-size="{ width: '323px', height: '155px' }"-->
<!-- @success="capctchaCheckSuccess"-->
<!-- />-->
<!-- <template #reference>-->
<!-- <el-button v-if="!verifyFlag" class="my_radar_tip_blue" />-->
<!-- <div v-if="verifyFlag" class="geetest_success_box">-->
<!-- <div class="geetest_success_show">-->
<!-- <div class="geetest_success_pie"></div>-->
<!-- <div class="geetest_success_filter"></div>-->
<!-- <div class="geetest_success_mask"></div>-->
<!-- </div>-->
<!-- <div class="geetest_success_correct">-->
<!-- <div class="geetest_success_icon"></div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-popover>-->
<!-- </div>-->
<!-- <div class="my_radar_text">-->
<!-- {{ verifyFlag ? "验证成功" : "点击按钮进行验证" }}-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </el-form-item>-->
<el-button
:loading="loading"
......@@ -355,13 +355,16 @@ function successLogin() {
},
{}
);
router.push({ path: "/system/user", query: otherQueryParams });
router.push({
path: "/controlPlatform/control",
query: otherQueryParams,
});
})
.catch(() => {
loading.value = false;
verifyFlag.value = false;
// 验证失败,重新生成验证码
getCaptcha();
// getCaptcha();
})
.finally(() => {
loading.value = false;
......@@ -374,7 +377,7 @@ function capctchaCheckSuccess(params: any) {
}
onMounted(() => {
getCaptcha();
// getCaptcha();
// 主题初始化
const theme = useSettingsStore().theme;
......
......@@ -124,8 +124,8 @@ const rules = reactive({
});
/** 点击搜索按钮*/
function clickQueryBtn() {
queryParams.pageNum = 1
handleQuery()
queryParams.pageNum = 1;
handleQuery();
}
/** 查询 */
function handleQuery() {
......
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