|
@@ -21,7 +21,7 @@ var thirdPartyVerify = {
|
|
|
// 证书编号
|
|
|
number: [
|
|
|
/(ISO\s{0,1}9001)/g,
|
|
|
- /(GB\/T 50430)/g,
|
|
|
+ /(GB\/T\s{0,1}50430)/g,
|
|
|
/(ISO\s{0,1}14001)/g,
|
|
|
/(ISO\s{0,1}45001)/g,
|
|
|
'HACCP',
|
|
@@ -61,48 +61,67 @@ var thirdPartyVerify = {
|
|
|
thirdPartyVerifyDialog.showDialog(true)
|
|
|
})
|
|
|
},
|
|
|
+ replaceKeys: function (content) {
|
|
|
+ // 1.先将关键词替换
|
|
|
+ var replaced = keyWordHighlight(content,this.keywordsList,"<span class='highlight-text third-party-verify-highlight'>$1</span>");
|
|
|
+ // 2.替换关键词后面最近的一个中文句号(用来插入button)
|
|
|
+ replaced = replaced.replace(/third-party-verify-highlight(.*?)(。|;|;)/g, function (match, p1, p2) {
|
|
|
+ return match.replace(p2, `<span class='paragraph-last'>${p2}</span>`)
|
|
|
+ })
|
|
|
+ return replaced
|
|
|
+ },
|
|
|
getInsertButton: function () {
|
|
|
return '<span class="third-party-popover third-party-verify-button"><span class="icon icon-third-party-verify-logo"></span><span class="button-text">剑鱼认证服务</span></span>'
|
|
|
},
|
|
|
- checkHighlightInsert: function () {
|
|
|
- var container = $('#tab2')
|
|
|
- var verifyIconButton = container.find('.third-party-verify-button')
|
|
|
- if (verifyIconButton.length) return
|
|
|
+ findNextMark: function (callback) {
|
|
|
var waitingInsertList = [] // 待插入节点dom对象
|
|
|
+ var container = $('#tab2')
|
|
|
var highlights = container.find('.third-party-verify-highlight')
|
|
|
- // 1. 先找highlights同级next的br
|
|
|
highlights.each(function () {
|
|
|
- var $br = $(this).next('br')
|
|
|
- var br = $br[0]
|
|
|
- if (br) {
|
|
|
- waitingInsertList.push(br)
|
|
|
+ var $mark = callback(this)
|
|
|
+ var mark = $mark[0]
|
|
|
+ if (mark) {
|
|
|
+ waitingInsertList.push(mark)
|
|
|
}
|
|
|
})
|
|
|
// 去重
|
|
|
- waitingInsertList = $.uniqueSort(waitingInsertList)
|
|
|
- // 2.1 找到了,则在其前面插入
|
|
|
- // 2.2 找不到,找到其父级标签,在其末尾插入
|
|
|
+ return $.uniqueSort(waitingInsertList)
|
|
|
+ },
|
|
|
+ checkHighlightInsert: function () {
|
|
|
+ var container = $('#tab2')
|
|
|
+ var verifyIconButton = container.find('.third-party-verify-button')
|
|
|
+ if (verifyIconButton.length) return
|
|
|
+ var waitingInsertList = [] // 待插入节点dom对象
|
|
|
// 获取要插入元素
|
|
|
var button = this.getInsertButton()
|
|
|
+ // 1. 先找highlights同级next的.paragraph-last
|
|
|
+ waitingInsertList = container.find('.paragraph-last').toArray()
|
|
|
+ waitingInsertList = $.uniqueSort(waitingInsertList)
|
|
|
if (waitingInsertList.length) {
|
|
|
- // 找到br
|
|
|
- for (var i = 0; i < waitingInsertList.length; i++) {
|
|
|
- $(waitingInsertList[i]).before(button)
|
|
|
- }
|
|
|
+ // 找到了.paragraph-last在其后插入button
|
|
|
+ waitingInsertList.forEach(function (dom) {
|
|
|
+ $(dom).after(button)
|
|
|
+ })
|
|
|
} else {
|
|
|
- // 没找到br,找到其父级标签,并在其末尾插入
|
|
|
- highlights.each(function () {
|
|
|
- var $parent = $(this).parent()
|
|
|
- var parent = $parent[0]
|
|
|
- if (parent) {
|
|
|
- waitingInsertList.push(parent)
|
|
|
- }
|
|
|
+ // 2. 找不到.paragraph-last。找同级next的br
|
|
|
+ waitingInsertList = this.findNextMark(function (_this) {
|
|
|
+ return $(_this).next('br')
|
|
|
})
|
|
|
- // 去重
|
|
|
- waitingInsertList = $.uniqueSort(waitingInsertList)
|
|
|
- if (waitingInsertList) {
|
|
|
- for (var i = 0; i < waitingInsertList.length; i++) {
|
|
|
- $(waitingInsertList[i]).append(button)
|
|
|
+ if (waitingInsertList.length) {
|
|
|
+ // 找到了br,则在其前面插入
|
|
|
+ waitingInsertList.forEach(function (dom) {
|
|
|
+ $(dom).before(button)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 3. 找不到br,找到其父级标签,并在其末尾插入
|
|
|
+ waitingInsertList = this.findNextMark(function (_this) {
|
|
|
+ return $(_this).parent()
|
|
|
+ })
|
|
|
+ if (waitingInsertList.length) {
|
|
|
+ // 找到了br,则在其前面插入
|
|
|
+ waitingInsertList.forEach(function (dom) {
|
|
|
+ $(dom).append(button)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -150,15 +169,15 @@ var thirdPartyVerifyDialogTemplate = `
|
|
|
</div>
|
|
|
<div class="p-c-h-c-item">
|
|
|
<span class="icon-verify-tick"></span>
|
|
|
- <span>类似项目帮多维度分析</span>
|
|
|
+ <span>体系认证:品牌提升,投标加分,提升企业竞争力</span>
|
|
|
</div>
|
|
|
<div class="p-c-h-c-item">
|
|
|
<span class="icon-verify-tick"></span>
|
|
|
- <span>辅助投标策略及报价参考</span>
|
|
|
+ <span>信用认证:企业信用名片,招投标必备</span>
|
|
|
</div>
|
|
|
<div class="p-c-h-c-item">
|
|
|
<span class="icon-verify-tick"></span>
|
|
|
- <span>辅助投标策略及报价参考</span>
|
|
|
+ <span>服务体系认证:实力认证,竞争有优势</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|