上传代码
This commit is contained in:
@@ -17,13 +17,13 @@ let baseURL = ''
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 生产环境
|
||||
// baseURL = "https://api.tkpage.yolozs.com"
|
||||
baseURL = "http://192.168.1.174:8101"
|
||||
baseURL = "http://49.235.115.212:12025/"
|
||||
// baseURL = "http://192.168.0.103:8085/"
|
||||
} else {
|
||||
// 测试环境
|
||||
// baseURL = "http://120.26.251.180:8085/"
|
||||
// 开发环境
|
||||
baseURL = "https://api.tkpage.yolozs.com"
|
||||
baseURL = "http://49.235.115.212:12025/"
|
||||
// baseURL = "http://api.tkpage.vvtiktok.cn"
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@ axios.interceptors.request.use((config) => {
|
||||
console.log("config", config)
|
||||
const url = sliceUrl(config.url)
|
||||
console.log("url", url)
|
||||
if (!(config.url == 'doLogin' || config.url == 'get-id-by-name')) {
|
||||
config.headers['vvtoken'] = getToken();
|
||||
}
|
||||
// if (!(config.url == 'templateList' || config.url == 'languageList')) {
|
||||
// config.headers['vvtoken'] = getToken();
|
||||
// }
|
||||
|
||||
// 请求超时时间 - 毫秒
|
||||
config.timeout = 60000
|
||||
config.baseURL = baseURL
|
||||
// 自定义Content-type
|
||||
config.headers['Content-type'] = 'application/json'
|
||||
// config.headers['Content-type'] = 'application/json'
|
||||
return config;
|
||||
}, (error) => {
|
||||
return Promise.reject(error)
|
||||
@@ -48,8 +48,8 @@ axios.interceptors.request.use((config) => {
|
||||
|
||||
// 响应拦截器
|
||||
axios.interceptors.response.use((response) => {
|
||||
console.log("response", response.data)
|
||||
if (response.data.code == 0) {
|
||||
console.log("```````````````response```````````````````", response.data)
|
||||
if (response.data.code == '200') {
|
||||
console.log("response", response.data.data)
|
||||
return response.data.data
|
||||
} else {
|
||||
@@ -83,14 +83,12 @@ export function getAxios({ url, params }) {
|
||||
// axios的post请求
|
||||
export function postAxios({ url, data }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("```````````````data```````````````", data);
|
||||
console.log("````````````````url````````````````", url);
|
||||
|
||||
axios.post(
|
||||
url,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
|
||||
Reference in New Issue
Block a user