diff --git a/packageSearch/goods-category-search/category-index.vue b/packageSearch/goods-category-search/category-index.vue index e86bdff..4f2ed21 100644 --- a/packageSearch/goods-category-search/category-index.vue +++ b/packageSearch/goods-category-search/category-index.vue @@ -355,13 +355,15 @@ menuItemHeight: 0, // 左边菜单item的高度 tabCurrent: 0, //分类详情 上架时间, // 左边菜单item的高度 tagCurrent: 0, //分类详情 上架时间 + imgUrl: '' } }, onLoad() { const menuButtonInfo = uni.getMenuButtonBoundingClientRect(); - console.log(menuButtonInfo) this.searchBarTop = menuButtonInfo.top; this.searchBarHeight = menuButtonInfo.height; + this.imgUrl = uni.getStorageSync('img_url') + this.getCategoryList() }, onReady() { let that = this; @@ -448,9 +450,22 @@ }, navigateToSearch() { uni.navigateTo({ - url: '../../search/search' + url: '../search/search' }) }, + getCategoryList() { + this.$apiServe.getCategories().then(res => { + this.categoryList = res.data.data.map((item, index) => { + item.icon = this.imgUrl + item.icon + item.active = false + if(!index) { + item.active = true + } + return item + }) + console.log(this.categoryList) + }).finally(_ => {}) + }, goBack() { uni.navigateBack() }, diff --git a/pages/ideasAndNeeds/ideasAndNeeds.vue b/pages/ideasAndNeeds/ideasAndNeeds.vue index 2de3d0c..d96a6ad 100644 --- a/pages/ideasAndNeeds/ideasAndNeeds.vue +++ b/pages/ideasAndNeeds/ideasAndNeeds.vue @@ -146,10 +146,6 @@ this.tabCurrent = data.index this.needsPublishForm = {} }, - changeCity(data) { - this.needsPublishForm.city = data.data.join('') - console.log('showCityPicker = true') - }, getCityValue(data) { this.showCityPicker = false this.needsPublishForm.city = data.join('/') diff --git a/pages/index/index.vue b/pages/index/index.vue index e703bdf..18cfbbb 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -105,6 +105,7 @@ uni.stopPullDownRefresh() }, onLoad() { + this.getImgUrl() this.$apiServe.getCategories().then(res => { console.log(res) }).finally(_ => {}) @@ -151,6 +152,16 @@ uni.navigateTo({ url: '../../packageSearch/goods-category-search/category-index' }) + }, + getImgUrl() { + this.$apiServe.getImgUrl().then(res => { + console.log(res) + try { + uni.setStorageSync('img_url', res.data.data.img_url); + } catch (e) { + // error + } + }).finally(_ => {}) } } } diff --git a/service/request.js b/service/request.js index d83825f..46ee5e6 100644 --- a/service/request.js +++ b/service/request.js @@ -189,12 +189,26 @@ const apiService = { }) }, // 搜索发现 热搜 - getDiscover(data) { + getDiscover() { const url = `/home/discover` return new Promise((resolve, reject) => { resolve(service.get(url)) }) }, + // 搜索产品 + getProductList(data) { + const url = `/home/product` + return new Promise((resolve, reject) => { + resolve(service.get(url)) + }) + }, + // 图片基本地址 + getImgUrl() { + const url = `/center/cfg?key=img_url` + return new Promise((resolve, reject) => { + resolve(service.get(url)) + }) + }, // 新增 addOutboundOrder(data) { const url = `/api`