| | |
| | | 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({ |
| | |
| | | }, |
| | | |
| | | 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 |
| | |
| | | */ |
| | | back () { |
| | | if (getCurrentPages().length == 1) { |
| | | uni.switchTab({ |
| | | url: "/pages/tabbar/home/index", |
| | | uni.redirectTo({ |
| | | url: "/pages/commodity-square/commoditySquare", |
| | | }); |
| | | } else { |
| | | uni.navigateBack(); |