Commit e5fbf6c1 by 梁建民

js

parent 85076827
<div class="right_header clr">
<div class="user_logo fr">
<a href="">
<img src="__PUBLIC__/images/test.jpg" alt="IClogo">
<a href="javascript:;" id="head_pic">
<img src="__PUBLIC__/images/default.jpg" alt="IC" title="IC">
</a>
</div>
<a class="message_icon fr" href="/notice">
<span class="icon iconfont iconjuxing1"></span>
<span class="num">23</span>
<span class="num" id="count_num">0</span>
</a>
<div class="input_div fr">
<input type="text" placeholder="请输入要搜索的内容">
......
!function () {
window.IcController = {
init: function () {
this.mounted(this).handleBind(this);
this.created(this).mounted(this).handleBind(this);
},
getData: function (url, type, param, callback, isload, isheader) {
......@@ -46,7 +46,7 @@
layer.msg('登录已失效,请重新登录', {time: 600}, function () {
window.location.href = home_url + '/login';
window.location.href = passport_url + '/login';
});
} else {
......@@ -65,6 +65,32 @@
}
});
},
created: function (opt) {
if ($('#head_pic').length > 0) {
//获取用户信息
this.getData(apis.userInfo, 'GET', {token: Util.getCookie('token') || ''}, function (res) {
if (res.errcode == 0) {
//消息数量
$("#count_num").empty().html(res.data['msg_notification']);
//设置头像
if (res.data.avatar) {
$("#head_pic").find('img').attr('src', res.data['avatar']);
}
}
});
}
return this;
},
mounted: function (opt) {
//导航栏
......@@ -113,7 +139,7 @@
Util.delCookie('token', cookieHostname);
window.location.href = home_url;
window.location.href = index_url;
} else {
......
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 sign in to comment