Merge pull request 'chenxuelian' (#25) from chenxuelian into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/25
This commit is contained in:
1171906056
2022-12-25 06:57:22 +00:00
4 changed files with 35 additions and 27 deletions

View File

@@ -405,14 +405,6 @@
this.tagCurrent = index this.tagCurrent = index
this.featureMask = false 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) { async swichMenu(index) {
if (index == this.menuCurrent) return; if (index == this.menuCurrent) return;
@@ -456,7 +448,7 @@
}, },
navigateToSearch() { navigateToSearch() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/search/search' url: '../../search/search'
}) })
}, },
goBack() { goBack() {

View File

@@ -32,7 +32,7 @@
</view> </view>
<view class="found-record"> <view class="found-record">
<view v-for="(item, index) in foundList" :key="index" class="tag-item"> <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> </view>
</view> </view>
@@ -49,26 +49,15 @@
searchBarTop: 0, //搜索栏的外边框高度单位px searchBarTop: 0, //搜索栏的外边框高度单位px
searchBarHeight: 0, //搜索栏的高度单位px searchBarHeight: 0, //搜索栏的高度单位px
queryParam: '', queryParam: '',
recentRecordList: [ recentRecordList: [],
'烘焙宝典1', foundList: []
'烘焙宝典2',
'烘焙宝典3',
'烘焙宝典4',
'无添加剂5',
'烘焙宝典&无添加剂',
'无添加剂6'
],
foundList: [
'烘焙宝典1',
'烘焙宝典2',
'烘焙宝典3',
'烘焙宝典4',
'烘焙宝典&无添加剂',
'无添加剂5'
]
} }
}, },
onLoad() { onLoad() {
this.getDiscover()
const tempList = uni.getStorageSync('storage_search_record')
this.recentRecordList = tempList ? tempList : [];
console.log(this.recentRecordList)
const menuButtonInfo = uni.getMenuButtonBoundingClientRect(); const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
this.searchBarTop = menuButtonInfo.top; this.searchBarTop = menuButtonInfo.top;
this.searchBarHeight = menuButtonInfo.height; this.searchBarHeight = menuButtonInfo.height;
@@ -87,6 +76,11 @@
this.recentRecordList.splice(index, 1) this.recentRecordList.splice(index, 1)
} }
this.recentRecordList.unshift(param) this.recentRecordList.unshift(param)
try {
uni.setStorageSync('storage_search_record', this.recentRecordList);
} catch (e) {
// error
}
}, },
goBack() { goBack() {
uni.navigateBack() uni.navigateBack()
@@ -97,6 +91,17 @@
}, },
clearRecentSearch() { clearRecentSearch() {
this.recentRecordList = [] 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(_ => {})
} }
} }
} }

View File

@@ -137,6 +137,10 @@
fileList1: [] fileList1: []
} }
}, },
onLoad(options) {
console.log(options)
this.tabCurrent = options.index
},
methods: { methods: {
tabChange(data) { tabChange(data) {
this.tabCurrent = data.index this.tabCurrent = data.index

View File

@@ -188,6 +188,13 @@ const apiService = {
resolve(service.get(url)) resolve(service.get(url))
}) })
}, },
// 搜索发现 热搜
getDiscover(data) {
const url = `/home/discover`
return new Promise((resolve, reject) => {
resolve(service.get(url))
})
},
// 新增 // 新增
addOutboundOrder(data) { addOutboundOrder(data) {
const url = `/api` const url = `/api`