产品库增加企微端登录,登录修复
This commit is contained in:
@@ -46,7 +46,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getToken','getAccount']),
|
||||
...mapActions(['getToken', 'getAccount', 'getCode']),
|
||||
...mapMutations(['login', 'logout']),
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(v => {
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
}
|
||||
this.getToken({...this.form, module, corpId}).then(token => {
|
||||
this.login(token)
|
||||
if( module != 'AppCountryAlbum'){
|
||||
if (module != 'AppCountryAlbum') {
|
||||
this.getAccount({module})
|
||||
}
|
||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
||||
@@ -74,7 +74,35 @@ export default {
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.handleLogout()
|
||||
if (/wxwork/.test(navigator.userAgent)) {
|
||||
//在企微端
|
||||
if (this.$route.query.code) {
|
||||
let {name: module, libPath} = this.currentApp,
|
||||
corpId = 'ww596787bb70f08288'
|
||||
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(token => {
|
||||
this.login(token)
|
||||
if (module != 'AppCountryAlbum') {
|
||||
this.getAccount({module})
|
||||
}
|
||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
||||
}).catch(err => {
|
||||
this.err = err
|
||||
})
|
||||
} else {
|
||||
this.getCode().catch(err => {
|
||||
this.err = err
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.handleLogout()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.loginForm.setRules(this.rules)
|
||||
|
||||
Reference in New Issue
Block a user