From 2ffb9f460e73eb28980c7d19b7cec417c942f750 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期日, 22 十二月 2024 17:58:51 +0800 Subject: [PATCH] 一次性同步测试 --- src/utils/request.ts | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 2e36c56..dd0ad55 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -8,6 +8,7 @@ import { debounce, decodeFormData } from './util'; import { AUTH_URL, MAIN_URL, SECONDARY_URL } from '/@/constants'; import { Local, LoginInfo, Session } from '/@/utils/storage'; +import { isSharePage } from '../stores/chatRoom'; // import JSONbig from 'json-bigint'; //#region ====================== 鍚庣 res.err_code ====================== @@ -48,7 +49,7 @@ // 灏� token 娣诲姞鍒拌姹傛姤鏂囧ご涓� config.headers['hswatersession'] = accessSession; } - if (!NO_AUTH_API_LIST.includes(config.url)) { + if (!NO_AUTH_API_LIST.includes(config.url) && !isSharePage.value) { if (!accessSession && config.url !== LOGIN_URL && config.url !== TEL_LOGIN_URL) { handleNoAuth(config.url); throw '鏉冮檺楠岃瘉澶辫触'; @@ -88,7 +89,7 @@ if (!serveData.json_ok) { switch (serveData?.err_code) { case ErrorCode.Auth: - if (res.config.url !== LOGIN_URL && res.config.url !== TEL_LOGIN_URL) { + if (res.config.url !== LOGIN_URL && res.config.url !== TEL_LOGIN_URL && !isSharePage.value) { handleNoAuth(); throw '鏉冮檺楠岃瘉澶辫触'; } @@ -132,13 +133,14 @@ return axios.create({ baseURL: MAIN_URL, timeout: 1200000, - headers: { 'Content-Type': 'application/json;charset=utf-8 ' }, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, ...option, }); }; const service = createAxiosInstance(); - export const mainRequest = service; //#region ====================== 娴佸搷搴旀暟鎹� ====================== @@ -147,7 +149,6 @@ responseType: 'stream', }); const decoder = new TextDecoder(); -const encoder = new TextEncoder(); const readStream = async (stream: ReadableStream, cb: (value) => void): Promise<any> => { const reader = stream.getReader(); let lastValue = ''; @@ -161,12 +162,11 @@ // const txt = decoder.decode(Uint8Array.from([...lastValue, ...value])); const txt = decoder.decode(value); const txtArr = txt.split('\n'); - txtArr[0] =lastValue+ txtArr[0] + txtArr[0] = lastValue + txtArr[0]; txtArr.forEach((value, index, array) => { // 涓�鑸笉浼氬嚭鐜拌繛缁崲琛岋紝鍙彲鑳芥渶鍚庝竴涓槸鎹㈣ if (index === array.length - 1) { - lastValue =value; - + lastValue = value; } else { const decodeValue = decodeURIComponent(value); fullValue += decodeValue; -- Gitblit v1.9.3