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: '复制成功',