51 行
1.8 KiB
JavaScript
可执行文件
51 行
1.8 KiB
JavaScript
可执行文件
$.post("/index.php/Vip/Signin/getsigindetail",function (data) {
|
|
setWrap(data);
|
|
})
|
|
//获取元素
|
|
var y_content = document.querySelector(".y_content");
|
|
var wrap = document.querySelector("#wrap");
|
|
|
|
//声明用到的变量
|
|
var time = new Object();
|
|
time.year = new Date().getFullYear();
|
|
time.month = new Date().getMonth();
|
|
time.date = new Date().getDate();
|
|
|
|
// setWrap();
|
|
function setWrap(data){
|
|
var fragment = document.createDocumentFragment();
|
|
var this_month_firstDay = new Date(time.year,time.month).getDay();//当月第一天是星期几;
|
|
var last_month_lastDate = new Date(time.year,time.month,0).getDate();//上个月最后一天是几号
|
|
var this_month_lastDate = new Date(time.year,time.month+1,0).getDate();//当月最后一天是几号
|
|
var this_month_lastDay = new Date(time.year,time.month+1,0).getDay();//当月最后一天是星期几
|
|
|
|
for(var i=0;i<this_month_firstDay;i++){
|
|
var li = document.createElement("li");
|
|
li.style.color="#ADADAD";
|
|
li.innerText=last_month_lastDate - this_month_firstDay+i+1;
|
|
fragment.appendChild(li);
|
|
}
|
|
for(var i=0;i<this_month_lastDate;i++){
|
|
var li = document.createElement("li");
|
|
li.innerText=i+1;
|
|
|
|
fragment.appendChild(li);
|
|
if(data.status){
|
|
for(var j = 0;j<data.data.length;j++){
|
|
if(i+1==data.data[j][2]){
|
|
li.style.color="white";
|
|
li.style.background="#FF9966";
|
|
li.style.borderRadius="50%";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for(var i= 0;i<6-this_month_lastDay;i++){
|
|
var li = document.createElement("li");
|
|
li.innerText=i+1;
|
|
li.style.color="#ADADAD";
|
|
fragment.appendChild(li);
|
|
}
|
|
wrap.appendChild(fragment);
|
|
y_content.innerText = time.year+'-'+(time.month+1)+'-'+time.date;
|
|
} |