feat(article): 添加未发布文章处理逻辑并插入来源信息
This commit is contained in:
parent
b71bc19188
commit
461aa0c691
|
|
@ -234,8 +234,13 @@ function getFirstTextNode(node: any): any {
|
||||||
|
|
||||||
const content = computed(() => {
|
const content = computed(() => {
|
||||||
const content = props.data.content;
|
const content = props.data.content;
|
||||||
|
// 未发布文章直接返回 status = 2 已发布
|
||||||
|
if(!content || props.data.status !== 2) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 插入文案
|
||||||
const insertText = `中证参考海外资讯${dayjs(props.data.publishTime).format('MM月DD日')}援引${props.data.source}`;
|
const insertText = `中证参考海外资讯${dayjs(props.data.publishTime).format('MM月DD日')}援引${props.data.source}`;
|
||||||
if (!content) return;
|
|
||||||
const dom = new DOMParser().parseFromString(content, "text/html");
|
const dom = new DOMParser().parseFromString(content, "text/html");
|
||||||
const body = dom.querySelector("body");
|
const body = dom.querySelector("body");
|
||||||
const p = body?.childNodes;
|
const p = body?.childNodes;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue