From 5db47c112613b078ff832ca5190d0957714d8d71 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 6 Sep 2023 21:21:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/constants/ParamConstants.java | 2 +- .../controller/sys/response/BasicInfo.java | 2 ++ .../system/SystemParameterService.java | 6 +++++ .../canvas/components/editor/Preview.vue | 5 ++-- core/frontend/src/lang/en.js | 1 + core/frontend/src/lang/tw.js | 1 + core/frontend/src/lang/zh.js | 1 + core/frontend/src/utils/index.js | 5 ++++ .../views/system/sysParam/BasicSetting.vue | 24 +++++++++++++++++++ 9 files changed, 44 insertions(+), 3 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/commons/constants/ParamConstants.java b/core/backend/src/main/java/io/dataease/commons/constants/ParamConstants.java index 2b1ca6686f..7c67ca446a 100644 --- a/core/backend/src/main/java/io/dataease/commons/constants/ParamConstants.java +++ b/core/backend/src/main/java/io/dataease/commons/constants/ParamConstants.java @@ -116,7 +116,7 @@ public interface ParamConstants { DS_CHECK_INTERVAL_TYPE("basic.dsCheckIntervalType"), DEFAULT_LOGIN_TYPE("basic.loginType"), OPEN_HOME_PAGE("ui.openHomePage"), - + AUTO_MOBILE("ui.autoMobile"), OPEN_MARKET_PAGE("ui.openMarketPage"), TEMPLATE_MARKET_ULR("basic.templateMarketUlr"), diff --git a/core/backend/src/main/java/io/dataease/controller/sys/response/BasicInfo.java b/core/backend/src/main/java/io/dataease/controller/sys/response/BasicInfo.java index 8edcc6bde5..ba7f003500 100644 --- a/core/backend/src/main/java/io/dataease/controller/sys/response/BasicInfo.java +++ b/core/backend/src/main/java/io/dataease/controller/sys/response/BasicInfo.java @@ -29,5 +29,7 @@ public class BasicInfo extends LoginLimitInfo implements Serializable { private String dsCheckInterval; @ApiModelProperty("数据源检测时间间隔类型") private String dsCheckIntervalType; + @ApiModelProperty("自动识别移动端") + private String autoMobile = "true"; } diff --git a/core/backend/src/main/java/io/dataease/service/system/SystemParameterService.java b/core/backend/src/main/java/io/dataease/service/system/SystemParameterService.java index 6d8fe979db..29ee567046 100644 --- a/core/backend/src/main/java/io/dataease/service/system/SystemParameterService.java +++ b/core/backend/src/main/java/io/dataease/service/system/SystemParameterService.java @@ -62,9 +62,11 @@ public class SystemParameterService { List homePageList = this.getParamList("ui.openHomePage"); List marketPageList = this.getParamList("ui.openMarketPage"); List loginLimitList = this.getParamList("loginlimit"); + List autoMobileList = this.getParamList("ui.autoMobile"); paramList.addAll(homePageList); paramList.addAll(marketPageList); paramList.addAll(loginLimitList); + paramList.addAll(autoMobileList); BasicInfo result = new BasicInfo(); result.setOpenHomePage("true"); Map beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((LoginLimitXpackService.class)); @@ -92,6 +94,10 @@ public class SystemParameterService { boolean open = StringUtils.equals("true", param.getParamValue()); result.setOpenMarketPage(open ? "true" : "false"); } + if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.AUTO_MOBILE.getValue())) { + boolean close = StringUtils.equals("false", param.getParamValue()); + result.setAutoMobile(close ? "false" : "true"); + } if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) { result.setTemplateMarketUlr(param.getParamValue()); } diff --git a/core/frontend/src/components/canvas/components/editor/Preview.vue b/core/frontend/src/components/canvas/components/editor/Preview.vue index 5b0082e35a..06e7422bee 100644 --- a/core/frontend/src/components/canvas/components/editor/Preview.vue +++ b/core/frontend/src/components/canvas/components/editor/Preview.vue @@ -165,6 +165,8 @@ import PDFPreExport from '@/views/panel/export/PDFPreExport' import { listenGlobalKeyDownPreview } from '@/components/canvas/utils/shortcutKey' import UserViewDialog from '@/components/canvas/customComponent/UserViewDialog' import {hexColorToRGBA} from "@/views/chart/chart/util"; +import { isMobile } from '@/utils/index' + const erd = elementResizeDetectorMaker() export default { @@ -623,9 +625,8 @@ export default { return -1 }, _isMobile() { - const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) + const flag = isMobile() this.terminal = flag ? 'mobile' : 'pc' - // this.terminal = 'mobile' }, canvasStyleDataInit() { // 数据刷新计时器 diff --git a/core/frontend/src/lang/en.js b/core/frontend/src/lang/en.js index ddd6e8b781..113ffc7521 100644 --- a/core/frontend/src/lang/en.js +++ b/core/frontend/src/lang/en.js @@ -2412,6 +2412,7 @@ export default { themeDark: 'Dark', themeCustom: 'Custom', openHomePage: 'Show Home Page', + auto_identify_mobile_devices: 'Automatically identify mobile devices', openMarketPage: 'Show Market Page', mobileBG: 'Mobile Login page BG', helpLink: 'Help Document Link', diff --git a/core/frontend/src/lang/tw.js b/core/frontend/src/lang/tw.js index 7843fc63e1..d4ea027e6f 100644 --- a/core/frontend/src/lang/tw.js +++ b/core/frontend/src/lang/tw.js @@ -2406,6 +2406,7 @@ export default { themeDark: '深色', themeCustom: '自定義', openHomePage: '顯示首頁', + auto_identify_mobile_devices: '自動識別移動設備', openMarketPage: '顯示模板市場', mobileBG: '移動端登錄頁背景', helpLink: '幫助文檔鏈接', diff --git a/core/frontend/src/lang/zh.js b/core/frontend/src/lang/zh.js index 574a1bcb54..c8593421b1 100644 --- a/core/frontend/src/lang/zh.js +++ b/core/frontend/src/lang/zh.js @@ -2406,6 +2406,7 @@ export default { themeDark: '深色', themeCustom: '自定义', openHomePage: '显示首页', + auto_identify_mobile_devices: '自动识别移动设备', openMarketPage: '显示模板市场', mobileBG: '移动端登录页背景', helpLink: '帮助文档链接', diff --git a/core/frontend/src/utils/index.js b/core/frontend/src/utils/index.js index 5fb32758df..b9fa0d15a2 100644 --- a/core/frontend/src/utils/index.js +++ b/core/frontend/src/utils/index.js @@ -5,6 +5,7 @@ import { seizeLogin } from '@/api/user' import router from '@/router' import store from '@/store' import { Loading } from 'element-ui' +import { getSysUI } from '@/utils/auth' export function timeSection(date, type, labelFormat = 'yyyy-MM-dd') { if (!date) { return null @@ -308,6 +309,10 @@ export function getQueryVariable(variable) { } export function isMobile() { + const uiInfo = getSysUI() + if (uiInfo['ui.autoMobile']?.paramValue === 'false') { + return false + } const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) return flag } diff --git a/core/frontend/src/views/system/sysParam/BasicSetting.vue b/core/frontend/src/views/system/sysParam/BasicSetting.vue index d61ca4dfae..e7db140ee8 100644 --- a/core/frontend/src/views/system/sysParam/BasicSetting.vue +++ b/core/frontend/src/views/system/sysParam/BasicSetting.vue @@ -207,6 +207,24 @@ >{{ $t("commons.no") }} + + + + {{ $t("commons.yes") }} + {{ $t("commons.no") }} + + @@ -412,6 +430,12 @@ export default { type: 'text', sort: 14 }, + { + paramKey: 'ui.autoMobile', + paramValue: this.formInline.autoMobile, + type: 'text', + sort: 15 + }, { paramKey: 'loginlimit.limitTimes',