<body>
<div id="top-wrap"><iframe src="{$Url}AdminTop" name="header" target="menu" scrolling="no" frameborder="0"></iframe></div>
<div id="header">
<div class="con">
<div class="left">
欢迎登录<span class="WebName"><a href="{$Group}/Config/basic" target="main">{$WebName}</a></span>管理后台!
<eq name="AppDebug" value="1">
<a class="debug" title="网站正式发布后,请关闭调试模式!" href="{$Group}/Config/basic" target="main">调试模式</a>
</eq>
</div>
<div class="right">
<ul class="headerlist">
<li><a class="title" href="{$WebInstallDir}" target="_blank"><i class="ydimg-home"></i>网站首页</a></li>
<li><a class="title" href="{$Group}/Decoration/index" target="_blank"><i class="ydicon-zhuangxiu"></i>模板装修</a></li>
<li><a class="title" onclick="checkUpgrade(false)" target="_self"><i class="ydicon-update"></i>检查更新</a></li>
<li><a class="title" href="{$Group}/Public/ClearCache" target="main"><i class="ydimg-cache"></i>缓存管理</a></li>
<empty name="IsOem">
<li style="width: 120px;">
<a class="title"><i class="ydimg-support"></i>技术支持<i class="ydimg-bottom"></i></a>
<div class="list">
<a href="" target="_blank">帮助手册</a>
<a href="" target="_blank">二次开发手册</a>
<a href="" target="_blank">高级装修手册</a>
<a href="" target="_blank">多端小程序手册</a>
<a href="" target="_blank">官方网站</a>
</div>
</li>
</empty>
<notempty name="Language">
<li style="width: 120px;">
<a class="title" href="{$Group}/Config/language" target="main">
<i class="ydimg-lang"></i>语言切换<i class="ydimg-bottom"></i>
</a>
<div id="language" class="list">
<volist name="Language" id="l">
<a <eq name="l.LanguageMark" value="$AdminLanguageMark">class="active"</eq> οnclick="ChangeLng(this,'{$l.LanguageMark}','{$Url}','lng{$l.LanguageID}')" target="main">
<img src="{$WebPublic}Images/mark/{$l.LanguageMark}.png" />
{$l.LanguageName}</a>
</volist>
<a href="{$Group}/Language/index" target="main"><span class="add-language">+ 添加网站语言<span></a>
</div>
</li>
</notempty>
<li><a class="title" href="{$Group}/Config/theme" target="main"><i class="ydimg-theme"></i>主题颜色</a></li>
<li class="admin" style="width: 190px;">
<a class="title">
<notempty name="MemberAvatar">
<img class="avatar" src="{$MemberAvatar}" />
<else />
<img class="avatar" src="{$Images}defaultavatar.png">
</notempty>
<span class="AdminName">{$AdminName}</span><br/>
<span class="AdminGroupName">{$AdminGroupName}</span>
<i class="ydimg-bottom"></i>
</a>
<div class="list">
<a href="{$Group}/member/Modify/MemberID/{$Think.session.AdminMemberID}" target="main">个人信息</a>
<a href="{$Url}pwd" target='main'>修改密码</a>
<a href="{$Url}logout" target="_top">安全退出</a>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="menu-wrap"><iframe src="{$Url}AdminLeft/MenuTopID/{$MenuTopID}" id="menu" name="menu" target="main" scrolling="no" frameborder="0"></iframe></div>
<div id="main-wrap"><iframe src="{$Url}Welcome" id="main" name="main" frameborder="0" scrolling="yes"></iframe></div>
<empty name="IsOem">
</empty>
</body>
<script type="text/javascript">
var gUpgradeUrl = "{$Url}upgrade?debug=1";
var gTimeout = 180*1000;
var gNewVersion = "";
var gReleaseDate = "";
var gIsUpgrading = false;
var gIsReUpgrade = 0;
function checkUpgrade(isAutoCheck){
if(checkSafeQuestion()) return;
gIsUpgrading = false;
gNewVersion = "";
gReleaseDate = "";
clearTip();
var url = "{$Url}checkUpgrade?debug=1";
$.get(url, null, function(data){
var ver = (data.data && data.data.version) || "";
gNewVersion = ver;
if (data.status == 1){
gReleaseDate = data.data.date;
openUpgradeDlg("发现新版本 v"+ver, data.data.description, 1);
}else{
if(isAutoCheck){
console.log("升级检测失败:"+data.info);
}else{
var des = "<span class='des' style='color:red;'>";
des += "<img src='{$Images}artdialog/warning.png' />"+data.info+"</span>";
openUpgradeDlg("检查新版本", des, 2);
}
}
}, "json");
}
function openUpgradeDlg(title, des, mode){
$(".upgrade_title").text(title);
$(".upgrade_body").html(des);
var dlgWidth = 450;
var winWidth = parseInt( $(window).width() );
var offsetX = (winWidth-dlgWidth)/2;
$(".dlg_upgrade").css({
"top": "25%",
"left": offsetX+"px",
"width": dlgWidth+"px"
});
if(mode == 1){
$(".btnKnow").hide();
$(".btnUpgrade").show();
$(".btnReUpgrade").hide();
$(".btnCancel").show();
}else{
$(".btnKnow").show();
$(".btnUpgrade").hide();
$(".btnCancel").hide();
$(".btnReUpgrade").show();
$(".btnReUpgrade").removeClass("disabled");
$(".btnReUpgrade").attr('disabled', false);
$(".btnReUpgrade").val("重新升级");
}
$(".dlg_upgrade").show();
}
function closeUpgradeDlg(){
gIsUpgrading = false;
$(".dlg_upgrade").hide();
}
function downloadFile(){
if(!gIsUpgrading) return;
clearTip();
showTip("开始升级");
var params = {
"Step":1,
"Version":gNewVersion,
"random":new Date().getTime(),
"IsReUpgrade":gIsReUpgrade
};
$.ajax({url: gUpgradeUrl, type: "POST", timeout: gTimeout, data: params, dataType:"json",
success: function(data){
if (data.status == 1){
showTip(data.info);
unzipFile(data.data);
}else{
showError(data.info);
}
},
error:function errorCallback(obj, textStatus, errorThrown){
var errmsg = (textStatus == "timeout") ? "下载升级包超时" :"发生错误 "+obj.statusText;
showError(errmsg);
}
});
}
function unzipFile(data){
if(!gIsUpgrading) return;
var params = {
"Step":2,
"ZipFile":data['ZipFile'],
"random":new Date().getTime(),
"Version":gNewVersion,
"IsReUpgrade":gIsReUpgrade
};
$.ajax({url: gUpgradeUrl, type: "POST", timeout: gTimeout, data: params, dataType:"json",
success: function(data){
if (data.status == 1){
showTip(data.info);
upgradeDb(data.data);
}else{
showError(data.info);
}
},
error:function errorCallback(obj, textStatus, errorThrown){
var errmsg = (textStatus == "timeout") ? "解压升级包超时" :"发生错误 "+obj.statusText;
showError(errmsg);
}
});
}
function upgradeDb(data){
if(!gIsUpgrading) return;
var params = {
"Step":3,
"Version":gNewVersion,
"ReleaseDate":gReleaseDate,
"IsReUpgrade":gIsReUpgrade,
"random":new Date().getTime()
};
$.ajax({url: gUpgradeUrl, type: "POST", timeout: gTimeout, data: params, dataType:"json",
success: function(data){
if (data.status == 1){
showTip(data.info);
showTip("恭喜,升级完成!");
$(".upgrade-loading").hide();
$(".btnKnow").show();
$(".btnUpgrade").hide();
$(".btnReUpgrade").hide();
$(".btnCancel").hide();
}else{
showError(data.info);
}
},
error:function errorCallback(obj, textStatus, errorThrown){
var errmsg = (textStatus == "timeout") ? "升级数据库超时" :"发生错误 "+obj.statusText;
showError(errmsg);
}
});
}
function getTipPrefix(){
var myDate = new Date();
var hour = myDate.getHours();
var min = myDate.getMinutes();
var second = myDate.getSeconds();
if(second<10) second = "0"+second;
var prefix = "· "+hour+":"+min+":"+second+" ";
return prefix;
}
function stopUpgrade(){
gIsUpgrading = false;
$(".upgrade-loading").hide();
$(".btnUpgrade").removeClass("disabled");
$(".btnUpgrade").attr('disabled', false);
$(".btnUpgrade").val("一键升级");
$(".btnReUpgrade").removeClass("disabled");
$(".btnReUpgrade").attr('disabled', false);
$(".btnReUpgrade").val("重新升级");
}
function showTip(html){
if(!html) return;
var prefix = getTipPrefix();
html = "<div class='item'>"+prefix+html+"</div>";
$(".upgrade_tip").append(html);
}
function clearTip(){
$(".upgrade_tip").html("");
}
function showError(message){
var prefix = getTipPrefix();
html = "<div class='item'>"+prefix+"<span style='color:red;'>"+message+"</span></div>";
$(".upgrade_tip").append(html);
stopUpgrade();
}
$(document).ready(function(){
$('.headerlist li').mouseenter(function(){
$(this).find('.list').show();
})
$('.headerlist li').mouseleave(function(){
$(this).find('.list').hide();
})
$(".btnCancel").click(function(){
closeUpgradeDlg();
});
$(".btnKnow").click(function(){
closeUpgradeDlg();
});
$(".btnUpgrade").click(function(){
$(".upgrade-loading").show();
$(".btnUpgrade").attr('disabled',true);
$(".btnUpgrade").addClass("disabled");
$(".btnUpgrade").val("升级中,请稍后...");
gIsUpgrading = true;
gIsReUpgrade = 0;
downloadFile();
});
$(".btnReUpgrade").click(function(){
$(".upgrade-loading").show();
$(".btnReUpgrade").attr('disabled',true);
$(".btnReUpgrade").addClass("disabled");
$(".btnReUpgrade").val("升级中,请稍后...");
gIsUpgrading = true;
gIsReUpgrade = 1;
downloadFile();
});
var checkUpdate = "{$CheckUpdate}";
if(1==checkUpdate) checkUpgrade(true);
});
</script>