Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-manage-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-manage-ui
Commits
a54c7392
Commit
a54c7392
authored
Nov 01, 2022
by
张俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录菜单调整
parent
5f3e72c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
215 additions
and
190 deletions
+215
-190
src/components/login-by-account.vue
src/components/login-by-account.vue
+203
-183
src/main.js
src/main.js
+12
-7
No files found.
src/components/login-by-account.vue
View file @
a54c7392
<
template
>
<
template
>
<div
class=
"login-by-account"
>
<div
class=
"login-by-account"
>
<el-form
ref=
"loginForm"
label-position=
"top"
:model=
"loginForm"
:rules=
"steploginFormRules"
>
<el-form
ref=
"loginForm"
label-position=
"top"
:model=
"loginForm"
:rules=
"steploginFormRules"
>
<el-form-item
label=
"账号"
prop=
"userid"
>
<el-form-item
label=
"账号"
prop=
"userid"
>
<el-input
<el-input
v-model=
"loginForm.userid"
v-model=
"loginForm.userid"
...
@@ -21,7 +26,7 @@
...
@@ -21,7 +26,7 @@
:title=
"hidePassword ? '显示密码' : '隐藏密码'"
:title=
"hidePassword ? '显示密码' : '隐藏密码'"
:class=
"hidePassword ? 'hide-password' : 'show-password'"
:class=
"hidePassword ? 'hide-password' : 'show-password'"
@
click=
"hidePassword = !hidePassword"
@
click=
"hidePassword = !hidePassword"
style=
"cursor:pointer;
"
style=
"cursor: pointer
"
></span>
></span>
</el-input>
</el-input>
</el-form-item>
</el-form-item>
...
@@ -32,28 +37,33 @@
...
@@ -32,28 +37,33 @@
placeholder=
"请输入验证码"
placeholder=
"请输入验证码"
@
keyup.enter.native=
"loginAction()"
@
keyup.enter.native=
"loginAction()"
/>
/>
<img
class=
"yzm_img"
title=
"看不清?换一张"
:src=
"imgSrc"
@
click=
"getImg()"
/>
<img
class=
"yzm_img"
title=
"看不清?换一张"
:src=
"imgSrc"
@
click=
"getImg()"
/>
</div>
</div>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-checkbox
v-model=
"rememberPassword"
>
记住密码
</el-checkbox>
<el-checkbox
v-model=
"rememberPassword"
>
记住密码
</el-checkbox>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"loginAction()"
style=
"width:100%;
"
>
<el-button
type=
"primary"
@
click=
"loginAction()"
style=
"width: 100%
"
>
登 录
登 录
</el-button>
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
CryptoJS
from
"
crypto-js
"
;
import
CryptoJS
from
"
crypto-js
"
;
import
{
getCookie
,
clearCookie
,
setCookie
}
from
"
@/services/cookie.js
"
;
import
{
getCookie
,
clearCookie
,
setCookie
}
from
"
@/services/cookie.js
"
;
import
menu
from
'
../router/function
'
import
menu
from
"
../router/function
"
;
import
{
generateRoutes
}
from
'
../router/index
'
import
{
generateRoutes
}
from
"
../router/index
"
;
export
default
{
export
default
{
name
:
"
LoginByAccount
"
,
// 账号密码登录
name
:
"
LoginByAccount
"
,
// 账号密码登录
data
()
{
data
()
{
return
{
return
{
...
@@ -65,12 +75,10 @@
...
@@ -65,12 +75,10 @@
steploginFormRules
:
{
steploginFormRules
:
{
userid
:
[{
required
:
true
,
message
:
"
请输入账号
"
,
trigger
:
"
blur
"
}],
userid
:
[{
required
:
true
,
message
:
"
请输入账号
"
,
trigger
:
"
blur
"
}],
password
:
[{
required
:
true
,
message
:
"
请输入密码
"
,
trigger
:
"
blur
"
}],
password
:
[{
required
:
true
,
message
:
"
请输入密码
"
,
trigger
:
"
blur
"
}],
yzm
:
[
yzm
:
[{
required
:
true
,
message
:
"
请输入验证码
"
,
trigger
:
"
blur
"
}],
{
required
:
true
,
message
:
"
请输入验证码
"
,
trigger
:
"
blur
"
},
],
},
},
imgId
:
''
,
imgId
:
""
,
imgSrc
:
''
,
imgSrc
:
""
,
identifyCode
:
""
,
identifyCode
:
""
,
hidePassword
:
true
,
hidePassword
:
true
,
rememberPassword
:
false
,
rememberPassword
:
false
,
...
@@ -87,11 +95,12 @@
...
@@ -87,11 +95,12 @@
clearCookie
(
"
userinfo
"
);
clearCookie
(
"
userinfo
"
);
}
}
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
$axios
this
.
$axios
.
get
(
`/apaas/system/v5/user/verifyCaptcha?id=
${
this
.
imgId
}
&value=
${
this
.
loginForm
.
yzm
}
`
)
.
get
(
`/apaas/system/v5/user/verifyCaptcha?id=
${
this
.
imgId
}
&value=
${
this
.
loginForm
.
yzm
}
`
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
this
.
login
();
this
.
login
();
...
@@ -99,16 +108,19 @@
...
@@ -99,16 +108,19 @@
this
.
$message
.
error
(
res
.
data
.
data
);
this
.
$message
.
error
(
res
.
data
.
data
);
}
}
});
});
}
}
});
});
},
},
login
()
{
login
()
{
this
.
$axios
this
.
$axios
.
post
(
`/apaas/system/v5/user/login`
,
{
.
post
(
`/apaas/system/v5/user/login`
,
{
system_account
:
this
.
loginForm
.
userid
,
system_account
:
this
.
loginForm
.
userid
,
password
:
CryptoJS
.
AES
.
encrypt
(
this
.
loginForm
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
password
:
CryptoJS
.
AES
.
encrypt
(
}).
then
(({
data
})
=>
{
this
.
loginForm
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
})
.
then
(({
data
})
=>
{
if
(
data
.
code
==
200
)
{
if
(
data
.
code
==
200
)
{
this
.
getUser
();
this
.
getUser
();
}
else
{
}
else
{
...
@@ -123,41 +135,50 @@
...
@@ -123,41 +135,50 @@
console
.
log
(
error
);
console
.
log
(
error
);
});
});
},
},
getUserInfo
()
{
return
this
.
$axios
.
get
(
`/apaas/system/v5/user/getUserInfo`
);
},
getMenu
()
{
return
this
.
$axios
.
get
(
`/apaas/system/v5/menu/user/tree`
);
},
getUser
()
{
getUser
()
{
this
.
$axios
.
get
(
`/apaas/system/v5/user/getUserInfo`
).
then
((
res
)
=>
{
Promise
.
all
([
this
.
getUserInfo
(),
this
.
getMenu
()]).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
[
0
].
data
.
code
==
200
&&
res
[
1
].
data
.
code
==
200
)
{
this
.
$store
.
commit
(
"
setUserInfo
"
,
res
.
data
.
data
);
let
data
=
res
[
1
].
data
.
data
[
0
].
children
||
[];
this
.
$store
.
commit
(
"
setUserInfo
"
,
res
[
0
].
data
.
data
);
// if (res.data.data.userType == 1) {
// if (res.data.data.userType == 1) {
//超管
//超管
this
.
$store
.
commit
(
"
setMenu
"
,
menu
.
adminMenu
);
this
.
$store
.
commit
(
"
setMenu
"
,
data
);
menu
.
menuToRouter
(
menu
.
adminMenu
)
menu
.
menuToRouter
(
data
);
this
.
$store
.
commit
(
'
setRoute
'
,
menu
.
adminMenu
)
this
.
$store
.
commit
(
"
setRoute
"
,
data
);
//存储菜单对象信息
//存储菜单对象信息
let
menuObj
=
{}
let
menuObj
=
{};
this
.
getMenuObj
(
menu
.
adminMenu
,
''
,
menuObj
)
this
.
getMenuObj
(
data
,
""
,
menuObj
);
this
.
$store
.
commit
(
'
setMenuObj
'
,
menuObj
)
this
.
$store
.
commit
(
"
setMenuObj
"
,
menuObj
);
// }
// }
generateRoutes
()
generateRoutes
();
// this.$router.push("/");
// this.$router.push("/");
//跳转到工作台页面
//跳转到工作台页面
window
.
location
.
href
=
'
/apaas/portal/ui/#/
'
window
.
location
.
href
=
"
/apaas/portal/ui/#/
"
;
}
}
});
});
},
},
getMenuObj
(
menu
,
parentRowPath
,
menuObj
)
{
getMenuObj
(
menu
,
parentRowPath
,
menuObj
)
{
menu
.
forEach
((
e
,
idx
)
=>
{
menu
.
forEach
((
e
,
idx
)
=>
{
e
.
rowPath
=
parentRowPath
+
'
.
'
+
idx
e
.
rowPath
=
parentRowPath
+
"
.
"
+
idx
;
menuObj
[
e
.
path
]
=
e
menuObj
[
e
.
path
]
=
e
;
if
(
e
.
children
&&
e
.
children
.
length
)
{
if
(
e
.
children
&&
e
.
children
.
length
)
{
this
.
getMenuObj
(
e
.
children
,
e
.
rowPath
,
menuObj
)
this
.
getMenuObj
(
e
.
children
,
e
.
rowPath
,
menuObj
);
}
}
});
});
},
},
getImg
(
clearInput
=
false
)
{
getImg
(
clearInput
=
false
)
{
this
.
$axios
.
get
(
`/apaas/system/v5/user/getCaptcha??width=240&height=32`
).
then
((
res
)
=>
{
this
.
$axios
.
get
(
`/apaas/system/v5/user/getCaptcha??width=240&height=32`
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
this
.
imgId
=
res
.
data
.
data
.
id
;
this
.
imgId
=
res
.
data
.
data
.
id
;
this
.
imgSrc
=
res
.
data
.
data
.
captcha
;
this
.
imgSrc
=
res
.
data
.
data
.
captcha
;
...
@@ -177,16 +198,16 @@
...
@@ -177,16 +198,16 @@
this
.
loginForm
.
password
=
userinfo
[
1
];
this
.
loginForm
.
password
=
userinfo
[
1
];
this
.
checked
=
true
;
this
.
checked
=
true
;
this
.
rememberPassword
=
true
this
.
rememberPassword
=
true
;
}
else
{
}
else
{
this
.
checked
=
false
;
this
.
checked
=
false
;
}
}
},
},
};
};
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.msg-code
{
.msg-code
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
center
;
align-items
:
center
;
...
@@ -195,6 +216,5 @@
...
@@ -195,6 +216,5 @@
margin-left
:
6px
;
margin-left
:
6px
;
flex-shrink
:
0
;
flex-shrink
:
0
;
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/main.js
View file @
a54c7392
...
@@ -43,6 +43,11 @@ function getUser() {
...
@@ -43,6 +43,11 @@ function getUser() {
return
axios
.
get
(
`/apaas/system/v5/user/getUserInfo`
)
return
axios
.
get
(
`/apaas/system/v5/user/getUserInfo`
)
}
}
//获取用户菜单信息
function
getMenu
()
{
return
axios
.
get
(
`/apaas/system/v5/menu/user/tree`
)
}
//处理菜单成为对象
//处理菜单成为对象
function
getMenuObj
(
menu
,
parentRowPath
,
menuObj
){
function
getMenuObj
(
menu
,
parentRowPath
,
menuObj
){
menu
.
forEach
((
e
,
idx
)
=>
{
menu
.
forEach
((
e
,
idx
)
=>
{
...
@@ -55,22 +60,22 @@ function getMenuObj(menu,parentRowPath,menuObj){
...
@@ -55,22 +60,22 @@ function getMenuObj(menu,parentRowPath,menuObj){
}
}
Promise
.
all
([
getUser
()]).
then
(
res
=>
{
Promise
.
all
([
getUser
()
,
getMenu
()
]).
then
(
res
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
if
(
res
[
0
].
data
.
code
==
200
)
{
if
(
res
[
0
].
data
.
code
==
200
&&
res
[
1
].
data
.
code
==
200
)
{
//已登录则记录菜单和用户信息
//已登录则记录菜单和用户信息
let
data
=
res
[
1
].
data
.
data
[
0
].
children
||
[]
store
.
commit
(
'
setUserInfo
'
,
res
[
0
].
data
.
data
)
store
.
commit
(
'
setUserInfo
'
,
res
[
0
].
data
.
data
)
// if (res[0].data.data.userType == 1) {//超管
// if (res[0].data.data.userType == 1) {//超管
store
.
commit
(
'
setMenu
'
,
menu
.
adminMenu
)
store
.
commit
(
'
setMenu
'
,
data
)
menu
.
menuToRouter
(
menu
.
adminMenu
)
menu
.
menuToRouter
(
data
)
console
.
log
(
menu
);
console
.
log
(
menu
);
store
.
commit
(
'
setRoute
'
,
menu
.
adminMenu
)
store
.
commit
(
'
setRoute
'
,
data
)
//存储菜单对象信息
//存储菜单对象信息
let
menuObj
=
{}
let
menuObj
=
{}
getMenuObj
(
menu
.
adminMenu
,
''
,
menuObj
)
getMenuObj
(
data
,
''
,
menuObj
)
store
.
commit
(
'
setMenuObj
'
,
menuObj
)
store
.
commit
(
'
setMenuObj
'
,
menuObj
)
console
.
log
(
menuObj
);
console
.
log
(
menuObj
);
...
...
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