feat:1. 调整项目结构,将API接口定义单独抽离 2. 将倒计时计算逻辑调整到后端进行处理计算 3. 增加铃声提示功能

This commit is contained in:
2025-07-26 12:53:33 +08:00
parent 07bf872149
commit 4faf2db730
6 changed files with 206 additions and 135 deletions
+6 -3
View File
@@ -1,7 +1,7 @@
import axios from 'axios';
import { ElMessage } from "element-plus";
const basic_url = "http://localhost:8081";
const basic_url = "http://localhost:5157";
const axiosInstance = axios.create({
baseURL: basic_url,
@@ -27,12 +27,15 @@ const validateResponse = (res: any) => {
return result;
};
const get = (url: string, params: {}) => {
function get(url: string, params: Record<string, any>): Promise<any>;
function get(url: string): Promise<any>;
function get(url: string, params: Record<string, any> = {}) {
console.log("开始GET请求", basic_url + url, "参数:", params);
return axiosInstance.get(url, { params })
.then(validateResponse)
.catch(handleError);
};
}
const post = (url: string, data: any = null, config: any = {}) => {
console.log("开始POST请求", url, "参数:", data, "配置:", config);