diff --git a/._src b/._src
deleted file mode 100644
index 2043f67..0000000
Binary files a/._src and /dev/null differ
diff --git a/index.html b/index.html
index 5ce5602..8f4564b 100644
--- a/index.html
+++ b/index.html
@@ -1,7 +1,7 @@
- API调试工具
+ TsumugiBoshi|纺星
@@ -25,8 +25,16 @@
}
#root {
flex: 1;
+ display: flex;
+ flex-direction: column;
+ }
+ pre {
+ background: #f5f5f5;
+ padding: 10px;
+ border-radius: 4px;
+ font-size: 14px;
+ overflow-x: auto;
}
- pre { background: #f5f5f5; padding: 10px; border-radius: 4px; }
.api-description {
margin: 8px 0 16px !important;
color: #666;
@@ -36,6 +44,7 @@
padding: 12px;
border-radius: 4px;
border-left: 4px solid #1976d2;
+ font-size: 0.9rem;
}
.selected-backend { font-weight: bold; color: #1976d2; }
.scrollable-tabs {
@@ -63,13 +72,37 @@
font-size: 0.875rem;
color: #666;
}
+ .backend-selector {
+ margin-top: 2rem;
+ padding: 1.5rem;
+ background-color: #f8f9fa;
+ border-radius: 4px;
+ }
@media (max-width: 600px) {
.MuiContainer-root {
- padding: 12px !important;
+ padding: 8px !important;
}
.MuiPaper-root {
padding: 12px !important;
}
+ .MuiTypography-h4 {
+ font-size: 1.5rem !important;
+ }
+ .MuiTypography-h6 {
+ font-size: 1.1rem !important;
+ }
+ .MuiTab-root {
+ min-height: 48px !important;
+ padding: 6px 12px !important;
+ font-size: 0.8rem !important;
+ }
+ .MuiInputBase-input {
+ font-size: 0.9rem !important;
+ }
+ .backend-selector {
+ margin-top: 1rem;
+ padding: 1rem;
+ }
h4.MuiTypography-root {
font-size: 1.5rem;
}
@@ -87,7 +120,7 @@
@@ -367,97 +400,14 @@
return (
- {/* 后端地址选择器 */}
-
- 选择后端地址
-
-
-
-
- {/* 添加自定义后端对话框 */}
-
- {/* Snackbar 提示 */}
-
-
- {snackbarMessage}
-
-
-
- API调试工具
+ 💫TsumugiBoshi
+
+
+ 神秘API调试工具
+ {/* API表单部分 */}
@@ -523,19 +473,78 @@
{response && (
-
+
响应结果:
{response}
)}
+
+ {/* 移动后端选择器到底部 */}
+
+
+ 后端设置
+
+
+ 选择后端地址
+
+
+
+
);
diff --git a/src/components/ApiTabs.js b/src/components/ApiTabs.js
deleted file mode 100644
index 061c580..0000000
--- a/src/components/ApiTabs.js
+++ /dev/null
@@ -1,228 +0,0 @@
-import React from 'react';
-import {
- Tabs,
- Tab,
- TextField,
- Button,
- Paper,
- Typography,
- Grid,
- Box,
- Select,
- MenuItem,
- InputLabel,
- FormControl,
- Dialog,
- DialogTitle,
- DialogContent,
- DialogActions,
- Snackbar,
- Alert,
- Radio,
- RadioGroup,
- FormControlLabel
-} from '@mui/material';
-import { setCookie } from '../utils/cookies';
-
-function ApiTabs({
- tabValue,
- setTabValue,
- qrInput,
- setQrInput,
- userId,
- setUserId,
- response,
- setResponse,
- musicData,
- setMusicData,
- apiBase,
- setApiBase,
- backends,
- setBackends,
- isDialogOpen,
- setIsDialogOpen,
- newBackend,
- setNewBackend,
- snackbarOpen,
- setSnackbarOpen,
- snackbarMessage,
- setSnackbarMessage
-}) {
- const handleTabChange = (event, newValue) => {
- setTabValue(newValue);
- };
-
- const handleUserIdChange = (event) => {
- const value = event.target.value;
- setUserId(value);
- setCookie('userId', value);
- setMusicData(prev => ({ ...prev, userId: parseInt(value) || 0 }));
- };
-
- const handleBackendChange = (event) => {
- const value = event.target.value;
- setApiBase(value);
- localStorage.setItem('apiBase', value);
- };
-
- const handleAddBackend = () => {
- if (!newBackend.label || !newBackend.value) {
- setSnackbarMessage('请填写完整的后端信息');
- setSnackbarOpen(true);
- return;
- }
-
- const updatedBackends = [...backends, newBackend];
- setBackends(updatedBackends);
- localStorage.setItem('customBackends', JSON.stringify(
- updatedBackends.slice(PRESET_BACKENDS.length)
- ));
- setIsDialogOpen(false);
- setNewBackend({ label: '', value: '' });
- };
-
- return (
- <>
-
-
- API调试工具
-
-
-
-
-
-
-
-
-
-
- 后端环境
-
-
-
-
-
- {tabValue === 0 && (
-
- setQrInput(e.target.value)}
- variant="outlined"
- />
-
- )}
-
- {tabValue === 1 && (
-
-
- {Object.entries(musicData.music).map(([key, value]) => (
-
- {
- const newValue = parseInt(e.target.value) || 0;
- setMusicData(prev => ({
- ...prev,
- music: {
- ...prev.music,
- [key]: newValue
- }
- }));
- }}
- variant="outlined"
- />
-
- ))}
-
-
- )}
-
- {response && (
-
-
- 响应结果
-
- {JSON.stringify(response, null, 2)}
-
- )}
-
-
-
-
-
- setSnackbarOpen(false)}
- >
- setSnackbarOpen(false)}
- severity="error"
- sx={{ width: '100%' }}
- >
- {snackbarMessage}
-
-
- >
- );
-}
-
-export default ApiTabs;
\ No newline at end of file
diff --git a/src/components/App.js b/src/components/App.js
deleted file mode 100644
index 2d8c45a..0000000
--- a/src/components/App.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import React, { useState } from 'react';
-import { Container, Typography } from '@mui/material';
-import { createTheme, ThemeProvider } from '@mui/material/styles';
-import ApiTabs from './ApiTabs';
-import { PRESET_BACKENDS } from '../constants';
-import { getCookie, setCookie } from '../utils/cookies';
-
-const theme = createTheme();
-
-function App() {
- const [tabValue, setTabValue] = useState(0);
- const [qrInput, setQrInput] = useState('');
- const [userId, setUserId] = useState(getCookie('userId') || '');
- const [response, setResponse] = useState('');
- const [musicData, setMusicData] = useState({
- userId: parseInt(userId) || 0,
- music: {
- musicId: 0,
- level: 0,
- achievement: 0,
- playCount: 0,
- comboStatus: 0,
- syncStatus: 0,
- deluxscoreMax: 0,
- scoreRank: 0
- }
- });
- const [apiBase, setApiBase] = useState(
- localStorage.getItem('apiBase') || PRESET_BACKENDS[0].value
- );
- const [backends, setBackends] = useState([
- ...PRESET_BACKENDS,
- ...JSON.parse(localStorage.getItem('customBackends') || '[]')
- ]);
- const [isDialogOpen, setIsDialogOpen] = useState(false);
- const [newBackend, setNewBackend] = useState({ label: '', value: '' });
- const [snackbarOpen, setSnackbarOpen] = useState(false);
- const [snackbarMessage, setSnackbarMessage] = useState('');
-
- return (
-
-
-
-
- );
-}
-
-export default App;
\ No newline at end of file
diff --git a/src/constants/index.js b/src/constants/index.js
deleted file mode 100644
index c76a669..0000000
--- a/src/constants/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export const PRESET_BACKENDS = [
- { label: "开发环境", value: "http://dev-api.example.com" },
- { label: "测试环境", value: "http://test-api.example.com" },
- { label: "生产环境", value: "http://api.example.com" }
-];
\ No newline at end of file
diff --git a/src/styles/main.css b/src/styles/main.css
deleted file mode 100644
index 16f5522..0000000
--- a/src/styles/main.css
+++ /dev/null
@@ -1,85 +0,0 @@
-body {
- margin: 0;
- font-family: Arial, sans-serif;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
-}
-
-#root {
- flex: 1;
-}
-
-pre {
- background: #f5f5f5;
- padding: 10px;
- border-radius: 4px;
-}
-
-.api-description {
- margin: 8px 0 16px !important;
- color: #666;
- white-space: pre-line;
- line-height: 1.5;
- background-color: #f8f9fa;
- padding: 12px;
- border-radius: 4px;
- border-left: 4px solid #1976d2;
-}
-
-.selected-backend {
- font-weight: bold;
- color: #1976d2;
-}
-
-.scrollable-tabs {
- max-width: calc(100% - 48px);
- overflow-x: auto;
- overflow-y: hidden;
-}
-
-.tabs-container {
- display: flex;
- align-items: center;
- position: relative;
- border-bottom: 1px solid rgba(0, 0, 0, 0.12);
-}
-
-.menu-button {
- position: absolute !important;
- right: 0;
- top: 50%;
- transform: translateY(-50%);
-}
-
-footer {
- margin-top: auto;
- padding: 16px;
- background-color: #f5f5f5;
- text-align: center;
- font-size: 0.875rem;
- color: #666;
-}
-
-@media (max-width: 600px) {
- .MuiContainer-root {
- padding: 12px !important;
- }
-
- .MuiPaper-root {
- padding: 12px !important;
- }
-
- h4.MuiTypography-root {
- font-size: 1.5rem;
- }
-
- .scrollable-tabs::-webkit-scrollbar {
- display: none;
- }
-
- .api-description {
- font-size: 0.875rem;
- padding: 8px;
- }
-}
\ No newline at end of file
diff --git a/src/utils/cookies.js b/src/utils/cookies.js
deleted file mode 100644
index 80b1a48..0000000
--- a/src/utils/cookies.js
+++ /dev/null
@@ -1,21 +0,0 @@
-export function setCookie(name, value, days = 30) {
- const d = new Date();
- d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
- const expires = `expires=${d.toUTCString()}`;
- document.cookie = `${name}=${value};${expires};path=/`;
-}
-
-export function getCookie(name) {
- const nameEQ = `${name}=`;
- const ca = document.cookie.split(';');
- for (let i = 0; i < ca.length; i++) {
- let c = ca[i];
- while (c.charAt(0) === ' ') c = c.substring(1, c.length);
- if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
- }
- return null;
-}
-
-export function deleteCookie(name) {
- document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/`;
-}
\ No newline at end of file