Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d45dbd0b
authored
May 26, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'dev_zj_1.7.0' into 'v1.7.0'
优化登录页面,兼容手机端 See merge request
!9
2 parents
f54e4ebc
a5ee353a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
257 additions
and
28 deletions
src/assets/images/car-bg.png
src/views/Login.vue
src/assets/images/car-bg.png
View file @
d45dbd0
682 KB
|
W:
|
H:
440 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/views/Login.vue
View file @
d45dbd0
<
template
>
<el-container
class=
"container"
>
<home-header></home-header>
<el-container
class=
"container"
>
<!--
<home-header></home-header>
<home-content></home-content>
<home-footer></home-footer>
</el-container>
<home-footer></home-footer>
-->
<div
class=
"login_page"
>
<div
class=
"login_header"
>
<img
class=
"home-logo-img"
:src=
"logoPath"
:key=
"logoPath"
alt=
"company-logo"
>
<span
class=
"home-logo-title"
>
{{
homeTitle
}}
</span>
</div>
<div
class=
"login_box"
>
<div
class=
"left"
></div>
<div
class=
"right"
>
<div
class=
"login_card"
>
<div
class=
"small_logo"
>
<img
class=
"home-logo-img"
:src=
"logo"
:key=
"logo"
alt=
"company-logo"
/>
</div>
<h1
class=
"login-title"
>
{{
title
}}
</h1>
<div
v-if=
"showAlert"
>
<el-alert
v-for=
"(item, index) in alertArr"
:key=
"index"
:title=
"item"
type=
"error"
show-icon
/>
</div>
<el-form>
<el-form-item
class=
"username-wrapper"
prop=
"name"
>
<el-input
class=
"login-input username-input"
placeholder=
"请输入用户名"
maxLength=
"50"
v-model=
"formInline.user"
>
</el-input>
</el-form-item>
<el-form-item
class=
"form-wrapper pwd-wrapper"
prop=
"pass"
>
<el-input
class=
"login-input"
placeholder=
"请输入密码"
v-model=
"formInline.password"
maxLength=
"20"
show-password
autocomplete=
"off"
>
</el-input>
</el-form-item>
<el-form-item
class=
"login-button-wrapper"
@
keyup
.
enter=
"handleSubmit"
@
click
.
native
.
prevent=
"handleSubmit"
>
<el-button
class=
"login-button"
type=
"primary"
html-type=
"submit"
>
登录
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
<div
class=
"login_footer"
>
Copyright ©2012-2021 粤ICP备12034057号 深圳广联赛讯有限公司 版权所有
</div>
</div>
</el-container>
</
template
>
<
script
>
import
HomeHeader
from
'components/Header/HomeHeader'
;
import
HomeContent
from
'components/HomeContent/HomeContent'
;
import
HomeFooter
from
'components/Footer/HomeFooter'
;
import
{
onMounted
}
from
'vue'
;
import
HomeHeader
from
"components/Header/HomeHeader"
;
import
HomeContent
from
"components/HomeContent/HomeContent"
;
import
HomeFooter
from
"components/Footer/HomeFooter"
;
import
{
onMounted
,
watch
,
reactive
,
toRefs
,
getCurrentInstance
,
onBeforeMount
,
}
from
"vue"
;
import
{
useStore
}
from
"vuex"
;
import
LoginService
from
"@/services/Login"
;
import
{
trimSpace
}
from
"@/utils/tools/tools"
;
export
default
{
name
:
"LoginPage"
,
components
:
{
HomeHeader
,
HomeContent
,
HomeFooter
},
setup
()
{
onMounted
(()
=>
{
});
}
}
name
:
"LoginPage"
,
components
:
{
HomeHeader
,
HomeContent
,
HomeFooter
,
},
setup
()
{
const
store
=
useStore
();
const
state
=
reactive
({
logoPath
:
store
.
state
.
app
.
logo
,
homeTitle
:
""
,
alertMsg
:
""
,
showAlert
:
false
,
alertArr
:
[],
randomVal
:
"0"
,
formInline
:
{
user
:
""
,
password
:
""
,
captcha
:
""
,
},
title
:
store
.
state
.
app
.
title
,
logo
:
store
.
state
.
app
.
logo
,
});
let
logoPath
=
store
.
state
.
app
.
logo
;
const
{
ctx
:
_this
}
=
getCurrentInstance
();
const
loginService
=
new
LoginService
();
onBeforeMount
(()
=>
{
document
.
onkeydown
=
(
e
)
=>
{
if
(
e
.
keyCode
===
13
)
{
handleSubmit
();
}
};
});
// 登录提交验证 用户名只限制长度50 验证码暂时屏蔽
const
handleSubmit
=
async
()
=>
{
const
value
=
state
.
formInline
,
captchaId
=
state
.
captchaId
,
{
user
,
password
,
captcha
}
=
value
;
state
.
alertArr
=
[];
state
.
showAlert
=
false
;
if
(
trimSpace
(
user
).
length
<=
0
)
{
state
.
alertArr
.
push
(
"请输入用户名"
);
state
.
showAlert
=
true
;
return
false
;
}
// if(!validate_username(user)) {
// state.alertArr.push('用户名格式不正确');
// state.showAlert = true;
// return false;
// }
if
(
trimSpace
(
password
).
length
<=
0
)
{
state
.
alertArr
.
push
(
"请输入密码"
);
state
.
showAlert
=
true
;
return
false
;
}
// if(trimSpace(captcha).length <= 0) {
// state.alertArr.push('请输入验证码');
// state.showAlert = true;
// return false;
// }
// params: captcha, captchaId 验证码暂时屏蔽
store
.
dispatch
(
"app/showLoading"
,
true
);
const
params
=
{
account
:
user
,
password
};
await
loginService
.
loginAction
(
params
).
then
(
(
res
)
=>
{
store
.
dispatch
(
"app/showLoading"
,
false
);
if
(
res
.
code
===
200
)
{
const
{
token
,
user
}
=
res
.
data
;
store
.
dispatch
(
"app/setUserInfo"
,
user
);
store
.
dispatch
(
"app/setToken"
,
token
);
}
else
{
const
{
message
}
=
res
;
state
.
alertArr
.
push
(
message
);
state
.
showAlert
=
true
;
store
.
dispatch
(
"app/showLoading"
,
false
);
}
},
(
err
)
=>
{
store
.
dispatch
(
"app/showLoading"
,
false
);
}
);
};
watch
(
()
=>
store
.
state
.
app
.
logo
,
(
n
,
o
)
=>
{
state
.
logoPath
=
n
;
console
.
log
(
"logoPath:"
,
n
);
}
);
watch
(
()
=>
store
.
state
.
app
.
logo
,
(
n
,
o
)
=>
{
state
.
logo
=
n
;
}
);
watch
(
()
=>
store
.
state
.
app
.
title
,
(
n
,
o
)
=>
{
state
.
title
=
n
;
}
);
console
.
log
(
logoPath
);
return
{
...
toRefs
(
state
),
handleSubmit
};
},
};
</
script
>
<
style
lang=
"less"
scoped
>
@import
'styles/variables.less'
;
@import
"styles/variables.less"
;
.container
{
position
:
fixed
;
height
:
100%
;
top
:
0
;
left
:
0
;
//
.container
{
//
position
:
fixed
;
//
height
:
100%
;
//
top
:
0
;
//
left
:
0
;
//
width
:
100%
;
//
min-width
:
1190px
;
//
overflow-y
:
scroll
;
//
}
.login_page
{
height
:
100vh
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
.login_header
{
height
:
60px
;
}
.login_box
{
width
:
100%
;
min-width
:
1190px
;
overflow-y
:
scroll
;
height
:
calc
(
100vh
-
120px
);
//
background
:
url("../../assets/images/car-bg.png")
no-repeat
;
background
:
url("../assets/images/car-bg.png")
no-repeat
;
background-size
:
cover
;
display
:
flex
;
justify-content
:
space-between
;
.right{
flex
:
2
;
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-end
;
padding
:
0
60px
0
0
;
}
.login_card
{
background-color
:
#fff
;
background-clip
:
border-box
;
border-radius
:
4px
;
width
:
410px
;
padding
:
45px
;
box-sizing
:
border-box
;
.home-logo-img
{
max-width
:
100%
;
height
:
50px
;
}
.login-title
{
height
:
55px
;
font-size
:
22px
;
color
:
#333
;
font-weight
:
bold
;
}
.login-input
{
width
:
100%
;
border
:
0
;
}
.login-button-wrapper
{
margin-top
:
45px
;
.login-button
{
width
:
100%
;
height
:
40px
;
background-color
:
#003457
;
border-color
:
transparent
;
}
}
}
}
.login_footer
{
height
:
60px
;
line-height
:
60px
;
font-size
:
12px
;
text-align
:
center
;
color
:
#999
;
}
}
</
style
>
<
style
scoped
>
.login_box
>>>
.el-input__inner
{
border
:
none
;
border-radius
:
0
;
border-bottom
:
1px
solid
#97979742
;
}
.login_box
>>>
.el-input__inner
:-webkit-autofill
{
-webkit-box-shadow
:
0
0
0px
1000px
#fff
inset
;
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment