Commit 80fe482e4c7b780943f3ab2ed529695a0abc3252

Authored by zhiyangdu
1 parent 2a16629e

加载更多动态

Showing 1 changed file with 20 additions and 23 deletions
src/pages/newDaren/newDaren.vue
@@ -43,17 +43,16 @@ @@ -43,17 +43,16 @@
43 }"> 43 }">
44 </text-title-box> 44 </text-title-box>
45 <div class="item_box"> 45 <div class="item_box">
46 - <ul  
47 - v-infinite-scroll="loadMore" 46 + <div
  47 + infinite-scroll-immediate-check="true"
  48 + v-infinite-scroll="getNewDynamicList"
48 infinite-scroll-disabled="loading" 49 infinite-scroll-disabled="loading"
49 :infinite-scroll-distance="50"> 50 :infinite-scroll-distance="50">
50 - <li v-for="(item, index) in list" :key="index">  
51 <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary" 51 <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary"
52 :lists="shopFnsDynamic"> 52 :lists="shopFnsDynamic">
53 53
54 </daren-list-box> 54 </daren-list-box>
55 - </li>  
56 - </ul> 55 + </div>
57 </div> 56 </div>
58 </div> 57 </div>
59 </template> 58 </template>
@@ -78,7 +77,7 @@ @@ -78,7 +77,7 @@
78 fansDaren: null, // 已关注达人动态 77 fansDaren: null, // 已关注达人动态
79 shopFnsDynamic: null, // 达人动态 78 shopFnsDynamic: null, // 达人动态
80 loading: false, // 加载 79 loading: false, // 加载
81 - pages:1 // 分页 80 + pages:0 // 分页
82 } 81 }
83 }, 82 },
84 components:{ 83 components:{
@@ -95,24 +94,24 @@ @@ -95,24 +94,24 @@
95 94
96 // 获取优选库精选活动 95 // 获取优选库精选活动
97 this.newDarenIndex(); 96 this.newDarenIndex();
  97 + // 达人最新动态
  98 + this.getNewDynamicList();
98 }, 99 },
99 methods: { 100 methods: {
100 - // 最新达人动态  
101 - loadMore() {  
102 - this.loading = true;  
103 - this.pages++  
104 - this.getNewDynamicList(this.pages)  
105 - },  
106 /** 101 /**
107 * 达人最新动态 102 * 达人最新动态
108 */ 103 */
109 getNewDynamicList() { 104 getNewDynamicList() {
  105 + this.loading = true;
  106 + this.pages++
110 // 加载中提示 107 // 加载中提示
111 Indicator.open("加载中..."); 108 Indicator.open("加载中...");
112 109
113 // 获取证书请求接口 110 // 获取证书请求接口
114 - this.http("/Api/" + this.getApiVersion().index + "/newDarenIndex", {  
115 - uid: this.$route.query.uid 111 + this.http("/Api/" + this.getApiVersion().dynamic + "/getNewDynamicList", {
  112 + uid: this.$route.query.uid,
  113 + page: this.pages,
  114 + type: 1
116 }, this.getNewDynamicListCallback, { 115 }, this.getNewDynamicListCallback, {
117 method: "post" 116 method: "post"
118 } 117 }
@@ -129,21 +128,19 @@ @@ -129,21 +128,19 @@
129 // 加载完成 128 // 加载完成
130 Indicator.close(); 129 Indicator.close();
131 130
132 - // 下拉刷新结束  
133 - this.$set(this, "isLoading", false); 131 + // 隐藏加载圈
  132 + this.loading = false;
134 133
135 // 返回处理 134 // 返回处理
136 if (res.code == 200) { 135 if (res.code == 200) {
137 - // 隐藏加载圈  
138 - this.loading = false;  
139 // 解构数据 136 // 解构数据
140 let { data: datas } = res; 137 let { data: datas } = res;
141 // 设置shopFnsDynamic达人动态数据 138 // 设置shopFnsDynamic达人动态数据
142 139
143 - if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {  
144 - this.$set(this, "shopFnsDynamic", datas.shop_fans_dynamic); 140 + if (datas.list && datas.list.length) {
  141 + this.$set(this, "shopFnsDynamic", datas.list);
145 } 142 }
146 - 143 + console.log(this.shopFnsDynamic)
147 /* 获取达人动态数据 结束 */ 144 /* 获取达人动态数据 结束 */
148 145
149 } else if (res.code == 400) { 146 } else if (res.code == 400) {
@@ -221,12 +218,12 @@ @@ -221,12 +218,12 @@
221 if (datas.shop_daren_hot && datas.shop_daren_hot.length) { 218 if (datas.shop_daren_hot && datas.shop_daren_hot.length) {
222 this.$set(this, "shopDarenHot", datas.shop_daren_hot); 219 this.$set(this, "shopDarenHot", datas.shop_daren_hot);
223 } 220 }
224 - // 设置shopFnsDynamic已关注达人动态数据 221 + // 设置fansDaren已关注达人动态数据
225 222
226 if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) { 223 if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {
227 this.$set(this, "fansDaren", datas.shop_fans_dynamic); 224 this.$set(this, "fansDaren", datas.shop_fans_dynamic);
228 } 225 }
229 - 226 + console.log(this.fansDaren)
230 /* 获取优选库精选活动数据 结束 */ 227 /* 获取优选库精选活动数据 结束 */
231 228
232 } else if (res.code == 400) { 229 } else if (res.code == 400) {