Commit a7360293dd89dd3522d9ec0ac177befad9b4da89

Authored by yvan.ni
1 parent f1981f67

商品分类的分享朋友券, 下拉到最后一个分类的时候的bug修复

pages/goods/categoryList/categoryList.js
... ... @@ -819,7 +819,7 @@ Page({
819 819 // },
820 820 // 左侧更新
821 821 scrollLower: function (data) {
822   - //console.log("上拉加载更多", JSON.stringify(data))
  822 + if(this.data.is_no_more) return false;
823 823 var that = this;
824 824 clearInterval(that.data.timer);
825 825 that.setData({
... ... @@ -843,18 +843,17 @@ Page({
843 843 });
844 844 if (e.data.data.pageData.length > 0) {
845 845 s.setData({
846   - msgStatus: false,
  846 + msgStatus: false,is_no_more:0
847 847 });
848 848 //如果有数据 判断分页为第一页的时候直接渲染数据
849 849 if (page > 1) {
850 850 //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面
851 851 var arr = s.data.requestData
852   - console.log("arr:=" + JSON.stringify(arr))
853   -
  852 +
854 853 for (var i = 0; i < e.data.data.pageData.length;i++){
855 854 arr.push(e.data.data.pageData[i]);
856 855 }
857   - console.log(arr)
  856 +
858 857 s.setData({
859 858 requestData: arr
860 859 });
... ... @@ -875,19 +874,28 @@ Page({
875 874 if (page != 1) {
876 875 var dataArray = s.data.one_level_classify
877 876 var index = s.data.index
878   - dataArray[index]['items']['is_show_class'] = false
879   - dataArray[index+1]['items']['is_show_class'] = true
880   - console.log(dataArray[index + 1]['items'])
881   - s.setData({
882   - msgStatus: true,
883   - stylePage: 1,
884   - index: index + 1,
885   - select_classify_on: index + 1,
886   - cat_id: dataArray[index + 1]['items']['id'],
887   - classify_name: dataArray[index + 1]['items']['name'],
888   - one_level_classify: dataArray
889   - });
890   - s.style(s.data.stylePage, dataArray[index + 1]['items']['id'])
  877 + dataArray[index]['items']['is_show_class'] = false
  878 + //没有下一个类别的时候
  879 + if(index+1>=dataArray.length){
  880 + s.setData({is_no_more:1});
  881 + }else{
  882 + dataArray[index+1]['items']['is_show_class'] = true
  883 + console.log(dataArray[index + 1]['items'])
  884 + s.setData({
  885 + msgStatus: true,
  886 + stylePage: 1,
  887 + index: index + 1,
  888 + select_classify_on: index + 1,
  889 + cat_id: dataArray[index + 1]['items']['id'],
  890 + classify_name: dataArray[index + 1]['items']['name'],
  891 + one_level_classify: dataArray,
  892 + is_no_more:0
  893 + });
  894 + s.style(s.data.stylePage, dataArray[index + 1]['items']['id'])
  895 + }
  896 +
  897 +
  898 +
891 899 }else{
892 900 //没有数据而且是第一页的时候
893 901 s.setData({
... ... @@ -897,7 +905,8 @@ Page({
897 905 s.setData({
898 906 msgStatus: true,
899 907 countDownNum: countDownNum,
900   - requestData: []
  908 + requestData: [],
  909 + is_no_more:0,
901 910 });
902 911 s.data.timer=setInterval(function () {
903 912 if (countDownNum == 0) {
... ... @@ -1013,12 +1022,11 @@ Page({
1013 1022 if(url[0]!='/') url='/'+url;
1014 1023 getApp().goto(url);
1015 1024 },
1016   -
1017   -
1018   - onShareTimeline() {
1019   - return {
1020   - title: '商品分类-' + getApp().globalData.config.store_name,
1021   - }
1022   - },
  1025 +
  1026 + onShareTimeline(){
  1027 + return {
  1028 + title:'商品分类-'+getApp().globalData.config.store_name,
  1029 + }
  1030 + }
1023 1031  
1024 1032 });
1025 1033 \ No newline at end of file
... ...
pages/goods/categoryList/categoryList.wxml
... ... @@ -493,6 +493,9 @@
493 493 </block>
494 494 </view>
495 495 </navigator>
  496 + <!-- 暂无更多 -->
  497 + <view style="height: 30rpx;line-height: 30rpx;margin-top: 20rpx;font-size: 25rpx; text-align: center;"
  498 + wx:if="{{is_no_more}}">暂无更多</view>
496 499 </view>
497 500 <view class="no-data" wx:if="{{msgStatus == true}}">
498 501 <!-- <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> -->
... ... @@ -500,8 +503,9 @@
500 503 <view wx:if="{{msgStatus == true && lastMsg == false}}" class="no-data-title" style="text-align:center;margin-top:100px">
501 504 <view style="color:#444;line-height:30px;">该类别暂无推荐商品</view><view style="color:#444;line-height:30px;"> {{countDownNum}} 秒后自动跳到下一个类别</view> </view>
502 505 <view wx:elif="{{lastMsg == true && msgStatus == true}}" class="no-data-title" style="text-align:center;margin-top:100px">该类别暂无推荐商品</view>
503   - <!-- <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator> -->
  506 + <!-- <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator> -->
504 507 </view>
  508 +
505 509  
506 510 </scroll-view>
507 511 <!-- /goodslist -->
... ...