Commit a234c28643467abdb540eb3ea4300ff2dfba6f9a

Authored by iceling
1 parent f903eda8

分享图显示bug修复

pages/user/assistance/task_assistance.js
@@ -4,12 +4,12 @@ var e = getApp(), @@ -4,12 +4,12 @@ var e = getApp(),
4 app = e, 4 app = e,
5 i = require("../../../utils/util.js"), 5 i = require("../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = e.globalData.setting, 7 + s = e.globalData.setting,
8 os = s, 8 os = s,
9 app_d = e.globalData; 9 app_d = e.globalData;
10 var regeneratorRuntime = require('../../../utils/runtime.js'); 10 var regeneratorRuntime = require('../../../utils/runtime.js');
11 Page({ 11 Page({
12 - 12 +
13 /** 13 /**
14 * 页面的初始数据 14 * 页面的初始数据
15 */ 15 */
@@ -30,8 +30,8 @@ Page({ @@ -30,8 +30,8 @@ Page({
30 taskid: "", //任务id 30 taskid: "", //任务id
31 usercount: 0, //参与的人数 31 usercount: 0, //参与的人数
32 dismantle: null, //帮拆记录数据集 32 dismantle: null, //帮拆记录数据集
33 - is_user_task:null,//判断是不是领取的任务  
34 - zzjx_id:"",//真正进行的任务id 33 + is_user_task: null, //判断是不是领取的任务
  34 + zzjx_id: "", //真正进行的任务id
35 //*********************************************start钱 35 //*********************************************start钱
36 canvasHidden: 0, //分享图片是否已经生成 36 canvasHidden: 0, //分享图片是否已经生成
37 is_share: 0, //是否显示画布 37 is_share: 0, //是否显示画布
@@ -47,7 +47,7 @@ Page({ @@ -47,7 +47,7 @@ Page({
47 already: 0, //已有几人助力 47 already: 0, //已有几人助力
48 lack: 0, //还差几人助力 48 lack: 0, //还差几人助力
49 zltime: "", //助力时间 49 zltime: "", //助力时间
50 - djs:"",//定时器的显示 50 + djs: "", //定时器的显示
51 //*********************************************end 51 //*********************************************end
52 }, 52 },
53 53
@@ -133,11 +133,11 @@ Page({ @@ -133,11 +133,11 @@ Page({
133 th.setData({ 133 th.setData({
134 endDate: help_data.endDate, 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,17 +186,17 @@ Page({
186 186
187 } 187 }
188 }) 188 })
189 - 189 +
190 // 分享的 190 // 分享的
191 // setTimeout(function() { 191 // setTimeout(function() {
192 // th.shareFrends(); 192 // th.shareFrends();
193 // }, 1000) 193 // }, 1000)
194 - 194 +
195 //会员任务列表 195 //会员任务列表
196 this.user_task_list(); 196 this.user_task_list();
197 // 获取会员的参与的任务列表 我的任务 197 // 获取会员的参与的任务列表 我的任务
198 this.get_user_task_num(); 198 this.get_user_task_num();
199 - 199 +
200 }, 200 },
201 201
202 202
@@ -214,18 +214,18 @@ Page({ @@ -214,18 +214,18 @@ Page({
214 var th = this; 214 var th = this;
215 var index = 1; //获取当前选择的是任务还是活动说明 215 var index = 1; //获取当前选择的是任务还是活动说明
216 var is_task = this.data.is_task; //0任务,1帮拆 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 console.log("0任务,1帮拆", is_task, ); 225 console.log("0任务,1帮拆", is_task, );
226 this.setData({ 226 this.setData({
227 is_task: 1, 227 is_task: 1,
228 - switch_head:1 228 + switch_head: 1
229 }); 229 });
230 rq.get("/api/weshop/marketing/help/help/task/involve/page", { 230 rq.get("/api/weshop/marketing/help/help/task/involve/page", {
231 data: { 231 data: {
@@ -237,14 +237,14 @@ Page({ @@ -237,14 +237,14 @@ Page({
237 237
238 if (res.data.code == 0) { 238 if (res.data.code == 0) {
239 var dismantle = res.data.data.pageData[0].zlHelpUser; 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 th.setData({ 242 th.setData({
243 dismantle: dismantle 243 dismantle: dismantle
244 }); 244 });
245 - }else{ 245 + } else {
246 th.setData({ 246 th.setData({
247 - dismantle:null 247 + dismantle: null
248 }); 248 });
249 } 249 }
250 } 250 }
@@ -252,14 +252,14 @@ Page({ @@ -252,14 +252,14 @@ Page({
252 }) 252 })
253 }, 253 },
254 // 领取礼包 254 // 领取礼包
255 - get_libao: function (e) { 255 + get_libao: function(e) {
256 var libao_id = e.currentTarget.dataset.libaoid; 256 var libao_id = e.currentTarget.dataset.libaoid;
257 var completeid = e.currentTarget.dataset.completeid; 257 var completeid = e.currentTarget.dataset.completeid;
258 console.log("礼包id", libao_id); 258 console.log("礼包id", libao_id);
259 getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); 259 getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid);
260 }, 260 },
261 //查看礼包id 261 //查看礼包id
262 - select_libao: function () { 262 + select_libao: function() {
263 var libao_id = e.currentTarget.dataset.libaoid; 263 var libao_id = e.currentTarget.dataset.libaoid;
264 getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0); 264 getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0);
265 }, 265 },
@@ -272,14 +272,14 @@ Page({ @@ -272,14 +272,14 @@ Page({
272 var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; 272 var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty;
273 var task_id = aitem[ind].id; 273 var task_id = aitem[ind].id;
274 console.log("划动的任务总数", task_number, "任务所有的参数", aitem, 274 console.log("划动的任务总数", task_number, "任务所有的参数", aitem,
275 - "任务id",task_id); 275 + "任务id", task_id);
276 th.setData({ 276 th.setData({
277 sw_index: ind, 277 sw_index: ind,
278 task_number: task_number, 278 task_number: task_number,
279 taskid: task_id 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 this.dismantle_record(); 284 this.dismantle_record();
285 } 285 }
@@ -296,13 +296,13 @@ Page({ @@ -296,13 +296,13 @@ Page({
296 }, 296 },
297 // 获取会员的参与的任务列表 我的任务 297 // 获取会员的参与的任务列表 我的任务
298 user_task_list: function(e) { 298 user_task_list: function(e) {
299 - 299 +
300 var th = this; 300 var th = this;
301 - 301 +
302 var index = 0; 302 var index = 0;
303 var is_task = this.data.is_task; //0任务,1帮拆 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 var switch_head = this.data.switch_head; 307 var switch_head = this.data.switch_head;
308 if (switch_head == undefined || switch_head == null) { 308 if (switch_head == undefined || switch_head == null) {
@@ -321,7 +321,7 @@ Page({ @@ -321,7 +321,7 @@ Page({
321 userId: user_id 321 userId: user_id
322 }, 322 },
323 success: function(su) { 323 success: function(su) {
324 - 324 +
325 if (su.data.code == 0) { 325 if (su.data.code == 0) {
326 var user_list = su.data.data.pageData; 326 var user_list = su.data.data.pageData;
327 console.log("会员列表", user_list); 327 console.log("会员列表", user_list);
@@ -337,31 +337,33 @@ Page({ @@ -337,31 +337,33 @@ Page({
337 }) 337 })
338 }, 338 },
339 //判断是否有领取任务 获取正在进行中的任务 339 //判断是否有领取任务 获取正在进行中的任务
340 - get_user_task:function(){ 340 + get_user_task: function() {
341 var user_id = getApp().globalData.user_id; 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 var taskid = aitem[sw_index].id 346 var taskid = aitem[sw_index].id
347 console.log("判断是否有领取任务 任务的id", taskid); 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 storeId: os.stoid, 350 storeId: os.stoid,
351 userId: user_id, 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 console.log('判断是不是领取的任务', is_usertask); 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 var th = this; 367 var th = this;
366 var help_id = th.data.help_id; 368 var help_id = th.data.help_id;
367 rq.get("/api/weshop/marketing/help/involve/help/act/people/count", { 369 rq.get("/api/weshop/marketing/help/involve/help/act/people/count", {
@@ -377,7 +379,7 @@ Page({ @@ -377,7 +379,7 @@ Page({
377 th.setData({ 379 th.setData({
378 usercount: usercount 380 usercount: usercount
379 }); 381 });
380 - } 382 + }
381 } 383 }
382 }) 384 })
383 385
@@ -483,47 +485,47 @@ Page({ @@ -483,47 +485,47 @@ Page({
483 var th = this; 485 var th = this;
484 // 获取当前时间,同时得到活动结束时间数组 486 // 获取当前时间,同时得到活动结束时间数组
485 var newTime = ut.gettimestamp(); 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 //---小于10的格式化函数---- 531 //---小于10的格式化函数----
@@ -544,7 +546,7 @@ Page({ @@ -544,7 +546,7 @@ Page({
544 onShareAppMessage: function() { 546 onShareAppMessage: function() {
545 547
546 }, 548 },
547 - 549 +
548 preview: function() { 550 preview: function() {
549 var th = this; 551 var th = this;
550 var shareImgPath = th.data.shareImgPath; 552 var shareImgPath = th.data.shareImgPath;
@@ -723,8 +725,8 @@ Page({ @@ -723,8 +725,8 @@ Page({
723 var c = q_num / num; 725 var c = q_num / num;
724 ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit); 726 ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit);
725 ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); 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 for (var i = 0; i < 6; i++) { 730 for (var i = 0; i < 6; i++) {
729 if (i < 0) { 731 if (i < 0) {
730 // ctx.beginPath(); 732 // ctx.beginPath();
@@ -908,16 +910,19 @@ Page({ @@ -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 //任务id 918 //任务id
916 var taskid = aitem[sw_index].id 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 var url = "/api/weshop/marketing/help/help/task/involve/page"; 923 var url = "/api/weshop/marketing/help/help/task/involve/page";
920 getApp().request.promiseGet(url, { 924 getApp().request.promiseGet(url, {
  925 + isShowLoading: true,
921 data: { 926 data: {
922 storeId: os.stoid, 927 storeId: os.stoid,
923 taskId: taskid, 928 taskId: taskid,
@@ -930,11 +935,11 @@ Page({ @@ -930,11 +935,11 @@ Page({
930 // th.setData({ 935 // th.setData({
931 // dynamic: data 936 // dynamic: data
932 // }) 937 // })
933 - // th.info_head();  
934 - //th.imageinfo();  
935 - setTimeout(function () { 938 + // th.info_head(function() {
936 th.shareFrends(); 939 th.shareFrends();
937 - }, 500) 940 + // });
  941 + //th.imageinfo();
  942 +
938 } 943 }
939 } else { 944 } else {
940 wx.hideLoading(); 945 wx.hideLoading();
@@ -943,18 +948,18 @@ Page({ @@ -943,18 +948,18 @@ Page({
943 }) 948 })
944 }, 949 },
945 //把已助力好友头像下载到本地 950 //把已助力好友头像下载到本地
946 - info_head: function (e) { 951 + info_head: function(e) {
947 var th = this; 952 var th = this;
948 var images = th.data.dynamic; 953 var images = th.data.dynamic;
949 if (images[0] != null && images[0] != "" && images[0] != undefined) { 954 if (images[0] != null && images[0] != "" && images[0] != undefined) {
950 console.log(images[0].headPic + "就将计就计"); 955 console.log(images[0].headPic + "就将计就计");
951 wx.getImageInfo({ 956 wx.getImageInfo({
952 src: images[0].headPic, 957 src: images[0].headPic,
953 - success: function (res) { 958 + success: function(res) {
954 //res.path是网络图片的本地地址 959 //res.path是网络图片的本地地址
955 images[0].headPic = res.path; 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,11 +967,11 @@ Page({
962 if (images[1] != null && images[1] != "" && images[1] != undefined) { 967 if (images[1] != null && images[1] != "" && images[1] != undefined) {
963 wx.getImageInfo({ 968 wx.getImageInfo({
964 src: images[1].headPic, 969 src: images[1].headPic,
965 - success: function (res) { 970 + success: function(res) {
966 //res.path是网络图片的本地地址 971 //res.path是网络图片的本地地址
967 images[1].headPic = res.path; 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,11 +979,11 @@ Page({
974 if (images[2] != null && images[2] != "" && images[2] != undefined) { 979 if (images[2] != null && images[2] != "" && images[2] != undefined) {
975 wx.getImageInfo({ 980 wx.getImageInfo({
976 src: images[2].headPic, 981 src: images[2].headPic,
977 - success: function (res) { 982 + success: function(res) {
978 //res.path是网络图片的本地地址 983 //res.path是网络图片的本地地址
979 images[2].headPic = res.path; 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,11 +991,11 @@ Page({
986 if (images[3] != null && images[3] != "" && images[3] != undefined) { 991 if (images[3] != null && images[3] != "" && images[3] != undefined) {
987 wx.getImageInfo({ 992 wx.getImageInfo({
988 src: images[3].headPic, 993 src: images[3].headPic,
989 - success: function (res) { 994 + success: function(res) {
990 //res.path是网络图片的本地地址 995 //res.path是网络图片的本地地址
991 images[3].headPic = res.path; 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,15 +1027,16 @@ Page({
1022 th.setData({ 1027 th.setData({
1023 dynamic: images 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 \ No newline at end of file 1043 \ No newline at end of file
pages/user/assistance/task_assistance.wxss
@@ -188,7 +188,7 @@ border-color: #fff; @@ -188,7 +188,7 @@ border-color: #fff;
188 188
189 .canvas { 189 .canvas {
190 position: fixed; 190 position: fixed;
191 - z-index: 11; 191 + z-index: 20;
192 width: 100%; 192 width: 100%;
193 top:20rpx; 193 top:20rpx;
194 } 194 }