UNPKG

47.2 kBJavaScriptView Raw
1/*
2 author:guomeishan [guomeishan@beisen.com]
3 name:iTalent-sidebar
4 last-verson:v0.3.2
5 test ci 2
6*/
7define(['talent',"$.cookie"],function(Talent){
8 var jst = (function(){
9 this["JST"] = this["JST"] || {};
10
11 this["JST"]["sidebar/bg-slider"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape;with (obj) {__p += '';}return __p};
12
13 this["JST"]["sidebar/multiple-menu-item"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape, __j = Array.prototype.join;function print() { __p += __j.call(arguments, '') }with (obj) {__p += '<a\n\tclass="list-1st-a"\n\tindex="' +((__t = ( index)) == null ? '' : __t) +'"\n\tdata-udc="' +((__t = (encodeURIComponent(JSON.stringify({ext: JSON.stringify({type:'globalMenu', id: id, appid:appId })})))) == null ? '' : __t) +'"\n\thref="javascript:;"\n>\n\t<span\n\t\tclass="sd-icon-before ' +((__t = (iconName)) == null ? '' : __t) +' ' +((__t = (( !newCount?'':'sd-new-message'))) == null ? '' : __t) +' ' +((__t = (MenuPoint && MenuPoint.value?'sd-update-tip':'')) == null ? '' : __t) +'"\n\t>\n\t\t<span class="red-remind" data-name="feed-all-indicator"></span>\n\t\t<span class="new-tip" data-name="update-tip"></span>\n\t</span>\n <span class="text">' +((__t = (title)) == null ? '' : __t) +'</span>\n\t<span class="sd-icon-after"></span>\n</a>\n\n'; if(children.length){ ;__p += '\n<ul class="list-2sd-ul">\n\t'; Talent._.each(children,function(item,index){ ;__p += '\n\t<li>\n\t\t<a\n\t\t\tclass="list-2sd-li ' +((__t = ( 'ani-item-' + index )) == null ? '' : __t) +' ' +((__t = ( (item.type == 'iframe')?'is-iframe':'' )) == null ? '' : __t) +' ' +((__t = ((item.isActive?'bg-highlight':''))) == null ? '' : __t) +' "\n\t\t\thref=\'' +((__t = ((item.href == "" || item.href == "#" || item.type == "iframe") ? "javascript:;":(item.href))) == null ? '' : __t) +'\'\n\t\t\tindex="' +((__t = (index)) == null ? '' : __t) +'"\n\t\t\tdata-udc="' +((__t = (encodeURIComponent(JSON.stringify({ext: JSON.stringify({type:'globalMenu', id: item.id, appid:item.appId })})))) == null ? '' : __t) +'"\n\t\t\ttarget="' +((__t = ( (item.type=='intLink')?'_self':(item.type=='extLink'||item.type=='newPage'?'_blank':'') )) == null ? '' : __t) +'"\n\t\t\tdata-trigger="' +((__t = ( (item.type=='iframe')?false:'')) == null ? '' : __t) +'"\n\t\t>\n \n <span class="list-2sd-li-title">' +__e( item.title ) +'</span>\n\t\t\t<span\n\t\t\t\tclass=" ' +((__t = (item.MenuPoint && item.MenuPoint.value?'sd-update-tip':'')) == null ? '' : __t) +'"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tclass="new-tip mult-new-tip"\n\t\t\t\t\tdata-name="update-tip"\n\t\t\t\t></span>\n\t\t\t</span>\n\t\t</a>\n\t</li>\n\t'; }) ;__p += '\n</ul>\n'; } ;__p += '\n';}return __p};
14
15 this["JST"]["sidebar/narrow-list-extend"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape, __j = Array.prototype.join;function print() { __p += __j.call(arguments, '') }with (obj) {__p += '<ul class="list-narrow-wrapper">\n ';Talent._.each(menuArry,function(item,superindex){;__p += '\n <li class="list-1st2-li ' +((__t = ( ('sp-item-' +superindex) )) == null ? '' : __t) +' ' +((__t = ( (item.children&&item.children.length)?'has-sub-list':'no-sub-list' )) == null ? '' : __t) +' ' +((__t = (item.isQuickEntry?'quick-entry-extend':'')) == null ? '' : __t) +'">\n <a \n class="list-1st2-a ' +((__t = ( (item.type == 'iframe')?'is-iframe':'' )) == null ? '' : __t) +' ' +((__t = ((item.isActive?'shadow-bg':''))) == null ? '' : __t) +'" \n href=\'' +((__t = ((item.href == "" || item.href == "#" || item.type == "iframe")?"javascript:void(0)":(item.href))) == null ? '' : __t) +'\' \n index="' +((__t = ( superindex)) == null ? '' : __t) +'"\n isSuperItem="true"\n data-udc="' +((__t = (encodeURIComponent(JSON.stringify({ext: JSON.stringify({type:'globalMenu', id: item.id, appid:item.appId })})))) == null ? '' : __t) +'" \n data-trigger="' +((__t = ( (item.type=='iframe')?false:'')) == null ? '' : __t) +'">\n <span>' +((__t = (item.title)) == null ? '' : __t) +'</span>\n <span class="sd-icon-after" ></span>\n </a>\n '; if(item.children&&item.children.length){ ;__p += '\n <ul class="list-2sd2-ul top-position">\n ';Talent._.each(item.children,function(subItem,subIndex){;__p += '\n <li class="list-2sd2-li ' +((__t = ( 'ani-index-' + subIndex )) == null ? '' : __t) +' ' +((__t = ((subItem.isActive?'shadow-bg':''))) == null ? '' : __t) +'">\n <a \n href=\'' +((__t = ((subItem.href =="" || subItem.href =="#" || subItem.type == "iframe")?"javascript:void(0)":subItem.href)) == null ? '' : __t) +'\'\n class="shadow-list-a ' +((__t = ( (subItem.type == 'iframe')?'is-iframe':'' )) == null ? '' : __t) +'" \n super-name="' +((__t = ( item.code)) == null ? '' : __t) +'"\n sub-name="' +((__t = ( subItem.code)) == null ? '' : __t) +'"\n super-index="' +((__t = ( superindex)) == null ? '' : __t) +'"\n sub-index="' +((__t = ( subIndex)) == null ? '' : __t) +'"\n target= "' +((__t = ( (subItem.type=='intLink')?'_self':(subItem.type=='extLink' || subItem.type=='newPage'?'_blank':'') )) == null ? '' : __t) +'"\n data-udc="' +((__t = (encodeURIComponent(JSON.stringify({ext: JSON.stringify({type:'globalMenu', id: subItem.id, appid:subItem.appId })})))) == null ? '' : __t) +'" \n data-trigger="' +((__t = ( (subItem.type=='iframe')?false:'')) == null ? '' : __t) +'">\n ' +((__t = (subItem.title)) == null ? '' : __t) +'\n </a>\n </li>\n '; }) ;__p += '\n </ul>\n '; } ;__p += '\n </li>\n ';});__p += '\n</ul>\n';}return __p};
16
17 this["JST"]["sidebar/side-bar"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape, __j = Array.prototype.join;function print() { __p += __j.call(arguments, '') }with (obj) {__p += '<div class="status-switch-wrapper">\n <span class="status-switch" data-name="switch">\n <span class="line-1"></span>\n <span class="line-2"></span>\n <span class="line-3"></span>\n </span>\n</div>\n<div data-name=\'top-shadow\' class="shadow-node-top"></div>\n<div class="list-outer-wrapper">\n <ul class="list-1st-ul">\n \t<div class="bg-slider-region"></div>\n </ul>\n</div>\n<div class="list-narrow-extend"></div>\n<div data-name=\'bottom-shadow\' class="shadow-node-bottom"></div>\n'; if(isLookingForService || isWantTucao){ ;__p += '\n <div class="tucao-service-container tucao-service-spread-layout">\n '; if(isLookingForService){ ;__p += '\n <div class="looking-for-service ' +((__t = ( !isWantTucao ? 'onlyone':'')) == null ? '' : __t) +'" data-name="looking-for-service">\n <span class="icon sys-icon-kefu" >\n </span>\n <span class="service-text" >' +((__t = ( !isWantTucao ? '在线客服':'找客服')) == null ? '' : __t) +'</span>\n </div>\n '; } ;__p += '\n\n '; if(isLookingForService && isWantTucao){ ;__p += '\n <div class="border"></div>\n '; } ;__p += '\n\n '; if(isWantTucao){ ;__p += '\n <div class="want-tucao ' +((__t = ( !isLookingForService ? 'onlyone':'')) == null ? '' : __t) +'" data-name="want-tucao">\n <span class="icon sys-icon-tucao" >\n </span>\n <span class="tucao-text" > ' +((__t = ( !isLookingForService ? '我要吐槽':'要吐槽')) == null ? '' : __t) +'</span>\n </div>\n '; } ;__p += '\n </div>\n <div class="tucao-service-container tucao-service-norrow-layout ' +((__t = ( isLookingForService && !isWantTucao ? 'looking-for-service-narrow' : '')) == null ? '' : __t) +'">\n <span class="norrow-icon ' +((__t = ( narrowIcon )) == null ? '' : __t) +'" ></span>\n <div class="tucao-service-list">\n '; if(isLookingForService && isWantTucao){ ;__p += '\n <div class="norrow-border"></div>\n '; } ;__p += '\n '; if(isLookingForService){ ;__p += '\n <div class="tucao-service-item looking-for-service-narrow" style="background-color: ' +((__t = ( !isWantTucao ? 'rgba(0,0,0,0.10)' : '')) == null ? '' : __t) +'" data-name="looking-for-service">' +((__t = ( !isWantTucao ? '在线客服':'找客服')) == null ? '' : __t) +'</div>\n '; } ;__p += '\n '; if(isWantTucao){ ;__p += '\n <div class="tucao-service-item" style="background-color: ' +((__t = ( !isLookingForService ? 'rgba(0,0,0,0.10)' : '')) == null ? '' : __t) +'" data-name="want-tucao">' +((__t = ( !isLookingForService ? '我要吐槽':'要吐槽')) == null ? '' : __t) +'</div>\n '; } ;__p += '\n </div>\n </div>\n\n'; } ;}return __p};
18
19 this["JST"]["sidebar/single-menu-item"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape;with (obj) {__p += '\n<a class="list-1st-a ' +((__t = ( isActive?'bg-highlight':'' )) == null ? '' : __t) +' ' +((__t = ( (type=='iframe')?'is-iframe':'' )) == null ? '' : __t) +'"\n data-udc="' +((__t = (encodeURIComponent(JSON.stringify({ext: JSON.stringify({type:'globalMenu', id: id, appid:appId })})))) == null ? '' : __t) +'"\n\thref=\'' +((__t = ((href == "" || href == "#" || type == "iframe" || type == "newPage" || type == "extLink") ? "javascript:;":(href))) == null ? '' : __t) +'\'\n\tindex="' +((__t = ( index)) == null ? '' : __t) +'"\n\ttarget= "' +((__t = ( (type=='intLink')?'_self':(type=='extLink' || type=='newPage'?'_blank':''))) == null ? '' : __t) +'"\n data-trigger="' +((__t = ( (type=='iframe')?false:'')) == null ? '' : __t) +'">\n <span class="sd-icon-before ' +((__t = (iconName)) == null ? '' : __t) +' ' +((__t = ((newCount?'sd-new-message':'') )) == null ? '' : __t) +' ' +((__t = (MenuPoint && MenuPoint.value?'sd-update-tip':'')) == null ? '' : __t) +' " >\n <span class="red-remind" data-name="feed-all-indicator" ></span>\n <span class="new-tip" data-name="update-tip" ></span>\n </span>\n <span class="text" data-id="' +((__t = (appId)) == null ? '' : __t) +'">' +((__t = (title)) == null ? '' : __t) +'</span>\n\n</a>';}return __p};
20 return this["JST"];
21 })();
22 var SingleItem = Talent.ItemView.extend({
23 template: jst["sidebar/single-menu-item"],
24 className: "",
25 initialize: function(options) {
26 this.model = new Talent.Model(options);
27 this.model.set({
28 maxWidth: 0,
29 });
30 this.listenTo(this.model, "change", this.render)
31 this.Viewindex = options.index
32 },
33 ui: {
34 memuItem: ".list-1st-a",
35 },
36 events: function() {
37 var events = {}
38 events["click " + this.ui.memuItem] = "menuItemClick"
39 events["mouseenter " + this.ui.memuItem] = "itemMouseEnter"
40 events["mouseleave " + this.ui.memuItem] = "itemMouseLeave"
41 return events
42 },
43 //导航点击
44 menuItemClick: function(e) {
45 this.trigger("getLayout");
46
47 // //自行消除高亮。
48 // this.model.set({
49
50 // maxWidth: $.cookie("pMenuMaxWidth"),
51 // })
52 this.model.set({ newCount: false })
53 this.model.set({ MenuPoint: false })
54 },
55 clickType: function(isNarrowLayout) {
56 if (isNarrowLayout) {
57 this.trigger("pseudoClick", this.model.toJSON())
58 } else {
59 this.trigger("itemClick", this.model.toJSON())
60 }
61 },
62 //立即消除当前高亮
63 highlightCancle: function(htInfo) {
64
65 this.model.set({ isActive: false })
66 },
67 //延时添加高亮。腾出滑块运动的时间。
68 highlightAdd: function() {
69
70 this.model.set({ isActive: true })
71 },
72 //鼠标移入
73 itemMouseEnter: function() {
74
75 this.triggerData("addClass")
76 },
77 //鼠标移出
78 itemMouseLeave: function() {
79 this.triggerData("removeClass")
80 },
81 triggerData: function(classOpr) {
82 // debugger;
83 var data = {
84 id: this.model.get("id"),
85 index: this.model.get("index"),
86 isActive: this.model.get("isActive"),
87 classOpr: classOpr,
88 };
89
90 this.trigger("mouse-enter-leave", data)
91 },
92 //更新model
93 itemReload: function(newData) {
94
95 newData.isActive = newData.isActive ? true : false
96 newData.newCount = newData.newCount ? true : false
97 newData.index = this.Viewindex
98 newData.isActive = this.isActive;
99
100 this.model.clear({ silent: true }).set(newData)
101 },
102 setMsgNotice: function(resp) {
103 this.model.set({ newCount: resp })
104 },
105 })
106
107 var MultipleItem = Talent.Layout.extend({
108 template: jst["sidebar/multiple-menu-item"],
109 className: "has-sub-list",
110 initialize: function(options) {
111 this.options = options
112 this.viewIndex = options.index
113 this.model = new Talent.Model(options)
114 this.listenTo(this.model, "change", this.render)
115 //标记为二级导航
116 this.isSubNav = true
117 //记录当前是否展开
118 this.listIsOpen = false
119 //是否需要一个字段记录当前时候有子级导航高亮。????
120 this.subListHeight = 34 * this.options.children.length
121 //是否首次加载
122 },
123 ui: {
124 menuItem: ".list-1st-a", //一级导航
125 subItem: ".list-2sd-li", //二级导航
126 listWrap: ".list-2sd-ul", //二级导航容器
127 },
128 events: function() {
129 var events = {}
130 events["click " + this.ui.subItem] = "subNavClick"
131 events["click " + this.ui.menuItem] = "listSwitch"
132 events["mouseenter " + this.ui.menuItem] = "superItemEnter"
133 events["mouseleave " + this.ui.menuItem] = "superItemLeave"
134 return events
135 },
136 onShow: function() {
137 // 快速入口锁定展开模式 20170214
138 if (this.model.get("isQuickEntry")) {
139 this.$el.addClass("open quick-entry")
140 }
141 },
142 //收起\展开二级菜单
143 listSwitch: function(flag) {
144 // debugger;
145 // 如果为快速入口模式,则直接返回,不收起 20170214
146 if (this.model.get("isQuickEntry")) return
147
148 if (flag && flag.isFromQuickEntry) {
149 var self = this
150 if (!this.listIsOpen) {
151 this.superMenuHighlightSwitch(true)
152 }
153 var heightGap = flag.p.cIndex >= 0 ? flag.p.cIndex * 34 + 44 : 0
154 var positionY = self.$el.position().top
155 self.trigger("listSwitch", {
156 top: positionY,
157 subListHeight: heightGap,
158 isOpen: self.listIsOpen,
159 target: self,
160 isFromQuickEntry: flag && flag.isFromQuickEntry ? true : false,
161 })
162 } else {
163 this.listIsOpen = !this.listIsOpen;
164 // debugger;
165 // $('.list-1st-a').removeClass('bg-highlight');
166 this.$el.toggleClass("open");
167
168 this.superMenuHighlightSwitch()
169 var highlightChildNode = this.ui.listWrap.find(".bg-highlight")
170 var heightGap = highlightChildNode.length
171 ? (parseInt(highlightChildNode.attr("index")) + 1) * 34
172 : this.subListHeight;
173
174 var positionY = this.$el.position().top
175 this.trigger("listSwitch", {
176 top: positionY,
177 subListHeight: heightGap,
178 isOpen: this.listIsOpen,
179 target: this,
180 isFromQuickEntry: flag && flag.isFromQuickEntry ? true : false,
181 })
182 }
183 },
184 //二级导航点击
185 subNavClick: function(e) {
186 var subIndex = Talent.$(e.currentTarget).attr("index"), //记录当前点击的二级菜单的索引
187 model = this.model.toJSON().children[subIndex];
188
189
190 this.trigger("itemClick", model)
191 this._setMenuPoint(subIndex)
192 },
193 //模拟用户点击
194 simSubNavClick: function(index) {
195 var firstDom = this.$el
196 .find(".list-2sd-ul")
197 .children()
198 .eq(index)
199 .children()
200 firstDom.click()
201 },
202 _setMenuPoint: function(subIndex) {
203 var model = this.model.get("children")[subIndex]
204 if (model.MenuPoint && model.MenuPoint.value == false) {
205 return
206 }
207 model.MenuPoint && (model.MenuPoint.value = false)
208 this.model.set({ MenuPoint: false })
209 },
210 //一级导航高亮切换
211 superMenuHighlightSwitch: function(flag) {
212
213 if (flag) {
214 var self = this;
215
216 setTimeout(function() {
217 self.ui.menuItem.addClass("bg-highlight")
218 }, 300)
219 } else {
220
221 var isHasHighLightChild = this.ui.listWrap.find(".bg-highlight")
222 .length
223 this.ui.menuItem[isHasHighLightChild ? "addClass" : "removeClass"](
224 "bg-highlight"
225 )
226 }
227 },
228 //鼠标移动到一级导航
229 superItemEnter: function(e) {
230 this.dataTrigger("addClass")
231 },
232 //鼠标离开一级导航
233 superItemLeave: function() {
234 this.dataTrigger("removeClass")
235 },
236 dataTrigger: function(classOpr) {
237
238 var data = {
239 id: this.model.get("id"),
240 index: this.model.get("index"),
241 isActive: this.ui.menuItem.hasClass("bg-highlight"),
242 classOpr: classOpr,
243 }
244 this.trigger("mouse-enter-leave", data)
245 },
246 //父级调用,当展开另外一个导航时,收起改导航
247 listClose: function() {
248 this.listIsOpen = false
249 this.$el.removeClass("open")
250 this.superMenuHighlightSwitch()
251 var highlightChildNode = this.ui.listWrap.find(".bg-highlight")
252 var heightGap = highlightChildNode.length
253 ? (parseInt(highlightChildNode.attr("index")) + 1) * 34
254 : this.subListHeight
255 var positionY = this.$el.position().top
256 this.trigger("listSwitch", {
257 top: positionY,
258 subListHeight: heightGap,
259 isOpen: this.listIsOpen,
260 target: this,
261 })
262 },
263 //供父级调用,用于刷新改view
264 itemReload: function(newData) {
265 newData.isActive = newData.isActive ? true : false
266 newData.newCount = newData.newCount ? true : false
267 newData.index = this.viewIndex
268 this.model.clear({ silent: true }).set(newData)
269 },
270 //静默更新高亮,场景是在窄屏下静默更新左侧导航。
271 highlightReset: function(p) {
272 this.dataArrange({})
273 },
274 //点击更新高亮,是直接添加class,因为要保留动效。直接reload,会使动效消失。
275 highlightAdd: function(p) {
276
277 // debugger;
278 this.ui.listWrap.find(".ani-item-" + p.cIndex).addClass("bg-highlight")
279 var children = this.model.get("children") || []
280 if (this.model.get("children")) {
281 this.$el.addClass("open");
282 this.$el.find('.list-1st-a').addClass('bg-highlight');
283 }
284 },
285 highlightCancle: function(p) {
286 this.$el.find(".bg-highlight").removeClass("bg-highlight")
287 },
288 //窄屏下,来自右侧导航部分的高亮同步
289 dataArrange: function(subItem) {
290
291 var newModel = JSON.parse(JSON.stringify(this.model.toJSON()))
292 Talent._.each(newModel.children, function(item, index) {
293 item.isActive = item.id == subItem.id ? true : false
294 })
295 this.itemReload(newModel)
296 },
297 })
298
299 var BgSlider = Talent.Layout.extend({
300 template: jst['sidebar/bg-slider']
301 ,className : 'bg-slider silder-hidden'
302 ,initialize:function(options){
303 this.positionY = 0;
304 }
305 /*
306 显式更新滑块位置
307 */
308 ,sliderAni:function(newStyle){
309 var self = this;
310 this.$el.removeClass("silder-hidden");
311 this.sliderGo(newStyle);
312 //滑块移动结束后抛出事件.
313 setTimeout(function(){
314 self.trigger('aniFinish');
315 self.$el.addClass("silder-hidden");
316 },300);
317 }
318 /*
319 隐式更新滑块位置。
320 调用场景:当前高亮,处在展开二级菜单的下面或者二级菜单中,
321 此时收起展开该菜单需要隐式更新滑块的位置。
322 */
323 ,positionResetSlice:function(newStyle){
324 this.sliderGo(newStyle);
325 }
326 //滑块移动,根据设备支持情况,选择不同的移动方式。
327 ,sliderGo:function(style){
328 this.positionY = style.top;
329 this.height = style.height;
330
331 var transformSupportTest = this.transitionSupport()("transform");
332 var transitionSupportTest = this.transitionSupport()("transition");
333
334 if(transformSupportTest.isSupport && transitionSupportTest.isSupport){
335 //这里期望的是在低版本浏览器中不支持transform ,就可以添加对应的前缀如-webkit-transform!
336 this.transformGo(style,transformSupportTest.props);
337 }else{
338 this.topGo(style);
339 }
340 }
341 //通过transtale3d,开启硬件加速移动滑块。
342 ,transformGo:function(style,prop){
343 var cssStyle = {};
344 cssStyle[prop] = 'translate3d(0,'+style.top+'px,0)';
345 cssStyle.height = style.height;
346 this.$el.css(cssStyle);
347 }
348 //不支持transalte,则使用top属性移动滑块
349 ,topGo:function(style){
350 this.$el.css({top:style.top,'height':style.height});
351 }
352 //transition Support
353 ,transitionSupport:function(){
354 var div = document.createElement('div'),
355 vendors = 'Khtml Ms O Moz Webkit'.split(' '),
356 len = vendors.length;
357
358 return function(prop) {
359 if ( prop in div.style ) return {isSupport:true,props:prop};
360
361 prop = prop.replace(/^[a-z]/, function(val) {
362 return val.toUpperCase();
363 });
364 while(len--) {
365 if ( vendors[len] + prop in div.style ) {
366 // browser supports box-shadow. Do what you need.
367 // Or use a bang (!) to test if the browser doesn't.
368 return {isSupport:true,props:vendors[len] + prop};
369 }
370 }
371 return false;
372 };
373 }
374 });
375
376
377
378
379
380
381
382
383
384 var NarrowListExtend = Talent.Layout.extend({
385 template: jst['sidebar/narrow-list-extend']
386 ,className : 'list-narrow-outer'
387 ,initialize:function(options){
388 this.options = options;
389 this.model = new Talent.Model(options);
390 this.listenTo(this.model,'change',this.render);
391 //the highlight node info before user interaction
392 this.preHLT = null;
393 }
394 ,ui: {
395 superLi:".no-sub-list .list-1st2-a" //First level navigation (without Second level navigation)
396 ,subItem:".shadow-list-a" //sub menu
397 ,listItem:".list-1st2-li"
398 ,ListWrap:".list-narrow-wrapper"
399 }
400 ,events: function () {
401 var events = {};
402 events['click ' + this.ui.superLi] = "superItemClick";
403 events['click ' + this.ui.subItem] = "subListClick";
404 events['mouseenter ' + this.ui.listItem] = 'showSpread';
405 events['mouseleave ' + this.ui.listItem] = 'hideSpread';
406 return events;
407 }
408 ,onShow:function(){
409 // 快速入口锁定展开模式 20170214
410 if (this.model.get('isQuickEntry')){
411 this.$el.addClass('quick-entry')
412 }
413
414 }
415 ,showSpread:function(e){
416 var parentNode = $(e.target).parents(".list-1st2-li");
417 parentNode.addClass("list-spread");
418 }
419 ,hideSpread:function(e){
420 $(e.target).parents(".list-1st2-li").removeClass("list-spread");
421 }
422 //First level navigation(without Second level navigation)
423 ,superItemClick:function(e){
424 var self = this,
425 highlightNode = $(e.target).parent();
426 highlightNode.removeClass("bg-ripple").addClass("bg-ripple");
427 this.$el.find(".shadow-bg").removeClass("shadow-bg");
428 var index = $(e.currentTarget).attr('index');
429 var itemInfo = self.options.menuArry[index];
430
431 self.trigger('superItemActive',itemInfo);
432 setTimeout(function(){
433 highlightNode.removeClass("bg-ripple list-spread").addClass('shadow-bg');
434 },450);
435 }
436 //second level navigation events when clicked,add highlight and notice the left navigation
437 ,subListClick:function(e){
438 // debugger;
439 var self = this;
440 // $('.list-1st-a').removeClass('bg-highlight');
441 // $('.has-sub-list').removeClass('open')
442 var curNode = $(e.target);
443 //!!!need to reduct!!!
444 this.$el.find(".shadow-bg").removeClass("shadow-bg");
445 curNode.removeClass("bg-ripple").addClass("bg-ripple");
446
447 var nodeSuperIndex = curNode.attr("super-index");
448 var nodeSubIndex = curNode.attr("sub-index");
449 var superNodeInfo = JSON.parse(JSON.stringify(this.model.toJSON())).menuArry[nodeSuperIndex];
450 var triggerData = {
451 superNodeInfo:superNodeInfo
452 ,subNodeInfo:superNodeInfo.children[nodeSubIndex]
453 }
454 this.trigger("sublistActive",triggerData);
455 //这里将添加双定时器,用于执行动效后刷新model。
456 setTimeout(function(){
457 curNode.parents(".list-1st2-li").removeClass("list-spread");
458 },450);
459 }
460 //spread navigation when super layer fired
461 ,itemSpreade:function(resp){
462
463 var oprNode = this.$el.find(".sp-item-"+resp.index);
464 oprNode[resp.classOpr]("list-spread");
465 this.$el[resp.classOpr]("extend");
466 this.subListOpen(oprNode,resp);
467 }
468 //renew scrollTop when super layer scrolled
469 ,setScrollTop:function(top){
470 this.ui.ListWrap.css("top",-top);
471 this.positionTop = top;
472 }
473 //hover to open/close sub navigations 、determine which direction to open/close.
474 ,subListOpen:function(node,resp){
475 var ulNode = node.find('.list-2sd2-ul');
476 // Reset location mode
477 ulNode.removeClass("bottom-position").addClass("top-position");
478 // Get the distance from the top of the current node distance
479 var itemPosition = node.offset().top;
480 // var ua = navigator.userAgent.toLowerCase();
481 // if (ua.indexOf("msie") > 0 || ua.indexOf("trident") > 0) {
482 // this.ui.ListWrap.addClass("list-narrow-wrapper-ie-top");
483 // }
484 // Get the height of current window
485 var windowH = $(window).height();
486 // Get the height gap between the bottom of the current node and the bottom of current page.
487 var heightGap = windowH - itemPosition - 50;
488 var sublistHeight = this.options.menuArry[parseInt(resp.index)].children.length * 40;
489 if ((heightGap-sublistHeight)>20) {
490 return;
491 }
492 ulNode.addClass("bottom-position").removeClass("top-position");
493 }
494 //moder reset to fire render
495 ,modelReset:function(p){
496 var self = this;
497 var currentModel = JSON.parse(JSON.stringify(this.model.toJSON()));
498 Talent._.each(currentModel.menuArry,function(item,index){
499 item.isActive = (item.id == p.fId)?true:false;
500 Talent._.each(item.children,function(subItem,index){
501 subItem.isActive = (subItem.id == p.cId)?true:false;
502 subItem.isActive&&(item.isActive = true);
503 });
504 });
505 setTimeout(function(){
506 self.model.clear({silent:true}).set(currentModel);
507 },700)
508 }
509 // 伪点击,用于在窄屏状态下点击图标区域,实现高亮。
510 ,pseudoClick:function(node){
511 this.$el.find(".sp-item-"+node.index).find(".list-1st2-a ").click();
512 }
513 ,onRender:function(){
514 // 重新渲染的时候,需要初始化top值
515 this.setScrollTop(this.positionTop);
516 }
517 });
518
519 var SideBar = Talent.Layout.extend({
520 template: jst['sidebar/side-bar'],
521 className: 'page-sidebar-wrapper page-spread-layout',
522 defaults: {
523 menuArry: [],
524 spreadWidth: 180, //展开时的菜单宽度
525 norrowWidth: 50, //收起时菜单宽度
526 isLookingForService: false,
527 isWantTucao: true,
528 },
529 initialize: function(options) {
530 var narrowIcon;
531 if (options.isLookingForService && options.isWantTucao) {
532 narrowIcon = 'sys-icon-kefu-tucao';
533 } else {
534 narrowIcon = options.isWantTucao ? 'sys-icon-tucao' : 'sys-icon-kefu'
535 }
536 this.options = Talent._.extend({}, this.defaults, options, {narrowIcon: narrowIcon});
537 this.model = new Talent.Model(this.options);
538
539 //layout tag
540 this.isNarrowLayout = false
541 //记录当前展开的二级导航
542 this.preOpenList = null
543 //是否是首次加载
544 this.isFirstInit = true
545 //初始化布局
546 this.initLayout()
547 //是否是一级菜单
548 this.isFirstLevel = false
549 },
550 regions: {
551 bgSilderRegion: '.bg-slider-region',
552 listNarrowExtend: '.list-narrow-extend'
553 },
554 ui: {
555 layoutSwitchBtn: "[data-name='switch']",
556 shadowTop: "[data-name='top-shadow']",
557 shadowBottom: "[data-name='bottom-shadow']",
558 itemWrapper: 'ul.list-1st-ul',
559 btnWrap: '.status-switch-wrapper',
560 lookingForService: "[data-name='looking-for-service']",
561 wantTucao: "[data-name='want-tucao']",
562 sideBarBottom:".tucao-service-container",
563 tucaoIcon: '.sys-icon-tucao',
564 kefuIcon: '.sys-icon-kefu',
565 },
566 events: function() {
567 var events = {}
568 events['click ' + this.ui.layoutSwitchBtn] = '_changeLayout'
569 events['click ' + this.ui.wantTucao] = 'clickWantTucao'
570 events['click ' + this.ui.lookingForService] = 'clickLookingForService'
571 events['click ' + this.ui.tucaoIcon] = 'clickWantTucao'
572 events['click ' + this.ui.kefuIcon] = 'clickLookingForService'
573 return events
574 },
575 onRender: function() {
576 //渲染背景滑块
577 this.bgSilder = new BgSlider()
578 this.bgSilderRegion.show(this.bgSilder)
579 //渲染窄屏的扩展导航
580 this.narrowListExtend = new NarrowListExtend(this.options)
581 this._listExtendListener()
582 this.listNarrowExtend.show(this.narrowListExtend)
583 //迭代渲染每一个导航.
584 this._baseViewCreate()
585 //页面加载,告知使用者当前应该显示的布局状态。
586 this.triggerLayoutStatus()
587
588 },
589 onShow: function() {
590 $('.page-sidebar-wrapper .list-1st-li').width(this.options.spreadWidth);
591 if (this.options.spreadWidth === 220) {
592 $('.page-sidebar-wrapper').addClass('large-sidebar');
593 } else {
594 $('.page-sidebar-wrapper').addClass('small-sidebar');
595 }
596 // 以180的宽度为基准计算菜单下文本的宽度
597 // $('.page-sidebar-wrapper .text').css({
598 // maxWidth: this.options.spreadWidth - 180 + 102
599 // });
600 // $('.page-sidebar-wrapper .list-2sd-li-title').css({
601 // maxWidth: this.options.spreadWidth - 40
602 // });
603 // this._createCookie('pMenuMaxWidth', this.options.spreadWidth - 180 + 102, 30);
604 // this._createCookie('cMenuMaxWidth', this.options.spreadWidth - 40 , 30)
605
606 //同步滚动
607 this._syncRoll()
608 },
609 _baseViewCreate: function(options) {
610 var self = this
611 Talent._.each(this.options.menuArry, function(item, index) {
612 //如果id存在定义,则创建view。
613 if (item.id !== undefined) {
614 //初始化dataformat
615 item.isActive = item.isActive ? true : false
616 item.newCount = item.newCount ? true : false
617 item.MenuPoint =
618 typeof item.MenuPoint == 'object' ? item.MenuPoint : {}
619 item.index = index
620 // item.highLightFlag = false
621 // item.children && item.children.forEach(function (i) {
622 // // debugger
623 // if(i.id == self.model.get('highLightId')) {
624 // item.highLightFlag = true
625 // }
626 // })
627 // console.log(self.model.get('highLightId'))
628 // console.log(item.children)
629
630 // debuggerF
631 var node = document.createElement('li')
632 //按照数据id字段,拼接唯一viewName,动态创建viewRegionName
633 var itemViewName = 'menuItem' + item.id
634 var regionName = itemViewName + '-region'
635 var className = 'list-1st-li ' + regionName;
636 if (item.children.length) {
637 className += ' has-child';
638 }
639 $(node).addClass(className)
640 self.ui.itemWrapper.append(node)
641 self.addRegion(regionName, '.' + regionName)
642 self[itemViewName] = item.children.length
643 ? new MultipleItem(item)
644 : new SingleItem(item)
645 //注册监听事件
646 self.baseViewListener(self[itemViewName])
647 self[regionName].show(self[itemViewName])
648 }
649 })
650 },
651 baseViewListener: function(baseView) {
652 var self = this
653 this.listenTo(baseView, 'itemClick', function(itemInfo) {
654 window.localStorage.setItem('italent_active_appId', itemInfo.appId);
655 window.localStorage.setItem('italent_active_appName', itemInfo.title);
656 window.localStorage.setItem('italent_active_id', itemInfo.id);
657 // 打开新窗口 用a标签的blank打开 会有原来的页面白页问题
658 console.log(itemInfo.type)
659 if (itemInfo.type == 'newPage' || itemInfo.type == 'extLink') {
660 // var otherWindow = window.open();
661 // otherWindow.opener = null;
662 // otherWindow.location = itemInfo.href;
663 window.open(itemInfo.href)
664 return
665 }
666
667 self.isFirstLevel = itemInfo.level == 1
668 self._triggerHash(itemInfo)
669 // debugger
670 })
671 //监听二级导航展开、收起操作,静默更新滑块位置,并收起上一步的展开导航。
672 this.listenTo(baseView, 'listSwitch', function(listInfo) {
673 clearTimeout(self._timer)
674 // 如果来自快速入口,滑块执行动效
675 if (listInfo.isFromQuickEntry) {
676 var subListHeight = listInfo.isOpen ? listInfo.subListHeight : 0
677 var sliderHeight = listInfo.isOpen ? 34 : 44
678 var newTop = listInfo.target.$el.position().top + subListHeight
679 this.bgSilder.sliderAni({ top: newTop, height: sliderHeight })
680 setTimeout(function() {
681 self.bgSilder.positionResetSlice({
682 top: newTop,
683 height: sliderHeight
684 })
685 }, 300)
686 } else {
687 // 如果滑块处在当前展开的节点的下方,则需要静默更新滑块位置
688 if (self.bgSilder.positionY >= listInfo.top) {
689 var topAdd = listInfo.isOpen
690 ? listInfo.subListHeight
691 : -listInfo.subListHeight
692 var newTop = self.bgSilder.positionY + topAdd
693 self.bgSilder.positionResetSlice({
694 top: newTop,
695 height: self.bgSilder.height
696 })
697 }
698 // 如果当前有展开的导航,这当前展开导航与target不一致,这收起之前导航
699 if (self.preOpenList && self.preOpenList != listInfo.target) {
700 self.preOpenList.listClose()
701 }
702 }
703 //加载第一个下拉菜单选项
704 // 去掉了这一坨的判断,因为在第一次点击二级菜单时 self.preOpenList 默认是null,self.isFirstLevel也是false,导致条件不通过
705 // if (listInfo.isOpen && (self.preOpenList && self.preOpenList != listInfo.target || self.isFirstLevel)) {
706 if (listInfo.isOpen) {
707 // 当点击的一级菜单有二级菜单,并且一级菜单的appid是1020时,展开默认选中第一个二级菜单 ---2018.4.2 曹尔国
708 var appid = listInfo.target.model.get('appId') || 0
709 // 如果self.preOpenList是null,并且进入到1020时,选中第一个
710 // 或者,如果self.preOpenList不是null,并且当前打开的和self.preOpenList不相同,并且进入到1020时,选中第一个
711 if (
712 ((self.preOpenList &&
713 self.preOpenList != listInfo.target) ||
714 !self.preOpenList) &&
715 (appid == 1020 || appid == 962)
716 ) {
717 self._timer = setTimeout(function() {
718 baseView.simSubNavClick(0)
719 }, 250)
720 }
721 }
722
723 self.preOpenList = listInfo.target
724 })
725 //在窄屏下,监听左侧导航鼠标enter\leave事件,弹出右侧扩展导航
726 this.listenTo(baseView, 'mouse-enter-leave', function(resp) {
727 self.isNarrowLayout && self.narrowListExtend.itemSpreade(resp)
728 })
729 //以下两个事件监听,实现窄屏状态下左侧导航部分的伪点击
730 this.listenTo(baseView, 'getLayout', function() {
731 baseView.clickType(self.isNarrowLayout)
732 })
733 this.listenTo(baseView, 'pseudoClick', function(node) {
734 self.narrowListExtend.pseudoClick(node)
735 })
736 },
737 _listExtendListener: function() {
738
739 var self = this
740 this.listenTo(this.narrowListExtend, 'superItemActive', function(
741 simpleNavInfo
742 ) {
743
744 self._triggerHash(simpleNavInfo)
745 })
746 this.listenTo(this.narrowListExtend, 'sublistActive', function(p) {
747
748 self._triggerHash(p.subNodeInfo)
749 })
750 },
751 //switch layout
752 _changeLayout: function() {
753 var norrowWidth = this.options.norrowWidth,
754 spreadWidth = this.options.spreadWidth
755 this.$el.width(!this.isNarrowLayout ? norrowWidth : spreadWidth)
756 this.$el
757 .toggleClass('page-spread-layout')
758 .toggleClass('page-norrow-layout')
759 this.isNarrowLayout = !this.isNarrowLayout
760 this.triggerLayoutStatus()
761 var newCk = this.isNarrowLayout ? 'narrow' : 'extend'
762 //手动切换布局时,种下cookie,记录当前选中状态。并设定有效期为30天。
763 this._createCookie('layoutStatus', newCk, 30);
764
765 },
766 //双滚动同步
767 _syncRoll: function() {
768 var self = this
769 Talent.$('.list-outer-wrapper').scroll(function(top) {
770 //this.scrollTop是否存在浏览器兼容性
771 self.narrowListExtend.setScrollTop(this.scrollTop)
772 //滚动添加阴影
773 var shadowTopOpr = this.scrollTop > 10 ? 'addClass' : 'removeClass'
774 self.ui.shadowTop[shadowTopOpr]('top-shadow')
775 var shadowBottomOpr =
776 this.scrollHeight - this.offsetHeight - this.scrollTop > 10
777 ? 'addClass'
778 : 'removeClass'
779 self.ui.shadowBottom[shadowBottomOpr]('bottom-shadow')
780 })
781 var windowH = $(window).innerHeight() - 95 - 36 //当前页面可以容纳的滚动最大高度(底部预留30px空白).
782 // 首次加载判断是否添加阴影
783 if ($('.list-1st-ul').height() > windowH) {
784 this.ui.shadowBottom.addClass('bottom-shadow')
785 }
786 //(用户习惯优化)OS系统,自动隐藏滚动条,windows始终显示滚动条
787 var isAlwaysVisible = this.isOS() ? false : true
788 var slimScroll = Talent.$('.list-outer-wrapper').slimScroll({
789 height: windowH, //滚动区域的高度
790 color: '#000', //滚动条颜色
791 opacity: 0.3, //滚动条透明度
792 size: 6, //滚动条宽度
793 distance: 2, //滚动条距离右侧边界的距离
794 // alwaysVisible:isAlwaysVisible, //是否自动隐藏滚动条
795 alwaysVisible: true, //是否自动隐藏滚动条
796 railVisible: false, //显示滚动槽
797 railColor: '#000', //滚动槽颜色
798 railOpacity: 0.1, //滚动槽透明度
799 allowPageScroll: false, //鼠标在该区域,禁止滚动page页面
800 position: 'right'
801 })
802 this.resetScrollArea()
803 this.scrollEvent()
804 },
805 resetScrollArea: function() {
806 var self = this
807 $(window).on('resize', function() {
808 windowH = window.innerHeight - 95 - 36 //这里减去滚动区域距离页面顶部的高度,并预留出底部的空间.
809 Talent.$('.page-sidebar-wrapper .slimScrollDiv')
810 .css({ height: windowH })
811 .find('.list-outer-wrapper')
812 .css({ height: windowH });
813 // Talent.$('.list-1st-a .text').css({
814 // "display": 'inline-block'
815 // });
816 Talent.$('.list-1st-a .text').hover();
817 })
818 },
819 scrollEvent: function() {
820 var slimScrollBar = $('.slimScrollBar')
821 var slimScrollRail = $('.slimScrollRail')
822 slimScrollBar.on('mouseenter', function() {
823 slimScrollRail.css({ width: 12 })
824 })
825 slimScrollBar.on('mouseleave', function() {
826 slimScrollRail.css({ width: 8 })
827 })
828 },
829 //首次加载设置显示状态
830 initLayout: function() {
831 //如果当前存在cookie且不为空,则按照cookie来确定布局
832 var ck = this._getCookie('layoutStatus')
833 //宽屏
834 if (ck == 'extend') {
835 this.isNarrowLayout = false
836 }
837 //窄屏
838 else if (ck == 'narrow') {
839 this.isNarrowLayout = true
840 }
841 //按照页面尺寸确定宽窄状态
842 else {
843 //首次访问页面,默认是宽屏状态
844 this.isNarrowLayout = false
845 //当前没有cookie,则种下
846 var newCk = this.isNarrowLayout ? 'narrow' : 'extend'
847 //手动切换布局时,种下cookie,记录当前选中状态。并设定有效期为30天。
848 this._createCookie('layoutStatus', newCk, 30)
849 }
850 //如果当前显示窄屏,则去掉指定的className
851 if (this.isNarrowLayout) {
852 this.$el.width(this.options.norrowWidth)
853 this.$el
854 .removeClass('page-spread-layout')
855 .addClass('page-norrow-layout');
856 // Talent.$('.page-sidebar-wrapper')
857 // .find('.tucao-service-container')
858 // .css({ height: this.options.norrowWidth });
859 // this.$el.find('.tucao-service-container').width(this.options.norrowWidth)
860 // debugger
861 Talent.$('.page-sidebar-wrapper')
862 .find('.tucao-service-container').addClass('norrow-layout');
863 } else {
864 this.$el.width(this.options.spreadWidth)
865 }
866 this.triggerLayoutStatus()
867 },
868 //判断操作系统,在mac下使用系统滚动条,其他进行滚动条定制
869 isOS: function() {
870 var isOS = navigator.userAgent.indexOf('Mac', 0) != -1 ? true : false
871 return isOS
872 },
873 /* cookie create */
874 _createCookie: function(name, value, days) {
875 $.cookie(name, value, { expires: 30 })
876 },
877 /* cookie get */
878 _getCookie: function(c_name) {
879 return $.cookie(c_name)
880 },
881 /****以下是与外部交流的事件****/
882 getWidth: function() {
883 var narrowWidth = this.options.norrowWidth,
884 spreadWidth = this.options.spreadWidth
885 return { width: this.isNarrowLayout ? narrowWidth : spreadWidth }
886 },
887 //向外部抛出当前最新的宽窄状态
888 triggerLayoutStatus: function() {
889 var narrowWidth = this.options.norrowWidth,
890 spreadWidth = this.options.spreadWidth
891 this.trigger('layoutChanged', {
892 width: this.isNarrowLayout ? narrowWidth : spreadWidth,
893 isNarrowLayout: this.isNarrowLayout
894 })
895 },
896 //向外抛出hash
897 _triggerHash: function(hashData) {
898
899 this.trigger('hashChanged', hashData)
900 },
901 //供外部调用的接口,刷新指定的menuitem
902 menuItemReload: function(resp) {
903 //这里在点击二级导航时会有问题。
904 this['menuItem' + resp.id] &&
905 this['menuItem' + resp.id].itemReload(resp)
906 //这里需要实时更新this.options中的数据!!!!
907 },
908 setMsgNotice: function(resp) {
909 var msgIndex
910 if (resp.code) {
911 Talent._.each(this.options.menuArry, function(item, index) {
912 if (item.code == resp.code) {
913 msgIndex = item.index
914 }
915 })
916 } else {
917 Talent._.each(this.options.menuArry, function(item, index) {
918 if (item.id == resp.id) {
919 msgIndex = item.index
920 }
921 })
922 }
923 this['menuItem' + this.options.menuArry[msgIndex].id].setMsgNotice(
924 resp.newCount
925 )
926 },
927 _getHLTIndex: function(resp) {
928 //记录高亮的index、id
929 var h = {
930 fId: null, //默认当前高亮第一条。
931 fIndex: null,
932 cId: null,
933 cIndex: null,
934 isFromQuickEntry: resp.isQuickEntry ? true : false // 是否来自快速入口
935 }
936 // debugger
937 // 后端数据兼容处理【如果存code为真,这使用code做查找,否则使用id】
938 var keyMatch = resp.code ? 'code' : 'id'
939 //遍历得到当前高亮节点的index,默认为0
940 return this.menuItemMatch(this.options.menuArry, resp, h, keyMatch)
941 },
942 menuItemMatch: function(array, flag, h, key) {
943 Talent._.each(array, function(item, index) {
944 // 筛选非快速入口中的匹配数据
945 if (!item.isQuickEntry) {
946 if (item[key] == flag[key]) {
947 h.fId = item.id
948 h.fIndex = index
949 } else {
950 Talent._.each(item.children, function(subItem, subIndex) {
951 if (subItem[key] == flag[key]) {
952 h.fId = item.id
953 h.fIndex = index
954 h.cId = subItem.id
955 h.cIndex = subIndex
956 }
957 })
958 }
959 }
960 })
961 return h
962 },
963 _goHighLight: function(p, resp) {
964 var self = this
965 // 如果当前处在高亮,则消除
966 this.preHTView && this.preHTView.highlightCancle(p)
967 // 定制高亮
968 if (p.fIndex != null) {
969 // 获得最新高亮的id
970 // var curId = this.options.menuArry[p.fIndex].id;
971 var curId = p.fId
972 // 获得当前高亮的view,如果有定义,则高亮并更新当前高亮标记
973 var curView = this['menuItem' + curId]
974
975 if (curView) {
976 // 做动效降级处理
977 var loadTm = this.isFirstInit ? 0 : 300
978 var isSupportCss3 = this.bgSilder.transitionSupport()(
979 'transform'
980 ).isSupport
981 loadTm = isSupportCss3 ? loadTm : 0
982 setTimeout(function() {
983 curView.highlightAdd(p)
984 }, loadTm)
985 if (resp) {
986 curView.listIsOpen = true
987 }
988 // 获得滑块的高度
989 var h = p.cIndex == null || !curView.listIsOpen ? 44 : 34
990 var subTop =
991 p.cIndex == null || !curView.listIsOpen
992 ? 0
993 : p.cIndex * 34 + 44
994 var top = curView.$el.position().top + subTop
995 // 首次加载 或 窄屏
996 if (this.isFirstInit || this.isNarrowLayout) {
997 //首次加载,或者窄屏状状态下,需要静默设定滑块位置
998 if (p.isFromQuickEntry && p.cId) {
999 curView.listSwitch({ isFromQuickEntry: true, p: p })
1000 }
1001 this.bgSilder.positionResetSlice({ top: top, height: h })
1002 }
1003 // 非首次加载 && 宽屏状态下
1004 else {
1005 //非首次加载,显式设定滑块位置
1006 if (p.isFromQuickEntry && p.cId) {
1007 curView.listSwitch({ isFromQuickEntry: true, p: p })
1008 } else {
1009 this.bgSilder.sliderAni({ top: top, height: h })
1010 }
1011 }
1012 // 同步窄屏展开的高亮
1013 this.narrowListExtend.modelReset(p)
1014 this.preHTView = curView
1015 this.isFirstInit = false
1016
1017 if (
1018 curView.model.get('children') &&
1019 curView.model.get('children').length
1020 ) {
1021 self.preOpenList = curView
1022 }
1023 }
1024 }
1025 // 消高亮
1026 if (p.fIndex == null) {
1027 this.bgSilder.positionResetSlice({ top: 0, height: 44 })
1028 this.preHTView && this.preHTView.highlightCancle()
1029 }
1030 },
1031 // 同时提供通过name、id设置高亮。消高亮功能。
1032 highLightSet: function(resp) {
1033 // 获得高亮的位置
1034 if (resp != undefined) {
1035 var pInfo = this._getHLTIndex(resp)
1036 this._goHighLight(pInfo, resp)
1037 }
1038 },
1039 isSimpleNav: function(p) {
1040 // console.log(p)
1041 // console.log(options.menuArry)
1042 },
1043 clickWantTucao: function(e) {
1044 e.stopPropagation();
1045 console.log("clickWantTucao")
1046 if (this.options.clickWantTucao) {
1047 this.options.clickWantTucao()
1048 }
1049 },
1050 clickLookingForService: function(e) {
1051 e.stopPropagation();
1052 console.log("clickLookingForService")
1053 if (this.options.clickLookingForService) {
1054 this.options.clickLookingForService()
1055 }
1056 }
1057 })
1058
1059 return SideBar;
1060})