a
This commit is contained in:
parent
685e12220d
commit
84c1b2889f
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
|
||||
<title>自动交易系统</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -12,28 +12,64 @@
|
|||
.nav-container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 2rem;
|
||||
padding: 0 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.nav-container {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 2rem;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 1.5rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.nav-title {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.nav-links {
|
||||
width: auto;
|
||||
gap: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-links a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 0.5rem 1rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.3s;
|
||||
font-size: 0.9rem;
|
||||
display: block;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.nav-links a {
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-links a:hover {
|
||||
|
|
@ -42,6 +78,13 @@
|
|||
|
||||
.main-content {
|
||||
max-width: 1200px;
|
||||
margin: 1rem auto;
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.main-content {
|
||||
margin: 2rem auto;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,34 @@
|
|||
.config-panel {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.config-panel {
|
||||
padding: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.config-header {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.header-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.header-top {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.guide-link {
|
||||
|
|
@ -33,19 +48,33 @@
|
|||
|
||||
.preset-section {
|
||||
background: #f8f9fa;
|
||||
padding: 1.5rem;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.preset-section {
|
||||
padding: 1.5rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.preset-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.preset-header {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.preset-section h3 {
|
||||
margin: 0;
|
||||
|
|
@ -87,13 +116,19 @@
|
|||
|
||||
.preset-buttons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.preset-buttons {
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.preset-btn {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
border: 2px solid #dee2e6;
|
||||
background: white;
|
||||
|
|
@ -101,6 +136,14 @@
|
|||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
text-align: left;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.preset-btn {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.preset-btn:hover:not(:disabled) {
|
||||
|
|
@ -213,14 +256,98 @@
|
|||
|
||||
.config-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.config-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.config-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
padding: 1rem;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.config-item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.help-btn {
|
||||
padding: 0.25rem 0.75rem;
|
||||
font-size: 0.85rem;
|
||||
background: #2196F3;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.help-btn:hover {
|
||||
background: #1976D2;
|
||||
}
|
||||
|
||||
.help-btn:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.config-detail-popup {
|
||||
background: white;
|
||||
padding: 1rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #dee2e6;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.6;
|
||||
color: #555;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.config-input-wrapper {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.config-input-wrapper input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
padding: 0.5rem 1rem;
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.save-btn:hover:not(:disabled) {
|
||||
background: #45a049;
|
||||
}
|
||||
|
||||
.save-btn:active:not(:disabled) {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.save-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.config-item label {
|
||||
|
|
@ -231,11 +358,21 @@
|
|||
|
||||
.config-item input,
|
||||
.config-item select {
|
||||
padding: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
transition: border-color 0.3s, box-shadow 0.3s;
|
||||
width: 100%;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.config-item input,
|
||||
.config-item select {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.config-item input:focus,
|
||||
|
|
@ -270,7 +407,7 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
cursor: help;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.help-icon {
|
||||
|
|
@ -284,3 +421,36 @@
|
|||
font-size: 1.2rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 移动端优化 */
|
||||
@media (max-width: 767px) {
|
||||
.config-item label {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.config-section h3 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.preset-btn {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.guide-link {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 0.75rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.config-info {
|
||||
font-size: 0.85rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
/* 确保按钮有足够的触摸区域 */
|
||||
button, .help-btn, .save-btn {
|
||||
min-height: 44px;
|
||||
min-width: 44px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
const [value, setValue] = useState(config.value)
|
||||
const [localValue, setLocalValue] = useState(config.value)
|
||||
const [isEditing, setIsEditing] = useState(false)
|
||||
const [showDetail, setShowDetail] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
setValue(config.value)
|
||||
|
|
@ -257,7 +258,7 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
setIsEditing(true)
|
||||
}
|
||||
|
||||
const handleBlur = () => {
|
||||
const handleSave = () => {
|
||||
setIsEditing(false)
|
||||
if (localValue !== value) {
|
||||
// 值发生变化,保存
|
||||
|
|
@ -266,7 +267,7 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
finalValue = parseFloat(localValue) || 0
|
||||
// 百分比配置需要转换
|
||||
if (label.includes('PERCENT')) {
|
||||
finalValue = finalValue / 100
|
||||
finalValue = finalValue
|
||||
}
|
||||
} else if (config.type === 'boolean') {
|
||||
finalValue = localValue === 'true' || localValue === true
|
||||
|
|
@ -275,9 +276,16 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
}
|
||||
}
|
||||
|
||||
const handleBlur = () => {
|
||||
// 移动端不自动保存,需要点击保存按钮
|
||||
if (window.innerWidth > 768) {
|
||||
handleSave()
|
||||
}
|
||||
}
|
||||
|
||||
const handleKeyPress = (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleBlur()
|
||||
handleSave()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -288,7 +296,23 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
if (config.type === 'boolean') {
|
||||
return (
|
||||
<div className="config-item">
|
||||
<div className="config-item-header">
|
||||
<label>{label}</label>
|
||||
{config.description && (
|
||||
<button
|
||||
className="help-btn"
|
||||
onClick={() => setShowDetail(!showDetail)}
|
||||
type="button"
|
||||
>
|
||||
{showDetail ? '收起' : '说明'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{showDetail && (
|
||||
<div className="config-detail-popup">
|
||||
{getConfigDetail(label)}
|
||||
</div>
|
||||
)}
|
||||
<select
|
||||
value={localValue ? 'true' : 'false'}
|
||||
onChange={(e) => {
|
||||
|
|
@ -302,9 +326,8 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
<option value="false">否</option>
|
||||
</select>
|
||||
{config.description && (
|
||||
<span className="description" title={getConfigDetail(label)}>
|
||||
<span className="description">
|
||||
{config.description}
|
||||
<span className="help-icon" title="悬停查看详细说明">ℹ️</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -315,7 +338,23 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
const options = ['1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h', '1d']
|
||||
return (
|
||||
<div className="config-item">
|
||||
<div className="config-item-header">
|
||||
<label>{label}</label>
|
||||
{config.description && (
|
||||
<button
|
||||
className="help-btn"
|
||||
onClick={() => setShowDetail(!showDetail)}
|
||||
type="button"
|
||||
>
|
||||
{showDetail ? '收起' : '说明'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{showDetail && (
|
||||
<div className="config-detail-popup">
|
||||
{getConfigDetail(label)}
|
||||
</div>
|
||||
)}
|
||||
<select
|
||||
value={localValue}
|
||||
onChange={(e) => {
|
||||
|
|
@ -330,9 +369,8 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
))}
|
||||
</select>
|
||||
{config.description && (
|
||||
<span className="description" title={getConfigDetail(label)}>
|
||||
<span className="description">
|
||||
{config.description}
|
||||
<span className="help-icon" title="悬停查看详细说明">ℹ️</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -341,7 +379,24 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
|
||||
return (
|
||||
<div className="config-item">
|
||||
<div className="config-item-header">
|
||||
<label>{label}</label>
|
||||
{config.description && (
|
||||
<button
|
||||
className="help-btn"
|
||||
onClick={() => setShowDetail(!showDetail)}
|
||||
type="button"
|
||||
>
|
||||
{showDetail ? '收起' : '说明'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{showDetail && (
|
||||
<div className="config-detail-popup">
|
||||
{getConfigDetail(label)}
|
||||
</div>
|
||||
)}
|
||||
<div className="config-input-wrapper">
|
||||
<input
|
||||
type={config.type === 'number' ? 'number' : 'text'}
|
||||
value={label.includes('PERCENT') ? displayValue : localValue}
|
||||
|
|
@ -357,11 +412,21 @@ const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
|||
step={config.type === 'number' ? '0.01' : undefined}
|
||||
className={isEditing ? 'editing' : ''}
|
||||
/>
|
||||
{isEditing && <span className="edit-hint">按Enter保存</span>}
|
||||
{isEditing && (
|
||||
<button
|
||||
className="save-btn"
|
||||
onClick={handleSave}
|
||||
disabled={disabled}
|
||||
type="button"
|
||||
>
|
||||
保存
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{isEditing && window.innerWidth > 768 && <span className="edit-hint">按Enter保存</span>}
|
||||
{config.description && (
|
||||
<span className="description" title={getConfigDetail(label)}>
|
||||
<span className="description">
|
||||
{config.description}
|
||||
<span className="help-icon" title="悬停查看详细说明">ℹ️</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,54 @@
|
|||
.dashboard {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.dashboard {
|
||||
padding: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard h2 {
|
||||
margin-bottom: 1rem;
|
||||
color: #2c3e50;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.dashboard h2 {
|
||||
margin-bottom: 2rem;
|
||||
color: #2c3e50;
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.dashboard-grid {
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||
gap: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard-card {
|
||||
background: #f8f9fa;
|
||||
padding: 1.5rem;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.dashboard-card {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard-card h3 {
|
||||
margin-bottom: 1rem;
|
||||
color: #34495e;
|
||||
|
|
@ -36,10 +63,17 @@
|
|||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.5rem 0;
|
||||
align-items: center;
|
||||
padding: 0.75rem 0;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.info-item {
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
|
@ -47,11 +81,26 @@
|
|||
.info-item .label {
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.info-item .label {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.info-item .value {
|
||||
font-weight: bold;
|
||||
color: #2c3e50;
|
||||
font-size: 0.95rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.info-item .value {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.info-item .value.positive {
|
||||
|
|
@ -70,26 +119,52 @@
|
|||
|
||||
.trade-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 1rem;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.75rem;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trade-item {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.75rem;
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.trade-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0.5rem;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trade-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.trade-symbol {
|
||||
font-weight: bold;
|
||||
color: #2c3e50;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trade-symbol {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.trade-side {
|
||||
|
|
@ -111,6 +186,19 @@
|
|||
|
||||
.trade-pnl {
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
text-align: right;
|
||||
padding: 0.5rem;
|
||||
background: #f8f9fa;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trade-pnl {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
|
|
|
|||
|
|
@ -1,20 +1,48 @@
|
|||
.trade-list {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trade-list {
|
||||
padding: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.trade-list h2 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trade-list h2 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-panel {
|
||||
background: #f8f9fa;
|
||||
padding: 1.5rem;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.filter-panel {
|
||||
padding: 1.5rem;
|
||||
margin-bottom: 2rem;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 1.5rem;
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
display: flex;
|
||||
|
|
@ -32,19 +60,35 @@
|
|||
}
|
||||
|
||||
.period-buttons {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.period-buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.period-buttons button {
|
||||
padding: 0.5rem 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 1px solid #ddd;
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: all 0.3s;
|
||||
touch-action: manipulation;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.period-buttons button {
|
||||
padding: 0.5rem 1rem;
|
||||
min-height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.period-buttons button:hover {
|
||||
|
|
@ -60,15 +104,30 @@
|
|||
|
||||
.date-inputs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.date-inputs {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.date-inputs input[type="date"] {
|
||||
padding: 0.75rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.date-inputs input[type="date"] {
|
||||
padding: 0.5rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9rem;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.date-inputs span {
|
||||
|
|
@ -78,27 +137,57 @@
|
|||
|
||||
.filter-section input[type="text"],
|
||||
.filter-section select {
|
||||
padding: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
width: 100%;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.filter-section input[type="text"],
|
||||
.filter-section select {
|
||||
padding: 0.5rem;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-actions {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.filter-actions {
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-primary,
|
||||
.btn-secondary {
|
||||
padding: 0.5rem 1.5rem;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s;
|
||||
touch-action: manipulation;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.btn-primary,
|
||||
.btn-secondary {
|
||||
padding: 0.5rem 1.5rem;
|
||||
min-height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
|
|
@ -128,10 +217,18 @@
|
|||
|
||||
.stats-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.stats-summary {
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
background: #f8f9fa;
|
||||
|
|
@ -164,6 +261,13 @@
|
|||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 1rem;
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trades-table {
|
||||
display: table;
|
||||
}
|
||||
}
|
||||
|
||||
.trades-table th {
|
||||
|
|
@ -172,17 +276,104 @@
|
|||
padding: 1rem;
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.trades-table td {
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.trades-table tr:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
/* 移动端卡片式布局 */
|
||||
.trades-cards {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.trades-cards {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.trade-card {
|
||||
background: #f8f9fa;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.trade-card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
.trade-card-symbol {
|
||||
font-weight: bold;
|
||||
font-size: 1.1rem;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
.trade-card-side {
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.trade-card-side.buy {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.trade-card-side.sell {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.trade-card-body {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.trade-card-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.trade-card-label {
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.trade-card-value {
|
||||
font-weight: 500;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
.trade-card-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 0.75rem;
|
||||
border-top: 1px solid #dee2e6;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.buy {
|
||||
color: #27ae60;
|
||||
font-weight: bold;
|
||||
|
|
|
|||
|
|
@ -204,6 +204,8 @@ const TradeList = () => {
|
|||
{trades.length === 0 ? (
|
||||
<div className="no-data">暂无交易记录</div>
|
||||
) : (
|
||||
<>
|
||||
{/* 桌面端表格 */}
|
||||
<table className="trades-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -236,6 +238,47 @@ const TradeList = () => {
|
|||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{/* 移动端卡片 */}
|
||||
<div className="trades-cards">
|
||||
{trades.map(trade => (
|
||||
<div key={trade.id} className="trade-card">
|
||||
<div className="trade-card-header">
|
||||
<span className="trade-card-symbol">{trade.symbol}</span>
|
||||
<span className={`trade-card-side ${trade.side === 'BUY' ? 'buy' : 'sell'} status ${trade.status}`}>
|
||||
{trade.side === 'BUY' ? '买入' : '卖出'} · {trade.status === 'open' ? '持仓中' : trade.status === 'closed' ? '已平仓' : '已取消'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="trade-card-body">
|
||||
<div className="trade-card-field">
|
||||
<span className="trade-card-label">数量</span>
|
||||
<span className="trade-card-value">{parseFloat(trade.quantity).toFixed(4)}</span>
|
||||
</div>
|
||||
<div className="trade-card-field">
|
||||
<span className="trade-card-label">入场价</span>
|
||||
<span className="trade-card-value">{parseFloat(trade.entry_price).toFixed(4)}</span>
|
||||
</div>
|
||||
<div className="trade-card-field">
|
||||
<span className="trade-card-label">出场价</span>
|
||||
<span className="trade-card-value">{trade.exit_price ? parseFloat(trade.exit_price).toFixed(4) : '-'}</span>
|
||||
</div>
|
||||
<div className="trade-card-field">
|
||||
<span className="trade-card-label">盈亏</span>
|
||||
<span className={`trade-card-value ${parseFloat(trade.pnl) >= 0 ? 'positive' : 'negative'}`}>
|
||||
{parseFloat(trade.pnl).toFixed(2)} USDT
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="trade-card-footer">
|
||||
<span>{new Date(trade.entry_time).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}</span>
|
||||
{trade.exit_time && (
|
||||
<span>平仓: {new Date(trade.exit_time).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,20 @@ body {
|
|||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
background-color: #f5f5f5;
|
||||
/* 移动端优化 */
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
/* 移动端全局样式优化 */
|
||||
@media (max-width: 767px) {
|
||||
* {
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
input, select, textarea, button {
|
||||
font-size: 16px; /* 防止iOS自动缩放 */
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user