zdg #184

Merged
zhangxuelin merged 9 commits from zdg into main 2024-09-10 16:16:46 +08:00
3 changed files with 35 additions and 25 deletions
Showing only changes of commit bbe4037a71 - Show all commits

View File

@ -24,8 +24,8 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/dev-api': { '/dev-api': {
// target: 'http://27.128.240.72:7865', target: 'http://27.128.240.72:7865',
target: 'http://192.168.2.158:7865', // target: 'http://192.168.2.158:7865', //郑德刚本地
// target: 'http://192.168.2.52:7863', // target: 'http://192.168.2.52:7863',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')

View File

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

View File

@ -32,8 +32,9 @@
> >
</el-form-item> </el-form-item>
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;"> <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-right: 10px;" @click="RegisterModel">注册账号</a>
<a style="margin-left: 10px;">忘记密码</a> <!-- | -->
<!-- <a style="margin-left: 10px;">忘记密码</a> -->
</div> </div>
</el-form> </el-form>
</div> </div>