Commit af19a29c authored by agping's avatar agping

修改

parent a835ac3d
......@@ -35,57 +35,6 @@ define(['doT', 'jquery', 'text!temp/menu_template_tpl.html', 'layer'], function
//是否有导航栏的标识
var haveMenu = !~location.href.indexOf('/userModalList');
haveMenu && menu_bar(function(){
//回调部分
//记录tab的点击状态,对应的标签内容展开,并高亮显示
var _hash = location.pathname.replace('/admin.php/', '/');
var _tempObj = $('[href="'+_hash+'"]');
_tempObj.addClass('active-a').siblings().removeClass('active-a');
_tempObj.closest('.dropdown-menu').prev().attr('aria-expanded', true).parents().addClass('open').siblings().removeClass('open');
});
function menu_bar(fn) {
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
console.log(user_info_obj);
//登录时间无效 直接跳转登录页面
if(!user_info_obj){
alert('登录失效,请您重新登录');
window.location.href="login.html";
}
$ ("#menu_bar").append (template);
if (user_info_obj) {
console.log(document.getElementById ('menu_tpl'))
var temp = document.getElementById ('menu_tpl').innerHTML;
var doTtmpl = doT.template (temp);
// alert(user_info_obj['name'])
// $ ("#dropdownMenu1").append(user_info_obj['name']);
$ ("#menu_bar").html (doTtmpl (user_info_obj['menu']));
//回调
fn && fn();
} else {
$.ajax ({
url: '/index/getMenu',
type: 'POST',
async: true,
data: "",
dataType: 'json',
success: function (data) {
var temp = document.getElementById ('menu_tpl').innerHTML;
var doTtmpl = doT.template (temp);
$ ("#menu_bar").html (doTtmpl (data.data.menu));
//回调
fn && fn();
}
});
}
}
$("#logout").click(function () {
localStorage.removeItem('pcUserInfo');
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment