+
{{ $t('login.title') }}
@@ -117,10 +118,10 @@ export default {
}
},
created() {
- // window.addEventListener('hashchange', this.afterQRScan)
+ // window.addEventListener('storage', this.afterQRScan)
},
destroyed() {
- // window.removeEventListener('hashchange', this.afterQRScan)
+ // window.removeEventListener('storage', this.afterQRScan)
},
methods: {
showPwd() {
@@ -134,7 +135,8 @@ export default {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
- this.$store.dispatch('LoginByUsername', this.loginForm).then(() => {
+ // dispatch @/store/modules/user login action
+ this.$store.dispatch('login', this.loginForm).then(() => {
this.loading = false
this.$router.push({ path: this.redirect || '/' })
}).catch(() => {
@@ -145,74 +147,79 @@ export default {
return false
}
})
- },
- afterQRScan() {
- // const hash = window.location.hash.slice(1)
- // const hashObj = getQueryObject(hash)
- // const originUrl = window.location.origin
- // history.replaceState({}, '', originUrl)
- // const codeMap = {
- // wechat: 'code',
- // tencent: 'code'
- // }
- // const codeName = hashObj[codeMap[this.auth_type]]
- // if (!codeName) {
- // alert('第三方登录失败')
- // } else {
- // this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
- // this.$router.push({ path: '/' })
- // })
- // }
}
+ // afterQRScan() {
+ // if (e.key === 'x-admin-oauth-code') {
+ // const code = getQueryObject(e.newValue)
+ // const codeMap = {
+ // wechat: 'code',
+ // tencent: 'code'
+ // }
+ // const type = codeMap[this.auth_type]
+ // const codeName = code[type]
+ // if (codeName) {
+ // this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
+ // this.$router.push({ path: this.redirect || '/' })
+ // })
+ // } else {
+ // alert('第三方登录失败')
+ // }
+ // }
+ // }
}
}