绿满眶商城微信小程序-uniapp
zxl
2025-07-30 61032da9f6f840c9c96af090d1810bc7a0734f4b
商品二维码跳转
3个文件已修改
35 ■■■■■ 已修改文件
pages/commodity-square/commoditySquare.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/health/healthVideo.vue 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/goods.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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}`
                });
pages/health/healthVideo.vue
pages/product/goods.vue
@@ -497,7 +497,24 @@
    this.productRefHeight = windowHeight - bottomHeight + "px";
  },
  async onLoad (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: {
      // 解析URL参数
      parseUrlParams(url) {
        const params = {};
        // 处理可能存在的hash(如果有的话)
        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