Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
薪
薪瑞通-前端
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
许珑标
薪瑞通-前端
Commits
8e334a3d
Commit
8e334a3d
authored
Feb 24, 2025
by
谢子梦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信验证码优化
parent
d6157291
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
13 deletions
+44
-13
src/views/login.vue
src/views/login.vue
+44
-13
No files found.
src/views/login.vue
View file @
8e334a3d
...
...
@@ -24,16 +24,16 @@
<img
:src=
"codeUrl"
@
click=
"getCode"
class=
"login-code-img"
/>
</div>
</el-form-item>
<div
style=
"color: red; font-size: 12px"
>
获取短信验证码必须同时填写账号、密码、数字验证码
</div>
<el-form-item
prop=
"smsCode"
v-if=
"captchaEnabled"
>
<el-input
v-model=
"loginForm.smsCode"
auto-complete=
"off"
placeholder=
"短信验证码"
style=
"width: 63%;"
@
keyup.enter.native=
"handleLogin"
>
<svg-icon
slot=
"prefix"
icon-class=
"validCode"
class=
"el-input__icon input-icon"
/>
<el-form-item
prop=
"smsCode"
v-if=
"captchaEnabled"
class=
"textMessage"
>
<el-input
style=
"width: 63%;"
v-model=
"loginForm.smsCode"
placeholder=
"短信验证码"
>
<i
slot=
"prefix"
@
keyup.enter.native=
"handleLogin"
style=
"margin-left: 2px;margin-top:12px"
class=
"el-icon-mobile-phone"
/>
</el-input>
<
div
class=
"login-code"
>
<el-button
size=
"small"
@
click=
"getSmsCode"
>
发送短信验证码
</el-button>
</div
>
<
el-button
:disabled=
"VerificationCodeTime > 0 || VerificationCodeShow"
@
click=
"getSmsCode"
style=
"width:33%;margin-left:4%;font-size:11px;"
type=
"success"
>
{{
VerificationCodeTitle
}}
</el-button
>
</el-form-item>
<div
style=
"color: red; font-size: 12px;margin-top:-10px;"
>
获取短信验证码前必须同时填写账号、密码、数字验证码
</div>
<el-checkbox
v-model=
"loginForm.rememberMe"
style=
"margin:12px 0px 25px 0px;"
>
记住密码
</el-checkbox>
<el-form-item
style=
"width:100%;"
>
<el-button
:loading=
"loading"
size=
"medium"
type=
"primary"
style=
"width:100%;"
...
...
@@ -48,7 +48,8 @@
</el-form>
<!-- 底部 -->
<div
class=
"el-login-footer"
>
<a
class=
"text-color"
href=
"https://beian.miit.gov.cn/#/Integrated/index"
target=
"_blank"
>
<span
style=
"color: #00afff"
>
备案号:冀ICP备2024097706号-1
</span></a>
<a
class=
"text-color"
href=
"https://beian.miit.gov.cn/#/Integrated/index"
target=
"_blank"
>
<span
style=
"color: #00afff"
>
备案号:冀ICP备2024097706号-1
</span></a>
</div>
</div>
</
template
>
...
...
@@ -68,7 +69,7 @@ export default {
password
:
""
,
rememberMe
:
false
,
code
:
""
,
smsCode
:
""
,
smsCode
:
""
,
uuid
:
""
},
loginRules
:
{
...
...
@@ -86,7 +87,11 @@ export default {
captchaEnabled
:
true
,
// 注册开关
register
:
false
,
redirect
:
undefined
redirect
:
undefined
,
// 短信验证码部分参数
VerificationCodeTitle
:
'
发送验证码
'
,
VerificationCodeTime
:
0
,
VerificationCodeShow
:
true
};
},
watch
:
{
...
...
@@ -95,6 +100,18 @@ export default {
this
.
redirect
=
route
.
query
&&
route
.
query
.
redirect
;
},
immediate
:
true
},
loginForm
:
{
handler
(
newValue
,
oldValue
)
{
console
.
log
(
'
变化后的数组
'
,
newValue
);
if
(
newValue
.
username
&&
newValue
.
password
&&
newValue
.
code
)
{
this
.
VerificationCodeShow
=
false
}
else
{
this
.
VerificationCodeShow
=
true
}
},
deep
:
true
,
immediate
:
false
,
}
},
created
()
{
...
...
@@ -150,9 +167,19 @@ export default {
delete
this
.
loginRules
.
smsCode
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
if
(
valid
)
{
getLoginSmsCode
(
this
.
loginForm
).
then
(
resp
=>
{
getLoginSmsCode
(
this
.
loginForm
).
then
(
resp
=>
{
if
(
200
===
resp
.
code
)
{
this
.
VerificationCodeTime
=
60
const
timer
=
setInterval
(()
=>
{
this
.
VerificationCodeTime
--
;
if
(
this
.
VerificationCodeTime
>
0
)
{
this
.
VerificationCodeTitle
=
`
${
this
.
VerificationCodeTime
}
秒后重新发送`
;
}
else
{
clearInterval
(
timer
);
this
.
VerificationCodeTitle
=
'
发送验证码
'
;
this
.
VerificationCodeTime
=
60
;
}
},
1000
);
}
})
}
...
...
@@ -160,6 +187,7 @@ export default {
}
}
};
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
>
...
...
@@ -196,6 +224,9 @@ export default {
width
:
400px
;
padding
:
35px
45px
25px
35px
;
.el-input
{
height
:
38px
;
...
...
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