登录修改

dev_2022-05-11
4 years ago
parent 7484fc9821
commit 4a36a9d0de
  1. 3
      src/components/common/Sidebar.vue
  2. 56
      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,23 +9,23 @@
<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="username"></el-input> <el-input v-model="param.username" placeholder="请输入账号"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input
type="password" type="password"
placeholder="password" 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>
@ -49,22 +68,31 @@ export default {
return { return {
param: { param: {
username: 'admin', username: 'admin',
password: 'admin', 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

@ -1024,6 +1024,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