diff --git a/src/views/property-marketing/put-account/investment-guidelines/components/month-data/index.vue b/src/views/property-marketing/put-account/investment-guidelines/components/month-data/index.vue index 87135fb..b99e439 100644 --- a/src/views/property-marketing/put-account/investment-guidelines/components/month-data/index.vue +++ b/src/views/property-marketing/put-account/investment-guidelines/components/month-data/index.vue @@ -11,20 +11,11 @@
- - {{ item.text }} -
+ + + {{ line.text }} + - - - - - - - - - -
@@ -34,20 +25,48 @@ import { IconQuestionCircle } from '@arco-design/web-vue/es/icon'; import { defineProps } from 'vue'; -const colorMap = { - purple: 'purple', - orange: 'orange', -}; const props = defineProps({ overview: { - type: Array, - default: () => [], + type: Object, + default: () => ({ + text: '', + parts: [], + }), }, }); - -const getColor = (highlight?: string) => { - return highlight ? colorMap[highlight] : undefined; +const classMap = { + purple: 'month-text-blue', + black: 'month-text-black', + orange: 'orange', + red: 'month-text-red', }; + +const formattedText = computed(() => { + console.log(props.overview, 'props.overview'); + const { text, parts } = props.overview; + if (!text || !parts) return []; + + // 替换占位符 + let resultText = text; + parts.forEach((part) => { + const key = Object.keys(part)[0]; + resultText = resultText.replace(`{${key}}`, part[key]); + }); + + // 按分号拆分并保留颜色信息 + return resultText.split(';').map((line) => { + const matchedPart = parts.find((part) => line.includes(part[Object.keys(part)[0]])); + return { + text: line.trim(), + highlight: matchedPart?.highlight || 'black', + }; + }); +}); + +const getCss = (highlight?: string) => { + return highlight ? classMap[highlight] : undefined; +}; + console.log(props.overview, 'overvie333');