Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
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
高淑倩
7-Eleven
Commits
ad6a16bc
Commit
ad6a16bc
authored
Aug 05, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 倒计时
parent
53179d3d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
pointList.js
src/pages/pointList/pointList.js
+35
-2
pointList.wxml
src/pages/pointList/pointList.wxml
+2
-2
No files found.
src/pages/pointList/pointList.js
View file @
ad6a16bc
...
...
@@ -9,7 +9,8 @@ wxService.page({
*/
data
:
{
pointList
:
[],
currentPointList
:
[]
// 合并对象
currentPointList
:
[],
// 合并对象
countdown
:
null
},
/**
...
...
@@ -44,6 +45,37 @@ wxService.page({
pointList
:
data
})
data
.
forEach
(
item
=>
{
let
currentEndTime
=
(
new
Date
(
item
.
endTime
)).
getTime
();
let
currentTime
=
(
new
Date
()).
getTime
();
let
distancetime
=
currentEndTime
-
currentTime
let
result
=
{
day
:
'00'
,
hour
:
'00'
,
min
:
'00'
,
sec
:
'00'
,
ms
:
'00'
,
isOver
:
true
,
};
if
(
distancetime
>
0
)
{
//如果大于0.说明尚未到达截止时间
result
.
ms
=
Math
.
floor
((
distancetime
%
1000
)
/
100
);
result
.
sec
=
Math
.
floor
((
distancetime
/
1000
)
%
60
);
result
.
min
=
Math
.
floor
((
distancetime
/
1000
/
60
)
%
60
);
result
.
hour
=
Math
.
floor
((
distancetime
/
1000
/
60
/
60
)
%
24
);
result
.
day
=
Math
.
floor
((
distancetime
/
1000
/
60
/
60
)
/
24
);
result
.
isOver
=
false
;
if
(
result
.
ms
<
10
)
result
.
ms
=
result
.
ms
;
if
(
result
.
sec
<
10
)
result
.
sec
=
'0'
+
result
.
sec
;
if
(
result
.
min
<
10
)
result
.
min
=
'0'
+
result
.
min
;
if
(
result
.
hour
<
10
)
result
.
hour
=
'0'
+
result
.
hour
;
if
(
result
.
day
<
10
)
result
.
day
=
'0'
+
result
.
day
;
}
this
.
setData
({
countdown
:
result
})
this
.
getPointConsumptionCount
(
item
.
id
)
})
}
...
...
@@ -58,9 +90,10 @@ wxService.page({
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
wx
.
hideLoading
()
let
obj1
=
{...
this
.
data
.
pointList
,...
res
.
data
}
let
obj1
=
{...
this
.
data
.
pointList
,...
data
}
let
currentList
=
[]
currentList
.
push
(
obj1
)
console
.
log
(
'-'
,
currentList
)
this
.
setData
({
currentPointList
:
currentList
})
...
...
src/pages/pointList/pointList.wxml
View file @
ad6a16bc
...
...
@@ -5,11 +5,11 @@
<status-img img="{{item[0].listImage}}" />
<view class="progress weui-flex df-j--bt">
<view class="rate">进度:
<text class="rate-num">
1
</text>
<text class="rate-num">
{{item.surplusPoints}}
</text>
/ {{item[0].goal}}
</view>
<view class="time-out">距离结束时间:
<text class="time">
11
</text>
<text class="time">
{{countdown.day}}天{{countdown.hour}}小时
</text>
</view>
</view>
</view>
...
...
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