Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
campSite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨梦雪
campSite
Commits
546ff08a
Commit
546ff08a
authored
Oct 25, 2021
by
杨梦雪
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.thussat.com.cn/yangmengxue/campsite
parents
0aa4df0d
803edfa1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
32 deletions
+42
-32
src/store/time.js
src/store/time.js
+17
-19
src/views/index/login/Register.vue
src/views/index/login/Register.vue
+24
-11
src/views/index/login/Reset.vue
src/views/index/login/Reset.vue
+1
-2
No files found.
src/store/time.js
View file @
546ff08a
...
@@ -10,30 +10,28 @@ export function djTime(data) {
...
@@ -10,30 +10,28 @@ export function djTime(data) {
}
}
export
function
formatTime
(
data
)
{
export
function
formatTime
(
data
)
{
var
time
=
new
Date
(
data
);
let
time
=
new
Date
(
data
);
var
y
=
time
.
getFullYear
();
let
y
=
time
.
getFullYear
();
var
m
=
time
.
getMonth
()
+
1
;
let
m
=
time
.
getMonth
()
+
1
;
var
d
=
time
.
getDate
();
let
d
=
time
.
getDate
();
var
h
=
time
.
getHours
();
let
h
=
time
.
getHours
();
var
mm
=
time
.
getMinutes
();
let
mm
=
time
.
getMinutes
();
var
ss
=
time
.
getSeconds
();
let
ss
=
time
.
getSeconds
();
return
(
y
+
"
-
"
+
add0
(
m
)
+
"
-
"
+
add0
(
d
)
+
"
"
+
add0
(
h
)
+
"
:
"
+
add0
(
mm
)
+
"
:
"
+
add0
(
ss
));
return
(
y
+
"
-
"
+
add0
(
m
)
+
"
-
"
+
add0
(
d
)
+
"
"
+
add0
(
h
)
+
"
:
"
+
add0
(
mm
)
+
"
:
"
+
add0
(
ss
));
}
}
//计算两个时间之间的时间差
多少天时分
秒
//计算两个时间之间的时间差
-多少
秒
export
function
intervalTime
(
startTime
,
endTime
)
{
export
function
intervalTime
(
startTime
,
endTime
)
{
var
stime
=
new
Date
(
startTime
);
let
stime
=
new
Date
(
startTime
);
var
etime
=
new
Date
(
endTime
);
let
etime
=
new
Date
(
endTime
);
// console.log(stime,etime)
if
(
stime
>
etime
){
if
(
stime
>
etime
){
return
add0
(
0
)
+
'
:
'
+
add0
(
0
)
return
add0
(
0
)
+
'
:
'
+
add0
(
0
)
}
}
var
y
=
etime
.
getFullYear
()
-
stime
.
getFullYear
();
let
y
=
etime
.
getFullYear
()
-
stime
.
getFullYear
();
var
m
=
etime
.
getMonth
()
+
1
-
(
stime
.
getMonth
()
+
1
);
let
m
=
etime
.
getMonth
()
+
1
-
(
stime
.
getMonth
()
+
1
);
var
d
=
etime
.
getDate
()
-
stime
.
getDate
();
let
d
=
etime
.
getDate
()
-
stime
.
getDate
();
var
h
=
etime
.
getHours
()
-
stime
.
getHours
();
let
h
=
etime
.
getHours
()
-
stime
.
getHours
();
var
mm
=
etime
.
getMinutes
()
-
stime
.
getMinutes
();
let
mm
=
etime
.
getMinutes
()
-
stime
.
getMinutes
();
var
ss
=
etime
.
getSeconds
()
-
stime
.
getSeconds
();
let
ss
=
etime
.
getSeconds
()
-
stime
.
getSeconds
();
var
time
=
y
*
365
*
24
*
60
*
60
+
m
*
30
*
24
*
60
*
60
+
d
*
24
*
60
*
60
+
h
*
60
*
60
+
mm
*
60
+
ss
let
time
=
y
*
365
*
24
*
60
*
60
+
m
*
30
*
24
*
60
*
60
+
d
*
24
*
60
*
60
+
h
*
60
*
60
+
mm
*
60
+
ss
time
=
add0
(
parseInt
(
time
/
60
))
+
'
:
'
+
add0
(
time
%
60
)
return
time
;
return
time
;
}
}
src/views/index/login/Register.vue
View file @
546ff08a
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
import
{
registerCode
,
setAccountInfo
}
from
"
r/index/register
"
;
import
{
registerCode
,
setAccountInfo
}
from
"
r/index/register
"
;
import
{
mobileCheck
,
checkStrong
}
from
"
@/common/utils.js
"
;
import
{
mobileCheck
,
checkStrong
}
from
"
@/common/utils.js
"
;
import
{
validatePassword
}
from
"
@/common/validator
"
;
import
{
validatePassword
}
from
"
@/common/validator
"
;
import
{
intervalTime
}
from
"
store/time
"
;
export
default
{
export
default
{
name
:
"
index-register
"
,
name
:
"
index-register
"
,
...
@@ -177,7 +178,12 @@ export default {
...
@@ -177,7 +178,12 @@ export default {
};
};
},
},
created
()
{
created
()
{
// this.$emit("getStatus", false);
const
endTime
=
window
.
localStorage
.
getItem
(
'
register_code_time
'
);
const
phone
=
window
.
localStorage
.
getItem
(
'
register_code_phone
'
);
if
(
endTime
&&
Number
(
endTime
)
>
new
Date
().
getTime
()){
this
.
registerForm
.
phone
=
phone
;
this
.
intervalHandle
(
new
Date
(),
Number
(
endTime
));
}
},
},
methods
:
{
methods
:
{
// 去注册
// 去注册
...
@@ -188,26 +194,30 @@ export default {
...
@@ -188,26 +194,30 @@ export default {
changePwdStatus
()
{
changePwdStatus
()
{
this
.
isShowPwd
=
!
this
.
isShowPwd
;
this
.
isShowPwd
=
!
this
.
isShowPwd
;
},
},
// 获取手机验证短信
// 定时器倒计时
getCode
()
{
intervalHandle
(
startTime
,
endTime
){
if
(
!
this
.
registerForm
.
phone
)
{
// 时间差
return
this
.
$message
.
error
(
"
请输入手机号
"
);
const
timeLag
=
intervalTime
(
startTime
,
endTime
);
}
console
.
log
(
timeLag
)
// 倒计时60s
const
TIME_COUNT
=
60
;
if
(
!
this
.
timer
)
{
if
(
!
this
.
timer
)
{
this
.
count
=
TIME_COUNT
;
this
.
count
=
timeLag
;
this
.
show
=
false
;
this
.
show
=
false
;
this
.
timer
=
setInterval
(()
=>
{
this
.
timer
=
setInterval
(()
=>
{
if
(
this
.
count
>
0
&&
this
.
count
<=
TIME_COUNT
)
{
if
(
this
.
count
>
0
&&
this
.
count
<=
timeLag
)
{
this
.
count
--
;
this
.
count
--
;
}
else
{
}
else
{
this
.
show
=
true
;
this
.
show
=
true
;
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
this
.
timer
=
null
;
}
}
},
1000
);
},
1000
);
}
}
},
// 获取手机验证短信
getCode
()
{
if
(
!
this
.
registerForm
.
phone
)
{
return
this
.
$message
.
error
(
"
请输入手机号
"
);
}
// 接口获得验证码
// 接口获得验证码
registerCode
({
registerCode
({
phone
:
this
.
registerForm
.
phone
,
phone
:
this
.
registerForm
.
phone
,
...
@@ -217,6 +227,9 @@ export default {
...
@@ -217,6 +227,9 @@ export default {
return
this
.
$message
.
error
(
res
.
data
.
message
);
return
this
.
$message
.
error
(
res
.
data
.
message
);
}
}
this
.
$message
.
success
(
res
.
data
.
message
);
this
.
$message
.
success
(
res
.
data
.
message
);
window
.
localStorage
.
setItem
(
'
register_code_time
'
,
res
.
data
.
data
.
now
*
1000
);
window
.
localStorage
.
setItem
(
'
register_code_phone
'
,
this
.
registerForm
.
phone
);
this
.
intervalHandle
(
new
Date
(),
res
.
data
.
data
.
now
*
1000
);
});
});
},
},
...
...
src/views/index/login/Reset.vue
View file @
546ff08a
...
@@ -193,7 +193,6 @@ export default {
...
@@ -193,7 +193,6 @@ export default {
if
(
!
this
.
resetForm
.
phone
)
{
if
(
!
this
.
resetForm
.
phone
)
{
return
this
.
$message
.
error
(
"
请输入手机号
"
);
return
this
.
$message
.
error
(
"
请输入手机号
"
);
}
}
// 接口获得验证码
// 接口获得验证码
passwordCode
({
passwordCode
({
phone
:
this
.
resetForm
.
phone
,
phone
:
this
.
resetForm
.
phone
,
...
@@ -221,7 +220,7 @@ export default {
...
@@ -221,7 +220,7 @@ export default {
// let s = Number(min * 60) + Number(sec);
// let s = Number(min * 60) + Number(sec);
// console.log(s); //130
// console.log(s); //130
// let aa = timeSpan(nowdata, codeTime);
// let aa = timeSpan(nowdata, codeTime);
// 倒计时60s
// 倒计时60s
const
TIME_COUNT
=
60
;
const
TIME_COUNT
=
60
;
if
(
!
this
.
timer
)
{
if
(
!
this
.
timer
)
{
...
...
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