@@ -168,6 +168,42 @@ function _setNotice(){
168168 var noticeContent = document . querySelector ( ".em-widget-tip .content" ) ;
169169 var noticeCloseBtn = document . querySelector ( ".em-widget-tip .tip-close" ) ;
170170 apiHelper . getNotice ( ) . then ( function ( notice ) {
171+
172+ // test
173+ // notice.content = [
174+ // {
175+ // name: "菜单",
176+ // sub_button: [
177+ // {
178+ // type: "view",
179+ // name: "搜索2666",
180+ // url: "http://www.soso.com/"
181+ // }
182+ // ]
183+ // },
184+ // {
185+ // name: "222",
186+ // sub_button: [
187+ // {
188+ // type: "media_id",
189+ // name: "111",
190+ // media_id: "75cffa4b-e462-40e8-a517-0ff807db29a6"
191+ // },
192+ // {
193+ // type: "media_id",
194+ // name: "香格里拉",
195+ // media_id: "4150c891-9917-4482-909c-ab7c9954110a"
196+ // }
197+ // ]
198+ // },
199+ // {
200+ // type: "media_id",
201+ // name: "333",
202+ // media_id: "75cffa4b-e462-40e8-a517-0ff807db29a6"
203+ // }
204+ // ];
205+
206+
171207 var slogan = notice . content ;
172208 if ( ! notice . enabled ) return ;
173209
@@ -176,18 +212,25 @@ function _setNotice(){
176212
177213 // 新配置就走新 tenantInfo
178214 if ( config . isWebChannelConfig ) {
179- tenantInfo = new TenantInfo ( ) ;
215+ if ( typeof slogan == "string" ) {
216+ renderSlogan ( ) ;
217+ }
218+ else {
219+ tenantInfo = new TenantInfo ( ) ;
220+ }
180221 }
181222 else {
182- ( function ( ) {
183- // 设置信息栏内容
184- noticeContent . innerHTML = WebIM . utils . parseLink ( slogan ) ;
185- // 隐藏信息栏按钮
186- utils . on ( noticeCloseBtn , utils . click , function ( ) {
187- // 隐藏信息栏
188- utils . removeClass ( doms . imChat , "has-tip" ) ;
189- } ) ;
190- } ) ( ) ;
223+ renderSlogan ( ) ;
224+ }
225+
226+ function renderSlogan ( ) {
227+ // 设置信息栏内容
228+ noticeContent . innerHTML = WebIM . utils . parseLink ( slogan ) ;
229+ // 隐藏信息栏按钮
230+ utils . on ( noticeCloseBtn , utils . click , function ( ) {
231+ // 隐藏信息栏
232+ utils . removeClass ( doms . imChat , "has-tip" ) ;
233+ } ) ;
191234 }
192235 } ) ;
193236}
0 commit comments