Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sensorConsult
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
zhanglw
sensorConsult
Commits
dfe4197e
Commit
dfe4197e
authored
Aug 21, 2023
by
zhanglw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
ff1e7584
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
249 additions
and
22 deletions
+249
-22
common.js
src/api/common.js
+10
-0
login.js
src/api/login.js
+3
-2
user.js
src/store/modules/user.js
+1
-1
login.vue
src/views/homepage/login.vue
+53
-19
userAgreement.vue
src/views/homepage/userAgreement.vue
+182
-0
No files found.
src/api/common.js
View file @
dfe4197e
...
@@ -597,6 +597,16 @@ export const HttpReq = {
...
@@ -597,6 +597,16 @@ export const HttpReq = {
return
res
return
res
})
})
},
},
// 请求短信验证
sendSmsCode
:
function
(
data
)
{
return
request
({
url
:
'
/api/bsw/bigScreen/personalCenter/sendSmsCode
'
,
method
:
'
post
'
,
data
:
data
}).
then
((
res
)
=>
{
return
res
})
},
id
:
null
id
:
null
}
}
}
}
...
...
src/api/login.js
View file @
dfe4197e
import
request
from
'
@/utils/request
'
import
request
from
'
@/utils/request
'
export
function
login
(
username
,
password
,
code
,
uuid
)
{
export
function
login
(
username
,
password
,
code
,
uuid
,
smsCode
)
{
return
request
({
return
request
({
url
:
'
auth/login
'
,
url
:
'
auth/login
'
,
method
:
'
post
'
,
method
:
'
post
'
,
...
@@ -8,7 +8,8 @@ export function login(username, password, code, uuid) {
...
@@ -8,7 +8,8 @@ export function login(username, password, code, uuid) {
username
,
username
,
password
,
password
,
code
,
code
,
uuid
uuid
,
smsCode
}
}
})
})
}
}
...
...
src/store/modules/user.js
View file @
dfe4197e
...
@@ -30,7 +30,7 @@ const user = {
...
@@ -30,7 +30,7 @@ const user = {
Login
({
commit
},
userInfo
)
{
Login
({
commit
},
userInfo
)
{
const
rememberMe
=
userInfo
.
rememberMe
const
rememberMe
=
userInfo
.
rememberMe
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
login
(
userInfo
.
username
,
userInfo
.
password
,
userInfo
.
code
,
userInfo
.
uuid
).
then
(
res
=>
{
login
(
userInfo
.
username
,
userInfo
.
password
,
userInfo
.
code
,
userInfo
.
uuid
,
userInfo
.
smsCode
).
then
(
res
=>
{
setToken
(
res
.
token
,
rememberMe
)
setToken
(
res
.
token
,
rememberMe
)
commit
(
'
SET_TOKEN
'
,
res
.
token
)
commit
(
'
SET_TOKEN
'
,
res
.
token
)
setUserInfo
(
res
.
user
,
commit
)
setUserInfo
(
res
.
user
,
commit
)
...
...
src/views/homepage/login.vue
View file @
dfe4197e
...
@@ -37,8 +37,8 @@
...
@@ -37,8 +37,8 @@
<img
:src=
"codeUrl"
@
click=
"getCode"
>
<img
:src=
"codeUrl"
@
click=
"getCode"
>
</div>
</div>
</el-form-item>
</el-form-item>
<el-form-item
v-show=
"mode!==1"
prop=
"sms"
>
<el-form-item
v-show=
"mode!==1"
prop=
"sms
Code
"
>
<el-input
v-model=
"loginForm.sms"
size=
"medium"
auto-complete=
"off"
placeholder=
"短信验证码"
style=
"width: 70%"
@
keyup.enter.native=
"handleLogin"
>
<el-input
v-model=
"loginForm.sms
Code
"
size=
"medium"
auto-complete=
"off"
placeholder=
"短信验证码"
style=
"width: 70%"
@
keyup.enter.native=
"handleLogin"
>
<svg-icon
slot=
"prefix"
icon-class=
"validCode"
class=
"el-input__icon input-icon"
/>
<svg-icon
slot=
"prefix"
icon-class=
"validCode"
class=
"el-input__icon input-icon"
/>
</el-input>
</el-input>
<div
class=
"login-code"
>
<div
class=
"login-code"
>
...
@@ -66,14 +66,15 @@
...
@@ -66,14 +66,15 @@
<span
class=
"underline touch"
@
click=
"changeMode(1)"
>
使用已有账号登录
</span>
<span
class=
"underline touch"
@
click=
"changeMode(1)"
>
使用已有账号登录
</span>
</div>
</div>
<div
style=
"padding: 10px 0;"
>
<div
style=
"padding: 10px 0;"
>
<el-checkbox
v-model=
"loginForm.
rememberMe
"
style=
"margin:0;opacity:0.8"
/>
<el-checkbox
v-model=
"loginForm.
agreement
"
style=
"margin:0;opacity:0.8"
/>
<div
class=
"login-agreement"
><span
class=
"touch"
>
阅读并接受《中国基建传感器网用户协议》及
《中国基建传感器网隐私权保护声明》
</span></div>
<div
class=
"login-agreement"
><span
style=
"opacity:0.8"
>
阅读并接受
</span><span
class=
"touch"
@
click=
"openView(1)"
>
《中国基建传感器网用户协议》
</span><span
style=
"opacity:0.8"
>
及
</span><span
class=
"touch"
@
click=
"openView(3)"
>
《中国基建传感器网隐私权保护声明》
</span></div>
</div>
</div>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
</div>
</div>
<home-footer
ref=
"homeFooter"
/>
<home-footer
ref=
"homeFooter"
/>
<user-agreement
ref=
"userAgreement"
/>
</div>
</div>
</template>
</template>
...
@@ -87,9 +88,11 @@ import titleMenus from './components/titleMenus'
...
@@ -87,9 +88,11 @@ import titleMenus from './components/titleMenus'
import
userLogin
from
'
./components/userLogin
'
import
userLogin
from
'
./components/userLogin
'
import
languageSetting
from
'
./components/languageSetting
'
import
languageSetting
from
'
./components/languageSetting
'
import
homeFooter
from
'
./components/homeFooter
'
import
homeFooter
from
'
./components/homeFooter
'
import
{
HttpReq
}
from
'
@/api/common
'
import
userAgreement
from
'
./userAgreement
'
export
default
{
export
default
{
components
:
{
titleMenus
,
userLogin
,
languageSetting
,
homeFooter
},
components
:
{
titleMenus
,
userLogin
,
languageSetting
,
homeFooter
,
userAgreement
},
data
()
{
data
()
{
const
validateMobile
=
(
rule
,
value
,
callback
)
=>
{
const
validateMobile
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
'
admin
'
)
{
if
(
value
===
'
admin
'
)
{
...
@@ -137,15 +140,16 @@ export default {
...
@@ -137,15 +140,16 @@ export default {
username
:
''
,
username
:
''
,
password
:
''
,
password
:
''
,
rememberMe
:
false
,
rememberMe
:
false
,
agreement
:
true
,
code
:
''
,
code
:
''
,
sms
:
''
,
sms
Code
:
''
,
uuid
:
''
uuid
:
''
},
},
loginRules
:
{
loginRules
:
{
username
:
[{
required
:
true
,
trigger
:
'
blur
'
,
message
:
'
手机号不能为空
'
},
{
validator
:
validateMobile
,
trigger
:
'
blur
'
}],
username
:
[{
required
:
true
,
trigger
:
'
blur
'
,
message
:
'
手机号不能为空
'
},
{
validator
:
validateMobile
,
trigger
:
'
blur
'
}],
password
:
[{
validator
:
validatePass
,
trigger
:
'
blur
'
}],
password
:
[{
validator
:
validatePass
,
trigger
:
'
blur
'
}],
code
:
[{
validator
:
validateCode
,
trigger
:
'
change
'
}],
code
:
[{
validator
:
validateCode
,
trigger
:
'
change
'
}],
sms
:
[{
validator
:
validateSms
,
trigger
:
'
change
'
}]
sms
Code
:
[{
validator
:
validateSms
,
trigger
:
'
change
'
}]
},
},
loading
:
false
,
loading
:
false
,
redirect
:
undefined
redirect
:
undefined
...
@@ -182,12 +186,21 @@ export default {
...
@@ -182,12 +186,21 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
openView
(
item
)
{
this
.
$refs
.
userAgreement
.
loadData
(
item
)
},
changeMode
(
mode
)
{
changeMode
(
mode
)
{
this
.
mode
=
mode
this
.
mode
=
mode
if
(
mode
===
1
)
{
if
(
mode
===
1
)
{
this
.
title
=
'
登录
'
this
.
title
=
'
登录
'
this
.
loginForm
.
password
=
''
this
.
loginForm
.
code
=
''
this
.
loginForm
.
smsCode
=
''
}
else
if
(
mode
===
2
)
{
}
else
if
(
mode
===
2
)
{
this
.
title
=
'
快捷登录
'
this
.
title
=
'
快捷登录
'
this
.
loginForm
.
password
=
''
this
.
loginForm
.
code
=
''
this
.
loginForm
.
smsCode
=
''
}
else
{
}
else
{
this
.
title
=
'
注册
'
this
.
title
=
'
注册
'
}
}
...
@@ -196,16 +209,34 @@ export default {
...
@@ -196,16 +209,34 @@ export default {
if
(
this
.
timer
&&
this
.
smsTime
)
{
if
(
this
.
timer
&&
this
.
smsTime
)
{
return
return
}
}
this
.
smsBtn
=
'
短信已发送
'
if
(
!
this
.
loginForm
.
username
)
{
this
.
smsTime
=
30
return
this
.
$notify
({
this
.
timer
=
setInterval
(()
=>
{
message
:
'
请输入手机号!
'
,
this
.
smsTime
--
type
:
'
warning
'
,
if
(
this
.
smsTime
===
0
)
{
duration
:
5000
clearInterval
(
this
.
timer
)
})
this
.
timer
=
null
}
this
.
smsBtn
=
'
短信获取验证码
'
HttpReq
.
webClientApi
.
sendSmsCode
({
tel
:
this
.
loginForm
.
username
}).
then
((
res
)
=>
{
this
.
$notify
({
title
:
res
.
msg
,
type
:
'
success
'
,
duration
:
2500
})
if
(
res
.
code
===
200
)
{
this
.
smsBtn
=
'
短信已发送
'
this
.
smsTime
=
30
this
.
timer
=
setInterval
(()
=>
{
this
.
smsTime
--
if
(
this
.
smsTime
===
0
)
{
clearInterval
(
this
.
timer
)
this
.
timer
=
null
this
.
smsBtn
=
'
短信获取验证码
'
}
},
1000
)
}
}
}
,
1000
)
})
},
},
getCode
()
{
getCode
()
{
getCodeImg
().
then
(
res
=>
{
getCodeImg
().
then
(
res
=>
{
...
@@ -224,7 +255,10 @@ export default {
...
@@ -224,7 +255,10 @@ export default {
username
:
username
===
undefined
?
this
.
loginForm
.
username
:
username
,
username
:
username
===
undefined
?
this
.
loginForm
.
username
:
username
,
password
:
password
,
password
:
password
,
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
),
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
),
code
:
''
code
:
''
,
agreement
:
true
,
smsCode
:
''
,
uuid
:
''
}
}
},
},
handleRegister
()
{
handleRegister
()
{
...
@@ -234,7 +268,7 @@ export default {
...
@@ -234,7 +268,7 @@ export default {
password
:
this
.
loginForm
.
password
,
password
:
this
.
loginForm
.
password
,
rememberMe
:
this
.
loginForm
.
rememberMe
,
rememberMe
:
this
.
loginForm
.
rememberMe
,
code
:
this
.
loginForm
.
code
,
code
:
this
.
loginForm
.
code
,
sms
:
this
.
loginForm
.
sms
,
sms
Code
:
this
.
loginForm
.
smsCode
,
uuid
:
this
.
loginForm
.
uuid
uuid
:
this
.
loginForm
.
uuid
}
}
if
(
user
.
password
!==
this
.
cookiePass
)
{
if
(
user
.
password
!==
this
.
cookiePass
)
{
...
@@ -271,7 +305,7 @@ export default {
...
@@ -271,7 +305,7 @@ export default {
password
:
this
.
loginForm
.
password
,
password
:
this
.
loginForm
.
password
,
rememberMe
:
this
.
loginForm
.
rememberMe
,
rememberMe
:
this
.
loginForm
.
rememberMe
,
code
:
this
.
loginForm
.
code
,
code
:
this
.
loginForm
.
code
,
sms
:
this
.
loginForm
.
sms
,
sms
Code
:
this
.
loginForm
.
smsCode
,
uuid
:
this
.
loginForm
.
uuid
uuid
:
this
.
loginForm
.
uuid
}
}
if
(
user
.
password
!==
this
.
cookiePass
)
{
if
(
user
.
password
!==
this
.
cookiePass
)
{
...
...
src/views/homepage/userAgreement.vue
0 → 100644
View file @
dfe4197e
This diff is collapsed.
Click to expand it.
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