Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-ui
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
ui
mongo-ui
Commits
cda1196e
Commit
cda1196e
authored
Jul 29, 2020
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: http.js添加公共token
parent
d8f944f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
LoginModal.vue
src/components/LoginModal.vue
+26
-4
http.js
src/service/http.js
+4
-2
No files found.
src/components/LoginModal.vue
View file @
cda1196e
...
...
@@ -5,6 +5,7 @@
:closeable="true"
cancel-btn
confirm-btn="确定"
@confirm="$refs.loginForm.submit()"
>
<cr-form
class=
"login-form"
...
...
@@ -30,8 +31,8 @@
:rules=
"validOptions[1]"
>
<template
v-slot:button
>
<a
href=
"javascript:;"
>
获取验证码
</a>
<span
class=
"login-form-remain"
>
59
s
</span>
<a
href=
"javascript:;"
@
click=
"getCode"
v-if=
"!showCount"
>
获取验证码
</a>
<span
class=
"login-form-remain"
v-else
>
{{
count
}}
s
</span>
</
template
>
</cr-field>
</cr-form>
...
...
@@ -40,7 +41,7 @@
<
script
>
import
Modal
from
"
@/components/Modal
"
;
import
{
loginByPhone
}
from
"
@/api/user
"
;
import
{
loginByPhone
,
getCaptchaSms
}
from
"
@/api/user
"
;
import
{
isPhone
}
from
"
@/service/validation
"
;
export
default
{
name
:
"
LoginModal
"
,
...
...
@@ -49,7 +50,10 @@ export default {
},
data
()
{
return
{
show
:
false
,
show
:
true
,
showCount
:
false
,
count
:
""
,
timer
:
null
,
formData
:
{
phoneNo
:
""
,
verifyCode
:
""
...
...
@@ -78,6 +82,24 @@ export default {
if
(
res
.
code
===
0
)
{
this
.
$notify
(
"
登录成功
"
);
}
},
async
getCode
()
{
const
TIME_COUNT
=
60
;
const
{
phoneNo
}
=
this
.
formData
;
const
res
=
await
getCaptchaSms
({
phoneNo
});
if
(
res
.
code
===
"
0
"
&&
!
this
.
timer
)
{
this
.
count
=
TIME_COUNT
;
this
.
showCount
=
true
;
this
.
timer
=
setInterval
(()
=>
{
if
(
this
.
count
>
0
&&
this
.
count
<=
TIME_COUNT
)
{
this
.
count
--
;
}
else
{
this
.
showCount
=
false
;
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
}
},
1000
);
}
}
}
};
...
...
src/service/http.js
View file @
cda1196e
...
...
@@ -128,7 +128,8 @@ export default {
url
:
url
,
params
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
"
Content-Type
"
:
"
application/json
"
,
"
x-auth-token
"
:
localStorage
.
getItem
(
"
mongoToken
"
)
||
null
}
})
.
then
(
res
=>
{
...
...
@@ -147,7 +148,8 @@ export default {
url
,
data
:
params
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
"
Content-Type
"
:
"
application/json
"
,
"
x-auth-token
"
:
localStorage
.
getItem
(
"
mongoToken
"
)
||
null
}
})
.
then
(
res
=>
{
...
...
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