diff --git a/src/locales/en.json b/src/locales/en.json index 0ddc35b..2834999 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -111,7 +111,9 @@ "no": "No", "priceZero": "0¢", "moreActions": "More actions", - "settledSubMarketsTitle": "Sub-markets (settled)" + "settledSubMarketsTitle": "Sub-markets (settled)", + "expandDescription": "Show more", + "collapseDescription": "Show less" }, "searchPage": { "title": "Search", diff --git a/src/locales/ja.json b/src/locales/ja.json index 40c48ef..dfc4807 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -111,7 +111,9 @@ "no": "No", "priceZero": "0¢", "moreActions": "その他の操作", - "settledSubMarketsTitle": "サブマーケット(決済済み)" + "settledSubMarketsTitle": "サブマーケット(決済済み)", + "expandDescription": "全文を表示", + "collapseDescription": "閉じる" }, "searchPage": { "title": "検索", diff --git a/src/locales/ko.json b/src/locales/ko.json index b24de40..4cdb4a0 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -111,7 +111,9 @@ "no": "No", "priceZero": "0¢", "moreActions": "더보기", - "settledSubMarketsTitle": "하위 마켓(정산 완료)" + "settledSubMarketsTitle": "하위 마켓(정산 완료)", + "expandDescription": "전체 보기", + "collapseDescription": "접기" }, "searchPage": { "title": "검색", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 0ac2ccc..279a26c 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -111,7 +111,9 @@ "no": "否", "priceZero": "0¢", "moreActions": "更多操作", - "settledSubMarketsTitle": "子市场(已结算)" + "settledSubMarketsTitle": "子市场(已结算)", + "expandDescription": "展开全文", + "collapseDescription": "收起" }, "searchPage": { "title": "搜索", diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index 04ed69e..d78d86a 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -111,7 +111,9 @@ "no": "否", "priceZero": "0¢", "moreActions": "更多操作", - "settledSubMarketsTitle": "子市場(已結算)" + "settledSubMarketsTitle": "子市場(已結算)", + "expandDescription": "展開全文", + "collapseDescription": "收起" }, "searchPage": { "title": "搜尋", diff --git a/src/views/EventMarkets.vue b/src/views/EventMarkets.vue index ddc1c22..724a481 100644 --- a/src/views/EventMarkets.vue +++ b/src/views/EventMarkets.vue @@ -75,7 +75,29 @@

{{ t('activity.rulesDescription') }}

-
{{ eventDetail.description }}
+
+ {{ eventDetail.description }} +
+ + {{ + rulesDescriptionExpanded + ? t('eventMarkets.collapseDescription') + : t('eventMarkets.expandDescription') + }} +

{{ t('activity.rulesSource') }}

@@ -328,6 +350,15 @@ const markets = computed(() => { const activeMarkets = computed(() => markets.value.filter((m) => !isPmMarketClosed(m))) /** 已结算/已关闭的子市场 */ const closedMarkets = computed(() => markets.value.filter((m) => isPmMarketClosed(m))) +/** 多市场时描述默认折叠,避免首屏过长 */ +const isMultiMarket = computed(() => markets.value.length > 1) +const RULES_DESC_COLLAPSE_MIN_LEN = 80 +const rulesDescriptionExpanded = ref(false) +const rulesDescriptionCollapsible = computed(() => { + if (!isMultiMarket.value) return false + const d = eventDetail.value?.description?.trim() ?? '' + return d.length > RULES_DESC_COLLAPSE_MIN_LEN +}) const selectedMarket = computed(() => activeMarkets.value[selectedMarketIndex.value] ?? null) /** 移动端底部栏显示的市场(选中项或首个),仅在有可交易市场时使用 */ const barMarket = computed(() => selectedMarket.value ?? activeMarkets.value[0]) @@ -777,7 +808,10 @@ watch( ) watch( () => route.params.id, - () => loadEventDetail(), + () => { + rulesDescriptionExpanded.value = false + loadEventDetail() + }, ) // 监听语言切换,语言变化时重新加载数据 @@ -1010,6 +1044,9 @@ watch( } .rules-card .rules-section { + display: flex; + flex-direction: column; + align-items: stretch; margin-bottom: 16px; } @@ -1034,6 +1071,22 @@ watch( word-break: break-word; } +.rules-text--multi-collapsed { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 4; + overflow: hidden; +} + +.rules-description-toggle { + margin-top: 4px; + padding: 0 4px !important; + min-width: auto !important; + text-transform: none; + font-weight: 600; + align-self: flex-start; +} + .rules-card .rules-link { font-size: 14px; color: #2563eb; diff --git a/src/views/TradeDetail.vue b/src/views/TradeDetail.vue index 4732034..04348ad 100644 --- a/src/views/TradeDetail.vue +++ b/src/views/TradeDetail.vue @@ -258,7 +258,29 @@