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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
45 deletions
+29
-45
components/pc/loginCard/loginInput.vue
+1
-6
pages/users/checkfrom.js
+9
-15
pages/users/login.vue
+6
-4
pages/users/register.vue
+5
-7
pages/users/reset.vue
+8
-13
No files found.
components/pc/loginCard/loginInput.vue
View file @
ea8362c2
...
@@ -46,8 +46,7 @@ export default {
...
@@ -46,8 +46,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
iconName
:
'invisible'
,
iconName
:
'invisible'
,
countdown
:
60
,
countdown
:
60
errMsg
:
''
// 错误信息
}
}
},
},
computed
:
{
computed
:
{
...
@@ -62,11 +61,7 @@ export default {
...
@@ -62,11 +61,7 @@ export default {
},
},
errMessage
:
{
errMessage
:
{
get
:
function
()
{
get
:
function
()
{
if
(
this
.
errorMessage
!==
''
)
{
return
this
.
errorMessage
return
this
.
errorMessage
}
else
{
return
this
.
errMsg
}
}
}
}
}
},
},
...
...
pages/users/checkfrom.js
View file @
ea8362c2
...
@@ -21,37 +21,31 @@ function checkEmail(email) {
...
@@ -21,37 +21,31 @@ function checkEmail(email) {
}
}
// 检测account 手机 邮箱
// 检测account 手机 邮箱
function
checkAccount
(
account
,
isEmail
=
true
)
{
function
checkAccount
(
account
)
{
if
(
/
[
a-zA-Z
]
+/
.
test
(
account
))
{
if
(
/
[
a-zA-Z
]
+/
.
test
(
account
))
{
if
(
isEmail
)
{
// console.log('email');
return
checkEmail
(
account
)
return
checkEmail
(
account
)
}
}
else
{
}
else
{
return
checkPhone
(
account
);
return
checkPhone
(
account
);
}
}
}
}
// 检测密码
// 检测密码
function
checkPassword
(
password
)
{
function
checkPassword
(
password
,
isLogin
=
false
)
{
if
(
password
===
''
)
{
if
(
password
===
''
)
{
return
'密码不能为空'
;
return
'密码不能为空'
;
}
else
{
}
else
if
(
!
isLogin
)
{
let
reg
=
/^
(?![
0-9
]
+$
)(?![
a-z
]
+$
)(?![
A-Z
]
+$
)(?!([^
(0-9a-zA-Z)
])
+$
)
.
{8,16}
$/
;
let
reg
=
/^
(?![
0-9
]
+$
)(?![
a-z
]
+$
)(?![
A-Z
]
+$
)(?!([^
(0-9a-zA-Z)
])
+$
)
.
{8,16}
$/
;
if
(
!
reg
.
test
(
password
))
{
return
!
reg
.
test
(
password
)
?
'密码要求长度为8-16位,包含数字和字母'
:
''
;
return
'密码格式错误'
;
}
else
{
return
''
}
}
}
return
''
}
}
// 检测验证码
// 检测验证码
function
checkVerification
(
phone
)
{
function
checkVerification
(
verifyCode
)
{
let
result
=
checkPhone
(
phone
);
if
(
verifyCode
===
''
)
{
if
(
result
===
''
)
{
return
'验证码不能为空'
return
true
}
}
return
''
}
}
// function errorCode(res) {
// function errorCode(res) {
...
...
pages/users/login.vue
View file @
ea8362c2
...
@@ -60,7 +60,7 @@ import loginWrap from '../../components/pc/loginCard/loginWrap'
...
@@ -60,7 +60,7 @@ import loginWrap from '../../components/pc/loginCard/loginWrap'
import
LoginInput
from
"../../components/pc/loginCard/loginInput"
;
import
LoginInput
from
"../../components/pc/loginCard/loginInput"
;
import
LoginButton
from
"../../components/pc/loginCard/loginButton"
;
import
LoginButton
from
"../../components/pc/loginCard/loginButton"
;
import
config
from
'../../action/config'
;
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
;
const
Cookie
=
process
.
client
?
require
(
'js-cookie'
)
:
null
;
...
@@ -107,14 +107,15 @@ export default {
...
@@ -107,14 +107,15 @@ export default {
},
},
// 检测 密码
// 检测 密码
checkPassword
()
{
checkPassword
()
{
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
,
true
);
},
},
// 检测验证码
// 检测验证码
checkVerification
()
{
checkVerification
()
{
this
.
isCount
=
false
;
this
.
isCount
=
false
;
let
result
=
checkVerification
(
this
.
account
);
this
.
accountErrMsg
=
checkPhone
(
this
.
account
);
if
(
result
)
{
if
(
this
.
accountErrMsg
===
''
)
{
this
.
getSms
();
this
.
getSms
();
this
.
verifyErrMsg
=
''
;
this
.
isCount
=
true
;
this
.
isCount
=
true
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
isCount
=
false
;
this
.
isCount
=
false
;
...
@@ -146,6 +147,7 @@ export default {
...
@@ -146,6 +147,7 @@ export default {
// 防止全部未输入就点击
// 防止全部未输入就点击
this
.
checkAccount
();
this
.
checkAccount
();
this
.
checkPassword
();
this
.
checkPassword
();
this
.
verifyErrMsg
=
checkVerification
(
this
.
verifyCode
);
let
authResponse
;
let
authResponse
;
// 两种登录方式
// 两种登录方式
...
...
pages/users/register.vue
View file @
ea8362c2
...
@@ -72,7 +72,7 @@ export default {
...
@@ -72,7 +72,7 @@ export default {
account
:
''
,
// 保存 手机号 邮箱
account
:
''
,
// 保存 手机号 邮箱
password
:
''
,
// 保存 密码
password
:
''
,
// 保存 密码
verifyCode
:
''
,
// 保存 验证码
verifyCode
:
''
,
// 保存 验证码
isEmail
:
false
,
// 判断
验证码
isEmail
:
false
,
// 判断
邮箱 手机 注册
placeholder
:
'请输入手机号'
,
placeholder
:
'请输入手机号'
,
accountErrMsg
:
''
,
// 手机号 邮箱 错误提示
accountErrMsg
:
''
,
// 手机号 邮箱 错误提示
passwordErrMsg
:
''
,
// 密码错误 提示信息
passwordErrMsg
:
''
,
// 密码错误 提示信息
...
@@ -115,18 +115,15 @@ export default {
...
@@ -115,18 +115,15 @@ export default {
},
},
// 检测 密码
// 检测 密码
checkPassword
()
{
checkPassword
()
{
if
(
checkPassword
(
this
.
password
)
===
'密码格式错误'
)
{
this
.
passwordErrMsg
=
'密码要求长度为8-16位,包含数字和字母'
}
else
{
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
}
},
},
// 检测验证码
// 检测验证码
checkVerification
()
{
checkVerification
()
{
this
.
isCount
=
false
;
this
.
isCount
=
false
;
let
result
=
checkVerification
(
this
.
account
);
this
.
accountErrMsg
=
checkPhone
(
this
.
account
);
if
(
result
)
{
if
(
this
.
accountErrMsg
===
''
)
{
this
.
getSms
();
this
.
getSms
();
this
.
verifyErrMsg
=
''
;
this
.
isCount
=
true
;
this
.
isCount
=
true
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
isCount
=
false
;
this
.
isCount
=
false
;
...
@@ -156,6 +153,7 @@ export default {
...
@@ -156,6 +153,7 @@ export default {
async
handleRegister
()
{
async
handleRegister
()
{
this
.
checkAccount
();
this
.
checkAccount
();
this
.
checkPassword
();
this
.
checkPassword
();
this
.
verifyErrMsg
=
checkVerification
(
this
.
verifyCode
);
let
registerResponse
;
let
registerResponse
;
...
...
pages/users/reset.vue
View file @
ea8362c2
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
></login-input>
></login-input>
<login-input
<login-input
:error-message=
"passwordErrMsg"
:error-message=
"passwordErrMsg"
placeholder=
"请输入密码"
placeholder=
"请输入
新的
密码"
input-type=
"2"
input-type=
"2"
type=
"password"
type=
"password"
v-model=
"password"
v-model=
"password"
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
></login-input>
></login-input>
</
template
>
</
template
>
<
template
#
mainFooter
>
<
template
#
mainFooter
>
<login-button
@
handle=
"handleReset"
button=
"重
制
账号"
></login-button>
<login-button
@
handle=
"handleReset"
button=
"重
置
账号"
></login-button>
</
template
>
</
template
>
</login-wrap>
</login-wrap>
</div>
</div>
...
@@ -64,7 +64,7 @@ export default {
...
@@ -64,7 +64,7 @@ export default {
password
:
''
,
// 保存 密码
password
:
''
,
// 保存 密码
verifyCode
:
''
,
// 保存 验证码
verifyCode
:
''
,
// 保存 验证码
isPassword
:
true
,
// 判断验证码
isPassword
:
true
,
// 判断验证码
placeholder
:
'请输入手机号
或邮箱
'
,
placeholder
:
'请输入手机号'
,
accountErrMsg
:
''
,
// 手机号 邮箱 错误提示
accountErrMsg
:
''
,
// 手机号 邮箱 错误提示
passwordErrMsg
:
''
,
// 密码错误 提示信息
passwordErrMsg
:
''
,
// 密码错误 提示信息
verifyErrMsg
:
''
,
// 验证码错误 提示信息
verifyErrMsg
:
''
,
// 验证码错误 提示信息
...
@@ -74,7 +74,7 @@ export default {
...
@@ -74,7 +74,7 @@ export default {
watch
:
{
watch
:
{
account
:
function
(
val
)
{
account
:
function
(
val
)
{
if
(
val
.
length
>
10
)
{
if
(
val
.
length
>
10
)
{
this
.
check
Phone
();
this
.
check
Account
();
}
}
},
},
password
:
function
(
val
)
{
password
:
function
(
val
)
{
...
@@ -90,18 +90,15 @@ export default {
...
@@ -90,18 +90,15 @@ export default {
},
},
// 检测 密码
// 检测 密码
checkPassword
()
{
checkPassword
()
{
if
(
checkPassword
(
this
.
password
)
===
'密码格式错误'
)
{
this
.
passwordErrMsg
=
'密码要求长度为8-16位,包含数字和字母'
}
else
{
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
this
.
passwordErrMsg
=
checkPassword
(
this
.
password
);
}
},
},
// 检测验证码
// 检测验证码
checkVerification
()
{
checkVerification
()
{
this
.
isCount
=
false
;
this
.
isCount
=
false
;
let
result
=
checkVerification
(
this
.
account
);
this
.
accountErrMsg
=
checkPhone
(
this
.
account
);
if
(
result
)
{
if
(
this
.
accountErrMsg
===
''
)
{
this
.
getSms
();
this
.
getSms
();
this
.
verifyErrMsg
=
''
;
this
.
isCount
=
true
;
this
.
isCount
=
true
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
isCount
=
false
;
this
.
isCount
=
false
;
...
@@ -131,7 +128,7 @@ export default {
...
@@ -131,7 +128,7 @@ export default {
async
handleReset
()
{
async
handleReset
()
{
this
.
checkAccount
();
this
.
checkAccount
();
this
.
checkPassword
();
this
.
checkPassword
();
this
.
verifyErrMsg
=
checkVerification
(
this
.
verifyCode
);
let
resetResponse
;
let
resetResponse
;
if
(
this
.
passwordErrMsg
===
''
&&
this
.
accountErrMsg
===
''
&&
this
.
verifyErrMsg
===
''
)
{
if
(
this
.
passwordErrMsg
===
''
&&
this
.
accountErrMsg
===
''
&&
this
.
verifyErrMsg
===
''
)
{
...
@@ -149,9 +146,7 @@ export default {
...
@@ -149,9 +146,7 @@ export default {
type
:
'success'
,
type
:
'success'
,
message
:
resetResponse
.
msg
message
:
resetResponse
.
msg
});
});
setTimeout
(()
=>
{
this
.
$router
.
push
(
'/users/login'
);
this
.
$router
.
push
(
'/users/login'
);
},
2500
)
}
else
if
(
resetResponse
!==
undefined
)
{
}
else
if
(
resetResponse
!==
undefined
)
{
// 修改密码失败
// 修改密码失败
if
(
resetResponse
.
code
===
1002
)
{
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