登录修改

master
4 years ago
parent 8b292d53d5
commit f21e3fe4a2
  1. 3
      src/components/common/Sidebar.vue
  2. 59
      src/components/page/Login.vue
  3. 1
      src/components/page/PersonalCenter.vue

@ -145,6 +145,9 @@ export default {
.sidebar-el-menu:not(.el-menu--collapse) { .sidebar-el-menu:not(.el-menu--collapse) {
width: 100%; width: 100%;
} }
.el-menu.el-menu--horizontal{
border-bottom: none;
}
.sidebar > ul { .sidebar > ul {
height: 100%; height: 100%;
} }

@ -9,8 +9,8 @@
<div class="ms-login"> <div class="ms-login">
<div class="ms-title"> <div class="ms-title">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="账号登录" name="first"> <el-tab-pane label="账号登录" name="0">
<el-form :model="param" :rules="rules" ref="login" label-width="0px" style="margin-top: 40px"> <el-form :model="param" :rules="rules" ref="param" label-width="0px" style="margin-top: 40px">
<el-form-item prop="username"> <el-form-item prop="username">
<el-input v-model="param.username" placeholder="请输入账号"></el-input> <el-input v-model="param.username" placeholder="请输入账号"></el-input>
</el-form-item> </el-form-item>
@ -19,13 +19,13 @@
type="password" type="password"
placeholder="请输入密码" placeholder="请输入密码"
v-model="param.password" v-model="param.password"
@keyup.enter.native="submitForm()" @keyup.enter.native="submitForm('param')"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-button type="text" class="forget">忘记密码?</el-button> <!-- <el-button type="text" class="forget">忘记密码?</el-button> -->
<div class="login-btn"> <div class="login-btn">
<el-button type="primary" @click="submitForm()">马上登录</el-button> <el-button type="primary" @click="submitForm('param')">马上登录</el-button>
</div> </div>
<!-- <p class="login-tips">使用第三方账号直接登录</p> <!-- <p class="login-tips">使用第三方账号直接登录</p>
<p class="thirdParty"> <p class="thirdParty">
@ -35,7 +35,26 @@
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="扫描登录" name="second">扫描登录</el-tab-pane> <el-tab-pane label="手机号/邮箱登录" name="1">
<el-form :model="phoneParam" :rules="phoneRules" ref="phoneParam" label-width="0px" style="margin-top: 40px">
<el-form-item prop="userphone">
<el-input v-model="phoneParam.userphone" placeholder="请输入手机号/邮箱"></el-input>
</el-form-item>
<el-form-item prop="phonePassword">
<el-input
type="password"
placeholder="请输入密码"
v-model="phoneParam.phonePassword"
@keyup.enter.native="submitForm('phoneParam')"
>
</el-input>
</el-form-item>
<!-- <el-button type="text" class="forget">忘记密码?</el-button> -->
<div class="login-btn">
<el-button type="primary" @click="submitForm('phoneParam')">马上登录</el-button>
</div>
</el-form>
</el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</div> </div>
@ -48,23 +67,32 @@ export default {
data: function() { data: function() {
return { return {
param: { param: {
username: '', username: 'admin',
password: '', password: 'admin'
}, },
rules: { rules: {
username: [{ required: true, message: '请输入账号', trigger: 'blur' }], username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }], password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
}, },
activeName: 'first' phoneParam: {
userphone: '',
phonePassword: ''
},
phoneRules: {
userphone: [{ required: true, message: '请输入手机号/邮箱', trigger: 'blur' }],
phonePassword: [{ required: true, message: '请输入密码', trigger: 'blur' }],
},
activeName: '0'
}; };
}, },
methods: { methods: {
submitForm() { submitForm(form) {
this.$refs.login.validate(valid => { this.$refs[form].validate(valid => {
if (valid) { if (valid) {
let data = { let data = {
account: this.param.username, account: this.activeName == '0' ? this.param.username : this.phoneParam.userphone,
password: this.param.password password: this.activeName == '0' ? this.param.password : this.phoneParam.phonePassword,
source: this.activeName
} }
this.$get(this.api.logins,data).then(res => { this.$get(this.api.logins,data).then(res => {
let data = res.message.retvalue let data = res.message.retvalue
@ -82,6 +110,9 @@ export default {
// this.$message.error(''); // this.$message.error('');
// } // }
}).catch(res => {}); }).catch(res => {});
} else {
this.$message.error('请输入账号和密码');
return false;
} }
}); });
}, },

@ -1004,6 +1004,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.wrap{ .wrap{
// height: calc(100vh - 60px); // height: calc(100vh - 60px);
margin: -20px;
padding-top: 170px; padding-top: 170px;
// overflow: auto; // overflow: auto;
display:flex; display:flex;

Loading…
Cancel
Save