Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈轩
8 years ago
Commit
ea14c6c39df5e2da8aa2b4728bf0a0f0c1b95293
1 parent
4e3a28ae
fix YH-5027
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
apps/product/controllers/seckill.js
public/js/product/seckill.page.js
apps/product/controllers/seckill.js
View file @
ea14c6c
...
...
@@ -128,8 +128,9 @@ const index = (req, res, next) => {
return
seckillModel
.
queryActivity
().
then
((
resultActivity
)
=>
{
// console.log(resultActivity)
let
focusIndex
=
false
;
let
nowTime
=
Date
.
parse
(
new
Date
()
);
let
nowTime
=
Date
.
now
(
);
result
.
currentTime
=
nowTime
;
if
(
resultActivity
.
code
!==
200
)
{
return
next
();
}
...
...
public/js/product/seckill.page.js
View file @
ea14c6c
...
...
@@ -188,7 +188,7 @@ seckillObj = {
$el
.
$navUl
.
find
(
'>li'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'now over wait'
);
time
=
new
Date
(
parseInt
(
$
(
this
).
find
(
'input.date'
).
val
(),
10
));
nowTime
=
new
Date
();
nowTime
=
new
Date
(
Date
.
now
()
+
that
.
diff
*
1000
);
if
(
nowTime
>
time
)
{
// 当前时间大于这个时间段,已经开始和即将开始两种情况
if
(
$
(
this
).
next
(
'.time-item'
).
length
)
{
...
...
@@ -258,7 +258,7 @@ seckillObj = {
initTick
:
function
(
elem
)
{
var
$el
=
this
.
el
,
that
=
this
,
time
,
nowTime
=
Date
.
parse
(
new
Date
())
/
1000
,
nowTime
=
Date
.
parse
(
new
Date
())
/
1000
+
that
.
diff
,
offsetTime
;
if
(
$
(
elem
).
hasClass
(
'now'
))
{
...
...
@@ -288,7 +288,7 @@ seckillObj = {
$
(
elem
).
find
(
'.tick.second'
).
text
(
second
<
0
?
'00'
:
(
second
<
10
?
(
'0'
+
second
)
:
second
));
$el
.
currentTick
=
setTimeout
(
function
()
{
var
curSec
=
Math
.
floor
(
Date
.
now
()
/
1000
);
var
curSec
=
Math
.
floor
(
Date
.
now
()
/
1000
)
+
that
.
diff
;
offsetTime
=
offsetTime
-
(
curSec
-
nowTime
);
that
.
startTick
(
elem
,
offsetTime
,
curSec
);
...
...
@@ -392,16 +392,14 @@ seckillObj = {
}))
);
// if (result && result.currentTime) {
// self.diff = Math.round((Date.now() - result.currentTime) / 1000);
// }
if
(
result
&&
result
.
activitys
&&
result
.
activitys
.
length
)
{
window
.
diff
=
self
.
diff
=
Math
.
round
((
result
.
currentTime
-
Date
.
now
())
/
1000
);
callback
();
}
lazyload
(
'img.lazy'
);
window
.
rePosFooter
();
if
(
result
&&
result
.
activitys
&&
result
.
activitys
.
length
)
{
callback
();
}
})
.
error
(
function
()
{
})
...
...
Please
register
or
login
to post a comment