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;
}