Commit 9b8c5b74d0c08187c9891d53e635c880f177c65c

Authored by zhiyangdu
1 parent 4b60f736

加载更多

Showing 1 changed file with 83 additions and 96 deletions
src/pages/newDaren/newDaren.vue
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 28
29 <!-- 最新动态标题 --> 29 <!-- 最新动态标题 -->
30 <text-title-box slot="title-box" @more="newDarenDynamicsMore" 30 <text-title-box slot="title-box" @more="newDarenDynamicsMore"
31 - :titles="{ 31 + :titles="{
32 title: '已关注达人', 32 title: '已关注达人',
33 more: true 33 more: true
34 }"> 34 }">
@@ -43,14 +43,15 @@ @@ -43,14 +43,15 @@
43 }"> 43 }">
44 </text-title-box> 44 </text-title-box>
45 <div class="item_box"> 45 <div class="item_box">
46 - <div infinite-scroll-immediate-check="true"  
47 - v-infinite-scroll="loadNewDynamic"  
48 - infinite-scroll-disabled="paging.shopFnsDynamic.loading"  
49 - :infinite-scroll-distance="paging.distance">  
50 - <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary"  
51 - :lists="shopFnsDynamic">  
52 -  
53 - </daren-list-box> 46 + <div
  47 + infinite-scroll-immediate-check="true"
  48 + v-infinite-scroll="getNewDynamicList"
  49 + infinite-scroll-disabled="loading"
  50 + :infinite-scroll-distance="50">
  51 + <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary"
  52 + :lists="shopFnsDynamic">
  53 +
  54 + </daren-list-box>
54 </div> 55 </div>
55 </div> 56 </div>
56 </div> 57 </div>
@@ -61,8 +62,8 @@ @@ -61,8 +62,8 @@
61 // 引入组件 62 // 引入组件
62 import { Toast, Indicator } from "mint-ui"; 63 import { Toast, Indicator } from "mint-ui";
63 import swiper from "@/components/swiper/swiper"; 64 import swiper from "@/components/swiper/swiper";
64 - import darenListBox from "@/components/darenListBox/darenListBox";  
65 - import textTitleBox from "@/components/textTitleBox/textTitleBox"; 65 + import darenListBox from "@/components/darenListBox/darenListBox";
  66 + import textTitleBox from "@/components/textTitleBox/textTitleBox";
66 import shopDatenTop from "@/components/shopDatenTop/shopDatenTop"; 67 import shopDatenTop from "@/components/shopDatenTop/shopDatenTop";
67 import horizList from "@/components/horizList/horizList"; 68 import horizList from "@/components/horizList/horizList";
68 export default { 69 export default {
@@ -75,13 +76,8 @@ @@ -75,13 +76,8 @@
75 shopDarenHot: null, // 达人推荐列表 76 shopDarenHot: null, // 达人推荐列表
76 fansDaren: null, // 已关注达人动态 77 fansDaren: null, // 已关注达人动态
77 shopFnsDynamic: null, // 达人动态 78 shopFnsDynamic: null, // 达人动态
78 - paging: { // 分页  
79 - shopFnsDynamic: {  
80 - loading: true,  
81 - page: 1  
82 - },  
83 - distance: 50  
84 - } 79 + loading: false, // 加载
  80 + pages:0 // 分页
85 } 81 }
86 }, 82 },
87 components:{ 83 components:{
@@ -99,31 +95,22 @@ @@ -99,31 +95,22 @@
99 // 获取优选库精选活动 95 // 获取优选库精选活动
100 this.newDarenIndex(); 96 this.newDarenIndex();
101 // 达人最新动态 97 // 达人最新动态
102 - this.getNewDynamicList(1); 98 + this.getNewDynamicList();
103 }, 99 },
104 methods: { 100 methods: {
105 /** 101 /**
106 - * 上拉加载“商品推荐”  
107 - */  
108 - loadNewDynamic() {  
109 - // 设置“精品推荐”页码  
110 - this.$set(this.paging.shopFnsDynamic, "page", ++this.paging.shopFnsDynamic.page);  
111 -  
112 - // 调用接口  
113 - this.getNewDynamicList(this.paging.shopFnsDynamic.page)  
114 - },  
115 - /**  
116 * 达人最新动态 102 * 达人最新动态
117 */ 103 */
118 - getNewDynamicList(page) { 104 + getNewDynamicList() {
  105 + this.loading = true;
  106 + this.pages++
119 // 加载中提示 107 // 加载中提示
120 Indicator.open("加载中..."); 108 Indicator.open("加载中...");
121 - // 加载中  
122 - this.$set(this.paging.shopFnsDynamic, "loading", true); 109 +
123 // 获取证书请求接口 110 // 获取证书请求接口
124 this.http("/Api/" + this.getApiVersion().dynamic + "/getNewDynamicList", { 111 this.http("/Api/" + this.getApiVersion().dynamic + "/getNewDynamicList", {
125 uid: this.$route.query.uid, 112 uid: this.$route.query.uid,
126 - page: page, 113 + page: this.pages,
127 type: 1 114 type: 1
128 }, this.getNewDynamicListCallback, { 115 }, this.getNewDynamicListCallback, {
129 method: "post" 116 method: "post"
@@ -148,10 +135,10 @@ @@ -148,10 +135,10 @@
148 // 设置shopFnsDynamic达人动态数据 135 // 设置shopFnsDynamic达人动态数据
149 136
150 if (datas.list && datas.list.length) { 137 if (datas.list && datas.list.length) {
  138 + // 隐藏加载圈
  139 + this.loading = false;
151 this.$set(this, "shopFnsDynamic", datas.list); 140 this.$set(this, "shopFnsDynamic", datas.list);
152 } 141 }
153 - // 设置还有需要加载的内容  
154 - this.$set(this.paging.shopFnsDynamic, "loading", false);  
155 /* 获取达人动态数据 结束 */ 142 /* 获取达人动态数据 结束 */
156 143
157 } else if (res.code == 400) { 144 } else if (res.code == 400) {
@@ -211,8 +198,8 @@ @@ -211,8 +198,8 @@
211 198
212 /* 获取优选库精选活动数据 开始 */ 199 /* 获取优选库精选活动数据 开始 */
213 if(datas.title){ 200 if(datas.title){
214 - // 设置标题  
215 - this.$set(this, "title", datas.title); 201 + // 设置标题
  202 + this.$set(this, "title", datas.title);
216 } 203 }
217 204
218 205
@@ -248,52 +235,52 @@ @@ -248,52 +235,52 @@
248 } 235 }
249 }, 236 },
250 /** 237 /**
251 - * 关注/取消关注达人  
252 - */  
253 - fansShop(item) {  
254 - Indicator.open("加载中...");  
255 - // 判断必要参数  
256 - if (item.id && this.$route.query.uid) {  
257 - // 请求接口  
258 - this.http("/Api/" + this.getApiVersion().dynamic + "/fansShop", {  
259 - id: item.id || 0,  
260 - uid: this.$route.query.uid || 0  
261 - }, this.fansShopCallback, {  
262 - method: "post",  
263 - item  
264 - }  
265 - );  
266 - }  
267 - }, 238 + * 关注/取消关注达人
  239 + */
  240 + fansShop(item) {
  241 + Indicator.open("加载中...");
  242 + // 判断必要参数
  243 + if (item.id && this.$route.query.uid) {
  244 + // 请求接口
  245 + this.http("/Api/" + this.getApiVersion().dynamic + "/fansShop", {
  246 + id: item.id || 0,
  247 + uid: this.$route.query.uid || 0
  248 + }, this.fansShopCallback, {
  249 + method: "post",
  250 + item
  251 + }
  252 + );
  253 + }
  254 + },
268 255
269 - /**  
270 - * 关注/取消关注达人回调  
271 - * @param {object} res [服务器返回数据]  
272 - * @param {object} ext [扩展参数]  
273 - */  
274 - fansShopCallback(res, ext) { 256 + /**
  257 + * 关注/取消关注达人回调
  258 + * @param {object} res [服务器返回数据]
  259 + * @param {object} ext [扩展参数]
  260 + */
  261 + fansShopCallback(res, ext) {
275 262
276 - // 加载完成 263 + // 加载完成
277 Indicator.close(); 264 Indicator.close();
278 - if (res.code) {  
279 - // 设置已关注  
280 - if (ext.item.is_fans == "0") {  
281 - // 关注达人  
282 - this.$set(ext.item, "is_fans", "1");  
283 - }else{  
284 - // 取消关注达人  
285 - this.$set(ext.item, "is_fans", "0");  
286 - }  
287 - }else if (res.statusCode === 200 && res.data.code == 400) {  
288 -  
289 - // 关注失败  
290 - this.showToast(res.data.message);  
291 - } else {  
292 -  
293 - // 关注失败  
294 - this.showToast("关注失败");  
295 - }  
296 - }, 265 + if (res.code) {
  266 + // 设置已关注
  267 + if (ext.item.is_fans == "0") {
  268 + // 关注达人
  269 + this.$set(ext.item, "is_fans", "1");
  270 + }else{
  271 + // 取消关注达人
  272 + this.$set(ext.item, "is_fans", "0");
  273 + }
  274 + }else if (res.statusCode === 200 && res.data.code == 400) {
  275 +
  276 + // 关注失败
  277 + this.showToast(res.data.message);
  278 + } else {
  279 +
  280 + // 关注失败
  281 + this.showToast("关注失败");
  282 + }
  283 + },
297 /** 284 /**
298 * 调用通用跳转 285 * 调用通用跳转
299 * @param {object} item [通用跳转对象] 286 * @param {object} item [通用跳转对象]
@@ -346,11 +333,11 @@ @@ -346,11 +333,11 @@
346 } 333 }
347 }, 334 },
348 335
349 - /**  
350 - * 用户头像/昵称,点击跳转  
351 - * @param {object} item [数据对象]  
352 - */  
353 - userJump(item) { 336 + /**
  337 + * 用户头像/昵称,点击跳转
  338 + * @param {object} item [数据对象]
  339 + */
  340 + userJump(item) {
354 341
355 // 判断并调用通用跳转 342 // 判断并调用通用跳转
356 if (typeof this.$parent.gotoDetail === "function") { 343 if (typeof this.$parent.gotoDetail === "function") {
@@ -373,10 +360,10 @@ @@ -373,10 +360,10 @@
373 }, 360 },
374 361
375 /** 362 /**
376 - * 点击跳转商品  
377 - * @param {object} item [数据对象]  
378 - */  
379 - goodsJump(item) { 363 + * 点击跳转商品
  364 + * @param {object} item [数据对象]
  365 + */
  366 + goodsJump(item) {
380 367
381 // 判断并调用通用跳转 368 // 判断并调用通用跳转
382 if (typeof this.$parent.gotoDetail === "function") { 369 if (typeof this.$parent.gotoDetail === "function") {
@@ -395,13 +382,13 @@ @@ -395,13 +382,13 @@
395 382
396 this.$parent.gotoDetail(item); 383 this.$parent.gotoDetail(item);
397 } 384 }
398 - }, 385 + },
399 386
400 - /**  
401 - * 点击跳转商品购买  
402 - * @param {object} item [数据对象]  
403 - */  
404 - goodsPrimary(item) { 387 + /**
  388 + * 点击跳转商品购买
  389 + * @param {object} item [数据对象]
  390 + */
  391 + goodsPrimary(item) {
405 392
406 // 判断并调用通用跳转 393 // 判断并调用通用跳转
407 if (typeof this.$parent.gotoDetail === "function") { 394 if (typeof this.$parent.gotoDetail === "function") {
@@ -420,7 +407,7 @@ @@ -420,7 +407,7 @@
420 407
421 this.$parent.gotoDetail(item); 408 this.$parent.gotoDetail(item);
422 } 409 }
423 - } 410 + }
424 }, 411 },
425 head: { 412 head: {
426 title () { 413 title () {