搜索页
This commit is contained in:
@@ -405,14 +405,6 @@
|
||||
this.tagCurrent = index
|
||||
this.featureMask = false
|
||||
},
|
||||
toShowPop() {
|
||||
console.log('---pop')
|
||||
this.showMask = true
|
||||
// this.$refs.popup.open('top')
|
||||
},
|
||||
getImg() {
|
||||
return Math.floor(Math.random() * 35);
|
||||
},
|
||||
// 点击左边的栏目切换
|
||||
async swichMenu(index) {
|
||||
if (index == this.menuCurrent) return;
|
||||
@@ -456,7 +448,7 @@
|
||||
},
|
||||
navigateToSearch() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/search/search'
|
||||
url: '../../search/search'
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</view>
|
||||
<view class="found-record">
|
||||
<view v-for="(item, index) in foundList" :key="index" class="tag-item">
|
||||
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item" @click="recentSearch(item)" />
|
||||
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item.name" @click="recentSearch(item.name)" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -49,26 +49,15 @@
|
||||
searchBarTop: 0, //搜索栏的外边框高度,单位px
|
||||
searchBarHeight: 0, //搜索栏的高度,单位px
|
||||
queryParam: '',
|
||||
recentRecordList: [
|
||||
'烘焙宝典1',
|
||||
'烘焙宝典2',
|
||||
'烘焙宝典3',
|
||||
'烘焙宝典4',
|
||||
'无添加剂5',
|
||||
'烘焙宝典&无添加剂',
|
||||
'无添加剂6'
|
||||
],
|
||||
foundList: [
|
||||
'烘焙宝典1',
|
||||
'烘焙宝典2',
|
||||
'烘焙宝典3',
|
||||
'烘焙宝典4',
|
||||
'烘焙宝典&无添加剂',
|
||||
'无添加剂5'
|
||||
]
|
||||
recentRecordList: [],
|
||||
foundList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getDiscover()
|
||||
const tempList = uni.getStorageSync('storage_search_record')
|
||||
this.recentRecordList = tempList ? tempList : [];
|
||||
console.log(this.recentRecordList)
|
||||
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
this.searchBarTop = menuButtonInfo.top;
|
||||
this.searchBarHeight = menuButtonInfo.height;
|
||||
@@ -87,6 +76,11 @@
|
||||
this.recentRecordList.splice(index, 1)
|
||||
}
|
||||
this.recentRecordList.unshift(param)
|
||||
try {
|
||||
uni.setStorageSync('storage_search_record', this.recentRecordList);
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
@@ -97,6 +91,17 @@
|
||||
},
|
||||
clearRecentSearch() {
|
||||
this.recentRecordList = []
|
||||
try {
|
||||
uni.setStorageSync('storage_search_record', this.recentRecordList);
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
},
|
||||
getDiscover() {
|
||||
this.$apiServe.getDiscover().then(res => {
|
||||
this.foundList = res.data.data
|
||||
console.log(res.data.data)
|
||||
}).finally(_ => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,6 +188,13 @@ const apiService = {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
// 搜索发现 热搜
|
||||
getDiscover(data) {
|
||||
const url = `/home/discover`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
// 新增
|
||||
addOutboundOrder(data) {
|
||||
const url = `/api`
|
||||
|
||||
Reference in New Issue
Block a user