Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1
Commits
71b9983e
Commit
71b9983e
authored
Dec 15, 2021
by
tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 注册登录调试,
parent
2f2e7205
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
30 deletions
+79
-30
user.js
src/axios/module/user.js
+12
-0
HeaderBtn.vue
src/components/layout/header/HeaderBtn.vue
+21
-4
check.vue
src/views/Search/check.vue
+2
-2
login.vue
src/views/User/login.vue
+7
-21
register.vue
src/views/User/register.vue
+37
-3
No files found.
src/axios/module/user.js
View file @
71b9983e
...
...
@@ -9,6 +9,18 @@ const login = (params = {}) => {
return
POST
(
`
${
Prefix
}
/office/loglogin/authApi/login`
,
params
)
}
// 用户注册
const
register
=
(
params
=
{})
=>
{
return
POST
(
`
${
Prefix
}
/office/member/api/userRegistered`
,
params
)
}
// 注册获取验证码
const
code
=
(
params
=
{})
=>
{
return
POST
(
`
${
Prefix
}
/office/timescoderegi/api/getVerificationCode`
,
params
)
}
export
default
{
login
,
register
,
code
,
}
src/components/layout/header/HeaderBtn.vue
View file @
71b9983e
<
template
>
<div
class=
"header-btn move-btn"
>
<el-button
type=
"primary"
style=
"padding: 9px 30px;margin-right: 6px"
size=
"small"
@
click=
"handleToLogin"
>
注册/登录
<el-button
v-if=
"!user"
type=
"primary"
style=
"padding: 9px 30px;margin-right: 6px"
size=
"small"
@
click=
"handleToLogin"
>
注册/登录
</el-button>
<el-button
v-else
type=
"primary"
style=
"padding: 9px 30px;margin-right: 6px"
size=
"small"
@
click=
"handleExit"
>
退出登录
</el-button>
<!-- Toggler -->
...
...
@@ -21,17 +23,32 @@
<
script
>
export
default
{
name
:
"HeaderBtn"
,
data
()
{
return
{
user
:
null
}
},
methods
:
{
handleToLogin
()
{
this
.
$router
.
push
({
path
:
"/login"
});
},
handleExit
(){
localStorage
.
removeItem
(
'loginInfo'
)
localStorage
.
removeItem
(
'TOKEN'
)
localStorage
.
removeItem
(
'gs-user'
)
this
.
$router
.
push
({
path
:
"/"
});
this
.
user
=
null
}
},
created
()
{
this
.
user
=
localStorage
.
getItem
(
'loginInfo'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'loginInfo'
))
:
null
},
}
</
script
>
<
style
lang=
"scss"
>
.header-btn
{
button{
&:hover{
.header-btn
{
button
{
&:hover
{
background
:
#CC3C0F
;
}
}
...
...
src/views/Search/check.vue
View file @
71b9983e
...
...
@@ -28,7 +28,7 @@
v-model=
"search.result"
class=
"w40"
></el-input>
<a
href=
"
http://www.ancc.org.cn/Knowledge/BarcodeArticle.aspx?id=301
"
style=
"margin-left: 20px"
<a
href=
"
/Knowledge
"
style=
"margin-left: 20px"
target=
"_blank"
class=
"hover"
>
检验码计算方法
</a>
</div>
</el-form-item>
...
...
@@ -42,7 +42,7 @@
<p>
1.请根据下列提示,输入商品的包装指示符和商品条码,系统会自动计算出它的校验码。欲了解校验码的计算规则,请点击
<a
href=
"
http://www.ancc.org.cn/Knowledge/goodsGln.aspx
"
href=
"
/Knowledge
"
target=
"_blank"
style=
"color: #5ac8fa"
>
了解更多 >>
</a
...
...
src/views/User/login.vue
View file @
71b9983e
...
...
@@ -20,11 +20,11 @@
</el-form-item>
<el-form-item
class=
"validate-append"
prop=
"
verification
"
prop=
"
captcha
"
:rules=
"[
{ required: true, message: '请输入验证码', trigger: 'blur' }]"
>
<el-input
v-model=
"userForm.
verification
"
v-model=
"userForm.
captcha
"
placeholder=
"请输入验证码"
>
<template
slot=
"append"
><img
:src=
"captchaPath"
style=
"cursor: pointer"
@
click=
"getCaptcha"
alt=
""
>
...
...
@@ -69,11 +69,10 @@ export default {
userForm
:
{
userName
:
''
,
passWord
:
''
,
verification
:
''
captcha
:
''
},
captchaPath
:
''
,
uuid
:
''
,
captcha
:
''
,
errorMsg
:
''
,
}
},
...
...
@@ -113,12 +112,14 @@ export default {
// this.showUserLoginError = true;
// }
this
.
$api
.
user
.
login
({
...
this
.
userForm
...
this
.
userForm
,
uuid
:
this
.
uuid
}).
then
(
res
=>
{
console
.
log
(
res
,
!
res
.
success
)
if
(
!
res
.
success
)
{
this
.
userLoginError
=
res
.
returnMsg
||
'用户名或密码不正确!'
this
.
showUserLoginError
=
true
;
this
.
getCaptcha
();
}
else
{
localStorage
.
setItem
(
'loginInfo'
,
JSON
.
stringify
(
res
.
data
))
localStorage
.
setItem
(
'TOKEN'
,
res
.
data
.
token
)
...
...
@@ -136,26 +137,11 @@ export default {
})
}
else
{
console
.
log
(
'error submit!!'
);
this
.
getCaptcha
()
return
false
;
}
});
},
sendValidateCode
()
{
if
(
this
.
mobileForm
.
mobile
===
''
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请输入手机号码'
});
}
else
{
this
.
hasSent
=
true
;
this
.
timer
=
setInterval
(()
=>
{
this
.
time
-=
1
;
if
(
this
.
time
===
0
)
{
clearInterval
(
this
.
timer
);
this
.
time
=
60
;
this
.
hasSent
=
false
;
}
},
1000
);
}
}
},
}
</
script
>
...
...
src/views/User/register.vue
View file @
71b9983e
...
...
@@ -116,13 +116,40 @@ export default {
},
methods
:
{
register
()
{
this
.
$refs
[
'ruleForm'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$api
.
user
.
register
({
"userName"
:
this
.
form
.
userName
,
"e-miail"
:
this
.
form
.
email
,
"phone"
:
this
.
form
.
mobile
,
"subjoin"
:
this
.
form
.
validate
,
"passWord"
:
this
.
form
.
password
,
"passWord_repeat"
:
this
.
form
.
rePassword
,
}).
then
(
res
=>
{
if
(
res
.
success
){
this
.
$message
({
type
:
'success'
,
message
:
'注册成功'
});
}
else
{
this
.
$message
({
type
:
'error'
,
message
:
res
.
returnMsg
||
'注册失败,请联系管理员'
});
}
}).
catch
(
err
=>
{
console
.
log
(
err
)
this
.
$message
({
type
:
'error'
,
message
:
'网络繁忙,请联系管理员'
});
})
}
})
},
sendValidateCode
()
{
if
(
this
.
form
.
mobile
===
''
)
{
this
.
$message
({
type
:
'error'
,
message
:
'
请输入手机号码
'
});
if
(
this
.
form
.
mobile
===
''
||
this
.
form
.
userName
===
''
)
{
this
.
$message
({
type
:
'error'
,
message
:
'
手机号码和用户名不能为空
'
});
}
else
{
this
.
$api
.
user
.
code
({
"userName"
:
this
.
form
.
userName
,
"phone"
:
this
.
form
.
mobile
,
}).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
.
success
){
this
.
$message
({
type
:
'success'
,
message
:
'发送成功'
});
this
.
hasSent
=
true
;
this
.
timer
=
setInterval
(()
=>
{
this
.
time
-=
1
;
...
...
@@ -132,6 +159,13 @@ export default {
this
.
hasSent
=
false
;
}
},
1000
);
}
else
{
}
}).
catch
(
err
=>
{
console
.
log
(
err
)
this
.
$message
({
type
:
'error'
,
message
:
'验证码发送失败,请联系管理员'
});
})
}
},
...
...
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