Showing
4 changed files
with
32 additions
and
19 deletions
@@ -70,6 +70,7 @@ export default { | @@ -70,6 +70,7 @@ export default { | ||
70 | isShow: false, | 70 | isShow: false, |
71 | total: 0, | 71 | total: 0, |
72 | active: 0, | 72 | active: 0, |
73 | + yasHeight: 0, | ||
73 | listBaseParams: { | 74 | listBaseParams: { |
74 | isHome: true, | 75 | isHome: true, |
75 | }, | 76 | }, |
@@ -107,18 +108,19 @@ export default { | @@ -107,18 +108,19 @@ export default { | ||
107 | }; | 108 | }; |
108 | }, | 109 | }, |
109 | computed: { | 110 | computed: { |
110 | - ...mapState(['channelList','contentCode']), | 111 | + ...mapState(['channelList', 'contentCode']), |
111 | navList() { | 112 | navList() { |
112 | return get(find(this.channelList.list, ['template_name', 'guessLike']), 'data') || []; | 113 | return get(find(this.channelList.list, ['template_name', 'guessLike']), 'data') || []; |
113 | }, | 114 | }, |
114 | navInfo() { | 115 | navInfo() { |
115 | - let index = findIndex(this.channelList.list, ['template_name', 'guessLike']) | ||
116 | - let id = get(find(this.channelList.list, ['template_name', 'guessLike']), 'template_id') | 116 | + let index = findIndex(this.channelList.list, ['template_name', 'guessLike']); |
117 | + let id = get(find(this.channelList.list, ['template_name', 'guessLike']), 'template_id'); | ||
118 | + | ||
117 | return { | 119 | return { |
118 | F_ID: id, | 120 | F_ID: id, |
119 | F_NAME: 'guessLike', | 121 | F_NAME: 'guessLike', |
120 | F_INDEX: index + 1 | 122 | F_INDEX: index + 1 |
121 | - } | 123 | + }; |
122 | }, | 124 | }, |
123 | noItemStyle() { | 125 | noItemStyle() { |
124 | return { | 126 | return { |
@@ -162,7 +164,7 @@ export default { | @@ -162,7 +164,7 @@ export default { | ||
162 | this.refreshProductList(this.active); | 164 | this.refreshProductList(this.active); |
163 | }, | 165 | }, |
164 | methods: { | 166 | methods: { |
165 | - ...mapActions(['fetchChannelList','getAllInboxCatInfo']), | 167 | + ...mapActions(['fetchChannelList', 'getAllInboxCatInfo']), |
166 | ...mapActionsList(['fetchProductList']), | 168 | ...mapActionsList(['fetchProductList']), |
167 | init() { | 169 | init() { |
168 | this.$nextTick(() => { | 170 | this.$nextTick(() => { |
@@ -290,26 +292,30 @@ export default { | @@ -290,26 +292,30 @@ export default { | ||
290 | I_INDEX: Number(params.index) + 1, | 292 | I_INDEX: Number(params.index) + 1, |
291 | TAB_ID: Number(params.index) + 1, | 293 | TAB_ID: Number(params.index) + 1, |
292 | TAB_NAME: params.title}); | 294 | TAB_NAME: params.title}); |
293 | - console.log(this.listYasParams) | ||
294 | } | 295 | } |
295 | }, | 296 | }, |
296 | getIndex({index, params}) { | 297 | getIndex({index, params}) { |
297 | this.selectedCategory = params; | 298 | this.selectedCategory = params; |
298 | this.active = Number(index); | 299 | this.active = Number(index); |
299 | this.isShow && this.$refs.scroll.scrollTo(this.navTop); | 300 | this.isShow && this.$refs.scroll.scrollTo(this.navTop); |
301 | + | ||
300 | // this.setYasParam({index, ...params}); | 302 | // this.setYasParam({index, ...params}); |
301 | this.guessLikeListParams({index, ...params}); | 303 | this.guessLikeListParams({index, ...params}); |
304 | + | ||
302 | // 商品列表曝光 | 305 | // 商品列表曝光 |
303 | - this.listScrollY > 0 && this.$refs.product && this.$refs.product.yasShowEvent(this.listScrollY); | 306 | + this.listScrollY > 0 && this.$refs.product && this.$refs.product.yasShowEvent(this.yasHeight); |
304 | }, | 307 | }, |
305 | scrollEndHandler({y}) { | 308 | scrollEndHandler({y}) { |
306 | let scrollHeight = Math.abs(y); | 309 | let scrollHeight = Math.abs(y); |
307 | let viewHeight = this.$refs.scroll.$el.offsetHeight; | 310 | let viewHeight = this.$refs.scroll.$el.offsetHeight; |
308 | let productListTop = this.$refs.product && this.$refs.product.$el.offsetTop || this.navTop + this.navHeight; | 311 | let productListTop = this.$refs.product && this.$refs.product.$el.offsetTop || this.navTop + this.navHeight; |
309 | let listScrollY = scrollHeight + viewHeight - productListTop; | 312 | let listScrollY = scrollHeight + viewHeight - productListTop; |
310 | - this.listScrollY = listScrollY | 313 | + |
314 | + this.listScrollY = listScrollY; | ||
315 | + this.yasHeight = scrollHeight - this.navTop; | ||
316 | + | ||
311 | // 商品列表曝光 | 317 | // 商品列表曝光 |
312 | - listScrollY > 0 && this.$refs.product && this.$refs.product.yasShowEvent(listScrollY); | 318 | + listScrollY > 0 && this.$refs.product && this.$refs.product.yasShowEvent(this.yasHeight); |
313 | if (scrollHeight >= this.navTop) { | 319 | if (scrollHeight >= this.navTop) { |
314 | return; | 320 | return; |
315 | } | 321 | } |
@@ -54,11 +54,11 @@ export default { | @@ -54,11 +54,11 @@ export default { | ||
54 | } | 54 | } |
55 | }); | 55 | }); |
56 | }, | 56 | }, |
57 | - yasShowEvent(height) { | 57 | + yasShowEvent: function(height) { |
58 | // 获取列表单个元素高度 | 58 | // 获取列表单个元素高度 |
59 | let index = 0; | 59 | let index = 0; |
60 | 60 | ||
61 | - if (height) { | 61 | + if (Number(height) > 0) { |
62 | // 获取第一个曝光元素 | 62 | // 获取第一个曝光元素 |
63 | let item = document.querySelector('.product-list-item'); | 63 | let item = document.querySelector('.product-list-item'); |
64 | let itemHeight = item.offsetHeight; | 64 | let itemHeight = item.offsetHeight; |
@@ -92,6 +92,8 @@ export default { | @@ -92,6 +92,8 @@ export default { | ||
92 | list.map((value, i) => { | 92 | list.map((value, i) => { |
93 | DATA.push({...this.yasParams, I_INDEX: i + index + 1, PRD_ID: value.id}); | 93 | DATA.push({...this.yasParams, I_INDEX: i + index + 1, PRD_ID: value.id}); |
94 | }); | 94 | }); |
95 | + console.log('-----'); | ||
96 | + console.log(DATA); | ||
95 | this.$store.dispatch('reportYas', { | 97 | this.$store.dispatch('reportYas', { |
96 | params: { | 98 | params: { |
97 | param: {DATA}, | 99 | param: {DATA}, |
@@ -112,7 +114,7 @@ export default { | @@ -112,7 +114,7 @@ export default { | ||
112 | // 7.PRD_ID:商品id | 114 | // 7.PRD_ID:商品id |
113 | this.$store.dispatch('reportYas', { | 115 | this.$store.dispatch('reportYas', { |
114 | params: { | 116 | params: { |
115 | - param: {...this.yasParams, I_INDEX: index, PRD_ID: id }, | 117 | + param: {...this.yasParams, I_INDEX: index + 1, PRD_ID: id }, |
116 | appop: 'XY_UFO_PRD_LIST_C' | 118 | appop: 'XY_UFO_PRD_LIST_C' |
117 | } | 119 | } |
118 | }); | 120 | }); |
@@ -96,7 +96,9 @@ export default { | @@ -96,7 +96,9 @@ export default { | ||
96 | }; | 96 | }; |
97 | }, | 97 | }, |
98 | activated: async function() { | 98 | activated: async function() { |
99 | - if (this.yoho.direction === 'forword') { | 99 | + let {list} = this.productList; |
100 | + | ||
101 | + if (this.yoho.direction === 'forword' || !list.length) { | ||
100 | this.$refs.filtrate.hide(); | 102 | this.$refs.filtrate.hide(); |
101 | Object.assign(this.$data, this.$options.data()); | 103 | Object.assign(this.$data, this.$options.data()); |
102 | this.changeArrow(); | 104 | this.changeArrow(); |
@@ -111,6 +113,7 @@ export default { | @@ -111,6 +113,7 @@ export default { | ||
111 | this.setYasParam({param: params, tab: {index: 1, name: '人气'}}); | 113 | this.setYasParam({param: params, tab: {index: 1, name: '人气'}}); |
112 | !params.order && (params.order = 'sale_desc'); | 114 | !params.order && (params.order = 'sale_desc'); |
113 | await this.fetchList({...params, isReset: true}); | 115 | await this.fetchList({...params, isReset: true}); |
116 | + this.$refs.product.yasShowEvent(0); | ||
114 | } else { | 117 | } else { |
115 | this.scrollY && this.$refs.scroll.scrollTo(this.scrollY); | 118 | this.scrollY && this.$refs.scroll.scrollTo(this.scrollY); |
116 | } | 119 | } |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | </div> | 25 | </div> |
26 | </Scroll> | 26 | </Scroll> |
27 | <Scroll v-show="query.length" :options="scrollOptions" :data="searchSuggestList"> | 27 | <Scroll v-show="query.length" :options="scrollOptions" :data="searchSuggestList"> |
28 | - <div class="item-line middle" v-if="searchSuggestList.length" v-for="(item, index) of searchSuggestList" @click="goSearch({query : item.item} ,{type: 3, index})"> | 28 | + <div class="item-line middle" v-if="searchSuggestList.length" v-for="(item, index) of searchSuggestList" @click="goSearch({query : item.item} ,{type: 0, index: 0})"> |
29 | {{item.item}} | 29 | {{item.item}} |
30 | </div> | 30 | </div> |
31 | </Scroll> | 31 | </Scroll> |
@@ -60,6 +60,13 @@ export default { | @@ -60,6 +60,13 @@ export default { | ||
60 | this.fetchDefaultSearchWords(); | 60 | this.fetchDefaultSearchWords(); |
61 | this.setLocalList(); | 61 | this.setLocalList(); |
62 | }, | 62 | }, |
63 | + beforeRouteEnter: function(to, from, next) { | ||
64 | + next(vm => { | ||
65 | + if (from.name === 'List') { | ||
66 | + vm.SEARCH_POS = 3; | ||
67 | + } | ||
68 | + }); | ||
69 | + }, | ||
63 | computed: { | 70 | computed: { |
64 | ...mapState(['searchWord', 'defaultSearchWord', 'searchSuggestList']), | 71 | ...mapState(['searchWord', 'defaultSearchWord', 'searchSuggestList']), |
65 | }, | 72 | }, |
@@ -108,11 +115,6 @@ export default { | @@ -108,11 +115,6 @@ export default { | ||
108 | } | 115 | } |
109 | this.localHistory = localHistory; | 116 | this.localHistory = localHistory; |
110 | }, | 117 | }, |
111 | - beforeRouteEnter: function(to, from, next) { | ||
112 | - if (from.name !== 'List') { | ||
113 | - this.SEARCH_POS = 3; | ||
114 | - } | ||
115 | - }, | ||
116 | addLocalWord: function(query) { | 118 | addLocalWord: function(query) { |
117 | if (this.query || query) { | 119 | if (this.query || query) { |
118 | let addQuery = query || this.query; | 120 | let addQuery = query || this.query; |
-
Please register or login to post a comment