修改native登录流程

This commit is contained in:
cebgcontract 2022-04-01 13:07:59 +08:00
parent 6cd44bdb4e
commit 4c7fa3919f

View File

@ -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 = {