Authored by TaoHuang

Merge branch 'develop' of http://git.yoho.cn/fe/xianyu-ufo-app-web into develop

@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 v-for="(item, index) in itemSub.sub" 28 v-for="(item, index) in itemSub.sub"
29 :key="index" 29 :key="index"
30 :data-id="item.id" 30 :data-id="item.id"
31 - ref="index"> 31 + :ref="index">
32 <LayoutLink :href="item.url" > 32 <LayoutLink :href="item.url" >
33 <div class="item-imge-div" @click="goProductList(item,index, itemSub)"> 33 <div class="item-imge-div" @click="goProductList(item,index, itemSub)">
34 <ImgSize 34 <ImgSize
@@ -76,13 +76,15 @@ export default { @@ -76,13 +76,15 @@ export default {
76 } 76 }
77 }; 77 };
78 }, 78 },
  79 +
79 mounted() { 80 mounted() {
  81 + Promise.all([this.fetchBrandList({}),this.fetchCategoryParentList()]).then(()=> {
  82 + this.reportYas(0);
  83 + })
80 }, 84 },
81 - async activated(){  
82 - await this.fetchCategoryParentList();  
83 - await this.fetchBrandList({});  
84 - this.reportYas(0);  
85 - }, 85 + // activated(){
  86 + // this.reportYas(0);
  87 + // },
86 methods: { 88 methods: {
87 ...mapActions(['fetchCategoryParentList', 'selectCategoryParent', 'fetchBrandList', 'fetchCategorySubList']), 89 ...mapActions(['fetchCategoryParentList', 'selectCategoryParent', 'fetchBrandList', 'fetchCategorySubList']),
88 onScrollEndHandler({y}) { 90 onScrollEndHandler({y}) {
@@ -95,8 +97,8 @@ export default { @@ -95,8 +97,8 @@ export default {
95 this.categorySubList.forEach((item) => { 97 this.categorySubList.forEach((item) => {
96 let subItemList = item.sub; 98 let subItemList = item.sub;
97 subItemList.forEach((val, index) => { 99 subItemList.forEach((val, index) => {
98 - let eleTop = this.$refs.index[index].offsetTop;  
99 - let eleHeight = this.$refs.index[index].offsetHeight; 100 + let eleTop = this.$refs[index][0].offsetTop;
  101 + let eleHeight = this.$refs[index][0].offsetHeight;
100 // console.log(eleHeight+'item'+scrollY) 102 // console.log(eleHeight+'item'+scrollY)
101 let firstHeight = 0; 103 let firstHeight = 0;
102 if(scrollY > eleHeight){ 104 if(scrollY > eleHeight){
@@ -15,22 +15,25 @@ export default function() { @@ -15,22 +15,25 @@ export default function() {
15 }, 15 },
16 mutations: { 16 mutations: {
17 addCategoryParentList(state, {data}) { 17 addCategoryParentList(state, {data}) {
  18 + let categoryParent = [];
18 let brand = { 19 let brand = {
19 - id:'-1',  
20 - name: '品牌',  
21 - image: '',  
22 - linkType: '',  
23 - index: 0,  
24 - isSelect: true,  
25 - }  
26 - state.categoryParent.push(brand); 20 + id: '-1',
  21 + name: '品牌',
  22 + image: '',
  23 + linkType: '',
  24 + index: 0,
  25 + isSelect: true,
  26 + };
  27 +
  28 + categoryParent.push(brand);
27 if (data && data.length) { 29 if (data && data.length) {
28 - data.forEach((val, index) => {  
29 - val.isSelect = false;  
30 - val.index = index + 1;  
31 - state.categoryParent.push(val);  
32 - }); 30 + data.forEach((val, index) => {
  31 + val.isSelect = false;
  32 + val.index = index + 1;
  33 + categoryParent.push(val);
  34 + });
33 } 35 }
  36 + state.categoryParent = categoryParent;
34 37
35 }, 38 },
36 39