讲师管理bug

This commit is contained in:
zhangsir
2024-12-21 16:13:30 +08:00
parent ceb9c0cf59
commit 9de8eb61d8
11 changed files with 102 additions and 26 deletions

View File

@@ -142,7 +142,7 @@
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="手机号码" name="mobile" prop="mobile">
<a-input v-model:value.trim="formParam.mobile" class="draitem"
<a-input type="number" v-model:value.trim="formParam.mobile" class="draitem"
placeholder="请输入手机号码" allowClear showSearch :maxLength="11" @blur="sendPhone">
</a-input>
</a-form-item>
@@ -316,6 +316,8 @@ export default {
const router = useRouter();
const userInfo = computed(() => store.state.userInfo);
const state = reactive({
phoneEmil: 0,
phoneEmilTwo: 0,
lookExternalVisi:false,
lookExterId: null,
currentPage1: 1,
@@ -527,6 +529,8 @@ export default {
// 新增讲师
const addTeacher = () => {
cancel()
state.phoneEmil = 0
state.phoneEmilTwo = 0
state.teacherdialog = true;
state.teacherdialogtitle = '新增讲师'
// state.formParam.photo =userInfo.value?.avatar
@@ -538,6 +542,8 @@ export default {
//修改讲师信息弹窗
const handleModify = (record) => {
state.phoneEmil = 0
state.phoneEmilTwo = 0
state.teacherdialog = true;
state.teacherdialogtitle = '编辑讲师'
state.id = record.id
@@ -566,6 +572,14 @@ export default {
return message.error(rules[formItemNames[i]][0].log)
}
}
if(state.phoneEmil){
message.destroy()
return message.warning( '手机号格式不正确')
}
if(state.phoneEmilTwo){
message.destroy()
return message.warning( '邮箱格式不正确')
}
state.formParam.description = repl(state.formParam.description)
state.formParam = {...state.formParam}
if (state.vf == false) {
@@ -745,24 +759,28 @@ export default {
state.formParam.name = state.formParam?.name?.replace(/\s/g, '');
}
const sendPhone=()=>{
state.phoneEmil = 0
console.log(state.formParam.mobile)
const reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if (!state.formParam.mobile) {
} else if (!reg.test(state.formParam.mobile)) {
message.warning( '手机号格式不正确')
state.formParam.mobile=''
// state.formParam.mobile=''
state.phoneEmil = 1
// state.formParam.mobile = state.formParam.mobile.replace(/\D/g, '');
}
}
const sendEmail=()=>{
state.phoneEmilTwo = 0
const reg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.\w{2,}$/;
if(!state.formParam.email){
return
}
if (!reg.test(state.formParam.email)) {
message.warning( '邮箱格式不正确')
state.formParam.email=''
// state.formParam.email=''
state.phoneEmilTwo = 2
// state.formParam.email = state.formParam.email.replace( /[\u4e00-\u9fa5]/g, '');
}
}