vuex模块化
This commit is contained in:
@@ -3,7 +3,7 @@ import instance from './http'
|
||||
|
||||
instance.interceptors.request.use(config => {
|
||||
store.commit('initWaterMarker')
|
||||
config.baseURL = "/lan"
|
||||
|
||||
if (/\/node\//.test(config.url)) {
|
||||
config.baseURL = '/ns'
|
||||
} else if (/AppCountryAlbum/.test(location.pathname) || config.module == 'AppCountryAlbum') {
|
||||
@@ -16,7 +16,8 @@ instance.interceptors.request.use(config => {
|
||||
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
|
||||
} else if (sessionStorage.getItem("prj") == "saas") {
|
||||
config.baseURL = '/online'
|
||||
}
|
||||
} else config.baseURL = "/lan"
|
||||
console.log(config)
|
||||
return config
|
||||
}, err => {
|
||||
console.error(err)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import http from "./http";
|
||||
import Vue from "vue";
|
||||
|
||||
/**
|
||||
* 用户登录信息
|
||||
*/
|
||||
export const user = {
|
||||
state: () => ({}),
|
||||
mutations: {
|
||||
@@ -16,13 +19,13 @@ export const user = {
|
||||
return http.post("/admin/user/detail-phone", null, config).then(res => {
|
||||
if (res?.code == 0) {
|
||||
commit('setUser', res.data)
|
||||
return Promise.all([dispatch('getGridInfo')])
|
||||
return Promise.all([dispatch('getGridInfo', config)])
|
||||
}
|
||||
})
|
||||
},
|
||||
getGridInfo({commit}) {
|
||||
getGridInfo({commit}, config) {
|
||||
//获取登录着网格员信息
|
||||
return http.post("/app/appgirdmemberinfo/checkLogOnUser").then(res => {
|
||||
return http.post("/app/appgirdmemberinfo/checkLogOnUser", null, config).then(res => {
|
||||
if (res?.data) {
|
||||
let {girdId, girdMemberId, girdName, checkType: girdCheckType, appGirdInfo: gridInfo} = res.data
|
||||
return commit("setUser", {girdId, girdMemberId, girdName, girdCheckType, gridInfo})
|
||||
|
||||
Reference in New Issue
Block a user