diff --git a/pages/user/assistance/friend_assistance.js b/pages/user/assistance/friend_assistance.js index 5d6217f..bdc5d76 100644 --- a/pages/user/assistance/friend_assistance.js +++ b/pages/user/assistance/friend_assistance.js @@ -32,54 +32,53 @@ Page({ if (options.userId) this.data.userId = options.userId; //任务是不是为空 if (this.data.tasking == 0 || this.data.tasking == undefined) { - //this.data.task_id = decodeURIComponent(options.scene); - this.data.tasking =1; - if (this.data.tasking != null && this.data.tasking != 'undefined' && this.data.tasking != "" && this.data.tasking != - 0) { - getApp().request.promiseGet("/api/weshop/marketing/help/help/tasking/get", { - data: { - id: th.data.tasking, - storeId: os.stoid - } - }).then(res => { - if (res.data.code == 0) { - th.data.userId = res.data.data.userId; - th.data.taskId = res.data.data.taskId; - //获取活动的时间 - return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { - data: { - helpId: res.data.data.helpFormId, - storeId: os.stoid - } - }) - } - return ut.null_promise(); - }).then(res => { - if (res.data.code == 0) { - th.setData({ - zl_act: res.data.data - }) - //获取活动的参与的人数 - return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", { - data: { - helpId: res.data.data.id, - storeId: os.stoid - } - }) - } - return ut.null_promise(); - }).then(res => { - if (res.data.code == 0) { - th.setData({ - s_num: res.data.data.countAll - }); - } - }) - - } + this.data.tasking = decodeURIComponent(options.scene); } - }, + if (this.data.tasking != null && this.data.tasking != 'undefined' && this.data.tasking != "" && this.data.tasking != + 0) { + getApp().request.promiseGet("/api/weshop/marketing/help/help/tasking/get", { + data: { + id: th.data.tasking, + storeId: os.stoid + } + }).then(res => { + if (res.data.code == 0) { + th.data.userId = res.data.data.userId; + th.data.taskId = res.data.data.taskId; + //获取活动的时间 + return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { + data: { + helpId: res.data.data.helpFormId, + storeId: os.stoid + } + }) + } + return ut.null_promise(); + }).then(res => { + if (res.data.code == 0) { + th.setData({ + zl_act: res.data.data + }) + //获取活动的参与的人数 + return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", { + data: { + helpId: res.data.data.id, + storeId: os.stoid + } + }) + } + return ut.null_promise(); + }).then(res => { + if (res.data.code == 0) { + th.setData({ + s_num: res.data.data.countAll + }); + } + }) + + } + }, // 跳转到助力成功页 participate_activity: function() { diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index 5a6469c..09f91c9 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -24,18 +24,14 @@ Page({ aitem: "", //活动的轮播图数据 switch_head: 0, //0:我的任务,1:记录 help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成 - is_share: 1, //是否显示画布 - shareImgPath: [], //生成的图片 - screenWidth: "", //用户的屏幕宽度 gid: "", timer: null, //全局的定时器 user_task_list: null, //会员列表 taskid: "", //任务id usercount: 0, //参与的人数 dismantle: null, //帮拆记录数据集 - is_user_task:null,//判断是不是领取的任务 - + zzjx_id:"",//真正进行的任务id //*********************************************start钱 canvasHidden: 0, //分享图片是否已经生成 is_share: 0, //是否显示画布 @@ -254,9 +250,9 @@ Page({ // 领取礼包 get_libao: function (e) { var libao_id = e.currentTarget.dataset.libaoid; - // var completeid = e.currentTarget.dataset.completeid; + var completeid = e.currentTarget.dataset.completeid; console.log("礼包id", libao_id); - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao="+1 ); + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); }, //查看礼包id select_libao: function () { @@ -336,7 +332,7 @@ Page({ } }) }, - //判断是否有领取任务 + //判断是否有领取任务 获取正在进行中的任务 get_user_task:function(){ var user_id = getApp().globalData.user_id; var th=this; @@ -1026,19 +1022,18 @@ Page({ }, //好友猜一猜 save_share: function (e) { - // var aitem = this.data.aitem; //任务的数据集 - // var sw_index = this.data.sw_index; //轮播的下标 + var aitem = this.data.aitem; //任务的数据集 + var sw_index = this.data.sw_index; //轮播的下标 //任务id - var taskid = e.currentTarget.dataset.taskid; + var taskid = aitem[sw_index].id console.log("好友猜一猜的任务id", taskid); var th = this; - var url = "/api/weshop/marketing/help/help/task/involve/page"; getApp().request.promiseGet(url, { data: { - storeId: 1, + storeId: os.stoid, taskId: taskid, - userId: 1433390 + userId: getApp().globalData.user_id } }).then(res => { if (res.data.code == 0) { @@ -1140,14 +1135,49 @@ Page({ dynamic: images }) }, - test:function(e){ - var task_id=e.currentTarget.dataset.taskid; - console.log("正在进行中任务的id",task_id); - }, //礼包的详情 轮播图 libao_details:function(e){ var giftbagid=e.currentTarget.dataset.giftbagid; - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + giftbagid + "&is_libao=" + 0); - } + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" +giftbagid + "&is_libao=" + 0); + }, + //正在进行任务 + test: function (e) { + var th=this; + var aitem = this.data.aitem; //任务的数据集 + var sw_index = this.data.sw_index; //轮播的下标 + //任务id + var taskid = aitem[sw_index].id; + //查看正在进行中的任务 + getAPP().request.promiseGet("/api/weshop/marketing/help/help/task/get",{ + data:{ + storeId: os.stoid, + userId: getApp().globalData.user_id, + taskId:taskid + } + }).then(res=>{ + if (res.data.code==0){ + var zzjx_id=res.data.data.id; + th.setData({zzjx_id:zzjx_id}); + var zzjx_id=th.data.zzjx_id; + getApp().goto("/pages/user/friend_assistance/friend_assistance?taskimg=" + zzjx_id); + // return getApp().request.json_post("/api/weshop/marketing/help/help/task/involve/insert",{ + // id:zzjx_id, + // storeId: os.stoid, + // userId: getApp().globalData.user_id, + // zlUserId: 4379287 + // },function (res) { + // if (res.data.code==0){ + + + // } + // } + + + // )} + }) + + + + }, }) \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index edd8f18..e3f7e76 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -41,7 +41,7 @@ 就选它了 - + 好友拆一拆 @@ -77,7 +77,7 @@ {{item.zlHelpNum}}/{{item.helpNum}} 查看礼包 - 领取礼包