From 61032da9f6f840c9c96af090d1810bc7a0734f4b Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 30 七月 2025 17:18:14 +0800
Subject: [PATCH] 商品二维码跳转
---
pages/product/goods.vue | 36 +++++++++++++++++++++++++++++++++++-
pages/health/healthVideo.vue | 4 ++--
pages/commodity-square/commoditySquare.vue | 1 +
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/pages/commodity-square/commoditySquare.vue b/pages/commodity-square/commoditySquare.vue
index 3d35583..06ae8ae 100644
--- a/pages/commodity-square/commoditySquare.vue
+++ b/pages/commodity-square/commoditySquare.vue
@@ -252,6 +252,7 @@
},
goToGoodsInfo(id) {
const item = this.goodsList.find(item => id === item.id);
+ console.log(item)
uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`
});
diff --git a/pages/health/healthVideo.vue b/pages/health/healthVideo.vue
index d4a3d77..add3102 100644
--- a/pages/health/healthVideo.vue
+++ b/pages/health/healthVideo.vue
@@ -388,8 +388,8 @@
const videoId = params.videoId;
const source = params.source
queryParam.videoId = videoId
- queryParam.shareType = shareType
- queryParam.source = source
+ queryParam.shareType = shareType
+ queryParam.source = source
console.log('瑙f瀽鍙傛暟:', { shareType, videoId,source });
}
const token = storage.getAccessToken();
diff --git a/pages/product/goods.vue b/pages/product/goods.vue
index 83fa403..ed638ae 100644
--- a/pages/product/goods.vue
+++ b/pages/product/goods.vue
@@ -497,7 +497,24 @@
this.productRefHeight = windowHeight - bottomHeight + "px";
},
async onLoad (options) {
- this.routerVal = options;
+
+ if(options.q){
+ let queryParam = null;
+ const decodedUrl = decodeURIComponent(decodeURIComponent(option.q));
+ console.log('鍘熷URL:', decodedUrl);
+ const params = this.parseUrlParams(decodedUrl);
+ const id = params.id;
+ const gooodsId = params.goodsId;
+ queryParam.id = id;
+ queryParam.goodsId = gooodsId;
+ this.routerVal = queryParam;
+ }else{
+ this.routerVal = options;
+ }
+ console.log('鎵撳嵃淇℃伅')
+ console.log(options)
+ console.log(this.routerVal)
+
// #ifdef MP-WEIXIN
// 灏忕▼搴忛粯璁ゅ垎浜�
uni.showShareMenu({
@@ -522,6 +539,23 @@
},
methods: {
+ // 瑙f瀽URL鍙傛暟
+ parseUrlParams(url) {
+ const params = {};
+ // 澶勭悊鍙兘瀛樺湪鐨刪ash锛堝鏋滄湁鐨勮瘽锛�
+ const cleanUrl = url.split('#')[0];
+ const queryStr = cleanUrl.split('?')[1] || '';
+
+ queryStr.split('&').forEach(pair => {
+ const [key, value] = pair.split('=');
+ if (key) {
+ // 濡傛灉鍊煎瓨鍦紝鍒欒В鐮侊紝鍚﹀垯璁句负绌哄瓧绗︿覆
+ params[key] = value ? decodeURIComponent(value) : '';
+ }
+ });
+
+ return params;
+ },
// 閲嶆柊鎵撳紑涓嬫灦
reStartTakeDownSale(){
this.$refs.takeDownSale.show = true
--
Gitblit v1.8.0