This commit is contained in:
aaron 2025-05-23 12:17:14 +08:00
parent 38c8cc8d87
commit 9f70d8ace7
2 changed files with 132 additions and 1 deletions

View File

@ -5,7 +5,7 @@ services:
build:
context: .
dockerfile: Dockerfile
image: tradus-web:1.3.5
image: tradus-web:1.3.6
container_name: tradus-web
ports:
- '6000:80'

View File

@ -25,6 +25,16 @@ const currentThought = ref('')
const showInitialView = ref(true)
const copySuccess = ref(false)
// 使
const timeframeOptions = [
{ value: '15m', label: '15分钟' },
{ value: '1h', label: '1小时' },
{ value: '4h', label: '4小时' },
{ value: '1d', label: '1天' },
{ value: '1w', label: '1周' },
]
const selectedTimeframe = ref('1d') // 1
// APIURL
const apiBaseUrl =
import.meta.env.MODE === 'development' ? 'http://127.0.0.1:8000' : 'https://api.ibtc.work'
@ -146,6 +156,7 @@ const handleAnalysis = async () => {
//
const requestData = {
symbol: code.toUpperCase(),
timeframe: selectedTimeframe.value,
}
response = await http.post(`${apiBaseUrl}/crypto/analysis_v2`, requestData)
}
@ -247,6 +258,8 @@ const resetView = () => {
analysisContent.value = ''
currentThought.value = ''
isAnalyzing.value = false
//
selectedTimeframe.value = '1d'
}
//
@ -345,6 +358,24 @@ const parsedContent = computed(() => {
</svg>
</button>
</div>
<!-- 加密货币模式下的时间周期选择 -->
<div v-if="!isStockMode" class="timeframe-selector">
<label class="timeframe-label">选择时间周期:</label>
<div class="timeframe-options">
<button
v-for="option in timeframeOptions"
:key="option.value"
class="timeframe-option"
:class="{ active: selectedTimeframe === option.value }"
@click="selectedTimeframe = option.value"
:disabled="isAnalyzing"
>
{{ option.label }}
</button>
</div>
</div>
<button
class="analyze-button"
@click="handleAnalysis"
@ -384,6 +415,8 @@ const parsedContent = computed(() => {
<div class="target-info">
<span class="label">正在分析</span>
<span class="value">{{ symbolCode.toUpperCase() }}</span>
<span v-if="!isStockMode" class="label timeframe-info">周期</span>
<span v-if="!isStockMode" class="value">{{ selectedTimeframe }}</span>
</div>
<div class="action-buttons" v-if="!isAnalyzing">
<button class="action-button" @click="resetView">
@ -1015,6 +1048,104 @@ const parsedContent = computed(() => {
text-align: center;
}
}
.timeframe-selector {
display: flex;
flex-direction: column;
margin-bottom: 0.75rem;
margin-top: 0.5rem;
align-items: flex-start;
width: 100%;
}
.timeframe-label {
font-size: 0.85rem;
color: var(--color-text-secondary);
margin-bottom: 0.5rem;
white-space: nowrap;
}
.timeframe-options {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
width: 100%;
}
.timeframe-option {
padding: 0.4rem 0.75rem;
font-size: 0.85rem;
background-color: var(--color-bg-secondary);
border: 1px solid var(--color-border);
border-radius: var(--border-radius);
color: var(--color-text-secondary);
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
}
.timeframe-option:hover:not(:disabled) {
border-color: var(--color-accent);
color: var(--color-accent);
}
.timeframe-option.active {
background-color: var(--color-accent);
color: white;
border-color: var(--color-accent);
}
.timeframe-option:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.timeframe-info {
margin-left: 1rem;
white-space: nowrap;
}
@media (max-width: 768px) {
.timeframe-options {
gap: 0.4rem;
}
.timeframe-option {
padding: 0.35rem 0.6rem;
font-size: 0.8rem;
}
}
@media (max-width: 480px) {
.timeframe-label {
font-size: 0.8rem;
}
.timeframe-options {
gap: 0.3rem;
justify-content: flex-start;
}
.timeframe-option {
padding: 0.3rem 0.5rem;
font-size: 0.75rem;
flex: none;
text-align: center;
}
.target-info {
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
padding-bottom: 0.5rem;
width: 100%;
}
.target-info .label,
.target-info .value {
white-space: nowrap;
}
}
</style>
<style>