Merged
Merge Request #285 · created by 后端研发-苏明海


Test


From test into qa

Merged by 后端研发-苏明海

1 participants






app.json
... ... @@ -89,8 +89,12 @@
89 89 "pages/giftpack/mygiftpack/mygiftpack",
90 90  
91 91 "pages/user/assistance/giftpacklist",
92   - "pages/user/assistance/task_assistance"
  92 + "pages/user/assistance/task_assistance",
  93 + "pages/user/assistance/friend_assistance",
  94 + "pages/user/assistance/assistance_success",
  95 + "pages/user/assistance/assistance",
93 96  
  97 + "pages/test/zhuli_test"
94 98  
95 99 ],
96 100 "permission": {
... ...
components/diy_advertising/diy_advertising.js
... ... @@ -12,8 +12,8 @@ Component({
12 12 yc:false,
13 13 btn: 1,
14 14 ad:false,
15   - autoplay:false,
16   - interval:5000,
  15 + autoplay:true,
  16 + interval:3000,
17 17 duration:1000,
18 18 someData: {},
19 19 max_sw_height:null,
... ... @@ -36,4 +36,4 @@ Component({
36 36 if (this.data.max_sw_height < viewHeight) this.setData({ max_sw_height: viewHeight });
37 37 }
38 38 }
39   -})
40 39 \ No newline at end of file
  40 +})
... ...
components/diy_picMax/diy_picMax.wxss
1 1 .picMax{width: 100%;position: relative;}
2   -.pic_item{display: inline-block; top:0;left:0;vertical-align: middle}
  2 +.pic_item{display: block; top:0;left:0;float:left}
3 3 .pic_item image{width: 100%; height: 100%}
4 4 .width_1{width: 187.5rpx}.width_2{width: 375rpx;}.width_3{width: 562.5rpx}.width_4{width:748rpx;}
5 5 /* .height_1{height: 187.5rpx;}.height_2{height: 375rpx;}.height_3{height: 562.5rpx}.height_4{height: 748rpx;} */
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -439,7 +439,6 @@ Page({
439 439 'content-type': 'application/json'
440 440 },// 设置请求的 header
441 441 success: function (res) {
442   -
443 442 th.data.is_summit_ing=0; //是否提交中
444 443 wx.hideLoading();
445 444 if (res.statusCode == 200) {
... ... @@ -469,7 +468,8 @@ Page({
469 468 util_pay.pay(data.data, function() {
470 469 setTimeout(function () {
471 470 wx.navigateTo({
472   - url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
  471 + //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
  472 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
473 473 })
474 474 },1000)
475 475 }, function () {
... ...
pages/getphone/getphone.js
... ... @@ -54,9 +54,11 @@ Page({
54 54 //接下来写业务代码登录
55 55 //最后,记得返回刚才的页面
56 56 if (e.encryptedData==undefined){
  57 + /*---
57 58 wx.navigateTo({
58 59 url: '/pages/user/binding_info/binding_info',
59   - })
  60 + })--*/
  61 + return app.my_warnning("登录需要授权手机号码!", 0, that);
60 62 return false;
61 63 }
62 64 var r=getApp().globalData.getu;
... ... @@ -105,6 +107,7 @@ Page({
105 107  
106 108 },
107 109 failStatus: function (t) {
  110 + /*---
108 111 return "100" === t.data.result ? (i.goHome(), wx.navigateTo({
109 112 url: "/pages/user/binding_info/binding_info?nickName=" + r.nickName + "&userHeadPic=" + r.avatarUrl
110 113 }), !1) : (i.clearAuth(), i.alertLoginErrorAndGoHome(t.data.msg), a.request.post("/api/user/logout", {
... ... @@ -115,7 +118,8 @@ Page({
115 118 failStatus: function () {
116 119 return !1;
117 120 }
118   - }), !1);
  121 + }), !1);--*/
  122 + return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
119 123 },
120 124 fail: function (t) {
121 125 return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1;
... ...
pages/getphone/getphone.json
1 1 {
2   - "navigationBarTitleText": "绑定手机"
  2 + "navigationBarTitleText": "绑定手机",
  3 + "usingComponents": {
  4 + "warn": "/components/long_warn/long_warn"
  5 + }
3 6 }
... ...
pages/getphone/getphone.wxml
... ... @@ -6,4 +6,5 @@
6 6 <button class="btn" open-type="getPhoneNumber" bindgetphonenumber="getphone">绑定会员</button>
7 7 <text class="btn2" bindtap="cancle_bind">暂不绑定</text>
8 8 </view>
9   -</view>
10 9 \ No newline at end of file
  10 +</view>
  11 +<warn id="warn"></warn>
11 12 \ No newline at end of file
... ...
pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -315,10 +315,20 @@ Page({
315 315 bind_bnerr2: function(e) {
316 316 var _errImg = e.target.dataset.errorimg;
317 317 var _errObj = {};
318   - _errObj[_errImg] = "/public/images/empty.jpg";
  318 + _errObj[_errImg] = "/miniapp/images/giftbag/gift01.png";
319 319 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  320 + },
  321 +
  322 + //图片失败,默认图片
  323 + bind_bnerr: function (e) {
  324 + var _errImg = e.target.dataset.errorimg;
  325 + var _errObj = {};
  326 + _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg";
  327 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  328 + //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"});
320 329  
321 330 },
  331 +
322 332 //关闭导航
323 333 close: function() {
324 334 var th = this;
... ...
pages/giftpack/giftpacklist/giftpacklist.wxml
1 1 <view class="box data-v-3a5b7e36">
2 2 <view class="box_top data-v-3a5b7e36">
3   - <image src="{{giftImage}}" class="data-v-3a5b7e36" lazy-load="true" binderror="bind_bnerr2" data-errorimg="giftImage"></image>
  3 + <image src="{{giftImage}}" class="data-v-3a5b7e36" lazy-load="true" binderror="bind_bnerr" data-errorimg="giftImage"></image>
4 4 </view>
5 5 <view class="box_title data-v-3a5b7e36">
6 6 <view class="top_title data-v-3a5b7e36">
... ...
pages/giftpack/giftpacklist/giftpacklist.wxss
... ... @@ -96,6 +96,7 @@
96 96 border: 2rpx solid #999;
97 97 width: 120rpx;
98 98 height: 120rpx;
  99 + background-color: #f8f8f8;
99 100 }
100 101  
101 102 .box_ware_item.data-v-3a5b7e36 {
... ... @@ -241,4 +242,4 @@ page.data-v-3a5b7e36 {
241 242 }
242 243 .overdue.data-v-3a5b7e36{
243 244 background-color: rgb(153,153,153);
244   -}
245 245 \ No newline at end of file
  246 +}
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -2601,6 +2601,14 @@ Page({
2601 2601  
2602 2602 //--定义的保存图片方法,分享团---
2603 2603 saveImageToPhotosAlbum: function() {
  2604 + //--先判断会员状态--
  2605 + var user_info = getApp().globalData.userInfo;
  2606 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  2607 + //getApp().my_warnning("请先登录",0,this);
  2608 + wx.navigateTo({ url: '/pages/getphone/getphone', })
  2609 + return false;
  2610 + }
  2611 +
2604 2612 //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团
2605 2613 var type = this.data.prom_type;
2606 2614 if (type == 6) type = 2;
... ...
pages/test/zhuli_test.js 0 → 100644
  1 +var e = getApp(),
  2 + a = e.globalData.setting,
  3 + os = a;
  4 +var regeneratorRuntime = require('../../utils/runtime.js');
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + iurl: a.imghost, //图片地址前缀\
  12 + taskId:0,
  13 + mobile:0,
  14 + },
  15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + onLoad: function(options) {
  19 + wx.setNavigationBarTitle({
  20 + title: "测试帮忙助力",
  21 + })
  22 + var th = this;
  23 + var taskId=options.taskId;
  24 + this.data.taskId=taskId;
  25 + },
  26 +
  27 + getphoneValue:function(e){
  28 + this.data.mobile=e.detail.value;
  29 + },
  30 + //测试正在进行任务
  31 + bindReg:async function () {
  32 + var userinfo=null;
  33 + await getApp().request.promiseGet("/api/weshop/users/page",{
  34 + data:{mobile:this.data.mobile,store_id:os.stoid}
  35 + }).then(res=>{
  36 + userinfo=res.data.data.pageData[0];
  37 + })
  38 + if(!userinfo) {
  39 + getApp().my_warnning("未找到会员",0,this); return false;
  40 + }
  41 +
  42 + var task=null;
  43 + await getApp().request.promiseGet("/api/weshop/marketing/help/help/task/get",{
  44 + data:{taskId:this.data.taskId,storeId:os.stoid,userId:userinfo.user_id}
  45 + }).then(res=>{
  46 + task=res.data.data;
  47 + })
  48 + if(!task) {
  49 + getApp().my_warnning("未找任务",0,this); return false;
  50 + }
  51 +
  52 + if(task.status!=0){
  53 + getApp().my_warnning("任务不是进行中",0,this); return false;
  54 + }
  55 + var taking=task.id;
  56 + getApp().goto("/pages/user/assistance/friend_assistance?tasking=" + taking + "&userId=" + userinfo.user_id);
  57 + },
  58 +
  59 +
  60 +})
... ...
pages/test/zhuli_test.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "助力测试专用",
  3 + "usingComponents": {
  4 + "warn": "/components/long_warn/long_warn"
  5 + }
  6 +}
0 7 \ No newline at end of file
... ...
pages/test/zhuli_test.wxml 0 → 100644
  1 +<view class="index">
  2 +
  3 + <!-- 发送验证码登录注册 -->
  4 + <view class="sr">
  5 + <view class="inputs fs30">
  6 + <!-- 手机号码 -->
  7 + <view class="flex rel phone_view">
  8 + <image src="{{iurl}}/mddmscp/regico1.jpg" class="tubiao_set"></image>
  9 + <input class="input_phone" type="number" placeholder="请输入手机号码" placeholder-style="color:rgb(190,190,190);"
  10 + maxlength="11" bindinput="getphoneValue"></input>
  11 + </view>
  12 + </view>
  13 + <!-- 点击注册 -->
  14 + <view class="flex-center fs30 reg_btn" bindtap="bindReg">
  15 + <view class="userlogin flex-center on">
  16 + <view>去帮忙助力</view>
  17 + </view>
  18 + </view>
  19 + </view>
  20 +</view>
  21 +
  22 +<warn id="warn"></warn>
... ...
pages/test/zhuli_test.wxss 0 → 100644
  1 +page{
  2 + border-top: 3rpx solid #EAEAEC;
  3 +}
  4 +.index {
  5 + position: absolute; width: 100%;
  6 + z-index: 1;
  7 +}
  8 +
  9 +.logins {
  10 + width: 100%;
  11 + padding-top: 60rpx;
  12 + padding-bottom: 120rpx;
  13 +}
  14 +
  15 +.login_img {
  16 + width: 192rpx;
  17 + height: 192rpx;
  18 + border-radius: 50%
  19 +}
  20 +
  21 +.input_phone {
  22 + height: 55rpx;
  23 + line-height: 55rpx;
  24 + margin-left:10rpx ;
  25 + position: relative; top:10rpx
  26 +}
  27 +
  28 +.input_code {
  29 + width: 360rpx;
  30 + height: 55rpx;
  31 + line-height: 55rpx;
  32 + border-radius: 12rpx;
  33 + margin-right: 20rpx;
  34 + border: 3rpx solid rgb(230, 230, 230);
  35 + padding-left: 40rpx;
  36 + color:#ef8179
  37 +}
  38 +
  39 +.codes {
  40 + margin-bottom: 65rpx;
  41 +}
  42 +
  43 +.get_code {
  44 + width: 176rpx;
  45 + height: 65rpx;
  46 + line-height: 65rpx;
  47 + border:1rpx solid rgb(236, 109, 95);
  48 + color: #ed7067;
  49 + border-radius: 12rpx;
  50 + right: 0;
  51 + top:5rpx;
  52 +}
  53 +
  54 +.userlogin {
  55 + width: 100%;
  56 + height: 95rpx;
  57 + line-height: 95rpx;
  58 + background-color: #ffc5c0;
  59 + color: rgb(255, 255, 255);
  60 + margin-bottom: 30rpx;
  61 + margin-top: 50rpx
  62 + }
  63 +
  64 +.userlogin.on{
  65 + background-color: #eb6359;
  66 +}
  67 +
  68 +.go_index {
  69 + color: #9d9d9d;
  70 + margin-bottom: 300rpx;
  71 +}
  72 +
  73 +.sr {
  74 + width: 90%; margin: 0 auto;
  75 +}
  76 +
  77 +.checkbox {
  78 + width: 25rpx;
  79 + height: 25rpx;
  80 + color: rgb(0, 0, 0);
  81 + margin-right: 50rpx;
  82 + margin-bottom: 30rpx
  83 +}
  84 +
  85 +.agrs {
  86 + padding: 0rpx 65rpx;
  87 +}
  88 +
  89 +.agreement {
  90 + color: rgb(236, 109, 95);
  91 + display: initial;
  92 +}
  93 +
  94 +.popup {
  95 + position: fixed;
  96 + z-index: 10;
  97 + background-color: rgba(153, 153, 153, 0.568);
  98 + height: 100%;
  99 + width: 100%;
  100 +}
  101 +
  102 +.content {
  103 + max-height: 800rpx;
  104 +min-height: 100rpx;
  105 +padding: 60rpx 35rpx;
  106 +background-color: rgb(255, 255, 255);
  107 +width: 570rpx;
  108 +margin-bottom: 70rpx;
  109 +overflow-y: scroll;
  110 +border-radius: 15rpx;
  111 +line-height: 50rpx;
  112 +font-size: 26rpx;
  113 +color: #545454;
  114 +
  115 +
  116 +}
  117 +
  118 +.close {
  119 + width: 65rpx;
  120 + height: 65rpx;
  121 +}
  122 +
  123 +.xy {
  124 + display: initial;color: #9c9c9c; line-height: 34rpx
  125 +}
  126 +
  127 +.get_code.on{
  128 + color: #666;
  129 +}
  130 +.tubiao_set{
  131 + width: 50rpx; height: 64rpx; margin-right:30rpx; position: relative; top:5rpx;
  132 +}
  133 +.tubiao_set2{
  134 + width: 46rpx; height: 64rpx; margin-right:34rpx;
  135 +}
  136 +.phone_view{
  137 + border-bottom:1rpx solid #e8e8e8 ;
  138 + height: 96rpx; margin-top:50rpx
  139 +
  140 +}
  141 +.phone_view.mt{
  142 + margin-top:20rpx
  143 +}
  144 +.reg_btn{
  145 + margin-top:40rpx; margin-bottom: 20rpx
  146 +}
... ...
pages/user/assistance/assistance.js
... ... @@ -20,7 +20,7 @@ Page({
20 20 switch_head: 0, //0:我的任务,1:活动说明
21 21 zl_act: null, //助力活动
22 22 zl_user_list: [], //任务列表
23   - is_load: 0, //是否已经加载
  23 + is_load: 0, //是否已经加载
24 24 cur_page: 1, //页码
25 25 page_num: 5, //每页多少个
26 26 is_show_more: 0, //是否加载更多
... ... @@ -37,15 +37,16 @@ Page({
37 37 var th = this;
38 38 var nav_b = th.selectComponent("#nav_b"); //组件的id
39 39 nav_b.set_name("助力", "/pages/user/assistance/assistance");
40   - // 助力活动
41   - th.assistance();
  40 +
42 41 },
43 42  
44 43 /**
45 44 * 生命周期函数--监听页面显示
46 45 */
47 46 onShow: function() {
48   -
  47 + var th = this;
  48 + // 助力活动
  49 + th.assistance();
49 50 },
50 51 // 助力活动
51 52 assistance() {
... ... @@ -80,7 +81,7 @@ Page({
80 81 }
81 82 return ut.null_promise();
82 83 }).then(res => {
83   - if (res.data.code == 0)
  84 + if ( res && res.data &&res.data.code == 0)
84 85 th.setData({
85 86 s_num: res.data.data.countAll
86 87 })
... ... @@ -94,7 +95,9 @@ Page({
94 95  
95 96 var th = this;
96 97 var page = th.data.page;
  98 + if(page==1)th.data.zl_user_list=[];
97 99 var help_id = this.data.help_id;
  100 + var r=Math.random()*100;
98 101 t.request.get("/api/weshop/marketing/help/help/user/page", {
99 102 isShowLoading: true,
100 103 data: {
... ... @@ -102,7 +105,8 @@ Page({
102 105 storeId: os.stoid,
103 106 helpId: help_id,
104 107 page: page,
105   - pageSize: 5
  108 + pageSize: 5,
  109 + r:r,
106 110 },
107 111 success: function(res) {
108 112 clearTimeout(th.data.timer);
... ... @@ -113,7 +117,7 @@ Page({
113 117 })
114 118 if (res.data.code == 0) {
115 119 var list = th.data.zl_user_list;
116   - //连接数组
  120 + //连接数组
117 121 list = list.concat(res.data.data.pageData);
118 122 th.setData({
119 123 zl_user_list: list,
... ... @@ -131,7 +135,7 @@ Page({
131 135 })
132 136 }
133 137 } else {
134   - getApp().my_warnning(res.data.msg, 0, th);
  138 + //getApp().my_warnning(res.data.msg, 0, th);
135 139 th.setData({
136 140 is_show_more: 1,
137 141 page: page
... ... @@ -178,6 +182,13 @@ Page({
178 182 select_libao: function(e) {
179 183 var orderSn = e.currentTarget.dataset.ordersn; //订单号
180 184 getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn);
  185 + },
  186 +
  187 + //---查看任务---
  188 + go_to_task:function (e) {
  189 + var help_id = this.data.help_id;
  190 + var taskid=e.currentTarget.dataset.taskid;
  191 + getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id+"&taskid="+taskid);
181 192 }
182 193  
183   -})
184 194 \ No newline at end of file
  195 +})
... ...
pages/user/assistance/assistance.wxml
... ... @@ -53,7 +53,7 @@
53 53 <view class="flex-center width state" wx:if="{{item.status==1}}">
54 54 <view class="ellipsis-1" bindtap="get_libao" data-help_id="{{item.helpFormId}}" data-taskId="{{item.helpTaskId}}" data-id="{{item.id}}">领取礼包</view>
55 55 </view>
56   - <view class="flex-center width state" wx:if="{{item.status==0}}">
  56 + <view class="flex-center width state" wx:if="{{item.status==0}}" data-taskId="{{item.helpTaskId}}" bindtap="go_to_task">
57 57 <view class="ellipsis-1">{{item.zlHelpNum}}/{{item.helpNum}}</view>
58 58 </view>
59 59 <view class="flex-center width state" wx:if="{{item.status==2}}">
... ... @@ -107,4 +107,4 @@
107 107 <!-- 引入提示组件 -->
108 108 <warn id="warn"></warn>
109 109 <!-- 制作一个圆球导航 -->
110   -<nav_b id="nav_b"></nav_b>
111 110 \ No newline at end of file
  111 +<nav_b id="nav_b"></nav_b>
... ...
pages/user/assistance/assistance_success.js
... ... @@ -18,23 +18,25 @@ Page({
18 18 * 生命周期函数--监听页面加载
19 19 */
20 20 onLoad: function (options) {
21   - //var helpid=options.helpid;
22   - var helpid=23;
  21 + var helpid=options.helpid;
23 22 this.init(helpid);
  23 + var nav_b = this.selectComponent("#nav_b"); //组件的id
  24 + nav_b.set_name("助力", "/pages/user/assistance/assistance");
  25 +
24 26 },
25 27 /**
26 28 * 生命周期函数--监听页面显示
27 29 */
28 30 onShow: function (e) {
29   -
  31 +
30 32 },
31 33  
32 34 // ----初始化----
33   - init:function(helpid) {
  35 + init:function(helpid) {
34 36 var user_id = getApp().globalData.user_id;
35 37 var store_id = os.stoid;
36 38 var th=this;
37   -
  39 +
38 40 //链式调用接口,先获取活动,在获取参与活动的人数
39 41 getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", {
40 42 data: {
... ... @@ -49,10 +51,10 @@ Page({
49 51 storeId: store_id,
50 52 helpId: helpid
51 53 }
52   - })
  54 + })
53 55 }
54 56 return ut.null_promise();
55   -
  57 +
56 58 }).then(res=>{
57 59 if(res.data.code==0){
58 60 th.setData({s_num:res.data.data.countAll});
... ... @@ -70,6 +72,6 @@ Page({
70 72 },
71 73  
72 74 cklie_button:function(){
73   - getApp().goto("/pages/user/assistance/assistance")
  75 + getApp().goto("/pages/user/assistance/assistance")
74 76 }
75   -})
76 77 \ No newline at end of file
  78 +})
... ...
pages/user/assistance/friend_assistance.js
... ... @@ -21,6 +21,7 @@ Page({
21 21 userId: 0, //任务用户的ID
22 22 s_num: 0, //分享的人数
23 23 taskId:0, //活动从表ID
  24 + helpId:0,
24 25 },
25 26  
26 27 /**
... ... @@ -28,64 +29,24 @@ Page({
28 29 */
29 30 onLoad: function(options) {
30 31 var th = this;
31   -
  32 +
  33 + var nav_b = th.selectComponent("#nav_b"); //组件的id
  34 + nav_b.set_name("助力", "/pages/user/assistance/assistance");
  35 +
32 36 if (options.tasking) this.data.tasking = options.tasking;
33 37 if (options.userId) this.data.userId = options.userId;
34 38 //任务是不是为空
35 39 if (this.data.tasking == 0 || this.data.tasking == undefined) {
36   - this.data.tasking = decodeURIComponent(options.scene);
  40 + this.data.tasking = decodeURIComponent(options.scene);
37 41 }
38   -
39   - if (this.data.tasking != null && this.data.tasking != 'undefined' && this.data.tasking != "" && this.data.tasking !=
40   - 0) {
41   -
42   - getApp().request.promiseGet("/api/weshop/marketing/help/help/tasking/get", {
43   - data: {
44   - taskingId: th.data.tasking,
45   - storeId: os.stoid
46   - }
47   - }).then(res => {
48   - if (res.data.code == 0) {
49   - th.data.userId = res.data.data.userId;
50   - th.data.taskId = res.data.data.taskId;
51   - //获取活动的时间
52   - return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", {
53   - data: {
54   - helpId: res.data.data.helpFormId,
55   - storeId: os.stoid
56   - }
57   - })
58   - }
59   - return ut.null_promise();
60   - }).then(res => {
61   - if (res.data.code == 0) {
62   - th.setData({
63   - zl_act: res.data.data
64   - })
65   - //获取活动的参与的人数
66   - return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", {
67   - data: {
68   - helpId: res.data.data.id,
69   - storeId: os.stoid
70   - }
71   - })
72   - }
73   - return ut.null_promise();
74   - }).then(res => {
75   - if (res.data.code == 0) {
76   - th.setData({
77   - s_num: res.data.data.countAll
78   - });
79   - }
80   - })
81   -
82   - }
  42 + getApp().getUserFir(function() {});
  43 +
83 44 },
84 45  
85 46 // 跳转到助力成功页
86 47 participate_activity: function() {
87 48 wx.navigateTo({
88   - url: '/pages/user/assistance/assistance_success',
  49 + url: '/pages/user/assistance/assistance_success?helpid='+this.data.helpId,
89 50 })
90 51 },
91 52  
... ... @@ -93,11 +54,63 @@ Page({
93 54 * 生命周期函数--监听页面显示
94 55 */
95 56 onShow: function() {
  57 + if (this.data.tasking != null && this.data.tasking != 'undefined' && this.data.tasking != "" && this.data.tasking !=
  58 + 0) {
  59 +
  60 + getApp().request.promiseGet("/api/weshop/marketing/help/help/tasking/get", {
  61 + data: {
  62 + taskingId: th.data.tasking,
  63 + storeId: os.stoid
  64 + }
  65 + }).then(res => {
  66 + if (res.data.code == 0) {
  67 + th.data.userId = res.data.data.userId;
  68 + th.data.taskId = res.data.data.taskId;
  69 + th.data.helpId=res.data.data.helpFormId;
  70 + //获取活动的时间
  71 + return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", {
  72 + data: {
  73 + helpId: res.data.data.helpFormId,
  74 + storeId: os.stoid
  75 + }
  76 + })
  77 + }
  78 + return ut.null_promise();
  79 + }).then(res => {
  80 + if (res.data.code == 0) {
  81 + th.setData({
  82 + zl_act: res.data.data
  83 + })
  84 + //获取活动的参与的人数
  85 + return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", {
  86 + data: {
  87 + helpId: res.data.data.id,
  88 + storeId: os.stoid
  89 + }
  90 + })
  91 + }
  92 + return ut.null_promise();
  93 + }).then(res => {
  94 + if (res && res.data && res.data.code == 0) {
  95 + th.setData({
  96 + s_num: res.data.data.countAll
  97 + });
  98 + }
  99 + })
96 100  
  101 + }
97 102 },
98 103 //点击开启礼盒
99 104 cklie_button: function() {
100 105 var th = this;
  106 + //--先判断会员状态--
  107 + var user_info = getApp().globalData.userInfo;
  108 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  109 + wx.navigateTo({
  110 + url: '/pages/getphone/getphone',
  111 + })
  112 + return false;
  113 + }
101 114 var t_user_id = app_d.user_id;
102 115 var data = {
103 116 id: this.data.tasking,
... ... @@ -126,7 +139,7 @@ Page({
126 139 //点击关闭礼盒
127 140 clike_none: function() {
128 141 this.setData({is_show: 0});
129   - getApp().goto("/pages/user/assistance/assistance_success");
  142 + getApp().goto("/pages/user/assistance/assistance_success?helpid="+this.data.helpId);
130 143 },
131 144 //导航球
132 145 close: function() {
... ...
pages/user/assistance/giftpacklist.js
... ... @@ -210,7 +210,8 @@ Page({
210 210 var json = {
211 211 "actId": th.data.id, //活动Id
212 212 "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
213   - "giftBagId": 1, //礼包Id
  213 + //"giftBagId": 1, //礼包Id
  214 + "giftBagId": th.giftBagId, //礼包Id
214 215 "storeId": a.stoid, //商家Id
215 216 "userId": d.user_id //用户ID
216 217 };
... ... @@ -334,14 +335,25 @@ Page({
334 335 bind_bnerr2: function(e) {
335 336 var _errImg = e.target.dataset.errorimg;
336 337 var _errObj = {};
337   - _errObj[_errImg] = "/public/images/empty.jpg";
338   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  338 + _errObj[_errImg] ="/miniapp/images/giftbag/gift01.png";
  339 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
339 340  
340 341 },
  342 +
  343 + //图片失败,默认图片
  344 + bind_bnerr: function (e) {
  345 + var _errImg = e.target.dataset.errorimg;
  346 + var _errObj = {};
  347 + _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg";
  348 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  349 + //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"});
  350 +
  351 + },
  352 +
341 353 //关闭导航
342 354 close: function() {
343 355 var th = this;
344 356 var nav_b = th.selectComponent("#nav_b"); //组件的id
345 357 nav_b.close_box();
346 358 }
347   -});
348 359 \ No newline at end of file
  360 +});
... ...
pages/user/assistance/giftpacklist.wxml
1 1 <view wx:if="{{is_head}}" class="box data-v-3a5b7e36" bindtap="close">
2 2 <view class="box_top data-v-3a5b7e36">
3   - <image src="{{giftImage}}" class="data-v-3a5b7e36" lazy-load="true" binderror="bind_bnerr2" data-errorimg="giftImage"></image>
  3 + <image src="{{giftImage}}" class="data-v-3a5b7e36" data-i='{{giftImage}}' lazy-load="true" binderror="bind_bnerr" data-errorimg="giftImage"></image>
4 4 </view>
5 5 <view class="box_title data-v-3a5b7e36">
6 6 <view class="top_title data-v-3a5b7e36">
... ... @@ -105,9 +105,13 @@
105 105 <view class="foot_button data-v-3a5b7e36">
106 106 <block wx:if="{{is_type!=0}}">
107 107 <block wx:if="{{is_type==1}}">
108   - <view class="foot_button_buy data-v-3a5b7e36" bindtap="GetReceive">
  108 + <view class="foot_button_buy data-v-3a5b7e36" bindtap="GetReceive" wx:if="{{!receiveState}}">
109 109 <text class="data-v-3a5b7e36">一键全部领取</text>
110 110 </view>
  111 +
  112 + <view class="foot_button_buy data-v-3a5b7e36 on" bindtap="GetReceive" wx:else>
  113 + <text class="data-v-3a5b7e36">已领取</text>
  114 + </view>
111 115 </block>
112 116 <block wx:if="{{is_type==2}}">
113 117 <block wx:if="{{is_lb!=1}}">
... ... @@ -141,4 +145,4 @@
141 145 <!-- 弹出框扫描 -->
142 146 <qr_code id="qc_com"></qr_code>
143 147 <!-- 制作一个圆球导航 -->
144   -<nav_b id="nav_b"></nav_b>
145 148 \ No newline at end of file
  149 +<nav_b id="nav_b"></nav_b>
... ...
pages/user/assistance/giftpacklist.wxss
... ... @@ -96,6 +96,7 @@
96 96 border: 2rpx solid #999;
97 97 width: 120rpx;
98 98 height: 120rpx;
  99 + background-color:#f8f8f8;
99 100 /* background-color: rgba(153, 153, 153, 0.664); */
100 101 }
101 102  
... ... @@ -219,6 +220,10 @@
219 220 border-radius: 40rpx;
220 221 }
221 222  
  223 +.foot_button_buy.data-v-3a5b7e36.on{
  224 + background-color: gainsboro; color: #666;
  225 +}
  226 +
222 227 .foot_button_intalge.data-v-3a5b7e36 {
223 228 background: #ffbb42;
224 229 color: #fff;
... ...
pages/user/assistance/task_assistance.js
  1 +var auth = require("../../../utils/auth.js"),
  2 + rq = require("../../../utils/request.js");
  3 +var e = getApp(),
  4 + app = e,
  5 + i = require("../../../utils/util.js"),
  6 + ut = i,
  7 + s = e.globalData.setting,
  8 + os = s,
  9 + app_d = e.globalData;
  10 +var regeneratorRuntime = require('../../../utils/runtime.js');
  11 +Page({
  12 + /**
  13 + * 页面的初始数据
  14 + */
  15 + data: {
  16 + swpie_img: s.imghost + "/miniapp/images/user_index_powder.jpg",
  17 + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg",//助力头像的默认图
  18 + sw_index: 0, //轮播的下标控制
  19 + url: s.url, //接口网址
  20 + iurl: s.imghost,
  21 + endDate: "", //活动结束时间
  22 + activity_data: "25:20:59", //活动剩余时间
  23 + task_number: 0, //任务数
  24 + is_task: 0, //历史记录与任务
  25 + aitem: "", //活动的轮播图数据
  26 + switch_head: 0, //0:我的任务,1:记录
  27 + help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成
  28 + gid: "",
  29 + timer: null, //全局的定时器
  30 + user_task_list: [], //会员列表
  31 + taskid: "", //任务id
  32 + usercount: 0, //参与的人数
  33 + dismantle: [], //帮拆记录数据集
  34 + is_user_task: null, //判断是不是领取的任务
  35 + zzjx_id: "", //真正进行的任务id
  36 + is_show: 0, //任务的加载更多
  37 + is_bc_show: 0, //帮拆的加载更多
  38 + bc_page: 1, //帮拆的页码
  39 + rw_page: 1, //任务的页码
  40 + block: 0, //阻断助力的我的任务在当前位置多次点击
  41 + is_dismantle: 0, //阻断助力的帮拆记录在当前位置多次点击
  42 + is_clik: 0,//点击的时候控制划动
  43 + is_dis_list: 0,//多个数据的时候
  44 + is_user_list: 0,//我的任务点击加载更多的后
  45 +
  46 + //*********************************************start钱
  47 + canvasHidden: 0, //分享图片是否已经生成
  48 + is_share: 0, //是否显示画布
  49 + shareImgPath: [], //生成的图片
  50 + screenWidth: "", //用户的屏幕宽度
  51 + gid: "",
  52 + images: ["miniapp/images/friendhelp/help.png", "miniapp/images/friendhelp/background.png", "miniapp/images/friendhelp/no_check.png",
  53 + "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/unfinished.png", "miniapp/images/xc_ellipsis.png"
  54 + ], //固的分享图片
  55 +
  56 + dynamic: null, //已助力的微信头像数组
  57 + head_pic_arr: [], //助力的头像
  58 + share_lb_img: "", //分享的礼包图片
  59 +
  60 + is_generate: 0, //是否重复点击拆一拆
  61 + already: 0, //已有几人助力
  62 + lack: 0, //还差几人助力
  63 + zltime: "", //助力时间
  64 + djs: "", //定时器的显示
  65 + //*********************************************end
  66 + },
  67 +
  68 + /**
  69 + * 生命周期函数--监听页面加载
  70 + */
  71 + onLoad: function (options) {
  72 + var th = this;
  73 + var help_id = options.help_id;
  74 + var nav_b = th.selectComponent("#nav_b"); //组件的id
  75 + nav_b.set_name("助力", "/pages/user/assistance/assistance");
  76 + th.setData({
  77 + help_id: help_id
  78 + });
  79 + //start 钱
  80 + if (options.gid != undefined) {
  81 + th.setData({
  82 + gid: options.gid
  83 + })
  84 + }
  85 + if (options.taskid != undefined) {
  86 + th.setData({taskid:options.taskid})
  87 + }
  88 +
  89 + th.close();
  90 + th.syinfo();
  91 + th.imageinfo();
  92 +
  93 + },
  94 +
  95 +
  96 + //选中任务保存
  97 + add_onlicke: function (e) {
  98 + var th = this;
  99 + var taskid = e.target.dataset.taskid;
  100 + var help_id = th.data.help_id;
  101 + var user_id = getApp().globalData.user_id;
  102 + var stoid = os.stoid
  103 + getApp().request.json_post("/api/weshop/marketing/help/help/task/insert", {
  104 + helpId: help_id,
  105 + userId: user_id,
  106 + storeId: stoid,
  107 + taskId: taskid
  108 + },
  109 + function (res) {
  110 + if (res.data.code == 0) {
  111 + getApp().my_warnning(res.data.data, 1, th);
  112 + //判断是不是领取的任务
  113 + th.get_user_task();
  114 + //会员任务列表
  115 + th.user_task_list();
  116 + } else {
  117 + getApp().my_warnning(res.data.msg, 0, th);
  118 + }
  119 + }
  120 +
  121 + )
  122 +
  123 + },
  124 +
  125 +
  126 +
  127 + /**
  128 + * 生命周期函数--监听页面初次渲染完成
  129 + */
  130 + onReady: function () {
  131 +
  132 + },
  133 +
  134 + /**
  135 + * 生命周期函数--监听页面显示
  136 + */
  137 + onShow: function () {
  138 + this.data.is_timer = 1;
  139 + var th = this;
  140 + var help_id = th.data.help_id;
  141 + var user_id = getApp().globalData.user_id;
  142 +
  143 + /*-----助力活动(判断)-----*/
  144 + rq.get("/api/weshop/marketing/help/act/judge", {
  145 + data: {
  146 + userId: user_id,
  147 + storeId: os.stoid
  148 + },
  149 + success: function (res) {
  150 + if (res.data.code == 0) {
  151 + var help_data = res.data.data;
  152 + th.setData({
  153 + endDate: help_data.endDate,
  154 + });
  155 +
  156 + //任务时间 设置全局定时器
  157 + th.setData({
  158 + timer: setInterval(function () {
  159 + th.countDown();
  160 + }, 1000)
  161 + })
  162 +
  163 +
  164 + }
  165 + }
  166 + });
  167 +
  168 +
  169 + /*-----获取助力活动的任务-----*/
  170 + rq.get("/api/weshop/marketing/help/help/task/page", {
  171 + data: {
  172 + helpId: help_id,
  173 + storeId: os.stoid
  174 + },
  175 + success: function (su) {
  176 + var data = su.data;
  177 + if (data.code != 0) {
  178 + getApp().my_warnning(data.msg, 0, th);
  179 + return false;
  180 + }
  181 + if (data.code == 0) {
  182 + //轮播图的数据
  183 + var data_aissa = data.data.pageData;
  184 + //当前时间戳
  185 + var nt = ut.gettimestamp();
  186 +
  187 + data_aissa.forEach(function (val, ind) {
  188 + //已开始
  189 + if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0;
  190 + //未开始
  191 + else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1;
  192 + //已结束
  193 + else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2;
  194 + });
  195 + var task_number = data_aissa[0].giftQty - data_aissa[0].useGiftQty;
  196 + var taskid = data_aissa[0].id;
  197 + if(th.data.taskid) {
  198 + th.setData({
  199 + aitem: data_aissa,
  200 + task_number: task_number,
  201 + });
  202 + th.go_to_task(th.data.taskid);
  203 +
  204 + }else{
  205 + th.setData({
  206 + aitem: data_aissa,
  207 + task_number: task_number,
  208 + taskid: taskid
  209 + });
  210 + //判断是不是领取的任务
  211 + th.get_user_task();
  212 + }
  213 + }
  214 +
  215 + }
  216 + })
  217 +
  218 + // 分享的
  219 + // setTimeout(function() {
  220 + // th.shareFrends();
  221 + // }, 1000)
  222 +
  223 + //会员任务列表
  224 + this.user_task_list();
  225 + //获取助力活动参与的人数
  226 + this.get_user_task_num();
  227 +
  228 + },
  229 + //记录加载更多
  230 + dismantle_record_list: function () {
  231 + this.setData({ is_dismantle: 0 });
  232 + this.dismantle_record();
  233 + },
  234 +
  235 + dismantle_record_click(){
  236 + if(this.data.switch_head==1) return false;
  237 + this.setData({ is_dismantle: 0 });
  238 + this.dismantle_record();
  239 + },
  240 +
  241 + //帮拆记录的
  242 + dismantle_record: function (e) {
  243 + //优化
  244 + if (this.data.is_dismantle == 1) {
  245 + return false;
  246 + }
  247 +
  248 + var aitem = this.data.aitem; //任务的数据集
  249 + var sw_index = this.data.sw_index; //轮播的下标
  250 + //任务id
  251 + var taskid = aitem[sw_index].id;
  252 + var th = this;
  253 + var index = 1; //获取当前选择的是任务还是活动说明
  254 + var is_task = this.data.is_task; //0任务,1帮拆
  255 + if (is_task == undefined || is_task == null) {
  256 + is_task = 1;
  257 + }
  258 + var switch_head = this.data.switch_head;
  259 + if (switch_head == undefined || switch_head == null) {
  260 + switch_head = 1;
  261 + }
  262 + this.setData({
  263 + is_task: 1,
  264 + switch_head: 1,
  265 + block: 0,
  266 + });
  267 +
  268 + var bc_page = th.data.bc_page;
  269 + rq.get("/api/weshop/marketing/help/help/task/involve/page", {
  270 + data: {
  271 + page: bc_page,
  272 + pageSize: 5,
  273 + taskId: taskid,
  274 + userId: getApp().globalData.user_id,
  275 + storeId: os.stoid
  276 + },
  277 + success: function (res) {
  278 + if (res.data.code == 0) {
  279 + th.setData({ is_dismantle: 1 });
  280 + var dismantle = res.data.data.pageData[0].zlHelpUser;
  281 + if (res.data.data.total > 5) {
  282 + var bc_page = th.data.bc_page + 1;
  283 + var dismantle_s = th.data.dismantle.concat(dismantle);
  284 + th.setData({
  285 + bc_page: bc_page,
  286 + is_bc_show: 1,
  287 + dismantle: dismantle_s,
  288 + is_dis_list: 1
  289 + })
  290 + } else {
  291 + th.setData({
  292 + dismantle: dismantle,
  293 + is_dis_list: 0
  294 + });
  295 + }
  296 + var dis_len = th.data.dismantle.length;
  297 + if (res.data.data.total == dis_len) {
  298 + th.setData({
  299 + is_dis_list: 0,
  300 + })
  301 + }
  302 + th.setData({
  303 +
  304 + is_clik: 0,
  305 + });
  306 + } else {
  307 + th.setData({
  308 + dismantle: null
  309 + });
  310 + }
  311 + }
  312 +
  313 + })
  314 + },
  315 + // 领取礼包
  316 + get_libao: function (e) {
  317 + var libao_id = e.currentTarget.dataset.libaoid; //礼包id
  318 + var taskid = e.currentTarget.dataset.taskid;
  319 + var taskingid = e.currentTarget.dataset.taskingid;
  320 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id=" + taskingid);
  321 + },
  322 + //查看礼包id
  323 + select_libao: function (e) {
  324 + var orderSn = e.currentTarget.dataset.ordersn;
  325 + getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn);
  326 + },
  327 +
  328 + //划动的时候监听
  329 + onSli: function (e) {
  330 + var arr = [];
  331 + this.setData({
  332 + dismantle: arr
  333 + });
  334 + var th = this;
  335 + var ind = e.detail.current;
  336 + var aitem = this.data.aitem;
  337 + var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty;
  338 + var task_id = aitem[ind].id;
  339 + th.setData({
  340 + sw_index: ind,
  341 + task_number: task_number,
  342 + taskid: task_id,
  343 + is_dismantle: 0,
  344 + bc_page: 1
  345 + });
  346 +
  347 + if (this.data.switch_head == 1 && th.data.is_clik == 0) {
  348 + //判断有没有帮拆记录
  349 + this.dismantle_record();
  350 + }
  351 + //判断是不是领取的任务
  352 + th.get_user_task();
  353 +
  354 + },
  355 + //导航球
  356 + close: function () {
  357 + var th = this;
  358 + var nav_b = th.selectComponent("#nav_b"); //组件的id
  359 + nav_b.close_box();
  360 + },
  361 + //我的任务点击加载更多
  362 + task_list: function () {
  363 + this.setData({ block: 0 });
  364 + this.user_task_list();
  365 + },
  366 + // 获取会员的参与的任务列表 我的任务
  367 + user_task_list: function (e) {
  368 + var th = this;
  369 + //防止已经当前位置的时候多次点击
  370 + if (th.data.block == 1) { return false; }
  371 + th.data.block=1;
  372 + var index = 0;
  373 + var is_task = this.data.is_task; //0任务,1帮拆
  374 + if (is_task == undefined || is_task == null) {
  375 + is_task = 0;
  376 + }
  377 + var switch_head = this.data.switch_head;
  378 + if (switch_head == undefined || switch_head == null) {
  379 + switch_head = 0;
  380 + }
  381 + this.setData({
  382 + is_task: index,
  383 + switch_head: index,
  384 + user_task_list:[],
  385 + });
  386 + var help_id = th.data.help_id;
  387 + var user_id = getApp().globalData.user_id;
  388 + var rw_page = th.data.rw_page;
  389 + if(rw_page==1)th.data.zl_user_list=[];
  390 + var r=Math.random()*100;
  391 + rq.get("/api/weshop/marketing/help/help/user/page", {
  392 + data: {
  393 + page: rw_page,
  394 + pageSize: 5,
  395 + helpId: help_id,
  396 + storeId: os.stoid,
  397 + userId: user_id,
  398 + r:r,
  399 + },
  400 + success: function (su) {
  401 + th.data.block=0
  402 + if (su.data.code == 0) {
  403 + if (su.data.data.total > 5) {
  404 + var rw_page = th.data.rw_page + 1;
  405 + th.setData({
  406 + rw_page: rw_page,
  407 + is_show: 1
  408 + })
  409 +
  410 + }
  411 +
  412 +
  413 + var user_list = su.data.data.pageData;
  414 + // if (user_list == "" || user_list.length == 0 || user_list==null){
  415 + // th.setData({
  416 + // is_user_list: 1
  417 + // });
  418 + // console.log("走哪里1111");
  419 + // }else{}
  420 + console.log("走哪里22222222");
  421 + var user_lists = th.data.user_task_list.concat(user_list);
  422 + th.setData({
  423 + user_task_list: user_lists
  424 + });
  425 + } else {
  426 + th.setData({ is_user_list: 1 });
  427 + //getApp().my_warnning(su.data.msg, 0, th);
  428 + }
  429 + }
  430 + })
  431 + },
  432 + //判断是否有领取任务 获取正在进行中的任务
  433 + get_user_task: function () {
  434 + var user_id = getApp().globalData.user_id;
  435 + var th = this;
  436 + var aitem = th.data.aitem;
  437 + var sw_index = th.data.sw_index;
  438 + var taskid = aitem[sw_index].id
  439 + rq.get("/api/weshop/marketing/help/help/task/get", {
  440 + data: {
  441 + storeId: os.stoid,
  442 + userId: user_id,
  443 + taskId: taskid
  444 + },
  445 + success: function (res) {
  446 + if (res.data.code == 0) {
  447 + var is_usertask = res.data.data;
  448 + th.setData({
  449 + is_user_task: is_usertask
  450 + });
  451 + }
  452 + }
  453 + })
  454 + },
  455 + //获取助力活动参与的人数
  456 + get_user_task_num: function () {
  457 + var th = this;
  458 + var help_id = th.data.help_id;
  459 + rq.get("/api/weshop/marketing/help/involve/help/act/people/count", {
  460 + data: {
  461 + helpId: help_id,
  462 + storeId: os.stoid,
  463 + },
  464 + success: function (su) {
  465 + if (su.data.code == 0) {
  466 + var usercount = su.data.data.countAll;
  467 +
  468 + th.setData({
  469 + usercount: usercount
  470 + });
  471 + }
  472 + }
  473 + })
  474 +
  475 + },
  476 + //轮播卡死的重置
  477 + changeGoodsSwip: function (detail) {
  478 + if (detail.detail.source == "touch") {
  479 + //当页面卡死的时候,current的值会变成0
  480 + if (detail.detail.current == 0) {
  481 + //有时候这算是正常情况,所以暂定连续出现3次就是卡了
  482 + let swiperError = this.data.swiperError
  483 + swiperError += 1
  484 + this.setData({
  485 + swiperError: swiperError
  486 + })
  487 + if (swiperError >= 3) { //在开关被触发3次以上
  488 + this.setData({
  489 + sw_index: this.data.preIndex
  490 + }); //,重置current为正确索引
  491 + this.setData({
  492 + swiperError: 0
  493 + })
  494 + }
  495 + } else { //正常轮播时,记录正确页码索引
  496 + this.setData({
  497 + preIndex: detail.detail.current
  498 + });
  499 + //将开关重置为0
  500 + this.setData({
  501 + swiperError: 0
  502 + })
  503 + }
  504 + }
  505 + },
  506 +
  507 + // 轮播图点击左边
  508 + click_pre: function () {
  509 + var arr = [];
  510 + this.setData({
  511 + dismantle: arr
  512 + });
  513 + var index = this.data.sw_index;
  514 + index--;
  515 + if (index < 0) return;
  516 + var aitem = this.data.aitem;
  517 + var task_number = aitem[index].giftQty - aitem[index].useGiftQty;
  518 + var task_id = aitem[index].id;
  519 + this.setData({
  520 + sw_index: index,
  521 + task_number: task_number,
  522 + taskid: task_id,
  523 + is_dismantle: 0,
  524 + is_clik: 1,
  525 + bc_page: 1
  526 + })
  527 + if (this.data.switch_head == 1) {
  528 + //判断有没有帮拆记录
  529 + console.log("往左点////////////////////");
  530 + this.dismantle_record();
  531 + }
  532 + if (this.data.switch_head == 0) {
  533 + //判断有没有领取任务
  534 + this.get_user_task();
  535 + }
  536 +
  537 + },
  538 + //轮播图点击右边
  539 + click_next: function () {
  540 + var arr = [];
  541 + this.setData({
  542 + is_clik: 1,
  543 + dismantle: arr
  544 + });
  545 + var index = this.data.sw_index;
  546 + index++;
  547 + if (index >= this.data.aitem.length) return;
  548 + var aitem = this.data.aitem;
  549 + var task_number = aitem[index].giftQty - aitem[index].useGiftQty;
  550 + var task_id = aitem[index].id;
  551 + this.setData({
  552 + sw_index: index,
  553 + task_number: task_number,
  554 + taskid: task_id,
  555 + is_dismantle: 0,
  556 + bc_page: 1,
  557 + })
  558 + if (this.data.switch_head == 1) {
  559 + this.dismantle_record();
  560 + }
  561 + },
  562 +
  563 + /**
  564 + * 生命周期函数--监听页面隐藏
  565 + */
  566 + onHide: function () {
  567 + //--清理定时器--
  568 + clearInterval(this.data.timer);
  569 + },
  570 +
  571 + /**
  572 + * 生命周期函数--监听页面卸载
  573 + */
  574 + onUnload: function () {
  575 +
  576 + },
  577 +
  578 + /**
  579 + * 页面相关事件处理函数--监听用户下拉动作
  580 + */
  581 + onPullDownRefresh: function () {
  582 +
  583 + },
  584 + //----助力任务的时间-----
  585 + countDown() {
  586 + if (!this.data.is_timer) return false;
  587 + var th = this;
  588 + // 获取当前时间,同时得到活动结束时间数组
  589 + var newTime = ut.gettimestamp();
  590 +
  591 + // 对结束时间进行处理渲染到页面
  592 +
  593 + // var o = endTimeList[i];
  594 + var endTime = th.data.endDate;
  595 + // if (o.status == 0) endTime = o.start_time
  596 +
  597 + var obj = null;
  598 + // 如果活动未结束,对时间进行处理
  599 + if (endTime - newTime > 0) {
  600 + var time = (endTime - newTime);
  601 + // 获取天、时、分、秒
  602 + var day = parseInt(time / (60 * 60 * 24));
  603 + var hou = parseInt(time % (60 * 60 * 24) / 3600);
  604 + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  605 + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  606 + obj = {
  607 + day: this.timeFormat(day),
  608 + hou: this.timeFormat(hou),
  609 + min: this.timeFormat(min),
  610 + sec: this.timeFormat(sec)
  611 + }
  612 + } else {
  613 + //活动已结束,全部设置为'00'
  614 + obj = {
  615 + day: '00',
  616 + hou: '00',
  617 + min: '00',
  618 + sec: '00'
  619 + }
  620 + }
  621 + var txt = "aitem[" + 0 + "].djs";
  622 + th.setData({
  623 + [txt]: obj
  624 + });
  625 + },
  626 + //---小于10的格式化函数----
  627 + timeFormat(param) {
  628 + return param < 10 ? '0' + param : param;
  629 + },
  630 +
  631 + /**
  632 + * 页面上拉触底事件的处理函数
  633 + */
  634 + onReachBottom: function () {
  635 +
  636 + },
  637 +
  638 + /**
  639 + * 用户点击右上角分享
  640 + */
  641 + onShareAppMessage: function () {
  642 +
  643 + },
  644 +
  645 + preview: function () {
  646 + var th = this;
  647 + var shareImgPath = th.data.shareImgPath;
  648 + wx.previewImage({
  649 + url: shareImgPath[0],
  650 + urls: shareImgPath
  651 + })
  652 + },
  653 +
  654 + //关闭分享显示
  655 + close_share: function () {
  656 + var th = this;
  657 + th.setData({
  658 + is_share: 0
  659 + })
  660 + },
  661 + syinfo: function () {
  662 + var th = this;
  663 + //获取用户设备信息,屏幕宽度
  664 + wx.getSystemInfo({
  665 + success: res => {
  666 + th.setData({
  667 + screenWidth: res.screenWidth
  668 + })
  669 + }
  670 + })
  671 + },
  672 +
  673 +
  674 +
  675 + //************************ */
  676 + shareFrends: function (e) {
  677 + var th = this;
  678 + if (th.data.is_generate) return;
  679 + th.data.is_generate = 1;
  680 +
  681 + var scene = this.data.is_user_task.id;
  682 + ///二微码
  683 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  684 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/assistance/friend_assistance";
  685 + //读取文件成功则OK--
  686 + wx.getImageInfo({
  687 + src: path3,
  688 + success: function (res) {
  689 +
  690 + var ewm_path = res.path; //
  691 + //var act_time="2019.06.26 - 2019.07.02"; //活动的时间
  692 + var bg_time = ut.formar_no_full(th.data.dynamic.beginDate,'.');
  693 + var end_time = ut.formar_no_full(th.data.dynamic.endDate,'.');
  694 + var act_time = bg_time + "-" + end_time;
  695 +
  696 +
  697 + var iurl = th.data.iurl; //图片地址前缀
  698 + const ctx = wx.createCanvasContext('share_id'); //绘图上下文
  699 + var unit = th.data.screenWidth / 750 * 1.35;
  700 + var numsize = 20 * unit; //几人助力字体大小
  701 + var head_list_img = th.data.head_pic_arr;
  702 + var num = th.data.head_pic_arr.length; //已有几位好友助力
  703 +
  704 + var aitem = th.data.aitem; //任务的数据集
  705 + var sw_index = th.data.sw_index; //轮播的下标
  706 + //任务id
  707 + var help_num = aitem[sw_index].helpNum;
  708 + var q_num = help_num - num; //还差几位好友助力
  709 + var already = num.toString().length + 1; //已有几位好友助力
  710 + var lack = q_num.toString().length + 1; //还差几位好友助力
  711 +
  712 + var size = 15 * unit;
  713 + var imagesize = 40 * unit; //助力人的图片大小
  714 + var left = 74 * unit; //助力人头像跟左边的距离
  715 + var spacing = 12 * unit; //助力人图片间距
  716 + var images = th.data.images;
  717 + ctx.drawImage(images[0], 0, 0, 445 * unit, 700 * unit); //分享的背景图片
  718 + ctx.drawImage(images[1], 37 * unit, 185 * unit, 370 * unit, 377 * unit); //分享的背景图片
  719 +
  720 + console.log(111);
  721 + console.log(th.data.share_lb_img);
  722 +
  723 + ctx.drawImage(th.data.share_lb_img, 90 * unit, 231 * unit, 266 * unit, 160 * unit); //分享的礼包的背景图片
  724 +
  725 + ctx.setFillStyle("rgb(221,153,116)");
  726 + ctx.setFontSize(size)
  727 + ctx.fillText("已有", 77 * unit, 430 * unit);
  728 + ctx.setFillStyle("#FF4746");
  729 + ctx.setFontSize(numsize)
  730 + ctx.fillText(num + "位", 108 * unit, 430 * unit);
  731 + ctx.setFillStyle("rgb(221,153,116)");
  732 + ctx.setFontSize(size)
  733 + ctx.fillText("好友助力,还差", 116 * unit + already * numsize * unit, 430 * unit);
  734 + ctx.setFillStyle("#FF4746");
  735 + ctx.setFontSize(numsize);
  736 + ctx.fillText(q_num + "位", 223 * unit + already * numsize * unit, 430 * unit);
  737 + ctx.setFillStyle("rgb(221,153,116)");
  738 + ctx.setFontSize(size);
  739 + ctx.fillText("达成助力", 230 * unit + lack * numsize * unit + already * numsize * unit, 430 * unit);
  740 + var c = num / help_num;
  741 + ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit);
  742 + ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit);
  743 + var head_list_num = 30;
  744 + var is_head_list = 0;
  745 +
  746 + //当需要助力人数小与6个
  747 + if (help_num < 6) {
  748 + var pos_arr = ut.get_box_arr(help_num, 225.25 * unit, 505 * unit, spacing, imagesize / 2);
  749 + var now_ind = 0;
  750 + //--判断已助力的人数--
  751 + for (var a = 0; a < head_list_img.length; a++) {
  752 + var pos = pos_arr[now_ind];
  753 + ut.draw_circle(ctx, pos.x, pos.y, imagesize / 2, head_list_img[a], 'red', unit);
  754 + now_ind++;
  755 + }
  756 + //--显示还差的人数--
  757 + if (help_num - head_list_img.length > 0) {
  758 + var neednum = help_num - head_list_img.length;
  759 + //这个是还未助力的位置
  760 + for (var i = 0; i < neednum; i++) {
  761 + var pos = pos_arr[now_ind];
  762 + now_ind++;
  763 + // 助力人的头像
  764 + ctx.drawImage(images[4], pos.x - imagesize / 2, pos.y - imagesize / 2, imagesize, imagesize); //分享的背景图片
  765 +
  766 + }
  767 + }
  768 +
  769 + } else if (help_num > 7) {
  770 + //助力头像数量, 是不是要显示省略图
  771 + var zl_head = 0, is_sheng = 0;
  772 + if (head_list_img.length >= 6) {
  773 + zl_head = 5; is_sheng = 1;
  774 + } else {
  775 + zl_head = head_list_img.length;
  776 + }
  777 +
  778 +
  779 + //判断已助力的人数
  780 + for (var a = 0; a < zl_head; a++) {
  781 + //绘制头像
  782 + ut.draw_circle(ctx, left + imagesize / 2, 505 * unit, imagesize / 2, head_list_img[a], 'red', unit);
  783 + left += imagesize + spacing;
  784 + }
  785 +
  786 + //如果是省略号的话
  787 + if (is_sheng) {
  788 + ctx.drawImage(images[5], left, 505 * unit - imagesize / 2, imagesize, imagesize); //头像的省略图片
  789 + } else {
  790 + //这个是还未助力的位置
  791 + for (var i = 0; i < 6 - head_list_img.length; i++) {
  792 + // 助力人的头像
  793 + ctx.drawImage(images[4], left, 505 * unit - imagesize / 2, imagesize, imagesize); //分享的?号图片
  794 + left += imagesize + spacing;
  795 + }
  796 + }
  797 + } else {
  798 + // 判断已助力的人数
  799 + for (var a = 0; a < head_list_img.length; a++) {
  800 + ctx.save();
  801 + ctx.beginPath(); //开始绘制
  802 + ctx.arc(left + imagesize / 2, 505 * unit, imagesize / 2, 0, 2 * Math.PI);
  803 + ctx.setLineWidth(4 * unit);
  804 + ctx.setStrokeStyle('red');
  805 + ctx.setFillStyle("white");
  806 + ctx.fill();
  807 + ctx.clip();
  808 + ctx.drawImage(head_list_img[a], left, 505 * unit - imagesize / 2, imagesize, imagesize);
  809 + ctx.restore();
  810 + left += imagesize + spacing;
  811 + }
  812 +
  813 + if (6 - head_list_img.length > 0) {
  814 + var neednum = 6 - head_list_img.length;
  815 + if(neednum>6) neednum=6;
  816 + //这个是还未助力的位置
  817 + for (var i = 0; i < neednum; i++) {
  818 + // 助力人的头像
  819 + ctx.drawImage(images[4], left, 505 * unit - imagesize / 2, imagesize, imagesize); //分享的背景图片
  820 + left += imagesize + spacing;
  821 + }
  822 + }
  823 +
  824 + }
  825 +
  826 + ctx.setFillStyle("rgb(255,255,255)");
  827 + ctx.setFontSize(size);
  828 + ctx.fillText("优惠乐翻天,精彩就在你身边!", 37 * unit, 595 * unit);
  829 + ctx.setFillStyle("rgb(255,255,255)");
  830 + ctx.setFontSize(size);
  831 + ctx.fillText(act_time, 37 * unit, 620 * unit); //绘制活动是时间
  832 + ctx.setFillStyle("rgb(255,255,255)");
  833 + ctx.setFontSize(size);
  834 + ctx.fillText("长按识别二维码,可帮我助力!", 37 * unit, 660 * unit);
  835 + ctx.drawImage(ewm_path, 325 * unit, 585 * unit, 77 * unit, 77 * unit); //分享的背景图片
  836 + ctx.save();
  837 + //读取文件成功则OK--
  838 + // wx.getImageInfo({
  839 + // src: path3,
  840 + // success: function (res) {
  841 + //把画板内容绘制成图片,并回调 画板图片路径
  842 + ctx.draw(false, function () {
  843 + setTimeout(function () {
  844 + wx.canvasToTempFilePath({
  845 + x: 0,
  846 + y: 0,
  847 + width: 300,
  848 + height: 500,
  849 + destWidth: 400 * 2,
  850 + destHeight: 720 * 2,
  851 + canvasId: 'share_id',
  852 + success: function (res) {
  853 + wx.hideLoading();
  854 + var shareImgPath = th.data.shareImgPath;
  855 + shareImgPath[0] = res.tempFilePath;
  856 +
  857 + th.setData({
  858 + shareImgPath: shareImgPath,
  859 + canvasHidden: 1,
  860 + is_share: 1,
  861 + is_generate: 0,
  862 + canvasHidden: 1
  863 + })
  864 + if (!res.tempFilePath) {
  865 + wx.showModal({
  866 + title: '提示',
  867 + content: '图片绘制中,请稍后重试',
  868 + showCancel: false
  869 + })
  870 + return false;
  871 + }
  872 +
  873 + },
  874 + fail(r) {
  875 +
  876 + }
  877 + }, 500)
  878 + })
  879 + })
  880 + }
  881 + })
  882 +
  883 +
  884 + },
  885 +
  886 +
  887 + preview: function () {
  888 + var th = this;
  889 + var shareImgPath = th.data.shareImgPath;
  890 + wx.previewImage({
  891 + url: shareImgPath[0],
  892 + urls: shareImgPath
  893 + })
  894 + th.setData({
  895 + is_share: 0
  896 + })
  897 + },
  898 +
  899 + //关闭分享显示
  900 + close_share: function () {
  901 + var th = this;
  902 + wx.hideLoading();
  903 + th.setData({
  904 + is_share: 0
  905 + })
  906 + },
  907 + syinfo: function () {
  908 + var th = this;
  909 + //获取用户设备信息,屏幕宽度
  910 + wx.getSystemInfo({
  911 + success: res => {
  912 + th.setData({
  913 + screenWidth: res.screenWidth
  914 + })
  915 + }
  916 + })
  917 + },
  918 +
  919 + //把固定的图片加载到本地
  920 + imageinfo: async function () {
  921 + var th = this;
  922 + var images = th.data.images;
  923 + var iurl = th.data.iurl;
  924 + for (var i in images) {
  925 + var img_path = iurl + images[i];
  926 + await getApp().request.promise_downimg(img_path).then(res => {
  927 + images[i] = res;
  928 + })
  929 + }
  930 +
  931 + th.data.images = images;
  932 + },
  933 +
  934 +
  935 + //好友猜一猜
  936 + save_share: function (e) {
  937 + var th = this;
  938 + var aitem = this.data.aitem; //任务的数据集
  939 + var sw_index = this.data.sw_index; //轮播的下标
  940 + var sw_item = aitem[sw_index];
  941 + //任务id
  942 + var taskid = sw_item.id;
  943 + th.setData({
  944 + is_share: 1
  945 + })
  946 + wx.showLoading({
  947 + title: "加载中",
  948 + })
  949 + var url = "/api/weshop/marketing/help/help/task/involve/page";
  950 + getApp().request.promiseGet(url, {
  951 + isShowLoading: false,
  952 + data: {
  953 + storeId: os.stoid,
  954 + taskId: taskid,
  955 + userId: getApp().globalData.user_id
  956 + }
  957 + }).then(res => {
  958 + if (res.data.code == 0) {
  959 + var data = res.data.data.pageData; //帮拆数组
  960 + if (data.length > 0) {
  961 + th.data.dynamic = data[0];
  962 + var path = th.data.iurl + (sw_item.giftBagUrl?sw_item.giftBagUrl:'/miniapp/images/no-head.jpg');
  963 + //先获取礼包分享时的本地路径
  964 + getApp().request.promise_downimg(path).then(res => {
  965 + th.data.share_lb_img = res;
  966 + //先获取会员的头像
  967 + th.info_head(th.shareFrends);
  968 + });
  969 + }
  970 + } else {
  971 + wx.hideLoading();
  972 + getApp().my_warnning(res.data.msg, 0, th);
  973 + }
  974 + })
  975 + },
  976 +
  977 + //把已助力好友头像下载到本地
  978 + info_head: async function (func) {
  979 + var th = this;
  980 + var images = th.data.dynamic.zlHelpUser;
  981 + var arr = new Array();
  982 + var block = th.data.block;
  983 + if (images) {
  984 + th.data.head_pic_arr.length = 0;
  985 + for (var i in images) {
  986 + var img_path = images[i].headPic;
  987 + img_path=img_path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  988 + await getApp().request.promise_downimg(img_path).then(res => {
  989 + th.data.head_pic_arr.push(res);
  990 + })
  991 + }
  992 + }
  993 + func();
  994 + },
  995 + //立即兑换
  996 + redeem_now: function (e) {
  997 + var libao_id = e.currentTarget.dataset.libaoid;
  998 + var sw_index = this.data.sw_index;
  999 + var aitem = this.data.aitem;
  1000 + var taskid = aitem[sw_index].id;
  1001 + var taskingid = e.currentTarget.dataset.taskingid;
  1002 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id=" + taskingid);
  1003 + },
  1004 +
  1005 +
  1006 + //礼包的详情 轮播图
  1007 + libao_details: function (e) {
  1008 + var th = this;
  1009 + var help_id = th.data.help_id; //活动id
  1010 + var taskId = e.currentTarget.dataset.taskid; //任务id
  1011 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId);
  1012 + },
  1013 +
  1014 + user_task_list_click:function(){
  1015 + if (this.data.switch_head==0) return false;
  1016 + this.data.block=0;
  1017 + this.user_task_list();
  1018 + },
  1019 +
  1020 + go_task:function(e){
  1021 + var taskid=e.currentTarget.dataset.taskid;
  1022 + this.go_to_task(taskid);
  1023 +
  1024 + },
  1025 +
  1026 + go_to_task(task_id){
  1027 + var index = 0;
  1028 + var aitem = this.data.aitem;
  1029 + for(var i=0;i<aitem.length;i++){
  1030 + if(aitem[i].id==task_id){
  1031 + index=i;break;
  1032 + }
  1033 + }
  1034 +
  1035 + //当是助力首页跳转过来的
  1036 + if(index==this.data.sw_index){
  1037 + this.get_user_task();
  1038 + }
  1039 +
  1040 + this.setData({
  1041 + sw_index: index,
  1042 + taskid: task_id,
  1043 + is_dismantle: 0,
  1044 + bc_page: 1,
  1045 + })
  1046 +
  1047 +
  1048 + },
  1049 +
  1050 + //--测试用--
  1051 + test:function(){
  1052 + var ind=this.data.sw_index;
  1053 + var aitem = this.data.aitem;
  1054 + var task_id = aitem[ind].id;
  1055 + getApp().goto("/pages/test/zhuli_test?taskId="+task_id);
  1056 + }
  1057 +
  1058 +})
... ...
pages/user/assistance/task_assistance.wxml
... ... @@ -55,11 +55,11 @@
55 55 <view wx:if="{{is_user_task!=null&&is_user_task.status==1}}" class="task_clike fs40 t-c flex-center" data-libaoid="{{is_user_task.helpListGiftBagId}}"data-taskingid="{{is_user_task.id}}" bindtap="redeem_now">
56 56 立即兑换
57 57 </view>
58   - <view wx:if="{{is_user_task!=null&&is_user_task.status==0}}" class="task_clike fs40 t-c flex-center"data-taskid="{{is_user_task.id}}" bindtap="test">
59   - <!-- <input placeholder="请输助力用户的id" maxlength="11" bindblur="testinput"></input>
60   - <view ></view> -->
61   - 测试专用
62   - </view>
  58 +
  59 + <!--
  60 + <view class="task_clike fs40 t-c flex-center" bindtap="test">
  61 + 测试专用帮被人拆
  62 + </view>-->
63 63  
64 64 </view>
65 65 <!-- 底部列表 -->
... ... @@ -67,20 +67,20 @@
67 67 <!-- 标题 -->
68 68  
69 69 <view class="flex-vertical-between fs28 padding head">
70   - <view class="flex-center lhead {{switch_head==0?'rhead':''}}" bindtap="user_task_list" data-index="0">
  70 + <view class="flex-center lhead {{switch_head==0?'rhead':''}}" bindtap="user_task_list_click" data-index="0">
71 71 <image class="unfinished" src="{{iurl}}miniapp/images/friendhelp/task.png" lazy-load="true"></image>
72 72 <view>我的任务</view>
73 73 </view>
74   - <view class="flex-center lhead {{switch_head==1?'rhead':''}}" bindtap="dismantle_record" data-index='1'>
  74 + <view class="flex-center lhead {{switch_head==1?'rhead':''}}" bindtap="dismantle_record_click" data-index='1'>
75 75 <image class="unfinished" style="margin-top: 5rpx;" src="{{iurl}}miniapp/images/friendhelp/edit.png" lazy-load="true"></image>
76 76 <view>帮拆记录</view>
77 77 </view>
78 78 </view>
79 79  
80 80 <view class="white">
81   -
  81 +
82 82 <view class="items" wx:if="{{is_task==0}}">
83   - <view class="tesk_list">
  83 + <view class="tesk_list">
84 84 <view class="item fs26 flex-vertical-between padding" wx:for="{{user_task_list}}" wx:key="*this">
85 85 <view class="flex-center width">
86 86 <view class="ellipsis-1">{{item.helpTaskName}}
... ... @@ -88,11 +88,11 @@
88 88 </view>
89 89 <view class="flex-center width state">
90 90 <view class="ellipsis-1">
91   - <text wx:if="{{item.status==0}}">{{item.zlHelpNum}}/{{item.helpNum}}</text>
  91 + <text wx:if="{{item.status==0}}" bindtap="go_task" data-taskid="{{item.helpTaskId}}">{{item.zlHelpNum}}/{{item.helpNum}}</text>
92 92 <text wx:if="{{item.status==2}}" bindtap="select_libao" data-orderSn="{{item.orderSn}}">查看礼包</text>
93 93 <text wx:if="{{item.status==1}}" bindtap="get_libao" data-libaoid="{{item.helpListGiftBagId}}"data-taskingid="{{item.id}}" data-taskid="{{item.helpTaskId}}">领取礼包 </text>
94 94 </view>
95   - </view>
  95 + </view>
96 96 </view>
97 97 </view>
98 98  
... ... @@ -153,7 +153,6 @@
153 153  
154 154 <!--********** 钱巧玲 -->
155 155 <view wx:if="{{is_share}}">
156   -
157 156 <view class="dust"></view>
158 157 <view class="canvas" style="width:100%;">
159 158 <view class="flex-center">
... ... @@ -167,4 +166,4 @@
167 166 <!-- 引入提示组件 -->
168 167 <warn id="warn"></warn>
169 168 <!-- 制作一个圆球导航 -->
170   -<nav_b id="nav_b"></nav_b>
171 169 \ No newline at end of file
  170 +<nav_b id="nav_b"></nav_b>
... ...
pages/user/assistance/task_assistance.wxss
... ... @@ -174,6 +174,7 @@ page {
174 174 width: 86%;
175 175 margin: auto;
176 176 margin-top: 50rpx;
  177 + justify-content: center;
177 178 }
178 179  
179 180 .plan-frame .plan_num {
... ...
pages/user/index/index.js
... ... @@ -40,6 +40,7 @@ Page({
40 40 actId: "", //生日活动的id
41 41 actImg: "",
42 42 is_assistance: 0, //助力活动
  43 + ad_img:"",
43 44 },
44 45 goto_nav: function(e) {
45 46 var th = this;
... ... @@ -56,7 +57,18 @@ Page({
56 57 * 生命周期函数--监听页面加载
57 58 */
58 59 onLoad: function(options) {
  60 + var th=this;
59 61 this.birthday();
  62 + getApp().request.promiseGet("/api/weshop/ad/list?pid=401&store_id=" + os.stoid, {
  63 + data: {
  64 + enabled: 1
  65 + }
  66 + }).then(res => {
  67 + if(res.data.code==0 && res.data.data){
  68 + var item=res.data.data[0];
  69 + th.setData({ad_img:item.ad_code})
  70 + }
  71 + })
60 72 },
61 73  
62 74 /**
... ... @@ -551,12 +563,12 @@ Page({
551 563 },
552 564 // 判断生日营销的页面是不是存在
553 565 birthday: function() {
554   -
  566 +
555 567 var th = this;
556 568 rq.get("/api/weshop/marketing/birthday/act/judge", {
557 569 data: { storeId: os.stoid, userId: app_d.user_id },
558 570 success: function (res) {
559   -
  571 +
560 572 var code = res.data.code;
561 573 if (code == 0) {
562 574 var giftbagid = res.data.data.giftBagId;
... ... @@ -575,7 +587,7 @@ Page({
575 587 var th = this;
576 588 var actId = th.data.actId;
577 589 var giftbagid = th.data.giftbagid;
578   -
  590 +
579 591 if (actId != "" && giftbagid != "") {
580 592  
581 593 getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3);
... ... @@ -584,7 +596,7 @@ Page({
584 596 getApp().showWarning("请稍后重试");
585 597 }
586 598 },
587   - // 判断助力活动是不是存在
  599 + // 判断助力活动是不是存在
588 600 is_assistance: function() {
589 601 var th = this;
590 602 rq.get("/api/weshop/marketing/help/act/judge", {
... ... @@ -607,4 +619,4 @@ Page({
607 619  
608 620  
609 621  
610   -})
611 622 \ No newline at end of file
  623 +})
... ...
pages/user/index/index.wxml
1 1 <view class="xc-page">
2 2 <view class="xc-user">
3   - <view class="xc-head rel">
4   - <image class="xc-background" src="{{iurl}}/miniapp/images/user_index_powder.jpg">
  3 + <view class="xc-head rel">
  4 + <image class="xc-background" src="{{iurl}}{{ad_img?ad_img:'/miniapp/images/user_index_powder.jpg'}}">
5 5 <view class="flex-space-between abs xc-user-frame">
6 6 <view class="xc-user-left flex" wx:if="{{userInfo}}">
7 7 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image>
... ... @@ -69,19 +69,19 @@
69 69 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image>
70 70 <view class="member fs28 "> 加入plus会员预计可省3031元</view>
71 71 </view>
72   - <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto">
  72 + <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto">
73 73 <view class="xc-opening fs28">立即开通</view>
74 74 </view>
75 75 </view>
76 76 </view>
77   -
  77 +
78 78 <view class="xc-add-member-frame flex-level rel addplus" wx:if="{{is_dengji==3}}">
79 79 <view class="xc-add-member flex-center-around ">
80 80 <view class="flex jc-center ai-center">
81 81 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image>
82 82 <view class="member fs28 "> 加入plus会员预计可省3031元</view>
83 83 </view>
84   - <view class="xc-opening-button t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto">
  84 + <view class="xc-opening-button t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto">
85 85 <view class="xc-opening fs28">立即续费</view>
86 86 </view>
87 87 </view>
... ... @@ -232,7 +232,7 @@
232 232 <view class="item t-c" data-url="/pages/user/assistance/assistance" bindtap="goto_nav">
233 233 <image class="xc-center-img " src="{{iurl}}/miniapp/images/friendhelp/icon-zl.png"></image>
234 234 <view class="four-level-word">助力活动</view>
235   - </view>
  235 + </view>
236 236 </block>
237 237  
238 238 </view>
... ... @@ -262,7 +262,7 @@
262 262 <!-- 显示商品 -->
263 263 <!-- 好物推荐 -->
264 264 <goods_recommend id="goods_recommend"></goods_recommend>
265   -
  265 +
266 266 </view>
267 267 </view>
268 268  
... ... @@ -290,4 +290,4 @@
290 290 </view>
291 291 </view>
292 292  
293   -<pop_txt id="pop_txt"></pop_txt>
294 293 \ No newline at end of file
  294 +<pop_txt id="pop_txt"></pop_txt>
... ...
public/static/images/model/bg.jpg deleted

35.5 KB

public/static/images/model/bg1.jpg deleted

37.2 KB

utils/util.js
... ... @@ -236,13 +236,13 @@ function check_mobile(phoneMobile){
236 236 var ob={code:1};
237 237 if (phoneMobile.length === 0) {
238 238 ob.title='输入的手机号为空';
239   - ob.code=-1;
  239 + ob.code=-1;
240 240 } else if (phoneMobile.length < 11) {
241 241 ob.title ='手机号长度有误!';
242   - ob.code = -1;
  242 + ob.code = -1;
243 243 } else if (!myreg.test(phoneMobile)) {
244 244 ob.title = '手机号格式有误!';
245   - ob.code = -1;
  245 + ob.code = -1;
246 246 }
247 247 return ob;
248 248 }
... ... @@ -280,31 +280,31 @@ function draw_randon_rect(ctx,x,y,r,w,h){
280 280 // ctx.setStrokeStyle('transparent')
281 281 // 左上角
282 282 ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5)
283   -
  283 +
284 284 // border-top
285 285 ctx.moveTo(x + r, y)
286 286 ctx.lineTo(x + w - r, y)
287 287 ctx.lineTo(x + w, y + r)
288 288 // 右上角
289 289 ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2)
290   -
  290 +
291 291 // border-right
292 292 ctx.lineTo(x + w, y + h - r)
293 293 ctx.lineTo(x + w - r, y + h)
294 294 // 右下角
295 295 ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5)
296   -
  296 +
297 297 // border-bottom
298 298 ctx.lineTo(x + r, y + h)
299 299 ctx.lineTo(x, y + h - r)
300 300 // 左下角
301 301 ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI)
302   -
  302 +
303 303 // border-left
304 304 ctx.lineTo(x, y + r)
305   - ctx.lineTo(x + r, y)
  305 + ctx.lineTo(x + r, y)
306 306 // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应
307   - ctx.fill();
  307 + ctx.fill();
308 308 }
309 309  
310 310 /**
... ... @@ -324,7 +324,7 @@ function get_box_arr(num,x,y,sp,r){
324 324  
325 325 /**
326 326 * @param {Object} ctx 画图句柄
327   - * @param {Object} x x坐标
  327 + * @param {Object} x x坐标
328 328 * @param {Object} y y坐标
329 329 * @param {Object} img 画的图片
330 330 * @param {Object} color 边框的颜色
... ... @@ -345,7 +345,7 @@ function draw_circle(ctx,x,y,r,img,color,unit){
345 345  
346 346  
347 347 function null_promise(){
348   - var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise;
  348 + var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise;
349 349 }
350 350  
351 351 module.exports = {
... ... @@ -371,9 +371,11 @@ module.exports = {
371 371 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)));
372 372 return r;
373 373 },
374   - formar_no_full(e){
  374 + formar_no_full(e,char){
375 375 var t= new Date(1e3 * e);
376   - return t.getFullYear() +"-"+(t.getMonth() + 1)+"-"+t.getDate();
  376 + var c="-";
  377 + if(char) c=char;
  378 + return t.getFullYear() +c+(t.getMonth() + 1)+c+t.getDate();
377 379 },
378 380  
379 381 json2Form: function(e) {
... ... @@ -442,7 +444,7 @@ module.exports = {
442 444 sub_last: sub_last,//去掉末尾一个字符
443 445 measureText: measureText,//画布需要的函数
444 446 check_mobile: check_mobile,//验证手机
445   - get_rand_item:get_rand_item, //随机获取元素
  447 + get_rand_item:get_rand_item, //随机获取元素
446 448 getDistance:getDistance, //获取俩个经纬网度之间的距离
447 449 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形
448 450 null_promise:null_promise,//返回空的promise
... ...