diff --git a/config.js b/config.js index 2967bfa..e5c39a4 100644 --- a/config.js +++ b/config.js @@ -14,6 +14,7 @@ export default { * 商城ID (必填) * 可在超管后台-商城列表中查看10025 */ + storeId: 10045, // storeId: 10037, diff --git a/pages.json b/pages.json index e0468e2..b452e03 100644 --- a/pages.json +++ b/pages.json @@ -759,6 +759,13 @@ "enablePullDownRefresh": true } }, + { + "path": "webView", + "style": { + "navigationBarTitleText": "商品详情", + "enablePullDownRefresh": true + } + }, { "path": "detail", "style": { diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index 3622b30..a142158 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -204,7 +204,9 @@ - + + @@ -557,6 +559,13 @@ } }, methods: { + onLook(isLink, url) { + if (isLink) { + uni.navigateTo({ + url: '/pages/goods/webView?src=' + encodeURIComponent(url) //url是h5的展示地址pageB + }) + } + }, async getGoodsStockInfor() { let params = { list: [{ @@ -878,6 +887,29 @@ } }) }, + getLinksFromRichText(richText) { + // 正则表达式匹配a标签及其href属性 + const regex = /]*href="?([^">]+)"?[^>]*>(.*?)<\/a>/gim; + let matches, links = ''; + + // 执行正则表达式匹配 + while ((matches = regex.exec(richText)) !== null) { + // matches[1]是href属性值,matches[2]是标签内的文本 + links = matches[1]; + } + + return links; + }, + getValueAfterSymbol(str, symbol) { + const parts = str.split(symbol); + if (parts.length > 1) { + return parts[1].trim(); // 使用trim()移除前后空格 + } + return str; // 如果没有找到符号,返回空字符串 + }, + containsLetterMix(str, mix) { + return new RegExp(mix.split('').join('\\w*')).test(str) + }, // 获取商品信息 getGoodsDetail(type) { const that = this @@ -897,10 +929,11 @@ .replace(/style=""/g, '') .replace(/ { this.$set(this.goods, item, info[item]) - // that.goods[item] = info[item] }) that.isTodo = true; @@ -1009,7 +1042,6 @@ return; } // 立即下单 - console.log(this.token, '登录信息') if (this.goods.stock_total == 0) { return this.$toast('库存不足,请选择其他商品购买') } diff --git a/pages/goods/list.vue b/pages/goods/list.vue index f710b7f..ee5438e 100644 --- a/pages/goods/list.vue +++ b/pages/goods/list.vue @@ -105,7 +105,7 @@