Commit e5a47808c78c6c5c373c1b98ee5d5e3902ee10ab

Authored by 后端开发-许程
1 parent 8b81e004

助力修改

pages/user/assistance/assistance.js
@@ -24,8 +24,8 @@ Page({ @@ -24,8 +24,8 @@ Page({
24 is_show_more: 0, //是否加载更多 24 is_show_more: 0, //是否加载更多
25 help_id:"",//助力活动的id 25 help_id:"",//助力活动的id
26 timer:"",//任务列表的定时器 26 timer:"",//任务列表的定时器
27 - s_num:"",//多少人已经领取任务  
28 - 27 + s_num:"",//多少人已经领取任务
  28 + page:1,//我的任务的当前页
29 }, 29 },
30 30
31 /** 31 /**
@@ -60,7 +60,6 @@ Page({ @@ -60,7 +60,6 @@ Page({
60 if (res.data.code == 0) { 60 if (res.data.code == 0) {
61 var help_data=res.data.data; 61 var help_data=res.data.data;
62 th.setData({ zl_act:help_data, help_id:help_data.id }); 62 th.setData({ zl_act:help_data, help_id:help_data.id });
63 - console.log(th.data.help_id, '数据', res.data);  
64 if (th.data.help_id != "" && th.data.help_id!=null) { 63 if (th.data.help_id != "" && th.data.help_id!=null) {
65 //我的任务 64 //我的任务
66 th.get_list(); 65 th.get_list();
@@ -84,44 +83,57 @@ Page({ @@ -84,44 +83,57 @@ Page({
84 83
85 //--点击获取用户任务列表--会员的任务列表 84 //--点击获取用户任务列表--会员的任务列表
86 get_list:function() { 85 get_list:function() {
87 - console.log("有走这里吗会员任务11111"); 86 +
  87 +
88 var th = this; 88 var th = this;
  89 + var page=th.data.page;
  90 + console.log("page是什么", page);
89 var help_id=this.data.help_id; 91 var help_id=this.data.help_id;
90 t.request.get("/api/weshop/marketing/help/help/user/page", { 92 t.request.get("/api/weshop/marketing/help/help/user/page", {
91 data: { 93 data: {
92 userId:getApp().globalData.user_id, 94 userId:getApp().globalData.user_id,
93 storeId: os.stoid, 95 storeId: os.stoid,
94 - helpId: help_id 96 + helpId: help_id,
  97 + page: page,
  98 + pageSize:5
95 }, 99 },
96 success: function(res) { 100 success: function(res) {
97 clearTimeout(th.data.timer); 101 clearTimeout(th.data.timer);
98 - console.log("有走这里吗会员任务6666666");  
99 - // if (!th.data.is_load)  
100 - // th.setData({  
101 - // is_load: 1  
102 - // }) 102 +
  103 + if (!th.data.is_load)
  104 + th.setData({
  105 + is_load: 1
  106 + })
  107 +
  108 +
103 if (res.data.code == 0) { 109 if (res.data.code == 0) {
104 - 110 + var page=th.data.page+1;
105 var list = th.data.zl_user_list; 111 var list = th.data.zl_user_list;
106 //连接数组 112 //连接数组
107 list = list.concat(res.data.data.pageData); 113 list = list.concat(res.data.data.pageData);
108 - console.log("我的任务数据",list);  
109 th.setData({ 114 th.setData({
110 zl_user_list: list, 115 zl_user_list: list,
111 - is_load: 1, 116 + is_load: 1,
  117 + page: page
112 }); 118 });
113 - var n_all_num = th.data.cur_page * th.data.page_num;  
114 - if (res.data.data.total > n_all_num) th.setData({  
115 - is_show_more: 1  
116 - })  
117 - else th.setData({  
118 - is_show_more: 0  
119 - }) 119 + if (res.data.data.total <= 5) {
  120 + th.setData({
  121 + is_show_more: 1
  122 + })
  123 + }
  124 + // var n_all_num = th.data.cur_page * th.data.page_num;
  125 + // if (res.data.data.total > n_all_num) th.setData({
  126 + // is_show_more: 1
  127 + // })
  128 + // else th.setData({
  129 + // is_show_more: 0
  130 + // })
120 //页吗要更新一下 131 //页吗要更新一下
121 - th.data.cur_page++; 132 + // th.data.cur_page++;
122 } else { 133 } else {
  134 + getApp().showWarning("暂无更多内容");
123 th.setData({ 135 th.setData({
124 - is_show_more: 0 136 + is_show_more: 1
125 }) 137 })
126 } 138 }
127 139
@@ -131,7 +143,7 @@ Page({ @@ -131,7 +143,7 @@ Page({
131 143
132 //-----跳转到领取礼包的页面------ 144 //-----跳转到领取礼包的页面------
133 go_task: function() { 145 go_task: function() {
134 - console.log("跳转领取任务列表2222"); 146 +
135 var help_id=this.data.help_id; 147 var help_id=this.data.help_id;
136 getApp().goto("/pages/user/assistance/task_assistance?help_id="+help_id); 148 getApp().goto("/pages/user/assistance/task_assistance?help_id="+help_id);
137 }, 149 },
@@ -156,7 +168,7 @@ Page({ @@ -156,7 +168,7 @@ Page({
156 get_libao:function(e){ 168 get_libao:function(e){
157 var libao_id=e.currentTarget.dataset.libaoid; 169 var libao_id=e.currentTarget.dataset.libaoid;
158 var completeid= e.currentTarget.dataset.completeid; 170 var completeid= e.currentTarget.dataset.completeid;
159 - console.log("礼包id", libao_id); 171 +
160 getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); 172 getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid);
161 }, 173 },
162 //查看礼包id 174 //查看礼包id
pages/user/assistance/assistance.json
1 { 1 {
2 - "navigationBarTitleText": "好友助力", 2 + "navigationBarTitleText": "好友助力,得好礼",
3 "navigationStyle": "custom", 3 "navigationStyle": "custom",
4 "usingComponents": { 4 "usingComponents": {
5 "warn": "/components/long_warn/long_warn", 5 "warn": "/components/long_warn/long_warn",
pages/user/assistance/assistance.wxml
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <view class="flex-center"> 8 <view class="flex-center">
9 <image class="getgift" src="{{iurl+'miniapp/images/friendhelp/getgift.png'}}" lazy-load="true"></image> 9 <image class="getgift" src="{{iurl+'miniapp/images/friendhelp/getgift.png'}}" lazy-load="true"></image>
10 </view> 10 </view>
11 - <view class="flex-center fs32"> 11 + <view class="flex-center fs32">
12 <view class="excitation">机会总是留给最有行动力的人</view> 12 <view class="excitation">机会总是留给最有行动力的人</view>
13 </view> 13 </view>
14 <view class="flex-center"> 14 <view class="flex-center">
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 64
65 </view> 65 </view>
66 <!-- 加载更多 --> 66 <!-- 加载更多 -->
67 - <block wx:if="{{is_load && zl_user_list.length!=0}}"> 67 + <block wx:if="{{is_show_more==0}}">
68 <view class="fs28 flex-center"> 68 <view class="fs28 flex-center">
69 <view class="line"></view> 69 <view class="line"></view>
70 <view class="load" bindtap="get_list">点击加载更多</view> 70 <view class="load" bindtap="get_list">点击加载更多</view>