Commit 538101da by 黄志甲

修改添加接口

parent 463377bc
ENV = 'development' ENV = 'development'
# 接口地址 # 接口地址
VUE_APP_BASE_API = 'http://106.53.98.217:10003' VUE_APP_BASE_API = 'http://192.168.7.176:9888'
VUE_APP_WS_API = 'ws://106.53.98.217:10003' VUE_APP_WS_API = 'ws://192.168.7.176:9888'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
import request from '@/utils/request' import request from '@/utils/request'
let baseUrl = 'http://portal.project.gxdpf.org.cn/portal' // 获取区域地址
export const getCityAreaList = data => {
return request({
url: 'portal/stats/getCityAreaList',
method: 'POST',
data
})
}
// 获取年份
export const getYearList = data => {
return request({
url: 'portal/stats/getYearList',
method: 'POST',
data
})
}
// 获取项目状态
export const getStatusCyclicList = data => {
return request({
url: 'portal/stats/getStatusCyclicList',
method: 'POST',
data
})
}
// 底部柱形图数据/portal/stats/getWorkSituationMonthList
export const getWorkSituationMonthList = data => {
return request({
url: 'portal/stats/getWorkSituationMonthList',
method: 'POST',
data
})
}
/* 任务地图 */
// 列表
export const getWorkSituationList = data => {
return request({
url: 'portal/stats/getWorkSituationList',
method: 'POST',
data
})
}
// 地图数据
export const getMapJson = data => {
return request({
url: `static/portal/${data}.json`,
method: 'GET'
})
}
export const getBanner = data => {
return request({
baseURL: `json/banner.json`,
method: 'GET'
})
}
// 实时统计残疾人
export const getIDTKindCountList = data => {
return request({
url: 'portal/people/getIDTKindCountList',
method: 'GET',
data
})
}
// 广西残疾人小康进程实现程度数据
export const getPeopleFairly = data => {
return request({
url: 'portal/stats/getPeopleFairly',
method: 'GET',
data
})
}
/* 数据库统计 */
// 全区持证残疾人
export const getPeopleBaseDataNum = data => {
return request({
url: 'portal/stats/getPeopleBaseDataNum',
method: 'GET',
data
})
}
// 残疾人动态更新数据库2018
export const getPeopleUpdateDataNum = data => {
return request({
url: 'portal/stats/getPeopleUpdateDataNum',
method: 'GET',
data
})
}
//查地址 // 残疾人动态更新数据库2017
export function getCityAreaList(data) { export const getPeopleUpdateData2017Num = data => {
return request({ return request({
baseUrl:baseUrl, url: 'portal/stats/getPeopleUpdateData2017Num',
url: `${baseUrl}/stats/getCityAreaList`, method: 'GET',
method: 'post',
data data
}) })
} }
...@@ -6,6 +6,21 @@ import { getToken } from '@/utils/auth' ...@@ -6,6 +6,21 @@ import { getToken } from '@/utils/auth'
import Config from '@/settings' import Config from '@/settings'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
// 微服务 前缀判断添加服务名
const addTopName = (data) => {
const urlTopName = data.url.split('/')[0]
switch (urlTopName) {
case 'api':
return `/AUTH-SERVER/${data.url}`
case 'auth':
return `/AUTH-SERVER/${data.url}`
case 'portal':
return `/PORTAL-SERVER/${data.url}`
default:
return `${data.url}`
}
}
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url
...@@ -19,6 +34,7 @@ service.interceptors.request.use( ...@@ -19,6 +34,7 @@ service.interceptors.request.use(
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
} }
config.headers['Content-Type'] = 'application/json' config.headers['Content-Type'] = 'application/json'
config.url = addTopName(config)
return config return config
}, },
error => { error => {
......
...@@ -40,6 +40,20 @@ module.exports = { ...@@ -40,6 +40,20 @@ module.exports = {
pathRewrite: { pathRewrite: {
'^/auth': 'auth' '^/auth': 'auth'
} }
},
'/ADMIN-SERVER':{
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
pathRewrite: {
'^/ADMIN-SERVER': 'ADMIN-SERVER'
}
},
'/AUTH-SERVER':{
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
pathRewrite: {
'^/AUTH-SERVER': 'AUTH-SERVER'
}
} }
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment