| | |
| | | <span class="svg-container"> |
| | | <svg-icon icon-class="user" /> |
| | | </span> |
| | | <el-input |
| | | ref="username" |
| | | v-model="loginForm.username" |
| | | placeholder="Username" |
| | | name="username" |
| | | type="text" |
| | | tabindex="1" |
| | | auto-complete="on" |
| | | /> |
| | | <el-input ref="username" v-model="loginForm.username" placeholder="Username" name="username" type="text" |
| | | tabindex="1" auto-complete="on" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item prop="password"> |
| | | <span class="svg-container"> |
| | | <svg-icon icon-class="password" /> |
| | | </span> |
| | | <el-input |
| | | :key="passwordType" |
| | | ref="password" |
| | | v-model="loginForm.password" |
| | | :type="passwordType" |
| | | placeholder="Password" |
| | | name="password" |
| | | tabindex="2" |
| | | auto-complete="on" |
| | | @keyup.enter.native="handleLogin" |
| | | /> |
| | | <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType" |
| | | placeholder="Password" name="password" tabindex="2" auto-complete="on" @keyup.enter.native="handleLogin" /> |
| | | <span class="show-pwd" @click="showPwd"> |
| | | <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> |
| | | </span> |
| | | </el-form-item> |
| | | |
| | | <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button> |
| | | <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" |
| | | @click.native.prevent="handleLogin">Login</el-button> |
| | | <!-- <div class="tips"> |
| | | <span style="margin-right:20px;">username: admin</span> |
| | | <span> password: any</span> |
| | |
| | | |
| | | <script> |
| | | import { validUsername } from '@/utils/validate' |
| | | |
| | | import { get } from "@/api/util/requestUtil.js" |
| | | export default { |
| | | name: 'Login', |
| | | data() { |
| | |
| | | }, |
| | | watch: { |
| | | $route: { |
| | | handler: function(route) { |
| | | handler: function (route) { |
| | | this.redirect = route.query && route.query.redirect |
| | | }, |
| | | immediate: true |
| | |
| | | this.$refs.loginForm.validate(valid => { |
| | | if (valid) { |
| | | this.loading = true |
| | | this.$store.dispatch('user/login', this.loginForm).then(() => { |
| | | this.$store.dispatch('user/login', this.loginForm).then(async () => { |
| | | await get(this.$url.info).then(res => { |
| | | this.user = res.data |
| | | localStorage.setItem("user", JSON.stringify(res.data)) |
| | | }) |
| | | this.$router.push({ path: this.redirect || '/' }) |
| | | this.loading = false |
| | | }).catch(() => { |
| | |
| | | /* 修复input 背景不协调 和光标变色 */ |
| | | /* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */ |
| | | |
| | | $bg:#283443; |
| | | $light_gray:#fff; |
| | | $bg: #283443; |
| | | $light_gray: #fff; |
| | | $cursor: #fff; |
| | | |
| | | @supports (-webkit-mask: none) and (not (cater-color: $cursor)) { |
| | |
| | | </style> |
| | | |
| | | <style lang="scss" scoped> |
| | | $bg:#2d3a4b; |
| | | $dark_gray:#889aa4; |
| | | $light_gray:#eee; |
| | | $bg: #2d3a4b; |
| | | $dark_gray: #889aa4; |
| | | $light_gray: #eee; |
| | | |
| | | .login-container { |
| | | min-height: 100%; |
| | | width: 100%; |
| | | background:url('../../assets/404_images/backgroud.png') no-repeat; |
| | | background: url('../../assets/404_images/backgroud.png') no-repeat; |
| | | background-size: 100vw 100vh; |
| | | overflow: hidden; |
| | | |
| | | .login-form { |
| | | position: relative; |
| | | width: 520px; |
| | | max-width: 100%; |
| | | padding: 0 35px ; |
| | | padding: 0 35px; |
| | | margin: 0 auto; |
| | | overflow: hidden; |
| | | position: absolute; |
| | | top: 50%; |
| | | left: 50%; |
| | | transform: translate(-50%,-50%); |
| | | transform: translate(-50%, -50%); |
| | | |
| | | } |
| | | |