Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
9
91isoft_web_vue3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
91isoft_web_vue3
Commits
2dd2fbbf
Commit
2dd2fbbf
authored
Feb 21, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
3b44e346
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
98 deletions
+111
-98
permission.ts
src/permission.ts
+16
-6
index.vue
src/views/login/index.vue
+93
-90
index.vue
src/views/system/user/index.vue
+2
-2
No files found.
src/permission.ts
View file @
2dd2fbbf
...
...
@@ -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 并跳转登录页
...
...
src/views/login/index.vue
View file @
2dd2fbbf
...
...
@@ -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
>
<!--
<!– 验证码 –>
-->
<
!--
<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
;
...
...
src/views/system/user/index.vue
View file @
2dd2fbbf
...
...
@@ -124,8 +124,8 @@ const rules = reactive({
});
/** 点击搜索按钮*/
function
clickQueryBtn
()
{
queryParams
.
pageNum
=
1
handleQuery
()
queryParams
.
pageNum
=
1
;
handleQuery
()
;
}
/** 查询 */
function
handleQuery
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment