| @@ -54,7 +54,8 @@ | |||||
| "backgroundTextStyle": "red", | "backgroundTextStyle": "red", | ||||
| "navigationBarBackgroundColor": "#02C0FF", | "navigationBarBackgroundColor": "#02C0FF", | ||||
| "navigationBarTitleText": "WeChat", | "navigationBarTitleText": "WeChat", | ||||
| "navigationBarTextStyle": "white" | |||||
| "navigationBarTextStyle": "white", | |||||
| "enablePullDownRefresh": true | |||||
| }, | }, | ||||
| "networkTimeout": { | "networkTimeout": { | ||||
| "request": 10000, | "request": 10000, | ||||
| @@ -5,12 +5,12 @@ | |||||
| <image src='{{data.coverImg}}' mode="widthFix"></image> | <image src='{{data.coverImg}}' mode="widthFix"></image> | ||||
| <text bindtap='gotoactdetail'>活动详情</text> | <text bindtap='gotoactdetail'>活动详情</text> | ||||
| </view> | </view> | ||||
| <view class='coupons_info'> | |||||
| <!-- <view class='coupons_info'> | |||||
| <view> | <view> | ||||
| <text>{{data.title}}</text> | <text>{{data.title}}</text> | ||||
| <text>{{data.subTitle}}</text> | <text>{{data.subTitle}}</text> | ||||
| </view> | </view> | ||||
| </view> | |||||
| </view> --> | |||||
| <!-- <view class='posi'> | <!-- <view class='posi'> | ||||
| <view class='posi_logo'> | <view class='posi_logo'> | ||||
| @@ -81,7 +81,7 @@ Page({ | |||||
| loading: false | loading: false | ||||
| }); | }); | ||||
| }, 1400); | }, 1400); | ||||
| if (pageNum >= res.data.pages) { | |||||
| if (pageNum > res.data.pages) { | |||||
| that.setData({ | that.setData({ | ||||
| allow_load: false | allow_load: false | ||||
| }); | }); | ||||
| @@ -17,7 +17,7 @@ Component({ | |||||
| list: [], | list: [], | ||||
| flag: "", | flag: "", | ||||
| loading: true, //"上拉加载"的变量,默认false,隐藏 | loading: true, //"上拉加载"的变量,默认false,隐藏 | ||||
| content:"", | |||||
| content: "", | |||||
| return_list: [], | return_list: [], | ||||
| current: 0, | current: 0, | ||||
| current_scroll: 0, | current_scroll: 0, | ||||
| @@ -30,13 +30,17 @@ Component({ | |||||
| * 组件的方法列表 | * 组件的方法列表 | ||||
| */ | */ | ||||
| methods: { | methods: { | ||||
| handleChange({ detail }) { | |||||
| handleChange({ | |||||
| detail | |||||
| }) { | |||||
| this.setData({ | this.setData({ | ||||
| current: detail.key | current: detail.key | ||||
| }); | }); | ||||
| }, | }, | ||||
| handleChangeScroll({ detail }) { | |||||
| handleChangeScroll({ | |||||
| detail | |||||
| }) { | |||||
| let that = this; | let that = this; | ||||
| // 切换tab时重新初始化下list 和 allow_load | // 切换tab时重新初始化下list 和 allow_load | ||||
| @@ -65,8 +69,8 @@ Component({ | |||||
| // 券list获取 | // 券list获取 | ||||
| if (that.data.allow_load) { | if (that.data.allow_load) { | ||||
| that.setData({ | that.setData({ | ||||
| loading:true, | |||||
| content:'小主,我在玩命加载中...' | |||||
| loading: true, | |||||
| content: '小主,我在玩命加载中...' | |||||
| }) | }) | ||||
| // 根据 key == 0 区分全部或其它tab,决定是否传参数 business | // 根据 key == 0 区分全部或其它tab,决定是否传参数 business | ||||
| if (key == 0) { | if (key == 0) { | ||||
| @@ -94,36 +98,42 @@ Component({ | |||||
| */ | */ | ||||
| if (pageNum >= res.data.pages) { | if (pageNum >= res.data.pages) { | ||||
| that.setData({ | that.setData({ | ||||
| allow_load: false | |||||
| allow_load: false, | |||||
| loading: true, | |||||
| content: "——— 在拉裤子就掉了啦 ———" | |||||
| }); | }); | ||||
| console.log("我已经加载完毕") | |||||
| } | } | ||||
| /** | |||||
| * 先赋值后渲染页面 | |||||
| * concat 不会改变原数组值 | |||||
| * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 | |||||
| */ | |||||
| that.data.list = that.data.list.concat(res.data.list); | |||||
| that.setData({ | |||||
| list: that.data.list | |||||
| }); | |||||
| console.log(pageNum); | |||||
| if(pageNum ==1){ | |||||
| that.setData({ | |||||
| list: [] | |||||
| }) | |||||
| } | |||||
| var tmpArr = that.data.list; | |||||
| tmpArr.push.apply(tmpArr,res.data.list); | |||||
| that.setData({ | |||||
| list: tmpArr | |||||
| }) | |||||
| console.log(tmpArr); | |||||
| }); | }); | ||||
| setTimeout(function() { | |||||
| setTimeout(function () { | |||||
| that.setData({ | that.setData({ | ||||
| loading:false, | |||||
| loading: false, | |||||
| }) | }) | ||||
| }, 1400); | }, 1400); | ||||
| } else { | } else { | ||||
| console.info("allow_load==false 已禁止加载"); | |||||
| that.setData({ | that.setData({ | ||||
| loading:true, | |||||
| loading: true, | |||||
| content: "——— 在拉裤子就掉了啦 ———" | content: "——— 在拉裤子就掉了啦 ———" | ||||
| }) | }) | ||||
| setTimeout(function(){ | |||||
| setTimeout(function () { | |||||
| that.setData({ | that.setData({ | ||||
| loading:false, | |||||
| loading: false, | |||||
| }) | }) | ||||
| },1400) | |||||
| }, 1400) | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -153,6 +163,9 @@ Component({ | |||||
| if (app.globalData.token && app.globalData.token != null) { | if (app.globalData.token && app.globalData.token != null) { | ||||
| app.businessListCallback(app.globalData.token); | app.businessListCallback(app.globalData.token); | ||||
| } | } | ||||
| that.setData({ | |||||
| list:[] | |||||
| }) | |||||
| that.getList(0, 1); | that.getList(0, 1); | ||||
| } | } | ||||
| }); | |||||
| }); | |||||
| @@ -22,7 +22,22 @@ Page({ | |||||
| var scene = decodeURIComponent(options.scene); | var scene = decodeURIComponent(options.scene); | ||||
| app.getLocation(); | app.getLocation(); | ||||
| }, | }, | ||||
| /** | |||||
| * 下拉刷新 | |||||
| */ | |||||
| onPullDownRefresh: function (e) { | |||||
| let that = this; | |||||
| that.userLogin(); | |||||
| console.log(this.data.code); | |||||
| if (that.data.code == 0 || that.data.code == undefined) { | |||||
| that.selectComponent("#lists").getList(0, 1); | |||||
| wx.stopPullDownRefresh(); | |||||
| console.log("下拉刷新"); | |||||
| } else { | |||||
| that.selectComponent("#lists").getList(that.data.code, 1); | |||||
| wx.stopPullDownRefresh(); | |||||
| }; | |||||
| }, | |||||
| onShow: function () { | onShow: function () { | ||||
| this.userLogin(); | this.userLogin(); | ||||
| }, | }, | ||||
| @@ -116,7 +131,6 @@ Page({ | |||||
| that.setData({ | that.setData({ | ||||
| list: res.data.list | list: res.data.list | ||||
| }); | }); | ||||
| console.log(res.data.list); | |||||
| }); | }); | ||||
| }, | }, | ||||
| @@ -183,12 +197,11 @@ Page({ | |||||
| //下拉加载更多 | //下拉加载更多 | ||||
| onReachBottom: function () { | onReachBottom: function () { | ||||
| let that = this; | let that = this; | ||||
| console.info("before++ " + that.data.page); | |||||
| that.data.page++; | that.data.page++; | ||||
| console.info("after++ " + that.data.page); | |||||
| that.setData({ | that.setData({ | ||||
| page: that.data.page | page: that.data.page | ||||
| }); | }); | ||||
| console.log("我是第"+that.data.page+"几页") | |||||
| //父组件获得子组件的方法 | //父组件获得子组件的方法 | ||||
| //如果code == 0 | //如果code == 0 | ||||
| if (that.data.code == 0 || that.data.code == undefined) { | if (that.data.code == 0 || that.data.code == undefined) { | ||||
| @@ -4,6 +4,8 @@ | |||||
| "c-rushToBuy": "./rushToBuy/index", | "c-rushToBuy": "./rushToBuy/index", | ||||
| "c-coupons": "./coupons/index" | "c-coupons": "./coupons/index" | ||||
| }, | }, | ||||
| "enablePullDownRefresh": false, | |||||
| "navigationBarTitleText": "首页" | |||||
| "navigationBarTitleText": "首页", | |||||
| "window": { | |||||
| "enablePullDownRefresh": true | |||||
| } | |||||
| } | } | ||||
| @@ -52,7 +52,7 @@ display: block; | |||||
| } | } | ||||
| .index-scroll-view .commodity-info { | .index-scroll-view .commodity-info { | ||||
| padding:5rpx 20rpx; | |||||
| padding:10rpx 20rpx; | |||||
| overflow: hidden; | overflow: hidden; | ||||
| } | } | ||||
| @@ -60,6 +60,7 @@ display: block; | |||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| color: #000000; | color: #000000; | ||||
| letter-spacing: 0.7rpx; | letter-spacing: 0.7rpx; | ||||
| overflow: hidden; | |||||
| } | } | ||||
| .index-scroll-view .commodity-info-time { | .index-scroll-view .commodity-info-time { | ||||
| @@ -72,6 +73,7 @@ display: block; | |||||
| .index-scroll-view .commodity-info-price-p { | .index-scroll-view .commodity-info-price-p { | ||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| color: #f96563; | color: #f96563; | ||||
| line-height: 36rpx; | |||||
| } | } | ||||
| .index-scroll-view .commodity-info-price-o { | .index-scroll-view .commodity-info-price-o { | ||||
| display: inline-block; | display: inline-block; | ||||
| @@ -80,7 +82,9 @@ display: block; | |||||
| color: #B4B4B4; | color: #B4B4B4; | ||||
| letter-spacing: 0.96rpx; | letter-spacing: 0.96rpx; | ||||
| text-decoration:line-through; | text-decoration:line-through; | ||||
| line-height: 36rpx; | |||||
| } | |||||
| .commodity-info-price{ | |||||
| line-height: 36rpx; | |||||
| } | } | ||||
| @@ -72,7 +72,7 @@ Page({ | |||||
| data: variable | data: variable | ||||
| }).then(res => { | }).then(res => { | ||||
| console.log(res); | console.log(res); | ||||
| if (pageNum >= res.data.pages) { | |||||
| if (pageNum > res.data.pages) { | |||||
| that.setData({ | that.setData({ | ||||
| allow_load: false | allow_load: false | ||||
| }); | }); | ||||
| @@ -79,7 +79,7 @@ Page({ | |||||
| setTimeout(function () { | setTimeout(function () { | ||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| }, 1200); | }, 1200); | ||||
| if (pageNum >= res.data.pages) { | |||||
| if (pageNum > res.data.pages) { | |||||
| that.setData({ | that.setData({ | ||||
| allow_load: false | allow_load: false | ||||
| }); | }); | ||||