Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
walk_daka_wx
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
穆启卓
walk_daka_wx
Commits
9037169d
Commit
9037169d
authored
Apr 23, 2019
by
穆启卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仪表盘进度条超出情况处理
parent
3ad20622
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
index.js
pages/index/index.js
+8
-5
No files found.
pages/index/index.js
View file @
9037169d
...
@@ -288,7 +288,7 @@ Page({
...
@@ -288,7 +288,7 @@ Page({
if
(
resData
.
total_step
>
0
)
{
if
(
resData
.
total_step
>
0
)
{
// this.changeShowPopup();
// this.changeShowPopup();
const
realCurrentSteps
=
(
resData
.
step_data
&&
resData
.
step_data
[
0
])
?
resData
.
step_data
[
0
].
step
:
0
;
const
realCurrentSteps
=
(
resData
.
step_data
&&
resData
.
step_data
[
0
])
?
resData
.
step_data
[
0
].
step
:
0
;
this
.
dynamicDrawCanvas
(
realCurrentSteps
,
resData
.
total_step
/
100
);
this
.
dynamicDrawCanvas
(
realCurrentSteps
,
(
resData
.
currentSteps
>
resData
.
total_step
?
resData
.
total_step
:
resData
.
currentSteps
)
/
100
);
}
else
{
}
else
{
setData
.
currentSteps
=
(
resData
.
step_data
&&
resData
.
step_data
[
0
])
?
resData
.
step_data
[
0
].
step
:
0
;
setData
.
currentSteps
=
(
resData
.
step_data
&&
resData
.
step_data
[
0
])
?
resData
.
step_data
[
0
].
step
:
0
;
}
}
...
@@ -311,17 +311,20 @@ Page({
...
@@ -311,17 +311,20 @@ Page({
// 让canvas动起来
// 让canvas动起来
dynamicDrawCanvas
(
realCurrentSteps
,
increment
)
{
dynamicDrawCanvas
(
realCurrentSteps
,
increment
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
drawProgressCanvas
();
if
(
this
.
data
.
currentSteps
<
realCurrentSteps
-
increment
)
{
if
(
this
.
data
.
currentSteps
<
realCurrentSteps
-
increment
)
{
// 让数字动
this
.
setData
({
this
.
setData
({
currentSteps
:
this
.
data
.
currentSteps
+
increment
currentSteps
:
Math
.
floor
(
this
.
data
.
currentSteps
+
increment
)
});
});
// 画进度条
if
(
this
.
data
.
currentSteps
<=
this
.
data
.
targetSteps
)
{
this
.
drawProgressCanvas
();
}
this
.
dynamicDrawCanvas
(
realCurrentSteps
,
increment
);
this
.
dynamicDrawCanvas
(
realCurrentSteps
,
increment
);
}
else
{
}
else
{
this
.
setData
({
this
.
setData
({
currentSteps
:
realCurrentSteps
currentSteps
:
realCurrentSteps
});
});
return
;
}
}
},
10
);
},
10
);
},
},
...
@@ -330,7 +333,7 @@ Page({
...
@@ -330,7 +333,7 @@ Page({
drawProgressCanvas
()
{
drawProgressCanvas
()
{
const
rate
=
this
.
data
.
progressCanvasRate
,
const
rate
=
this
.
data
.
progressCanvasRate
,
context
=
this
.
data
.
progressCanvasContext
,
context
=
this
.
data
.
progressCanvasContext
,
currentSteps
=
this
.
data
.
currentSteps
||
0
,
currentSteps
=
(
this
.
data
.
currentSteps
>
this
.
data
.
targetSteps
?
this
.
data
.
targetSteps
:
this
.
data
.
currentSteps
)
||
0
,
targetSteps
=
this
.
data
.
targetSteps
||
1
,
targetSteps
=
this
.
data
.
targetSteps
||
1
,
progressValue
=
currentSteps
/
targetSteps
;
progressValue
=
currentSteps
/
targetSteps
;
context
.
translate
(
375
*
rate
,
255
*
rate
);
context
.
translate
(
375
*
rate
,
255
*
rate
);
...
...
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