Commit ec9cf53481fa8a21f6e52af718faa9e9726d1899

Authored by zhiyangdu
1 parent 44ee2496

关注列表数据绑定

src/components/dresserList/dresserList.vue
@@ -3,13 +3,13 @@ @@ -3,13 +3,13 @@
3 <!--标题--> 3 <!--标题-->
4 <textTitleBox :titles="null"></textTitleBox> 4 <textTitleBox :titles="null"></textTitleBox>
5 <div class="item_box"> 5 <div class="item_box">
6 - <img class="head_portrait" src="static/img/1.png" alt="网家家"/> 6 + <img class="head_portrait" v-lazy="dresserList.user_img" src="static/img/1.png" alt="网家家"/>
7 <div class="user_info"> 7 <div class="user_info">
8 <div class="name"> 8 <div class="name">
9 - 冯提莫 9 + {{dresserList.title}}
10 </div> 10 </div>
11 <div class="desc"> 11 <div class="desc">
12 - 冯提莫描述 12 + {{dresserList.user_title}}
13 </div> 13 </div>
14 </div> 14 </div>
15 <img class="arrow_right" src="static/img/icon_arrow_right.png" alt="网家家"/> 15 <img class="arrow_right" src="static/img/icon_arrow_right.png" alt="网家家"/>
src/pages/dresser/dresser.less renamed to src/pages/fansShopMessageList/fansShopMessageList.less
src/pages/dresser/dresser.vue renamed to src/pages/fansShopMessageList/fansShopMessageList.vue
@@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
7 <ul 7 <ul
8 v-infinite-scroll="loadMore" 8 v-infinite-scroll="loadMore"
9 infinite-scroll-disabled="loading" 9 infinite-scroll-disabled="loading"
10 - infinite-scroll-distance="10">  
11 - <li v-for="item in list">  
12 - <dresserList></dresserList> 10 + :infinite-scroll-distance="list.length">
  11 + <li v-for="item in list" @click="$parent.toDetail(item)">
  12 + <dresserList :dresserList="item"></dresserList>
13 </li> 13 </li>
14 </ul> 14 </ul>
15 </div> 15 </div>
@@ -18,11 +18,11 @@ @@ -18,11 +18,11 @@
18 18
19 <script> 19 <script>
20 import dresserList from "@/components/dresserList/dresserList"; 20 import dresserList from "@/components/dresserList/dresserList";
  21 + import { Toast, Indicator } from 'mint-ui';
21 export default { 22 export default {
22 name: 'test', 23 name: 'test',
23 data () { 24 data () {
24 return { 25 return {
25 - waitList: [],  
26 list: [], 26 list: [],
27 loading: false, 27 loading: false,
28 } 28 }
@@ -32,23 +32,60 @@ @@ -32,23 +32,60 @@
32 }, 32 },
33 created(){ 33 created(){
34 document.title = "已关注达人"; 34 document.title = "已关注达人";
  35 + // 获取关注人列表
  36 + this.fansShopMessageList();
35 }, 37 },
36 methods: { 38 methods: {
  39 + /**
  40 + * 已关注达人列表
  41 + */
  42 + fansShopMessageList () {
  43 + // 加载中提示
  44 + Indicator.open('加载中...');
  45 + // 请求接口
  46 + this.http("/api/Dynamic/fansShopMessageList", {
  47 + uid:this.$route.query.uid
  48 + },this.fansShopMessageListCallback, {
  49 + method: "post"
  50 + });
  51 + },
  52 +
  53 + /**
  54 + * 已关注达人列表回调
  55 + * @param {object} res [服务器返回数据]
  56 + * @param {object} ext [扩展参数]
  57 + */
  58 + fansShopMessageListCallback(res, ext) {
  59 + // 加载完成
  60 + Indicator.close();
  61 + // 返回处理
  62 + if (res.code == 200) {
  63 +
  64 + // 解构数据
  65 + let {data: datas} = res;
  66 +
  67 + /*获取裂变数据*/
  68 +
  69 + // 设置标题
  70 + this.$set(this, "list", datas.list);
  71 + }
  72 + },
37 loadMore() { 73 loadMore() {
38 - this.loading = true;  
39 - setTimeout(() => {  
40 - let last = this.list[this.list.length - 1];  
41 - for (let i = 1; i <= 10; i++) {  
42 - this.list.push(last + i);  
43 - }  
44 - this.loading = false;  
45 - }, 2500);  
46 - } 74 +// this.loading = true;
  75 +// setTimeout(() => {
  76 +// let last = this.list[this.list.length - 1];
  77 +// for (let i = 1; i <= 10; i++) {
  78 +// this.list.push(last + i);
  79 +// }
  80 +// this.loading = false;
  81 +// }, 2500);
  82 + },
  83 +
47 } 84 }
48 } 85 }
49 </script> 86 </script>
50 87
51 <!-- Add "scoped" attribute to limit CSS to this component only --> 88 <!-- Add "scoped" attribute to limit CSS to this component only -->
52 <style rel="stylesheet/less" lang="less" scoped> 89 <style rel="stylesheet/less" lang="less" scoped>
53 - @import "dresser"; 90 + @import "fansShopMessageList";
54 </style> 91 </style>
src/router/index.js
@@ -29,10 +29,10 @@ const router = new Router({ @@ -29,10 +29,10 @@ const router = new Router({
29 }, 29 },
30 { 30 {
31 // 达人列表页 31 // 达人列表页
32 - path: "/dresser",  
33 - name: "dresser", 32 + path: "/fansShopMessageList",
  33 + name: "fansShopMessageList",
34 component: resolve => { 34 component: resolve => {
35 - require(["@/pages/dresser/dresser"], resolve); 35 + require(["@/pages/fansShopMessageList/fansShopMessageList"], resolve);
36 }, 36 },
37 meta: { 37 meta: {
38 requireAuth: false 38 requireAuth: false