Commit 87a8006095f583e70120a99b92fe570919f12df7
1 parent
66e1e005
转盘海报频闪问题修复
Showing
3 changed files
with
79 additions
and
20 deletions
packageB/pages/luckactivity/luckinfo/luckinfo.js
... | ... | @@ -158,11 +158,12 @@ let imgDraw = { |
158 | 158 | { //12.横线 |
159 | 159 | "type": "rect", |
160 | 160 | "css": { |
161 | - "background": "#f8f8f8", | |
162 | - "width": "554px", | |
161 | + "color": "#eee", | |
162 | + "width": "548px", | |
163 | 163 | "height": "1px", |
164 | 164 | "top": "676px", |
165 | - "left": "0px", | |
165 | + "left": "277px", | |
166 | + "align": "center", | |
166 | 167 | } |
167 | 168 | }, |
168 | 169 | { //13 |
... | ... | @@ -217,7 +218,7 @@ let imgDraw = { |
217 | 218 | |
218 | 219 | Page({ |
219 | 220 | data: { |
220 | - imgDraw: {}, | |
221 | + imgDraw: imgDraw, | |
221 | 222 | |
222 | 223 | start: false, |
223 | 224 | list: null, |
... | ... | @@ -322,7 +323,6 @@ Page({ |
322 | 323 | |
323 | 324 | |
324 | 325 | this.setData({ |
325 | - imgDraw: imgDraw, | |
326 | 326 | userInfo: app.globalData.userInfo, |
327 | 327 | isLogin: true, |
328 | 328 | 'imgDraw.views[1].text': app.globalData.userInfo.nickname,//昵称 |
... | ... | @@ -544,6 +544,7 @@ Page({ |
544 | 544 | if(res.code != -1) { |
545 | 545 | self.setData({ |
546 | 546 | 'imgDraw.views[16].url': res.path, |
547 | + getMiniCode: true, | |
547 | 548 | }); |
548 | 549 | }; |
549 | 550 | } |
... | ... | @@ -1047,7 +1048,7 @@ Page({ |
1047 | 1048 | num: --num, |
1048 | 1049 | }); |
1049 | 1050 | } |
1050 | - }, 1000); | |
1051 | + }, 500); | |
1051 | 1052 | |
1052 | 1053 | }; |
1053 | 1054 | |
... | ... | @@ -1304,20 +1305,67 @@ Page({ |
1304 | 1305 | this.showQr(); |
1305 | 1306 | }, |
1306 | 1307 | |
1308 | + | |
1309 | + | |
1307 | 1310 | showPoster() { |
1311 | + | |
1312 | + console.log('已经生成图片!!!!!!', self.data.imgPath); | |
1313 | + // console.log(Promise.resolve(this.onImgOK)); | |
1308 | 1314 | wx.showLoading({ |
1309 | 1315 | title: '生成海报中', |
1310 | 1316 | }); |
1311 | - setTimeout(function() { | |
1317 | + var timer; | |
1318 | + if(this.data.isImgOk && this.data.getMiniCode) { | |
1319 | + wx.hideLoading(); | |
1312 | 1320 | self.setData({ |
1321 | + myimg: self.data.imgPath, | |
1313 | 1322 | hiddenCanvas: true, |
1314 | 1323 | showMask: true, |
1315 | 1324 | showPoster: true, |
1316 | 1325 | }); |
1317 | - wx.hideLoading(); | |
1318 | - }, 3000) | |
1319 | - | |
1326 | + } else { | |
1327 | + timer = setInterval(function() { | |
1328 | + if(self.data.isImgOk && self.data.getMiniCode) { | |
1329 | + clearInterval(timer); | |
1330 | + wx.hideLoading(); | |
1331 | + self.setData({ | |
1332 | + myimg: self.data.imgPath, | |
1333 | + hiddenCanvas: true, | |
1334 | + showMask: true, | |
1335 | + showPoster: true, | |
1336 | + }); | |
1337 | + }; | |
1338 | + }, 1000); | |
1339 | + }; | |
1340 | + // if(this.data.isImgOk) { | |
1341 | + // setTimeout(function() { | |
1342 | + // wx.hideLoading(); | |
1343 | + // self.setData({ | |
1344 | + // myimg: self.data.imgPath, | |
1345 | + // hiddenCanvas: true, | |
1346 | + // showMask: true, | |
1347 | + // showPoster: true, | |
1348 | + // }); | |
1349 | + // }, 300); | |
1350 | + | |
1351 | + // } else { | |
1352 | + // wx.showToast({ | |
1353 | + // title: '生成失败,请重新点击', | |
1354 | + // icon: 'none', | |
1355 | + // }); | |
1356 | + // }; | |
1320 | 1357 | |
1358 | + // setTimeout(function() { | |
1359 | + // // if(self.data.myimg) { | |
1360 | + // if(self.data.imgPath) { | |
1361 | + // wx.hideLoading(); | |
1362 | + | |
1363 | + // } else { | |
1364 | + // console.log('没有生成图片!!!!!!', self.data.imgPath); | |
1365 | + // }; | |
1366 | + | |
1367 | + // // } | |
1368 | + // }, 300); | |
1321 | 1369 | }, |
1322 | 1370 | |
1323 | 1371 | closePoster() { |
... | ... | @@ -1331,9 +1379,19 @@ Page({ |
1331 | 1379 | |
1332 | 1380 | |
1333 | 1381 | onImgOK(e) { |
1334 | - this.setData({ | |
1335 | - myimg: e.detail.path, | |
1336 | - }); | |
1382 | + console.log('图片绘制成功', e.detail.path); | |
1383 | + // this.setData({ | |
1384 | + // imgPath: e.detail.path, | |
1385 | + // }); | |
1386 | + if(e&&e.detail.path) { | |
1387 | + this.setData({ | |
1388 | + isImgOk: true, | |
1389 | + imgPath: e.detail.path, | |
1390 | + }); | |
1391 | + }; | |
1392 | + | |
1337 | 1393 | }, |
1394 | + | |
1395 | + | |
1338 | 1396 | |
1339 | 1397 | }) |
1340 | 1398 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.wxml
... | ... | @@ -70,14 +70,14 @@ |
70 | 70 | <import src="../../../../utils/wxParse/wxParse.wxml"/> |
71 | 71 | <!-- <template is="wxParse" data="{{wxParseData:content.nodes}}"/> --> |
72 | 72 | <!-- 时间 --> |
73 | - <view class="bdt"> | |
73 | + <view class="brdt"> | |
74 | 74 | <!-- <view class=""> --> |
75 | 75 | <view class="txt-red">活动时间:</view> |
76 | 76 | <view class="fs28 pdv20">{{filter.format_time(luckInfo.begindate, 1) + ' 至 ' + filter.format_time(luckInfo.enddate, 1)}}</view> |
77 | 77 | <!-- </view> --> |
78 | 78 | </view> |
79 | 79 | <!-- 规则 --> |
80 | - <view class="bdt" wx:if="{{luckInfo.remark}}"> | |
80 | + <view class="brdt" wx:if="{{luckInfo.remark}}"> | |
81 | 81 | <view class="txt-red pdt20">活动说明:</view> |
82 | 82 | <view class="fs28 pdv20"><template is="wxParse" data="{{wxParseData:content.nodes}}"/></view> |
83 | 83 | </view> |
... | ... | @@ -189,9 +189,9 @@ |
189 | 189 | |
190 | 190 | |
191 | 191 | <!-- 海报 --> |
192 | - <view class="poster-container" hidden="{{!showPoster}}"> | |
192 | + <view class="poster-container" wx:if="{{showPoster}}"> | |
193 | 193 | <view class="t-r pdb20 white2"><text class="iconfont icon-close fs40" bindtap="closePoster"></text></view> |
194 | - <image src="{{myimg}}" class="poster" show-menu-by-longpress lazy-load></image> | |
194 | + <image src="{{myimg}}" class="poster" show-menu-by-longpress></image> | |
195 | 195 | <view class="pdt10 fs26 white2"><text class="iconfont icon-zhiwen"></text> 长按图片保存至相册</view> |
196 | 196 | </view> |
197 | 197 | |
... | ... | @@ -205,4 +205,4 @@ |
205 | 205 | <qrcode id="qrcode" bind:close="closeQr"></qrcode> |
206 | 206 | |
207 | 207 | |
208 | -<painter style="position: absolute; top: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/> | |
209 | 208 | \ No newline at end of file |
209 | +<painter style="position: absolute;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/> | |
210 | 210 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.wxss
... | ... | @@ -434,11 +434,12 @@ page, |
434 | 434 | color: #FFE12F; |
435 | 435 | padding: 0 10rpx; |
436 | 436 | } |
437 | -.bdt:only-child { | |
437 | +.brdt:only-of-type { | |
438 | 438 | border-top: none; |
439 | 439 | } |
440 | -.bdt ~ .bdt { | |
440 | +.brdt ~ .brdt { | |
441 | 441 | border-top: 2rpx solid #ebedf0; |
442 | + /* border-top: 2rpx solid red; */ | |
442 | 443 | } |
443 | 444 | |
444 | 445 | .poster-container { | ... | ... |