diff --git a/src/utils/request.ts b/src/utils/request.ts index 81d0d08..7c6cb3f 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -39,10 +39,13 @@ export function getRequest(url: string, params: object) { * @returns {Promise} - 返回一个 Promise 对象,包含 response 数据或 error 信息 */ export function postRequest(url: string, data: object) { - return fetch('http://localhost:8088' + url, { + return fetch('http://127.0.0.1:8088' + url, { method: 'POST', headers: { 'Content-Type': 'application/json', + 'sec-ch-ua-mobile': '', + 'User-Agent': '', + 'sec-ch-ua': '' }, body: JSON.stringify(data), }) @@ -154,6 +157,7 @@ export function uploadFile(url: string, formData: any) { return fetch(url, { method: 'POST', body: formData, + mode:"cors" }) .then(response => { if (!response.ok) { throw new Error('上传失败'); }