Commit a234c28643467abdb540eb3ea4300ff2dfba6f9a
1 parent
f903eda8
分享图显示bug修复
Showing
2 changed files
with
121 additions
and
115 deletions
pages/user/assistance/task_assistance.js
... | ... | @@ -4,12 +4,12 @@ var e = getApp(), |
4 | 4 | app = e, |
5 | 5 | i = require("../../../utils/util.js"), |
6 | 6 | ut = i, |
7 | - s = e.globalData.setting, | |
7 | + s = e.globalData.setting, | |
8 | 8 | os = s, |
9 | 9 | app_d = e.globalData; |
10 | 10 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
11 | 11 | Page({ |
12 | - | |
12 | + | |
13 | 13 | /** |
14 | 14 | * 页面的初始数据 |
15 | 15 | */ |
... | ... | @@ -30,8 +30,8 @@ Page({ |
30 | 30 | taskid: "", //任务id |
31 | 31 | usercount: 0, //参与的人数 |
32 | 32 | dismantle: null, //帮拆记录数据集 |
33 | - is_user_task:null,//判断是不是领取的任务 | |
34 | - zzjx_id:"",//真正进行的任务id | |
33 | + is_user_task: null, //判断是不是领取的任务 | |
34 | + zzjx_id: "", //真正进行的任务id | |
35 | 35 | //*********************************************start钱 |
36 | 36 | canvasHidden: 0, //分享图片是否已经生成 |
37 | 37 | is_share: 0, //是否显示画布 |
... | ... | @@ -47,7 +47,7 @@ Page({ |
47 | 47 | already: 0, //已有几人助力 |
48 | 48 | lack: 0, //还差几人助力 |
49 | 49 | zltime: "", //助力时间 |
50 | - djs:"",//定时器的显示 | |
50 | + djs: "", //定时器的显示 | |
51 | 51 | //*********************************************end |
52 | 52 | }, |
53 | 53 | |
... | ... | @@ -133,11 +133,11 @@ Page({ |
133 | 133 | th.setData({ |
134 | 134 | endDate: help_data.endDate, |
135 | 135 | }); |
136 | - | |
137 | - //任务时间 设置全局定时器 | |
138 | - th.data.timer = setInterval(function() { | |
139 | - th.countDown(); | |
140 | - }, 1000); | |
136 | + | |
137 | + //任务时间 设置全局定时器 | |
138 | + th.data.timer = setInterval(function() { | |
139 | + th.countDown(); | |
140 | + }, 1000); | |
141 | 141 | |
142 | 142 | } |
143 | 143 | } |
... | ... | @@ -186,17 +186,17 @@ Page({ |
186 | 186 | |
187 | 187 | } |
188 | 188 | }) |
189 | - | |
189 | + | |
190 | 190 | // 分享的 |
191 | 191 | // setTimeout(function() { |
192 | 192 | // th.shareFrends(); |
193 | 193 | // }, 1000) |
194 | - | |
194 | + | |
195 | 195 | //会员任务列表 |
196 | 196 | this.user_task_list(); |
197 | 197 | // 获取会员的参与的任务列表 我的任务 |
198 | 198 | this.get_user_task_num(); |
199 | - | |
199 | + | |
200 | 200 | }, |
201 | 201 | |
202 | 202 | |
... | ... | @@ -214,18 +214,18 @@ Page({ |
214 | 214 | var th = this; |
215 | 215 | var index = 1; //获取当前选择的是任务还是活动说明 |
216 | 216 | var is_task = this.data.is_task; //0任务,1帮拆 |
217 | - if (is_task == undefined || is_task==null){ | |
218 | - is_task=1; | |
217 | + if (is_task == undefined || is_task == null) { | |
218 | + is_task = 1; | |
219 | 219 | } |
220 | - var switch_head=this.data.switch_head; | |
221 | - if (switch_head == undefined || switch_head== null){ | |
222 | - switch_head=1; | |
220 | + var switch_head = this.data.switch_head; | |
221 | + if (switch_head == undefined || switch_head == null) { | |
222 | + switch_head = 1; | |
223 | 223 | } |
224 | - | |
224 | + | |
225 | 225 | console.log("0任务,1帮拆", is_task, ); |
226 | 226 | this.setData({ |
227 | 227 | is_task: 1, |
228 | - switch_head:1 | |
228 | + switch_head: 1 | |
229 | 229 | }); |
230 | 230 | rq.get("/api/weshop/marketing/help/help/task/involve/page", { |
231 | 231 | data: { |
... | ... | @@ -237,14 +237,14 @@ Page({ |
237 | 237 | |
238 | 238 | if (res.data.code == 0) { |
239 | 239 | var dismantle = res.data.data.pageData[0].zlHelpUser; |
240 | - console.log(dismantle.toString, "帮拆记录",dismantle[0].nickName); | |
241 | - | |
240 | + console.log(dismantle.toString, "帮拆记录", dismantle[0].nickName); | |
241 | + | |
242 | 242 | th.setData({ |
243 | 243 | dismantle: dismantle |
244 | 244 | }); |
245 | - }else{ | |
245 | + } else { | |
246 | 246 | th.setData({ |
247 | - dismantle:null | |
247 | + dismantle: null | |
248 | 248 | }); |
249 | 249 | } |
250 | 250 | } |
... | ... | @@ -252,14 +252,14 @@ Page({ |
252 | 252 | }) |
253 | 253 | }, |
254 | 254 | // 领取礼包 |
255 | - get_libao: function (e) { | |
255 | + get_libao: function(e) { | |
256 | 256 | var libao_id = e.currentTarget.dataset.libaoid; |
257 | 257 | var completeid = e.currentTarget.dataset.completeid; |
258 | 258 | console.log("礼包id", libao_id); |
259 | 259 | getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); |
260 | 260 | }, |
261 | 261 | //查看礼包id |
262 | - select_libao: function () { | |
262 | + select_libao: function() { | |
263 | 263 | var libao_id = e.currentTarget.dataset.libaoid; |
264 | 264 | getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0); |
265 | 265 | }, |
... | ... | @@ -272,14 +272,14 @@ Page({ |
272 | 272 | var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; |
273 | 273 | var task_id = aitem[ind].id; |
274 | 274 | console.log("划动的任务总数", task_number, "任务所有的参数", aitem, |
275 | - "任务id",task_id); | |
275 | + "任务id", task_id); | |
276 | 276 | th.setData({ |
277 | 277 | sw_index: ind, |
278 | 278 | task_number: task_number, |
279 | 279 | taskid: task_id |
280 | 280 | }); |
281 | - | |
282 | - if (this.data.switch_head==1){ | |
281 | + | |
282 | + if (this.data.switch_head == 1) { | |
283 | 283 | //判断有没有帮拆记录 |
284 | 284 | this.dismantle_record(); |
285 | 285 | } |
... | ... | @@ -296,13 +296,13 @@ Page({ |
296 | 296 | }, |
297 | 297 | // 获取会员的参与的任务列表 我的任务 |
298 | 298 | user_task_list: function(e) { |
299 | - | |
299 | + | |
300 | 300 | var th = this; |
301 | - | |
301 | + | |
302 | 302 | var index = 0; |
303 | 303 | var is_task = this.data.is_task; //0任务,1帮拆 |
304 | - if (is_task == undefined || is_task==null){ | |
305 | - is_task=0; | |
304 | + if (is_task == undefined || is_task == null) { | |
305 | + is_task = 0; | |
306 | 306 | } |
307 | 307 | var switch_head = this.data.switch_head; |
308 | 308 | if (switch_head == undefined || switch_head == null) { |
... | ... | @@ -321,7 +321,7 @@ Page({ |
321 | 321 | userId: user_id |
322 | 322 | }, |
323 | 323 | success: function(su) { |
324 | - | |
324 | + | |
325 | 325 | if (su.data.code == 0) { |
326 | 326 | var user_list = su.data.data.pageData; |
327 | 327 | console.log("会员列表", user_list); |
... | ... | @@ -337,31 +337,33 @@ Page({ |
337 | 337 | }) |
338 | 338 | }, |
339 | 339 | //判断是否有领取任务 获取正在进行中的任务 |
340 | - get_user_task:function(){ | |
340 | + get_user_task: function() { | |
341 | 341 | var user_id = getApp().globalData.user_id; |
342 | - var th=this; | |
343 | - var aitem= th.data.aitem; | |
344 | - var sw_index=th.data.sw_index; | |
345 | - console.log(sw_index,"判断是否有领取任务", aitem); | |
342 | + var th = this; | |
343 | + var aitem = th.data.aitem; | |
344 | + var sw_index = th.data.sw_index; | |
345 | + console.log(sw_index, "判断是否有领取任务", aitem); | |
346 | 346 | var taskid = aitem[sw_index].id |
347 | 347 | console.log("判断是否有领取任务 任务的id", taskid); |
348 | - rq.get("/api/weshop/marketing/help/help/task/get",{ | |
349 | - data:{ | |
348 | + rq.get("/api/weshop/marketing/help/help/task/get", { | |
349 | + data: { | |
350 | 350 | storeId: os.stoid, |
351 | 351 | userId: user_id, |
352 | - taskId: taskid | |
352 | + taskId: taskid | |
353 | 353 | }, |
354 | - success: function (res) { | |
355 | - if (res.data.code==0){ | |
356 | - var is_usertask=res.data.data; | |
354 | + success: function(res) { | |
355 | + if (res.data.code == 0) { | |
356 | + var is_usertask = res.data.data; | |
357 | 357 | console.log('判断是不是领取的任务', is_usertask); |
358 | - th.setData({is_user_task: is_usertask}); | |
359 | - } | |
358 | + th.setData({ | |
359 | + is_user_task: is_usertask | |
360 | + }); | |
361 | + } | |
360 | 362 | } |
361 | 363 | }) |
362 | 364 | }, |
363 | 365 | //获取助力活动参与的人数 |
364 | - get_user_task_num:function(){ | |
366 | + get_user_task_num: function() { | |
365 | 367 | var th = this; |
366 | 368 | var help_id = th.data.help_id; |
367 | 369 | rq.get("/api/weshop/marketing/help/involve/help/act/people/count", { |
... | ... | @@ -377,7 +379,7 @@ Page({ |
377 | 379 | th.setData({ |
378 | 380 | usercount: usercount |
379 | 381 | }); |
380 | - } | |
382 | + } | |
381 | 383 | } |
382 | 384 | }) |
383 | 385 | |
... | ... | @@ -483,47 +485,47 @@ Page({ |
483 | 485 | var th = this; |
484 | 486 | // 获取当前时间,同时得到活动结束时间数组 |
485 | 487 | var newTime = ut.gettimestamp(); |
486 | - | |
487 | - // 对结束时间进行处理渲染到页面 | |
488 | - | |
489 | - // var o = endTimeList[i]; | |
490 | - var endTime = th.data.endDate | |
491 | - | |
492 | - // if (o.status == 0) endTime = o.start_time | |
493 | - | |
494 | - var obj = null; | |
495 | - // 如果活动未结束,对时间进行处理 | |
496 | - if (endTime - newTime > 0) { | |
497 | - | |
498 | - var time = (endTime - newTime); | |
499 | - // 获取天、时、分、秒 | |
500 | - var day = parseInt(time / (60 * 60 * 24)); | |
501 | - var hou = parseInt(time % (60 * 60 * 24) / 3600); | |
502 | - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
503 | - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
504 | - obj = { | |
505 | - day: this.timeFormat(day), | |
506 | - hou: this.timeFormat(hou), | |
507 | - min: this.timeFormat(min), | |
508 | - sec: this.timeFormat(sec) | |
509 | - } | |
510 | - } else { | |
511 | - //活动已结束,全部设置为'00' | |
512 | - obj = { | |
513 | - day: '00', | |
514 | - hou: '00', | |
515 | - min: '00', | |
516 | - sec: '00' | |
517 | - } | |
488 | + | |
489 | + // 对结束时间进行处理渲染到页面 | |
490 | + | |
491 | + // var o = endTimeList[i]; | |
492 | + var endTime = th.data.endDate | |
493 | + | |
494 | + // if (o.status == 0) endTime = o.start_time | |
495 | + | |
496 | + var obj = null; | |
497 | + // 如果活动未结束,对时间进行处理 | |
498 | + if (endTime - newTime > 0) { | |
499 | + | |
500 | + var time = (endTime - newTime); | |
501 | + // 获取天、时、分、秒 | |
502 | + var day = parseInt(time / (60 * 60 * 24)); | |
503 | + var hou = parseInt(time % (60 * 60 * 24) / 3600); | |
504 | + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
505 | + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
506 | + obj = { | |
507 | + day: this.timeFormat(day), | |
508 | + hou: this.timeFormat(hou), | |
509 | + min: this.timeFormat(min), | |
510 | + sec: this.timeFormat(sec) | |
518 | 511 | } |
519 | - | |
520 | - th.setData({ | |
521 | - djs: obj | |
522 | - }); | |
512 | + } else { | |
513 | + //活动已结束,全部设置为'00' | |
514 | + obj = { | |
515 | + day: '00', | |
516 | + hou: '00', | |
517 | + min: '00', | |
518 | + sec: '00' | |
519 | + } | |
520 | + } | |
521 | + | |
522 | + th.setData({ | |
523 | + djs: obj | |
524 | + }); | |
525 | + | |
526 | + | |
523 | 527 | |
524 | 528 | |
525 | - | |
526 | - | |
527 | 529 | |
528 | 530 | }, |
529 | 531 | //---小于10的格式化函数---- |
... | ... | @@ -544,7 +546,7 @@ Page({ |
544 | 546 | onShareAppMessage: function() { |
545 | 547 | |
546 | 548 | }, |
547 | - | |
549 | + | |
548 | 550 | preview: function() { |
549 | 551 | var th = this; |
550 | 552 | var shareImgPath = th.data.shareImgPath; |
... | ... | @@ -723,8 +725,8 @@ Page({ |
723 | 725 | var c = q_num / num; |
724 | 726 | ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit); |
725 | 727 | ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); |
726 | - // var dynamic = th.data.dynamic; //助力的微信头像 | |
727 | - // console.log(dynamic[0].headPic + "动态图片显示"); | |
728 | + // var dynamic = th.data.dynamic; //助力的微信头像 | |
729 | + // console.log(dynamic[0].headPic + "动态图片显示"); | |
728 | 730 | for (var i = 0; i < 6; i++) { |
729 | 731 | if (i < 0) { |
730 | 732 | // ctx.beginPath(); |
... | ... | @@ -908,16 +910,19 @@ Page({ |
908 | 910 | }) |
909 | 911 | |
910 | 912 | }, |
911 | -//好友猜一猜 | |
912 | - save_share: function (e) { | |
913 | - var aitem = this.data.aitem; //任务的数据集 | |
914 | - var sw_index = this.data.sw_index; //轮播的下标 | |
913 | + //好友猜一猜 | |
914 | + save_share: function(e) { | |
915 | + var th = this; | |
916 | + var aitem = this.data.aitem; //任务的数据集 | |
917 | + var sw_index = this.data.sw_index; //轮播的下标 | |
915 | 918 | //任务id |
916 | 919 | var taskid = aitem[sw_index].id |
917 | - console.log("好友猜一猜的任务id", taskid); | |
918 | - var th = this; | |
920 | + th.setData({ | |
921 | + is_share: 1 | |
922 | + }) | |
919 | 923 | var url = "/api/weshop/marketing/help/help/task/involve/page"; |
920 | 924 | getApp().request.promiseGet(url, { |
925 | + isShowLoading: true, | |
921 | 926 | data: { |
922 | 927 | storeId: os.stoid, |
923 | 928 | taskId: taskid, |
... | ... | @@ -930,11 +935,11 @@ Page({ |
930 | 935 | // th.setData({ |
931 | 936 | // dynamic: data |
932 | 937 | // }) |
933 | - // th.info_head(); | |
934 | - //th.imageinfo(); | |
935 | - setTimeout(function () { | |
938 | + // th.info_head(function() { | |
936 | 939 | th.shareFrends(); |
937 | - }, 500) | |
940 | + // }); | |
941 | + //th.imageinfo(); | |
942 | + | |
938 | 943 | } |
939 | 944 | } else { |
940 | 945 | wx.hideLoading(); |
... | ... | @@ -943,18 +948,18 @@ Page({ |
943 | 948 | }) |
944 | 949 | }, |
945 | 950 | //把已助力好友头像下载到本地 |
946 | - info_head: function (e) { | |
951 | + info_head: function(e) { | |
947 | 952 | var th = this; |
948 | 953 | var images = th.data.dynamic; |
949 | 954 | if (images[0] != null && images[0] != "" && images[0] != undefined) { |
950 | 955 | console.log(images[0].headPic + "就将计就计"); |
951 | 956 | wx.getImageInfo({ |
952 | 957 | src: images[0].headPic, |
953 | - success: function (res) { | |
958 | + success: function(res) { | |
954 | 959 | //res.path是网络图片的本地地址 |
955 | 960 | images[0].headPic = res.path; |
956 | 961 | }, |
957 | - fail: function (res) { | |
962 | + fail: function(res) { | |
958 | 963 | |
959 | 964 | } |
960 | 965 | }); |
... | ... | @@ -962,11 +967,11 @@ Page({ |
962 | 967 | if (images[1] != null && images[1] != "" && images[1] != undefined) { |
963 | 968 | wx.getImageInfo({ |
964 | 969 | src: images[1].headPic, |
965 | - success: function (res) { | |
970 | + success: function(res) { | |
966 | 971 | //res.path是网络图片的本地地址 |
967 | 972 | images[1].headPic = res.path; |
968 | 973 | }, |
969 | - fail: function (res) { | |
974 | + fail: function(res) { | |
970 | 975 | |
971 | 976 | } |
972 | 977 | }); |
... | ... | @@ -974,11 +979,11 @@ Page({ |
974 | 979 | if (images[2] != null && images[2] != "" && images[2] != undefined) { |
975 | 980 | wx.getImageInfo({ |
976 | 981 | src: images[2].headPic, |
977 | - success: function (res) { | |
982 | + success: function(res) { | |
978 | 983 | //res.path是网络图片的本地地址 |
979 | 984 | images[2].headPic = res.path; |
980 | 985 | }, |
981 | - fail: function (res) { | |
986 | + fail: function(res) { | |
982 | 987 | |
983 | 988 | } |
984 | 989 | }); |
... | ... | @@ -986,11 +991,11 @@ Page({ |
986 | 991 | if (images[3] != null && images[3] != "" && images[3] != undefined) { |
987 | 992 | wx.getImageInfo({ |
988 | 993 | src: images[3].headPic, |
989 | - success: function (res) { | |
994 | + success: function(res) { | |
990 | 995 | //res.path是网络图片的本地地址 |
991 | 996 | images[3].headPic = res.path; |
992 | 997 | }, |
993 | - fail: function (res) { | |
998 | + fail: function(res) { | |
994 | 999 | |
995 | 1000 | } |
996 | 1001 | }); |
... | ... | @@ -1022,15 +1027,16 @@ Page({ |
1022 | 1027 | th.setData({ |
1023 | 1028 | dynamic: images |
1024 | 1029 | }) |
1030 | + | |
1025 | 1031 | }, |
1026 | 1032 | //礼包的详情 轮播图 |
1027 | - libao_details:function(e){ | |
1028 | - var giftbagid=e.currentTarget.dataset.giftbagid; | |
1029 | - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" +giftbagid + "&is_libao=" + 0); | |
1033 | + libao_details: function(e) { | |
1034 | + var giftbagid = e.currentTarget.dataset.giftbagid; | |
1035 | + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + giftbagid + "&is_libao=" + 0); | |
1030 | 1036 | }, |
1031 | 1037 | //正在进行任务 |
1032 | - test: function (e) { | |
1033 | - getApp().goto("/pages/user/assistance/friend_assistance?tasking=13"); | |
1038 | + test: function(e) { | |
1039 | + getApp().goto("/pages/user/assistance/friend_assistance?tasking=13"); | |
1034 | 1040 | }, |
1035 | 1041 | |
1036 | 1042 | }) |
1037 | 1043 | \ No newline at end of file | ... | ... |