代理设置,工具优化

This commit is contained in:
aixianling
2022-06-08 17:07:34 +08:00
parent b92e61f634
commit 2ef5fe020c
2 changed files with 10 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ instance.interceptors.request.use(config => {
} else if (/AppCountryAlbum/.test(location.pathname) || config.module == 'AppCountryAlbum') {
config.baseURL = '/aca'
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
} else if (/\/project\/beta\//.test(location.pathname)) {
} else if (/\/project\/beta\//.test(location.pathname) || config.module == 'wangge') {
config.baseURL = '/wangge'
} else if (/\/project\/police\//.test(location.pathname) || config.module == 'hnjc') {
config.baseURL = '/hnjc'

View File

@@ -33,7 +33,8 @@ export default {
return decodeURIComponent(this.$route.query.back) || ""
},
currentApp() {
return this.apps.find(e => this.target.indexOf(e.libPath) > -1) || {}
let path = this.target.replace(/(.+)[\\\/][^\\\/]+\?.*/, '$1')
return this.apps.find(e => e.libPath.indexOf(path) > -1) || {}
},
appPath() {
return this.currentApp?.label || ""
@@ -50,12 +51,15 @@ export default {
handleLogin() {
this.$refs.loginForm.validate(v => {
if (v) {
let {name: module,libPath} = this.currentApp
if(/\/project\/police\//.test(libPath)){
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'
}
this.getToken({...this.form, module, corpId: 'ww596787bb70f08288'}).then(() => {
// this.getToken({...this.form, module, corpId: 'wpytYEDgAAcpXjmlYkYwKO60JDGDWrXg'}).then(() => {
this.getToken({...this.form, module, corpId}).then(() => {
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
}).catch(() => 0)
}