$(function () {
$.post("/ajax/Admin_userlist.ashx", "", function (data) {
var d = JSON.parse(data);
var s = "";
for (var i = 0; i < d.length; i++) {
s = "<tr>";
s += "<td>" + d[i].UserId + "</td>";
s += "<td>" + d[i].UserName + "</td>";
s += "<td>" + d[i].UserPwd + "</td>";
s += "<td>" + d[i].UserPhone + "</td>";
s += "<td>" + d[i].UserCard + "</td>";
s += "<td>" + d[i].UserQQ + "</td>";
s += "<td>" + d[i].Useremail + "</td>";
s += "<td>" + d[i].Usergrous + "</td>";
s += "<td>" + d[i].ClientIP + "</td>";
s += "<td>" + FormatToDate(d[i].CreatedTime) + "</td>";
s += "<td>" + "<a href='Admin_user.aspx?id=" + d[i].UserId + "'>编辑</a>" + "</td>";
s += "<td>" + "<a href='Admin_userms.aspx?id=" + d[i].UserId + "'>站内信</a>" + "</td>";
s += "<td>" + "<a href='Admin_userem.aspx?id=" + d[i].UserId + "'>发邮箱</a>" + "</td>";
s += "<td>" + "<button onclick='del(" + d[i].UserId + ")'>删除</button>" + "</td>";
$("#userlist table").append(s);
}
})
});
function FormatToDate(val) {
if (val != null) {
var date = new Date(parseInt(val.replace("/Date(", "").replace(")/", ""), 10));
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; //补0
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var minDate = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
return date.getFullYear() + "-" + month + "-" + currentDate+ "-" + date.getHours()+ ":" +minDate+ ":" +date.getSeconds();
}
return "";
}