From f52d8cbcc6bb46adaf5c5eb5cfeca32caeaaf208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Tue, 5 Aug 2025 09:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=BF=E5=91=8A=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=A1=B5=E9=9D=A2=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/community/index/index.vue | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/community/index/index.vue b/packages/community/index/index.vue index 27116243..2bed8cf6 100644 --- a/packages/community/index/index.vue +++ b/packages/community/index/index.vue @@ -427,26 +427,27 @@ export default { headerServerClick(e) { console.log("当前点击内容", e); - if (!e.link_url) { + if (!e.target_page) { this.NotOpen(); return; } - if (e.link_url) { + if (e.target_page) { // #ifdef APP-PLUS uni.navigateTo({ - url: "/pages/webview/webview?url=" + encodeURIComponent(e.link_url), + url: + "/pages/webview/webview?url=" + encodeURIComponent(e.target_page), }); // #endif // #ifdef H5 - window.open(e.link_url, "_blank"); + window.open(e.target_page, "_blank"); // #endif // #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU if (e.appid) { uni.navigateToMiniProgram({ appId: e.appid, - path: e.link_url, + path: e.target_page, //需要传递给目标小程序的数据 extraData: { data1: "test", @@ -456,18 +457,23 @@ export default { }, }); } else { - NavgateTo(e.link_url); + // 确保路径是绝对路径 + let targetPage = e.target_page; + if (!targetPage.startsWith("/")) { + targetPage = "/" + targetPage; + } + NavgateTo(targetPage); // NavgateTo('/packages/localLife/index/index') } // 小程序中可能需要用户手动复制链接或使用web-view // uni.showModal({ // title: '提示', - // content: '即将打开外部链接,请复制后在浏览器中打开: ' + e.link_url, + // content: '即将打开外部链接,请复制后在浏览器中打开: ' + e.target_page, // confirmText: '复制链接', // success(res) { // if (res.confirm) { // uni.setClipboardData({ - // data: e.link_url, + // data: e.target_page, // success() { // uni.showToast({ // title: '复制成功',