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
c7306330
Commit
c7306330
authored
Apr 16, 2019
by
穆启卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
canvas和image切换法解决canvas真机层级问题
parent
91a97b7b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
index.js
pages/index/index.js
+31
-4
index.wxml
pages/index/index.wxml
+3
-2
No files found.
pages/index/index.js
View file @
c7306330
...
@@ -16,6 +16,7 @@ Page({
...
@@ -16,6 +16,7 @@ Page({
scene
:
1001
,
scene
:
1001
,
progressCanvasContext
:
''
,
progressCanvasContext
:
''
,
progressCanvasRate
:
''
,
progressCanvasRate
:
''
,
progressCanvasImage
:
''
,
},
},
onShow
()
{
onShow
()
{
...
@@ -65,7 +66,20 @@ Page({
...
@@ -65,7 +66,20 @@ Page({
context
.
arc
(
-
245
*
rate
,
0
,
7
*
rate
,
0
,
2
*
Math
.
PI
,
false
);
context
.
arc
(
-
245
*
rate
,
0
,
7
*
rate
,
0
,
2
*
Math
.
PI
,
false
);
context
.
fill
();
context
.
fill
();
// 画
// 画
context
.
draw
();
context
.
draw
(
false
,
drawRes
=>
{
if
(
drawRes
.
errMsg
===
'drawCanvas:ok'
)
{
wx
.
canvasToTempFilePath
({
canvasId
:
'progressCanvas'
,
success
:(
ImageRes
)
=>
{
this
.
setData
({
progressCanvasImage
:
ImageRes
.
tempFilePath
});
}
});
}
else
{
// 重画
}
});
},
},
getPageData
()
{
getPageData
()
{
...
@@ -277,9 +291,10 @@ Page({
...
@@ -277,9 +291,10 @@ Page({
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
;
}
}
this
.
setData
(
setData
);
this
.
setData
(
setData
);
wx
.
hideLoading
();
this
.
showToast
();
this
.
showToast
();
},
},
complete
:
()
=>
{
fail
:
()
=>
{
wx
.
hideLoading
();
wx
.
hideLoading
();
}
}
});
});
...
@@ -364,7 +379,20 @@ Page({
...
@@ -364,7 +379,20 @@ Page({
context
.
arc
(
-
245
*
rate
,
0
,
7
*
rate
,
0
,
2
*
Math
.
PI
,
false
);
context
.
arc
(
-
245
*
rate
,
0
,
7
*
rate
,
0
,
2
*
Math
.
PI
,
false
);
context
.
fill
();
context
.
fill
();
// 画
// 画
context
.
draw
();
context
.
draw
(
false
,
drawRes
=>
{
if
(
drawRes
.
errMsg
===
'drawCanvas:ok'
)
{
wx
.
canvasToTempFilePath
({
canvasId
:
'progressCanvas'
,
success
:(
ImageRes
)
=>
{
this
.
setData
({
progressCanvasImage
:
ImageRes
.
tempFilePath
});
}
});
}
else
{
this
.
drawProgressCanvas
();
}
});
},
},
// 获取微信步数失败处理,包括未授权、设备不支持等
// 获取微信步数失败处理,包括未授权、设备不支持等
...
@@ -501,7 +529,6 @@ Page({
...
@@ -501,7 +529,6 @@ Page({
});
});
},
},
// 暂留==================================================================
// 暂留==================================================================
// 通过code2session方式拿unionid
// 通过code2session方式拿unionid
...
...
pages/index/index.wxml
View file @
c7306330
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
<view>说明</view>
<view>说明</view>
</view>
</view>
<view class="today-step-info" bindtap="clickStepData">
<view class="today-step-info" bindtap="clickStepData">
<canvas class="progress-canvas" canvas-id="progressCanvas"></canvas>
<image class="progress-canvas" src="{{progressCanvasImage}}" wx:if="{{activityExplainShow || showGetUserInfo}}"></image>
<canvas class="progress-canvas" canvas-id="progressCanvas" hidden="{{activityExplainShow || showGetUserInfo}}"></canvas>
<block wx:if="{{stepAuth}}">
<block wx:if="{{stepAuth}}">
<view class="info-title">今日步数</view>
<view class="info-title">今日步数</view>
<view class="today-step-num">{{currentSteps}}</view>
<view class="today-step-num">{{currentSteps}}</view>
...
@@ -35,7 +36,7 @@
...
@@ -35,7 +36,7 @@
</view>
</view>
</view>
</view>
<!-- 活动说明弹窗 -->
<!-- 活动说明弹窗 -->
<view class="activity-explain-popup-bg" wx:if="{{activityExplainShow}}">
<view class="activity-explain-popup-bg"
catchtouchmove
wx:if="{{activityExplainShow}}">
<view class="activity-explain-popup-container">
<view class="activity-explain-popup-container">
<view class="popup-title">活动说明</view>
<view class="popup-title">活动说明</view>
<view class="popup-explain">本小程序仅用于记录您的步数明细数据,获取步数数据成功后,返回报名页面,即打卡成功</view>
<view class="popup-explain">本小程序仅用于记录您的步数明细数据,获取步数数据成功后,返回报名页面,即打卡成功</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