Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds-front
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
beyond-clouds-front
Commits
ea8362c2
Commit
ea8362c2
authored
Feb 09, 2020
by
高浩杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix login third
parent
8fa18f99
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
50 deletions
+34
-50
components/pc/loginCard/loginInput.vue
+2
-7
pages/users/checkfrom.js
+10
-16
pages/users/login.vue
+6
-4
pages/users/register.vue
+6
-8
pages/users/reset.vue
+10
-15
No files found.
components/pc/loginCard/loginInput.vue
View file @
ea8362c2
...
...
@@ -46,8 +46,7 @@ export default {
data
()
{
return
{
iconName
:
'invisible'
,
countdown
:
60
,
errMsg
:
''
// 错误信息
countdown
:
60
}
},
computed
:
{
...
...
@@ -62,11 +61,7 @@ export default {
},
errMessage
:
{
get
:
function
()
{
if
(
this
.
errorMessage
!==
''
)
{
return
this
.
errorMessage
}
else
{
return
this
.
errMsg
}
return
this
.
errorMessage
}
}
},
...
...
pages/users/checkfrom.js
View file @
ea8362c2
...
...
@@ -21,37 +21,31 @@ function checkEmail(email) {
}
// 检测account 手机 邮箱
function
checkAccount
(
account
,
isEmail
=
true
)
{
function
checkAccount
(
account
)
{
if
(
/
[
a-zA-Z
]
+/
.
test
(
account
))
{
if
(
isEmail
)
{
// console.log('email');
return
checkEmail
(
account
)
}
return
checkEmail
(
account
)
}
else
{
return
checkPhone
(
account
);
}
}
// 检测密码
function
checkPassword
(
password
)
{
function
checkPassword
(
password
,
isLogin
=
false
)
{
if
(
password
===
''
)
{
return
'密码不能为空'
;
}
else
{
}
else
if
(
!
isLogin
)
{
let
reg
=
/^
(?![
0-9
]
+$
)(?![
a-z
]
+$
)(?![
A-Z
]
+$
)(?!([^
(0-9a-zA-Z)
])
+$
)
.
{8,16}
$/
;
if
(
!
reg
.
test
(
password
))
{
return
'密码格式错误'
;
}
else
{
return
''
}
return
!
reg
.
test
(
password
)
?
'密码要求长度为8-16位,包含数字和字母'
:
''
;
}
return
''
}
// 检测验证码
function
checkVerification
(
phone
)
{
let
result
=
checkPhone
(
phone
);
if
(
result
===
''
)
{
return
true
function
checkVerification
(
verifyCode
)
{
if
(
verifyCode
===
''
)
{
return
'验证码不能为空'
}
return
''
}
// function errorCode(res) {
...
...
pages/users/login.vue
View file @
ea8362c2
...
...
@@ -60,7 +60,7 @@ import loginWrap from '../../components/pc/loginCard/loginWrap'
import
LoginInput
from
"../../components/pc/loginCard/loginInput"
;
import
LoginButton
from
"../../components/pc/loginCard/loginButton"
;
import
config
from
'../../action/config'
;
import
{
checkAccount
,
checkPassword
,
checkVerification
}
from
'./checkfrom'
;
import
{
checkAccount
,
checkP
hone
,
checkP
assword
,
checkVerification
}
from
'./checkfrom'
;
const
Cookie
=
process
.
client
?
require
(
'js-cookie'
)
:
null
;
...
...
@@ -107,14 +107,15 @@ export default {
},
// 检测 密码
checkPassword
()
{
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
,
true
);
},
// 检测验证码
checkVerification
()
{
this
.
isCount
=
false
;
let
result
=
checkVerification
(
this
.
account
);
if
(
result
)
{
this
.
accountErrMsg
=
checkPhone
(
this
.
account
);
if
(
this
.
accountErrMsg
===
''
)
{
this
.
getSms
();
this
.
verifyErrMsg
=
''
;
this
.
isCount
=
true
;
setTimeout
(()
=>
{
this
.
isCount
=
false
;
...
...
@@ -146,6 +147,7 @@ export default {
// 防止全部未输入就点击
this
.
checkAccount
();
this
.
checkPassword
();
this
.
verifyErrMsg
=
checkVerification
(
this
.
verifyCode
);
let
authResponse
;
// 两种登录方式
...
...
pages/users/register.vue
View file @
ea8362c2
...
...
@@ -72,7 +72,7 @@ export default {
account
:
''
,
// 保存 手机号 邮箱
password
:
''
,
// 保存 密码
verifyCode
:
''
,
// 保存 验证码
isEmail
:
false
,
// 判断
验证码
isEmail
:
false
,
// 判断
邮箱 手机 注册
placeholder
:
'请输入手机号'
,
accountErrMsg
:
''
,
// 手机号 邮箱 错误提示
passwordErrMsg
:
''
,
// 密码错误 提示信息
...
...
@@ -115,18 +115,15 @@ export default {
},
// 检测 密码
checkPassword
()
{
if
(
checkPassword
(
this
.
password
)
===
'密码格式错误'
)
{
this
.
passwordErrMsg
=
'密码要求长度为8-16位,包含数字和字母'
}
else
{
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
}
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
},
// 检测验证码
checkVerification
()
{
this
.
isCount
=
false
;
let
result
=
checkVerification
(
this
.
account
);
if
(
result
)
{
this
.
accountErrMsg
=
checkPhone
(
this
.
account
);
if
(
this
.
accountErrMsg
===
''
)
{
this
.
getSms
();
this
.
verifyErrMsg
=
''
;
this
.
isCount
=
true
;
setTimeout
(()
=>
{
this
.
isCount
=
false
;
...
...
@@ -156,6 +153,7 @@ export default {
async
handleRegister
()
{
this
.
checkAccount
();
this
.
checkPassword
();
this
.
verifyErrMsg
=
checkVerification
(
this
.
verifyCode
);
let
registerResponse
;
...
...
pages/users/reset.vue
View file @
ea8362c2
...
...
@@ -15,7 +15,7 @@
></login-input>
<login-input
:error-message=
"passwordErrMsg"
placeholder=
"请输入密码"
placeholder=
"请输入
新的
密码"
input-type=
"2"
type=
"password"
v-model=
"password"
...
...
@@ -33,7 +33,7 @@
></login-input>
</
template
>
<
template
#
mainFooter
>
<login-button
@
handle=
"handleReset"
button=
"重
制
账号"
></login-button>
<login-button
@
handle=
"handleReset"
button=
"重
置
账号"
></login-button>
</
template
>
</login-wrap>
</div>
...
...
@@ -64,7 +64,7 @@ export default {
password
:
''
,
// 保存 密码
verifyCode
:
''
,
// 保存 验证码
isPassword
:
true
,
// 判断验证码
placeholder
:
'请输入手机号
或邮箱
'
,
placeholder
:
'请输入手机号'
,
accountErrMsg
:
''
,
// 手机号 邮箱 错误提示
passwordErrMsg
:
''
,
// 密码错误 提示信息
verifyErrMsg
:
''
,
// 验证码错误 提示信息
...
...
@@ -74,7 +74,7 @@ export default {
watch
:
{
account
:
function
(
val
)
{
if
(
val
.
length
>
10
)
{
this
.
check
Phone
();
this
.
check
Account
();
}
},
password
:
function
(
val
)
{
...
...
@@ -90,18 +90,15 @@ export default {
},
// 检测 密码
checkPassword
()
{
if
(
checkPassword
(
this
.
password
)
===
'密码格式错误'
)
{
this
.
passwordErrMsg
=
'密码要求长度为8-16位,包含数字和字母'
}
else
{
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
}
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
},
// 检测验证码
checkVerification
()
{
this
.
isCount
=
false
;
let
result
=
checkVerification
(
this
.
account
);
if
(
result
)
{
this
.
accountErrMsg
=
checkPhone
(
this
.
account
);
if
(
this
.
accountErrMsg
===
''
)
{
this
.
getSms
();
this
.
verifyErrMsg
=
''
;
this
.
isCount
=
true
;
setTimeout
(()
=>
{
this
.
isCount
=
false
;
...
...
@@ -131,7 +128,7 @@ export default {
async
handleReset
()
{
this
.
checkAccount
();
this
.
checkPassword
();
this
.
verifyErrMsg
=
checkVerification
(
this
.
verifyCode
);
let
resetResponse
;
if
(
this
.
passwordErrMsg
===
''
&&
this
.
accountErrMsg
===
''
&&
this
.
verifyErrMsg
===
''
)
{
...
...
@@ -149,9 +146,7 @@ export default {
type
:
'success'
,
message
:
resetResponse
.
msg
});
setTimeout
(()
=>
{
this
.
$router
.
push
(
'/users/login'
);
},
2500
)
this
.
$router
.
push
(
'/users/login'
);
}
else
if
(
resetResponse
!==
undefined
)
{
// 修改密码失败
if
(
resetResponse
.
code
===
1002
)
{
...
...
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