From e81695903ef4e809e7f4ca9decd11cfaa5daaa60 Mon Sep 17 00:00:00 2001 From: Niki Date: Thu, 11 Apr 2019 15:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E5=88=B6=E5=8C=96=E5=8C=BB=E7=96=97A?= =?UTF-8?q?=E5=8C=BA=E5=A2=9E=E5=8A=A0=E5=B1=8F=E8=94=BD=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=20=20(#1337)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 定制化医疗业务增加屏蔽A区链接跳转功能 * 修改屏蔽A区跳转功能 * 去掉百科名医网站 * 放开百科名医 --- src/mip-custom/mip-custom.js | 40 ++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/mip-custom/mip-custom.js b/src/mip-custom/mip-custom.js index 5d6b98fa9..b55278cad 100644 --- a/src/mip-custom/mip-custom.js +++ b/src/mip-custom/mip-custom.js @@ -171,10 +171,46 @@ define(function () { require.config(config); } + // common 数据缓存 if (data.common) { commonData = data.common; } + var isForbidden = true; + // 医疗屏蔽A区跳转 + if (commonData.product === 'medicine') { + var specialLink = [ + // 寻医问药 + 'mip.imask.xywy.com', + // 宝宝知道 + 'baobao.baidu.com', + // 柠檬爱美 + 'lemon.baidu.com', + // 春雨医生 + 'm.chunyuyisheng.com', + // 好大夫 + 'mip.haodf.com', + // 百科名医 + 'm.baikemy.com' + ]; + for (var i = 0; i < specialLink.length; i++) { + if (commonData.originalUrl && commonData.originalUrl.indexOf(specialLink[i]) > -1) { + isForbidden = false; + break; + } + } + + if (isForbidden) { + var alink = document.querySelectorAll('a'); + + for (var i = 0; i < alink.length; i++) { + if (alink[i].href.indexOf('author.baidu.com') < 0) { + alink[i].href = 'javascript:void(0)'; + } + } + } + + } // 模板数据缓存 if (data.template) { @@ -186,7 +222,6 @@ define(function () { var container = document.createElement('div'); container.setAttribute('mip-custom-container', i); element.appendChild(container); - // dom 渲染 dom.render(element, tplData, container); } @@ -201,6 +236,7 @@ define(function () { window.MIP.adShow = true // 移除广告占位符号 dom.removePlaceholder.apply(this); + }; /** @@ -473,4 +509,4 @@ define(function () { }; return customElement; -}); +}); \ No newline at end of file