注册问题修改0315

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

@ -83,7 +83,7 @@
</div> </div>
<div class="right"> <div class="right">
<el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem" <el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem"
v-model="formModel.clssid" /> v-model="formModel.clssid" @change="handleChange" />
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
@ -251,10 +251,10 @@
// import { onMounted, reactive, ref, toRefs, watch } from "vue"; // import { onMounted, reactive, ref, toRefs, watch } from "vue";
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import settingStore from "@/store/modules/setting"; 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 { ref } from "vue";
import userStore from "@/store/modules/user"; 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"; import { useRouter } from "vue-router";
const router = useRouter() const router = useRouter()
const setting = settingStore(); 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", trigger: "blur",
}, },
], ],
clssid:[ clssid: [
{ required: true, message: "请选择所属班级", trigger: "blur" }, { required: true, message: "请选择所属班级", trigger: "blur" },
], ],
mobile:[ mobile: [
{ required: true, message: "请输入手机号", trigger: "blur" }, { required: true, message: "请输入手机号", trigger: "blur" },
{ {
pattern: /^1[3-9]\d{9}$/, pattern: /^1[3-9]\d{9}$/,
@ -377,29 +380,40 @@ const register = async () => {
username: formModel.value.username, username: formModel.value.username,
realname: formModel.value.name, realname: formModel.value.name,
workno: formModel.value.studentNumb, workno: formModel.value.studentNumb,
depid: deepValues.value.splice(0, 2).join(',') depid: deepValues.value.slice(0, 2).join(',')
}; };
const res: any = await sturegister(data) try {
if (res.code === 200) { const res: any = await sturegister(data)
formModel.value = {
username: "",
password: "",
repassword: "",
name: "",
clssid: '',
studentNumb: "",
mobile: '',
captcha: "",
}
ElMessage.success(`注册成功`) ElMessage.success(`注册成功`)
isRegister.value = false isRegister.value = false
formModel.value={
username: "",
password: "", } catch (error) {
repassword: "", console.log(error);
name: "",
clssid: '',
studentNumb: "",
mobile: '',
captcha: "",
}
getcodeinfo()
} else {
ElMessage.warning(res.message)
getcodeinfo() getcodeinfo()
} }
console.log(res)
// getcodeinfo()
// console.log(11111);
// ElMessage.warning(res.message)
// console.log(res)
}; };
const codeUrl = ref(""); const codeUrl = ref("");
const getcodeinfo = async () => { const getcodeinfo = async () => {
@ -423,16 +437,16 @@ const login = async () => {
username: formModel.value.username, username: formModel.value.username,
}; };
const res = await user.logIn(data); const res = await user.logIn(data);
if(res){ if (res) {
router.push('/') router.push('/')
} }
}; };
const toRegister=()=>{ const toRegister = () => {
isRegister.value = true isRegister.value = true
getcodeinfo(); getcodeinfo();
} }
const toLogin=()=>{ const toLogin = () => {
isRegister.value = false isRegister.value = false
getcodeinfo(); getcodeinfo();
} }
@ -472,28 +486,32 @@ const toLogin=()=>{
margin: 0; margin: 0;
background: url("../assets/images/login.png") no-repeat; background: url("../assets/images/login.png") no-repeat;
background-position: center; background-position: center;
background-size: 50% auto; background-size: 50% auto;
} }
.captcha { .captcha {
width: 100%;
height: 100%;
position: relative;
.code {
width: 100%;
height: 100%;
position: absolute;
top: 0;
right: 0;
width: 105px;
height: 100%;
// background-color: pink;
display: flex;
align-items: center;
img {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; }
.code { }
width: 100%; }
height: 100%;
position: absolute;
top: 0;
right: 0;
width: 105px;
height: 100%;
// background-color: pink;
display: flex;
align-items: center;
img {
width: 100%;
height: 100%;
}
}}
} }
.hexagon-button { .hexagon-button {
@ -510,6 +528,7 @@ const toLogin=()=>{
background-color: #0e2e5e; background-color: #0e2e5e;
font-size: 18px; font-size: 18px;
} }
// .el-form-item__label { // .el-form-item__label {
// color: #0e2e5e; // color: #0e2e5e;
// } // }
@ -519,7 +538,8 @@ const toLogin=()=>{
.el-input { .el-input {
width: 300px; width: 300px;
} }
:deep(.el-form-item__error){
:deep(.el-form-item__error) {
left: 110px; left: 110px;
} }
</style> </style>

Loading…
Cancel
Save