| | |
| | | <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() { |
| | |
| | | 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(() => { |
| | |
| | | background:url('../../assets/404_images/backgroud.png') no-repeat; |
| | | background-size: 100vw 100vh; |
| | | overflow: hidden; |
| | | |
| | | .login-form { |
| | | position: relative; |
| | | width: 520px; |