feat: 优化敏感词处理和更新拖拽题功能,提升用户体验

- 清理敏感词处理函数中的多余空行,提升代码整洁性。
- 在 HuangyanpeiPlace3 组件中引入拖拽题功能,增强互动性。
- 添加拖拽题的成功和错误提示逻辑,优化用户填写体验。
- 使用 useMemo 优化已访问展品的状态管理,提升性能。
This commit is contained in:
zhongyidian committed 2026-02-02 00:03:09 +08:00
1 parent 45dd648d21
commit 1dd8afcce7
2 files changed
+150 -33

No files matched your search

+9 -10
View File
@@ -19,10 +19,10 @@ const SENSITIVE_WORDS = [
*/
export function containsSensitiveWord(text: string): boolean {
if (!text) return false;
const normalizedText = text.toLowerCase().trim();
return SENSITIVE_WORDS.some((word) =>
return SENSITIVE_WORDS.some((word) =>
normalizedText.includes(word.toLowerCase())
);
}
@@ -34,14 +34,14 @@ export function containsSensitiveWord(text: string): boolean {
*/
export function filterSensitiveWords(text: string): string {
if (!text) return text;
let result = text;
SENSITIVE_WORDS.forEach((word) => {
const regex = new RegExp(word, "gi");
result = result.replace(regex, "*".repeat(word.length));
});
return result;
}
@@ -52,10 +52,9 @@ export function filterSensitiveWords(text: string): string {
*/
export function filterInput(input: string): string {
if (!input) return input;
// 先进行敏感词过滤
let filtered = filterSensitiveWords(input);
const filtered = filterSensitiveWords(input);
return filtered;
}