fix(frontend): 完善表单校验并添加错误提示

- UserEditModal: 添加 email 必填和 concurrency 最小值校验
- UserAttributesConfigModal: 添加 key/name 必填和 options 非空校验
- GroupsView: 添加 name 必填校验
- ProxiesView: 添加 name/host 必填和 port 范围校验
- UserBalanceModal: 添加 amount 有效性和余额充足性校验
- RedeemView: 添加空兑换码错误提示
- i18n: 添加所有新增校验的中英文翻译
This commit is contained in:
ianshaw
2026-01-04 20:22:59 -08:00
parent 960c09cdce
commit 85f53ef2dd
8 changed files with 92 additions and 6 deletions

View File

@@ -871,6 +871,10 @@ const closeCreateModal = () => {
}
const handleCreateGroup = async () => {
if (!createForm.name.trim()) {
appStore.showError(t('admin.groups.nameRequired'))
return
}
submitting.value = true
try {
await adminAPI.groups.create(createForm)
@@ -912,6 +916,10 @@ const closeEditModal = () => {
const handleUpdateGroup = async () => {
if (!editingGroup.value) return
if (!editForm.name.trim()) {
appStore.showError(t('admin.groups.nameRequired'))
return
}
submitting.value = true
try {

View File

@@ -887,6 +887,18 @@ const handleBatchCreate = async () => {
}
const handleCreateProxy = async () => {
if (!createForm.name.trim()) {
appStore.showError(t('admin.proxies.nameRequired'))
return
}
if (!createForm.host.trim()) {
appStore.showError(t('admin.proxies.hostRequired'))
return
}
if (createForm.port < 1 || createForm.port > 65535) {
appStore.showError(t('admin.proxies.portInvalid'))
return
}
submitting.value = true
try {
await adminAPI.proxies.create({
@@ -927,6 +939,18 @@ const closeEditModal = () => {
const handleUpdateProxy = async () => {
if (!editingProxy.value) return
if (!editForm.name.trim()) {
appStore.showError(t('admin.proxies.nameRequired'))
return
}
if (!editForm.host.trim()) {
appStore.showError(t('admin.proxies.hostRequired'))
return
}
if (editForm.port < 1 || editForm.port > 65535) {
appStore.showError(t('admin.proxies.portInvalid'))
return
}
submitting.value = true
try {