|
@@ -2,7 +2,7 @@ import BaseModel from '../../../core/base'
|
|
import useSummaryModel from '../transform/summary2'
|
|
import useSummaryModel from '../transform/summary2'
|
|
import useCommonTitleModel from '../transform/content'
|
|
import useCommonTitleModel from '../transform/content'
|
|
import useThirdPartyVerifyModel from '../transform/third-party-verify'
|
|
import useThirdPartyVerifyModel from '../transform/third-party-verify'
|
|
-import { replaceKeyword } from '@jy/util'
|
|
|
|
|
|
+import { replaceKeyowrdWithRichText } from '@jy/util'
|
|
const thirdPartyVerify = useThirdPartyVerifyModel()
|
|
const thirdPartyVerify = useThirdPartyVerifyModel()
|
|
|
|
|
|
class ContentModel extends BaseModel {
|
|
class ContentModel extends BaseModel {
|
|
@@ -42,7 +42,7 @@ class ContentModel extends BaseModel {
|
|
try {
|
|
try {
|
|
result.content.contentHighlighted = this.highlightContentHTML(result.content.content, data, result)
|
|
result.content.contentHighlighted = this.highlightContentHTML(result.content.content, data, result)
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.error(error)
|
|
|
|
|
|
+ console.error(error)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -61,10 +61,10 @@ class ContentModel extends BaseModel {
|
|
const projectCode = baseInfo?.projectCode
|
|
const projectCode = baseInfo?.projectCode
|
|
// 下划线高亮项目名称编号
|
|
// 下划线高亮项目名称编号
|
|
if (projectName && title.toLowerCase().indexOf(projectName.toLowerCase()) > -1) {
|
|
if (projectName && title.toLowerCase().indexOf(projectName.toLowerCase()) > -1) {
|
|
- title = replaceKeyword(title, projectName, '<span class="keyword keyword-underline project project-name hide-underline">$1</span>')
|
|
|
|
|
|
+ title = replaceKeyowrdWithRichText(title, projectName, '<span class="keyword keyword-underline project project-name hide-underline">$1</span>')
|
|
}
|
|
}
|
|
if (projectCode && title.toLowerCase().indexOf(projectCode.toLowerCase()) > -1) {
|
|
if (projectCode && title.toLowerCase().indexOf(projectCode.toLowerCase()) > -1) {
|
|
- title = replaceKeyword(title, projectCode, '<span class="keyword keyword-underline project project-code">$1</span>')
|
|
|
|
|
|
+ title = replaceKeyowrdWithRichText(title, projectCode, '<span class="keyword keyword-underline project project-code">$1</span>')
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------
|
|
// ------------------
|
|
@@ -74,7 +74,7 @@ class ContentModel extends BaseModel {
|
|
highlightKeys = formatted.content.highlightKeys
|
|
highlightKeys = formatted.content.highlightKeys
|
|
}
|
|
}
|
|
highlightKeys.forEach((key) => {
|
|
highlightKeys.forEach((key) => {
|
|
- title = replaceKeyword(title, key, '<span class="keyword highlight-text">$1</span>')
|
|
|
|
|
|
+ title = replaceKeyowrdWithRichText(title, key, '<span class="keyword highlight-text">$1</span>')
|
|
})
|
|
})
|
|
return title
|
|
return title
|
|
}
|
|
}
|
|
@@ -89,12 +89,18 @@ class ContentModel extends BaseModel {
|
|
|
|
|
|
content = content.replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g, '').trim()
|
|
content = content.replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g, '').trim()
|
|
|
|
|
|
|
|
+ let tempNode = document.createElement('div')
|
|
|
|
+ tempNode.innerHTML = content
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// 下划线高亮项目名称编号
|
|
// 下划线高亮项目名称编号
|
|
if(projectName && content.toLowerCase().indexOf(projectName.toLowerCase()) > -1){
|
|
if(projectName && content.toLowerCase().indexOf(projectName.toLowerCase()) > -1){
|
|
- content = replaceKeyword(content, projectName, '<span class="keyword keyword-underline my-follow project project-name hide-underline">$1</span>')
|
|
|
|
|
|
+ content = replaceKeyowrdWithRichText(content, projectName, '<span class="keyword keyword-underline my-follow project project-name hide-underline">$1</span>')
|
|
}
|
|
}
|
|
if(projectCode && content.toLowerCase().indexOf(projectCode.toLowerCase()) > -1){
|
|
if(projectCode && content.toLowerCase().indexOf(projectCode.toLowerCase()) > -1){
|
|
- content = replaceKeyword(content, projectCode, '<span class="keyword keyword-underline my-follow project project-code">$1</span>')
|
|
|
|
|
|
+ content = replaceKeyowrdWithRichText(content, projectCode, '<span class="keyword keyword-underline my-follow project project-code">$1</span>')
|
|
}
|
|
}
|
|
// 下划线高亮中标企业
|
|
// 下划线高亮中标企业
|
|
const winners = summary.winners
|
|
const winners = summary.winners
|
|
@@ -103,7 +109,7 @@ class ContentModel extends BaseModel {
|
|
const winnerName = winners[i].name
|
|
const winnerName = winners[i].name
|
|
const winnerId = winners[i].id
|
|
const winnerId = winners[i].id
|
|
if (winnerName && content.toLowerCase().indexOf(winnerName.toLowerCase()) > -1) {
|
|
if (winnerName && content.toLowerCase().indexOf(winnerName.toLowerCase()) > -1) {
|
|
- content = replaceKeyword(content, winnerName, `<span data-eid='${winnerId}' class='keyword keyword-underline winner-name my-follow-ent'>$1</span>`)
|
|
|
|
|
|
+ content = replaceKeyowrdWithRichText(content, winnerName, `<span data-eid='${winnerId}' class='keyword keyword-underline winner-name my-follow-ent'>$1</span>`)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -125,7 +131,7 @@ class ContentModel extends BaseModel {
|
|
highlightKeys = formatted.content.highlightKeys
|
|
highlightKeys = formatted.content.highlightKeys
|
|
}
|
|
}
|
|
highlightKeys.forEach((key) => {
|
|
highlightKeys.forEach((key) => {
|
|
- content = replaceKeyword(content, key, '<span class="keyword highlight-text">$1</span>')
|
|
|
|
|
|
+ content = replaceKeyowrdWithRichText(content, key, '<span class="keyword highlight-text">$1</span>')
|
|
})
|
|
})
|
|
|
|
|
|
// 将多个连续的br替换成一个
|
|
// 将多个连续的br替换成一个
|