change config

This commit is contained in:
Pan
2017-04-23 22:43:05 +08:00
parent a7b09a2a01
commit e0695d422a
8 changed files with 37 additions and 39 deletions

View File

@@ -97,29 +97,29 @@
});
},
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: '/' });
});
}
// 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: '/' });
// });
// }
}
},
created() {
window.addEventListener('hashchange', this.afterQRScan);
// window.addEventListener('hashchange', this.afterQRScan);
},
destroyed() {
window.removeEventListener('hashchange', this.afterQRScan);
// window.removeEventListener('hashchange', this.afterQRScan);
}
}
</script>