Commit 2a16629edc0f2ba526ad7f7012b947b7cc7685f7

Authored by zhiyangdu
1 parent bcc58df5

加载更多

Showing 1 changed file with 81 additions and 11 deletions
src/pages/newDaren/newDaren.vue
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 </horiz-list> 24 </horiz-list>
25 <!-- 已关注达人 --> 25 <!-- 已关注达人 -->
26 <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary" 26 <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary"
27 - :lists="shopFnsDynamic"> 27 + :lists="fansDaren">
28 28
29 <!-- 最新动态标题 --> 29 <!-- 最新动态标题 -->
30 <text-title-box slot="title-box" @more="newDarenDynamicsMore" 30 <text-title-box slot="title-box" @more="newDarenDynamicsMore"
@@ -35,17 +35,26 @@ @@ -35,17 +35,26 @@
35 </text-title-box> 35 </text-title-box>
36 </daren-list-box> 36 </daren-list-box>
37 <!--最新达人动态--> 37 <!--最新达人动态-->
  38 + <!-- 最新动态标题 -->
  39 + <text-title-box slot="title-box" @more="newDarenDynamicsMore"
  40 + :titles="{
  41 + title: '最新达人动态',
  42 + more: false
  43 + }">
  44 + </text-title-box>
  45 + <div class="item_box">
  46 + <ul
  47 + v-infinite-scroll="loadMore"
  48 + infinite-scroll-disabled="loading"
  49 + :infinite-scroll-distance="50">
  50 + <li v-for="(item, index) in list" :key="index">
38 <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"
39 :lists="shopFnsDynamic"> 52 :lists="shopFnsDynamic">
40 53
41 - <!-- 最新动态标题 -->  
42 - <text-title-box slot="title-box" @more="newDarenDynamicsMore"  
43 - :titles="{  
44 - title: '最新达人动态',  
45 - more: true  
46 - }">  
47 - </text-title-box>  
48 </daren-list-box> 54 </daren-list-box>
  55 + </li>
  56 + </ul>
  57 + </div>
49 </div> 58 </div>
50 </template> 59 </template>
51 60
@@ -66,7 +75,10 @@ @@ -66,7 +75,10 @@
66 shopDatenTop: null, // 置顶达人信息 75 shopDatenTop: null, // 置顶达人信息
67 banner:[], // 轮播 76 banner:[], // 轮播
68 shopDarenHot: null, // 达人推荐列表 77 shopDarenHot: null, // 达人推荐列表
69 - shopFnsDynamic: null // 达人动态 78 + fansDaren: null, // 已关注达人动态
  79 + shopFnsDynamic: null, // 达人动态
  80 + loading: false, // 加载
  81 + pages:1 // 分页
70 } 82 }
71 }, 83 },
72 components:{ 84 components:{
@@ -85,7 +97,65 @@ @@ -85,7 +97,65 @@
85 this.newDarenIndex(); 97 this.newDarenIndex();
86 }, 98 },
87 methods: { 99 methods: {
  100 + // 最新达人动态
  101 + loadMore() {
  102 + this.loading = true;
  103 + this.pages++
  104 + this.getNewDynamicList(this.pages)
  105 + },
  106 + /**
  107 + * 达人最新动态
  108 + */
  109 + getNewDynamicList() {
  110 + // 加载中提示
  111 + Indicator.open("加载中...");
  112 +
  113 + // 获取证书请求接口
  114 + this.http("/Api/" + this.getApiVersion().index + "/newDarenIndex", {
  115 + uid: this.$route.query.uid
  116 + }, this.getNewDynamicListCallback, {
  117 + method: "post"
  118 + }
  119 + );
  120 + },
  121 +
  122 + /**
  123 + * 达人最新动态回调
  124 + * @param {object} res [服务器返回数据]
  125 + * @param {object} ext [扩展参数]
  126 + */
  127 + getNewDynamicListCallback(res, ext) {
  128 +
  129 + // 加载完成
  130 + Indicator.close();
  131 +
  132 + // 下拉刷新结束
  133 + this.$set(this, "isLoading", false);
88 134
  135 + // 返回处理
  136 + if (res.code == 200) {
  137 + // 隐藏加载圈
  138 + this.loading = false;
  139 + // 解构数据
  140 + let { data: datas } = res;
  141 + // 设置shopFnsDynamic达人动态数据
  142 +
  143 + if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {
  144 + this.$set(this, "shopFnsDynamic", datas.shop_fans_dynamic);
  145 + }
  146 +
  147 + /* 获取达人动态数据 结束 */
  148 +
  149 + } else if (res.code == 400) {
  150 +
  151 + // 获取达人动态失败
  152 + Toast(res.message);
  153 + } else {
  154 +
  155 + // 获取优选库精选活动失败
  156 + Toast("获取达人动态失败");
  157 + }
  158 + },
89 // 下拉刷新 159 // 下拉刷新
90 // onRefresh() { 160 // onRefresh() {
91 161
@@ -151,10 +221,10 @@ @@ -151,10 +221,10 @@
151 if (datas.shop_daren_hot && datas.shop_daren_hot.length) { 221 if (datas.shop_daren_hot && datas.shop_daren_hot.length) {
152 this.$set(this, "shopDarenHot", datas.shop_daren_hot); 222 this.$set(this, "shopDarenHot", datas.shop_daren_hot);
153 } 223 }
154 - // 设置shopFnsDynamic达人动态数据 224 + // 设置shopFnsDynamic已关注达人动态数据
155 225
156 if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) { 226 if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {
157 - this.$set(this, "shopFnsDynamic", datas.shop_fans_dynamic); 227 + this.$set(this, "fansDaren", datas.shop_fans_dynamic);
158 } 228 }
159 229
160 /* 获取优选库精选活动数据 结束 */ 230 /* 获取优选库精选活动数据 结束 */