From a234c28643467abdb540eb3ea4300ff2dfba6f9a Mon Sep 17 00:00:00 2001 From: iceling Date: Wed, 15 Jan 2020 16:16:22 +0800 Subject: [PATCH] 分享图显示bug修复 --- pages/user/assistance/task_assistance.js | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------ pages/user/assistance/task_assistance.wxss | 2 +- 2 files changed, 121 insertions(+), 115 deletions(-) diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index cad915c..29990ac 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -4,12 +4,12 @@ var e = getApp(), app = e, i = require("../../../utils/util.js"), ut = i, - s = e.globalData.setting, + s = e.globalData.setting, os = s, app_d = e.globalData; var regeneratorRuntime = require('../../../utils/runtime.js'); Page({ - + /** * 页面的初始数据 */ @@ -30,8 +30,8 @@ Page({ taskid: "", //任务id usercount: 0, //参与的人数 dismantle: null, //帮拆记录数据集 - is_user_task:null,//判断是不是领取的任务 - zzjx_id:"",//真正进行的任务id + is_user_task: null, //判断是不是领取的任务 + zzjx_id: "", //真正进行的任务id //*********************************************start钱 canvasHidden: 0, //分享图片是否已经生成 is_share: 0, //是否显示画布 @@ -47,7 +47,7 @@ Page({ already: 0, //已有几人助力 lack: 0, //还差几人助力 zltime: "", //助力时间 - djs:"",//定时器的显示 + djs: "", //定时器的显示 //*********************************************end }, @@ -133,11 +133,11 @@ Page({ th.setData({ endDate: help_data.endDate, }); - - //任务时间 设置全局定时器 - th.data.timer = setInterval(function() { - th.countDown(); - }, 1000); + + //任务时间 设置全局定时器 + th.data.timer = setInterval(function() { + th.countDown(); + }, 1000); } } @@ -186,17 +186,17 @@ Page({ } }) - + // 分享的 // setTimeout(function() { // th.shareFrends(); // }, 1000) - + //会员任务列表 this.user_task_list(); // 获取会员的参与的任务列表 我的任务 this.get_user_task_num(); - + }, @@ -214,18 +214,18 @@ Page({ var th = this; var index = 1; //获取当前选择的是任务还是活动说明 var is_task = this.data.is_task; //0任务,1帮拆 - if (is_task == undefined || is_task==null){ - is_task=1; + if (is_task == undefined || is_task == null) { + is_task = 1; } - var switch_head=this.data.switch_head; - if (switch_head == undefined || switch_head== null){ - switch_head=1; + var switch_head = this.data.switch_head; + if (switch_head == undefined || switch_head == null) { + switch_head = 1; } - + console.log("0任务,1帮拆", is_task, ); this.setData({ is_task: 1, - switch_head:1 + switch_head: 1 }); rq.get("/api/weshop/marketing/help/help/task/involve/page", { data: { @@ -237,14 +237,14 @@ Page({ if (res.data.code == 0) { var dismantle = res.data.data.pageData[0].zlHelpUser; - console.log(dismantle.toString, "帮拆记录",dismantle[0].nickName); - + console.log(dismantle.toString, "帮拆记录", dismantle[0].nickName); + th.setData({ dismantle: dismantle }); - }else{ + } else { th.setData({ - dismantle:null + dismantle: null }); } } @@ -252,14 +252,14 @@ Page({ }) }, // 领取礼包 - get_libao: function (e) { + get_libao: function(e) { var libao_id = e.currentTarget.dataset.libaoid; var completeid = e.currentTarget.dataset.completeid; console.log("礼包id", libao_id); getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); }, //查看礼包id - select_libao: function () { + select_libao: function() { var libao_id = e.currentTarget.dataset.libaoid; getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0); }, @@ -272,14 +272,14 @@ Page({ var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; var task_id = aitem[ind].id; console.log("划动的任务总数", task_number, "任务所有的参数", aitem, - "任务id",task_id); + "任务id", task_id); th.setData({ sw_index: ind, task_number: task_number, taskid: task_id }); - - if (this.data.switch_head==1){ + + if (this.data.switch_head == 1) { //判断有没有帮拆记录 this.dismantle_record(); } @@ -296,13 +296,13 @@ Page({ }, // 获取会员的参与的任务列表 我的任务 user_task_list: function(e) { - + var th = this; - + var index = 0; var is_task = this.data.is_task; //0任务,1帮拆 - if (is_task == undefined || is_task==null){ - is_task=0; + if (is_task == undefined || is_task == null) { + is_task = 0; } var switch_head = this.data.switch_head; if (switch_head == undefined || switch_head == null) { @@ -321,7 +321,7 @@ Page({ userId: user_id }, success: function(su) { - + if (su.data.code == 0) { var user_list = su.data.data.pageData; console.log("会员列表", user_list); @@ -337,31 +337,33 @@ Page({ }) }, //判断是否有领取任务 获取正在进行中的任务 - get_user_task:function(){ + get_user_task: function() { var user_id = getApp().globalData.user_id; - var th=this; - var aitem= th.data.aitem; - var sw_index=th.data.sw_index; - console.log(sw_index,"判断是否有领取任务", aitem); + var th = this; + var aitem = th.data.aitem; + var sw_index = th.data.sw_index; + console.log(sw_index, "判断是否有领取任务", aitem); var taskid = aitem[sw_index].id console.log("判断是否有领取任务 任务的id", taskid); - rq.get("/api/weshop/marketing/help/help/task/get",{ - data:{ + rq.get("/api/weshop/marketing/help/help/task/get", { + data: { storeId: os.stoid, userId: user_id, - taskId: taskid + taskId: taskid }, - success: function (res) { - if (res.data.code==0){ - var is_usertask=res.data.data; + success: function(res) { + if (res.data.code == 0) { + var is_usertask = res.data.data; console.log('判断是不是领取的任务', is_usertask); - th.setData({is_user_task: is_usertask}); - } + th.setData({ + is_user_task: is_usertask + }); + } } }) }, //获取助力活动参与的人数 - get_user_task_num:function(){ + get_user_task_num: function() { var th = this; var help_id = th.data.help_id; rq.get("/api/weshop/marketing/help/involve/help/act/people/count", { @@ -377,7 +379,7 @@ Page({ th.setData({ usercount: usercount }); - } + } } }) @@ -483,47 +485,47 @@ Page({ var th = this; // 获取当前时间,同时得到活动结束时间数组 var newTime = ut.gettimestamp(); - - // 对结束时间进行处理渲染到页面 - - // var o = endTimeList[i]; - var endTime = th.data.endDate - - // if (o.status == 0) endTime = o.start_time - - var obj = null; - // 如果活动未结束,对时间进行处理 - if (endTime - newTime > 0) { - - var time = (endTime - newTime); - // 获取天、时、分、秒 - var day = parseInt(time / (60 * 60 * 24)); - var hou = parseInt(time % (60 * 60 * 24) / 3600); - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); - obj = { - day: this.timeFormat(day), - hou: this.timeFormat(hou), - min: this.timeFormat(min), - sec: this.timeFormat(sec) - } - } else { - //活动已结束,全部设置为'00' - obj = { - day: '00', - hou: '00', - min: '00', - sec: '00' - } + + // 对结束时间进行处理渲染到页面 + + // var o = endTimeList[i]; + var endTime = th.data.endDate + + // if (o.status == 0) endTime = o.start_time + + var obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0) { + + var time = (endTime - newTime); + // 获取天、时、分、秒 + var day = parseInt(time / (60 * 60 * 24)); + var hou = parseInt(time % (60 * 60 * 24) / 3600); + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec) } - - th.setData({ - djs: obj - }); + } else { + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + } + + th.setData({ + djs: obj + }); + + - - }, //---小于10的格式化函数---- @@ -544,7 +546,7 @@ Page({ onShareAppMessage: function() { }, - + preview: function() { var th = this; var shareImgPath = th.data.shareImgPath; @@ -723,8 +725,8 @@ Page({ var c = q_num / num; ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit); ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); - // var dynamic = th.data.dynamic; //助力的微信头像 - // console.log(dynamic[0].headPic + "动态图片显示"); + // var dynamic = th.data.dynamic; //助力的微信头像 + // console.log(dynamic[0].headPic + "动态图片显示"); for (var i = 0; i < 6; i++) { if (i < 0) { // ctx.beginPath(); @@ -908,16 +910,19 @@ Page({ }) }, -//好友猜一猜 - save_share: function (e) { - var aitem = this.data.aitem; //任务的数据集 - var sw_index = this.data.sw_index; //轮播的下标 + //好友猜一猜 + save_share: function(e) { + var th = this; + var aitem = this.data.aitem; //任务的数据集 + var sw_index = this.data.sw_index; //轮播的下标 //任务id var taskid = aitem[sw_index].id - console.log("好友猜一猜的任务id", taskid); - var th = this; + th.setData({ + is_share: 1 + }) var url = "/api/weshop/marketing/help/help/task/involve/page"; getApp().request.promiseGet(url, { + isShowLoading: true, data: { storeId: os.stoid, taskId: taskid, @@ -930,11 +935,11 @@ Page({ // th.setData({ // dynamic: data // }) - // th.info_head(); - //th.imageinfo(); - setTimeout(function () { + // th.info_head(function() { th.shareFrends(); - }, 500) + // }); + //th.imageinfo(); + } } else { wx.hideLoading(); @@ -943,18 +948,18 @@ Page({ }) }, //把已助力好友头像下载到本地 - info_head: function (e) { + info_head: function(e) { var th = this; var images = th.data.dynamic; if (images[0] != null && images[0] != "" && images[0] != undefined) { console.log(images[0].headPic + "就将计就计"); wx.getImageInfo({ src: images[0].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[0].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -962,11 +967,11 @@ Page({ if (images[1] != null && images[1] != "" && images[1] != undefined) { wx.getImageInfo({ src: images[1].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[1].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -974,11 +979,11 @@ Page({ if (images[2] != null && images[2] != "" && images[2] != undefined) { wx.getImageInfo({ src: images[2].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[2].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -986,11 +991,11 @@ Page({ if (images[3] != null && images[3] != "" && images[3] != undefined) { wx.getImageInfo({ src: images[3].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[3].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -1022,15 +1027,16 @@ Page({ th.setData({ dynamic: images }) + }, //礼包的详情 轮播图 - libao_details:function(e){ - var giftbagid=e.currentTarget.dataset.giftbagid; - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" +giftbagid + "&is_libao=" + 0); + libao_details: function(e) { + var giftbagid = e.currentTarget.dataset.giftbagid; + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + giftbagid + "&is_libao=" + 0); }, //正在进行任务 - test: function (e) { - getApp().goto("/pages/user/assistance/friend_assistance?tasking=13"); + test: function(e) { + getApp().goto("/pages/user/assistance/friend_assistance?tasking=13"); }, }) \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index 1c4dda8..3537b0f 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -188,7 +188,7 @@ border-color: #fff; .canvas { position: fixed; - z-index: 11; + z-index: 20; width: 100%; top:20rpx; } -- libgit2 0.21.4