From 4c7fa3919fdb4fac818094653b663ed6cb28f53c Mon Sep 17 00:00:00 2001 From: cebgcontract <99630598+cebgcontract@users.noreply.github.com> Date: Fri, 1 Apr 2022 13:07:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9native=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mobile/NativeLogin.vue | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 = {