From 146920496ee730d78f949c4384dadbbb69d39f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 14 Aug 2023 03:40:03 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96OFD=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E9=A2=84=E8=A7=88=20=E9=A1=B5=E9=9D=A2=E4=B8=8D?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=20=E4=BC=98=E5=8C=96OFD=20=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E9=A2=84=E8=A7=88=20=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=8D=E8=87=AA=E9=80=82=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- server/src/main/resources/web/ofd.ftl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/src/main/resources/web/ofd.ftl b/server/src/main/resources/web/ofd.ftl index de05d6e2..d05ea302 100644 --- a/server/src/main/resources/web/ofd.ftl +++ b/server/src/main/resources/web/ofd.ftl @@ -4,7 +4,7 @@ - OFD预览 + ${file.name}OFD预览 <#include "*/commonHeader.ftl"> @@ -22,7 +22,11 @@ if (!url.startsWith(baseUrl)) { url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(Base64.encode(url)); } + if(IsPhone()){ + document.getElementsByTagName('iframe')[0].src = "${baseUrl}ofd/index.html?file=" + encodeURIComponent(url)+"&scale=width"; + }else{ document.getElementsByTagName('iframe')[0].src = "${baseUrl}ofd/index.html?file="+ encodeURIComponent(url)+""; + } document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight - 10; /** * 页面变化调整高度 @@ -32,7 +36,13 @@ fm.height = window.document.documentElement.clientHeight - 10; } - + function IsPhone() { + var info = navigator.userAgent; + //通过正则表达式的test方法判断是否包含“Mobile”字符串 + var isPhone = /mobile/i.test(info); + //如果包含“Mobile”(是手机设备)则返回true + return isPhone; + } /*初始化水印*/ window.onload = function () { initWaterMark();