Commit 9aa57bda57727a90167805ce628dece8b3b403cf

Authored by 前端研发-钱巧玲
1 parent ab1086fc

助力活动分享排版

pages/user/assistance/assistance.js
@@ -10,42 +10,44 @@ Page({ @@ -10,42 +10,44 @@ Page({
10 * 页面的初始数据 10 * 页面的初始数据
11 */ 11 */
12 data: { 12 data: {
13 - url: a.url, //接口网址  
14 - iurl: a.imghost, //图片前缀网址  
15 - switch_head: 0, //0:我的任务,1:活动说明  
16 - zl_act:null, //助力活动  
17 - zl_user_list:[],//任务列表  
18 - is_load:0, //是否已经加载  
19 - cur_page:1, //页码  
20 - page_num:5, //每页多少个  
21 - is_show_more:0, //是否加载更多 13 + url: a.url, //接口网址
  14 + iurl: a.imghost, //图片前缀网址
  15 + switch_head: 0, //0:我的任务,1:活动说明
  16 + zl_act: null, //助力活动
  17 + zl_user_list: [], //任务列表
  18 + is_load: 0, //是否已经加载
  19 + cur_page: 1, //页码
  20 + page_num: 5, //每页多少个
  21 + is_show_more: 0, //是否加载更多
22 }, 22 },
23 23
24 /** 24 /**
25 * 生命周期函数--监听页面加载 25 * 生命周期函数--监听页面加载
26 */ 26 */
27 onLoad: function(options) { 27 onLoad: function(options) {
28 - var th = this;  
29 - var nav_b = th.selectComponent("#nav_b"); //组件的id  
30 - nav_b.set_name("助力", ""); 28 + var th = this;
  29 + var nav_b = th.selectComponent("#nav_b"); //组件的id
  30 + nav_b.set_name("助力", "");
31 }, 31 },
32 32
33 /** 33 /**
34 * 生命周期函数--监听页面显示 34 * 生命周期函数--监听页面显示
35 */ 35 */
36 onShow: function() { 36 onShow: function() {
37 - var th=this;  
38 - e.request.get("http://172.20.3.102:8022/api/weshop/zl_act",{  
39 - success:function(res){  
40 - if(res.data.code==0){  
41 - th.setData({zl_act:res.data.data});  
42 - }  
43 - }  
44 - })  
45 -  
46 - this.get_list();  
47 -  
48 - 37 + var th = this;
  38 + e.request.get("http://172.20.3.102:8022/api/weshop/zl_act", {
  39 + success: function(res) {
  40 + if (res.data.code == 0) {
  41 + th.setData({
  42 + zl_act: res.data.data
  43 + });
  44 + }
  45 + }
  46 + })
  47 +
  48 + this.get_list();
  49 +
  50 +
49 }, 51 },
50 switch_head: function(e) { 52 switch_head: function(e) {
51 var th = this; 53 var th = this;
@@ -57,40 +59,50 @@ Page({ @@ -57,40 +59,50 @@ Page({
57 }) 59 })
58 } 60 }
59 }, 61 },
60 - 62 +
61 //关闭导航 63 //关闭导航
62 close: function() { 64 close: function() {
63 var th = this; 65 var th = this;
64 var nav_b = th.selectComponent("#nav_b"); //组件的id 66 var nav_b = th.selectComponent("#nav_b"); //组件的id
65 nav_b.close_box(); 67 nav_b.close_box();
66 }, 68 },
67 - 69 +
68 //--点击获取用户任务列表-- 70 //--点击获取用户任务列表--
69 - get_list:function(){  
70 - var th=this;  
71 - e.request.get("http://172.20.3.102:8022/api/weshop/zl_user_list",{  
72 - success:function(res){  
73 - if(!th.data.is_load) th.setData({is_load:1})  
74 - if(res.data.code==0){  
75 - var list=th.data.zl_user_list;  
76 - list=list.concat(res.data.data.pageData) //连接数组  
77 - th.setData({zl_user_list:list});  
78 - var n_all_num=th.data.cur_page*th.data.page_num;  
79 - if(res.data.data.total>n_all_num) th.setData({is_show_more:1})  
80 - else th.setData({is_show_more:0})  
81 - //页吗要更新一下  
82 - th.data.cur_page++;  
83 - }else{  
84 - th.setData({is_show_more:0})  
85 - }  
86 -  
87 - }  
88 - }) 71 + get_list: function() {
  72 + var th = this;
  73 + e.request.get("http://172.20.3.102:8022/api/weshop/zl_user_list", {
  74 + success: function(res) {
  75 + if (!th.data.is_load) th.setData({
  76 + is_load: 1
  77 + })
  78 + if (res.data.code == 0) {
  79 + var list = th.data.zl_user_list;
  80 + list = list.concat(res.data.data.pageData) //连接数组
  81 + th.setData({
  82 + zl_user_list: list
  83 + });
  84 + var n_all_num = th.data.cur_page * th.data.page_num;
  85 + if (res.data.data.total > n_all_num) th.setData({
  86 + is_show_more: 1
  87 + })
  88 + else th.setData({
  89 + is_show_more: 0
  90 + })
  91 + //页吗要更新一下
  92 + th.data.cur_page++;
  93 + } else {
  94 + th.setData({
  95 + is_show_more: 0
  96 + })
  97 + }
  98 +
  99 + }
  100 + })
89 }, 101 },
90 - 102 +
91 //-----跳转到领取礼包的页面------ 103 //-----跳转到领取礼包的页面------
92 - go_task:function(){  
93 - getApp().goto("/pages/user/assistance/task_assistance"); 104 + go_task: function() {
  105 + getApp().goto("/pages/user/assistance/task_assistance");
94 } 106 }
95 107
96 }) 108 })
97 \ No newline at end of file 109 \ No newline at end of file
pages/user/assistance/assistance.wxml
1 -<wxs module="filter" src="c_filter.wxs"></wxs> 1 +<!-- <wxs module="../../../filter" src="c_filter.wxs"></wxs> -->
2 <view class="page" bindtap="close"> 2 <view class="page" bindtap="close">
3 <!-- 背景图片 --> 3 <!-- 背景图片 -->
4 <image class="lumi" src="{{iurl+'miniapp/images/friendhelp/lumi.png'}}" lazy-load="true"></image> 4 <image class="lumi" src="{{iurl+'miniapp/images/friendhelp/lumi.png'}}" lazy-load="true"></image>
pages/user/assistance/task_assistance.wxml
@@ -43,11 +43,11 @@ @@ -43,11 +43,11 @@
43 43
44 <view class="flex-vertical-between fs28 padding head"> 44 <view class="flex-vertical-between fs28 padding head">
45 <view class="flex-center lhead {{switch_head==0?'rhead':''}}" bindtap="switch_head"data-index="0"> 45 <view class="flex-center lhead {{switch_head==0?'rhead':''}}" bindtap="switch_head"data-index="0">
46 - <image class="unfinished" src="../../../images/frinedhelp/task.png" lazy-load="true"></image> 46 + <image class="unfinished" src="{{iurl}}miniapp/images/friendhelp/task.png" lazy-load="true"></image>
47 <view >我的任务</view> 47 <view >我的任务</view>
48 </view> 48 </view>
49 <view class="flex-center lhead {{switch_head==1?'rhead':''}}" bindtap="switch_head" data-index='1'> 49 <view class="flex-center lhead {{switch_head==1?'rhead':''}}" bindtap="switch_head" data-index='1'>
50 - <image class="unfinished" style="margin-top: 5rpx;" src="../../../images/frinedhelp/edit.png" lazy-load="true"></image> 50 + <image class="unfinished" style="margin-top: 5rpx;" src="{{iurl}}miniapp/images/friendhelp/edit.png" lazy-load="true"></image>
51 <view>帮拆记录</view> 51 <view>帮拆记录</view>
52 </view> 52 </view>
53 </view> 53 </view>