Commit ed33b2fce8aae21ff7478a04ffaf0f1ee2c68957
1 parent
55291fd9
上拉加载更多
Showing
3 changed files
with
55 additions
and
21 deletions
src/components/giftGivingItem/giftGivingItem.less
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | font-weight: 400; | 18 | font-weight: 400; |
| 19 | color: rgba(51, 51, 51, 1); | 19 | color: rgba(51, 51, 51, 1); |
| 20 | line-height: 50px; | 20 | line-height: 50px; |
| 21 | - width: 400px; | 21 | + width: 320px; |
| 22 | overflow: hidden; | 22 | overflow: hidden; |
| 23 | text-overflow: ellipsis; | 23 | text-overflow: ellipsis; |
| 24 | white-space: nowrap; | 24 | white-space: nowrap; |
src/pages/myGiftBox/myGiftBox.less
| @@ -47,7 +47,15 @@ | @@ -47,7 +47,15 @@ | ||
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | .item_box{ | 49 | .item_box{ |
| 50 | - height: calc(100vh-90px); | ||
| 51 | - overflow-y: auto; | 50 | + // height: calc(100vh-200px); |
| 51 | + padding-bottom: 40px; | ||
| 52 | + // overflow-y: auto; | ||
| 53 | + height: auto; | ||
| 54 | + } | ||
| 55 | + .tip_text{ | ||
| 56 | + text-align: center; | ||
| 57 | + margin-top: 20px; | ||
| 58 | + font-size: 26px; | ||
| 59 | + color: #999; | ||
| 52 | } | 60 | } |
| 53 | } | 61 | } |
src/pages/myGiftBox/myGiftBox.vue
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | <div class="item_box"> | 18 | <div class="item_box"> |
| 19 | <div | 19 | <div |
| 20 | infinite-scroll-immediate-check="true" | 20 | infinite-scroll-immediate-check="true" |
| 21 | - v-infinite-scroll="getorderGiftList" | 21 | + v-infinite-scroll="onInfiniteScroll" |
| 22 | infinite-scroll-disabled="loading" | 22 | infinite-scroll-disabled="loading" |
| 23 | :infinite-scroll-distance="50" | 23 | :infinite-scroll-distance="50" |
| 24 | > | 24 | > |
| @@ -37,6 +37,8 @@ | @@ -37,6 +37,8 @@ | ||
| 37 | :giftGivingItem="giftGivingItem" | 37 | :giftGivingItem="giftGivingItem" |
| 38 | > | 38 | > |
| 39 | </giftGivingItem> | 39 | </giftGivingItem> |
| 40 | + <!-- 没有更多了 --> | ||
| 41 | + <div class="tip_text">{{this.tipText}}</div> | ||
| 40 | </div> | 42 | </div> |
| 41 | </div> | 43 | </div> |
| 42 | </div> | 44 | </div> |
| @@ -53,16 +55,18 @@ export default { | @@ -53,16 +55,18 @@ export default { | ||
| 53 | return { | 55 | return { |
| 54 | active: 0, | 56 | active: 0, |
| 55 | receivingGiftsInfo: null, // 收礼列表页数据 | 57 | receivingGiftsInfo: null, // 收礼列表页数据 |
| 56 | - receivingGifts: { | 58 | + loading: false, // 判断是否加载 |
| 59 | + receivingGifts: { // 收礼 | ||
| 57 | loading: false, // 加载 | 60 | loading: false, // 加载 |
| 58 | pages: 0 // 分页 | 61 | pages: 0 // 分页 |
| 59 | }, | 62 | }, |
| 60 | giftGivingItem: null, // 送礼列表页数据 | 63 | giftGivingItem: null, // 送礼列表页数据 |
| 61 | - giftsRuleUrl:null, // 礼物规则URL | ||
| 62 | - giftGiving: { | 64 | + giftsRuleUrl: null, // 礼物规则URL |
| 65 | + giftGiving: { // 送礼 | ||
| 63 | loading: false, // 加载 | 66 | loading: false, // 加载 |
| 64 | pages: 0 // 分页 | 67 | pages: 0 // 分页 |
| 65 | - } | 68 | + }, |
| 69 | + tipText:null // 是否已加载完 | ||
| 66 | }; | 70 | }; |
| 67 | }, | 71 | }, |
| 68 | components: { | 72 | components: { |
| @@ -75,20 +79,46 @@ export default { | @@ -75,20 +79,46 @@ export default { | ||
| 75 | // 送礼订单列表 | 79 | // 送礼订单列表 |
| 76 | this.getorderGiveGiftList(); | 80 | this.getorderGiveGiftList(); |
| 77 | // 赠礼规则 | 81 | // 赠礼规则 |
| 78 | - this.orderGiftContent() | 82 | + this.orderGiftContent(); |
| 79 | }, | 83 | }, |
| 80 | methods: { | 84 | methods: { |
| 85 | + /** | ||
| 86 | + * tab切换 | ||
| 87 | + */ | ||
| 81 | onTap(active) { | 88 | onTap(active) { |
| 82 | this.active = active; | 89 | this.active = active; |
| 90 | + // 初始化加载状态 | ||
| 91 | + this.loading = false; | ||
| 83 | if (active === 1) { | 92 | if (active === 1) { |
| 84 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 | 93 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 |
| 85 | this.setGiftBottomVisibleBySwitchTab(1); | 94 | this.setGiftBottomVisibleBySwitchTab(1); |
| 95 | + // 送礼订单列表 | ||
| 96 | + this.getorderGiveGiftList(); | ||
| 86 | } else { | 97 | } else { |
| 98 | + // 收礼订单列表 | ||
| 99 | + this.getorderGiftList(); | ||
| 87 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 | 100 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 |
| 88 | this.setGiftBottomVisibleBySwitchTab(0); | 101 | this.setGiftBottomVisibleBySwitchTab(0); |
| 89 | } | 102 | } |
| 90 | }, | 103 | }, |
| 91 | /** | 104 | /** |
| 105 | + * 下啦滑动加载更多 | ||
| 106 | + */ | ||
| 107 | + onInfiniteScroll() { | ||
| 108 | + if (this.active === 0) { | ||
| 109 | + // 收礼订单列表 | ||
| 110 | + this.loading = this.receivingGifts.loading | ||
| 111 | + this.getorderGiftList(); | ||
| 112 | + } else { | ||
| 113 | + // 送礼订单列表 | ||
| 114 | + this.loading = this.giftGiving.loading | ||
| 115 | + this.getorderGiveGiftList(); | ||
| 116 | + } | ||
| 117 | + if(!this.loading){ | ||
| 118 | + this.tipText = "已经全部加载完毕" | ||
| 119 | + } | ||
| 120 | + }, | ||
| 121 | + /** | ||
| 92 | * 显示和隐藏聊天 | 122 | * 显示和隐藏聊天 |
| 93 | */ | 123 | */ |
| 94 | setGiftBottomVisibleBySwitchTab(itme) { | 124 | setGiftBottomVisibleBySwitchTab(itme) { |
| @@ -157,7 +187,7 @@ export default { | @@ -157,7 +187,7 @@ export default { | ||
| 157 | if (datas.list && datas.list.length) { | 187 | if (datas.list && datas.list.length) { |
| 158 | // 隐藏加载圈 | 188 | // 隐藏加载圈 |
| 159 | this.receivingGifts.loading = false; | 189 | this.receivingGifts.loading = false; |
| 160 | - if (this.pages > 1) { | 190 | + if (this.receivingGifts.pages > 1) { |
| 161 | this.$set(this, "receivingGiftsInfo", [ | 191 | this.$set(this, "receivingGiftsInfo", [ |
| 162 | ...this.receivingGiftsInfo, | 192 | ...this.receivingGiftsInfo, |
| 163 | ...datas.list | 193 | ...datas.list |
| @@ -277,15 +307,11 @@ export default { | @@ -277,15 +307,11 @@ export default { | ||
| 277 | if (datas.list && datas.list.length) { | 307 | if (datas.list && datas.list.length) { |
| 278 | // 隐藏加载圈 | 308 | // 隐藏加载圈 |
| 279 | this.giftGiving.loading = false; | 309 | this.giftGiving.loading = false; |
| 280 | - if (this.pages > 1) { | ||
| 281 | - this.$set(this, "giftGivingItem", [ | ||
| 282 | - ...this.giftGivingItem, | ||
| 283 | - ...datas.list | ||
| 284 | - ]); | 310 | + if (this.giftGiving.pages > 1) { |
| 311 | + this.$set(this, "giftGivingItem",[...this.giftGivingItem,...datas.list]); | ||
| 285 | } else { | 312 | } else { |
| 286 | this.$set(this, "giftGivingItem", datas.list); | 313 | this.$set(this, "giftGivingItem", datas.list); |
| 287 | } | 314 | } |
| 288 | - console.log(this.giftGivingItem); | ||
| 289 | } | 315 | } |
| 290 | /* 获取送礼订单列表 结束 */ | 316 | /* 获取送礼订单列表 结束 */ |
| 291 | } else if (res.code == 400) { | 317 | } else if (res.code == 400) { |
| @@ -318,19 +344,19 @@ export default { | @@ -318,19 +344,19 @@ export default { | ||
| 318 | * @param {object} res [服务器返回数据] | 344 | * @param {object} res [服务器返回数据] |
| 319 | * @param {object} ext [扩展参数] | 345 | * @param {object} ext [扩展参数] |
| 320 | */ | 346 | */ |
| 321 | - orderGiftContentCallback(res, ext){ | ||
| 322 | - // 加载完成 | 347 | + orderGiftContentCallback(res, ext) { |
| 348 | + // 加载完成 | ||
| 323 | Indicator.close(); | 349 | Indicator.close(); |
| 324 | 350 | ||
| 325 | // 返回处理 | 351 | // 返回处理 |
| 326 | if (res.code == 200) { | 352 | if (res.code == 200) { |
| 327 | - // 解构数据 | 353 | + // 解构数据 |
| 328 | let { data: datas } = res; | 354 | let { data: datas } = res; |
| 329 | - this.giftsRuleUrl = datas.content | 355 | + this.giftsRuleUrl = datas.content; |
| 330 | } | 356 | } |
| 331 | }, | 357 | }, |
| 332 | // 送礼规则说明 | 358 | // 送礼规则说明 |
| 333 | - giftRules(){ | 359 | + giftRules() { |
| 334 | // 判断并调用通用跳转 | 360 | // 判断并调用通用跳转 |
| 335 | if (typeof this.$parent.gotoDetail === "function") { | 361 | if (typeof this.$parent.gotoDetail === "function") { |
| 336 | // 临时,设置跳转商品详情参数 | 362 | // 临时,设置跳转商品详情参数 |