Skip to content

Commit

Permalink
定制化医疗A区增加屏蔽链接 (#1337)
Browse files Browse the repository at this point in the history
* 定制化医疗业务增加屏蔽A区链接跳转功能

* 修改屏蔽A区跳转功能

* 去掉百科名医网站

* 放开百科名医
  • Loading branch information
ning5129 authored and chenqiushi committed Apr 11, 2019
1 parent c0ba06e commit e816959
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions src/mip-custom/mip-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand All @@ -201,6 +236,7 @@ define(function () {
window.MIP.adShow = true
// 移除广告占位符号
dom.removePlaceholder.apply(this);

};

/**
Expand Down Expand Up @@ -473,4 +509,4 @@ define(function () {
};

return customElement;
});
});

0 comments on commit e816959

Please sign in to comment.