| | |
| | | <div class="logo"> |
| | | <img src="../../assets/images/logo.png" alt=""> |
| | | </div> |
| | | <div> |
| | | | |
| | | </div> |
| | | <div class="logo-title"> |
| | | 中天科技WMS系统 |
| | | WMS系统 |
| | | </div> |
| | | </div> |
| | | <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> |
| | | |
| | | <div class="title-container"> |
| | | <div class="logo-main"> |
| | | <div class="main-img"> |
| | | <img src="@/assets/images/loginbg.png" alt=""> |
| | | </div> |
| | | <!-- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> --> |
| | | <el-form ref="loginForm" :status-icon="true" :model="loginForm" class="login-form" auto-complete="on" label-position="left"> |
| | | <div v-show="!showCode" class="title-container"> |
| | | <div> |
| | | <div class="title">系统登录</div> |
| | | <div class="scan-icon">小图标</div> |
| | | <div class="title">登录</div> |
| | | <div class="scan-icon iconfont icon-saoyisao" /> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-form-item prop="username"> |
| | | <el-form-item v-show="!showCode" size="size" prop="username"> |
| | | <span class="svg-container"> |
| | | <svg-icon icon-class="user" /> |
| | | <i class="el-icon-user" /> |
| | | </span> |
| | | <el-input |
| | | ref="username" |
| | | v-model="loginForm.username" |
| | | placeholder="Username" |
| | | v-model.number="loginForm.username" |
| | | size="mini" |
| | | placeholder="账号" |
| | | name="username" |
| | | type="text" |
| | | |
| | | tabindex="1" |
| | | auto-complete="on" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item prop="password"> |
| | | <el-form-item v-show="!showCode" size="size" prop="password"> |
| | | <span class="svg-container"> |
| | | <svg-icon icon-class="password" /> |
| | | <i class="el-icon-lock" /> |
| | | </span> |
| | | <el-input |
| | | :key="passwordType" |
| | | ref="password" |
| | | v-model="loginForm.password" |
| | | size="mini" |
| | | :type="passwordType" |
| | | placeholder="Password" |
| | | placeholder="密码" |
| | | name="password" |
| | | show-password |
| | | tabindex="2" |
| | | auto-complete="on" |
| | | @keyup.enter.native="handleLogin" |
| | |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-checkbox v-model="checked">自动登录</el-checkbox> |
| | | <el-checkbox v-model="checked">忘记密码</el-checkbox> |
| | | </el-form-item> |
| | | <div class="login"> |
| | | <div v-show="!showCode" class="login"> |
| | | <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | <div v-show="showCode" class="code"> |
| | | <img src="../../assets/images/code.png"> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | name: 'Login', |
| | | data() { |
| | | const validateUsername = (rule, value, callback) => { |
| | | if (!validUsername(value)) { |
| | | callback(new Error('请输入正确的账号!')) |
| | | const reg = /^(?=.*\d).{6,11}$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('账号由6-10位数字组成,请输入正确的账号!')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | const validatePassword = (rule, value, callback) => { |
| | | if (value.length < 6) { |
| | | callback(new Error('请输入6位密码!')) |
| | | // let reg= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4,20}$/ |
| | | // let reg = /^(?![0-9]+$)(?![A-Z]+$)(?![a-z]+$)[0-9A-Za-z]{6,12}$/ |
| | | |
| | | const reg = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{6,12}$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('密码必须是由6-12位包含大小写字母,数字组合')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | loginForm: { |
| | | username: 'admin', |
| | | password: '111111' |
| | | username: '', |
| | | password: '' |
| | | }, |
| | | loginRules: { |
| | | username: [{ required: true, trigger: 'blur', validator: validateUsername }], |
| | |
| | | }, |
| | | loading: false, |
| | | passwordType: 'password', |
| | | redirect: undefined |
| | | redirect: undefined, |
| | | showCode: false |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | openCode() { |
| | | this.showCode = true |
| | | }, |
| | | showPwd() { |
| | | if (this.passwordType === 'password') { |
| | | this.passwordType = '' |
| | |
| | | }) |
| | | }, |
| | | handleLogin() { |
| | | this.$refs.loginForm.validate(valid => { |
| | | if (valid) { |
| | | console.log('开始登录') |
| | | // debugger |
| | | console.log(this) |
| | | this.loading = true |
| | | this.$store.dispatch('user/login', this.loginForm).then(() => { |
| | | this.$store.dispatch('user/login', this.loginForm).then((res) => { |
| | | console.log(res) |
| | | this.$router.push({ path: this.redirect || '/' }) |
| | | this.loading = false |
| | | }).catch(() => { |
| | | this.loading = false |
| | | }) |
| | | } else { |
| | | console.log('error submit!!') |
| | | return false |
| | | } |
| | | }) |
| | | } |
| | | } |
| | |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | |
| | | #app .login-container .el-input input:-webkit-autofill { |
| | | box-shadow: none !important; |
| | | } |
| | | /* 修复input 背景不协调 和光标变色 */ |
| | | /* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */ |
| | | |
| | | .login{ |
| | | text-align: center; |
| | | .el-button{ |
| | | background: #285E77 ; |
| | | border: 2px solid #8AA0AC; |
| | | } |
| | | } |
| | | $bg:#283443; |
| | | $light_gray:#fff; |
| | |
| | | .login-container { |
| | | .el-input { |
| | | display: inline-block; |
| | | height: 47px; |
| | | height: 30px; |
| | | width: 85%; |
| | | |
| | | input { |
| | |
| | | border: 0px; |
| | | -webkit-appearance: none; |
| | | border-radius: 0px; |
| | | padding: 12px 5px 12px 15px; |
| | | padding: 6px 2px 6px 7px; |
| | | color: $cursor; |
| | | height: 47px; |
| | | height: 30px; |
| | | // caret-color: $cursor; |
| | | |
| | | &:-webkit-autofill { |
| | |
| | | background: rgba(255, 255, 255); |
| | | border-radius: 5px; |
| | | color: #454545; |
| | | margin-bottom: 40px; |
| | | margin-right: 40px; |
| | | margin-left: 40px; |
| | | height: 40px; |
| | | &:nth-child(4){ |
| | | // width: 100%; |
| | | // display: flex; |
| | |
| | | $bg:#2d3a4b; |
| | | $dark_gray:#889aa4; |
| | | $light_gray:#eee; |
| | | ::v-deep .el-form-item__content{ |
| | | .svg-container{ |
| | | text-align: center; |
| | | line-height: 32px; |
| | | } |
| | | // display: flex; |
| | | |
| | | } |
| | | .login-container { |
| | | position: relative; |
| | | min-height: 100%; |
| | | width: 100%; |
| | | background: url("../../assets/images/loginbg.png"); |
| | | background: #134666; |
| | | background-size: cover; |
| | | overflow: hidden; |
| | | .login-logo{ |
| | | position: absolute; |
| | | width: 520px; |
| | | left: 60%; |
| | | top: 25%; |
| | | position: fixed; |
| | | width: 100%; |
| | | left: 0; |
| | | top: 0; |
| | | color: #fff; |
| | | font-size: 30px; |
| | | font-size: 20px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 10px; |
| | | background: #0E3757; |
| | | .logo{ |
| | | img{ |
| | | width: 150px; |
| | | height: 50px; |
| | | width: 80px; |
| | | height: 30px; |
| | | } |
| | | } |
| | | .logo-title{ |
| | | margin-left: 20px; |
| | | } |
| | | } |
| | | .logo-main{ |
| | | position: absolute; |
| | | left: 50%; |
| | | top: 50%; |
| | | transform: translate(-50%,-50%); |
| | | width: 1000px; |
| | | height: 400px; |
| | | border-radius: 25px; |
| | | overflow:hidden; |
| | | display: flex; |
| | | // border: 2px solid red; |
| | | .main-img{ |
| | | // width: 550px; |
| | | // height: 300px; |
| | | flex: 1; |
| | | height: 400px; |
| | | text-align: center; |
| | | background: #0D3155; |
| | | img{ |
| | | width: 400px; |
| | | height: 400px; |
| | | } |
| | | } |
| | | .login-form { |
| | | position: absolute; |
| | | background: #fff; |
| | | border-radius: 25px; |
| | | width: 520px; |
| | | height: 370px; |
| | | padding: 40px; |
| | | max-width: 100%; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | left: 60%; |
| | | background: #285E77; |
| | | width: 450px; |
| | | height: 400px; |
| | | padding: 30px; |
| | | overflow: hidden; |
| | | color: #fff; |
| | | .code{ |
| | | text-align: center; |
| | | img{ |
| | | width: 200px; |
| | | height: 200px; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | .tips { |
| | | font-size: 14px; |
| | | color: #fff; |
| | |
| | | } |
| | | |
| | | .svg-container { |
| | | padding: 6px 5px 6px 15px; |
| | | padding: 3px 2px 3px 7px; |
| | | color: $dark_gray; |
| | | vertical-align: middle; |
| | | width: 30px; |
| | |
| | | |
| | | .title-container { |
| | | position: relative; |
| | | |
| | | // height: 70px; |
| | | // line-height: 70px; |
| | | margin-bottom: 40px; |
| | | .title { |
| | | height: 30px; |
| | | line-height: 30px; |
| | | position: relative; |
| | | // position: absolute; |
| | | left: 50%; |
| | | transform: translate(-50%); |
| | | font-size: 20px; |
| | | color: #454545; |
| | | margin: 0px auto 24px auto; |
| | | color: #fff; |
| | | margin: 0px auto 0 auto; |
| | | display: inline-block; |
| | | // font-weight: bold; |
| | | } |
| | | .scan-icon{ |
| | | float: right; |
| | | font-size: 30px; |
| | | } |
| | | } |
| | | |