From d41684d7ed1638aeb2f2711d12de209c5fb3208a Mon Sep 17 00:00:00 2001 From: zhoulinf <2507241354@qq.com> Date: Tue, 27 Jan 2026 14:38:30 +0800 Subject: [PATCH] =?UTF-8?q?h5=EF=BC=88=E8=BF=94=E5=9B=9E=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/res/year-statistic/index.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/res/year-statistic/index.html b/public/res/year-statistic/index.html index abb6d762..ffd5f76b 100644 --- a/public/res/year-statistic/index.html +++ b/public/res/year-statistic/index.html @@ -1530,12 +1530,15 @@ } // 返回按钮功能 - function goBack() { - if (window.history.length > 1) { - window.history.back(); - } else { - // 如果没有历史记录,关闭窗口或跳转到默认页面 - window.close(); + function goBack(){//h5返回APP + let data = {"action":"goBack","params":""} + var u = navigator.userAgent; + var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); + // var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 + if(isiOS){ + window.webkit.messageHandlers.nativeObject.postMessage(data); + }else { + window.android.sendMessage("goBack"); } }