bug
This commit is contained in:
parent
8513b981c9
commit
e055bbac40
@ -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")
|
||||
|
@ -86,3 +86,12 @@ export const getFrontList = () => {
|
||||
]
|
||||
return routes;
|
||||
}
|
||||
export const hasSensitiveWords = () => {
|
||||
const sensitivePatterns = [
|
||||
'暴力',
|
||||
'政治',
|
||||
'共产党',
|
||||
'反共',
|
||||
]
|
||||
return sensitivePatterns;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user