...
|
...
|
@@ -3,7 +3,7 @@ |
|
|
<form action="javascript:void(0)">
|
|
|
<div class="search-header middle">
|
|
|
<div class="search-img"></div>
|
|
|
<input class="search-input" type="search" v-model="query" placeholder="Search" @input="suggest" @focus="yasFocus"
|
|
|
<input class="search-input" type="search" v-model="query" placeholder="Search" @input="suggest"
|
|
|
@keyup.13="searchGoods"/>
|
|
|
<div class="search-clear" :class="query && 'search-clear-img'" @click="clear()"></div>
|
|
|
</div>
|
...
|
...
|
@@ -11,7 +11,7 @@ |
|
|
<Scroll v-show="!query.length" :options="scrollOptions">
|
|
|
<div class="recent title middle" v-if="searchWord && searchWord.length">热门推荐</div>
|
|
|
<div class="content middle">
|
|
|
<div class="item" v-if="searchWord && searchWord.length" v-for="item of searchWord" @click="goSearch({query : item.search_word} ,2)">
|
|
|
<div class="item" v-if="searchWord && searchWord.length" v-for="(item, index) of searchWord" @click="goSearch({query : item.search_word} ,{type: 2, index})">
|
|
|
{{item.search_word}}
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -20,12 +20,12 @@ |
|
|
<div class="search-clear search-clear-img" @click="clearLocalHistory()"></div>
|
|
|
</div>
|
|
|
<div class="content middle">
|
|
|
<div class="item" v-if="localHistory && localHistory.length" v-for="item of localHistory" @click="goSearch({query : item} ,1)">{{item}}
|
|
|
<div class="item" v-if="localHistory && localHistory.length" v-for="(item, index) of localHistory" @click="goSearch({query : item} ,{type: 1, index})">{{item}}
|
|
|
</div>
|
|
|
</div>
|
|
|
</Scroll>
|
|
|
<Scroll v-show="query.length" :options="scrollOptions" :data="searchSuggestList">
|
|
|
<div class="item-line middle" v-if="searchSuggestList.length" v-for="item of searchSuggestList" @click="goSearch({query : item.item} ,0)">
|
|
|
<div class="item-line middle" v-if="searchSuggestList.length" v-for="(item, index) of searchSuggestList" @click="goSearch({query : item.item} ,{type: 3, index})">
|
|
|
{{item.item}}
|
|
|
</div>
|
|
|
</Scroll>
|
...
|
...
|
@@ -50,7 +50,8 @@ export default { |
|
|
}
|
|
|
},
|
|
|
query: '',
|
|
|
localHistory: []
|
|
|
localHistory: [],
|
|
|
SEARCH_POS: 1
|
|
|
};
|
|
|
},
|
|
|
activated() {
|
...
|
...
|
@@ -70,7 +71,7 @@ export default { |
|
|
},
|
|
|
searchGoods: function() {
|
|
|
this.addLocalWord();
|
|
|
this.yasInput(0);
|
|
|
this.yasInput({type: 0, index: 0});
|
|
|
this.$router.push({
|
|
|
name: 'List',
|
|
|
query: {
|
...
|
...
|
@@ -82,10 +83,10 @@ export default { |
|
|
suggest: function() {
|
|
|
this.fetchSearchSuggest(this.query);
|
|
|
},
|
|
|
goSearch: function(parameters, type) {
|
|
|
goSearch: function(parameters, param) {
|
|
|
let query = parameters.query;
|
|
|
|
|
|
this.yasInput(type);
|
|
|
this.yasInput(param);
|
|
|
this.$router.push({
|
|
|
name: 'List',
|
|
|
query: {
|
...
|
...
|
@@ -106,6 +107,11 @@ export default { |
|
|
}
|
|
|
this.localHistory = localHistory;
|
|
|
},
|
|
|
beforeRouteEnter: function(to, from, next) {
|
|
|
if (from.name !== 'List') {
|
|
|
this.SEARCH_POS = 3;
|
|
|
}
|
|
|
},
|
|
|
addLocalWord: function() {
|
|
|
if (this.query) {
|
|
|
let localHistory = localStorage.getItem('@YohoUFOStore:searchHistory');
|
...
|
...
|
@@ -121,23 +127,15 @@ export default { |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
yasFocus() {
|
|
|
this.$store.dispatch('reportYas', {
|
|
|
params: {
|
|
|
param: {SEARCH_POS: 3},
|
|
|
appop: 'XY_UFO_SEARCH_CLICK'
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
yasInput: function(type) {
|
|
|
yasInput: function(param) {
|
|
|
this.$store.dispatch('reportYas', {
|
|
|
params: {
|
|
|
param: {
|
|
|
SEARCH_POS: 3,
|
|
|
SEARCH_POS: this.SEARCH_POS,
|
|
|
KEYWORD: this.query,
|
|
|
POS_ID: type,
|
|
|
TYPE_ID: type,
|
|
|
FLR_INDEX: type,
|
|
|
POS_ID: param.type,
|
|
|
TYPE_ID: 1,
|
|
|
FLR_INDEX: param.index + 1,
|
|
|
},
|
|
|
appop: 'XY_UFO_HOME_KEYWORD_SEARCH_C'
|
|
|
}
|
...
|
...
|
|