From 985f1279d5cf7102e97e2ffa7e914cd2a743ac40 Mon Sep 17 00:00:00 2001 From: fanfan Date: Thu, 18 Apr 2024 09:22:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E5=8A=A0?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 3 ++- manifest.json | 2 +- pages.json | 7 +++++++ pages/goods/detail.vue | 40 ++++++++++++++++++++++++++++++++++++---- pages/goods/webView.vue | 28 ++++++++++++++++++++++++++++ project.config.json | 2 +- 6 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 pages/goods/webView.vue diff --git a/config.js b/config.js index 9325d95..f340b07 100644 --- a/config.js +++ b/config.js @@ -14,7 +14,8 @@ export default { * 商城ID (必填) * 可在超管后台-商城列表中查看10025 */ - storeId: 10001, + // storeId: 10001, + storeId: 10045, // storeId: 10037, diff --git a/manifest.json b/manifest.json index 2f9cbcc..04e172b 100644 --- a/manifest.json +++ b/manifest.json @@ -92,7 +92,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wx68d198de972a9e9d", + "appid" : "wxe843b6d7a4bd3389", "libVersion" : "latest", "setting" : { // 是否检查安全域名和 TLS 版本 diff --git a/pages.json b/pages.json index b7ff968..6edc952 100644 --- a/pages.json +++ b/pages.json @@ -745,6 +745,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/webView.vue b/pages/goods/webView.vue new file mode 100644 index 0000000..c4a5c5a --- /dev/null +++ b/pages/goods/webView.vue @@ -0,0 +1,28 @@ +//PageWebview.vue + + + + + diff --git a/project.config.json b/project.config.json index 435aa7e..06a195e 100644 --- a/project.config.json +++ b/project.config.json @@ -1,5 +1,5 @@ { - "appid": "wx68d198de972a9e9d", + "appid": "wxe843b6d7a4bd3389", "compileType": "miniprogram", "libVersion": "3.3.3", "packOptions": { From 4b9fa154baff4e85c0cbf8c3e1f5d89c124854c9 Mon Sep 17 00:00:00 2001 From: fanfan Date: Thu, 18 Apr 2024 09:46:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/list.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 @@