diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 081aaf4..8536e9a 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -791,6 +791,58 @@ const local: any = { editSsid:'Edit ssid', updateSuccess:'Update success', }, + portal: { + title: 'Portal management', + name: 'Name', + selectSite:'no site', + authType: 'Authentication Type', + auth: { + none: 'No Authentication', + simplePassword: 'Simple password', + externalRadius: 'RADIUS server', + externalPortal: 'External Portal server', + hotspot: 'Hotspot', + ldap: 'LDAP' + }, + addPortal: 'Add Portal', + enable: 'Enable', + ssid: 'SSID', + selectSsid: 'Please select SSID', + authTimeout: 'Authentication Timeout', + dailyLimit: 'Daily Limit', + enableDailyLimit: 'Enable', + httpsRedirect: 'HTTPS Redirection', + enableHttpsRedirect: 'Enable', + landingPage: 'Landing Page', + landingUrl: 'URL', + enterUrl: 'Please enter URL', + nameRequired: 'Please enter portal name', + ssidRequired: 'Please select SSID', + urlRequired: 'Please enter URL', + addSuccess: 'Add Success', + addError: 'Add Error', + total:'Total', + updateSuccess:'Update success', + editPortal:'Edit Portal', + timeUnit: { + min: 'Min', + hour: 'Hour', + day: 'Day' + }, + landing: { + originalUrl: 'The Original URL', + promotionUrl: 'The Promotional URL', + logoutPage: 'The Success Page' + }, + externalPortal: 'External Portal server', + ipAddress: 'IP Address', + url: 'URL', + ipRequired: 'Please enter IP', + invalidUrl: 'The URL is not formatted correctly', + confirmDelete: 'Confirm Delete', + deleteConfirmContent: 'Sure to delete portal {name} ?', + deleteSuccess: 'Delete success' + }, terminal:{ title:'Terminal', total:'Total', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 305a1dc..e664eac 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -736,7 +736,7 @@ const local:any = { forgetConfirm:'确认要移除设备吗?', restartConfirm:'确认要重启设备吗?', led:'LED', - useSiteSettings:'站点设置', + useSiteSettings:'使用站点设置', on:'打开', off:'关闭', longitude:'经度(可选)', @@ -758,6 +758,92 @@ const local:any = { configError:'配置失败', }, + wlan:{ + title:'无线网络', + selectSite:'无站点', + selectGroup:'无网络组', + total:'共', + name:'SSid名称', + security:'安全性', + none:'无', + wpaEnterprise:'WPA-Enterprise', + wpaPersonal:'WPA-Personal', + ppskWithoutRadius:'PPSK without RADIUS', + ppskWithRadius:'PPSK with RADIUS', + band:'频段', + guestNetwork:'访客网络', + enable:'开启', + disable:'关闭', + deviceType:'设备类型', + broadcast:'广播', + vlan:'VLAN', + addSsid:'Ssid配置', + open:'开启', + vlanId:'VLAN ID', + default:'默认', + custom:'定制', + nameRequired:'名称不能为空', + nameLength:'名称长度1~32字符', + vlanIdRequired:'VLAN ID不能为空', + addSuccess:'添加成功', + confirmDelete:'删除设备', + deleteConfirmContent:'确认要删除设备吗', + deleteSuccess:'删除成功', + editSsid:'修改配置', + updateSuccess:'修改成功', + }, + portal: { + title: '门户管理', + name: '名称', + selectSite:'无站点', + authType: '身份验证类型', + auth: { + none: '无认证', + simplePassword: '简单密码', + externalRadius: '外部 Radius 服务器', + externalPortal: '外部 Portal 服务器', + hotspot: '热点', + ldap: 'LDAP 格式' + }, + addPortal: '添加门户', + enable: '启用', + ssid: 'SSID', + selectSsid: '请选择SSID', + authTimeout: '身份验证时间', + dailyLimit: '每日限额', + enableDailyLimit: '启用每日限额', + httpsRedirect: 'HTTPS 重定向', + enableHttpsRedirect: '启用 HTTPS 重定向', + landingPage: '登录页面', + landingUrl: '促销 URL', + enterUrl: '请输入 URL', + nameRequired: '请输入门户名称', + ssidRequired: '请选择 SSID', + urlRequired: '请输入 URL', + addSuccess: '添加成功', + addError: '添加失败', + total:'共', + updateSuccess:'更新成功', + editPortal:'修改配置', + timeUnit: { + min: '分钟', + hour: '小时', + day: '天' + }, + landing: { + originalUrl: '重定向到原始 URL', + promotionUrl: '重定向到促销 URL', + logoutPage: '重定向到注销页面' + }, + externalPortal: '自定义 Portal 服务器', + ipAddress: 'IP地址', + url: 'URL', + ipRequired: '请输入IP地址', + invalidUrl: 'URL 格式不正确', + confirmDelete: '确认删除', + deleteConfirmContent: '确定要删除门户 {name} 吗?', + deleteSuccess: '删除成功' + }, terminal:{ title:'终端设备', total:'共', diff --git a/src/service/api/auth.ts b/src/service/api/auth.ts index 1c371f6..efdbee3 100644 --- a/src/service/api/auth.ts +++ b/src/service/api/auth.ts @@ -348,6 +348,59 @@ export function updateWlanSsid(siteId: string, wlanId: string, ssidId: string, p data: params }); } +/** 获取门户列表 */ +export function fetchPortalList(siteId: string, params: { pageNum: number; pageSize: number }) { + return request({ + url: `/system/portal/${siteId}`, + method: 'get', + params: { + pageNum: params.pageNum, + pageSize: params.pageSize + } + }); +} +/** 获取 SSID 列表 */ +export function fetchSsidList(siteId: string) { + return request({ + url: `/system/wlan/ssids/${siteId}`, + method: 'get' + }); +} + +/** 添加门户 */ +export function addPortal(siteId: string, params: Api.Portal.AddPortalParams) { + return request({ + url: `/system/portal/${siteId}`, + method: 'post', + data: params + }); +} +/** 获取门户配置 */ +export function getPortalConfig(siteId: string, portalId: string) { + return request({ + url: `/system/portal/${siteId}/${portalId}`, + method: 'get' + }); +} + +/** 更新门户配置 */ +export function updatePortalConfig(siteId: string, portalId: string, params: Api.Portal.AddPortalParams) { + return request({ + url: `/system/portal/${siteId}/${portalId}`, + method: 'put', + data: params + }); +} +/** 删除门户 */ +export function deletePortal(siteId: string, portalId: string) { + return request({ + url: `/system/portal/${siteId}/${portalId}`, + method: 'delete' + }); +} + + + diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 02f13b5..b50bc19 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -807,8 +807,8 @@ declare namespace Api { namespace Wlan { interface WlanGroup { wlanId: string; - name: string; - primary: boolean; + wlanName: string; + ssidList: SsidInfo[]; } type WlanGroupResponse = App.Service.ApiResponse; @@ -876,6 +876,91 @@ declare namespace Api { vlanId?: number; } } + namespace Portal { + interface Portal { + id: string; + name: string; + enable: boolean; + ssidNames: string[]; + ssidList: string[]; + networkList: string[]; + authType: number; + hotspotTypes: any; + } + + + interface PortalResponse extends App.Service.ApiResponse<{ + rows: Portal[]; + total: number; + }> {} + } + namespace Portal { + // 先定义基础类型 + interface SsidInfo { + ssidId: string; + ssidName: string; + } + + interface WlanGroup { + wlanId: string; + wlanName: string; + ssidList: SsidInfo[]; + } + interface Portal { + id: string; + name: string; + enable: boolean; + ssidNames: string[]; + ssidList: string[]; + networkList: string[]; + authType: number; + hotspotTypes: any; + } + + + interface PortalResponse extends App.Service.ApiResponse<{ + rows: Portal[]; + total: number; + }> {} + + + interface SsidListResponse extends App.Service.ApiResponse {} + + interface AuthTimeout { + customTimeout: number; + customTimeoutUnit: 1 | 2 | 3; // 1:分钟 2:小时 3:天 + } + + interface NoAuth { + dailyLimitEnable: boolean; + } + interface ExternalPortal { + hostType: 1 | 2; // 1: IP地址 2: URL + serverUrl: string; // IP地址或URL值 + serverUrlScheme?: string; // URL时的协议类型 + } + + interface ImportedPortalPage { + id: string; + } + + interface AddPortalParams { + name: string; + enable: boolean; + ssidList: string[]; + authType: number; + authTimeout: AuthTimeout; + noAuth: NoAuth; + httpsRedirectEnable: boolean; + landingPage: 1 | 2 | 3; + landingUrlScheme?: string; + landingUrl?: string; + externalPortal?: ExternalPortal; // 添加外部Portal配置 + pageType: number; + importedPortalPage: ImportedPortalPage; + + } + } } declare namespace App { diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts index 3297b01..2969bc8 100644 --- a/src/typings/auto-imports.d.ts +++ b/src/typings/auto-imports.d.ts @@ -14,6 +14,7 @@ declare global { const addData: typeof import('../service/api/dictData')['addData'] const addJob: typeof import('../service/api/job')['addJob'] const addPackage: typeof import('../service/api/auth')['addPackage'] + const addPortal: typeof import('../service/api/auth')['addPortal'] const addRateLimit: typeof import('../service/api/auth')['addRateLimit'] const addThemeVarsToHtml: typeof import('../store/modules/theme/shared')['addThemeVarsToHtml'] const addWlanSsid: typeof import('../service/api/auth')['addWlanSsid'] @@ -66,6 +67,7 @@ declare global { const delJobLog: typeof import('../service/api/job')['delJobLog'] const deleteApDevices: typeof import('../service/api/auth')['deleteApDevices'] const deletePackage: typeof import('../service/api/auth')['deletePackage'] + const deletePortal: typeof import('../service/api/auth')['deletePortal'] const deleteWlanSsid: typeof import('../service/api/auth')['deleteWlanSsid'] const describe: typeof import('vitest')['describe'] const dict: typeof import('../store/modules/dict/index')['default'] @@ -142,10 +144,12 @@ declare global { const fetchKycList: typeof import('../service/api/auth')['fetchKycList'] const fetchLogin: typeof import('../service/api/auth')['fetchLogin'] const fetchPackageList: typeof import('../service/api/auth')['fetchPackageList'] + const fetchPortalList: typeof import('../service/api/auth')['fetchPortalList'] const fetchRateLimitList: typeof import('../service/api/auth')['fetchRateLimitList'] const fetchRefreshToken: typeof import('../service/api/auth')['fetchRefreshToken'] const fetchRegister: typeof import('../service/api/auth')['fetchRegister'] const fetchSiteList: typeof import('../service/api/auth')['fetchSiteList'] + const fetchSsidList: typeof import('../service/api/auth')['fetchSsidList'] const fetchTerminalList: typeof import('../service/api/auth')['fetchTerminalList'] const fetchWlanGroups: typeof import('../service/api/auth')['fetchWlanGroups'] const fetchWlanSsidList: typeof import('../service/api/auth')['fetchWlanSsidList'] @@ -175,6 +179,7 @@ declare global { const getFixedTabs: typeof import('../store/modules/tab/shared')['getFixedTabs'] const getGlobalMenusByAuthRoutes: typeof import('../store/modules/route/shared')['getGlobalMenusByAuthRoutes'] const getLocalizedTimeUnit: typeof import('../utils/units')['getLocalizedTimeUnit'] + const getPortalConfig: typeof import('../service/api/auth')['getPortalConfig'] const getRouteIcons: typeof import('../store/modules/tab/shared')['getRouteIcons'] const getSelectedMenuKeyPathByKey: typeof import('../store/modules/route/shared')['getSelectedMenuKeyPathByKey'] const getServiceBaseURL: typeof import('../utils/service')['getServiceBaseURL'] @@ -299,6 +304,7 @@ declare global { const updateJob: typeof import('../service/api/job')['updateJob'] const updateLocaleOfGlobalMenus: typeof import('../store/modules/route/shared')['updateLocaleOfGlobalMenus'] const updatePackage: typeof import('../service/api/auth')['updatePackage'] + const updatePortalConfig: typeof import('../service/api/auth')['updatePortalConfig'] const updateTabByI18nKey: typeof import('../store/modules/tab/shared')['updateTabByI18nKey'] const updateTabsByI18nKey: typeof import('../store/modules/tab/shared')['updateTabsByI18nKey'] const updateWlanSsid: typeof import('../service/api/auth')['updateWlanSsid'] diff --git a/src/views/device/portal/index.vue b/src/views/device/portal/index.vue index 803f1b7..cb43f9b 100644 --- a/src/views/device/portal/index.vue +++ b/src/views/device/portal/index.vue @@ -1,6 +1,669 @@ - + + + +