请求头加入Content-Type

This commit is contained in:
lyp 2025-04-17 08:46:11 +08:00
parent 3c63397501
commit 906947359f
2 changed files with 68 additions and 23 deletions

View File

@ -9,7 +9,7 @@ import {
} from '../util/AjaxUtils'
// 开发环境
// // 开发环境
// const operatorPluginBaseUrl = 'http://192.168.0.115:8099' //开票
// const aiShopBaseUrl = 'http://192.168.0.115:8081'//买卖'
// const operatorBaseUrl = 'http://192.168.0.15:8091' //绑定手机号
@ -27,8 +27,27 @@ request.interceptors.request.use(
config.headers = config.headers || {}
config.headers['Auth'] = token ? `Bearer ${token}` : '';
config.headers['Content-Type'] = 'application/json';
// config.data = { unused: 0 }
if (config.method === 'get' ) {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'put') {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'post') {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'delete') {
if (!config.data) {
config.data = { unused: 0 }
}
}
return config;
},
@ -57,22 +76,27 @@ aiShopRequest.interceptors.request.use(
config.headers = config.headers || {}
config.headers['Auth'] = token ? `Bearer ${token}` : '';
config.headers['Content-Type'] = 'application/json';
// config.data = { unused: 0 }
if (config.method === 'get' ) {
if (!config.data) {
config.data = { unused: 0 }
// if (config.method === 'get' ) {
// if (!config.data) {
// config.data = { unused: 0 }
// }
// }
// if (config.method === 'put') {
// if (!config.data) {
// config.data = { unused: 0 }
// }
// }
// if (config.method === 'post') {
// if (!config.data) {
// config.data = { unused: 0 }
// }
// }
}
}
if (config.method === 'put') {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'post') {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'delete') {
if (!config.data) {
config.data = { unused: 0 }
}
}
return config;
},
@ -99,7 +123,28 @@ phoneRequest.interceptors.request.use(
config.headers = config.headers || {}
config.headers['Auth'] = token ? `Bearer ${token}` : '';
config.headers['Content-Type'] = 'application/json';
// config.data = { unused: 0 }
if (config.method === 'get' ) {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'put') {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'post') {
if (!config.data) {
config.data = { unused: 0 }
}
}
if (config.method === 'delete') {
if (!config.data) {
config.data = { unused: 0 }
}
}
return config;
},

View File

@ -17,7 +17,7 @@ import MenuWithTopButton from "../../components/menu/MenuWithTopButton.tsx";
import RefunModal from '../../components/RefunModal/RefunModal.tsx'
import CorrectionModal from '../../components/CorrectionModal/CorrectionModal.tsx'
import ContractModal from '../../components/ContractModal/ContractModal.tsx'
// import MenuWithBottomButtom from '../../components/menu/MenuWithBottomButton.tsx'
import MenuWithBottomButtom from '../../components/menu/MenuWithBottomButton.tsx'
// import MenuTreeWithTopButton from "../../components/menu/MenuTreeWithTopButton.tsx";
// import ListProj from "../../components/list/ListProj.tsx";
// import ListProjAgent from "../../components/list/ListProjAgent.tsx";
@ -1699,7 +1699,7 @@ export default function Index() {
list={agentMenu.list}
handleListItem={agentMenu.handleListItem}
/> */}
{/* <MenuWithBottomButtom
<MenuWithBottomButtom
button={sellMenu.button}
list={sellMenu.list}
handleListItem={sellMenu.handleListItem}
@ -1732,7 +1732,7 @@ export default function Index() {
tradingEndTime={tradingEndTime}
tradingStatus={tradingStatus}
/> */}
/>
{/* <MenuWithTopButton
button={refundMenu.button}
list={refundMenu.list}