完善企微产品库自动登录
This commit is contained in:
@@ -51,6 +51,22 @@ export default {
|
|||||||
handleLogin() {
|
handleLogin() {
|
||||||
this.$refs.loginForm.validate(v => {
|
this.$refs.loginForm.validate(v => {
|
||||||
if (v) {
|
if (v) {
|
||||||
|
this.handleSignIn({...this.form, module, corpId})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleLogout() {
|
||||||
|
this.$http.delete("/auth/token/logout").finally(() => this.logout())
|
||||||
|
},
|
||||||
|
handleSignIn(params) {
|
||||||
|
this.getSystem().then(({module, corpId}) => this.getToken({...params, module, corpId}).then(() => {
|
||||||
|
if (module != 'AppCountryAlbum') {
|
||||||
|
this.getAccount({module})
|
||||||
|
}
|
||||||
|
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
||||||
|
}).catch(() => 0))
|
||||||
|
},
|
||||||
|
getSystem() {
|
||||||
let {name: module, libPath} = this.currentApp,
|
let {name: module, libPath} = this.currentApp,
|
||||||
corpId = 'ww596787bb70f08288'
|
corpId = 'ww596787bb70f08288'
|
||||||
if (/\/project\/police\//.test(libPath)) {
|
if (/\/project\/police\//.test(libPath)) {
|
||||||
@@ -64,41 +80,17 @@ export default {
|
|||||||
module = 'wangge'
|
module = 'wangge'
|
||||||
}
|
}
|
||||||
this.setModule(module)
|
this.setModule(module)
|
||||||
this.getToken({...this.form, module, corpId}).then(() => {
|
return {corpId, module}
|
||||||
if (module != 'AppCountryAlbum') {
|
|
||||||
this.getAccount({module})
|
|
||||||
}
|
|
||||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
|
||||||
}).catch(() => 0)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleLogout() {
|
|
||||||
this.$http.delete("/auth/token/logout").finally(() => this.logout())
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (/wxwork/.test(navigator.userAgent)) {
|
if (/wxwork/.test(navigator.userAgent)) {
|
||||||
//在企微端
|
//在企微端
|
||||||
if (this.$route.query.code) {
|
if (this.$route.query.code) {
|
||||||
let {name: module, libPath} = this.currentApp,
|
const {code} = this.$route.query
|
||||||
corpId = 'ww596787bb70f08288'
|
this.handleSignIn({code})
|
||||||
if (/\/project\/police\//.test(libPath)) {
|
|
||||||
module = 'hnjc'
|
|
||||||
} else if (/\/project\/beta\//.test(libPath)) {
|
|
||||||
corpId = 'ww2a667717a70164f1'
|
|
||||||
module = 'wangge'
|
|
||||||
}
|
|
||||||
let {code} = this.$route.query
|
|
||||||
this.getToken({code}).then(() => {
|
|
||||||
if (module != 'AppCountryAlbum') {
|
|
||||||
this.getAccount({module})
|
|
||||||
}
|
|
||||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
|
||||||
}).catch(err => {
|
|
||||||
this.err = err
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
|
this.getSystem()
|
||||||
this.getCode().catch(err => {
|
this.getCode().catch(err => {
|
||||||
this.err = err
|
this.err = err
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user