2
0

fix:添加portal参数配置

This commit is contained in:
zhongzm
2025-02-27 16:12:55 +08:00
parent 21f372c9b5
commit 11e1e4bcea

View File

@@ -427,26 +427,69 @@ const URL_PATTERN = new RegExp(
const addForm = ref({ const addForm = ref({
name: '', name: '',
enable: true, enable: true, // 默认启用
ssidList: [], ssidList: [],
authType: 4, // 固定为外部 Portal 认证 authType: 4, // 固定为外部 Portal 认证
authTimeout: { authTimeout: {
customTimeout: 8, customTimeout: 8, // 默认超时时间
customTimeoutUnit: 2 customTimeoutUnit: 2 // 默认单位为小时
}, },
noAuth: { noAuth: {
dailyLimitEnable: false dailyLimitEnable: false // 默认不启用每日限额
}, },
httpsRedirectEnable: false, httpsRedirectEnable: false, // 默认不启用 HTTPS 重定向
landingPage: 1, landingPage: 1, // 默认登录页面
pageType: 2, pageType: 2, // 默认页面类型
importedPortalPage: { importedPortalPage: {
id: 'test' id: 'test' // 默认导入的门户页面 ID
}, },
externalPortal: { externalPortal: {
hostType: 2, hostType: 2, // 默认外部 Portal 服务器类型
serverUrl: '', serverUrl: '', // 默认服务器 URL
serverUrlScheme: 'http' 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 hide = message.loading(t('common.loading'), 0);
// 创建一个新对象来存储要提交的数据 // 创建一个新对象来存储要提交的数据
const submitData = { ...addForm.value }; const submitData = {
...addForm.value,
// 设置默认参数 // 这里可以直接使用默认值
submitData.authTimeout = { authType: 4, // 固定为外部 Portal 认证
authTimeout: {
customTimeout: 8, customTimeout: 8,
customTimeoutUnit: 2 customTimeoutUnit: 2
}; },
submitData.externalPortal = { noAuth: {
dailyLimitEnable: false
},
httpsRedirectEnable: false,
landingPage: 1,
pageType: 2,
importedPortalPage: {
id: 'test'
},
externalPortal: {
hostType: 2, hostType: 2,
serverUrl: submitData.externalPortal.serverUrl, serverUrl: addForm.value.externalPortal.serverUrl, // 确保从 addForm 中获取 serverUrl
serverUrlScheme: submitData.externalPortal.serverUrlScheme 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); const { error } = await addPortal(selectedSiteId.value, submitData);
@@ -563,23 +660,66 @@ const editVisible = ref(false);
const editFormRef = ref(); const editFormRef = ref();
const editForm = ref({ const editForm = ref({
name: '', name: '',
enable: true, enable: true, // 默认启用
ssidList: [], ssidList: [],
authType: 4, // 固定为外部 Portal 认证 authType: 4, // 固定为外部 Portal 认证
authTimeout: { authTimeout: {
customTimeout: 8, customTimeout: 8, // 默认超时时间
customTimeoutUnit: 2 customTimeoutUnit: 2 // 默认单位为小时
}, },
httpsRedirectEnable: false, httpsRedirectEnable: false, // 默认不启用 HTTPS 重定向
landingPage: 1, landingPage: 1, // 默认登录页面
pageType: 2, pageType: 2, // 默认页面类型
importedPortalPage: { importedPortalPage: {
id: 'test' id: 'test' // 默认导入的门户页面 ID
}, },
externalPortal: { externalPortal: {
hostType: 2, hostType: 2, // 默认外部 Portal 服务器类型
serverUrl: '', serverUrl: '', // 默认服务器 URL
serverUrlScheme: 'http' 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, hostType: 2,
serverUrl: editForm.value.externalPortal.serverUrl, serverUrl: editForm.value.externalPortal.serverUrl,
serverUrlScheme: editForm.value.externalPortal.serverUrlScheme 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
}
} }
}; };