diff --git a/packageSearch/goods-category-search/category-index.vue b/packageSearch/goods-category-search/category-index.vue index cac1f73..e86bdff 100644 --- a/packageSearch/goods-category-search/category-index.vue +++ b/packageSearch/goods-category-search/category-index.vue @@ -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() { diff --git a/packageSearch/search/search.vue b/packageSearch/search/search.vue index 0a13b0f..16e62b0 100644 --- a/packageSearch/search/search.vue +++ b/packageSearch/search/search.vue @@ -32,7 +32,7 @@ - + @@ -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(_ => {}) } } } diff --git a/pages/ideasAndNeeds/ideasAndNeeds.vue b/pages/ideasAndNeeds/ideasAndNeeds.vue index 1f02a43..2de3d0c 100644 --- a/pages/ideasAndNeeds/ideasAndNeeds.vue +++ b/pages/ideasAndNeeds/ideasAndNeeds.vue @@ -137,6 +137,10 @@ fileList1: [] } }, + onLoad(options) { + console.log(options) + this.tabCurrent = options.index + }, methods: { tabChange(data) { this.tabCurrent = data.index diff --git a/service/request.js b/service/request.js index 51b49ee..d83825f 100644 --- a/service/request.js +++ b/service/request.js @@ -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`