注册账号
This commit is contained in:
parent
c79e7966ee
commit
bbe4037a71
|
@ -24,8 +24,8 @@ export default defineConfig({
|
|||
server: {
|
||||
proxy: {
|
||||
'/dev-api': {
|
||||
// target: 'http://27.128.240.72:7865',
|
||||
target: 'http://192.168.2.158:7865',
|
||||
target: 'http://27.128.240.72:7865',
|
||||
// target: 'http://192.168.2.158:7865', //郑德刚本地
|
||||
// target: 'http://192.168.2.52:7863',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
>
|
||||
</el-form-item>
|
||||
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
||||
<a style="margin-right: 10px;" @click="RegisterModel">注册账号</a> |
|
||||
<a style="margin-left: 10px;">忘记密码</a>
|
||||
<a style="margin-right: 10px;" @click="RegisterModel">注册账号</a>
|
||||
<!-- | -->
|
||||
<!-- <a style="margin-left: 10px;">忘记密码</a> -->
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue