You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

296 lines
12 KiB
Plaintext

11 months ago
<%@ Page Title="系统升级" Language="C#" MasterPageFile="~/Areas/SoftMng/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
<style>
.block{
display: table;
height: 100%;
width:100%;
margin: 0;
padding: 0;
text-align: center;
font-family: 'Roboto', sans-serif;
}
a:hover {
color: #fff;
}
.block__cell{
text-align: center;
padding-top: 150px;
}
.btn{
text-decoration: none;
line-height: 46px;
padding: 0 30px 0 55px;
position: relative;
text-align: center;
display: inline-block;
background-color: #319bef;
color: #fff;
font-weight: 500;
border-radius: 23px;
font-size: 16px;
transition: all 0.5s linear;
-o-transition: all 0.5s linear;
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s ease;
overflow: hidden;
}
.btn__icon{
width: 24px;
height: 24px;
background-color: #fff;
border: 0px solid #319bef;
border-radius: 50%;
display: inline-block;
top: 11px;
position: absolute;
left: 20px;
}
.btn .btn__icon:before{
content: '';
left:0px;
top:0px;
position: absolute;
transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-moz-transition: all 0.3s ease;
}
.btn--activate .btn__icon:before{
width: 24px;
height: 24px;
background-image: url('data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+Cjxzdm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
background-position-x: center;
background-position-y: center;
}
.btn .btn__icon:after{
content: '';
top: 0px;
left: 0px;
position: absolute;
transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-moz-transition: all 0.3s linear;
}
.btn--activate .btn__icon:after{
width: 24px;
height: 24px;
background-image: url('data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI2IDI2IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyNiAyNiIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCI+CiAgPHBhdGggZD0ibS4zLDE0Yy0wLjItMC4yLTAuMy0wLjUtMC4zLTAuN3MwLjEtMC41IDAuMy0wLjdsMS40LTEuNGMwLjQtMC40IDEtMC40IDEuNCwwbC4xLC4xIDUuNSw1LjljMC4yLDAuMiAwLjUsMC4yIDAuNywwbDEzLjQtMTMuOWgwLjF2LTguODgxNzhlLTE2YzAuNC0wLjQgMS0wLjQgMS40LDBsMS40LDEuNGMwLjQsMC40IDAuNCwxIDAsMS40bDAsMC0xNiwxNi42Yy0wLjIsMC4yLTAuNCwwLjMtMC43LDAuMy0wLjMsMC0wLjUtMC4xLTAuNy0wLjNsLTcuOC04LjQtLjItLjN6IiBmaWxsPSIjMmY4OWQxIi8+Cjwvc3ZnPgo=');
background-repeat: no-repeat;
background-size: 8px;
background-position-x: center;
background-position-y: 34px;
}
.btn--activate:hover{
background-color: #2f89d1;
}
.btn--activate:hover .btn__icon{
border-color: #2f89d1;
}
.btn--activate:hover .btn__icon:before{
background-position-y: -34px;
}
.btn--activate:hover .btn__icon:after{
background-position-y: center;
}
.btn--waiting{
background-color: #2f89d1;
}
.btn--waiting .btn__icon{
background-color: transparent;
}
.btn--waiting .btn__icon:after{
width:20px;
height:20px;
top: 0px;
left: 0px;
border-radius:50%;
animation:rotation infinite linear 0.5s;
transition:none;
border-top: 2px solid transparent;
border-left: 2px solid #fff;
border-right: 2px solid transparent;
border-bottom: 2px solid transparent;
z-index: 0;
}
.btn--activated {
background-color: #44cc71;
}
.btn--activated .btn__icon:after{
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI2IDI2IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyNiAyNiIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCI+CiAgPHBhdGggZD0ibS4zLDE0Yy0wLjItMC4yLTAuMy0wLjUtMC4zLTAuN3MwLjEtMC41IDAuMy0wLjdsMS40LTEuNGMwLjQtMC40IDEtMC40IDEuNCwwbC4xLC4xIDUuNSw1LjljMC4yLDAuMiAwLjUsMC4yIDAuNywwbDEzLjQtMTMuOWgwLjF2LTguODgxNzhlLTE2YzAuNC0wLjQgMS0wLjQgMS40LDBsMS40LDEuNGMwLjQsMC40IDAuNCwxIDAsMS40bDAsMC0xNiwxNi42Yy0wLjIsMC4yLTAuNCwwLjMtMC43LDAuMy0wLjMsMC0wLjUtMC4xLTAuNy0wLjNsLTcuOC04LjQtLjItLjN6IiBmaWxsPSIjNDRjYzcxIi8+Cjwvc3ZnPgo=);
width: 24px;
height: 24px;
background-size: 10px;
background-repeat: no-repeat;
background-position-x: center;
background-position-y: center;
animation: activated 0.3s linear 1;
}
.btn__text{
position: relative;
}
.btn__text:before{
content: attr(data-after);
position: absolute;
top: -27px;
color: transparent;
z-index: -1;
color: #fff;
transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
}
.btn__text:after{
content: attr(data-wait);
position: absolute;
color: transparent;
top: 2px;
left: 0;
z-index: -1;
color: #fff;
transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
}
.btn--waiting .btn__text{
color: transparent;
}
.btn--waiting .btn__text:after{
top: -13px;
z-index: 1;
}
.btn--activated .btn__text:before{
top: -13px;
z-index: 1;
}
.btn--activated .btn__text{
color: transparent;
}
@keyframes rotation {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(360deg);
}
}
@keyframes activated {
0% {
background-position-y: 34px;
}
100% {
background-position-y: center;
}
}
#version {
font-size: 5rem;
font-family: 'Segoe Print';
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Bread" runat="server">
系统升级
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="server">
<div class="block__cell">
<h4>当前版本:<span id="version"><%=ViewData["Version"]%></span></h4>
<hr />
<a href="#" class="btn btn--activate" id="btnActivation">
<span class="btn__icon"></span>
<span class="btn__text" data-wait="请稍后..." data-after="已完成">检查升级</span>
</a>
</div>
<script>
$('#btnActivation').click(function(){
if (!$('#btnActivation').hasClass(('btn--activated'))) {
CommonAjax.Post("/SoftMng/Update/CheckUpdate",
null,
function(res) {
if (res.success) {
layer.confirm("检测到新版本,是否下载安装?", {icon:3,skin:"layui-layer-molv" },
function (index) {
layer.close(index);
$('#btnActivation').removeClass('btn--activate').addClass('btn--waiting');
//下载并安装更新
CommonAjax.Post("/SoftMng/Update/DownUpzip",
{ path: res.filename },
function (data) {
switch (data.success) {
case true:
if (data.msg.length === 0)
layer.alert("已成功完成更新", { icon: 1, skin: "layui-layer-molv" }, function(index) {
ShowNotes(data.notes);
});
else
layer.alert("已完成更新,数据库升级中遇到错误,请查看日志手动解决",
{ icon: 6, skin: "layui-layer-molv" }, function(index) {
ShowNotes(data.notes);
});
document.getElementById("version").innerText = data.appVersion;
break;
case false:
layer.alert("更新失败,详情请查看日志!", { icon: 5, skin: "layui-layer-lan" });
break;
}
if (data.msg.length > 0) {
var html = data.msg.join("");
// 实例化一个Blob对象其构造函数的第一个参数是包含文件内容的数组第二个参数是包含文件类型属性的对象
var blob = new Blob([html], { type: "text/plain" });
var a = document.createElement("a");
// 利用URL.createObjectURL()方法为a元素生成blob URL
a.href = URL.createObjectURL(blob);
// 设置文件名目前只有Chrome和FireFox支持此属性
try {
a.download = "升级失败日志_" + new Date().format("yyyy-mm-dd hh:ii") + ".txt";
} catch (e) {
layer.msg("遇到意外的错误!");
} finally {
//iE不兼容问题
if (navigator.appVersion.toString().indexOf('.NET') > 0)
window.navigator.msSaveBlob(blob, a.download);
else {
a.click();
}
}
}
$('#btnActivation').removeClass('btn--waiting').addClass('btn--activate');
});
});
} else {
layer.alert("已经是最新版本!", { icon: 1, skin: "layui-layer-molv" });
//$('#btnActivation').removeClass('btn--waiting').addClass('btn--activate');
}
});
}
});
//展示更新详情
function ShowNotes(notes) {
if (notes !== "") {
layer.open({
type: 0,
skin:"layui-layer-molv",
title: "更新详情",
area:['500px','400px'],
content:notes
});
}
}
</script>
</asp:Content>