From 858464028263de5377a6bbe52590b7739fd1238f Mon Sep 17 00:00:00 2001 From: claw_bot Date: Fri, 13 Mar 2026 10:12:59 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E7=BC=96=E8=AF=91=EF=BC=8C=E4=B8=93=E6=B3=A8=E4=BA=8E?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - config.vue: 使用原生picker替代u-picker,删除不需要的代码 - detail.vue: 使用原生input和picker,恢复搜索功能 - 添加form-input样式,统一输入框外观 - 移除所有条件编译,简化代码结构 --- pages/config/config.vue | 72 ++------------------------------------ pages/detail/detail.vue | 76 +++++++++++++++-------------------------- 2 files changed, 29 insertions(+), 119 deletions(-) diff --git a/pages/config/config.vue b/pages/config/config.vue index 20f0e4a..6164d3b 100755 --- a/pages/config/config.vue +++ b/pages/config/config.vue @@ -23,27 +23,8 @@ 选择逻辑模板 - - - - - - {{ selectedStrategy.name }} - - 点击选择逻辑规则 - - - - - - + {{ selectedStrategy.name }} @@ -52,34 +33,17 @@ - {{ selectedStrategy.desc }} 组合币种 - - - - {{ currencyList[currencyIndex].name }} - - - - - - + {{ currencyList[currencyIndex].name }} - 创建后币种不可修改,所有交易只能使用该币种 @@ -210,14 +174,9 @@ const currencyList = ref([ ]); const currencyIndex = ref(0); // 默认CNY -// Picker 控制变量 -const showStrategyPicker = ref(false); -const showCurrencyPicker = ref(false); - // 小程序原生 picker 事件处理 const onStrategyChange = (e) => { strategyIndex.value = e.detail.value; - showStrategyPicker.value = false; // 调用原有的策略变更逻辑 const strategy = strategies.value[strategyIndex.value]; @@ -235,7 +194,6 @@ const onStrategyChange = (e) => { const onCurrencyChange = (e) => { currencyIndex.value = e.detail.value; - showCurrencyPicker.value = false; }; // 防止重复请求的标志 @@ -346,32 +304,6 @@ const onDateChange = (e, index) => { form.value.stocks[index].date = e.detail.value; }; -// u-picker 确认方法 -const onStrategyPickerConfirm = (e) => { - const { value, index } = e; - strategyIndex.value = index[0]; - showStrategyPicker.value = false; - - // 调用原有的策略变更逻辑 - const strategy = strategies.value[strategyIndex.value]; - if (strategy && strategy.parameters && strategy.parameters.assets) { - form.value.stocks = strategy.parameters.assets.map(asset => ({ - name: asset.symbol, - price: '', - amount: '', - date: '' - })); - } else { - form.value.stocks = [{ name: '', price: '', amount: '', date: '' }]; - } -}; - -const onCurrencyPickerConfirm = (e) => { - const { value, index } = e; - currencyIndex.value = index[0]; - showCurrencyPicker.value = false; -}; - const submitForm = async () => { if (!form.value.name) { proxy?.$refs.uToastRef?.show({ diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 82852e6..150ac6a 100755 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -249,32 +249,14 @@ {{ transactionType === 'sell' ? '选择持仓' : '股票代码' }} - - - - - - - - 数量{{ transactionType === 'sell' && maxSellAmount > 0 ? ` (最多可卖 ${maxSellAmount} 份)` : '' }} - 价格 - 交易时间 - - - - {{ transactionForm.transactionDate || '请选择日期' }} - - - - - {{ transactionForm.transactionDate || '请选择日期' }} - @@ -464,7 +429,6 @@ const searchResults = ref([]); const searchTimer = ref(null); const handleStockInputClick = () => { - // #ifdef H5 || APP-PLUS if (transactionType.value === 'sell') { searchResults.value = positions.value.map(pos => ({ ticker: pos.stockCode, @@ -480,14 +444,9 @@ const handleStockInputClick = () => { }; const onStockInput = (e) => { - // #ifdef H5 || APP-PLUS const keyword = e.detail.value; console.log('🔍 股票输入:', keyword); searchStock(keyword); - // #endif - // #ifdef MP-WEIXIN - // 小程序中不触发搜索,直接输入代码 - // #endif }; const searchStock = async (keyword) => { @@ -961,9 +920,28 @@ const deletePortfolio = async () => { margin-bottom: 12rpx; } -/* .stock-input 已替换为 u-input,样式已通过 customStyle 设置 */ .stock-input { - /* 样式已内联设置 */ + width: 100%; + height: 80rpx; + background-color: #F9FAFB; + border: 2rpx solid #E5E7EB; + border-radius: 16rpx; + padding: 0 20rpx; + font-size: 28rpx; + color: #1F2937; + box-sizing: border-box; +} + +.form-input { + width: 100%; + height: 80rpx; + background-color: #F9FAFB; + border: 2rpx solid #E5E7EB; + border-radius: 16rpx; + padding: 0 20rpx; + font-size: 28rpx; + color: #1F2937; + box-sizing: border-box; } .form-select {