添加新接口
This commit is contained in:
parent
849575d46f
commit
3f30b796c6
|
@ -56,18 +56,18 @@
|
|||
<ul class="nav navbar-nav">
|
||||
<!-- Messages: style can be found in dropdown.less-->
|
||||
<li class="dropdown notifications-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<a id='notificationIcon' href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="label label-warning">0</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="header">You have 10 notifications</li>
|
||||
<li id="notificationHeader" class="header">You have 0 notifications</li>
|
||||
<li>
|
||||
<!-- inner menu: contains the actual data -->
|
||||
<ul class="menu">
|
||||
<ul id='notificationList' class="menu">
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="ion ion-ios-people info"></i> Notification title
|
||||
<i class="fa fa-envelop"></i> Notification title
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -254,6 +254,40 @@
|
|||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var ajaxCfg = {
|
||||
type : "post",
|
||||
url : '/notification/query_self/',
|
||||
dataType : "json",
|
||||
data : {},
|
||||
success : function(data) {
|
||||
console.log(data);
|
||||
var notifies = data.data;
|
||||
var cnt = notifies.length;
|
||||
if(cnt != 0) {
|
||||
$("<span class=\"label label-warning\">"+cnt+"</span>").appendTo($('#notificationIcon'));
|
||||
}
|
||||
$("#notificationHeader").html("You have " + cnt + " notifications");
|
||||
for(var i = 0; i < cnt; i++) {
|
||||
var notify = notifies[i];
|
||||
console.log(notify);
|
||||
var a = $("<a href=\"/notification/detail/"+ notify.id +"/\"><i class=\"fa fa-envelop\"></i> "+ notify.title +"</a>")
|
||||
var item = $("<li></li>");
|
||||
item.append(a);
|
||||
$("#notificationList").append(item);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log(xhr);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$.ajax(ajaxCfg);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
{% if mysession['status'] == 'init' %}
|
||||
<script type="text/javascript">
|
||||
|
|
Loading…
Reference in New Issue