作者 吴孟雨

首页添加分页,团购列表和成交记录添加分页,优化申诉上传的图片格式,去掉活动详情的默认图,首页添加购买背景图接口,优化弹框高度

@@ -104,8 +104,9 @@ Page({ @@ -104,8 +104,9 @@ Page({
104 const images = []; 104 const images = [];
105 const new_images = []; 105 const new_images = [];
106 images.push(self.data.image_params,self.data.image_params1,self.data.image_params2); 106 images.push(self.data.image_params,self.data.image_params1,self.data.image_params2);
  107 + console.log('images push后',images);
107 images.map((item)=> { 108 images.map((item)=> {
108 - if(item !== '') { 109 + if(item !== undefined) {
109 new_images.push(item) 110 new_images.push(item)
110 } 111 }
111 }); 112 });
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 <view class='review_content_box'> 56 <view class='review_content_box'>
57 <view class='review_img'> 57 <view class='review_img'>
58 <image src='{{item.images[0]}}' wx:if="{{item.re_description === ''}}"></image> 58 <image src='{{item.images[0]}}' wx:if="{{item.re_description === ''}}"></image>
59 - <image src='{{item.re_images}}' wx:if="{{item.re_description !== ''}}"></image> 59 + <image src='{{item.re_images[0]}}' wx:if="{{item.re_description !== ''}}"></image>
60 </view> 60 </view>
61 <view class='review_content'> 61 <view class='review_content'>
62 <view class='review_info' wx:if="{{item.re_description === ''}}" >{{item.description}}</view> 62 <view class='review_info' wx:if="{{item.re_description === ''}}" >{{item.description}}</view>
@@ -101,7 +101,7 @@ Page({ @@ -101,7 +101,7 @@ Page({
101 const new_images = []; 101 const new_images = [];
102 images.push(self.data.image_params,self.data.image_params1,self.data.image_params2); 102 images.push(self.data.image_params,self.data.image_params1,self.data.image_params2);
103 images.map((item)=> { 103 images.map((item)=> {
104 - if(item !== '') { 104 + if(item !== undefined) {
105 new_images.push(item) 105 new_images.push(item)
106 } 106 }
107 }); 107 });
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 <view class="content"> 2 <view class="content">
3 <view class="head" style="border-bottom: 20rpx solid #f2f2f2"> 3 <view class="head" style="border-bottom: 20rpx solid #f2f2f2">
4 <view class="img_box"> 4 <view class="img_box">
5 - <!--<image src="{{detail.thumb}}" class="activity_img" mode="aspectFill"></image>-->  
6 - <image src="../../../images/test_img.jpg" class="activity_img" mode="aspectFill"></image> 5 + <image src="{{detail.thumb}}" class="activity_img" mode="aspectFill"></image>
  6 + <!--<image src="../../../images/test_img.jpg" class="activity_img" mode="aspectFill"></image>-->
7 </view> 7 </view>
8 <view class="title"> 8 <view class="title">
9 <view class="line"></view> 9 <view class="line"></view>
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </view> 15 </view>
16 16
17 <view class="jiexi" style="margin-bottom: 150rpx"> 17 <view class="jiexi" style="margin-bottom: 150rpx">
18 - <image src="../../../images/i.jpg" style="width:100%;height:100%;"></image> 18 + <!--<image src="../../../images/i.jpg" style="width:100%;height:100%;"></image>-->
19 <import src="/wxParse/wxParse.wxml"/> 19 <import src="/wxParse/wxParse.wxml"/>
20 <template is="wxParse" data="{{wxParseData:article.nodes}}"/> 20 <template is="wxParse" data="{{wxParseData:article.nodes}}"/>
21 </view> 21 </view>
@@ -14,9 +14,27 @@ Page({ @@ -14,9 +14,27 @@ Page({
14 interval: 2000, //间隔时间 14 interval: 2000, //间隔时间
15 duration: 500, //滑动时间 15 duration: 500, //滑动时间
16 this_week_test_info: {}, 16 this_week_test_info: {},
17 - past_test_info: {}, 17 + past_test_info: [],
18 is_buy: false, 18 is_buy: false,
19 student_id: '', 19 student_id: '',
  20 + page_number:1,
  21 + has_more:true,
  22 + },
  23 + //获取购买背景图
  24 + getBuyCard() {
  25 + let url = '/portal/Index/buy';
  26 + let header = {
  27 + "XX-token": wx.getStorageSync('token')
  28 + };
  29 + app.post(url, {}, {}).then((res) => {
  30 + console.log('获取购买背景图',res);
  31 + this.setData({buy_card: res.info})
  32 + // if (res.is_binding) {
  33 + // this.setData({is_bingding: true})
  34 + // } else {
  35 + // this.setData({is_bingding: false})
  36 + // }
  37 + })
20 }, 38 },
21 //判断手机号是否绑定 39 //判断手机号是否绑定
22 checkMobile() { 40 checkMobile() {
@@ -97,13 +115,19 @@ Page({ @@ -97,13 +115,19 @@ Page({
97 }, 115 },
98 //获取往期实验 116 //获取往期实验
99 getPastWeekTest() { 117 getPastWeekTest() {
  118 + if(!this.data.has_more) return;
  119 + this.setData({has_more: false});
100 let url = '/portal/Index/history'; 120 let url = '/portal/Index/history';
101 let params = { 121 let params = {
102 - page: 1, 122 + page: this.data.page_number,
103 } 123 }
104 app.post(url, params,{}).then((res) => { 124 app.post(url, params,{}).then((res) => {
105 - // console.log(res);  
106 - this.setData({past_test_info: res}) 125 + console.log('获取往期实验',res);
  126 + if(res.this_page < res.total_page) {
  127 + this.setData({has_more: true});
  128 + }
  129 + // console.log('list', list);
  130 + this.setData({past_test_info: this.data.past_test_info.concat(res.list)});
107 // console.log(this.data.this_week_test_info); 131 // console.log(this.data.this_week_test_info);
108 }) 132 })
109 }, 133 },
@@ -189,6 +213,7 @@ Page({ @@ -189,6 +213,7 @@ Page({
189 // self.checkMobile(); 213 // self.checkMobile();
190 self.getTheWeekTest(); 214 self.getTheWeekTest();
191 self.getPastWeekTest(); 215 self.getPastWeekTest();
  216 + self.getBuyCard();
192 //获取当前城市 217 //获取当前城市
193 wx.getLocation({ 218 wx.getLocation({
194 type: 'wgs84', 219 type: 'wgs84',
@@ -224,4 +249,17 @@ Page({ @@ -224,4 +249,17 @@ Page({
224 onShow() { 249 onShow() {
225 console.log('show-globalData',app.globalData.is_bingding,typeof(app.globalData.is_bingding)); 250 console.log('show-globalData',app.globalData.is_bingding,typeof(app.globalData.is_bingding));
226 }, 251 },
  252 + onReachBottom: function () {
  253 + const self = this;
  254 + if(self.data.has_more) {
  255 + self.data.page_number ++;
  256 + self.getPastWeekTest();
  257 + }else {
  258 + wx.showToast({
  259 + title: '没有更多数据了~',
  260 + icon: 'none'
  261 + });
  262 + }
  263 + console.log('上拉加载');
  264 + },
227 }); 265 });
@@ -27,8 +27,9 @@ @@ -27,8 +27,9 @@
27 <!--购买--> 27 <!--购买-->
28 <view class="btn-box" bindtap="goBuyCard"> 28 <view class="btn-box" bindtap="goBuyCard">
29 <view class="buy-btn"> 29 <view class="buy-btn">
30 - <text>点击图片可跳转到购买页</text>  
31 - <image src="../../images/taimiao@2x.png" mode="aspectFill"></image> 30 + <!--<text>点击图片可跳转到购买页</text>-->
  31 + <!--<image src="../../images/taimiao@2x.png" mode="aspectFill"></image>-->
  32 + <image src="{{buy_card}}" mode="aspectFill"></image>
32 </view> 33 </view>
33 </view> 34 </view>
34 35
@@ -69,7 +70,7 @@ @@ -69,7 +70,7 @@
69 <view class="line"></view> 70 <view class="line"></view>
70 <text>往期实验</text> 71 <text>往期实验</text>
71 </view> 72 </view>
72 - <view wx:for="{{past_test_info.list}}" wx:key="index" data-index="{{index}}" data-id="{{item.id}}" bindtap="goTestDetail" 73 + <view wx:for="{{past_test_info}}" wx:key="index" data-index="{{index}}" data-id="{{item.id}}" bindtap="goTestDetail"
73 data-is_the_week='{{false}}'> 74 data-is_the_week='{{false}}'>
74 <view class="test_box"> 75 <view class="test_box">
75 <view class="time">{{item.start_time}} - {{item.end_time}}</view> 76 <view class="time">{{item.start_time}} - {{item.end_time}}</view>
@@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
2 2
3 /* 团购成交记录 */ 3 /* 团购成交记录 */
4 page { 4 page {
5 - height: 100%; 5 + /* height: 100%; */
6 } 6 }
7 .content_box { 7 .content_box {
8 - height: 100%; 8 + /* height: 100%; */
9 } 9 }
10 .no-data { 10 .no-data {
11 width: 100%; 11 width: 100%;
@@ -31,7 +31,12 @@ Page({ @@ -31,7 +31,12 @@ Page({
31 31
32 //兑换并绑定按钮 32 //兑换并绑定按钮
33 chargeBtn(e) { 33 chargeBtn(e) {
34 - // console.log('34',e.detail); 34 + // this.setData({
  35 + // // detail: e.detail,
  36 + // 'modal_data.is_showModal': true,
  37 + // 'modal_data.title': '绑定后无法更改,确认绑定' + this.data.picker_list[this.data.index] + '吗?',
  38 + // });
  39 + console.log('34',e.detail);
35 const self = this; 40 const self = this;
36 if(self.data.code === '') { 41 if(self.data.code === '') {
37 wx.showToast({title: '请输入兑换码!',icon: 'none'}) 42 wx.showToast({title: '请输入兑换码!',icon: 'none'})
@@ -4,7 +4,8 @@ @@ -4,7 +4,8 @@
4 4
5 } 5 }
6 .modal { 6 .modal {
7 - height: 224rpx; 7 + /* height: 224rpx; */
  8 + /* min-height: 183rpx; */
8 position: absolute; 9 position: absolute;
9 top: 280rpx; 10 top: 280rpx;
10 left: 50%; 11 left: 50%;
@@ -9,7 +9,10 @@ @@ -9,7 +9,10 @@
9 data: { 9 data: {
10 current: 0, 10 current: 0,
11 chargenum: "", 11 chargenum: "",
12 - page: 0, 12 + group_page_number: 1,
  13 + record_page_number: 1,
  14 + group_has_more: true,
  15 + record_has_more: true,
13 groupList: [], 16 groupList: [],
14 recordList: [], 17 recordList: [],
15 pay_info: [], 18 pay_info: [],
@@ -75,42 +78,49 @@ @@ -75,42 +78,49 @@
75 78
76 //参与的组团 79 //参与的组团
77 takeGroup() { 80 takeGroup() {
  81 + if(!this.data.group_has_more) return;
  82 + this.setData({group_has_more: false});
78 let url = '/portal/Group/group_list' 83 let url = '/portal/Group/group_list'
79 let params = { 84 let params = {
80 - page: this.data.page 85 + page: this.data.group_page_number
81 } 86 }
82 let header = { 87 let header = {
83 "XX-Token": wx.getStorageSync('token') 88 "XX-Token": wx.getStorageSync('token')
84 } 89 }
85 app.post(url, params, header).then((res) => { 90 app.post(url, params, header).then((res) => {
86 console.log(res) 91 console.log(res)
87 - this.setData({  
88 - groupList: res.list  
89 - }) 92 + if(res.this_page < res.total_page) {
  93 + this.setData({group_has_more: true});
  94 + }
  95 + // console.log('list', list);
  96 + this.setData({groupList: this.data.groupList.concat(res.list)});
90 }) 97 })
91 }, 98 },
92 99
93 //成交记录 100 //成交记录
94 record() { 101 record() {
  102 + if(!this.data.record_has_more) return;
  103 + this.setData({record_has_more: false});
95 let url = '/portal/Group/group_complete' 104 let url = '/portal/Group/group_complete'
96 let params = { 105 let params = {
97 - page: this.data.page 106 + page: this.data.record_page_number
98 } 107 }
99 let header = { 108 let header = {
100 "XX-Token": wx.getStorageSync('token') 109 "XX-Token": wx.getStorageSync('token')
101 } 110 }
102 app.post(url, params, header).then((res) => { 111 app.post(url, params, header).then((res) => {
103 console.log(res) 112 console.log(res)
104 - var recordList= res.list  
105 - for(var i=0;i<recordList.length;i++){  
106 - var chargeTime = recordList[i].create_time  
107 - chargeTime = time.formatTimeTwo(chargeTime, 'Y-M-D')  
108 - console.log(chargeTime)  
109 - recordList[i].create_time = chargeTime 113 + if(res.this_page < res.total_page) {
  114 + this.setData({record_has_more: true});
110 } 115 }
111 - this.setData({  
112 - recordList: recordList  
113 - }) 116 + var recordList= res.list
  117 + for(var i=0;i<recordList.length;i++){
  118 + var chargeTime = recordList[i].create_time
  119 + chargeTime = time.formatTimeTwo(chargeTime, 'Y-M-D')
  120 + console.log(chargeTime)
  121 + recordList[i].create_time = chargeTime
  122 + }
  123 + this.setData({recordList: this.data.recordList.concat(recordList)});
114 }) 124 })
115 }, 125 },
116 126
@@ -210,6 +220,36 @@ @@ -210,6 +220,36 @@
210 this.PayDetail() 220 this.PayDetail()
211 }, 221 },
212 222
  223 + /**
  224 + * 页面上拉触底事件的处理函数
  225 + */
  226 + onReachBottom: function () {
  227 + const self = this;
  228 + if(+self.data.current === 0) {
  229 + if(self.data.group_has_more) {
  230 + self.data.group_page_number ++;
  231 + self.takeGroup();
  232 + }else {
  233 + wx.showToast({
  234 + title: '没有更多数据了~',
  235 + icon: 'none'
  236 + });
  237 + }
  238 + console.log('上拉加载');
  239 + }else if(+self.data.current === 1) {
  240 + if(self.data.record_has_more) {
  241 + self.data.record_page_number ++;
  242 + self.record();
  243 + }else {
  244 + wx.showToast({
  245 + title: '没有更多数据了~',
  246 + icon: 'none'
  247 + });
  248 + }
  249 + console.log('上拉加载');
  250 + }
  251 +
  252 + },
213 /** 253 /**
214 * 生命周期函数--监听页面初次渲染完成 254 * 生命周期函数--监听页面初次渲染完成
215 */ 255 */
@@ -246,13 +286,6 @@ @@ -246,13 +286,6 @@
246 }, 286 },
247 287
248 /** 288 /**
249 - * 页面上拉触底事件的处理函数  
250 - */  
251 - onReachBottom: function() {  
252 -  
253 - },  
254 -  
255 - /**  
256 * 用户点击右上角分享 289 * 用户点击右上角分享
257 */ 290 */
258 onShareAppMessage: function() { 291 onShareAppMessage: function() {