feat:1. 调整项目结构,将API接口定义单独抽离 2. 将倒计时计算逻辑调整到后端进行处理计算 3. 增加铃声提示功能
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user