| | |
| | | <i slot="prefix" class="iconfont icon-mima"></i> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="loginCode"> |
| | | <el-col :span="16"> |
| | | <el-input |
| | | v-model="loginCode" |
| | | size="small" |
| | | auto-complete="off" |
| | | placeholder="请输入验证码" |
| | | @keyup.enter.native="handleLogin" |
| | | > |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="6" :offset="2"> |
| | | <login-code |
| | | :key="refreshKey" |
| | | :identifyCode="loginCodeValue" |
| | | @refresh="refreshLoginValueCode" |
| | | /> |
| | | </el-col> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { randomLenNum } from '@/util/util' |
| | | import { mapGetters } from 'vuex' |
| | | import { getCode } from '@/api/code' |
| | | import Verify from '@/components/verifition/Verify' |
| | | import { getSsoAuthUrl } from '@/api/login' |
| | | import LoginCode from '@/page/login/LoginCode.vue' |
| | | |
| | | export default { |
| | | name: 'Userlogin', |
| | | components: { |
| | | Verify |
| | | LoginCode |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | ] |
| | | }, |
| | | passwordType: 'password', |
| | | SSO: window.location.hash |
| | | SSO: window.location.hash, |
| | | loginCode: null, |
| | | loginCodeValue: Math.random() |
| | | .toString(36) |
| | | .substr(2, 4), |
| | | refreshKey: 0 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | : (this.passwordType = '') |
| | | }, |
| | | handleLogin() { |
| | | if (!this.loginCode) { |
| | | this.$message.error('请输入验证码') |
| | | return |
| | | } |
| | | if (this.loginCode.toLowerCase() !== this.loginCodeValue) { |
| | | this.$message.error('验证码不正确') |
| | | return |
| | | } |
| | | this.$refs.loginForm.validate((valid) => { |
| | | if (valid) { |
| | | this.$store.dispatch('LoginByUsername', this.loginForm).then(() => { |
| | | this.$router.push({ path: this.tagWel.value }) |
| | | }) |
| | | } else { |
| | | this.refreshLoginValueCode() |
| | | } |
| | | }) |
| | | }, |
| | |
| | | this.$router.push({ path: this.tagWel.value }) |
| | | }) |
| | | } |
| | | }, |
| | | // 刷新验证码 |
| | | refreshLoginValueCode() { |
| | | this.loginCodeValue = Math.random() |
| | | .toString(36) |
| | | .substr(2, 4) |
| | | this.refreshKey++ |
| | | } |
| | | } |
| | | } |