Commit b8f0596d1cbfd348ffddb0d0ed44dedb3129b513

Authored by 后端研发-苏明海
2 parents b7151bec abdcef98

Merge branch 'dev' into 'test'

Dev

See merge request !283
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": {
... ...
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() {
... ... @@ -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,
... ... @@ -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/giftpacklist.js
... ... @@ -334,10 +334,21 @@ Page({
334 334 bind_bnerr2: function(e) {
335 335 var _errImg = e.target.dataset.errorimg;
336 336 var _errObj = {};
337   - _errObj[_errImg] = "/public/images/empty.jpg";
  337 + _errObj[_errImg] ="/miniapp/images/giftbag/gift01.png";
338 338 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
339 339  
340 340 },
  341 +
  342 + //图片失败,默认图片
  343 + bind_bnerr: function (e) {
  344 + var _errImg = e.target.dataset.errorimg;
  345 + var _errObj = {};
  346 + _errObj[_errImg] = this.data.iurl + "/miniapp/images/empty.jpg";
  347 + //this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  348 + this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"});
  349 +
  350 + },
  351 +
341 352 //关闭导航
342 353 close: function() {
343 354 var th = this;
... ...
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 = 1;
  682 + ///二微码
  683 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  684 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/index/index/index";
  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 + var url = "/api/weshop/marketing/help/help/task/involve/page";
  947 + getApp().request.promiseGet(url, {
  948 + isShowLoading: true,
  949 + data: {
  950 + storeId: os.stoid,
  951 + taskId: taskid,
  952 + userId: getApp().globalData.user_id
  953 + }
  954 + }).then(res => {
  955 + if (res.data.code == 0) {
  956 + var data = res.data.data.pageData; //帮拆数组
  957 + if (data.length > 0) {
  958 + th.data.dynamic = data[0];
  959 + var path = th.data.iurl + (sw_item.giftBagUrl?sw_item.giftBagUrl:'/miniapp/images/no-head.jpg');
  960 + //先获取礼包分享时的本地路径
  961 + getApp().request.promise_downimg(path).then(res => {
  962 + th.data.share_lb_img = res;
  963 + //先获取会员的头像
  964 + th.info_head(th.shareFrends);
  965 + });
  966 + }
  967 + } else {
  968 + wx.hideLoading();
  969 + getApp().my_warnning(res.data.msg, 0, th);
  970 + }
  971 + })
  972 + },
  973 +
  974 + //把已助力好友头像下载到本地
  975 + info_head: async function (func) {
  976 + var th = this;
  977 + var images = th.data.dynamic.zlHelpUser;
  978 + var arr = new Array();
  979 + var block = th.data.block;
  980 + if (images) {
  981 + th.data.head_pic_arr.length = 0;
  982 + for (var i in images) {
  983 + var img_path = images[i].headPic;
  984 + await getApp().request.promise_downimg(img_path).then(res => {
  985 + th.data.head_pic_arr.push(res);
  986 + })
  987 + }
  988 + }
  989 + func();
  990 + },
  991 + //立即兑换
  992 + redeem_now: function (e) {
  993 + var libao_id = e.currentTarget.dataset.libaoid;
  994 + var sw_index = this.data.sw_index;
  995 + var aitem = this.data.aitem;
  996 + var taskid = aitem[sw_index].id;
  997 + var taskingid = e.currentTarget.dataset.taskingid;
  998 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id=" + taskingid);
  999 + },
  1000 +
  1001 +
  1002 + //礼包的详情 轮播图
  1003 + libao_details: function (e) {
  1004 + var th = this;
  1005 + var help_id = th.data.help_id; //活动id
  1006 + var taskId = e.currentTarget.dataset.taskid; //任务id
  1007 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId);
  1008 + },
  1009 +
  1010 + user_task_list_click:function(){
  1011 + if (this.data.switch_head==0) return false;
  1012 + this.data.block=0;
  1013 + this.user_task_list();
  1014 + },
  1015 +
  1016 + go_task:function(e){
  1017 + var taskid=e.currentTarget.dataset.taskid;
  1018 + this.go_to_task(taskid);
  1019 +
  1020 + },
  1021 +
  1022 + go_to_task(task_id){
  1023 + var index = 0;
  1024 + var aitem = this.data.aitem;
  1025 + for(var i=0;i<aitem.length;i++){
  1026 + if(aitem[i].id==task_id){
  1027 + index=i;break;
  1028 + }
  1029 + }
  1030 +
  1031 + //当是助力首页跳转过来的
  1032 + if(index==this.data.sw_index){
  1033 + this.get_user_task();
  1034 + }
  1035 +
  1036 + this.setData({
  1037 + sw_index: index,
  1038 + taskid: task_id,
  1039 + is_dismantle: 0,
  1040 + bc_page: 1,
  1041 + })
  1042 +
  1043 +
  1044 + },
  1045 +
  1046 + //--测试用--
  1047 + test:function(){
  1048 + var ind=this.data.sw_index;
  1049 + var aitem = this.data.aitem;
  1050 + var task_id = aitem[ind].id;
  1051 + getApp().goto("/pages/test/zhuli_test?taskId="+task_id);
  1052 + }
  1053 +
  1054 +})
... ...
pages/user/assistance/task_assistance.wxml
... ... @@ -55,10 +55,10 @@
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   - 测试专用
  58 +
  59 +
  60 + <view class="task_clike fs40 t-c flex-center"data-taskid="{{}}" bindtap="test">
  61 + 测试专用帮被人拆
62 62 </view>
63 63  
64 64 </view>
... ... @@ -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  
... ... @@ -167,4 +167,4 @@
167 167 <!-- 引入提示组件 -->
168 168 <warn id="warn"></warn>
169 169 <!-- 制作一个圆球导航 -->
170   -<nav_b id="nav_b"></nav_b>
171 170 \ No newline at end of file
  171 +<nav_b id="nav_b"></nav_b>
... ...