0901f53f by 任超

style:日期

1 parent b5203c00
......@@ -22,7 +22,7 @@
<div class='home-sticky'>
<div class='top-logo'>
<div class='top_logo_content'>
<div class="head-time">今天是2021年1月19日 星期二</div>
<div class="head-time"></div>
<ul class='login layui-nav login-con'>
<span class='loginButton' id="login">登录</span>
<p class='loginButton register' id='register'><a href='/staticViews/register.html'>注册</a></p>
......
......@@ -3,6 +3,7 @@ $(function () {
if (getItem('myCookie') && getItem('myCookie').userid) {
fetchNewsData(getItem('myCookie').userid, 5);
}
$('.head-time').html(getDateWeek())
})
function newsCenterData() {
$(document).on("mouseover", ".sysNewsList .newsDetail", function (e) {
......@@ -14,16 +15,16 @@ function newsCenterData() {
})
$(document).on("mouseover", ".sysNewsItem .userImage", function (e) {
$(this).attr('src','/staticImages/sexiaoxi.png');
$(this).attr('src', '/staticImages/sexiaoxi.png');
})
$(document).on("mouseout", ".sysNewsItem .userImage", function (e) {
$(this).attr('src','/staticImages/xiaoxi.png');
$(this).attr('src', '/staticImages/xiaoxi.png');
})
$(document).on("mouseover", ".sysNewsList", function (e) {
$('.sysNewsItem .userImage').attr('src','/staticImages/sexiaoxi.png');
$('.sysNewsItem .userImage').attr('src', '/staticImages/sexiaoxi.png');
})
$(document).on("mouseout", ".sysNewsList", function (e) {
$('.sysNewsItem .userImage').attr('src','/staticImages/xiaoxi.png');
$('.sysNewsItem .userImage').attr('src', '/staticImages/xiaoxi.png');
})
}
// 根据用户id及展示数量读取消息提醒
......@@ -33,7 +34,7 @@ function fetchNewsData(userid, size) {
var li;
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/portal/messageRemind/getDetailByUserid?userid="+userid+"&size="+size,//路径
url: portal.api_url + "/portal/messageRemind/getDetailByUserid?userid=" + userid + "&size=" + size,//路径
dataType: "json",
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
......@@ -41,11 +42,11 @@ function fetchNewsData(userid, size) {
for (var i = 0; i < result.data.length; i++) {
li = '<dd>'
li += '<a>'
li += '<p class="newsDetail ellipsis">'+result.data[i].content+'</p>'
li += '<div class="newsDetail-time"><span>'+result.data[i].addTime+'</span>'
li += '<p class="newsDetail ellipsis">' + result.data[i].content + '</p>'
li += '<div class="newsDetail-time"><span>' + result.data[i].addTime + '</span>'
if (result.data[i].status == 0) {
li += '<span clas="unread" style="color: #ff0000">未读</span></div>'
}else {
} else {
li += '<span class="read">已读</span></div>'
}
li += '</a>'
......@@ -56,3 +57,26 @@ function fetchNewsData(userid, size) {
}
});
}
function getDateWeek() {
todayDate = new Date();
date = todayDate.getDate();
month = todayDate.getMonth() + 1;
year = todayDate.getYear();
var dateweek = "今天是:";
if (navigator.appName == "Netscape") {
dateweek = dateweek + (1900 + year) + "年" + month + "月" + date + "日 ";
}
if (navigator.appVersion.indexOf("MSIE") != -1) {
dateweek = dateweek + year + "年" + month + "月" + date + "日 ";
}
switch (todayDate.getDay()) {
case 0: dateweek += "星期日"; break;
case 1: dateweek += "星期一"; break;
case 2: dateweek += "星期二"; break;
case 3: dateweek += "星期三"; break;
case 4: dateweek += "星期四"; break;
case 5: dateweek += "星期五"; break;
case 6: dateweek += "星期六"; break;
}
return dateweek;
}
\ No newline at end of file
......