This commit is contained in:
18796357645 2025-06-08 11:53:45 +08:00
parent 8513b981c9
commit e055bbac40
2 changed files with 22 additions and 1 deletions

View File

@ -16,7 +16,7 @@
</div>
<div>
<el-button type="primary" @click="state.rechargeDialogVisible = true">充值</el-button>
<!-- <el-button type="success" @click="state.withdrawDialogVisible = true">提现</el-button>-->
<!-- <el-button type="success" @click="state.withdrawDialogVisible = true">提现</el-button>-->
</div>
</div>
</el-card>
@ -154,6 +154,7 @@ import type { FormInstance } from 'element-plus'
import { reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import { hasSensitiveWords } from '~/utils/utils'
const router = useRouter()
const formRef = ref<FormInstance>()
const state = reactive({
@ -193,6 +194,17 @@ const submitForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.validate((valid) => {
if (valid) {
//
const foundSensitiveWords = hasSensitiveWords().filter(word =>
state.userInfo.nickName.includes(word)
);
if (foundSensitiveWords.length > 0) {
ElMessage.error(`内容包含敏感词:${foundSensitiveWords.join('、')}`);
return;
}
frontRequest.put("/api/user/update", state.userInfo).then(res => {
ElMessage.success("修改成功")
router.push("/login")

View File

@ -86,3 +86,12 @@ export const getFrontList = () => {
]
return routes;
}
export const hasSensitiveWords = () => {
const sensitivePatterns = [
'暴力',
'政治',
'共产党',
'反共',
]
return sensitivePatterns;
}