注册问题修改0315

main
xy 3 weeks ago
parent 1c4eccee74
commit 50aa26a040
  1. 62
      src/layout/loginPage.vue

@ -83,7 +83,7 @@
</div>
<div class="right">
<el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem"
v-model="formModel.clssid" />
v-model="formModel.clssid" @change="handleChange" />
</div>
</div>
</el-form-item>
@ -251,10 +251,10 @@
// import { onMounted, reactive, ref, toRefs, watch } from "vue";
import { ElMessage, ElMessageBox } from 'element-plus'
import settingStore from "@/store/modules/setting";
import { User, Lock, Avatar, Stamp,Grid,Iphone } from "@element-plus/icons-vue";
import { User, Lock, Avatar, Stamp, Grid, Iphone } from "@element-plus/icons-vue";
import { ref } from "vue";
import userStore from "@/store/modules/user";
import { getCode, sturegister,getFaculties } from '@/api/user'
import { getCode, sturegister, getFaculties } from '@/api/user'
import { useRouter } from "vue-router";
const router = useRouter()
const setting = settingStore();
@ -301,7 +301,10 @@ const props = {
},
}
const handleChange = (e: any) => {
console.log(e);
formModel.value.clssid = e
}
//
@ -353,10 +356,10 @@ const rules = {
trigger: "blur",
},
],
clssid:[
clssid: [
{ required: true, message: "请选择所属班级", trigger: "blur" },
],
mobile:[
mobile: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{
pattern: /^1[3-9]\d{9}$/,
@ -377,13 +380,11 @@ const register = async () => {
username: formModel.value.username,
realname: formModel.value.name,
workno: formModel.value.studentNumb,
depid: deepValues.value.splice(0, 2).join(',')
depid: deepValues.value.slice(0, 2).join(',')
};
try {
const res: any = await sturegister(data)
if (res.code === 200) {
ElMessage.success(`注册成功`)
isRegister.value = false
formModel.value={
formModel.value = {
username: "",
password: "",
repassword: "",
@ -392,14 +393,27 @@ const register = async () => {
studentNumb: "",
mobile: '',
captcha: "",
}
getcodeinfo()
} else {
ElMessage.warning(res.message)
}
ElMessage.success(`注册成功`)
isRegister.value = false
} catch (error) {
console.log(error);
getcodeinfo()
}
console.log(res)
// getcodeinfo()
// console.log(11111);
// ElMessage.warning(res.message)
// console.log(res)
};
const codeUrl = ref("");
const getcodeinfo = async () => {
@ -423,16 +437,16 @@ const login = async () => {
username: formModel.value.username,
};
const res = await user.logIn(data);
if(res){
if (res) {
router.push('/')
}
};
const toRegister=()=>{
const toRegister = () => {
isRegister.value = true
getcodeinfo();
}
const toLogin=()=>{
const toLogin = () => {
isRegister.value = false
getcodeinfo();
}
@ -474,10 +488,12 @@ const toLogin=()=>{
background-position: center;
background-size: 50% auto;
}
.captcha {
width: 100%;
height: 100%;
position: relative;
.code {
width: 100%;
height: 100%;
@ -489,11 +505,13 @@ const toLogin=()=>{
// background-color: pink;
display: flex;
align-items: center;
img {
width: 100%;
height: 100%;
}
}}
}
}
}
.hexagon-button {
@ -510,6 +528,7 @@ const toLogin=()=>{
background-color: #0e2e5e;
font-size: 18px;
}
// .el-form-item__label {
// color: #0e2e5e;
// }
@ -519,7 +538,8 @@ const toLogin=()=>{
.el-input {
width: 300px;
}
:deep(.el-form-item__error){
:deep(.el-form-item__error) {
left: 110px;
}
</style>

Loading…
Cancel
Save