From f3429013f18b25e2dc4dd99d230170c1892a1479 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期四, 19 六月 2025 11:24:14 +0800 Subject: [PATCH] update 修改商品广场 --- config/api.js | 8 +- pages.json | 34 ++++++----- components/custom-tabbar.vue | 4 + pages/commodity-square/commoditySquare.vue | 81 ++++++++++++++++++--------- 4 files changed, 80 insertions(+), 47 deletions(-) diff --git a/components/custom-tabbar.vue b/components/custom-tabbar.vue index 5d2cf8b..75aec2e 100644 --- a/components/custom-tabbar.vue +++ b/components/custom-tabbar.vue @@ -47,7 +47,9 @@ "key": 'index' }, { - "pagePath": "/pages/tabbar/category/category", + // "pagePath": "/pages/tabbar/category/category", + "pagePath": "/pages/commodity-square/commoditySquare", + "iconPath": "/static/tabbar/category.png", "selectedIconPath": "/static/tabbar/category-s.png", "text": "鍟嗗煄", diff --git a/config/api.js b/config/api.js index bc6ccf9..73823e6 100644 --- a/config/api.js +++ b/config/api.js @@ -4,10 +4,10 @@ */ // 寮�鍙戠幆澧� const dev = { - im: "http://127.0.0.1:8885", - common: "http://127.0.0.1:8890", - buyer: "http://127.0.0.1:8888", - store: "http://127.0.0.1:8889", + im: "http://192.168.0.15:8885", + common: "http://192.168.0.15:8890", + buyer: "http://192.168.0.15:8888", + store: "http://192.168.0.15:8889", // common: "http://192.168.0.113:8890", // buyer: "http://192.168.0.113:8888", // im: "http://192.168.0.113:8885", diff --git a/pages.json b/pages.json index aae66b9..e738c2e 100644 --- a/pages.json +++ b/pages.json @@ -63,12 +63,14 @@ } }, { - "path": "pages/tabbar/category/category", + // "path": "pages/tabbar/category/category", + "path": "pages/commodity-square/commoditySquare", + "style": { - "navigationBarTitleText": "鍒嗙被", - "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� + "navigationBarTitleText": "鍟嗗搧骞垮満", + // "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� "navigationBarTextStyle": "black", - "disableScroll": true, + // "disableScroll": true, "bounce": "none", "scrollIndicator": "none", "componentPlaceholder": { @@ -1432,17 +1434,18 @@ "navigationBarTitleText": "澶у仴搴�" } }] - }, - { - "root": "pages/commodity-square", - "pages": [{ - "path" : "commoditySquare", - "style" : - { - "navigationBarTitleText" : "鍟嗗搧骞垮満" - } - }] } + // , + // { + // "root": "pages/commodity-square", + // "pages": [{ + // "path" : "commoditySquare", + // "style" : + // { + // "navigationBarTitleText" : "鍟嗗搧骞垮満" + // } + // }] + // } ], "globalStyle": { "navigationBarTextStyle": "black", @@ -1470,7 +1473,8 @@ "text": "棣栭〉" }, { - "pagePath": "pages/tabbar/category/category", + // "pagePath": "pages/tabbar/category/category", + "pagePath": "pages/commodity-square/commoditySquare", "iconPath": "static/tabbar/category.png", "selectedIconPath": "static/tabbar/category-s.png", "text": "鍟嗗煄" diff --git a/pages/commodity-square/commoditySquare.vue b/pages/commodity-square/commoditySquare.vue index b335475..f903f36 100644 --- a/pages/commodity-square/commoditySquare.vue +++ b/pages/commodity-square/commoditySquare.vue @@ -1,9 +1,10 @@ <template> <view class="container"> - <input type="text" v-show="false" v-model="flushDom"/> + <input type="text" v-show="false" v-model="flushDom" /> <view class="commoditySquare"> <view class="left" style="width: 310rpx;"> - <view class="commoditySquareItem" v-for="(item,index) in goodsList1" @click="goToGoodsInfo('goodsList1',item.id)"> + <view class="commoditySquareItem" v-for="(item,index) in goodsList1" + @click="goToGoodsInfo('goodsList1',item.id)"> <video :src="item.goodsVideo" v-if="item.goodsVideo " v-show="item.show" :initial-time="0" :controls="false" object-fit="contain" :show-play-btn="false" :show-center-play-btn="false" @loadedmetadata="getvideoInfo($event,'goodsList1',index)" :ref="'video'+item.id" @@ -21,7 +22,8 @@ </view> </view> <view class="right" style="width: 310rpx;"> - <view class="commoditySquareItem" v-for="(item,index) in goodsList2" @click="goToGoodsInfo('goodsList2',item.id)"> + <view class="commoditySquareItem" v-for="(item,index) in goodsList2" + @click="goToGoodsInfo('goodsList2',item.id)"> <video :src="item.goodsVideo" v-if="item.goodsVideo " v-show="item.show" :initial-time="0" :controls="false" object-fit="contain" :show-play-btn="false" :show-center-play-btn="false" @loadedmetadata="getvideoInfo($event,'goodsList2',index)" :ref="'video'+item.id" @@ -53,7 +55,9 @@ </view> </uni-drawer> </view> - <view style="display: flex;align-items: center;justify-content: center;margin-top: 20rpx;" v-if="canLoadMore">娌℃湁鏇村鏁版嵁浜�.................</view> + <view style="display: flex;align-items: center;justify-content: center;margin-top: 20rpx;" v-if="canLoadMore"> + 娌℃湁鏇村鏁版嵁浜�.................</view> + <custom-tabbar bgColor="#ffffff" selected="shop"></custom-tabbar> </view> </template> @@ -75,11 +79,11 @@ //褰撳墠閫変腑鐨勫垎绫� currentCategort: '', //鏄剧ず娌℃湁鏁版嵁 - canLoadMore:false, + canLoadMore: false, //鏈�澶ч〉鏁� maxPages: 0, //鍒锋柊dom浣跨敤 - flushDom:'', + flushDom: '', //鏌ヨ鍟嗗搧闇�瑕佺殑鍙傛暟 getGoodsParam: { keyword: '', @@ -117,11 +121,11 @@ console.log(this[arrName][index].width, this[arrName][index].height) this.flushDom = new Date(); }, - goToGoodsInfo(arrName,id){ - const item =this[arrName].find(item=> id === item.id); - uni.navigateTo({ - url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}` - }); + goToGoodsInfo(arrName, id) { + const item = this[arrName].find(item => id === item.id); + uni.navigateTo({ + url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}` + }); }, //鑾峰彇鍒嗙被瀵艰埅鏍� async loadCategoryList() { @@ -150,21 +154,44 @@ } }) //骞冲垎缁欎袱涓暟缁� - const middle = Math.ceil(goodsList.data.result.records.length / 2); - this.goodsList1 = goodsList.data.result.records.slice(0, middle); - this.goodsList2 = goodsList.data.result.records.slice(middle); - this.maxPages = goodsList.data.result.pages - console.log(this.maxPages) + const middle = Math.ceil(goodsList.data.result.records.length / 2); + this.goodsList1 = goodsList.data.result.records.slice(0, middle); + this.goodsList2 = goodsList.data.result.records.slice(middle); + this.maxPages = goodsList.data.result.pages + console.log(this.maxPages) } }, onShow() { this.showDrawer('showLeft') }, - onLoad() { - this.loadCategoryList(); + async onLoad() { + await this.loadCategoryList(); + this.getGoodsParam.pageNumber = 1 + this.getGoodsParam.categoryId = "" + this.getGoodsParam.keyword = "" + const goodsList = await getGoodsList(this.getGoodsParam); + const sts = await getSTSToken(); + const stsUrl = sts.data.data.endpoint + // 澶勭悊鏁版嵁 + goodsList.data.result.records.forEach(item => { + if (item.thumbnail !== '' && item.thumbnail !== null && item.thumbnail.indexOf('http') === + -1) { + item.thumbnail = stsUrl + '/' + item.thumbnail + } + if (item.goodsVideo !== '' && item.goodsVideo !== null && item.goodsVideo.indexOf( + 'http') === -1) { + item.goodsVideo = stsUrl + '/' + item.goodsVideo + } + }) + //骞冲垎缁欎袱涓暟缁� + const middle = Math.ceil(goodsList.data.result.records.length / 2); + this.goodsList1 = goodsList.data.result.records.slice(0, middle); + this.goodsList2 = goodsList.data.result.records.slice(middle); + this.maxPages = goodsList.data.result.pages + console.log(this.maxPages) }, - async onReachBottom(){ - if(this.getGoodsParam.pageNumber<this.maxPages){ + async onReachBottom() { + if (this.getGoodsParam.pageNumber < this.maxPages) { this.getGoodsParam.pageNumber++; const goodsList = await getGoodsList(this.getGoodsParam); const sts = await getSTSToken(); @@ -181,14 +208,14 @@ } }) //骞冲垎缁欎袱涓暟缁� - const middle = Math.ceil(goodsList.data.result.records.length / 2); - this.goodsList1 = [...this.goodsList1,...goodsList.data.result.records.slice(0, middle)]; - this.goodsList2 = [...this.goodsList2,...goodsList.data.result.records.slice(middle)]; - this.maxPages = goodsList.data.result.pages - }else{ + const middle = Math.ceil(goodsList.data.result.records.length / 2); + this.goodsList1 = [...this.goodsList1, ...goodsList.data.result.records.slice(0, middle)]; + this.goodsList2 = [...this.goodsList2, ...goodsList.data.result.records.slice(middle)]; + this.maxPages = goodsList.data.result.pages + } else { this.canLoadMore = true; } - + } } </script> @@ -222,7 +249,7 @@ } .commoditySquareItem { - border: 1rpx solid darkgray; + // border: 1rpx solid #b6dbba; border-radius: 12rpx; box-sizing: border-box; padding: 0 32rpx; -- Gitblit v1.8.0