“优化了持仓页面”

This commit is contained in:
Sebastian
2026-04-20 16:51:10 +08:00
parent b582cd8bf2
commit ae6d77e363
5 changed files with 981 additions and 1165 deletions

File diff suppressed because one or more lines are too long

View File

@@ -522,7 +522,6 @@
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.26.tgz",
"integrity": "sha512-xJWM9KH1kd201w5DvMDOwDHYhrdPTrAatn56oB/LRG4plEQeZRQLw0Bpwih9KYoqmzaxF0OKSn6swzYi84e1/Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/reactivity": "3.5.26",
"@vue/shared": "3.5.26"
@@ -635,7 +634,6 @@
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.6.0.tgz",
"integrity": "sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"tslib": "2.3.0",
"zrender": "5.6.1"
@@ -1031,7 +1029,6 @@
"integrity": "sha512-+v57oAaoYNnO3hIu5Z/tJRZjq5aHM2zDve9YZ8HngVHbhk66RStobhb1sqPMIPEleV6cNKYK4eGrAbE9Ulbl2g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.18.10",
"postcss": "^8.4.27",
@@ -1087,7 +1084,6 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.26.tgz",
"integrity": "sha512-SJ/NTccVyAoNUJmkM9KUqPcYlY+u8OVL1X5EW9RIs3ch5H2uERxyyIUI4MRxVCSOiEcupX9xNGde1tL9ZKpimA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.26",
"@vue/compiler-sfc": "3.5.26",

View File

@@ -38,16 +38,9 @@
<button
class="mode-btn"
:class="{ active: viewMode === 'realtime' }"
@click="viewMode = 'realtime'"
@click="viewMode = 'portfolio'"
>
📊 实时估值
</button>
<button
class="mode-btn"
:class="{ active: viewMode === 'positions' }"
@click="viewMode = 'positions'"
>
💼 我的持仓
📊 估值与持仓
</button>
</div>
</div>
@@ -97,8 +90,8 @@
<!-- 其他模式 -->
<div v-else class="main-layout">
<!-- 左侧自选列表 (筛选和实时估值模式不显示) -->
<aside class="sidebar-left" v-if="viewMode !== 'screening' && viewMode !== 'realtime'">
<!-- 左侧自选列表 (筛选和估值持仓看板模式不显示) -->
<aside class="sidebar-left" v-if="viewMode !== 'screening' && viewMode !== 'portfolio'">
<FundWatchlist
@view-fund="handleFundSelected"
@add-to-compare="handleAddToCompare"
@@ -110,7 +103,7 @@
</aside>
<!-- 右侧根据模式显示不同内容 -->
<div class="content-area" :class="{ 'full-width': viewMode === 'screening' || viewMode === 'realtime' }">
<div class="content-area" :class="{ 'full-width': viewMode === 'screening' || viewMode === 'portfolio' }">
<!-- 筛选模式 -->
<template v-if="viewMode === 'screening'">
<FundScreening
@@ -118,6 +111,11 @@
@add-to-compare="handleAddToCompare"
/>
</template>
<!-- 估值与持仓一体化看板 -->
<template v-else-if="viewMode === 'portfolio'">
<FundRealtime @view-detail="handleRealtimeFundView" />
</template>
<!-- 回测模式 -->
<template v-else-if="viewMode === 'backtest'">
@@ -126,11 +124,6 @@
/>
</template>
<!-- 我的持仓模式 -->
<template v-else-if="viewMode === 'positions'">
<MyPositions />
</template>
<!-- 详情模式 -->
<template v-else>
<FundSearch @fund-selected="handleFundSelected" />
@@ -163,7 +156,6 @@ import FundRealtime from './components/FundRealtime.vue'
import MarketOverview from './components/MarketOverview.vue'
import FlashNews from './components/FlashNews.vue'
import SectorRank from './components/SectorRank.vue'
import MyPositions from './components/MyPositions.vue'
export default {
name: 'App',
@@ -177,8 +169,7 @@ export default {
FundRealtime,
MarketOverview,
FlashNews,
SectorRank,
MyPositions
SectorRank
},
setup() {
const selectedFundCode = ref('')
@@ -229,6 +220,13 @@ export default {
selectedFundCode.value = fundCode
viewMode.value = 'dashboard'
}
// 从估值卡片点击后跳转到基金详情(大盘页布局)
const handleRealtimeFundView = (fundOrCode) => {
compareMode.value = false
viewMode.value = 'dashboard'
handleFundSelected(fundOrCode)
}
// 添加基金到对比列表
const handleAddToCompare = (fund) => {
@@ -292,6 +290,7 @@ export default {
handleHeaderSearch,
handleDashboardFundView,
handleScreeningFundView,
handleRealtimeFundView,
handleAddToCompare,
handleRemoveFromCompare,
handleClearCompare,

View File

@@ -188,12 +188,18 @@ export default {
// 移除自选
await watchlistAPI.removeFromWatchlist(this.fundCode)
this.isInWatchlist = false
window.dispatchEvent(new CustomEvent('watchlist-updated', {
detail: { fundCode: this.fundCode, action: 'remove' }
}))
} else {
// 添加自选
const fundName = this.fundInfo?.name || this.fundInfo?.fund_name || this.fundCode
const fundType = this.fundInfo?.fund_type || ''
await watchlistAPI.addToWatchlist(this.fundCode, fundName, fundType)
this.isInWatchlist = true
window.dispatchEvent(new CustomEvent('watchlist-updated', {
detail: { fundCode: this.fundCode, action: 'add' }
}))
}
} catch (error) {
console.error('操作自选失败:', error)

File diff suppressed because it is too large Load Diff