Fix:3119 【商城小程序】用户点击商品卡片不会跳转到对应的商品详情页

This commit is contained in:
modendeveloper
2025-01-22 00:26:39 +08:00
parent 5177f5881a
commit 3d6a2785d5
2 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -777,7 +777,7 @@ export default {
}, },
goRoom() { goRoom() {
const params = { const params = {
goodsId: this.productId, goodsId: this.id,
goodsName: this.attr.productSelect.store_name, goodsName: this.attr.productSelect.store_name,
skuStr: this.attrValue, skuStr: this.attrValue,
price: this.attr.productSelect.price, price: this.attr.productSelect.price,
+22 -1
View File
@@ -24,7 +24,7 @@
<view class="msg" v-if="item.msg_type===1"> <view class="msg" v-if="item.msg_type===1">
<image class="img" :src="item.msg_content" @click="preview(item.msg_content)"></image> <image class="img" :src="item.msg_content" @click="preview(item.msg_content)"></image>
</view> </view>
<view class="msg v12-d-flex" style="box-sizing: content-box" v-if="item.msg_type===2"> <view class="msg v12-d-flex" style="box-sizing: content-box" v-if="item.msg_type===2" @click="toGoods(item)">
<view class="goods-logo"> <view class="goods-logo">
<image class="img v12-radius-8" :src="wsJson(item.msg_content).cover"></image> <image class="img v12-radius-8" :src="wsJson(item.msg_content).cover"></image>
</view> </view>
@@ -126,14 +126,35 @@ export default {
this.token = uni.getStorageSync("login_status"); this.token = uni.getStorageSync("login_status");
this.userInfo = uni.getStorageSync("userInfo"); this.userInfo = uni.getStorageSync("userInfo");
this.uid = this.userInfo.uid this.uid = this.userInfo.uid
this.content = uni.getStorageSync(this.merName+this.uid+this.storeId)
this.connectSocketInit() this.connectSocketInit()
}, },
onUnload() { onUnload() {
if (this.socketOpen) { if (this.socketOpen) {
this.socketTask.close(); this.socketTask.close();
} }
uni.setStorageSync(this.merName+this.uid+this.storeId, this.content)
}, },
methods: { methods: {
toGoods(item) {
console.log(item);
const itemJson = JSON.parse(item.msg_content)
if(!itemJson.goodsId) {
// 提示数据错误
// uni.showToast({
// title: '数据错误',
// icon: 'none'
// })
return
}
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: itemJson.goodsId
}
})
},
wsJson(json) { wsJson(json) {
return JSON.parse(json) return JSON.parse(json)
}, },