From 50aa26a040fb0d1d446f4924f646b9030ca2450c Mon Sep 17 00:00:00 2001 From: xy <2115269706@qq.com> Date: Sat, 15 Mar 2025 11:06:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B90315?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/loginPage.vue | 112 +++++++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 46 deletions(-) diff --git a/src/layout/loginPage.vue b/src/layout/loginPage.vue index 9d505ea..bd994f1 100644 --- a/src/layout/loginPage.vue +++ b/src/layout/loginPage.vue @@ -83,7 +83,7 @@
+ v-model="formModel.clssid" @change="handleChange" />
@@ -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,29 +380,40 @@ 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(',') }; - const res: any = await sturegister(data) - if (res.code === 200) { + try { + const res: any = await sturegister(data) + formModel.value = { + username: "", + password: "", + repassword: "", + name: "", + clssid: '', + studentNumb: "", + mobile: '', + captcha: "", + } ElMessage.success(`注册成功`) isRegister.value = false - formModel.value={ - username: "", - password: "", - repassword: "", - name: "", - clssid: '', - studentNumb: "", - mobile: '', - captcha: "", -} - getcodeinfo() - } else { - ElMessage.warning(res.message) + + + } 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(); } @@ -472,28 +486,32 @@ const toLogin=()=>{ margin: 0; background: url("../assets/images/login.png") no-repeat; background-position: center; - background-size: 50% auto; + background-size: 50% auto; } + .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%; 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 { @@ -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; }