From 7ab790285f2ab8bd778bf0ef670524305a705eb5 Mon Sep 17 00:00:00 2001 From: chaorenluo <1243357953@qq.com> Date: Wed, 17 Jul 2024 11:25:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=89=8D=E7=AB=AF=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E9=97=AE=E9=A2=98=E8=B0=83=E6=95=B4=20(#352)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:修复前端白名单bug * fix:添加保存和发布检查判断白名单设置是否有误 --- web/src/common/regexpMap.ts | 11 +++ web/src/management/api/space.ts | 4 ++ .../modules/contentModule/PublishPanel.vue | 19 ++++++ .../edit/modules/contentModule/SavePanel.vue | 17 +++++ .../setters/widgets/teamMemberList.vue | 68 +++++++------------ .../materials/setters/widgets/whiteList.vue | 26 +++++++ web/src/render/adapter/rules.js | 12 +--- web/src/render/api/survey.js | 4 +- .../render/components/VerifyWhiteDialog.vue | 5 +- web/src/render/pages/RenderPage.vue | 9 +-- web/src/render/store/mutations.js | 4 +- web/src/render/store/state.js | 4 +- 12 files changed, 115 insertions(+), 68 deletions(-) create mode 100644 web/src/common/regexpMap.ts diff --git a/web/src/common/regexpMap.ts b/web/src/common/regexpMap.ts new file mode 100644 index 00000000..1de548a6 --- /dev/null +++ b/web/src/common/regexpMap.ts @@ -0,0 +1,11 @@ +export const regexpMap = { + nd: /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/, + m: /^[1]([3-9])[0-9]{9}$/, + idcard: /^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/, + strictIdcard: + /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/, + n: /^[0-9]+([.]{1}[0-9]+){0,1}$/, + e: /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/, + licensePlate: + /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([DFAG]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4,5}[A-Z0-9挂学警港澳]{1})$/ +} \ No newline at end of file diff --git a/web/src/management/api/space.ts b/web/src/management/api/space.ts index b0aadda9..94804575 100644 --- a/web/src/management/api/space.ts +++ b/web/src/management/api/space.ts @@ -16,6 +16,10 @@ export const getSpaceDetail = (workspaceId: string) => { return axios.get(`/workspace/${workspaceId}`) } +export const getMemberList = () => { + return axios.get('/workspace/member/list') +} + export const deleteSpace = (workspaceId: string) => { return axios.delete(`/workspace/${workspaceId}`) } diff --git a/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue b/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue index 622698d5..1a54ac77 100644 --- a/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue +++ b/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue @@ -31,6 +31,17 @@ const updateLogicConf = () => { } } +const updateWhiteConf = () => { + const baseConf = store.state.edit.schema.baseConf || {}; + if (baseConf.passwordSwitch && !baseConf.password) { + return true; + } + if (baseConf.whitelistType!='ALL' && !baseConf.whitelist?.length) { + return true; + } + return false +} + const handlePublish = async () => { if (isPublishing.value) { return @@ -46,6 +57,14 @@ const handlePublish = async () => { return } + + if(updateWhiteConf()){ + isPublishing.value = false + ElMessage.error('请检查问卷设置是否有误') + return + } + + const saveData = buildData(store.state.edit.schema) if (!saveData.surveyId) { isPublishing.value = false diff --git a/web/src/management/pages/edit/modules/contentModule/SavePanel.vue b/web/src/management/pages/edit/modules/contentModule/SavePanel.vue index a3f2f3cd..1d4c58e4 100644 --- a/web/src/management/pages/edit/modules/contentModule/SavePanel.vue +++ b/web/src/management/pages/edit/modules/contentModule/SavePanel.vue @@ -63,6 +63,17 @@ const updateLogicConf = () => { } } +const updateWhiteConf = () => { + const baseConf = store.state.edit.schema.baseConf || {}; + if (baseConf.passwordSwitch && !baseConf.password) { + return true; + } + if (baseConf.whitelistType!='ALL' && !baseConf.whitelist?.length) { + return true; + } + return false +} + const timerHandle = ref(null) const triggerAutoSave = () => { if (autoSaveStatus.value === 'saving') { @@ -114,6 +125,12 @@ const handleSave = async () => { return } + if(updateWhiteConf()){ + isSaving.value = false + ElMessage.error('请检查问卷设置是否有误') + return + } + try { const res: any = await saveData() if (res.code === 200) { diff --git a/web/src/materials/setters/widgets/teamMemberList.vue b/web/src/materials/setters/widgets/teamMemberList.vue index 4086b499..24c35de3 100644 --- a/web/src/materials/setters/widgets/teamMemberList.vue +++ b/web/src/materials/setters/widgets/teamMemberList.vue @@ -9,16 +9,18 @@