mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-24 18:04:55 +08:00
90 lines
2.3 KiB
JavaScript
90 lines
2.3 KiB
JavaScript
layui.config({
|
|
base : "/js/"
|
|
}).use(['form','element','layer','jquery'],function(){
|
|
var form = layui.form,
|
|
layer = parent.layer === undefined ? layui.layer : parent.layer,
|
|
element = layui.element,
|
|
$ = layui.jquery;
|
|
|
|
$(".panel a").on("click",function(){
|
|
window.parent.addTab($(this));
|
|
})
|
|
|
|
//动态获取文章总数和待审核文章数量,最新文章
|
|
$.get("/json/newsList.json",
|
|
function(data){
|
|
var waitNews = [];
|
|
$(".allNews span").text(data.length); //文章总数
|
|
for(var i=0;i<data.length;i++){
|
|
var newsStr = data[i];
|
|
if(newsStr["newsStatus"] == "待审核"){
|
|
waitNews.push(newsStr);
|
|
}
|
|
}
|
|
$(".waitNews span").text(waitNews.length); //待审核文章
|
|
}
|
|
)
|
|
|
|
//图片总数
|
|
$.get("/json/images.json",
|
|
function(data){
|
|
$(".imgAll span").text(data.length);
|
|
}
|
|
)
|
|
|
|
//用户数
|
|
$.get("/json/usersList.json",
|
|
function(data){
|
|
$(".userAll span").text(data.length);
|
|
}
|
|
)
|
|
|
|
//新消息
|
|
$.get("/json/message.json",
|
|
function(data){
|
|
$(".newMessage span").text(data.length);
|
|
}
|
|
)
|
|
|
|
|
|
//数字格式化
|
|
$(".panel span").each(function(){
|
|
$(this).html($(this).text()>9999 ? ($(this).text()/10000).toFixed(2) + "<em>万</em>" : $(this).text());
|
|
})
|
|
|
|
//系统基本参数
|
|
if(window.sessionStorage.getItem("systemParameter")){
|
|
var systemParameter = JSON.parse(window.sessionStorage.getItem("systemParameter"));
|
|
fillParameter(systemParameter);
|
|
}else{
|
|
$.ajax({
|
|
url : "/json/systemParameter.json",
|
|
type : "get",
|
|
dataType : "json",
|
|
success : function(data){
|
|
fillParameter(data);
|
|
}
|
|
})
|
|
}
|
|
|
|
//填充数据方法
|
|
function fillParameter(data){
|
|
//判断字段数据是否存在
|
|
function nullData(data){
|
|
if(data == '' || data == "undefined"){
|
|
return "未定义";
|
|
}else{
|
|
return data;
|
|
}
|
|
}
|
|
$(".version").text(nullData(data.version)); //当前版本
|
|
$(".author").text(nullData(data.author)); //开发作者
|
|
$(".homePage").text(nullData(data.homePage)); //网站首页
|
|
$(".server").text(nullData(data.server)); //服务器环境
|
|
$(".dataBase").text(nullData(data.dataBase)); //数据库版本
|
|
$(".maxUpload").text(nullData(data.maxUpload)); //最大上传限制
|
|
$(".userRights").text(nullData(data.userRights));//当前用户权限
|
|
}
|
|
|
|
})
|