|
|
|
@ -61,20 +61,9 @@
|
|
|
|
|
<div v-for="item in schoolSubject" style="display: flex;">
|
|
|
|
|
<span style="width:50px">{{ item.name }}:</span>
|
|
|
|
|
<el-checkbox-group style="width:100%" v-model="ruleForm.discipline" >
|
|
|
|
|
<el-checkbox style="margin-right:10px" v-for="el in item.children" :key="el.id" :label="el.itemtitle" :value="el.id" />
|
|
|
|
|
<el-checkbox style="margin-right:10px" v-for="el in item.children" :key="el.id" :label="el.itemtitle" :value="el" />
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <el-checkbox-group v-model="ruleForm.discipline">
|
|
|
|
|
<el-checkbox v-for="(item,index) in schoolSubject" :label="item.itemtitle" :key="index" :value="item.itemtitle" />
|
|
|
|
|
</el-checkbox-group> -->
|
|
|
|
|
<!-- <el-checkbox-group v-model="ruleForm.discipline">
|
|
|
|
|
<el-checkbox value="Online activities" name="type">
|
|
|
|
|
语文
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
<el-checkbox value="Promotion activities" name="type">
|
|
|
|
|
数学
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group> -->
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="activeIndex==1">
|
|
|
|
|
<div class="centerDiv">
|
|
|
|
@ -124,7 +113,6 @@ import {captchaImg,sendCode,deptTree,getDept,listClassmain,listEvaluation,signIn
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
import {setToken, removeToken } from '@/utils/auth'
|
|
|
|
|
import { regionData, codeToText } from 'element-china-area-data'
|
|
|
|
|
import array from 'lodash/array'
|
|
|
|
|
const ruleFormRef = ref(null)
|
|
|
|
|
const activeIndex=ref(1)
|
|
|
|
|
const ruleForm = reactive({
|
|
|
|
@ -180,7 +168,23 @@ const rules = reactive({
|
|
|
|
|
],
|
|
|
|
|
idNumber: [
|
|
|
|
|
{ required: true, message: '身份证号码是必填项', trigger: 'blur' },
|
|
|
|
|
{ pattern: /^\d{17}[\dX]$/, message: '身份证号码格式不正确', trigger: 'blur' },
|
|
|
|
|
{
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 正则表达式同时支持15位和18位身份证号码
|
|
|
|
|
const pattern = /^(?:\d{15}|\d{17}[\dX])$/;
|
|
|
|
|
const valid = pattern.test(value);
|
|
|
|
|
if (!valid) {
|
|
|
|
|
callback(new Error('身份证号码格式不正确'));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
password: [
|
|
|
|
|
{ required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
|
@ -228,6 +232,7 @@ const OpenModel = () =>{
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
const handleClose = () => {
|
|
|
|
|
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
|
|
|
|
removeToken();
|
|
|
|
|
activeIndex.value=1
|
|
|
|
|
dialogVisible.value=false
|
|
|
|
|
}
|
|
|
|
@ -275,11 +280,12 @@ const getSubject = async ()=>{
|
|
|
|
|
allSubjectList.value = rows.data
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitForm = async (formEl) => {
|
|
|
|
|
if (!formEl) return
|
|
|
|
|
await formEl.validate((valid, fields) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
console.log(ruleForm)
|
|
|
|
|
var araname = codeToText[ruleForm.address[0]] + '-' + codeToText[ruleForm.address[1]] + '-' + codeToText[ruleForm.address[2]];
|
|
|
|
|
var form={
|
|
|
|
|
mobile:ruleForm.phoneNumber,
|
|
|
|
|
code:ruleForm.Code,
|
|
|
|
@ -287,16 +293,18 @@ const submitForm = async (formEl) => {
|
|
|
|
|
idCard:ruleForm.idNumber,
|
|
|
|
|
password:ruleForm.password,
|
|
|
|
|
confirmPassword:ruleForm.confirmPassword,
|
|
|
|
|
schoolId:ruleForm.school.join(','),
|
|
|
|
|
schoolId:ruleForm.school[2],
|
|
|
|
|
classIds:ruleForm.class.join(','),
|
|
|
|
|
subjectIds:ruleForm.discipline.join(','),
|
|
|
|
|
area:ruleForm.address.join(','),
|
|
|
|
|
subjectIds:ruleForm.discipline.map(o=>o.id).join(','),
|
|
|
|
|
subject:ruleForm.discipline.map(o=>o.itemtitle).join(','),
|
|
|
|
|
areaIds:ruleForm.address.join(','),
|
|
|
|
|
area:araname
|
|
|
|
|
}
|
|
|
|
|
signIn(form).then(res=>{
|
|
|
|
|
if(res.code==200){
|
|
|
|
|
ElMessage.success('注册成功')
|
|
|
|
|
ElMessage.success('您已注册成功,等待学校管理员审核')
|
|
|
|
|
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
|
|
|
|
ruleForm={
|
|
|
|
|
var restValue={
|
|
|
|
|
name: '',
|
|
|
|
|
idNumber:'',
|
|
|
|
|
phoneNumber: '',
|
|
|
|
@ -307,6 +315,7 @@ const submitForm = async (formEl) => {
|
|
|
|
|
discipline:[],
|
|
|
|
|
school:[],
|
|
|
|
|
}
|
|
|
|
|
Object.assign(ruleForm, restValue);
|
|
|
|
|
activeIndex.value=1
|
|
|
|
|
dialogVisible.value=false
|
|
|
|
|
}else{
|
|
|
|
@ -436,7 +445,7 @@ const gradeName = (key) =>{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onMounted(()=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
defineExpose({
|
|
|
|
|
OpenModel,
|
|
|
|
|