完善企微产品库自动登录

This commit is contained in:
aixianling
2022-07-25 14:26:26 +08:00
parent a4eac1cf1a
commit 71fcc8c728

View File

@@ -51,7 +51,7 @@ export default {
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(v => { this.$refs.loginForm.validate(v => {
if (v) { if (v) {
this.handleSignIn({...this.form, module, corpId}) this.getSystem().then(({module, corpId}) => this.handleSignIn({...this.form, module, corpId}))
} }
}) })
}, },
@@ -59,12 +59,12 @@ export default {
this.$http.delete("/auth/token/logout").finally(() => this.logout()) this.$http.delete("/auth/token/logout").finally(() => this.logout())
}, },
handleSignIn(params) { handleSignIn(params) {
this.getSystem().then(({module, corpId}) => this.getToken({...params, module, corpId}).then(() => { return this.getToken(params).then(() => {
if (module != 'AppCountryAlbum') { if (module != 'AppCountryAlbum') {
this.getAccount({module}) this.getAccount({module})
} }
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({}) this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
}).catch(() => 0)) }).catch(() => 0)
}, },
getSystem() { getSystem() {
let {name: module, libPath} = this.currentApp, let {name: module, libPath} = this.currentApp,
@@ -80,7 +80,7 @@ export default {
module = 'wangge' module = 'wangge'
} }
this.setModule(module) this.setModule(module)
return {corpId, module} return Promise.resolve({corpId, module})
} }
}, },
onShow() { onShow() {
@@ -93,7 +93,6 @@ export default {
this.getSystem().then(() => this.getCode().catch(err => { this.getSystem().then(() => this.getCode().catch(err => {
this.err = err this.err = err
})) }))
} }
} else { } else {
this.handleLogout() this.handleLogout()