支持组件自适应项目
This commit is contained in:
@@ -3,18 +3,18 @@ import instance from './http'
|
||||
|
||||
instance.interceptors.request.use(config => {
|
||||
store.commit('initWaterMarker')
|
||||
|
||||
let {module} = store.state
|
||||
if (/\/node\//.test(config.url)) {
|
||||
config.baseURL = '/ns'
|
||||
} else if (/AppCountryAlbum/.test(location.pathname) || config.module == 'AppCountryAlbum') {
|
||||
} else if (/AppCountryAlbum/.test(location.pathname) || config.module == 'AppCountryAlbum' || module == "AppCountryAlbum") {
|
||||
config.baseURL = '/aca'
|
||||
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
||||
} else if (/\/project\/beta\//.test(location.pathname) || config.module == 'wangge' || store.state.config.corpid == 'ww2a667717a70164f1') {
|
||||
} else if (/\/project\/beta\//.test(location.pathname) || config.module == 'wangge' || module == "wangge") {
|
||||
config.baseURL = '/wangge'
|
||||
} else if (/\/project\/police\//.test(location.pathname) || config.module == 'hnjc') {
|
||||
} else if (/\/project\/police\//.test(location.pathname) || config.module == 'hnjc' || module == "hnjc") {
|
||||
config.baseURL = '/hnjc'
|
||||
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
||||
} else if (sessionStorage.getItem("prj") == "saas") {
|
||||
} else if (sessionStorage.getItem("prj") == "saas" || module == "saas") {
|
||||
config.baseURL = '/online'
|
||||
} else config.baseURL = "/lan"
|
||||
return config
|
||||
|
||||
@@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getToken', 'getAccount', 'getCode']),
|
||||
...mapMutations(['login', 'logout']),
|
||||
...mapMutations(['login', 'logout', 'setModule']),
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(v => {
|
||||
if (v) {
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
this.getToken({...this.form, module, corpId}).then(token => {
|
||||
this.login(token)
|
||||
if (module != 'AppCountryAlbum') {
|
||||
this.getAccount({module})
|
||||
this.getAccount({module}).then(() => this.setModule(module))
|
||||
}
|
||||
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
|
||||
}).catch(() => 0)
|
||||
|
||||
@@ -9,12 +9,16 @@ const store = new Vuex.Store({
|
||||
state: {
|
||||
token: "",
|
||||
openUser: {},
|
||||
apps: []
|
||||
apps: [],
|
||||
module: ""
|
||||
},
|
||||
mutations: {
|
||||
setApps(state, apps) {
|
||||
state.apps = apps
|
||||
},
|
||||
setModule(state, mod) {
|
||||
state.module = mod
|
||||
},
|
||||
login(state, token) {
|
||||
state.token = token
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user