File tree Expand file tree Collapse file tree 3 files changed +45
-4
lines changed
Expand file tree Collapse file tree 3 files changed +45
-4
lines changed Original file line number Diff line number Diff line change 1717 width ="100 "
1818 height ="30 "
1919 type ="ad-fd "
20- data-id ="143 ">
20+ data-id ="143 "
21+ data-dep ="54,12 "
22+ data-dis ="12100 ">
2123 </ mip-ad >
2224 </ div >
2325 < script src ="https://c.mipcdn.com/static/v2/mip.js "> </ script >
Original file line number Diff line number Diff line change @@ -12,15 +12,36 @@ export default function render (el) {
1212 el . classList . add ( '__customer_place' )
1313
1414 if ( window . CUSTOMER ) {
15- loadSubScript ( el )
15+ setConditions ( el )
1616 } else {
1717 window . require ( [ 'https://img.familydoctor.com.cn/component/common/scripts/gg_main.min' ] , function ( CUSTOMER ) {
1818 window . CUSTOMER = CUSTOMER
19- loadSubScript ( el )
19+ setConditions ( el )
2020 } )
2121 }
2222}
2323
24+ /**
25+ * 设置定向条件
26+ *
27+ * @param {HTMLElement } el 当前 mip-ad 组件的 DOM 元素
28+ */
29+ function setConditions ( el ) {
30+ let dep = el . getAttribute ( 'data-dep' )
31+ let dis = el . getAttribute ( 'data-dis' )
32+
33+ if ( dep ) {
34+ dep = dep . split ( ',' )
35+ window . CUSTOMER . setDep ( ...dep )
36+ }
37+
38+ if ( dis ) {
39+ window . CUSTOMER . setDis ( dis )
40+ }
41+
42+ loadSubScript ( el )
43+ }
44+
2445/**
2546 * 加载广告位 js
2647 *
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ mip 广告组件 `<mip-ad>` 的一种类型:家庭医生在线提供的广告
1919 width =" 100"
2020 height =" 30"
2121 type =" ad-fd"
22- data-id =" 143" >
22+ data-id =" 143"
23+ data-dep =" 54,12"
24+ data-dis =" 12100" >
2325</mip-ad >
2426```
2527
@@ -41,4 +43,20 @@ mip 广告组件 `<mip-ad>` 的一种类型:家庭医生在线提供的广告
4143
4244** 必选项** :是
4345
46+ ** 类型** :数字
47+
48+ ### data-dep
49+
50+ ** 说明** :按科室编号投放。可分两种情况:示例1、投放到一级科室 data-dep="54";示例2、投放到一级科室和二级科室 data-dep="54,12"。
51+
52+ ** 必选项** :否
53+
54+ ** 类型** :数字
55+
56+ ### data-dis
57+
58+ ** 说明** :按疾病编号投放。
59+
60+ ** 必选项** :否
61+
4462** 类型** :数字
You can’t perform that action at this time.
0 commit comments