From 11e1e4bcea08f77c7e5e302c72ae334b6be854ca Mon Sep 17 00:00:00 2001 From: zhongzm Date: Thu, 27 Feb 2025 16:12:55 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=B7=BB=E5=8A=A0portal=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/portal/index.vue | 257 +++++++++++++++++++++++++----- 1 file changed, 220 insertions(+), 37 deletions(-) diff --git a/src/views/device/portal/index.vue b/src/views/device/portal/index.vue index 3d205ff..9e94a31 100644 --- a/src/views/device/portal/index.vue +++ b/src/views/device/portal/index.vue @@ -175,11 +175,11 @@ - - - - - + + + + + @@ -427,26 +427,69 @@ const URL_PATTERN = new RegExp( const addForm = ref({ name: '', - enable: true, + enable: true, // 默认启用 ssidList: [], authType: 4, // 固定为外部 Portal 认证 authTimeout: { - customTimeout: 8, - customTimeoutUnit: 2 + customTimeout: 8, // 默认超时时间 + customTimeoutUnit: 2 // 默认单位为小时 }, noAuth: { - dailyLimitEnable: false + dailyLimitEnable: false // 默认不启用每日限额 }, - httpsRedirectEnable: false, - landingPage: 1, - pageType: 2, + httpsRedirectEnable: false, // 默认不启用 HTTPS 重定向 + landingPage: 1, // 默认登录页面 + pageType: 2, // 默认页面类型 importedPortalPage: { - id: 'test' + id: 'test' // 默认导入的门户页面 ID }, externalPortal: { - hostType: 2, - serverUrl: '', - serverUrlScheme: 'http' + hostType: 2, // 默认外部 Portal 服务器类型 + serverUrl: '', // 默认服务器 URL + serverUrlScheme: 'http' // 默认协议 + }, + portalCustomize: { // 新增的默认参数 + defaultLanguage: 1, + backgroundPictureId: '', + logoPictureId: '', + logoDisplay: true, + inputBoxColor: '', + inputBoxOpacity: 0, + inputTextColor: '', + inputTextOpacity: 0, + buttonColor: '', + buttonOpacity: 0, + buttonTextColor: '', + buttonTextOpacity: 0, + buttonText: '', + // formAuthButtonText: '', + welcomeEnable: true, + // welcomeInformation: '', + // welcomeTextColor: '', + welcomeTextOpacity: 0, + welcomeTextFontSize: 0, + termsOfServiceEnable: true, + termsOfServiceText: '', + termsOfServiceFontSize: 0, + termsOfServiceUrlTexts: [ + { + content: '', + text: '' + } + ], + copyrightEnable: false, + copyright: '', + // copyrightTextColor: '', + // copyrightTextOpacity: 0, + copyrightTextFontSize: 12, + redirectionCountDownEnable: true, + advertisement: { + enable: false, + pictureIds: [], + // totalDuration: 0, + // pictureInterval: 0, + // skipEnable: true + } } }); @@ -534,17 +577,71 @@ const handleAddConfirm = async () => { const hide = message.loading(t('common.loading'), 0); // 创建一个新对象来存储要提交的数据 - const submitData = { ...addForm.value }; - - // 设置默认参数 - submitData.authTimeout = { - customTimeout: 8, - customTimeoutUnit: 2 - }; - submitData.externalPortal = { - hostType: 2, - serverUrl: submitData.externalPortal.serverUrl, - serverUrlScheme: submitData.externalPortal.serverUrlScheme + const submitData = { + ...addForm.value, + // 这里可以直接使用默认值 + authType: 4, // 固定为外部 Portal 认证 + authTimeout: { + customTimeout: 8, + customTimeoutUnit: 2 + }, + noAuth: { + dailyLimitEnable: false + }, + httpsRedirectEnable: false, + landingPage: 1, + pageType: 2, + importedPortalPage: { + id: 'test' + }, + externalPortal: { + hostType: 2, + serverUrl: addForm.value.externalPortal.serverUrl, // 确保从 addForm 中获取 serverUrl + serverUrlScheme: addForm.value.externalPortal.serverUrlScheme + }, + portalCustomize: { // 新增的默认参数 + defaultLanguage: 1, + backgroundPictureId: '', + logoPictureId: '', + logoDisplay: true, + inputBoxColor: "#ffffff", + inputBoxOpacity: 100, + inputTextColor: "#2B2B2B", + inputTextOpacity: 100, + buttonColor: "#00778C", + buttonOpacity: 100, + buttonTextColor: "#FFFFFF", + buttonTextOpacity: 100, + buttonText: "Log In", + // formAuthButtonText: '', + welcomeEnable: false, + // welcomeInformation: '', + // welcomeTextColor: '', + welcomeTextOpacity: 100, + welcomeTextFontSize: 12, + termsOfServiceEnable: false, + termsOfServiceText: "I agree to Terms of Service", + termsOfServiceFontSize: 12, + termsOfServiceUrlTexts: [ + { + content: "By accepting this agreement and accessing the wireless network, you acknowledge that you are of legal age, you have read and understood, and agree to be bound by this agreement.", + text: "Terms of Service" + } + ], + copyrightEnable: false, + copyright: '', + // copyrightTextColor: '', + // copyrightTextOpacity: 0, + copyrightTextFontSize: 12, + redirectionCountDownEnable: true, + advertisement: { + enable: false, + pictureIds: [], + // totalDuration: 0, + // pictureInterval: 0, + // skipEnable: true + } + } }; const { error } = await addPortal(selectedSiteId.value, submitData); @@ -563,23 +660,66 @@ const editVisible = ref(false); const editFormRef = ref(); const editForm = ref({ name: '', - enable: true, + enable: true, // 默认启用 ssidList: [], authType: 4, // 固定为外部 Portal 认证 authTimeout: { - customTimeout: 8, - customTimeoutUnit: 2 + customTimeout: 8, // 默认超时时间 + customTimeoutUnit: 2 // 默认单位为小时 }, - httpsRedirectEnable: false, - landingPage: 1, - pageType: 2, + httpsRedirectEnable: false, // 默认不启用 HTTPS 重定向 + landingPage: 1, // 默认登录页面 + pageType: 2, // 默认页面类型 importedPortalPage: { - id: 'test' + id: 'test' // 默认导入的门户页面 ID }, externalPortal: { - hostType: 2, - serverUrl: '', - serverUrlScheme: 'http' + hostType: 2, // 默认外部 Portal 服务器类型 + serverUrl: '', // 默认服务器 URL + serverUrlScheme: 'http' // 默认协议 + }, + portalCustomize: { // 新增的默认参数 + defaultLanguage: 1, + backgroundPictureId: '', + logoPictureId: '', + logoDisplay: true, + inputBoxColor: "#ffffff", + inputBoxOpacity: 100, + inputTextColor: "#2B2B2B", + inputTextOpacity: 100, + buttonColor: "#00778C", + buttonOpacity: 100, + buttonTextColor: "#FFFFFF", + buttonTextOpacity: 100, + buttonText: "Log In", + // formAuthButtonText: '', + welcomeEnable: false, + // welcomeInformation: '', + // welcomeTextColor: '', + welcomeTextOpacity: 100, + welcomeTextFontSize: 12, + termsOfServiceEnable: false, + termsOfServiceText: "I agree to Terms of Service", + termsOfServiceFontSize: 12, + termsOfServiceUrlTexts: [ + { + content: "By accepting this agreement and accessing the wireless network, you acknowledge that you are of legal age, you have read and understood, and agree to be bound by this agreement.", + text: "Terms of Service" + } + ], + copyrightEnable: false, + copyright: '', + // copyrightTextColor: '', + // copyrightTextOpacity: 0, + copyrightTextFontSize: 12, + redirectionCountDownEnable: true, + advertisement: { + enable: false, + pictureIds: [], + // totalDuration: 0, + // pictureInterval: 0, + // skipEnable: true + } } }); @@ -628,6 +768,49 @@ const handleEditConfirm = async () => { hostType: 2, serverUrl: editForm.value.externalPortal.serverUrl, serverUrlScheme: editForm.value.externalPortal.serverUrlScheme + }, + portalCustomize: { // 新增的默认参数 + defaultLanguage: 1, + backgroundPictureId: '', + logoPictureId: '', + logoDisplay: true, + inputBoxColor: "#ffffff", + inputBoxOpacity: 100, + inputTextColor: "#2B2B2B", + inputTextOpacity: 100, + buttonColor: "#00778C", + buttonOpacity: 100, + buttonTextColor: "#FFFFFF", + buttonTextOpacity: 100, + buttonText: "Log In", + // formAuthButtonText: '', + welcomeEnable: false, + // welcomeInformation: '', + // welcomeTextColor: '', + welcomeTextOpacity: 100, + welcomeTextFontSize: 12, + termsOfServiceEnable: false, + termsOfServiceText: "I agree to Terms of Service", + termsOfServiceFontSize: 12, + termsOfServiceUrlTexts: [ + { + content: "By accepting this agreement and accessing the wireless network, you acknowledge that you are of legal age, you have read and understood, and agree to be bound by this agreement.", + text: "Terms of Service" + } + ], + copyrightEnable: false, + copyright: '', + // copyrightTextColor: '', + // copyrightTextOpacity: 0, + copyrightTextFontSize: 12, + redirectionCountDownEnable: true, + advertisement: { + enable: false, + pictureIds: [], + // totalDuration: 0, + // pictureInterval: 0, + // skipEnable: true + } } };