单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-08-29 35509af3021b6e56f256b9f8771c1ce5564d7cde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// src/api/api.ts
 
import axios from 'axios';
 
interface SetTimeoutAlertRequest {
    deviceCode: string;
    minutes: number;
    alertText: string;
}
 
interface ApiResponse {
    code: number;
    data: string;
    message: string;
}
 
// const apiBaseUrl = 'https://backend.ihemodialysis.com'; // 替换为你的API基础URL
// const apiBaseUrl = 'https://testbs.ihemodialysis.com'; // 替换为你的API基础URL
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL;
 
export const setTimeoutAlert = async (requestData: SetTimeoutAlertRequest): Promise<ApiResponse> => {
    try {
        const response = await axios.post(`${apiBaseUrl}/patient/hemo/med/record/setTimeoutAlert`, requestData, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        });
        return response.data;
    } catch (error) {
        console.error('Error setting timeout alert:', error);
        throw error;
    }
};
 
export const sendValidateCode = async (requestData): Promise<ApiResponse> => {
    try {
        const response = await axios.post(`${apiBaseUrl}/user/info/sendValidateCodeForRegister`, requestData, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        });
        return response.data;
    } catch (error) {
        console.error('Error setting timeout alert:', error);
        throw error;
    }
};
 
export const registerForNutrition = async (requestData): Promise<ApiResponse> => {
    try {
        const response = await axios.post(`${apiBaseUrl}/user/info/registerForNutrition`, requestData, {
            headers: {
                'Content-Type': 'application/json'
            }
        });
        return response.data;
    } catch (error) {
        console.error('Error setting timeout alert:', error);
        throw error;
    }
};
 
/**
 * 停止定时任务
 * @param deviceCode 
 * @returns 
 */
export const stopTimeoutAlert = async (deviceCode: string) => {
    try {
        const response = await axios.post(`${apiBaseUrl}/patient/hemo/med/record/stopTimeoutAlert`, { deviceCode }, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        });
        return response.data;
    } catch (error) {
        throw error;
    }
}
 
/**
 * 获取副屏最新的版本号Api
 * @returns 
 */
export const getServiceVersionApi = async(version: string) => {
    try {
        const response = await axios.post(`${apiBaseUrl}/system/version/subscreen/showVersionDiff`, { version }, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        });
        return response.data;
    } catch (error) {
        throw error;
    }
}