feat: 完成前端业务闭环与后端联调

This commit is contained in:
2026-08-24 23:37:56 +08:00
parent c59e36f933
commit 9ad572907b
175 changed files with 10711 additions and 1740 deletions
-12
View File
@@ -1,14 +1,5 @@
import { assertPlainPayload } from './request-normalizers.js'
export const FEEDBACK_TYPE_OPTIONS = Object.freeze([
Object.freeze({ value: 'bug', label: '功能问题' }),
Object.freeze({ value: 'advice', label: '使用建议' }),
Object.freeze({ value: 'complaint', label: '投诉反馈' }),
Object.freeze({ value: 'other', label: '其他' })
])
const feedbackTypes = new Set(FEEDBACK_TYPE_OPTIONS.map(({ value }) => value))
export const normalizeFeedbackPayload = (payload) => {
const allowedFields = new Set(['feedbackType', 'feedbackContent', 'contactInfo'])
assertPlainPayload(payload, allowedFields, '反馈请求')
@@ -23,9 +14,6 @@ export const normalizeFeedbackPayload = (payload) => {
}
const normalizedText = payload[optionalField].trim()
if (!normalizedText) continue
if (optionalField === 'feedbackType' && !feedbackTypes.has(normalizedText)) {
throw new TypeError('feedbackType 必须为 advice、bug、complaint 或 other')
}
normalizedPayload[optionalField] = normalizedText
}
return normalizedPayload