修改外校老师留后门
This commit is contained in:
parent
fa6c669b86
commit
9ed1e5e554
|
@ -57,16 +57,6 @@
|
|||
</template>
|
||||
|
||||
</van-field>
|
||||
|
||||
|
||||
<!-- <van-field-->
|
||||
<!-- v-model="notLocalTeacher.identityId"-->
|
||||
<!-- name="userCardId"-->
|
||||
<!-- label="身份证号"-->
|
||||
<!-- type="text"-->
|
||||
<!-- placeholder="请输入身份证号"-->
|
||||
<!-- :rules="[{ validator:userCardId, message: '请输入身份证号' }]"-->
|
||||
<!-- />-->
|
||||
<van-field
|
||||
v-model="notLocalTeacher.phone"
|
||||
name="phone"
|
||||
|
@ -92,7 +82,7 @@
|
|||
label="职称"
|
||||
placeholder="点击选择职称"
|
||||
@click="showPicker = true"
|
||||
:rules="[{ required: true, message: '请选择职称' }]"
|
||||
:rules="[{ validator: (value) => notLocalTeacher.identityId?.trim() === '0000000' ? true : !!value, message: '请选择职称' }]"
|
||||
>
|
||||
<template #left-icon>
|
||||
<img
|
||||
|
@ -112,7 +102,7 @@
|
|||
label="职务"
|
||||
type="text"
|
||||
placeholder="请输入职务(如教师,教务主任)"
|
||||
:rules="[{ required: true, message: '请输入职务' }]"
|
||||
:rules="[{ validator: (value) => notLocalTeacher.identityId?.trim() === '0000000' ? true : !!value, message: '请输入职务' }]"
|
||||
>
|
||||
<template #left-icon>
|
||||
<img
|
||||
|
@ -134,7 +124,7 @@
|
|||
label="单位名称"
|
||||
type="text"
|
||||
placeholder="请输入单位名称"
|
||||
:rules="[{ required: true, message: '请输入单位名称' }]"
|
||||
:rules="[{ validator: (value) => notLocalTeacher.identityId?.trim() === '0000000' ? true : !!value, message: '请输入单位名称' }]"
|
||||
>
|
||||
|
||||
<template #left-icon>
|
||||
|
@ -202,8 +192,12 @@
|
|||
|
||||
// 校验表单
|
||||
const userName = (value: any) => {
|
||||
const reg = /^.{2,12}$/;
|
||||
return reg.test(value);
|
||||
if(notLocalTeacher.identityId?.trim() === '0000000'){
|
||||
return true;
|
||||
}else{
|
||||
const reg = /^.{2,12}$/;
|
||||
return reg.test(value);
|
||||
}
|
||||
};
|
||||
const jobTitleTest = (value: any) => {
|
||||
if (value.length > 0) {
|
||||
|
@ -211,16 +205,6 @@
|
|||
}
|
||||
return true;
|
||||
};
|
||||
// 身份证验证
|
||||
// const userCardId = (value: any) => {
|
||||
// const reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
||||
// let birthday = value.substring(6, 10) + "-" + value.substring(10, 12) + "-" + value.substring(12, 14)
|
||||
// let age = calculateAge(birthday);
|
||||
// notLocalTeacher.age=age
|
||||
// notLocalTeacher.sex=getSex(value)
|
||||
// return reg.test(value);
|
||||
// };
|
||||
|
||||
// 计算年龄的函数
|
||||
function calculateAge(birthday: string) {
|
||||
const today = new Date();
|
||||
|
@ -242,6 +226,10 @@
|
|||
*/
|
||||
function userCardId(value) {
|
||||
let psidno = String(value);
|
||||
// 如果是7个0,则跳过验证
|
||||
if (psidno === '0000000') {
|
||||
return true; // 或者根据业务需求返回特定值
|
||||
}
|
||||
psidno = psidno.toUpperCase();
|
||||
// 1.校验身份证号格式和长度
|
||||
const regPsidno =
|
||||
|
@ -398,8 +386,12 @@
|
|||
}
|
||||
|
||||
const phoneNum = (value: string) => {
|
||||
const reg = /^.{11}$/;
|
||||
return reg.test(value);
|
||||
if(notLocalTeacher.identityId?.trim() === '0000000'){
|
||||
return true;
|
||||
}else{
|
||||
const reg = /^.{11}$/;
|
||||
return reg.test(value);
|
||||
}
|
||||
};
|
||||
const onConfirm = ({ selectedOptions }) => {
|
||||
notLocalTeacher.jobTitle = selectedOptions[0]?.text;
|
||||
|
@ -410,8 +402,30 @@
|
|||
notLocalTeacher.sex = selectedOptions[0]?.text;
|
||||
showSex.value = false;
|
||||
};
|
||||
//const onSubmit = (values: object) => {
|
||||
// console.log('submit', values);
|
||||
// localStorage.setItem('notLocalTeacher', JSON.stringify(notLocalTeacher));
|
||||
// router.push('/waiTeacherTwo');
|
||||
//};
|
||||
const onSubmit = (values: object) => {
|
||||
console.log('submit', values);
|
||||
// 检查身份证是否为7个0
|
||||
const isSpecialId = notLocalTeacher.identityId?.trim() === '0000000';
|
||||
console.log(isSpecialId)
|
||||
if (isSpecialId) {
|
||||
// 身份证为7个0,跳过所有验证直接提交
|
||||
handleSubmit();
|
||||
} else {
|
||||
// 正常验证流程
|
||||
notLocalTeacher.value?.validate().then(() => {
|
||||
handleSubmit();
|
||||
}).catch((error) => {
|
||||
console.log('表单验证失败', error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
console.log('提交数据', notLocalTeacher);
|
||||
localStorage.setItem('notLocalTeacher', JSON.stringify(notLocalTeacher));
|
||||
router.push('/waiTeacherTwo');
|
||||
};
|
||||
|
|
|
@ -498,6 +498,9 @@
|
|||
|
||||
// 动态规则,根据 isValidationEnabled 来控制规则
|
||||
const rules = computed(() => {
|
||||
if(notLocalTeacherTwo.identityId?.trim() === '0000000'){
|
||||
isValidationEnabled.value = false;
|
||||
}
|
||||
if (isValidationEnabled.value) {
|
||||
return [{ validator: bankCard }];
|
||||
}
|
||||
|
@ -567,23 +570,31 @@
|
|||
// 校验规则
|
||||
|
||||
const bankAddr = (value: string) => {
|
||||
if (value == '---') {
|
||||
if(notLocalTeacherTwo.identityId?.trim() === '0000000'){
|
||||
return true;
|
||||
}else{
|
||||
if (value == '---') {
|
||||
return true;
|
||||
}
|
||||
if (value.length < 1) {
|
||||
return '开户所在地不能为空';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (value.length < 1) {
|
||||
return '开户所在地不能为空';
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const bankName = (value: string) => {
|
||||
if (value == '---') {
|
||||
if(notLocalTeacherTwo.identityId?.trim() === '0000000'){
|
||||
return true;
|
||||
}else{
|
||||
if (value == '---') {
|
||||
return true;
|
||||
}
|
||||
if (value.length < 1) {
|
||||
return '开户行不能为空';
|
||||
}
|
||||
if (value.length < 1) {
|
||||
return '开户行不能为空';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const bankCard = (value: string) => {
|
||||
// if (value.length < 16) {
|
||||
|
@ -636,7 +647,6 @@
|
|||
'*' +
|
||||
notLocalTeacherTwo.userName.substring(notLocalTeacherTwo.userName.length - 1, notLocalTeacherTwo.userName.length);
|
||||
}
|
||||
|
||||
//notLocalTeacherTwo.identityId这个18位身份证号 第七位到14位*
|
||||
tid.value = notLocalTeacherTwo.identityId.substring(0, 5) + '****' + notLocalTeacherTwo.identityId.substring(13, 18);
|
||||
tphone.value = notLocalTeacherTwo.phone.substring(0, 3) + '****' + notLocalTeacherTwo.phone.substring(7, 11);
|
||||
|
@ -649,31 +659,28 @@
|
|||
let myObj = {};
|
||||
// 信息提交到后台
|
||||
const onSubmit = (values: object) => {
|
||||
// console.log('submit', {...values,...storedData});
|
||||
// alert({...values,...storedData}.toString())
|
||||
// 检查身份证是否为7个0
|
||||
const isSpecialId = notLocalTeacherTwo.identityId?.trim() === '0000000';
|
||||
if (isSpecialId) {
|
||||
// 身份证为7个0,跳过所有验证直接处理提交
|
||||
myShowDialog.value = true;
|
||||
console.log("storedData",storedData)
|
||||
console.log("storedData", storedData);
|
||||
myObj = { ...values, ...storedData };
|
||||
//存在加密--直接修改要提交后端的值
|
||||
myObj.pyCard = notLocalTeacherTwo.pyCard;
|
||||
console.log("myObj", myObj)
|
||||
console.log("myObj", myObj);
|
||||
return;
|
||||
// waiTApi.save({...values,...storedData}).then(res => {
|
||||
// console.log(res)
|
||||
// if (res.data.code == 500){
|
||||
// alert(res.data.msg)
|
||||
// return
|
||||
// }
|
||||
// if (res.data.code == 200) {
|
||||
// alert("提交成功")
|
||||
// console.log(res.data)
|
||||
// store.login(res.data.user)
|
||||
// localStorage.removeItem("notLocalTeacher")
|
||||
// router.push(res.data.router)
|
||||
// }
|
||||
// }, err => {
|
||||
// console.log(err)
|
||||
// })
|
||||
} else {
|
||||
// 正常验证流程
|
||||
notLocalTeacherTwo.value?.validate().then(() => {
|
||||
myShowDialog.value = true;
|
||||
console.log("storedData", storedData);
|
||||
myObj = { ...values, ...storedData };
|
||||
myObj.pyCard = notLocalTeacherTwo.pyCard;
|
||||
console.log("myObj", myObj);
|
||||
}).catch((error) => {
|
||||
console.log('表单验证失败', error);
|
||||
});
|
||||
}
|
||||
};
|
||||
const confirm = () => {
|
||||
waiTeacherSave(myObj).then(
|
||||
|
|
Loading…
Reference in New Issue