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