“优化了持仓页面”

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

View File

@@ -38,16 +38,9 @@
<button <button
class="mode-btn" class="mode-btn"
:class="{ active: viewMode === 'realtime' }" :class="{ active: viewMode === 'realtime' }"
@click="viewMode = 'realtime'" @click="viewMode = 'portfolio'"
> >
📊 实时估值 📊 估值与持仓
</button>
<button
class="mode-btn"
:class="{ active: viewMode === 'positions' }"
@click="viewMode = 'positions'"
>
💼 我的持仓
</button> </button>
</div> </div>
</div> </div>
@@ -97,8 +90,8 @@
<!-- 其他模式 --> <!-- 其他模式 -->
<div v-else class="main-layout"> <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 <FundWatchlist
@view-fund="handleFundSelected" @view-fund="handleFundSelected"
@add-to-compare="handleAddToCompare" @add-to-compare="handleAddToCompare"
@@ -110,7 +103,7 @@
</aside> </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'"> <template v-if="viewMode === 'screening'">
<FundScreening <FundScreening
@@ -119,6 +112,11 @@
/> />
</template> </template>
<!-- 估值与持仓一体化看板 -->
<template v-else-if="viewMode === 'portfolio'">
<FundRealtime @view-detail="handleRealtimeFundView" />
</template>
<!-- 回测模式 --> <!-- 回测模式 -->
<template v-else-if="viewMode === 'backtest'"> <template v-else-if="viewMode === 'backtest'">
<FundBacktest <FundBacktest
@@ -126,11 +124,6 @@
/> />
</template> </template>
<!-- 我的持仓模式 -->
<template v-else-if="viewMode === 'positions'">
<MyPositions />
</template>
<!-- 详情模式 --> <!-- 详情模式 -->
<template v-else> <template v-else>
<FundSearch @fund-selected="handleFundSelected" /> <FundSearch @fund-selected="handleFundSelected" />
@@ -163,7 +156,6 @@ import FundRealtime from './components/FundRealtime.vue'
import MarketOverview from './components/MarketOverview.vue' import MarketOverview from './components/MarketOverview.vue'
import FlashNews from './components/FlashNews.vue' import FlashNews from './components/FlashNews.vue'
import SectorRank from './components/SectorRank.vue' import SectorRank from './components/SectorRank.vue'
import MyPositions from './components/MyPositions.vue'
export default { export default {
name: 'App', name: 'App',
@@ -177,8 +169,7 @@ export default {
FundRealtime, FundRealtime,
MarketOverview, MarketOverview,
FlashNews, FlashNews,
SectorRank, SectorRank
MyPositions
}, },
setup() { setup() {
const selectedFundCode = ref('') const selectedFundCode = ref('')
@@ -230,6 +221,13 @@ export default {
viewMode.value = 'dashboard' viewMode.value = 'dashboard'
} }
// 从估值卡片点击后跳转到基金详情(大盘页布局)
const handleRealtimeFundView = (fundOrCode) => {
compareMode.value = false
viewMode.value = 'dashboard'
handleFundSelected(fundOrCode)
}
// 添加基金到对比列表 // 添加基金到对比列表
const handleAddToCompare = (fund) => { const handleAddToCompare = (fund) => {
// 最多5只基金 // 最多5只基金
@@ -292,6 +290,7 @@ export default {
handleHeaderSearch, handleHeaderSearch,
handleDashboardFundView, handleDashboardFundView,
handleScreeningFundView, handleScreeningFundView,
handleRealtimeFundView,
handleAddToCompare, handleAddToCompare,
handleRemoveFromCompare, handleRemoveFromCompare,
handleClearCompare, handleClearCompare,

View File

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

File diff suppressed because it is too large Load Diff