Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-base
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
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 72290d5e
authored
Nov 08, 2022
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改短信验证码的一些验证规则
1 parent
c2db39b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
src/views/Login.vue
src/views/components/LoginSMSCodeCheck.vue
src/views/Login.vue
View file @
72290d5
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
<el-input
type=
"password"
clearable
v-model
.
trim=
"loginForm.password"
placeholder=
"请输入密码"
@
keyup
.
enter
.
native=
"submitForm"
></el-input>
<el-input
type=
"password"
clearable
v-model
.
trim=
"loginForm.password"
placeholder=
"请输入密码"
@
keyup
.
enter
.
native=
"submitForm"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
prop=
"code"
>
<el-form-item
prop=
"code"
>
<el-input
type=
"code"
v-model
.
trim=
"loginForm.code"
maxlength=
"
36
"
placeholder=
"请输入验证码"
@
keyup
.
enter
.
native=
"submitForm"
>
<el-input
type=
"code"
v-model
.
trim=
"loginForm.code"
maxlength=
"
4
"
placeholder=
"请输入验证码"
@
keyup
.
enter
.
native=
"submitForm"
>
<div
class=
"code-suffix"
slot=
"suffix"
@
click=
"getCode"
>
<div
class=
"code-suffix"
slot=
"suffix"
@
click=
"getCode"
>
<el-image
:src=
"code64"
></el-image>
<el-image
:src=
"code64"
></el-image>
</div>
</div>
...
...
src/views/components/LoginSMSCodeCheck.vue
View file @
72290d5
...
@@ -2,18 +2,18 @@
...
@@ -2,18 +2,18 @@
* @Author: limin
* @Author: limin
* @Date: 2022-11-07 11:16:08
* @Date: 2022-11-07 11:16:08
* @LastEditors: limin
* @LastEditors: limin
* @LastEditTime: 2022-11-0
7 21:30:08
* @LastEditTime: 2022-11-0
8 14:36:39
* @Description:
* @Description:
-->
-->
<
template
>
<
template
>
<div
class=
"com-login-sms-code-check"
>
<div
class=
"com-login-sms-code-check"
>
<el-dialog
title=
"手机号验证"
:visible
.
sync=
"dialogVisible"
top=
"32vh"
width=
"576px"
height=
"292px"
:destroy-on-close=
"true"
:close-on-click-modal=
"false"
>
<el-dialog
title=
"手机号验证"
:visible
.
sync=
"dialogVisible"
top=
"32vh"
width=
"576px"
height=
"292px"
:destroy-on-close=
"true"
:close-on-click-modal=
"false"
>
<span
class=
"notify"
>
为了您的账号安全,请输入发送至 +86
{{
checkProps
.
mobile
}}
的
6
位验证码
</span>
<span
class=
"notify"
>
为了您的账号安全,请输入发送至 +86
{{
checkProps
.
mobile
}}
的
4
位验证码
</span>
<el-form
:model=
"smsCodeCheckForm"
@
keyup
.
enter
.
native=
"submitForm"
:rules=
"rules"
ref=
"smsCodeCheckForm"
class=
"smsCodeCheckForm"
>
<el-form
:model=
"smsCodeCheckForm"
:validate-on-rule-change=
"true"
@
keyup
.
enter
.
native=
"submitForm"
:rules=
"rules"
ref=
"smsCodeCheckForm"
class=
"smsCodeCheckForm"
>
<el-form-item
prop=
"
sms
code"
>
<el-form-item
prop=
"code"
>
<el-input
clearable
v-model
.
trim=
"smsCodeCheckForm.smscode"
placeholder=
"请输入短信验证码"
maxlength=
"6"
onkeyup=
"value=value.replace(/[^\d]/g,' ')
"
></el-input>
<el-input
v-model
.
trim=
"smsCodeCheckForm.code"
autocomplete=
"off"
placeholder=
"请输入短信验证码"
maxlength=
"4"
@
input=
"onInput"
:validate-event=
"false
"
></el-input>
<el-button
type=
"text"
@
click=
"getSmsCode"
>
获取验证码
</el-button>
<el-button
type=
"text"
@
click=
"getSmsCode"
v-show=
"!isShowtimeCounter"
>
获取验证码
</el-button>
<span
class=
"time-counter"
v-show=
"isShowtimeCounter"
>
{{
counter
}}
</span>
<span
class=
"time-counter"
v-show=
"isShowtimeCounter"
>
{{
counter
}}
s
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<div
slot=
"footer"
>
<div
slot=
"footer"
>
...
@@ -45,14 +45,14 @@ export default {
...
@@ -45,14 +45,14 @@ export default {
data
()
{
data
()
{
return
{
return
{
smsCodeCheckForm
:
{
smsCodeCheckForm
:
{
sms
code
:
''
code
:
''
},
},
isShowtimeCounter
:
false
,
isShowtimeCounter
:
false
,
counter
,
counter
,
timer
:
null
,
timer
:
null
,
loading
:
false
,
loading
:
false
,
rules
:
{
rules
:
{
smscode
:
[{
validator
:
this
.
checkSmsCode
,
trigger
:
'blur'
}]
code
:
[{
validator
:
this
.
checkSmsCode
}]
}
}
}
}
},
},
...
@@ -74,6 +74,7 @@ export default {
...
@@ -74,6 +74,7 @@ export default {
* 以上两步均通过验证,关闭验证弹窗,触发验证成功事件
* 以上两步均通过验证,关闭验证弹窗,触发验证成功事件
*/
*/
submitForm
:
utils
.
debounce
(
function
()
{
submitForm
:
utils
.
debounce
(
function
()
{
this
.
loading
=
true
this
.
$refs
[
'smsCodeCheckForm'
].
validate
(
async
valid
=>
{
this
.
$refs
[
'smsCodeCheckForm'
].
validate
(
async
valid
=>
{
this
.
loading
=
false
this
.
loading
=
false
if
(
valid
)
{
if
(
valid
)
{
...
@@ -159,6 +160,15 @@ export default {
...
@@ -159,6 +160,15 @@ export default {
cancle
()
{
cancle
()
{
this
.
dialogVisible
=
false
this
.
dialogVisible
=
false
this
.
$refs
[
'smsCodeCheckForm'
].
resetFields
()
this
.
$refs
[
'smsCodeCheckForm'
].
resetFields
()
},
onInput
(
v
)
{
const
objFormItem
=
this
.
$refs
[
'smsCodeCheckForm'
].
fields
[
0
]
if
(
objFormItem
?.
validateState
===
'error'
)
{
objFormItem
.
clearValidate
()
}
if
(
v
)
{
this
.
smsCodeCheckForm
.
code
=
String
(
v
).
replace
(
/
\D
/g
,
''
)
}
}
}
}
}
}
}
...
@@ -225,15 +235,12 @@ export default {
...
@@ -225,15 +235,12 @@ export default {
.time-counter
{
.time-counter
{
display
:
block
;
display
:
block
;
position
:
absolute
;
position
:
absolute
;
right
:
0
;
right
:
10px
;
top
:
0
;
top
:
0
;
text-align
:
center
;
text-align
:
center
;
width
:
6em
;
font-size
:
14px
;
letter-spacing
:
1px
;
letter-spacing
:
1px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
color
:
#ccc
;
color
:
#fff
;
font-weight
:
600
;
border-radius
:
0
4px
4px
0
;
}
}
}
}
}
}
...
...
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