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() {
const params = {
goodsId: this.productId,
goodsId: this.id,
goodsName: this.attr.productSelect.store_name,
skuStr: this.attrValue,
price: this.attr.productSelect.price,
+22 -1
View File
@@ -24,7 +24,7 @@
<view class="msg" v-if="item.msg_type===1">
<image class="img" :src="item.msg_content" @click="preview(item.msg_content)"></image>
</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">
<image class="img v12-radius-8" :src="wsJson(item.msg_content).cover"></image>
</view>
@@ -126,14 +126,35 @@ export default {
this.token = uni.getStorageSync("login_status");
this.userInfo = uni.getStorageSync("userInfo");
this.uid = this.userInfo.uid
this.content = uni.getStorageSync(this.merName+this.uid+this.storeId)
this.connectSocketInit()
},
onUnload() {
if (this.socketOpen) {
this.socketTask.close();
}
uni.setStorageSync(this.merName+this.uid+this.storeId, this.content)
},
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) {
return JSON.parse(json)
},