Commit 5b0664d79cb80663833ddb166975f7a16f6518a0
1 parent
5fbea9e0
助力首页模拟数据填充
Showing
2 changed files
with
73 additions
and
26 deletions
pages/user/assistance/assistance.js
... | ... | @@ -10,24 +10,42 @@ Page({ |
10 | 10 | * 页面的初始数据 |
11 | 11 | */ |
12 | 12 | data: { |
13 | - url: a.url, //接口网址 | |
14 | - iurl: a.imghost, //图片前缀网址 | |
15 | - switch_head: 0, //0:我的任务,1:活动说明 | |
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, //是否加载更多 | |
16 | 22 | }, |
17 | 23 | |
18 | 24 | /** |
19 | 25 | * 生命周期函数--监听页面加载 |
20 | 26 | */ |
21 | 27 | onLoad: function(options) { |
22 | - var th = this; | |
23 | - th.close(); | |
28 | + var th = this; | |
29 | + var nav_b = th.selectComponent("#nav_b"); //组件的id | |
30 | + nav_b.set_name("助力", ""); | |
24 | 31 | }, |
25 | 32 | |
26 | 33 | /** |
27 | 34 | * 生命周期函数--监听页面显示 |
28 | 35 | */ |
29 | 36 | onShow: function() { |
30 | - | |
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 | + | |
31 | 49 | }, |
32 | 50 | switch_head: function(e) { |
33 | 51 | var th = this; |
... | ... | @@ -39,12 +57,40 @@ Page({ |
39 | 57 | }) |
40 | 58 | } |
41 | 59 | }, |
60 | + | |
42 | 61 | //关闭导航 |
43 | 62 | close: function() { |
44 | 63 | var th = this; |
45 | 64 | var nav_b = th.selectComponent("#nav_b"); //组件的id |
46 | 65 | nav_b.close_box(); |
47 | - nav_b.set_name("助力", ""); | |
66 | + }, | |
67 | + | |
68 | + //--点击获取用户任务列表-- | |
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 | + }) | |
89 | + }, | |
90 | + | |
91 | + //-----跳转到领取礼包的页面------ | |
92 | + go_task:function(){ | |
93 | + getApp().goto("/pages/user/assistance/task_assistance"); | |
48 | 94 | } |
49 | 95 | |
50 | 96 | }) |
51 | 97 | \ No newline at end of file | ... | ... |
pages/user/assistance/assistance.wxml
1 | +<wxs module="filter" src="c_filter.wxs"></wxs> | |
1 | 2 | <view class="page" bindtap="close"> |
2 | 3 | <!-- 背景图片 --> |
3 | 4 | <image class="lumi" src="{{iurl+'miniapp/images/friendhelp/lumi.png'}}" lazy-load="true"></image> |
... | ... | @@ -14,10 +15,10 @@ |
14 | 15 | </view> |
15 | 16 | <view class="flex-center fs26 time"> |
16 | 17 | <view>活动时间:</view> |
17 | - <view>5月28日-6月30日 | |
18 | + <view>{{filter.fm_time(zl_act.begindate)}}-{{filter.fm_time(zl_act.enddate)}} | |
18 | 19 | </view> |
19 | 20 | </view> |
20 | - <view class="flex-center"> | |
21 | + <view class="flex-center" bindtap="go_task"> | |
21 | 22 | <view class="flex-center take"> |
22 | 23 | <view>立即领取</view> |
23 | 24 | </view> |
... | ... | @@ -42,28 +43,34 @@ |
42 | 43 | <!-- 我的任务 --> |
43 | 44 | <view wx:if="{{switch_head==0}}" class="white"> |
44 | 45 | <view class="items"> |
45 | - <view class="item fs26 flex-vertical-between padding" wx:for="{{5}}"> | |
46 | + <view class="item fs26 flex-vertical-between padding" wx:for="{{zl_user_list}}"> | |
46 | 47 | <view class="flex-center width"> |
47 | - <view class="ellipsis-1">豪华任务一 | |
48 | - </view> | |
48 | + <view class="ellipsis-1">{{item.help_taskname}}</view> | |
49 | 49 | </view> |
50 | 50 | |
51 | - <!-- 已完成的颜色nostate --> | |
52 | - <view class="flex-center width state {{index==0?'nostate':''}}"> | |
53 | - <view class="ellipsis-1">进行中 | |
54 | - </view> | |
51 | + <!-- 已完成的颜色nostate --> | |
52 | + <view class="flex-center width state" wx:if="{{item.is_acting==0}}"> | |
53 | + <view class="ellipsis-1">领取礼包</view> | |
55 | 54 | </view> |
55 | + <view class="flex-center width state" wx:if="{{item.is_acting==1}}"> | |
56 | + <view class="ellipsis-1">{{item.helped}}/{{item.help_num}}</view> | |
57 | + </view> | |
58 | + <view class="flex-center width state" wx:if="{{item.is_acting==2}}"> | |
59 | + <view class="ellipsis-1">查看礼包</view> | |
60 | + </view> | |
61 | + | |
62 | + | |
56 | 63 | </view> |
57 | 64 | <!-- 加载更多 --> |
58 | 65 | <view class="fs28 flex-center"> |
59 | 66 | <view class="line"></view> |
60 | - <view class="load" bindtap="">点击加载更多</view> | |
67 | + <view class="load" bindtap="get_list">点击加载更多</view> | |
61 | 68 | <view class="line"></view> |
62 | 69 | </view> |
63 | 70 | </view> |
64 | 71 | |
65 | - <view class="fs30"> | |
66 | - <view class="flex-center nothing"> | |
72 | + <view class="fs30" style="margin-top: 30rpx;"> | |
73 | + <view class="flex-center nothing" wx:if="{{is_load && zl_user_list.length==0}}"> | |
67 | 74 | <view>暂无任务记录</view> |
68 | 75 | </view> |
69 | 76 | <view class="flex-center receive"> |
... | ... | @@ -81,13 +88,7 @@ |
81 | 88 | <view wx:if="{{switch_head}}" class="white"> |
82 | 89 | <view class="items"> |
83 | 90 | <view class="content fs28 padding"> |
84 | - <view>活动时间: 2014年4月24日-27日, 共4天 活动规则:活动期间内,通过当当购物手机客户端成功购买图书的用户, 均视为成功参与此次活动;每个用户只可参与一-次。 奖品发放:交易完成后,3个工作日内发送至参与用户账号 补充说明:此次活动不与客户端用户首单奖励5元活动冲突,可同时参与。 此次活动最终解释权归当当网所有。</view> | |
85 | - </view> | |
86 | - <!-- 加载更多 --> | |
87 | - <view class="loads fs28 flex-center"> | |
88 | - <view class="line"></view> | |
89 | - <view class="load" bindtap="">点击加载更多</view> | |
90 | - <view class="line"></view> | |
91 | + <view>{{zl_act.remark}}</view> | |
91 | 92 | </view> |
92 | 93 | </view> |
93 | 94 | ... | ... |