| | |
| | | url = '/' + url; |
| | | } |
| | | let p = url; |
| | | if(url.indexOf('pages/shop/shop') != -1){ |
| | | let shopSupplierId = null; |
| | | try { |
| | | // 尝试使用 URLSearchParams(H5环境) |
| | | if (typeof URLSearchParams !== 'undefined') { |
| | | const urlParams = new URLSearchParams(url.split('?')[1]); |
| | | shopSupplierId = urlParams.get('shop_supplier_id'); |
| | | } else { |
| | | // 兼容非H5环境 |
| | | const match = url.match(/[?&]shop_supplier_id=([^&]*)/); |
| | | shopSupplierId = match ? match[1] : null; |
| | | } |
| | | } catch (e) { |
| | | // 备用方案 |
| | | const match = url.match(/[?&]shop_supplier_id=([^&]*)/); |
| | | shopSupplierId = match ? match[1] : null; |
| | | } |
| | | if(shopSupplierId) { |
| | | uni.setStorageSync('shop_supplier_id', shopSupplierId); |
| | | } |
| | | } |
| | | if (url.indexOf('?') != -1) { |
| | | p = url.substr(0, url.indexOf('?')); |
| | | // #ifdef H5 |