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