diff --git a/src/views/mobile/NativeLogin.vue b/src/views/mobile/NativeLogin.vue index 6b0c3f9..11ef7b6 100644 --- a/src/views/mobile/NativeLogin.vue +++ b/src/views/mobile/NativeLogin.vue @@ -19,16 +19,13 @@ export const COCOS_SCHEMA = 'nativechain' export default class NativeLogin extends Vue { chainManager = new ChainManager() - async created() { - await this.chainManager.init() - } - - mounted() { + async mounted() { const act = this.$route.query.a console.log('act: ', act) + await this.chainManager.init() switch (act) { case 'login': - this.collectToWallet() + await this.collectToWallet() break } } @@ -38,15 +35,23 @@ export default class NativeLogin extends Vue { } async collectToWallet() { - try { - await this.chainManager.login() + const self = this + const responseSuccess = function() { const data: any = { act: 'login', account: AppModule.accountId, chainid: AppModule.chainId, token: UserModule.token } - this.response(data) + self.response(data) + } + if (this.logined) { + responseSuccess() + return + } + try { + await this.chainManager.login() + responseSuccess() } catch (err) { console.log(err) const data: any = {