feat: 长文本组件调整
This commit is contained in:
@@ -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);
|
const isArrayValue = (value) => Array.isArray(value);
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,18 @@ const longTextData = ref(null);
|
|||||||
|
|
||||||
let unsubscribe = null;
|
let unsubscribe = null;
|
||||||
|
|
||||||
|
const HIDDEN_DETAIL_SECTION_KEYS = [
|
||||||
|
LONG_TEXT_KEYS.containerType,
|
||||||
|
LONG_TEXT_KEYS.contentSummary,
|
||||||
|
];
|
||||||
|
|
||||||
const shouldUseParsedValueView = (section) => {
|
const shouldUseParsedValueView = (section) => {
|
||||||
return (
|
return (
|
||||||
section.fromLongTextData &&
|
section.fromLongTextData &&
|
||||||
section.contentKey !== LONG_TEXT_KEYS.tag &&
|
section.contentKey !== LONG_TEXT_KEYS.tag &&
|
||||||
section.contentKey !== LONG_TEXT_KEYS.title &&
|
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(
|
return renderSections.value.filter(
|
||||||
(section) =>
|
(section) =>
|
||||||
section.contentKey !== LONG_TEXT_KEYS.title &&
|
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;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
margin-bottom: 6px;
|
||||||
}
|
}
|
||||||
.long-answer-tag {
|
.long-answer-tag {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const props = defineProps({
|
|||||||
const tag = computed(() => getLongTextValue(props.longTextData, "tag"));
|
const tag = computed(() => getLongTextValue(props.longTextData, "tag"));
|
||||||
const title = computed(() => getLongTextValue(props.longTextData, "title"));
|
const title = computed(() => getLongTextValue(props.longTextData, "title"));
|
||||||
const previewContent = computed(() => {
|
const previewContent = computed(() => {
|
||||||
return getLongTextPreviewText(props.longTextData, ["content"]) || (props.content ? String(props.content) : "");
|
return getLongTextPreviewText(props.longTextData, ["content_summary"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 处理文本内容:按行截断以保证预览最多显示三行(更贴近视觉行数)
|
// 处理文本内容:按行截断以保证预览最多显示三行(更贴近视觉行数)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export const LONG_TEXT_KEYS = {
|
|||||||
tag: "tag",
|
tag: "tag",
|
||||||
title: "title",
|
title: "title",
|
||||||
content: "content",
|
content: "content",
|
||||||
|
contentSummary: "content_summary",
|
||||||
guideConclusion: "guide_conclusion",
|
guideConclusion: "guide_conclusion",
|
||||||
keyFacts: "key_facts",
|
keyFacts: "key_facts",
|
||||||
sceneImage: "scene_image",
|
sceneImage: "scene_image",
|
||||||
@@ -41,6 +42,7 @@ export const LONG_TEXT_FIELD_CONFIG = [
|
|||||||
{ key: LONG_TEXT_KEYS.tag },
|
{ key: LONG_TEXT_KEYS.tag },
|
||||||
{ key: LONG_TEXT_KEYS.title },
|
{ key: LONG_TEXT_KEYS.title },
|
||||||
{ key: LONG_TEXT_KEYS.content },
|
{ key: LONG_TEXT_KEYS.content },
|
||||||
|
{ key: LONG_TEXT_KEYS.contentSummary },
|
||||||
{ key: LONG_TEXT_KEYS.guideConclusion },
|
{ key: LONG_TEXT_KEYS.guideConclusion },
|
||||||
{ key: LONG_TEXT_KEYS.keyFacts },
|
{ key: LONG_TEXT_KEYS.keyFacts },
|
||||||
{ key: LONG_TEXT_KEYS.sceneImage },
|
{ key: LONG_TEXT_KEYS.sceneImage },
|
||||||
@@ -75,7 +77,7 @@ export const LONG_TEXT_FIELD_CONFIG = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const LONG_TEXT_PREVIEW_KEYS = [
|
export const LONG_TEXT_PREVIEW_KEYS = [
|
||||||
LONG_TEXT_KEYS.content,
|
LONG_TEXT_KEYS.contentSummary,
|
||||||
LONG_TEXT_KEYS.title,
|
LONG_TEXT_KEYS.title,
|
||||||
LONG_TEXT_KEYS.tag,
|
LONG_TEXT_KEYS.tag,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user