From 924ac095350193f1fc0fa4138ec1aca79ccc1051 Mon Sep 17 00:00:00 2001 From: claw_bot Date: Fri, 13 Mar 2026 06:32:46 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AD=96=E7=95=A5=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=82=A1=E7=A5=A8=E6=90=9C=E7=B4=A2=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将u-input替换为原生input,解决事件参数问题 - 添加onStockInput方法正确处理input事件 - 添加调试日志便于排查再平衡策略资产加载问题 --- pages/strategies/edit/edit.vue | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/pages/strategies/edit/edit.vue b/pages/strategies/edit/edit.vue index 4c65edf..13d66a3 100755 --- a/pages/strategies/edit/edit.vue +++ b/pages/strategies/edit/edit.vue @@ -146,12 +146,11 @@ 代码 - @@ -302,10 +301,16 @@ const formData = ref({ const searchResults = ref([]); const activeAssetIndex = ref(-1); const searchTimer = ref(null); + +const onStockInput = (e, assetIndex) => { + const keyword = e.detail.value; + console.log('🔍 策略页面股票输入:', keyword, 'assetIndex:', assetIndex); + searchStock(keyword, assetIndex); +}; + const searchStock = async (keyword, assetIndex) => { - // 防抖 + console.log('🔍 searchStock 调用:', keyword, 'assetIndex:', assetIndex); if (searchTimer.value) clearTimeout(searchTimer.value); - // 赋值当前激活的搜索下标 activeAssetIndex.value = assetIndex; if (!keyword || keyword.length < 1) { searchResults.value = []; @@ -315,7 +320,9 @@ const searchStock = async (keyword, assetIndex) => { searchTimer.value = setTimeout(async () => { try { + console.log('📤 调用 api.ticker.search:', keyword); const res = await api.ticker.search(keyword); + console.log('📥 搜索结果:', res); if (res.code === 200) { searchResults.value = res.data.map(item => ({ ...item, @@ -520,6 +527,8 @@ const loadStrategyDetail = async (id) => { // 兼容旧格式 params = JSON.parse(data.config); } + console.log('📊 策略类型:', data.type, '参数:', params); + switch (data.type) { case 'ma_trend': formData.value.maType = params.maType || 'SMA'; @@ -529,11 +538,13 @@ const loadStrategyDetail = async (id) => { case 'risk_parity': formData.value.lookbackPeriod = params.lookbackPeriod?.toString() || ''; formData.value.rebalanceThreshold = params.rebalanceThreshold?.toString() || ''; + console.log('📊 再平衡策略 assets:', params.assets); if (params.assets && params.assets.length > 0) { formData.value.assets = params.assets.map(asset => ({ symbol: asset.symbol || '', targetWeight: asset.targetWeight?.toString() || '' })); + console.log('📊 填充后的 formData.assets:', formData.value.assets); } break; case 'chandelier_exit': @@ -850,6 +861,17 @@ onMounted(() => { font-weight: 600; } +.stock-input { + width: 100%; + height: 72rpx; + background-color: #F9FAFB; + border-radius: 16rpx; + padding: 0 20rpx; + font-size: 26rpx; + color: #1F2937; + box-sizing: border-box; +} + /* 搜索下拉列表 */ .relative { position: relative;