Showing
4 changed files
with
44 additions
and
13 deletions
| 1 | // pages/me/follow.js | 1 | // pages/me/follow.js |
| 2 | import util from '../../utils/util'; | 2 | import util from '../../utils/util'; |
| 3 | import App from '../../utils/api'; | 3 | import App from '../../utils/api'; |
| 4 | -const {regeneratorRuntime} = global | 4 | +const createRecycleContext = require('miniprogram-recycle-view') |
| 5 | Page({ | 5 | Page({ |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| @@ -16,6 +16,21 @@ Page({ | @@ -16,6 +16,21 @@ Page({ | ||
| 16 | * 生命周期函数--监听页面加载 | 16 | * 生命周期函数--监听页面加载 |
| 17 | */ | 17 | */ |
| 18 | options:null, | 18 | options:null, |
| 19 | + ctx:null, | ||
| 20 | + onReady: function() { | ||
| 21 | + this.ctx = createRecycleContext({ | ||
| 22 | + id: 'recycleId', | ||
| 23 | + dataKey: 'sellers', | ||
| 24 | + page: this, | ||
| 25 | + itemSize: { // 这个参数也可以直接传下面定义的this.itemSizeFunc函数 | ||
| 26 | + width: 337, | ||
| 27 | + height: 150 | ||
| 28 | + } | ||
| 29 | + }) | ||
| 30 | + // ctx.append(newList) | ||
| 31 | + // ctx.update(beginIndex, list) | ||
| 32 | + // ctx.destroy() | ||
| 33 | + }, | ||
| 19 | onLoad: function (options) { | 34 | onLoad: function (options) { |
| 20 | //latitude=34.215637&longitude=108.891264&scale=16&height=397 | 35 | //latitude=34.215637&longitude=108.891264&scale=16&height=397 |
| 21 | this.options=options | 36 | this.options=options |
| @@ -39,12 +54,6 @@ Page({ | @@ -39,12 +54,6 @@ Page({ | ||
| 39 | sellers:sellers | 54 | sellers:sellers |
| 40 | }) | 55 | }) |
| 41 | }, | 56 | }, |
| 42 | - /** | ||
| 43 | - * 生命周期函数--监听页面初次渲染完成 | ||
| 44 | - */ | ||
| 45 | - onReady: function () { | ||
| 46 | - | ||
| 47 | - }, | ||
| 48 | 57 | ||
| 49 | /** | 58 | /** |
| 50 | * 生命周期函数--监听页面显示 | 59 | * 生命周期函数--监听页面显示 |
| @@ -84,7 +93,12 @@ Page({ | @@ -84,7 +93,12 @@ Page({ | ||
| 84 | * 页面上拉触底事件的处理函数 | 93 | * 页面上拉触底事件的处理函数 |
| 85 | */ | 94 | */ |
| 86 | onReachBottom: function (e) { | 95 | onReachBottom: function (e) { |
| 87 | - console.log(e) | 96 | + // console.log(e) |
| 97 | + // if(this.hasMore){ | ||
| 98 | + // this.GetCollectionSellerList(); | ||
| 99 | + // } | ||
| 100 | + }, | ||
| 101 | + scrollToLower(){ | ||
| 88 | if(this.hasMore){ | 102 | if(this.hasMore){ |
| 89 | this.GetCollectionSellerList(); | 103 | this.GetCollectionSellerList(); |
| 90 | } | 104 | } |
| @@ -124,9 +138,10 @@ Page({ | @@ -124,9 +138,10 @@ Page({ | ||
| 124 | } | 138 | } |
| 125 | seller.hasFollow=true | 139 | seller.hasFollow=true |
| 126 | }) | 140 | }) |
| 141 | + this.ctx.append(sellers) | ||
| 127 | sellers=[...this.data.sellers,...sellers] | 142 | sellers=[...this.data.sellers,...sellers] |
| 128 | this.setData({ | 143 | this.setData({ |
| 129 | - sellers:sellers, | 144 | + //sellers:sellers, |
| 130 | hasMore:this.hasMore, | 145 | hasMore:this.hasMore, |
| 131 | }) | 146 | }) |
| 132 | this.sellers=sellers | 147 | this.sellers=sellers |
| @@ -6,6 +6,8 @@ | @@ -6,6 +6,8 @@ | ||
| 6 | "formids":"/components/formids/formids", | 6 | "formids":"/components/formids/formids", |
| 7 | "nav":"/components/nav/nav", | 7 | "nav":"/components/nav/nav", |
| 8 | "getpos":"/components/userinfo/getpos", | 8 | "getpos":"/components/userinfo/getpos", |
| 9 | - "sb-tr":"/components/reserve/seller-box-transverse/seller-box" | 9 | + "sb-tr":"/components/reserve/seller-box-transverse/seller-box", |
| 10 | + "recycle-view": "miniprogram-recycle-view/recycle-view", | ||
| 11 | + "recycle-item": "miniprogram-recycle-view/recycle-item" | ||
| 10 | } | 12 | } |
| 11 | } | 13 | } |
| 1 | <!--pages/reserve/discount.wxml--> | 1 | <!--pages/reserve/discount.wxml--> |
| 2 | <nav>特惠榜</nav> | 2 | <nav>特惠榜</nav> |
| 3 | -<image class="banner" | ||
| 4 | - src="http://qn.colorcun.com/reserve/images/%E7%B2%BE%E9%80%89%E6%8A%98%E6%89%A3.png"></image> | ||
| 5 | <view class="pages"> | 3 | <view class="pages"> |
| 6 | <view class="follow"> | 4 | <view class="follow"> |
| 5 | + <!-- | ||
| 7 | <view class="seller" wx:for="{{sellers}}" wx:key="sellers.key" | 6 | <view class="seller" wx:for="{{sellers}}" wx:key="sellers.key" |
| 8 | bindtap="gotoDetail" data-sid="{{item.id}}" wx:if="{{item.hasFollow}}"> | 7 | bindtap="gotoDetail" data-sid="{{item.id}}" wx:if="{{item.hasFollow}}"> |
| 9 | <sb-tr seller="{{item}}" | 8 | <sb-tr seller="{{item}}" |
| 10 | hasActivity="{{true}}" hasAverage="{{false}}" | 9 | hasActivity="{{true}}" hasAverage="{{false}}" |
| 11 | hasSlogan="{{true}}" sellerStyle="noborder noshadow"></sb-tr> | 10 | hasSlogan="{{true}}" sellerStyle="noborder noshadow"></sb-tr> |
| 12 | </view> | 11 | </view> |
| 13 | - <view class="flex-vc" wx:if="{{!hasMore}}">没有更多了</view> | 12 | + --> |
| 13 | + <recycle-view batch="{{batchSetRecycleData}}" id="recycleId" bindscrolltolower="scrollToLower"> | ||
| 14 | + <view slot="before"> | ||
| 15 | + <image class="banner" | ||
| 16 | + src="http://qn.colorcun.com/reserve/images/%E7%B2%BE%E9%80%89%E6%8A%98%E6%89%A3.png"></image> | ||
| 17 | + </view> | ||
| 18 | + <recycle-item wx:for="{{sellers}}" wx:key="sellers.key" | ||
| 19 | + class="seller" style="width: 90%;" | ||
| 20 | + bindtap="gotoDetail" data-sid="{{item.id}}" wx:if="{{item.hasFollow}}"> | ||
| 21 | + <sb-tr seller="{{item}}" | ||
| 22 | + hasActivity="{{true}}" hasAverage="{{false}}" | ||
| 23 | + hasSlogan="{{true}}" sellerStyle="noborder noshadow"></sb-tr> | ||
| 24 | + </recycle-item> | ||
| 25 | + <view slot="after"><view class="flex-vc" wx:if="{{!hasMore}}">没有更多了</view></view> | ||
| 26 | + </recycle-view> | ||
| 14 | </view> | 27 | </view> |
| 15 | </view> | 28 | </view> |
| 16 | <getpos bindpos="onpos" id="getpos" hasAllowFail></getpos> | 29 | <getpos bindpos="onpos" id="getpos" hasAllowFail></getpos> |
-
Please register or login to post a comment