From bb2c1b0b42f08b7eebad534c4d80d745ebb3a79b Mon Sep 17 00:00:00 2001 From: xujiang Date: Thu, 2 Sep 2021 19:52:38 +0800 Subject: [PATCH] =?UTF-8?q?:new:=20=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=88=A4=E6=96=AD,=20=E4=BF=AE=E5=A4=8Dissue#119?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/materials/base/Form/index.tsx | 3 ++- src/utils/tool.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/materials/base/Form/index.tsx b/src/materials/base/Form/index.tsx index 68c8a39..05539b5 100644 --- a/src/materials/base/Form/index.tsx +++ b/src/materials/base/Form/index.tsx @@ -3,6 +3,7 @@ import { Button } from 'zarm'; import BaseForm from './BaseForm'; import styles from './index.less'; import { IFormConfig } from './schema'; +import { IsPC } from '@/utils/tool'; import logo from '@/assets/form.png'; const FormComponent = (props: IFormConfig & { isTpl: boolean }) => { const { @@ -52,7 +53,7 @@ const FormComponent = (props: IFormConfig & { isTpl: boolean }) => { backgroundColor: bgColor, overflow: 'hidden', position: 'absolute', - pointerEvents: isEditorPage ? 'none' : 'initial', + pointerEvents: isEditorPage || IsPC() ? 'none' : 'initial', }} > {title && ( diff --git a/src/utils/tool.ts b/src/utils/tool.ts index 7322953..074d8d6 100644 --- a/src/utils/tool.ts +++ b/src/utils/tool.ts @@ -154,3 +154,17 @@ export const _gaw = (w: number) => { const vw = window.innerWidth > 800 ? 375 : window.innerWidth; return (vw / 375) * w; }; + +// 代码运行环境判断 +export function IsPC() { + var userAgentInfo = navigator.userAgent; + var Agents = new Array('Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'); + var flag = true; + for (var v = 0; v < Agents.length; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +}