登录修改

UI_2022-02-10
4 years ago
parent d27e2cd02a
commit 1b5a269b7f
  1. 6
      src/assets/css/main.css
  2. 143
      src/components/page/Login.vue

@ -224,7 +224,7 @@ li {
opacity: 0;
}
.ms-login .el-tabs__item{
padding: 0 90px;
padding: 0 20px;
color: #999;
}
.ms-login .el-tabs__item:hover{
@ -243,12 +243,12 @@ li {
justify-content: center;
}
.ms-login .el-input__inner{
/* .ms-login .el-input__inner{
height: 80px;
line-height: 80px;
border:1px solid rgba(220,220,220,1);
border-radius:2px;
}
} */
.header_tab .el-tabs__nav-wrap::after{
background-color: #fff;

@ -27,40 +27,48 @@
<div class="back" v-show="isReg" @click="toReg(false)">
<i class="el-icon-back"></i>
</div>
<div v-if="!isReg">
<h2>账号登录</h2>
<el-form :model="loginForm" :rules="loginRules" ref="login" label-width="0px">
<el-form-item prop="username">
<p class="label">用户名</p>
<el-input v-model="loginForm.username" placeholder="请输入账号/手机号" @keyup.enter.native="getSchool()"></el-input>
</el-form-item>
<el-form-item prop="password">
<p class="label">密码</p>
<el-input
type="password"
placeholder="请输入密码"
v-model="loginForm.password"
@keyup.enter.native="getSchool"
>
</el-input>
</el-form-item>
<el-button class="submit" type="primary" @click="getSchool">登录</el-button>
<div class="links flex-between">
<el-button type="text" class="ques" @click="toReg(true)">前往注册</el-button>
<el-button type="text" class="forget" @click="forget">忘记密码</el-button>
</div>
<!-- <p class="login-tips">其他登陆方式</p>
<div class="thirdParty">
<div class="item">
<img src="../../assets/img/icon_wechat.png" alt="">
微信扫码登录
</div>
<div class="item">
<img src="../../assets/img/icon_qq.png" alt="">
QQ一键登录
</div>
</div> -->
</el-form>
<div v-if="!isReg" class="ms-login">
<el-tabs v-model="activeName">
<el-tab-pane label="账号登录" name="0">
<el-form :model="loginForm" :rules="loginRules" ref="loginForm" style="margin-top: 20px">
<el-form-item label="用户名" prop="username">
<el-input v-model="loginForm.username" placeholder="请输入账号"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input
type="password"
placeholder="请输入密码"
v-model="loginForm.password"
@keyup.enter.native="getSchool('loginForm')"
>
</el-input>
</el-form-item>
<el-button class="submit" type="primary" @click="getSchool('loginForm')">登录</el-button>
</el-form>
</el-tab-pane>
<el-tab-pane label="手机号/邮箱登录" name="1">
<el-form :model="phoneParam" :rules="phoneRules" ref="phoneParam" style="margin-top: 20px">
<el-form-item label="手机号/邮箱" prop="userphone">
<el-input v-model="phoneParam.userphone" placeholder="请输入手机号/邮箱"></el-input>
</el-form-item>
<el-form-item label="密码" prop="phonePassword">
<el-input
type="password"
placeholder="请输入密码"
v-model="phoneParam.phonePassword"
@keyup.enter.native="getSchool('phoneParam')"
>
</el-input>
</el-form-item>
<el-button class="submit" type="primary" @click="getSchool('phoneParam')">登录</el-button>
</el-form>
</el-tab-pane>
</el-tabs>
<div class="links flex-between">
<el-button type="text" class="ques" @click="toReg(true)">前往注册</el-button>
<el-button type="text" class="forget" @click="forget">忘记密码</el-button>
</div>
</div>
<register v-else :isReg.sync="isReg" @updateInfo="updateInfo"></register>
</div>
@ -74,7 +82,8 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="cancleRoleDia"> </el-button>
<el-button type="primary" @click="roleSure"> </el-button>
<el-button v-if="activeName == '0'" type="primary" @click="roleSure('loginForm')"> </el-button>
<el-button v-else type="primary" @click="roleSure('phoneParam')"> </el-button>
</span>
</el-dialog>
@ -130,6 +139,7 @@ import register from './RegisterForm';
export default {
data: function() {
return {
activeName: '0',
isReg: false,
loginForm: {
// username: '18818574533',
@ -140,6 +150,14 @@ export default {
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
},
phoneParam: {
userphone: '',
phonePassword: ''
},
phoneRules: {
userphone: [{ required: true, message: '请输入手机号/邮箱', trigger: 'blur' }],
phonePassword: [{ required: true, message: '请输入密码', trigger: 'blur' }],
},
roleDialog: false,
userId: '',
schoolId: '',
@ -174,13 +192,14 @@ export default {
})
},
methods: {
getSchool() {
this.$refs.login.validate(valid => {
getSchool(form) {
this.$refs[form].validate(valid => {
if (valid) {
let data = {
account: this.loginForm.username,
password: this.loginForm.password,
schoolId: 2105
account: this.activeName == '0' ? this.loginForm.username : this.phoneParam.userphone,
password: this.activeName == '0' ? this.loginForm.password : this.phoneParam.phonePassword,
schoolId: 2105,
source: this.activeName
};
this.$get(this.api.loginSchool, data)
.then(res => {
@ -194,7 +213,7 @@ export default {
this.schoolId = this.schoolList[0].schoolId
this.userId = this.schoolList[0].userId
this.studentId = this.schoolList[0].studentId
this.getRole()
this.getRole(form)
}else{
this.$message.error('账号不存在')
}
@ -206,7 +225,7 @@ export default {
}
});
},
getRole() {
getRole(form) {
// this.userId = this.schoolList.find((n,k) => {
// return n.schoolId == this.schoolId
// }).userId
@ -236,10 +255,12 @@ export default {
}
})
if(this.roleList.length > 1) {
console.log('role:true')
this.roleDialog = true
}else{
console.log('role:false')
this.roleId = this.roleList[0].roleId
this.submitForm()
this.submitForm(form)
}
})
.catch(res => {});
@ -248,15 +269,15 @@ export default {
this.loginForm.username = data.username
this.loginForm.password = data.password
},
roleSure(){
roleSure(form){
if(this.roleId){
this.submitForm()
this.submitForm(form)
}else{
this.$message.error('请选择角色!');
}
},
submitForm() {
this.$refs.login.validate(valid => {
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
let data = {
roleId: this.roleId,
@ -524,25 +545,14 @@ export default {
.submit{
width: 100%;
height: 48px;
margin-top: 60px;
margin-top: 40px;
line-height: 48px;
padding: 0;
font-size: 20px;
font-size: 18px;
background-color: #9278ff;
border-radius: 6px;
border: 0;
}
.links{
margin: 20px 0 20px;
}
.ques{
color: #9278ff;
font-size: 14px;
}
.forget{
color: #ffa94e;
font-size: 14px;
}
.login-tips{
margin-bottom: 20px;
font-size: 16px;
@ -576,4 +586,17 @@ export default {
color: #9076FF;
}
}
.links{
width: 70%;
margin-left: 15%;
margin-top: 20px;
}
.ques{
color: #9278ff;
font-size: 14px;
}
.forget{
color: #ffa94e;
font-size: 14px;
}
</style>
Loading…
Cancel
Save