d0e011c0 by 任超

style:新闻列表

1 parent e62f47ee
...@@ -384,8 +384,11 @@ div.top-logo .top_logo_search i { ...@@ -384,8 +384,11 @@ div.top-logo .top_logo_search i {
384 } 384 }
385 .newsDetail-time span{ 385 .newsDetail-time span{
386 font-size: 12px; 386 font-size: 12px;
387 color: #006CFF!important; 387 color: #555454;
388 } 388 }
389 .newsDetail-time span:nth-child(2){ 389 .newsDetail-time span:nth-child(2){
390 float: right; 390 float: right;
391 } 391 }
392 .read {
393 color: #006CFF!important;
394 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
33 width: 1200px; 33 width: 1200px;
34 margin: 0 auto; 34 margin: 0 auto;
35 padding :20px; 35 padding :20px;
36 height: 260px;
37 overflow: auto;
36 border-radius: 5px; 38 border-radius: 5px;
37 border: 1px solid #dedede; 39 border: 1px solid #dedede;
38 } 40 }
......
1 $(function () { 1 $(function () {
2 newsCenterData(); 2 newsCenterData();
3 // 3 if (getItem('myCookie') && getItem('myCookie').userid) {
4 fetchNewsData(getItem('myCookie').username); 4 fetchNewsData(getItem('myCookie').userid, 5);
5 }
5 }) 6 })
6 function newsCenterData() { 7 function newsCenterData() {
7 $(document).on("mouseover", ".sysNewsList .newsDetail", function (e) { 8 $(document).on("mouseover", ".sysNewsList .newsDetail", function (e) {
...@@ -14,6 +15,9 @@ function newsCenterData() { ...@@ -14,6 +15,9 @@ function newsCenterData() {
14 } 15 }
15 // 根据用户id及展示数量读取消息提醒 16 // 根据用户id及展示数量读取消息提醒
16 function fetchNewsData(userid, size) { 17 function fetchNewsData(userid, size) {
18 var sysNewsList = $("#sysNewsList-con");
19 sysNewsList.empty();
20 var li;
17 $.ajax({ 21 $.ajax({
18 type: "get", //提交方式 22 type: "get", //提交方式
19 url: portal.api_url + "/portal/messageRemind/getDetailByUserid?userid="+userid+"&size="+size,//路径 23 url: portal.api_url + "/portal/messageRemind/getDetailByUserid?userid="+userid+"&size="+size,//路径
...@@ -23,7 +27,18 @@ function fetchNewsData(userid, size) { ...@@ -23,7 +27,18 @@ function fetchNewsData(userid, size) {
23 if (result.code == 200 && result.data != null) { 27 if (result.code == 200 && result.data != null) {
24 console.log(result.data) 28 console.log(result.data)
25 for (var i = 0; i < result.data.length; i++) { 29 for (var i = 0; i < result.data.length; i++) {
26 30 li = '<dd>'
31 li += '<a>'
32 li += '<p class="newsDetail ellipsis">'+result.data[i].content+'</p>'
33 li += '<div class="newsDetail-time"><span>'+result.data[i].addTime+'</span>'
34 if (result.data[i].status == 0) {
35 li += '<span clas="unread" style="color: #ff0000">未读</span></div>'
36 }else {
37 li += '<span class="read">已读</span></div>'
38 }
39 li += '</a>'
40 li += '</dd>'
41 sysNewsList.append(li);
27 } 42 }
28 } 43 }
29 } 44 }
......
...@@ -111,18 +111,8 @@ function appendData() { ...@@ -111,18 +111,8 @@ function appendData() {
111 '<div class="sysNewsOperation">' + 111 '<div class="sysNewsOperation">' +
112 '<span>全部标记为已阅</span><a href="/staticViews/sysnews-center.html">查看全部</a>' + 112 '<span>全部标记为已阅</span><a href="/staticViews/sysnews-center.html">查看全部</a>' +
113 '</div>' + 113 '</div>' +
114 '<dd>' + 114 '<div id="sysNewsList-con">'+
115 '<a>' + 115 '</div>'+
116 '<p class="newsDetail ellipsis">您申请办理的XXX业务已成功提交您申请办理的XXX业务已成功提交</p>' +
117 '<div class="newsDetail-time"><span>2020-12-32</span> <span>已读</span></div>' +
118 '</a>' +
119 '</dd>' +
120 '<dd>' +
121 '<a>' +
122 '<p class="newsDetail ellipsis">您申请办理的XXX业务已成功提交您申请办理的XXX业务已成功提交</p>' +
123 '<div class="newsDetail-time"><span>2020-12-32</span> <span>已读</span></div>' +
124 '</a>' +
125 '</dd>' +
126 '</dl>' + 116 '</dl>' +
127 '</li>' + 117 '</li>' +
128 '<img class="userImage" src="/staticImages/user.png">' + 118 '<img class="userImage" src="/staticImages/user.png">' +
......
...@@ -16,15 +16,29 @@ layui.use('laydate', function () { ...@@ -16,15 +16,29 @@ layui.use('laydate', function () {
16 }); 16 });
17 }); 17 });
18 $(function () { 18 $(function () {
19 if (getItem('myCookie') && getItem('myCookie').userid) {
19 initNewsData() 20 initNewsData()
21 }
20 }) 22 })
21 function initNewsData() { 23 function initNewsData() {
22 $('.sysnews-center-tab ul li').click(function () { 24 layui.use('flow', function () {
23 $('.sysnews-center-tab ul li').removeClass('sysnewsTabActive'); 25 var flow = layui.flow;
24 $(this).addClass('sysnewsTabActive') 26 flow.load({
25 }) 27 elem: '#sys-news' //流加载容器
28 , scrollElem: '#sys-news' //滚动条所在元素,一般不用填,此处只是演示需要。
29 , done: function (page, next) { //执行下一页的回调
30 //模拟数据插入
31 setTimeout(function () {
32 var lis = [];
33 for (var i = 0; i < 8; i++) {
34 lis.push('<li>' + ((page - 1) * 8 + i + 1) + '</li>')
35 }
36
37 //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
38 //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
39 next(lis.join(''), page < 10); //假设总页数为 10
40 }, 500);
41 }
42 });
43 });
26 } 44 }
...\ No newline at end of file ...\ No newline at end of file
27 var data = { //数据
28 total: 10,
29 curr: 1
30 };
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
34 </div> 34 </div>
35 </div> 35 </div>
36 <!-- 列表 --> 36 <!-- 列表 -->
37 <ul class="sysnews-list"> 37 <ul class="sysnews-list flow-default" id="sys-news">
38 <li> 38 <li>
39 <span class="list-date">2020-12-23</span> 39 <span class="list-date">2020-12-23</span>
40 <p> 40 <p>
......