Skip to content

Commit 3e5f6be

Browse files
committed
在新版 config 配置下,也要兼容 string slogan 的情形。
1 parent 529c609 commit 3e5f6be

File tree

2 files changed

+53
-50
lines changed

2 files changed

+53
-50
lines changed

src/js/app/modules/chat.js

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/js/app/modules/tenantInfo/index.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,6 @@ module.exports = function(){
1515
apiHelper.getNotice()
1616
.then(function(notice){
1717
if(!notice.enabled) return;
18-
19-
20-
21-
// test
22-
// notice.content = [
23-
// {
24-
// name: "菜单",
25-
// sub_button: [
26-
// {
27-
// type: "view",
28-
// name: "搜索2666",
29-
// url: "http://www.soso.com/"
30-
// }
31-
// ]
32-
// },
33-
// {
34-
// name: "222",
35-
// sub_button: [
36-
// {
37-
// type: "media_id",
38-
// name: "111",
39-
// media_id: "75cffa4b-e462-40e8-a517-0ff807db29a6"
40-
// },
41-
// {
42-
// type: "media_id",
43-
// name: "香格里拉",
44-
// media_id: "4150c891-9917-4482-909c-ab7c9954110a"
45-
// }
46-
// ]
47-
// },
48-
// {
49-
// type: "media_id",
50-
// name: "333",
51-
// media_id: "75cffa4b-e462-40e8-a517-0ff807db29a6"
52-
// }
53-
// ];
54-
55-
56-
57-
5818
menuArr = notice.content;
5919
container.innerHTML = _.template(tpl)({
6020
menu: menuArr,

0 commit comments

Comments
 (0)