diff --git a/app.json b/app.json index 73cb4fb..fb04943 100644 --- a/app.json +++ b/app.json @@ -89,8 +89,12 @@ "pages/giftpack/mygiftpack/mygiftpack", "pages/user/assistance/giftpacklist", - "pages/user/assistance/task_assistance" + "pages/user/assistance/task_assistance", + "pages/user/assistance/friend_assistance", + "pages/user/assistance/assistance_success", + "pages/user/assistance/assistance", + "pages/test/zhuli_test" ], "permission": { diff --git a/components/diy_advertising/diy_advertising.js b/components/diy_advertising/diy_advertising.js index 2ae1a91..a2f3aa1 100644 --- a/components/diy_advertising/diy_advertising.js +++ b/components/diy_advertising/diy_advertising.js @@ -12,8 +12,8 @@ Component({ yc:false, btn: 1, ad:false, - autoplay:false, - interval:5000, + autoplay:true, + interval:3000, duration:1000, someData: {}, max_sw_height:null, @@ -36,4 +36,4 @@ Component({ if (this.data.max_sw_height < viewHeight) this.setData({ max_sw_height: viewHeight }); } } -}) \ No newline at end of file +}) diff --git a/components/diy_picMax/diy_picMax.wxss b/components/diy_picMax/diy_picMax.wxss index 170aa45..8886b2d 100644 --- a/components/diy_picMax/diy_picMax.wxss +++ b/components/diy_picMax/diy_picMax.wxss @@ -1,5 +1,5 @@ .picMax{width: 100%;position: relative;} -.pic_item{display: inline-block; top:0;left:0;vertical-align: middle} +.pic_item{display: block; top:0;left:0;float:left} .pic_item image{width: 100%; height: 100%} .width_1{width: 187.5rpx}.width_2{width: 375rpx;}.width_3{width: 562.5rpx}.width_4{width:748rpx;} /* .height_1{height: 187.5rpx;}.height_2{height: 375rpx;}.height_3{height: 562.5rpx}.height_4{height: 748rpx;} */ diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index c3ce082..7a5c415 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -439,7 +439,6 @@ Page({ 'content-type': 'application/json' },// 设置请求的 header success: function (res) { - th.data.is_summit_ing=0; //是否提交中 wx.hideLoading(); if (res.statusCode == 200) { @@ -469,7 +468,8 @@ Page({ util_pay.pay(data.data, function() { setTimeout(function () { wx.navigateTo({ - url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data, + //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data, + url: "/pages/team/team_success/team_success?ordersn=" + data.data, }) },1000) }, function () { diff --git a/pages/getphone/getphone.js b/pages/getphone/getphone.js index 9a6e927..ddf27f8 100644 --- a/pages/getphone/getphone.js +++ b/pages/getphone/getphone.js @@ -54,9 +54,11 @@ Page({ //接下来写业务代码登录 //最后,记得返回刚才的页面 if (e.encryptedData==undefined){ + /*--- wx.navigateTo({ url: '/pages/user/binding_info/binding_info', - }) + })--*/ + return app.my_warnning("登录需要授权手机号码!", 0, that); return false; } var r=getApp().globalData.getu; @@ -105,6 +107,7 @@ Page({ }, failStatus: function (t) { + /*--- return "100" === t.data.result ? (i.goHome(), wx.navigateTo({ url: "/pages/user/binding_info/binding_info?nickName=" + r.nickName + "&userHeadPic=" + r.avatarUrl }), !1) : (i.clearAuth(), i.alertLoginErrorAndGoHome(t.data.msg), a.request.post("/api/user/logout", { @@ -115,7 +118,8 @@ Page({ failStatus: function () { return !1; } - }), !1); + }), !1);--*/ + return app.my_warnning("授权登入失败,请稍后再试!", 0, that); }, fail: function (t) { return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; diff --git a/pages/getphone/getphone.json b/pages/getphone/getphone.json index 41fff8a..fb13409 100644 --- a/pages/getphone/getphone.json +++ b/pages/getphone/getphone.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "绑定手机" + "navigationBarTitleText": "绑定手机", + "usingComponents": { + "warn": "/components/long_warn/long_warn" + } } diff --git a/pages/getphone/getphone.wxml b/pages/getphone/getphone.wxml index 8f80327..e511fa5 100644 --- a/pages/getphone/getphone.wxml +++ b/pages/getphone/getphone.wxml @@ -6,4 +6,5 @@ 暂不绑定 - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index ec28d16..ef408c7 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -315,10 +315,20 @@ Page({ bind_bnerr2: function(e) { var _errImg = e.target.dataset.errorimg; var _errObj = {}; - _errObj[_errImg] = "/public/images/empty.jpg"; + _errObj[_errImg] = "/miniapp/images/giftbag/gift01.png"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + //图片失败,默认图片 + bind_bnerr: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"}); }, + //关闭导航 close: function() { var th = this; diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml index 57c9994..aef38d6 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxml +++ b/pages/giftpack/giftpacklist/giftpacklist.wxml @@ -1,6 +1,6 @@ - + diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxss b/pages/giftpack/giftpacklist/giftpacklist.wxss index 3d906ad..be61320 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxss +++ b/pages/giftpack/giftpacklist/giftpacklist.wxss @@ -96,6 +96,7 @@ border: 2rpx solid #999; width: 120rpx; height: 120rpx; + background-color: #f8f8f8; } .box_ware_item.data-v-3a5b7e36 { @@ -241,4 +242,4 @@ page.data-v-3a5b7e36 { } .overdue.data-v-3a5b7e36{ background-color: rgb(153,153,153); -} \ No newline at end of file +} diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 35b53a0..3b30bd0 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -2601,6 +2601,14 @@ Page({ //--定义的保存图片方法,分享团--- saveImageToPhotosAlbum: function() { + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + //getApp().my_warnning("请先登录",0,this); + wx.navigateTo({ url: '/pages/getphone/getphone', }) + return false; + } + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 var type = this.data.prom_type; if (type == 6) type = 2; diff --git a/pages/test/zhuli_test.js b/pages/test/zhuli_test.js new file mode 100644 index 0000000..452f7cd --- /dev/null +++ b/pages/test/zhuli_test.js @@ -0,0 +1,60 @@ +var e = getApp(), + a = e.globalData.setting, + os = a; +var regeneratorRuntime = require('../../utils/runtime.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + iurl: a.imghost, //图片地址前缀\ + taskId:0, + mobile:0, + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + wx.setNavigationBarTitle({ + title: "测试帮忙助力", + }) + var th = this; + var taskId=options.taskId; + this.data.taskId=taskId; + }, + + getphoneValue:function(e){ + this.data.mobile=e.detail.value; + }, + //测试正在进行任务 + bindReg:async function () { + var userinfo=null; + await getApp().request.promiseGet("/api/weshop/users/page",{ + data:{mobile:this.data.mobile,store_id:os.stoid} + }).then(res=>{ + userinfo=res.data.data.pageData[0]; + }) + if(!userinfo) { + getApp().my_warnning("未找到会员",0,this); return false; + } + + var task=null; + await getApp().request.promiseGet("/api/weshop/marketing/help/help/task/get",{ + data:{taskId:this.data.taskId,storeId:os.stoid,userId:userinfo.user_id} + }).then(res=>{ + task=res.data.data; + }) + if(!task) { + getApp().my_warnning("未找任务",0,this); return false; + } + + if(task.status!=0){ + getApp().my_warnning("任务不是进行中",0,this); return false; + } + var taking=task.id; + getApp().goto("/pages/user/assistance/friend_assistance?tasking=" + taking + "&userId=" + userinfo.user_id); + }, + + +}) diff --git a/pages/test/zhuli_test.json b/pages/test/zhuli_test.json new file mode 100644 index 0000000..007d140 --- /dev/null +++ b/pages/test/zhuli_test.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "助力测试专用", + "usingComponents": { + "warn": "/components/long_warn/long_warn" + } +} \ No newline at end of file diff --git a/pages/test/zhuli_test.wxml b/pages/test/zhuli_test.wxml new file mode 100644 index 0000000..d86ec97 --- /dev/null +++ b/pages/test/zhuli_test.wxml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + 去帮忙助力 + + + + + + diff --git a/pages/test/zhuli_test.wxss b/pages/test/zhuli_test.wxss new file mode 100644 index 0000000..11ea42a --- /dev/null +++ b/pages/test/zhuli_test.wxss @@ -0,0 +1,146 @@ +page{ + border-top: 3rpx solid #EAEAEC; +} +.index { + position: absolute; width: 100%; + z-index: 1; +} + +.logins { + width: 100%; + padding-top: 60rpx; + padding-bottom: 120rpx; +} + +.login_img { + width: 192rpx; + height: 192rpx; + border-radius: 50% +} + +.input_phone { + height: 55rpx; + line-height: 55rpx; + margin-left:10rpx ; + position: relative; top:10rpx +} + +.input_code { + width: 360rpx; + height: 55rpx; + line-height: 55rpx; + border-radius: 12rpx; + margin-right: 20rpx; + border: 3rpx solid rgb(230, 230, 230); + padding-left: 40rpx; + color:#ef8179 +} + +.codes { + margin-bottom: 65rpx; +} + +.get_code { + width: 176rpx; + height: 65rpx; + line-height: 65rpx; + border:1rpx solid rgb(236, 109, 95); + color: #ed7067; + border-radius: 12rpx; + right: 0; + top:5rpx; +} + +.userlogin { + width: 100%; + height: 95rpx; + line-height: 95rpx; + background-color: #ffc5c0; + color: rgb(255, 255, 255); + margin-bottom: 30rpx; + margin-top: 50rpx + } + +.userlogin.on{ + background-color: #eb6359; +} + +.go_index { + color: #9d9d9d; + margin-bottom: 300rpx; +} + +.sr { + width: 90%; margin: 0 auto; +} + +.checkbox { + width: 25rpx; + height: 25rpx; + color: rgb(0, 0, 0); + margin-right: 50rpx; + margin-bottom: 30rpx +} + +.agrs { + padding: 0rpx 65rpx; +} + +.agreement { + color: rgb(236, 109, 95); + display: initial; +} + +.popup { + position: fixed; + z-index: 10; + background-color: rgba(153, 153, 153, 0.568); + height: 100%; + width: 100%; +} + +.content { + max-height: 800rpx; +min-height: 100rpx; +padding: 60rpx 35rpx; +background-color: rgb(255, 255, 255); +width: 570rpx; +margin-bottom: 70rpx; +overflow-y: scroll; +border-radius: 15rpx; +line-height: 50rpx; +font-size: 26rpx; +color: #545454; + + +} + +.close { + width: 65rpx; + height: 65rpx; +} + +.xy { + display: initial;color: #9c9c9c; line-height: 34rpx +} + +.get_code.on{ + color: #666; +} +.tubiao_set{ + width: 50rpx; height: 64rpx; margin-right:30rpx; position: relative; top:5rpx; +} +.tubiao_set2{ + width: 46rpx; height: 64rpx; margin-right:34rpx; +} +.phone_view{ + border-bottom:1rpx solid #e8e8e8 ; + height: 96rpx; margin-top:50rpx + +} +.phone_view.mt{ + margin-top:20rpx +} +.reg_btn{ + margin-top:40rpx; margin-bottom: 20rpx +} diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js index 4900b35..2b95357 100644 --- a/pages/user/assistance/assistance.js +++ b/pages/user/assistance/assistance.js @@ -20,7 +20,7 @@ Page({ switch_head: 0, //0:我的任务,1:活动说明 zl_act: null, //助力活动 zl_user_list: [], //任务列表 - is_load: 0, //是否已经加载 + is_load: 0, //是否已经加载 cur_page: 1, //页码 page_num: 5, //每页多少个 is_show_more: 0, //是否加载更多 @@ -37,15 +37,16 @@ Page({ var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.set_name("助力", "/pages/user/assistance/assistance"); - // 助力活动 - th.assistance(); + }, /** * 生命周期函数--监听页面显示 */ onShow: function() { - + var th = this; + // 助力活动 + th.assistance(); }, // 助力活动 assistance() { @@ -80,7 +81,7 @@ Page({ } return ut.null_promise(); }).then(res => { - if (res.data.code == 0) + if ( res && res.data &&res.data.code == 0) th.setData({ s_num: res.data.data.countAll }) @@ -94,7 +95,9 @@ Page({ var th = this; var page = th.data.page; + if(page==1)th.data.zl_user_list=[]; var help_id = this.data.help_id; + var r=Math.random()*100; t.request.get("/api/weshop/marketing/help/help/user/page", { isShowLoading: true, data: { @@ -102,7 +105,8 @@ Page({ storeId: os.stoid, helpId: help_id, page: page, - pageSize: 5 + pageSize: 5, + r:r, }, success: function(res) { clearTimeout(th.data.timer); @@ -113,7 +117,7 @@ Page({ }) if (res.data.code == 0) { var list = th.data.zl_user_list; - //连接数组 + //连接数组 list = list.concat(res.data.data.pageData); th.setData({ zl_user_list: list, @@ -131,7 +135,7 @@ Page({ }) } } else { - getApp().my_warnning(res.data.msg, 0, th); + //getApp().my_warnning(res.data.msg, 0, th); th.setData({ is_show_more: 1, page: page @@ -178,6 +182,13 @@ Page({ select_libao: function(e) { var orderSn = e.currentTarget.dataset.ordersn; //订单号 getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); + }, + + //---查看任务--- + go_to_task:function (e) { + var help_id = this.data.help_id; + var taskid=e.currentTarget.dataset.taskid; + getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id+"&taskid="+taskid); } -}) \ No newline at end of file +}) diff --git a/pages/user/assistance/assistance.wxml b/pages/user/assistance/assistance.wxml index 5db3f19..6a6c89b 100644 --- a/pages/user/assistance/assistance.wxml +++ b/pages/user/assistance/assistance.wxml @@ -53,7 +53,7 @@ 领取礼包 - + {{item.zlHelpNum}}/{{item.helpNum}} @@ -107,4 +107,4 @@ - \ No newline at end of file + diff --git a/pages/user/assistance/assistance_success.js b/pages/user/assistance/assistance_success.js index f09db9a..8ffd0dd 100644 --- a/pages/user/assistance/assistance_success.js +++ b/pages/user/assistance/assistance_success.js @@ -18,23 +18,25 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - //var helpid=options.helpid; - var helpid=23; + var helpid=options.helpid; this.init(helpid); + var nav_b = this.selectComponent("#nav_b"); //组件的id + nav_b.set_name("助力", "/pages/user/assistance/assistance"); + }, /** * 生命周期函数--监听页面显示 */ onShow: function (e) { - + }, // ----初始化---- - init:function(helpid) { + init:function(helpid) { var user_id = getApp().globalData.user_id; var store_id = os.stoid; var th=this; - + //链式调用接口,先获取活动,在获取参与活动的人数 getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { data: { @@ -49,10 +51,10 @@ Page({ storeId: store_id, helpId: helpid } - }) + }) } return ut.null_promise(); - + }).then(res=>{ if(res.data.code==0){ th.setData({s_num:res.data.data.countAll}); @@ -70,6 +72,6 @@ Page({ }, cklie_button:function(){ - getApp().goto("/pages/user/assistance/assistance") + getApp().goto("/pages/user/assistance/assistance") } -}) \ No newline at end of file +}) diff --git a/pages/user/assistance/friend_assistance.js b/pages/user/assistance/friend_assistance.js index 42711a4..8701da5 100644 --- a/pages/user/assistance/friend_assistance.js +++ b/pages/user/assistance/friend_assistance.js @@ -21,6 +21,7 @@ Page({ userId: 0, //任务用户的ID s_num: 0, //分享的人数 taskId:0, //活动从表ID + helpId:0, }, /** @@ -28,64 +29,24 @@ Page({ */ onLoad: function(options) { var th = this; - + + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.set_name("助力", "/pages/user/assistance/assistance"); + if (options.tasking) this.data.tasking = options.tasking; if (options.userId) this.data.userId = options.userId; //任务是不是为空 if (this.data.tasking == 0 || this.data.tasking == undefined) { - this.data.tasking = decodeURIComponent(options.scene); + 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: { - taskingId: 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 - }); - } - }) - - } + getApp().getUserFir(function() {}); + }, // 跳转到助力成功页 participate_activity: function() { wx.navigateTo({ - url: '/pages/user/assistance/assistance_success', + url: '/pages/user/assistance/assistance_success?helpid='+this.data.helpId, }) }, @@ -93,11 +54,63 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + 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: { + taskingId: 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; + th.data.helpId=res.data.data.helpFormId; + //获取活动的时间 + 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 && res.data && res.data.code == 0) { + th.setData({ + s_num: res.data.data.countAll + }); + } + }) + } }, //点击开启礼盒 cklie_button: function() { var th = this; + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/getphone/getphone', + }) + return false; + } var t_user_id = app_d.user_id; var data = { id: this.data.tasking, @@ -126,7 +139,7 @@ Page({ //点击关闭礼盒 clike_none: function() { this.setData({is_show: 0}); - getApp().goto("/pages/user/assistance/assistance_success"); + getApp().goto("/pages/user/assistance/assistance_success?helpid="+this.data.helpId); }, //导航球 close: function() { diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js index adf92ba..d033364 100644 --- a/pages/user/assistance/giftpacklist.js +++ b/pages/user/assistance/giftpacklist.js @@ -210,7 +210,8 @@ Page({ var json = { "actId": th.data.id, //活动Id "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 - "giftBagId": 1, //礼包Id + //"giftBagId": 1, //礼包Id + "giftBagId": th.giftBagId, //礼包Id "storeId": a.stoid, //商家Id "userId": d.user_id //用户ID }; @@ -334,14 +335,25 @@ Page({ bind_bnerr2: function(e) { var _errImg = e.target.dataset.errorimg; var _errObj = {}; - _errObj[_errImg] = "/public/images/empty.jpg"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + _errObj[_errImg] ="/miniapp/images/giftbag/gift01.png"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, + + //图片失败,默认图片 + bind_bnerr: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"}); + + }, + //关闭导航 close: function() { var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); } -}); \ No newline at end of file +}); diff --git a/pages/user/assistance/giftpacklist.wxml b/pages/user/assistance/giftpacklist.wxml index a2311dc..01ac169 100644 --- a/pages/user/assistance/giftpacklist.wxml +++ b/pages/user/assistance/giftpacklist.wxml @@ -1,6 +1,6 @@ - + @@ -105,9 +105,13 @@ - + 一键全部领取 + + + 已领取 + @@ -141,4 +145,4 @@ - \ No newline at end of file + diff --git a/pages/user/assistance/giftpacklist.wxss b/pages/user/assistance/giftpacklist.wxss index 7026432..d21cbd5 100644 --- a/pages/user/assistance/giftpacklist.wxss +++ b/pages/user/assistance/giftpacklist.wxss @@ -96,6 +96,7 @@ border: 2rpx solid #999; width: 120rpx; height: 120rpx; + background-color:#f8f8f8; /* background-color: rgba(153, 153, 153, 0.664); */ } @@ -219,6 +220,10 @@ border-radius: 40rpx; } +.foot_button_buy.data-v-3a5b7e36.on{ + background-color: gainsboro; color: #666; +} + .foot_button_intalge.data-v-3a5b7e36 { background: #ffbb42; color: #fff; diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index e69de29..f0413b5 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -0,0 +1,1058 @@ +var auth = require("../../../utils/auth.js"), + rq = require("../../../utils/request.js"); +var e = getApp(), + app = e, + i = require("../../../utils/util.js"), + ut = i, + s = e.globalData.setting, + os = s, + app_d = e.globalData; +var regeneratorRuntime = require('../../../utils/runtime.js'); +Page({ + /** + * 页面的初始数据 + */ + data: { + swpie_img: s.imghost + "/miniapp/images/user_index_powder.jpg", + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg",//助力头像的默认图 + sw_index: 0, //轮播的下标控制 + url: s.url, //接口网址 + iurl: s.imghost, + endDate: "", //活动结束时间 + activity_data: "25:20:59", //活动剩余时间 + task_number: 0, //任务数 + is_task: 0, //历史记录与任务 + aitem: "", //活动的轮播图数据 + switch_head: 0, //0:我的任务,1:记录 + help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成 + gid: "", + timer: null, //全局的定时器 + user_task_list: [], //会员列表 + taskid: "", //任务id + usercount: 0, //参与的人数 + dismantle: [], //帮拆记录数据集 + is_user_task: null, //判断是不是领取的任务 + zzjx_id: "", //真正进行的任务id + is_show: 0, //任务的加载更多 + is_bc_show: 0, //帮拆的加载更多 + bc_page: 1, //帮拆的页码 + rw_page: 1, //任务的页码 + block: 0, //阻断助力的我的任务在当前位置多次点击 + is_dismantle: 0, //阻断助力的帮拆记录在当前位置多次点击 + is_clik: 0,//点击的时候控制划动 + is_dis_list: 0,//多个数据的时候 + is_user_list: 0,//我的任务点击加载更多的后 + + //*********************************************start钱 + canvasHidden: 0, //分享图片是否已经生成 + is_share: 0, //是否显示画布 + shareImgPath: [], //生成的图片 + screenWidth: "", //用户的屏幕宽度 + gid: "", + images: ["miniapp/images/friendhelp/help.png", "miniapp/images/friendhelp/background.png", "miniapp/images/friendhelp/no_check.png", + "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/unfinished.png", "miniapp/images/xc_ellipsis.png" + ], //固的分享图片 + + dynamic: null, //已助力的微信头像数组 + head_pic_arr: [], //助力的头像 + share_lb_img: "", //分享的礼包图片 + + is_generate: 0, //是否重复点击拆一拆 + already: 0, //已有几人助力 + lack: 0, //还差几人助力 + zltime: "", //助力时间 + djs: "", //定时器的显示 + //*********************************************end + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var th = this; + var help_id = options.help_id; + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.set_name("助力", "/pages/user/assistance/assistance"); + th.setData({ + help_id: help_id + }); + //start 钱 + if (options.gid != undefined) { + th.setData({ + gid: options.gid + }) + } + if (options.taskid != undefined) { + th.setData({taskid:options.taskid}) + } + + th.close(); + th.syinfo(); + th.imageinfo(); + + }, + + + //选中任务保存 + add_onlicke: function (e) { + var th = this; + var taskid = e.target.dataset.taskid; + var help_id = th.data.help_id; + var user_id = getApp().globalData.user_id; + var stoid = os.stoid + getApp().request.json_post("/api/weshop/marketing/help/help/task/insert", { + helpId: help_id, + userId: user_id, + storeId: stoid, + taskId: taskid + }, + function (res) { + if (res.data.code == 0) { + getApp().my_warnning(res.data.data, 1, th); + //判断是不是领取的任务 + th.get_user_task(); + //会员任务列表 + th.user_task_list(); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + } + + ) + + }, + + + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.data.is_timer = 1; + var th = this; + var help_id = th.data.help_id; + var user_id = getApp().globalData.user_id; + + /*-----助力活动(判断)-----*/ + rq.get("/api/weshop/marketing/help/act/judge", { + data: { + userId: user_id, + storeId: os.stoid + }, + success: function (res) { + if (res.data.code == 0) { + var help_data = res.data.data; + th.setData({ + endDate: help_data.endDate, + }); + + //任务时间 设置全局定时器 + th.setData({ + timer: setInterval(function () { + th.countDown(); + }, 1000) + }) + + + } + } + }); + + + /*-----获取助力活动的任务-----*/ + rq.get("/api/weshop/marketing/help/help/task/page", { + data: { + helpId: help_id, + storeId: os.stoid + }, + success: function (su) { + var data = su.data; + if (data.code != 0) { + getApp().my_warnning(data.msg, 0, th); + return false; + } + if (data.code == 0) { + //轮播图的数据 + var data_aissa = data.data.pageData; + //当前时间戳 + var nt = ut.gettimestamp(); + + data_aissa.forEach(function (val, ind) { + //已开始 + if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0; + //未开始 + else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1; + //已结束 + else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2; + }); + var task_number = data_aissa[0].giftQty - data_aissa[0].useGiftQty; + var taskid = data_aissa[0].id; + if(th.data.taskid) { + th.setData({ + aitem: data_aissa, + task_number: task_number, + }); + th.go_to_task(th.data.taskid); + + }else{ + th.setData({ + aitem: data_aissa, + task_number: task_number, + taskid: taskid + }); + //判断是不是领取的任务 + th.get_user_task(); + } + } + + } + }) + + // 分享的 + // setTimeout(function() { + // th.shareFrends(); + // }, 1000) + + //会员任务列表 + this.user_task_list(); + //获取助力活动参与的人数 + this.get_user_task_num(); + + }, + //记录加载更多 + dismantle_record_list: function () { + this.setData({ is_dismantle: 0 }); + this.dismantle_record(); + }, + + dismantle_record_click(){ + if(this.data.switch_head==1) return false; + this.setData({ is_dismantle: 0 }); + this.dismantle_record(); + }, + + //帮拆记录的 + dismantle_record: function (e) { + //优化 + if (this.data.is_dismantle == 1) { + return false; + } + + var aitem = this.data.aitem; //任务的数据集 + var sw_index = this.data.sw_index; //轮播的下标 + //任务id + var taskid = aitem[sw_index].id; + 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; + } + var switch_head = this.data.switch_head; + if (switch_head == undefined || switch_head == null) { + switch_head = 1; + } + this.setData({ + is_task: 1, + switch_head: 1, + block: 0, + }); + + var bc_page = th.data.bc_page; + rq.get("/api/weshop/marketing/help/help/task/involve/page", { + data: { + page: bc_page, + pageSize: 5, + taskId: taskid, + userId: getApp().globalData.user_id, + storeId: os.stoid + }, + success: function (res) { + if (res.data.code == 0) { + th.setData({ is_dismantle: 1 }); + var dismantle = res.data.data.pageData[0].zlHelpUser; + if (res.data.data.total > 5) { + var bc_page = th.data.bc_page + 1; + var dismantle_s = th.data.dismantle.concat(dismantle); + th.setData({ + bc_page: bc_page, + is_bc_show: 1, + dismantle: dismantle_s, + is_dis_list: 1 + }) + } else { + th.setData({ + dismantle: dismantle, + is_dis_list: 0 + }); + } + var dis_len = th.data.dismantle.length; + if (res.data.data.total == dis_len) { + th.setData({ + is_dis_list: 0, + }) + } + th.setData({ + + is_clik: 0, + }); + } else { + th.setData({ + dismantle: null + }); + } + } + + }) + }, + // 领取礼包 + get_libao: function (e) { + var libao_id = e.currentTarget.dataset.libaoid; //礼包id + var taskid = e.currentTarget.dataset.taskid; + var taskingid = e.currentTarget.dataset.taskingid; + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id=" + taskingid); + }, + //查看礼包id + select_libao: function (e) { + var orderSn = e.currentTarget.dataset.ordersn; + getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); + }, + + //划动的时候监听 + onSli: function (e) { + var arr = []; + this.setData({ + dismantle: arr + }); + var th = this; + var ind = e.detail.current; + var aitem = this.data.aitem; + var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; + var task_id = aitem[ind].id; + th.setData({ + sw_index: ind, + task_number: task_number, + taskid: task_id, + is_dismantle: 0, + bc_page: 1 + }); + + if (this.data.switch_head == 1 && th.data.is_clik == 0) { + //判断有没有帮拆记录 + this.dismantle_record(); + } + //判断是不是领取的任务 + th.get_user_task(); + + }, + //导航球 + close: function () { + var th = this; + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.close_box(); + }, + //我的任务点击加载更多 + task_list: function () { + this.setData({ block: 0 }); + this.user_task_list(); + }, + // 获取会员的参与的任务列表 我的任务 + user_task_list: function (e) { + var th = this; + //防止已经当前位置的时候多次点击 + if (th.data.block == 1) { return false; } + th.data.block=1; + var index = 0; + var is_task = this.data.is_task; //0任务,1帮拆 + if (is_task == undefined || is_task == null) { + is_task = 0; + } + var switch_head = this.data.switch_head; + if (switch_head == undefined || switch_head == null) { + switch_head = 0; + } + this.setData({ + is_task: index, + switch_head: index, + user_task_list:[], + }); + var help_id = th.data.help_id; + var user_id = getApp().globalData.user_id; + var rw_page = th.data.rw_page; + if(rw_page==1)th.data.zl_user_list=[]; + var r=Math.random()*100; + rq.get("/api/weshop/marketing/help/help/user/page", { + data: { + page: rw_page, + pageSize: 5, + helpId: help_id, + storeId: os.stoid, + userId: user_id, + r:r, + }, + success: function (su) { + th.data.block=0 + if (su.data.code == 0) { + if (su.data.data.total > 5) { + var rw_page = th.data.rw_page + 1; + th.setData({ + rw_page: rw_page, + is_show: 1 + }) + + } + + + var user_list = su.data.data.pageData; + // if (user_list == "" || user_list.length == 0 || user_list==null){ + // th.setData({ + // is_user_list: 1 + // }); + // console.log("走哪里1111"); + // }else{} + console.log("走哪里22222222"); + var user_lists = th.data.user_task_list.concat(user_list); + th.setData({ + user_task_list: user_lists + }); + } else { + th.setData({ is_user_list: 1 }); + //getApp().my_warnning(su.data.msg, 0, th); + } + } + }) + }, + //判断是否有领取任务 获取正在进行中的任务 + 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; + var taskid = aitem[sw_index].id + rq.get("/api/weshop/marketing/help/help/task/get", { + data: { + storeId: os.stoid, + userId: user_id, + taskId: taskid + }, + success: function (res) { + if (res.data.code == 0) { + var is_usertask = res.data.data; + th.setData({ + is_user_task: is_usertask + }); + } + } + }) + }, + //获取助力活动参与的人数 + 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", { + data: { + helpId: help_id, + storeId: os.stoid, + }, + success: function (su) { + if (su.data.code == 0) { + var usercount = su.data.data.countAll; + + th.setData({ + usercount: usercount + }); + } + } + }) + + }, + //轮播卡死的重置 + changeGoodsSwip: function (detail) { + if (detail.detail.source == "touch") { + //当页面卡死的时候,current的值会变成0 + if (detail.detail.current == 0) { + //有时候这算是正常情况,所以暂定连续出现3次就是卡了 + let swiperError = this.data.swiperError + swiperError += 1 + this.setData({ + swiperError: swiperError + }) + if (swiperError >= 3) { //在开关被触发3次以上 + this.setData({ + sw_index: this.data.preIndex + }); //,重置current为正确索引 + this.setData({ + swiperError: 0 + }) + } + } else { //正常轮播时,记录正确页码索引 + this.setData({ + preIndex: detail.detail.current + }); + //将开关重置为0 + this.setData({ + swiperError: 0 + }) + } + } + }, + + // 轮播图点击左边 + click_pre: function () { + var arr = []; + this.setData({ + dismantle: arr + }); + var index = this.data.sw_index; + index--; + if (index < 0) return; + var aitem = this.data.aitem; + var task_number = aitem[index].giftQty - aitem[index].useGiftQty; + var task_id = aitem[index].id; + this.setData({ + sw_index: index, + task_number: task_number, + taskid: task_id, + is_dismantle: 0, + is_clik: 1, + bc_page: 1 + }) + if (this.data.switch_head == 1) { + //判断有没有帮拆记录 + console.log("往左点////////////////////"); + this.dismantle_record(); + } + if (this.data.switch_head == 0) { + //判断有没有领取任务 + this.get_user_task(); + } + + }, + //轮播图点击右边 + click_next: function () { + var arr = []; + this.setData({ + is_clik: 1, + dismantle: arr + }); + var index = this.data.sw_index; + index++; + if (index >= this.data.aitem.length) return; + var aitem = this.data.aitem; + var task_number = aitem[index].giftQty - aitem[index].useGiftQty; + var task_id = aitem[index].id; + this.setData({ + sw_index: index, + task_number: task_number, + taskid: task_id, + is_dismantle: 0, + bc_page: 1, + }) + if (this.data.switch_head == 1) { + this.dismantle_record(); + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + //--清理定时器-- + clearInterval(this.data.timer); + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + //----助力任务的时间----- + countDown() { + if (!this.data.is_timer) return false; + 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 txt = "aitem[" + 0 + "].djs"; + th.setData({ + [txt]: obj + }); + }, + //---小于10的格式化函数---- + timeFormat(param) { + return param < 10 ? '0' + param : param; + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + preview: function () { + var th = this; + var shareImgPath = th.data.shareImgPath; + wx.previewImage({ + url: shareImgPath[0], + urls: shareImgPath + }) + }, + + //关闭分享显示 + close_share: function () { + var th = this; + th.setData({ + is_share: 0 + }) + }, + syinfo: function () { + var th = this; + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + th.setData({ + screenWidth: res.screenWidth + }) + } + }) + }, + + + + //************************ */ + shareFrends: function (e) { + var th = this; + if (th.data.is_generate) return; + th.data.is_generate = 1; + + var scene = this.data.is_user_task.id; + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/assistance/friend_assistance"; + //读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success: function (res) { + + var ewm_path = res.path; // + //var act_time="2019.06.26 - 2019.07.02"; //活动的时间 + var bg_time = ut.formar_no_full(th.data.dynamic.beginDate,'.'); + var end_time = ut.formar_no_full(th.data.dynamic.endDate,'.'); + var act_time = bg_time + "-" + end_time; + + + var iurl = th.data.iurl; //图片地址前缀 + const ctx = wx.createCanvasContext('share_id'); //绘图上下文 + var unit = th.data.screenWidth / 750 * 1.35; + var numsize = 20 * unit; //几人助力字体大小 + var head_list_img = th.data.head_pic_arr; + var num = th.data.head_pic_arr.length; //已有几位好友助力 + + var aitem = th.data.aitem; //任务的数据集 + var sw_index = th.data.sw_index; //轮播的下标 + //任务id + var help_num = aitem[sw_index].helpNum; + var q_num = help_num - num; //还差几位好友助力 + var already = num.toString().length + 1; //已有几位好友助力 + var lack = q_num.toString().length + 1; //还差几位好友助力 + + var size = 15 * unit; + var imagesize = 40 * unit; //助力人的图片大小 + var left = 74 * unit; //助力人头像跟左边的距离 + var spacing = 12 * unit; //助力人图片间距 + var images = th.data.images; + ctx.drawImage(images[0], 0, 0, 445 * unit, 700 * unit); //分享的背景图片 + ctx.drawImage(images[1], 37 * unit, 185 * unit, 370 * unit, 377 * unit); //分享的背景图片 + + console.log(111); + console.log(th.data.share_lb_img); + + ctx.drawImage(th.data.share_lb_img, 90 * unit, 231 * unit, 266 * unit, 160 * unit); //分享的礼包的背景图片 + + ctx.setFillStyle("rgb(221,153,116)"); + ctx.setFontSize(size) + ctx.fillText("已有", 77 * unit, 430 * unit); + ctx.setFillStyle("#FF4746"); + ctx.setFontSize(numsize) + ctx.fillText(num + "位", 108 * unit, 430 * unit); + ctx.setFillStyle("rgb(221,153,116)"); + ctx.setFontSize(size) + ctx.fillText("好友助力,还差", 116 * unit + already * numsize * unit, 430 * unit); + ctx.setFillStyle("#FF4746"); + ctx.setFontSize(numsize); + ctx.fillText(q_num + "位", 223 * unit + already * numsize * unit, 430 * unit); + ctx.setFillStyle("rgb(221,153,116)"); + ctx.setFontSize(size); + ctx.fillText("达成助力", 230 * unit + lack * numsize * unit + already * numsize * unit, 430 * unit); + var c = num / help_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 head_list_num = 30; + var is_head_list = 0; + + //当需要助力人数小与6个 + if (help_num < 6) { + var pos_arr = ut.get_box_arr(help_num, 225.25 * unit, 505 * unit, spacing, imagesize / 2); + var now_ind = 0; + //--判断已助力的人数-- + for (var a = 0; a < head_list_img.length; a++) { + var pos = pos_arr[now_ind]; + ut.draw_circle(ctx, pos.x, pos.y, imagesize / 2, head_list_img[a], 'red', unit); + now_ind++; + } + //--显示还差的人数-- + if (help_num - head_list_img.length > 0) { + var neednum = help_num - head_list_img.length; + //这个是还未助力的位置 + for (var i = 0; i < neednum; i++) { + var pos = pos_arr[now_ind]; + now_ind++; + // 助力人的头像 + ctx.drawImage(images[4], pos.x - imagesize / 2, pos.y - imagesize / 2, imagesize, imagesize); //分享的背景图片 + + } + } + + } else if (help_num > 7) { + //助力头像数量, 是不是要显示省略图 + var zl_head = 0, is_sheng = 0; + if (head_list_img.length >= 6) { + zl_head = 5; is_sheng = 1; + } else { + zl_head = head_list_img.length; + } + + + //判断已助力的人数 + for (var a = 0; a < zl_head; a++) { + //绘制头像 + ut.draw_circle(ctx, left + imagesize / 2, 505 * unit, imagesize / 2, head_list_img[a], 'red', unit); + left += imagesize + spacing; + } + + //如果是省略号的话 + if (is_sheng) { + ctx.drawImage(images[5], left, 505 * unit - imagesize / 2, imagesize, imagesize); //头像的省略图片 + } else { + //这个是还未助力的位置 + for (var i = 0; i < 6 - head_list_img.length; i++) { + // 助力人的头像 + ctx.drawImage(images[4], left, 505 * unit - imagesize / 2, imagesize, imagesize); //分享的?号图片 + left += imagesize + spacing; + } + } + } else { + // 判断已助力的人数 + for (var a = 0; a < head_list_img.length; a++) { + ctx.save(); + ctx.beginPath(); //开始绘制 + ctx.arc(left + imagesize / 2, 505 * unit, imagesize / 2, 0, 2 * Math.PI); + ctx.setLineWidth(4 * unit); + ctx.setStrokeStyle('red'); + ctx.setFillStyle("white"); + ctx.fill(); + ctx.clip(); + ctx.drawImage(head_list_img[a], left, 505 * unit - imagesize / 2, imagesize, imagesize); + ctx.restore(); + left += imagesize + spacing; + } + + if (6 - head_list_img.length > 0) { + var neednum = 6 - head_list_img.length; + if(neednum>6) neednum=6; + //这个是还未助力的位置 + for (var i = 0; i < neednum; i++) { + // 助力人的头像 + ctx.drawImage(images[4], left, 505 * unit - imagesize / 2, imagesize, imagesize); //分享的背景图片 + left += imagesize + spacing; + } + } + + } + + ctx.setFillStyle("rgb(255,255,255)"); + ctx.setFontSize(size); + ctx.fillText("优惠乐翻天,精彩就在你身边!", 37 * unit, 595 * unit); + ctx.setFillStyle("rgb(255,255,255)"); + ctx.setFontSize(size); + ctx.fillText(act_time, 37 * unit, 620 * unit); //绘制活动是时间 + ctx.setFillStyle("rgb(255,255,255)"); + ctx.setFontSize(size); + ctx.fillText("长按识别二维码,可帮我助力!", 37 * unit, 660 * unit); + ctx.drawImage(ewm_path, 325 * unit, 585 * unit, 77 * unit, 77 * unit); //分享的背景图片 + ctx.save(); + //读取文件成功则OK-- + // wx.getImageInfo({ + // src: path3, + // success: function (res) { + //把画板内容绘制成图片,并回调 画板图片路径 + ctx.draw(false, function () { + setTimeout(function () { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 300, + height: 500, + destWidth: 400 * 2, + destHeight: 720 * 2, + canvasId: 'share_id', + success: function (res) { + wx.hideLoading(); + var shareImgPath = th.data.shareImgPath; + shareImgPath[0] = res.tempFilePath; + + th.setData({ + shareImgPath: shareImgPath, + canvasHidden: 1, + is_share: 1, + is_generate: 0, + canvasHidden: 1 + }) + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + + }, + fail(r) { + + } + }, 500) + }) + }) + } + }) + + + }, + + + preview: function () { + var th = this; + var shareImgPath = th.data.shareImgPath; + wx.previewImage({ + url: shareImgPath[0], + urls: shareImgPath + }) + th.setData({ + is_share: 0 + }) + }, + + //关闭分享显示 + close_share: function () { + var th = this; + wx.hideLoading(); + th.setData({ + is_share: 0 + }) + }, + syinfo: function () { + var th = this; + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + th.setData({ + screenWidth: res.screenWidth + }) + } + }) + }, + + //把固定的图片加载到本地 + imageinfo: async function () { + var th = this; + var images = th.data.images; + var iurl = th.data.iurl; + for (var i in images) { + var img_path = iurl + images[i]; + await getApp().request.promise_downimg(img_path).then(res => { + images[i] = res; + }) + } + + th.data.images = images; + }, + + + //好友猜一猜 + save_share: function (e) { + var th = this; + var aitem = this.data.aitem; //任务的数据集 + var sw_index = this.data.sw_index; //轮播的下标 + var sw_item = aitem[sw_index]; + //任务id + var taskid = sw_item.id; + th.setData({ + is_share: 1 + }) + wx.showLoading({ + title: "加载中", + }) + var url = "/api/weshop/marketing/help/help/task/involve/page"; + getApp().request.promiseGet(url, { + isShowLoading: false, + data: { + storeId: os.stoid, + taskId: taskid, + userId: getApp().globalData.user_id + } + }).then(res => { + if (res.data.code == 0) { + var data = res.data.data.pageData; //帮拆数组 + if (data.length > 0) { + th.data.dynamic = data[0]; + var path = th.data.iurl + (sw_item.giftBagUrl?sw_item.giftBagUrl:'/miniapp/images/no-head.jpg'); + //先获取礼包分享时的本地路径 + getApp().request.promise_downimg(path).then(res => { + th.data.share_lb_img = res; + //先获取会员的头像 + th.info_head(th.shareFrends); + }); + } + } else { + wx.hideLoading(); + getApp().my_warnning(res.data.msg, 0, th); + } + }) + }, + + //把已助力好友头像下载到本地 + info_head: async function (func) { + var th = this; + var images = th.data.dynamic.zlHelpUser; + var arr = new Array(); + var block = th.data.block; + if (images) { + th.data.head_pic_arr.length = 0; + for (var i in images) { + var img_path = images[i].headPic; + img_path=img_path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); + await getApp().request.promise_downimg(img_path).then(res => { + th.data.head_pic_arr.push(res); + }) + } + } + func(); + }, + //立即兑换 + redeem_now: function (e) { + var libao_id = e.currentTarget.dataset.libaoid; + var sw_index = this.data.sw_index; + var aitem = this.data.aitem; + var taskid = aitem[sw_index].id; + var taskingid = e.currentTarget.dataset.taskingid; + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id=" + taskingid); + }, + + + //礼包的详情 轮播图 + libao_details: function (e) { + var th = this; + var help_id = th.data.help_id; //活动id + var taskId = e.currentTarget.dataset.taskid; //任务id + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId); + }, + + user_task_list_click:function(){ + if (this.data.switch_head==0) return false; + this.data.block=0; + this.user_task_list(); + }, + + go_task:function(e){ + var taskid=e.currentTarget.dataset.taskid; + this.go_to_task(taskid); + + }, + + go_to_task(task_id){ + var index = 0; + var aitem = this.data.aitem; + for(var i=0;i 立即兑换 - - - 测试专用 - + + @@ -67,20 +67,20 @@ - + 我的任务 - + 帮拆记录 - + - + {{item.helpTaskName}} @@ -88,11 +88,11 @@ - {{item.zlHelpNum}}/{{item.helpNum}} + {{item.zlHelpNum}}/{{item.helpNum}} 查看礼包 领取礼包 - + @@ -153,7 +153,6 @@ - @@ -167,4 +166,4 @@ - \ No newline at end of file + diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index b84cdcb..3302ba0 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -174,6 +174,7 @@ page { width: 86%; margin: auto; margin-top: 50rpx; + justify-content: center; } .plan-frame .plan_num { diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 06d59f8..f293086 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -40,6 +40,7 @@ Page({ actId: "", //生日活动的id actImg: "", is_assistance: 0, //助力活动 + ad_img:"", }, goto_nav: function(e) { var th = this; @@ -56,7 +57,18 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { + var th=this; this.birthday(); + getApp().request.promiseGet("/api/weshop/ad/list?pid=401&store_id=" + os.stoid, { + data: { + enabled: 1 + } + }).then(res => { + if(res.data.code==0 && res.data.data){ + var item=res.data.data[0]; + th.setData({ad_img:item.ad_code}) + } + }) }, /** @@ -551,12 +563,12 @@ Page({ }, // 判断生日营销的页面是不是存在 birthday: function() { - + var th = this; rq.get("/api/weshop/marketing/birthday/act/judge", { data: { storeId: os.stoid, userId: app_d.user_id }, success: function (res) { - + var code = res.data.code; if (code == 0) { var giftbagid = res.data.data.giftBagId; @@ -575,7 +587,7 @@ Page({ var th = this; var actId = th.data.actId; var giftbagid = th.data.giftbagid; - + if (actId != "" && giftbagid != "") { getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3); @@ -584,7 +596,7 @@ Page({ getApp().showWarning("请稍后重试"); } }, - // 判断助力活动是不是存在 + // 判断助力活动是不是存在 is_assistance: function() { var th = this; rq.get("/api/weshop/marketing/help/act/judge", { @@ -607,4 +619,4 @@ Page({ -}) \ No newline at end of file +}) diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 1375433..64a77e8 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -1,7 +1,7 @@ - - + + @@ -69,19 +69,19 @@ 加入plus会员预计可省3031元 - + 立即开通 - + 加入plus会员预计可省3031元 - + 立即续费 @@ -232,7 +232,7 @@ 助力活动 - + @@ -262,7 +262,7 @@ - + @@ -290,4 +290,4 @@ - \ No newline at end of file + diff --git a/public/static/images/model/bg.jpg b/public/static/images/model/bg.jpg deleted file mode 100644 index 35849b8..0000000 --- a/public/static/images/model/bg.jpg +++ /dev/null diff --git a/public/static/images/model/bg1.jpg b/public/static/images/model/bg1.jpg deleted file mode 100644 index 3e5f2e1..0000000 --- a/public/static/images/model/bg1.jpg +++ /dev/null diff --git a/utils/util.js b/utils/util.js index 423d6f7..9d8771e 100644 --- a/utils/util.js +++ b/utils/util.js @@ -236,13 +236,13 @@ function check_mobile(phoneMobile){ var ob={code:1}; if (phoneMobile.length === 0) { ob.title='输入的手机号为空'; - ob.code=-1; + ob.code=-1; } else if (phoneMobile.length < 11) { ob.title ='手机号长度有误!'; - ob.code = -1; + ob.code = -1; } else if (!myreg.test(phoneMobile)) { ob.title = '手机号格式有误!'; - ob.code = -1; + ob.code = -1; } return ob; } @@ -280,31 +280,31 @@ function draw_randon_rect(ctx,x,y,r,w,h){ // ctx.setStrokeStyle('transparent') // 左上角 ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5) - + // border-top ctx.moveTo(x + r, y) ctx.lineTo(x + w - r, y) ctx.lineTo(x + w, y + r) // 右上角 ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2) - + // border-right ctx.lineTo(x + w, y + h - r) ctx.lineTo(x + w - r, y + h) // 右下角 ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5) - + // border-bottom ctx.lineTo(x + r, y + h) ctx.lineTo(x, y + h - r) // 左下角 ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI) - + // border-left ctx.lineTo(x, y + r) - ctx.lineTo(x + r, y) + ctx.lineTo(x + r, y) // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 - ctx.fill(); + ctx.fill(); } /** @@ -324,7 +324,7 @@ function get_box_arr(num,x,y,sp,r){ /** * @param {Object} ctx 画图句柄 - * @param {Object} x x坐标 + * @param {Object} x x坐标 * @param {Object} y y坐标 * @param {Object} img 画的图片 * @param {Object} color 边框的颜色 @@ -345,7 +345,7 @@ function draw_circle(ctx,x,y,r,img,color,unit){ function null_promise(){ - var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise; + var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise; } module.exports = { @@ -371,9 +371,11 @@ module.exports = { for (var o in n) new RegExp("(" + o + ")").test(r) && (r = r.replace(RegExp.$1, 1 == RegExp.$1.length ? n[o] : ("00" + n[o]).substr(("" + n[o]).length))); return r; }, - formar_no_full(e){ + formar_no_full(e,char){ var t= new Date(1e3 * e); - return t.getFullYear() +"-"+(t.getMonth() + 1)+"-"+t.getDate(); + var c="-"; + if(char) c=char; + return t.getFullYear() +c+(t.getMonth() + 1)+c+t.getDate(); }, json2Form: function(e) { @@ -442,7 +444,7 @@ module.exports = { sub_last: sub_last,//去掉末尾一个字符 measureText: measureText,//画布需要的函数 check_mobile: check_mobile,//验证手机 - get_rand_item:get_rand_item, //随机获取元素 + get_rand_item:get_rand_item, //随机获取元素 getDistance:getDistance, //获取俩个经纬网度之间的距离 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形 null_promise:null_promise,//返回空的promise