chenyc
2025-08-07 2191b6011fdab3b76344fc2447b8b6aaa972b6c1
加入完整日志
2个文件已修改
10 ■■■■■ 已修改文件
src/samples/httpApi.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/axios.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/samples/httpApi.ts
@@ -16,7 +16,7 @@
        queryCode:codeStr
    }
    getPatientInfo2(mode).then(re=>{
        ipcRenderer.invoke('logger', `获取患者数据成功:${JSON.stringify(re.data)}`)
        ipcRenderer.invoke('logger', `获取患者数据成功:${JSON.stringify(re)}`)
        writePatient(re.data)
    }).catch(err=>{
        ipcRenderer.invoke('logger', `获取患者数据失败:${err}`)
src/utils/axios.ts
@@ -1,10 +1,10 @@
import axios, {AxiosError, AxiosResponse} from 'axios'
import { Session } from '@/utils/storage'
import { ElMessage } from 'element-plus'
import { confingInfoStore } from '@/stores/StoresConfing'
import { ipcRenderer } from 'electron'
let BASE_URL = 'http://testbs.ihemodialysis.com'
// let BASE_URL = 'https://hemobs.icoldchain.cn'
let BASE_URL = 'https://hemobs.icoldchain.cn'
const TIME_OUT = 10 * 1000
// setTimeout(()=>{
@@ -42,6 +42,7 @@
        if (Session.get('token')) {
            response.headers.common['Authorization'] = 'Bearer '+ `${Session.get('token')}`
        }
        ipcRenderer.invoke('logger', `http请求参数:${JSON.stringify(response)}`)
        return response
    },
    (error) => Promise.reject(error)
@@ -50,6 +51,7 @@
// 后置拦截器(获取到响应时的拦截)
instance.interceptors.response.use(
    (res: AxiosResponse) => {
        ipcRenderer.invoke('logger', `http响应参数:${JSON.stringify(res)}`)
        if (String(res.status).indexOf('2') !== 0) {
            return {
                code: res.status,