Commit ee052b6953ebcf81e0ce8cba4157eb760aeaac09
1 parent
f540036e
领取任务
Showing
3 changed files
with
385 additions
and
230 deletions
pages/user/assistance/task_assistance.js
| @@ -17,9 +17,9 @@ Page({ | @@ -17,9 +17,9 @@ Page({ | ||
| 17 | sw_index: 0, //轮播的下标控制 | 17 | sw_index: 0, //轮播的下标控制 |
| 18 | url: s.url, //接口网址 | 18 | url: s.url, //接口网址 |
| 19 | iurl: s.imghost, | 19 | iurl: s.imghost, |
| 20 | - is_task: 0, //判断标题名是任务1还是2 | 20 | + endDate:"",//活动结束时间 |
| 21 | activity_data: "25:20:59", //活动剩余时间 | 21 | activity_data: "25:20:59", //活动剩余时间 |
| 22 | - task_number: 12, //任务数 | 22 | + task_number:0, //任务数 |
| 23 | is_task: 0, //历史记录与任务 | 23 | is_task: 0, //历史记录与任务 |
| 24 | aitem: "", //活动的轮播图 | 24 | aitem: "", //活动的轮播图 |
| 25 | switch_head: 0, //0:我的任务,1:记录 | 25 | switch_head: 0, //0:我的任务,1:记录 |
| @@ -28,9 +28,10 @@ Page({ | @@ -28,9 +28,10 @@ Page({ | ||
| 28 | shareImgPath: [], //生成的图片 | 28 | shareImgPath: [], //生成的图片 |
| 29 | screenWidth: "", //用户的屏幕宽度 | 29 | screenWidth: "", //用户的屏幕宽度 |
| 30 | gid: "", | 30 | gid: "", |
| 31 | - images: ["miniapp/images/friendhelp/help.png", "miniapp/images/friendhelp/background.png", "miniapp/images/friendhelp/gift.png", "miniapp/images/friendhelp/no_check.png", | ||
| 32 | - "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/unfinished.png", "miniapp/images/friendhelp/gift.png" | ||
| 33 | - ] | 31 | + timer: null,//全局的定时器 |
| 32 | + user_task_list:null,//会员列表 | ||
| 33 | + taskid:"",//任务id | ||
| 34 | + usercount:0,//参与的人数 | ||
| 34 | }, | 35 | }, |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| @@ -38,7 +39,6 @@ Page({ | @@ -38,7 +39,6 @@ Page({ | ||
| 38 | */ | 39 | */ |
| 39 | onLoad: function(options) { | 40 | onLoad: function(options) { |
| 40 | var help_id = options.help_id; | 41 | var help_id = options.help_id; |
| 41 | - console.log("是什么鬼", help_id); | ||
| 42 | var th = this; | 42 | var th = this; |
| 43 | th.setData({ | 43 | th.setData({ |
| 44 | help_id: help_id | 44 | help_id: help_id |
| @@ -50,57 +50,74 @@ Page({ | @@ -50,57 +50,74 @@ Page({ | ||
| 50 | } | 50 | } |
| 51 | th.close(); | 51 | th.close(); |
| 52 | th.syinfo(); | 52 | th.syinfo(); |
| 53 | - th.imageinfo(); | 53 | + // th.imageinfo(); |
| 54 | }, | 54 | }, |
| 55 | - // 轮播图点击左边 | ||
| 56 | - click_pre: function() { | ||
| 57 | - var index = this.data.sw_index; | ||
| 58 | - index--; | ||
| 59 | - if (index < 0) return; | ||
| 60 | - this.setData({ | ||
| 61 | - sw_index: index | ||
| 62 | - }) | 55 | + |
| 56 | + | ||
| 57 | + //选中任务保存 | ||
| 58 | + add_onlicke:function(e){ | ||
| 59 | + var th=this; | ||
| 60 | + var taskid=e.target.dataset.taskid; | ||
| 61 | + var help_id = th.data.help_id; | ||
| 62 | + var user_id = getApp().globalData.user_id; | ||
| 63 | + var stoid=os.stoid | ||
| 64 | + getApp().request.json_post("/api/weshop/marketing/help/help/task/insert" | ||
| 65 | + ,{ | ||
| 66 | + helpId:help_id, | ||
| 67 | + userId:user_id, | ||
| 68 | + storeId:stoid, | ||
| 69 | + taskId: taskid | ||
| 70 | + }, | ||
| 71 | + function(res) { | ||
| 72 | + if(res.data.code==0){ | ||
| 73 | + console.log(res.data.data); | ||
| 74 | + getApp().my_warnning("任务领取成功", 1, th); | ||
| 75 | + }else{ | ||
| 76 | + getApp().my_warnning(res.data.msg, 0, th); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + ) | ||
| 63 | 81 | ||
| 64 | }, | 82 | }, |
| 65 | - //轮播图点击右边 | ||
| 66 | - click_next: function() { | ||
| 67 | - var index = this.data.sw_index; | ||
| 68 | - index++; | ||
| 69 | - if (index >= this.data.aitem.length) return; | ||
| 70 | - this.setData({ | ||
| 71 | - sw_index: index | ||
| 72 | - }) | ||
| 73 | 83 | ||
| 74 | - }, | ||
| 75 | - //任务领取 | ||
| 76 | - onlicke: function() { | 84 | + //帮拆记录的 |
| 85 | + dismantle_record: function(e) { | ||
| 86 | + console.log(); | ||
| 77 | var th = this; | 87 | var th = this; |
| 78 | - th.shareFrends(); | ||
| 79 | - th.setData({ | ||
| 80 | - is_share:1 | ||
| 81 | - }) | ||
| 82 | - getApp().my_warnning("任务领取成功", 1, th); | ||
| 83 | - }, | ||
| 84 | - | ||
| 85 | - //我的任务和帮拆记录的替换 | ||
| 86 | - switch_head: function(e) { | ||
| 87 | - var th = this; | ||
| 88 | - var index = e.currentTarget.dataset.index; //获取当前选择的是任务还是活动说明 | ||
| 89 | - var switch_head = th.data.switch_head; //0任务,1活动说明 | ||
| 90 | - if (index != switch_head) { | 88 | + var index =1; //获取当前选择的是任务还是活动说明 |
| 89 | + var is_task= th.data.is_task; //0任务,1活动说明 | ||
| 90 | + console.log(e, "这是标签的", is_task, "这是"); | ||
| 91 | + | ||
| 91 | th.setData({ | 92 | th.setData({ |
| 92 | - switch_head: index, | ||
| 93 | - is_task: index | 93 | + is_task:1, |
| 94 | + switch_head:1 | ||
| 95 | + }); | ||
| 96 | + rq.get("/api/weshop/marketing/help/help/task/involve/page", { | ||
| 97 | + data: { | ||
| 98 | + userId: user_id, | ||
| 99 | + storeId: os.stoid | ||
| 100 | + }, | ||
| 101 | + success: function (res) {} | ||
| 102 | + | ||
| 94 | }) | 103 | }) |
| 95 | - } | 104 | + |
| 105 | + | ||
| 96 | }, | 106 | }, |
| 107 | + | ||
| 108 | + | ||
| 97 | //划动的时候监听 | 109 | //划动的时候监听 |
| 98 | onSli: function(e) { | 110 | onSli: function(e) { |
| 99 | - | 111 | + var th= this; |
| 100 | var ind = e.detail.current; | 112 | var ind = e.detail.current; |
| 101 | - this.setData({ | ||
| 102 | - sw_index: ind | 113 | + var aitem = this.data.aitem; |
| 114 | + | ||
| 115 | + var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; | ||
| 116 | + th.setData({ | ||
| 117 | + sw_index: ind, | ||
| 118 | + task_number: task_number | ||
| 103 | }) | 119 | }) |
| 120 | + console.log(th.data.sw_index,"滑动监听", ind); | ||
| 104 | }, | 121 | }, |
| 105 | //导航球 | 122 | //导航球 |
| 106 | close: function() { | 123 | close: function() { |
| @@ -121,18 +138,41 @@ Page({ | @@ -121,18 +138,41 @@ Page({ | ||
| 121 | * 生命周期函数--监听页面显示 | 138 | * 生命周期函数--监听页面显示 |
| 122 | */ | 139 | */ |
| 123 | onShow: function() { | 140 | onShow: function() { |
| 141 | + this.data.is_timer = 1; | ||
| 124 | var th = this; | 142 | var th = this; |
| 125 | var help_id = th.data.help_id; | 143 | var help_id = th.data.help_id; |
| 126 | - /*-----统计-----*/ | 144 | + var user_id = getApp().globalData.user_id; |
| 145 | + | ||
| 146 | + /*-----助力活动(判断)-----*/ | ||
| 147 | + rq.get("/api/weshop/marketing/help/act/judge", { | ||
| 148 | + data: { | ||
| 149 | + userId: user_id, | ||
| 150 | + storeId: os.stoid | ||
| 151 | + }, | ||
| 152 | + success: function (res) { | ||
| 153 | + if (res.data.code == 0) { | ||
| 154 | + | ||
| 155 | + var help_data = res.data.data; | ||
| 156 | + console.log( '助力活动(判断)', res.data.data); | ||
| 157 | + th.setData({ | ||
| 158 | + endDate:help_data.endDate, | ||
| 159 | + }); | ||
| 160 | + | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + | ||
| 165 | + }); | ||
| 166 | + | ||
| 167 | + | ||
| 168 | + /*-----获取助力活动的任务-----*/ | ||
| 127 | rq.get("/api/weshop/marketing/help/help/task/page", { | 169 | rq.get("/api/weshop/marketing/help/help/task/page", { |
| 128 | data: { | 170 | data: { |
| 129 | helpId: help_id, | 171 | helpId: help_id, |
| 130 | storeId: os.stoid | 172 | storeId: os.stoid |
| 131 | }, | 173 | }, |
| 132 | success: function(su) { | 174 | success: function(su) { |
| 133 | - | ||
| 134 | var data = su.data; | 175 | var data = su.data; |
| 135 | - console.log('waitlist5555555555' + data.code); | ||
| 136 | if (data.code != 0) { | 176 | if (data.code != 0) { |
| 137 | getApp().my_warnning(data.msg, 0, th); | 177 | getApp().my_warnning(data.msg, 0, th); |
| 138 | return false; | 178 | return false; |
| @@ -142,21 +182,23 @@ Page({ | @@ -142,21 +182,23 @@ Page({ | ||
| 142 | var data_aissa = data.data.pageData; | 182 | var data_aissa = data.data.pageData; |
| 143 | //当前时间戳 | 183 | //当前时间戳 |
| 144 | var nt = ut.gettimestamp(); | 184 | var nt = ut.gettimestamp(); |
| 145 | - | 185 | + |
| 146 | data_aissa.forEach(function(val, ind) { | 186 | data_aissa.forEach(function(val, ind) { |
| 147 | - console.log(nt, "当前时间", "结束时间", val.end_time, "开始时间"); | 187 | + |
| 148 | //已开始 | 188 | //已开始 |
| 149 | if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0; | 189 | if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0; |
| 150 | //未开始 | 190 | //未开始 |
| 151 | else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1; | 191 | else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1; |
| 152 | //已结束 | 192 | //已结束 |
| 153 | - | ||
| 154 | else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2; | 193 | else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2; |
| 155 | - | ||
| 156 | }); | 194 | }); |
| 157 | - | 195 | + var task_number=data_aissa[0].giftQty - data_aissa[0].useGiftQty; |
| 196 | + var taskid = data_aissa[0].id; | ||
| 197 | + | ||
| 158 | th.setData({ | 198 | th.setData({ |
| 159 | - aitem: data_aissa | 199 | + aitem: data_aissa, |
| 200 | + task_number: task_number, | ||
| 201 | + taskid:taskid | ||
| 160 | }); | 202 | }); |
| 161 | 203 | ||
| 162 | 204 | ||
| @@ -164,58 +206,97 @@ Page({ | @@ -164,58 +206,97 @@ Page({ | ||
| 164 | 206 | ||
| 165 | } | 207 | } |
| 166 | }) | 208 | }) |
| 167 | - setTimeout(function() { | ||
| 168 | - th.shareFrends(); | ||
| 169 | - }, 1000) | ||
| 170 | - | 209 | + // 分享的 |
| 210 | + // setTimeout(function() { | ||
| 211 | + // th.shareFrends(); | ||
| 212 | + // }, 1000) | ||
| 213 | + //任务时间 设置全局定时器 | ||
| 214 | + th.data.timer = setInterval(function () { | ||
| 215 | + th.countDown(); | ||
| 216 | + },1000); | ||
| 217 | + //会员任务列表 | ||
| 218 | + this.user_task_list(); | ||
| 219 | + // 获取会员的参与的任务列表 我的任务 | ||
| 220 | + this.get_user_task_num(); | ||
| 171 | }, | 221 | }, |
| 172 | - //----助力任务----- | ||
| 173 | - countDown() { | ||
| 174 | - if (!this.data.is_timer) return false; | ||
| 175 | - var th = this; | ||
| 176 | - // 获取当前时间,同时得到活动结束时间数组 | ||
| 177 | - var newTime = ut.gettimestamp(); | ||
| 178 | - var List = this.data.aitem; | ||
| 179 | - for (var j = 0; j < List.length; j++) { | ||
| 180 | - var endTimeList = List[j]; | ||
| 181 | - // 对结束时间进行处理渲染到页面 | ||
| 182 | - for (var i = 0; i < endTimeList.length; i++) { | ||
| 183 | - var o = endTimeList[i]; | ||
| 184 | - var endTime = o.end_time | ||
| 185 | - if (o.status == 0) endTime = o.start_time | ||
| 186 | - | ||
| 187 | - var obj = null; | ||
| 188 | - // 如果活动未结束,对时间进行处理 | ||
| 189 | - if (endTime - newTime > 0) { | ||
| 190 | - var time = (endTime - newTime); | ||
| 191 | - // 获取天、时、分、秒 | ||
| 192 | - var day = parseInt(time / (60 * 60 * 24)); | ||
| 193 | - var hou = parseInt(time % (60 * 60 * 24) / 3600); | ||
| 194 | - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | ||
| 195 | - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | ||
| 196 | - obj = { | ||
| 197 | - day: this.timeFormat(day), | ||
| 198 | - hou: this.timeFormat(hou), | ||
| 199 | - min: this.timeFormat(min), | ||
| 200 | - sec: this.timeFormat(sec) | ||
| 201 | - } | ||
| 202 | - } else { | ||
| 203 | - //活动已结束,全部设置为'00' | ||
| 204 | - obj = { | ||
| 205 | - day: '00', | ||
| 206 | - hou: '00', | ||
| 207 | - min: '00', | ||
| 208 | - sec: '00' | ||
| 209 | - } | ||
| 210 | - } | ||
| 211 | - var txt = "aitem[" + j + "][" + i + "].djs"; | 222 | + // 获取会员的参与的任务列表 我的任务 |
| 223 | + user_task_list:function(e){ | ||
| 224 | + var th=this; | ||
| 225 | + // var index = e.target.dataset.index; //获取当前选择的是任务还是活动说明 | ||
| 226 | + var index =0; | ||
| 227 | + var is_task = th.data.is_task; //0任务,1活动说明 | ||
| 228 | + var help_id = th.data.help_id; | ||
| 229 | + var user_id = getApp().globalData.user_id; | ||
| 230 | + rq.get("/api/weshop/marketing/help/help/user/page", { | ||
| 231 | + data: { | ||
| 232 | + helpId: help_id, | ||
| 233 | + storeId: os.stoid, | ||
| 234 | + userId: user_id | ||
| 235 | + }, | ||
| 236 | + success: function (su) { | ||
| 212 | th.setData({ | 237 | th.setData({ |
| 213 | - [txt]: obj | 238 | + is_task: index, |
| 239 | + switch_head: index | ||
| 214 | }); | 240 | }); |
| 241 | + if (su.data.code == 0) { | ||
| 242 | + var user_list=su.data.data.pageData; | ||
| 243 | + console.log("会员列表",user_list); | ||
| 244 | + th.setData({ | ||
| 245 | + user_task_list: user_list | ||
| 246 | + }); | ||
| 247 | + }else{ | ||
| 248 | + th.setData({ | ||
| 249 | + user_task_list:null | ||
| 250 | + }); | ||
| 251 | + } | ||
| 215 | } | 252 | } |
| 253 | + }) | ||
| 254 | + }, | ||
| 255 | + //获取助力活动参与的人数 | ||
| 256 | + get_user_task_num(){ | ||
| 257 | + var th=this; | ||
| 258 | + var help_id=th.data.help_id; | ||
| 259 | + rq.get("/api/weshop/marketing/help/involve/help/act/people/count", { | ||
| 260 | + data: { | ||
| 261 | + helpId: help_id, | ||
| 262 | + storeId: os.stoid, | ||
| 263 | + }, | ||
| 264 | + success: function (su) { | ||
| 265 | + console.log(su.data.code, "获取助力活动参与的人数",su.data) | ||
| 266 | + if (su.data.code == 0) { | ||
| 267 | + var usercount=su.data.data.countAll; | ||
| 268 | + | ||
| 269 | + th.setData({ usercount: usercount}); | ||
| 270 | + } else { | ||
| 271 | + | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + }) | ||
| 275 | + | ||
| 276 | + }, | ||
| 277 | + // 轮播图点击左边 | ||
| 278 | + click_pre: function () { | ||
| 279 | + var index = this.data.sw_index; | ||
| 280 | + index--; | ||
| 281 | + if (index < 0) return; | ||
| 282 | + var aitem = this.data.aitem; | ||
| 283 | + var task_number = aitem[index].giftQty - aitem[index].useGiftQty; | ||
| 284 | + this.setData({ | ||
| 285 | + sw_index: index, | ||
| 286 | + task_number: task_number | ||
| 287 | + }) | ||
| 216 | 288 | ||
| 217 | - } | ||
| 218 | - setTimeout(th.countDown, 1000); | 289 | + }, |
| 290 | + //轮播图点击右边 | ||
| 291 | + click_next: function () { | ||
| 292 | + var index = this.data.sw_index; | ||
| 293 | + index++; | ||
| 294 | + if (index >= this.data.aitem.length) return; | ||
| 295 | + var aitem = this.data.aitem; | ||
| 296 | + var task_number = aitem[index].giftQty - aitem[index].useGiftQty; | ||
| 297 | + this.setData({ | ||
| 298 | + sw_index: index, task_number: task_number | ||
| 299 | + }) | ||
| 219 | 300 | ||
| 220 | }, | 301 | }, |
| 221 | 302 | ||
| @@ -223,7 +304,9 @@ Page({ | @@ -223,7 +304,9 @@ Page({ | ||
| 223 | * 生命周期函数--监听页面隐藏 | 304 | * 生命周期函数--监听页面隐藏 |
| 224 | */ | 305 | */ |
| 225 | onHide: function() { | 306 | onHide: function() { |
| 226 | - | 307 | + //--清理定时器-- |
| 308 | + console.log("清理定时器"); | ||
| 309 | + clearInterval(this.timer); | ||
| 227 | }, | 310 | }, |
| 228 | 311 | ||
| 229 | /** | 312 | /** |
| @@ -239,6 +322,63 @@ Page({ | @@ -239,6 +322,63 @@ Page({ | ||
| 239 | onPullDownRefresh: function() { | 322 | onPullDownRefresh: function() { |
| 240 | 323 | ||
| 241 | }, | 324 | }, |
| 325 | + //----助力任务的时间----- | ||
| 326 | + countDown() { | ||
| 327 | + if (!this.data.is_timer) return false; | ||
| 328 | + var th = this; | ||
| 329 | + // 获取当前时间,同时得到活动结束时间数组 | ||
| 330 | + var newTime = ut.gettimestamp(); | ||
| 331 | + var List = this.data.aitem; | ||
| 332 | + for (var j = 0; j < List.length; j++) { | ||
| 333 | + var o = List[j]; | ||
| 334 | + | ||
| 335 | + // 对结束时间进行处理渲染到页面 | ||
| 336 | + | ||
| 337 | + // var o = endTimeList[i]; | ||
| 338 | + var endTime = o.endDate | ||
| 339 | + | ||
| 340 | + // if (o.status == 0) endTime = o.start_time | ||
| 341 | + | ||
| 342 | + var obj = null; | ||
| 343 | + // 如果活动未结束,对时间进行处理 | ||
| 344 | + if (endTime - newTime > 0) { | ||
| 345 | + | ||
| 346 | + var time = (endTime - newTime); | ||
| 347 | + // 获取天、时、分、秒 | ||
| 348 | + var day = parseInt(time / (60 * 60 * 24)); | ||
| 349 | + var hou = parseInt(time % (60 * 60 * 24) / 3600); | ||
| 350 | + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | ||
| 351 | + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | ||
| 352 | + obj = { | ||
| 353 | + day: this.timeFormat(day), | ||
| 354 | + hou: this.timeFormat(hou), | ||
| 355 | + min: this.timeFormat(min), | ||
| 356 | + sec: this.timeFormat(sec) | ||
| 357 | + } | ||
| 358 | + } else { | ||
| 359 | + | ||
| 360 | + //活动已结束,全部设置为'00' | ||
| 361 | + obj = { | ||
| 362 | + day: '00', | ||
| 363 | + hou: '00', | ||
| 364 | + min: '00', | ||
| 365 | + sec: '00' | ||
| 366 | + } | ||
| 367 | + } | ||
| 368 | + var txt = "aitem[" + j + "]djs"; | ||
| 369 | + th.setData({ | ||
| 370 | + [txt]: obj | ||
| 371 | + }); | ||
| 372 | + | ||
| 373 | + | ||
| 374 | + } | ||
| 375 | + setTimeout(th.countDown, 1000); | ||
| 376 | + | ||
| 377 | + }, | ||
| 378 | + //---小于10的格式化函数---- | ||
| 379 | + timeFormat(param) { | ||
| 380 | + return param < 10 ? '0' + param : param; | ||
| 381 | + }, | ||
| 242 | 382 | ||
| 243 | /** | 383 | /** |
| 244 | * 页面上拉触底事件的处理函数 | 384 | * 页面上拉触底事件的处理函数 |
| @@ -393,102 +533,103 @@ Page({ | @@ -393,102 +533,103 @@ Page({ | ||
| 393 | } | 533 | } |
| 394 | }) | 534 | }) |
| 395 | }, | 535 | }, |
| 396 | - imageinfo: function() { | ||
| 397 | - var th = this; | ||
| 398 | - var images = th.data.images; | ||
| 399 | - var iurl = th.data.iurl; | ||
| 400 | - wx.getImageInfo({ | ||
| 401 | - src: iurl + images[0], | ||
| 402 | - success: function(res) { | ||
| 403 | - console.log(res + i); | ||
| 404 | - //res.path是网络图片的本地地址 | ||
| 405 | - images[0] = res.path; | ||
| 406 | - }, | ||
| 407 | - fail: function(res) { | ||
| 408 | - console.log(res.toString() + "" + i); | ||
| 409 | - } | ||
| 410 | - }); | ||
| 411 | - wx.getImageInfo({ | ||
| 412 | - src: iurl + images[1], | ||
| 413 | - success: function(res) { | ||
| 414 | - console.log(res + i); | ||
| 415 | - //res.path是网络图片的本地地址 | ||
| 416 | - images[1] = res.path; | ||
| 417 | - }, | ||
| 418 | - fail: function(res) { | ||
| 419 | - console.log(res.toString() + "" + i); | ||
| 420 | - } | ||
| 421 | - }); | ||
| 422 | - wx.getImageInfo({ | ||
| 423 | - src: iurl + images[2], | ||
| 424 | - success: function(res) { | ||
| 425 | - console.log(res + i); | ||
| 426 | - //res.path是网络图片的本地地址 | ||
| 427 | - images[2] = res.path; | ||
| 428 | - }, | ||
| 429 | - fail: function(res) { | ||
| 430 | - console.log(res.toString() + "" + i); | ||
| 431 | - } | ||
| 432 | - }); | ||
| 433 | - wx.getImageInfo({ | ||
| 434 | - src: iurl + images[3], | ||
| 435 | - success: function(res) { | ||
| 436 | - console.log(res + i); | ||
| 437 | - //res.path是网络图片的本地地址 | ||
| 438 | - images[3] = res.path; | ||
| 439 | - }, | ||
| 440 | - fail: function(res) { | ||
| 441 | - console.log(res.toString() + "" + i); | ||
| 442 | - } | ||
| 443 | - }); | ||
| 444 | - wx.getImageInfo({ | ||
| 445 | - src: iurl + images[4], | ||
| 446 | - success: function(res) { | ||
| 447 | - console.log(res + i); | ||
| 448 | - //res.path是网络图片的本地地址 | ||
| 449 | - images[4] = res.path; | ||
| 450 | - }, | ||
| 451 | - fail: function(res) { | ||
| 452 | - console.log(res.toString() + "" + i); | ||
| 453 | - } | ||
| 454 | - }); | ||
| 455 | - wx.getImageInfo({ | ||
| 456 | - src: iurl + images[5], | ||
| 457 | - success: function(res) { | ||
| 458 | - console.log(res + i); | ||
| 459 | - //res.path是网络图片的本地地址 | ||
| 460 | - images[5] = res.path; | ||
| 461 | - }, | ||
| 462 | - fail: function(res) { | ||
| 463 | - console.log(res.toString() + "" + i); | ||
| 464 | - } | ||
| 465 | - }); | ||
| 466 | - wx.getImageInfo({ | ||
| 467 | - src: iurl + images[6], | ||
| 468 | - success: function(res) { | ||
| 469 | - console.log(res + i); | ||
| 470 | - //res.path是网络图片的本地地址 | ||
| 471 | - images[6] = res.path; | ||
| 472 | - }, | ||
| 473 | - fail: function(res) { | ||
| 474 | - console.log(res.toString() + "" + i); | ||
| 475 | - } | ||
| 476 | - }); | ||
| 477 | - | ||
| 478 | - wx.getImageInfo({ | ||
| 479 | - src: iurl + images[7], | ||
| 480 | - success: function(res) { | ||
| 481 | - console.log(res + i); | ||
| 482 | - //res.path是网络图片的本地地址 | ||
| 483 | - images[7] = res.path; | ||
| 484 | - }, | ||
| 485 | - fail: function(res) { | ||
| 486 | - console.log(res.toString() + "" + i); | ||
| 487 | - } | ||
| 488 | - }) | ||
| 489 | - th.setData({ | ||
| 490 | - images: images | ||
| 491 | - }) | ||
| 492 | - | ||
| 493 | - } | 536 | + //分享图 |
| 537 | + // imageinfo: function() { | ||
| 538 | + // var th = this; | ||
| 539 | + // var images = th.data.images; | ||
| 540 | + // var iurl = th.data.iurl; | ||
| 541 | + // wx.getImageInfo({ | ||
| 542 | + // src: iurl + images[0], | ||
| 543 | + // success: function(res) { | ||
| 544 | + // console.log(res + i); | ||
| 545 | + // //res.path是网络图片的本地地址 | ||
| 546 | + // images[0] = res.path; | ||
| 547 | + // }, | ||
| 548 | + // fail: function(res) { | ||
| 549 | + // console.log(res.toString() + "" + i); | ||
| 550 | + // } | ||
| 551 | + // }); | ||
| 552 | + // wx.getImageInfo({ | ||
| 553 | + // src: iurl + images[1], | ||
| 554 | + // success: function(res) { | ||
| 555 | + // console.log(res + i); | ||
| 556 | + // //res.path是网络图片的本地地址 | ||
| 557 | + // images[1] = res.path; | ||
| 558 | + // }, | ||
| 559 | + // fail: function(res) { | ||
| 560 | + // console.log(res.toString() + "" + i); | ||
| 561 | + // } | ||
| 562 | + // }); | ||
| 563 | + // wx.getImageInfo({ | ||
| 564 | + // src: iurl + images[2], | ||
| 565 | + // success: function(res) { | ||
| 566 | + // console.log(res + i); | ||
| 567 | + // //res.path是网络图片的本地地址 | ||
| 568 | + // images[2] = res.path; | ||
| 569 | + // }, | ||
| 570 | + // fail: function(res) { | ||
| 571 | + // console.log(res.toString() + "" + i); | ||
| 572 | + // } | ||
| 573 | + // }); | ||
| 574 | + // wx.getImageInfo({ | ||
| 575 | + // src: iurl + images[3], | ||
| 576 | + // success: function(res) { | ||
| 577 | + // console.log(res + i); | ||
| 578 | + // //res.path是网络图片的本地地址 | ||
| 579 | + // images[3] = res.path; | ||
| 580 | + // }, | ||
| 581 | + // fail: function(res) { | ||
| 582 | + // console.log(res.toString() + "" + i); | ||
| 583 | + // } | ||
| 584 | + // }); | ||
| 585 | + // wx.getImageInfo({ | ||
| 586 | + // src: iurl + images[4], | ||
| 587 | + // success: function(res) { | ||
| 588 | + // console.log(res + i); | ||
| 589 | + // //res.path是网络图片的本地地址 | ||
| 590 | + // images[4] = res.path; | ||
| 591 | + // }, | ||
| 592 | + // fail: function(res) { | ||
| 593 | + // console.log(res.toString() + "" + i); | ||
| 594 | + // } | ||
| 595 | + // }); | ||
| 596 | + // wx.getImageInfo({ | ||
| 597 | + // src: iurl + images[5], | ||
| 598 | + // success: function(res) { | ||
| 599 | + // console.log(res + i); | ||
| 600 | + // //res.path是网络图片的本地地址 | ||
| 601 | + // images[5] = res.path; | ||
| 602 | + // }, | ||
| 603 | + // fail: function(res) { | ||
| 604 | + // console.log(res.toString() + "" + i); | ||
| 605 | + // } | ||
| 606 | + // }); | ||
| 607 | + // wx.getImageInfo({ | ||
| 608 | + // src: iurl + images[6], | ||
| 609 | + // success: function(res) { | ||
| 610 | + // console.log(res + i); | ||
| 611 | + // //res.path是网络图片的本地地址 | ||
| 612 | + // images[6] = res.path; | ||
| 613 | + // }, | ||
| 614 | + // fail: function(res) { | ||
| 615 | + // console.log(res.toString() + "" + i); | ||
| 616 | + // } | ||
| 617 | + // }); | ||
| 618 | + | ||
| 619 | + // wx.getImageInfo({ | ||
| 620 | + // src: iurl + images[7], | ||
| 621 | + // success: function(res) { | ||
| 622 | + // console.log(res + i); | ||
| 623 | + // //res.path是网络图片的本地地址 | ||
| 624 | + // images[7] = res.path; | ||
| 625 | + // }, | ||
| 626 | + // fail: function(res) { | ||
| 627 | + // console.log(res.toString() + "" + i); | ||
| 628 | + // } | ||
| 629 | + // }) | ||
| 630 | + // th.setData({ | ||
| 631 | + // images: images | ||
| 632 | + // }) | ||
| 633 | + | ||
| 634 | + // } | ||
| 494 | }) | 635 | }) |
| 495 | \ No newline at end of file | 636 | \ No newline at end of file |
pages/user/assistance/task_assistance.wxml
| @@ -2,10 +2,11 @@ | @@ -2,10 +2,11 @@ | ||
| 2 | <!-- 助力活动头部 --> | 2 | <!-- 助力活动头部 --> |
| 3 | <view class="top-frame"> | 3 | <view class="top-frame"> |
| 4 | <view class="top-title white fs36 t-c"> | 4 | <view class="top-title white fs36 t-c"> |
| 5 | - {{aitem[sw_index].tite_name}} | 5 | + {{sw_index}} |
| 6 | + {{aitem[sw_index].helpTaskName}} | ||
| 6 | </view> | 7 | </view> |
| 7 | <view class="activity-data t-c fs28 white"> | 8 | <view class="activity-data t-c fs28 white"> |
| 8 | - 活动剩余时间: {{activity_data}} | 9 | + 活动剩余时间:<text class='tui-conutdown-box'> {{aitem[0].djs.day}}</text>:<text class='tui-conutdown-box'>{{aitem[0].djs.hou}}</text>:<text class='tui-conutdown-box'>{{aitem[0].djs.min}}</text>:<text class='tui-conutdown-box tui-countdown-bg'>{{aitem[0].djs.sec}}</text> |
| 9 | </view> | 10 | </view> |
| 10 | </view> | 11 | </view> |
| 11 | <!-- 图片的轮播图 --> | 12 | <!-- 图片的轮播图 --> |
| @@ -14,25 +15,27 @@ | @@ -14,25 +15,27 @@ | ||
| 14 | <view class="bg_left xc-left bcolor"></view> | 15 | <view class="bg_left xc-left bcolor"></view> |
| 15 | </view> | 16 | </view> |
| 16 | <swiper current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> | 17 | <swiper current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> |
| 17 | - | ||
| 18 | <swiper-item wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx"> | 18 | <swiper-item wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx"> |
| 19 | - | ||
| 20 | - <image class="xc-center-img " src="{{aitem.PrivilegeICOUrl}}"></image> | ||
| 21 | - | 19 | + <image class="xc-center-img " src="{{iurl+aitem.giftBagUrl}}"></image> |
| 22 | </swiper-item> | 20 | </swiper-item> |
| 23 | - | ||
| 24 | </swiper> | 21 | </swiper> |
| 25 | 22 | ||
| 26 | <view bindtap="click_next"> | 23 | <view bindtap="click_next"> |
| 27 | <view class="bg_right xc-right bcolor mt"></view> | 24 | <view class="bg_right xc-right bcolor mt"></view> |
| 28 | </view> | 25 | </view> |
| 29 | </view> | 26 | </view> |
| 30 | - | 27 | + <view class="plan-frame"> |
| 28 | + <view class="plan_num rel"> | ||
| 29 | + <view class="is_plam abs"></view> | ||
| 30 | + </view> | ||
| 31 | + <text class="white fs32">/</text> | ||
| 32 | + | ||
| 33 | + </view> | ||
| 31 | <view class="task-number fs28 white t-c "> | 34 | <view class="task-number fs28 white t-c "> |
| 32 | 今天剩余可领{{task_number}}个任务 | 35 | 今天剩余可领{{task_number}}个任务 |
| 33 | </view> | 36 | </view> |
| 34 | 37 | ||
| 35 | - <view class="task_clike fs40 t-c flex-center" bindtap="onlicke"> | 38 | + <view class="task_clike fs40 t-c flex-center"data-taskid="{{taskid}}" bindtap="add_onlicke"> |
| 36 | 就选它了 | 39 | 就选它了 |
| 37 | </view> | 40 | </view> |
| 38 | </view> | 41 | </view> |
| @@ -41,26 +44,30 @@ | @@ -41,26 +44,30 @@ | ||
| 41 | <!-- 标题 --> | 44 | <!-- 标题 --> |
| 42 | 45 | ||
| 43 | <view class="flex-vertical-between fs28 padding head"> | 46 | <view class="flex-vertical-between fs28 padding head"> |
| 44 | - <view class="flex-center lhead {{switch_head==0?'rhead':''}}" bindtap="switch_head" data-index="0"> | 47 | + <view class="flex-center lhead {{switch_head==0?'rhead':''}}" bindtap="user_task_list" data-index="0"> |
| 45 | <image class="unfinished" src="{{iurl}}miniapp/images/friendhelp/task.png" lazy-load="true"></image> | 48 | <image class="unfinished" src="{{iurl}}miniapp/images/friendhelp/task.png" lazy-load="true"></image> |
| 46 | <view>我的任务</view> | 49 | <view>我的任务</view> |
| 47 | </view> | 50 | </view> |
| 48 | - <view class="flex-center lhead {{switch_head==1?'rhead':''}}" bindtap="switch_head" data-index='1'> | 51 | + <view class="flex-center lhead {{switch_head==1?'rhead':''}}" bindtap="dismantle_record" data-index='1'> |
| 49 | <image class="unfinished" style="margin-top: 5rpx;" src="{{iurl}}miniapp/images/friendhelp/edit.png" lazy-load="true"></image> | 52 | <image class="unfinished" style="margin-top: 5rpx;" src="{{iurl}}miniapp/images/friendhelp/edit.png" lazy-load="true"></image> |
| 50 | <view>帮拆记录</view> | 53 | <view>帮拆记录</view> |
| 51 | </view> | 54 | </view> |
| 52 | </view> | 55 | </view> |
| 53 | 56 | ||
| 54 | <view class="white"> | 57 | <view class="white"> |
| 58 | + | ||
| 55 | <view class="items" wx:if="{{is_task==0}}"> | 59 | <view class="items" wx:if="{{is_task==0}}"> |
| 56 | - <view class="item fs26 flex-vertical-between padding" wx:for="{{5}}"> | 60 | + |
| 61 | + <view class="item fs26 flex-vertical-between padding" wx:for="{{user_task_list}}" > | ||
| 57 | <view class="flex-center width"> | 62 | <view class="flex-center width"> |
| 58 | - <view class="ellipsis-1">豪华任务一 | 63 | + <view class="ellipsis-1">{{item.helpTaskName}} |
| 59 | </view> | 64 | </view> |
| 60 | </view> | 65 | </view> |
| 61 | - | ||
| 62 | <view class="flex-center width state"> | 66 | <view class="flex-center width state"> |
| 63 | - <view class="ellipsis-1">进行中 | 67 | + <view class="ellipsis-1"> |
| 68 | + <text wx:if="{{item.status==0&&item.zlHelpNum<item.helpNum}}">{{item.zlHelpNum}}/{{item.helpNum}}</text> | ||
| 69 | + <text wx:if="{{item.status==2&&item.zlHelpNum==item.helpNum}}">查看详情</text> | ||
| 70 | + <text wx:if="{{item.status==1&&time.zlHelpNum==item.helpNum}}">领取礼包 </text> | ||
| 64 | </view> | 71 | </view> |
| 65 | </view> | 72 | </view> |
| 66 | 73 | ||
| @@ -70,9 +77,7 @@ | @@ -70,9 +77,7 @@ | ||
| 70 | 77 | ||
| 71 | 78 | ||
| 72 | <view class="items" wx:if="{{is_task==1}}"> | 79 | <view class="items" wx:if="{{is_task==1}}"> |
| 73 | - | ||
| 74 | - | ||
| 75 | - <view class="item fs26 flex flex-vertical-between padding" wx:for="{{5}}"> | 80 | + <view class="item fs26 flex flex-vertical-between padding" wx:for="{{}}"> |
| 76 | <view class="flex white" style="justify-content: space-around; width: 90%;margin:auto"> | 81 | <view class="flex white" style="justify-content: space-around; width: 90%;margin:auto"> |
| 77 | <image class="circle user_img" src="https://mshopimg.yolipai.net/public/upload/qyimg/temp/2019/08-14/0697f7277936a3b116a6ebc4f8f5e39a.png"></image> | 82 | <image class="circle user_img" src="https://mshopimg.yolipai.net/public/upload/qyimg/temp/2019/08-14/0697f7277936a3b116a6ebc4f8f5e39a.png"></image> |
| 78 | <view class="ellipsis-1">豪华任务一 | 83 | <view class="ellipsis-1">豪华任务一 |
| @@ -84,30 +89,23 @@ | @@ -84,30 +89,23 @@ | ||
| 84 | </view> | 89 | </view> |
| 85 | 90 | ||
| 86 | </view> | 91 | </view> |
| 87 | - <view class="fs30" wx:if="{{1<0}}"> | ||
| 88 | - <view class="flex-center nothing"> | 92 | + <view class="fs30" wx:if="{{user_task_list==null || user_task_list==''}}"> |
| 93 | + <view class="flex-center nothing white"> | ||
| 89 | <view>暂无任务记录</view> | 94 | <view>暂无任务记录</view> |
| 90 | </view> | 95 | </view> |
| 91 | - <view class="flex-center receive"> | ||
| 92 | - <view class="flex-center"> | ||
| 93 | - <view>已有</view> | ||
| 94 | - <view>126</view> | ||
| 95 | - <view>人领取了任务</view> | ||
| 96 | - </view> | ||
| 97 | - </view> | ||
| 98 | </view> | 96 | </view> |
| 99 | 97 | ||
| 100 | </view> | 98 | </view> |
| 101 | <!-- 加载更多 --> | 99 | <!-- 加载更多 --> |
| 102 | -<view class="fs32 "> | ||
| 103 | - <view class="flex-center"> | 100 | +<view class="fs32"> |
| 101 | + <view class="flex-center" wx:if="{{user_task_list}}"> | ||
| 104 | <view class="line"></view> | 102 | <view class="line"></view> |
| 105 | <view class="load white" bindtap="">点击加载更多</view> | 103 | <view class="load white" bindtap="">点击加载更多</view> |
| 106 | <view class="line"></view> | 104 | <view class="line"></view> |
| 107 | </view> | 105 | </view> |
| 108 | <view class="flex-center white" style="margin-top: 20rpx;"> | 106 | <view class="flex-center white" style="margin-top: 20rpx;"> |
| 109 | <view>已有</view> | 107 | <view>已有</view> |
| 110 | - <view>126</view> | 108 | + <view>{{usercount}}</view> |
| 111 | <view>人领取了任务</view> | 109 | <view>人领取了任务</view> |
| 112 | </view> | 110 | </view> |
| 113 | </view> | 111 | </view> |
pages/user/assistance/task_assistance.wxss
| @@ -154,3 +154,19 @@ border-color: #fff; | @@ -154,3 +154,19 @@ border-color: #fff; | ||
| 154 | width: 70rpx; | 154 | width: 70rpx; |
| 155 | height: 70rpx; | 155 | height: 70rpx; |
| 156 | } | 156 | } |
| 157 | +.plan-frame{ | ||
| 158 | + width: 90%; | ||
| 159 | + margin: auto; | ||
| 160 | + | ||
| 161 | +} | ||
| 162 | +.plan-frame .plan_num{ | ||
| 163 | + width: 90%; | ||
| 164 | + background: #ffe7ab; | ||
| 165 | + border-radius: 20rpx; | ||
| 166 | + height: 32rpx; | ||
| 167 | +} | ||
| 168 | +.is_plam{ | ||
| 169 | + height: 100%; | ||
| 170 | + top: 0rpx; | ||
| 171 | + left: 0rpx; | ||
| 172 | +} | ||
| 157 | \ No newline at end of file | 173 | \ No newline at end of file |