feat: 长文本组件调整

This commit is contained in:
2026-05-22 14:27:18 +08:00
parent 6e0988e85a
commit 932783af2c
4 changed files with 15 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ const props = defineProps({
},
});
const IGNORED_FIELD_KEYS = ["container_type", "content", "components"];
const IGNORED_FIELD_KEYS = ["container_type", "content", "content_summary", "components"];
const isArrayValue = (value) => Array.isArray(value);

View File

@@ -62,12 +62,18 @@ const longTextData = ref(null);
let unsubscribe = null;
const HIDDEN_DETAIL_SECTION_KEYS = [
LONG_TEXT_KEYS.containerType,
LONG_TEXT_KEYS.contentSummary,
];
const shouldUseParsedValueView = (section) => {
return (
section.fromLongTextData &&
section.contentKey !== LONG_TEXT_KEYS.tag &&
section.contentKey !== LONG_TEXT_KEYS.title &&
section.contentKey !== LONG_TEXT_KEYS.content
section.contentKey !== LONG_TEXT_KEYS.content &&
!HIDDEN_DETAIL_SECTION_KEYS.includes(section.contentKey)
);
};
@@ -99,7 +105,8 @@ const contentSections = computed(() => {
return renderSections.value.filter(
(section) =>
section.contentKey !== LONG_TEXT_KEYS.title &&
section.contentKey !== LONG_TEXT_KEYS.tag
section.contentKey !== LONG_TEXT_KEYS.tag &&
!HIDDEN_DETAIL_SECTION_KEYS.includes(section.contentKey)
);
});
@@ -267,6 +274,7 @@ onUnload(() => {
align-items: flex-start;
justify-content: space-between;
gap: 10px;
margin-bottom: 6px;
}
.long-answer-tag {
display: inline-flex;

View File

@@ -58,7 +58,7 @@ const props = defineProps({
const tag = computed(() => getLongTextValue(props.longTextData, "tag"));
const title = computed(() => getLongTextValue(props.longTextData, "title"));
const previewContent = computed(() => {
return getLongTextPreviewText(props.longTextData, ["content"]) || (props.content ? String(props.content) : "");
return getLongTextPreviewText(props.longTextData, ["content_summary"]);
});
// 处理文本内容:按行截断以保证预览最多显示三行(更贴近视觉行数)

View File

@@ -3,6 +3,7 @@ export const LONG_TEXT_KEYS = {
tag: "tag",
title: "title",
content: "content",
contentSummary: "content_summary",
guideConclusion: "guide_conclusion",
keyFacts: "key_facts",
sceneImage: "scene_image",
@@ -41,6 +42,7 @@ export const LONG_TEXT_FIELD_CONFIG = [
{ key: LONG_TEXT_KEYS.tag },
{ key: LONG_TEXT_KEYS.title },
{ key: LONG_TEXT_KEYS.content },
{ key: LONG_TEXT_KEYS.contentSummary },
{ key: LONG_TEXT_KEYS.guideConclusion },
{ key: LONG_TEXT_KEYS.keyFacts },
{ key: LONG_TEXT_KEYS.sceneImage },
@@ -75,7 +77,7 @@ export const LONG_TEXT_FIELD_CONFIG = [
];
export const LONG_TEXT_PREVIEW_KEYS = [
LONG_TEXT_KEYS.content,
LONG_TEXT_KEYS.contentSummary,
LONG_TEXT_KEYS.title,
LONG_TEXT_KEYS.tag,
];