test: 添加 API 测试页面并更新环境变量

- 新增 index.html 文件,用于测试 API 接口
- 更新 .env.production 文件,保持 API 基础 URL 不变
- 在 .gitignore 中添加 .aider* 目录忽略项
- 删除 path/to/filename.js 文件
This commit is contained in:
ikmkj
2025-08-04 19:45:45 +08:00
parent 6fdc3a491c
commit b3509866dd
4 changed files with 44 additions and 3 deletions

3
.gitignore vendored
View File

@@ -62,4 +62,5 @@ yarn-error.log*
*.sln
dist/
npm-debug.log
.vscode/
.vscode/
.aider*

View File

@@ -1 +1 @@
VITE_API_BASE_URL=https://biji-houdaun.311169.xyz
VITE_API_BASE_URL=https://biji-houdaun.311169.xyz

41
index.html Normal file
View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Test</title>
</head>
<body>
<button id="ipv4Btn">ipv4</button>
<button id="ipv6Btn">ipv6</button>
<div id="result"></div>
<script>
const ipv4Btn = document.getElementById('ipv4Btn');
const ipv6Btn = document.getElementById('ipv6Btn');
const resultDiv = document.getElementById('result');
const fetchData = async (url, buttonText) => {
try {
const response = await fetch(url);
const data = await response.json();
if (data.code === 200) {
resultDiv.textContent = `"${buttonText}" 请求成功`;
} else {
resultDiv.textContent = `"${buttonText}" 请求失败: ${data.msg}`;
}
} catch (error) {
resultDiv.textContent = `"${buttonText}" 请求出错: ${error}`;
}
};
ipv4Btn.addEventListener('click', () => {
fetchData('https://biji.ikmkj.dpdns.org/api/groupings', 'ipv4');
});
ipv6Btn.addEventListener('click', () => {
fetchData('https://biji-houdaun.311169.xyz/api/groupings', 'ipv6');
});
</script>
</body>
</html>

View File

@@ -1 +0,0 @@
// 文件内容