|
|
@@ -8,7 +8,7 @@
|
|
|
'navigationBarTextStyle':'black',
|
|
|
"usingComponents": {
|
|
|
"van-sidebar": "../native/vant/sidebar/index",
|
|
|
- "van-sidebar-item": "../native/vant/sidebar-item/index"
|
|
|
+ "van-sidebar-item": "../native/vant/sidebar-item/index",
|
|
|
},
|
|
|
'disableScroll': true
|
|
|
}
|
|
|
@@ -29,9 +29,13 @@
|
|
|
@change="changeSearch"
|
|
|
:maxlength="60"
|
|
|
@focus="focus = true"
|
|
|
- @blur="blurSearch"
|
|
|
+ always-embed
|
|
|
+ @click="focus = true"
|
|
|
+ v-if="focus"
|
|
|
/>
|
|
|
|
|
|
+ <!-- <mp-searchbar @selectresult="confirm" :search="search"></mp-searchbar> -->
|
|
|
+
|
|
|
<scroll-view
|
|
|
v-if="searchKey"
|
|
|
scroll-y
|
|
|
@@ -108,7 +112,8 @@ export default {
|
|
|
historys: [],
|
|
|
focus: false,
|
|
|
hots: ['信息通信', '3D打印', '机床', '机加工', '电子器件', '高精度打印机', '量具仪具'],
|
|
|
- matchList: []
|
|
|
+ matchList: [],
|
|
|
+ ios: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -122,78 +127,17 @@ export default {
|
|
|
} else {
|
|
|
return {};
|
|
|
}
|
|
|
- },
|
|
|
- nowCategory() {
|
|
|
- return { ...(this.getList([...this.categories], this.activeKey) || { children: [] }) };
|
|
|
- },
|
|
|
- firstLevelId() {
|
|
|
- if (this.categories.length > this.activeKey) {
|
|
|
- return [...this.categories][this.activeKey].id;
|
|
|
- } else {
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- listQuery() {
|
|
|
- if (this.searchType === 'product') {
|
|
|
- return {
|
|
|
- productSort: this.sort,
|
|
|
- categoryIds: this.categoryIds || '',
|
|
|
- countries: this.countries,
|
|
|
- tagIds: this.tagIds,
|
|
|
- applicationField: this.applicationField,
|
|
|
- query: JSON.stringify({
|
|
|
- vendorInfoId: this.vendorInfoId
|
|
|
- })
|
|
|
- };
|
|
|
- } else if (this.searchType === 'vendor') {
|
|
|
- return {
|
|
|
- vendorSort: this.sort,
|
|
|
- categoryIds: this.categoryIds,
|
|
|
- countries: this.countries,
|
|
|
- continent: this.continent,
|
|
|
- enterpriseType: this.enterpriseType,
|
|
|
- applicationField: this.applicationField
|
|
|
- };
|
|
|
- } else {
|
|
|
- return {
|
|
|
- sort: 'createdAt,desc'
|
|
|
- };
|
|
|
- }
|
|
|
- },
|
|
|
- filterQuery() {
|
|
|
- if (this.searchType === 'product') {
|
|
|
- return {
|
|
|
- pageType: 'product',
|
|
|
- categoryIds: this.categoryIds,
|
|
|
- countries: this.countries,
|
|
|
- continent: this.continent,
|
|
|
- searchTop: this.searchTop,
|
|
|
- tagIds: this.tagIds,
|
|
|
- applicationField: this.applicationField,
|
|
|
- brand: this.brand
|
|
|
- };
|
|
|
- } else {
|
|
|
- return {
|
|
|
- pageType: 'vendor',
|
|
|
- categoryIds: this.categoryIds,
|
|
|
- countries: this.countries,
|
|
|
- continent: this.continent,
|
|
|
- enterpriseType: this.enterpriseType,
|
|
|
- searchTop: this.searchTop,
|
|
|
- applicationField: this.applicationField
|
|
|
- };
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
setTimeout(() => {
|
|
|
this.$nextTick(() => {
|
|
|
this.focus = true;
|
|
|
- if (this.search) {
|
|
|
- this.changeSearch({
|
|
|
- detail: this.search
|
|
|
- });
|
|
|
- }
|
|
|
+ // if (this.search) {
|
|
|
+ // this.changeSearch({
|
|
|
+ // detail: this.search
|
|
|
+ // });
|
|
|
+ // }
|
|
|
});
|
|
|
}, 100);
|
|
|
},
|
|
|
@@ -202,6 +146,14 @@ export default {
|
|
|
this.$http.get('/sysConfig/get/SEARCH_HOT').then(res => {
|
|
|
this.hots = res.value.split(',');
|
|
|
});
|
|
|
+
|
|
|
+ wx.getSystemInfo({
|
|
|
+ success: res => {
|
|
|
+ if (res.brand === 'iPhone') {
|
|
|
+ this.ios = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
onReady() {
|
|
|
this.left = wx.createSelectorQuery().select('#left');
|
|
|
@@ -246,6 +198,8 @@ export default {
|
|
|
historys = [...new Set(historys)];
|
|
|
historys = historys.slice(0, 10);
|
|
|
var _this = this;
|
|
|
+ this.focus = false;
|
|
|
+ this.search = info;
|
|
|
wx.setStorage({
|
|
|
key: 'searchHistory',
|
|
|
data: JSON.stringify(historys),
|
|
|
@@ -254,30 +208,25 @@ export default {
|
|
|
|
|
|
wx.navigateTo({
|
|
|
url: '/pagesHome/SearchList?search=' + info,
|
|
|
- success: () => {
|
|
|
- _this.search = info;
|
|
|
- _this.focus = false;
|
|
|
- }
|
|
|
+ success: () => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
goVendor(info) {
|
|
|
+ this.search = info;
|
|
|
+ this.focus = false;
|
|
|
wx.navigateTo({
|
|
|
url: '/pagesHome/VendorList?search=' + info,
|
|
|
- success: () => {
|
|
|
- this.search = info;
|
|
|
- this.focus = false;
|
|
|
- }
|
|
|
+ success: () => {}
|
|
|
});
|
|
|
},
|
|
|
goInformation(info) {
|
|
|
+ this.search = info;
|
|
|
+ this.focus = false;
|
|
|
wx.navigateTo({
|
|
|
url: '/pagesHome/InformationList?search=' + info,
|
|
|
- success: () => {
|
|
|
- this.search = info;
|
|
|
- this.focus = false;
|
|
|
- }
|
|
|
+ success: () => {}
|
|
|
});
|
|
|
},
|
|
|
getHistory() {
|
|
|
@@ -312,6 +261,9 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
changeSearch(e) {
|
|
|
+ if (this.ios) {
|
|
|
+ this.search = e.detail;
|
|
|
+ }
|
|
|
this.searchKey = e.detail;
|
|
|
if (e.detail) {
|
|
|
matchingName(e.detail).then(res => {
|
|
|
@@ -364,6 +316,13 @@ export default {
|
|
|
line-height: 25px;
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
|
+
|
|
|
+ .van-field__body--search {
|
|
|
+ -webkit-user-select: text !important;
|
|
|
+ }
|
|
|
+ .van-field__input {
|
|
|
+ -webkit-user-select: text !important;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.container {
|