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 43 }">
44 44 </text-title-box>
45 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 49 infinite-scroll-disabled="loading"
49 50 :infinite-scroll-distance="50">
50   - <li v-for="(item, index) in list" :key="index">
51 51 <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary"
52 52 :lists="shopFnsDynamic">
53 53  
54 54 </daren-list-box>
55   - </li>
56   - </ul>
  55 + </div>
57 56 </div>
58 57 </div>
59 58 </template>
... ... @@ -78,7 +77,7 @@
78 77 fansDaren: null, // 已关注达人动态
79 78 shopFnsDynamic: null, // 达人动态
80 79 loading: false, // 加载
81   - pages:1 // 分页
  80 + pages:0 // 分页
82 81 }
83 82 },
84 83 components:{
... ... @@ -95,24 +94,24 @@
95 94  
96 95 // 获取优选库精选活动
97 96 this.newDarenIndex();
  97 + // 达人最新动态
  98 + this.getNewDynamicList();
98 99 },
99 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 104 getNewDynamicList() {
  105 + this.loading = true;
  106 + this.pages++
110 107 // 加载中提示
111 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 115 }, this.getNewDynamicListCallback, {
117 116 method: "post"
118 117 }
... ... @@ -129,21 +128,19 @@
129 128 // 加载完成
130 129 Indicator.close();
131 130  
132   - // 下拉刷新结束
133   - this.$set(this, "isLoading", false);
  131 + // 隐藏加载圈
  132 + this.loading = false;
134 133  
135 134 // 返回处理
136 135 if (res.code == 200) {
137   - // 隐藏加载圈
138   - this.loading = false;
139 136 // 解构数据
140 137 let { data: datas } = res;
141 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 146 } else if (res.code == 400) {
... ... @@ -221,12 +218,12 @@
221 218 if (datas.shop_daren_hot && datas.shop_daren_hot.length) {
222 219 this.$set(this, "shopDarenHot", datas.shop_daren_hot);
223 220 }
224   - // 设置shopFnsDynamic已关注达人动态数据
  221 + // 设置fansDaren已关注达人动态数据
225 222  
226 223 if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {
227 224 this.$set(this, "fansDaren", datas.shop_fans_dynamic);
228 225 }
229   -
  226 + console.log(this.fansDaren)
230 227 /* 获取优选库精选活动数据 结束 */
231 228  
232 229 } else if (res.code == 400) {
... ...