canyin-project/ybcy/views/admin/site/site_cloud_upgrade.php
2024-11-01 16:07:54 +08:00

262 lines
10 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<?php if($this->params['site_image']):?>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $this->params['site_image'];?>" />
<?php else:?>
<link rel="shortcut icon" type="image/x-icon" href="<?=Yii::$app->request->baseUrl?>/web/favicon.ico" />
<?php endif;?>
<title><?php if($this->params['site_title']):?>
<?php echo $this->params['site_title']; ?>
<?php else:?>
应用管理后台
<?php endif;?>-系统升级</title>
<link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl?>/web/static/css/globle.css"/>
<script src="<?=Yii::$app->request->baseUrl?>/web/static/js/config.js" type="text/javascript" charset="utf-8"></script>
</head>
<style>
.el-progress-circle{
width:200px !important;
height: 200px !important;;
}
.el-progress__text{
font-size: 40px !important;
}
.mar_t60{
margin-top: 60px;
}
.fileshow{
background: #D9EDF7;
border:1px solid #BCE8F1;
color: #2A6C8B;
}
.leftWidth{
width: 130px;
}
.el-alert--success.is-light {
padding: 12px;
/*border: 1px solid #67C23A;*/
}
.el-icon-check:before {
display: inline-block;
margin-top: 12px;
transform: rotate(0deg);
position: relative;
top: -3px;
}
</style>
<body>
<div class="head">
<div class="publicHeader"><?php echo $this->render('@app/views/admin/public/publicHeader.html');?></div>
</div>
<div class="left">
<div class="publicAside"><?php echo $this->render('@app/views/admin/public/publicAside.html');?></div>
</div>
<div class="yb_body">
<div class="layout" id="platformList">
<el-container>
<el-container>
<el-main>
<div class="main" style="min-width: 800px" v-loading="showLoading" element-loading-text="正在下载更新数据包,请勿刷新页面">
<div class="ba_f bor_rad5 mar_b30">
<div class="main-search-tit t_l fon_16 wei pad_20">系统升级</div>
<div class="pad_30">
<!-- <el-upload
action="#"
:file-list="fileList"
:on-change="changeData"
:http-request="handleRequest"
:before-upload="beforeUpload">
<el-button class="btn upload-btn">上传附件</el-button>
<div slot="tip" class="el-upload__tip">上传文件大小不超过50M</div>
</el-upload> -->
<!-- <el-progress :stroke-width="16" :percentage="progressPercent"></el-progress> -->
<el-progress class="flex-center" type="circle" :percentage="percentageTime" :color="colors" ></el-progress>
<div class="mar_t60">
<el-alert
title="正在更新系统文件,请不要关闭窗口"
type="success"
:closable="false">
</el-alert>
</div>
<div class="mar_t20">
<el-alert
title="如果下载文件失败,可能造成的原因:写入失败,请仔细检查写入权限是否正确"
type="success"
:closable="false">
</el-alert>
</div>
<div class="mar_t30">
<div class="fileshow pad_30">
<div class="flex">
<div class="wei leftWidth">整体进度</div>
<div class="fon_14">{{file_countjian}}/{{file_count}}</div>
</div>
<div class="flex mar_t10">
<div class="wei leftWidth">正在下载文件</div>
<div class="fon_14">{{showFile}}</div>
</div>
</div>
</div>
<!-- <div> <el-button @click="ceshitijiapo()">测试</el-button></div> -->
</div>
</div>
</div>
</el-main>
</el-container>
</el-container>
</div>
</div>
<script>
$(document).ready(function () {
$(".slimScrollDiv ul .main-nav-li a").eq(10).addClass("menu_active");
$(".main-nav .main-nav-li .submenu").eq(4).addClass("block");
$(".main-nav .main-nav-li .submenu").children().children().eq(11).addClass("menu_active2")
});
</script>
<script>
new Vue({
el: '#platformList',
created() {
this.init();
// this.deactivation()
},
data: function () {
return {
percentageTime:0,
status:'warning',
version:'',
release:'',
files:[],
file_count:'',
file_countjian:1,
loginTimer:0,
showFile:'',
colors: [
{color: '#f56c6c', percentage: 20},
{color: '#e6a23c', percentage: 40},
{color: '#5cb87a', percentage: 60},
{color: '#1989fa', percentage: 80},
{color: '#6f7ad3', percentage: 100}
],
showLoading:false,
}
},
methods: {
async init(){
this.showLoading = true
res = await utils.requestPost({data: '', url: "admin/upgrade/get-upgrade-info"},this)
if (res.code == 1) {
this.version = res.data.version
this.release = res.data.release
this.files = res.data.files
this.file_count = res.data.file_count
var requstData = {
version:res.data.version,
version_date:res.data.release,
domain_url:window.location.host
}
res = await utils.requestGet({data: requstData, url: "admin/upgrade/compress-package"},this)
if(res.code==1){
this.showLoading = false
var objString = JSON.stringify(this.file_countjian);
this.loginTimer = setInterval( ()=>{
this.showFile = this.files[this.loginTimer++]
if(this.file_count>=objString){
this.file_countjian = objString++
}else{
this.percentageTime=100
this.showFile =['下载完成']
setTimeout(()=>{
location.href = "<?= Yii::$app->urlManager->createUrl('admin/site/site_upgrade');?>"+"?type=1";
},1000)
}
},150)
this.loginTimer = setInterval( ()=>{
if(this.percentageTime<100){
this.percentageTime++
}else{
this.percentageTime=100
this.showFile =['下载完成']
setTimeout(()=>{
location.href = "<?= Yii::$app->urlManager->createUrl('admin/site/site_upgrade');?>"+"?type=1";
},1000)
}
},180)
// let timer = setInterval(() => {
// this.percentageTime++
// }, 1000);
// clearInterval(timer);
// this.percentageTime=30
// setTimeout(()=>{
// this.percentageTime=60
// setTimeout(()=>{
// this.status='success'
// this.percentageTime=100
// setTimeout(()=>{
// location.href = "<?= Yii::$app->urlManager->createUrl('admin/site/site_upgrade');?>"+"?type=1";
// },2000)
// },3000)
// },2000)
}
}
},
// async deactivation() {
// var requstData = {
// version:1,
// version_date:2,
// }
// res = await utils.requestGet({
// data: requstData,
// url: "admin/upgrade/compress-package"
// },this)
// if (res.code == 1) {
// this.$message({
// type: 'success',
// message: '操作成功!',
// duration: 1000,
// onClose: () => {
// location.href ="<?= Yii::$app->urlManager->createUrl('admin/apply/platform_management');?>"+"?id="+this.id;
// },
// });
// }
// },
async ceshitijiapo() {
let timer = setInterval(() => {
this.percentageTime++
}, 1000);
clearInterval(timer);
this.percentageTime=30
setTimeout(()=>{
this.percentageTime=60
setTimeout(()=>{
this.status='success'
this.percentageTime=100
},3000)
},2000)
// this.flietime = 60;
// let timer = setInterval(() => {
// this.codetime--;
// if (this.flietime < 1) {
// clearInterval(timer);
// this.codetime = 0;
// this.getCode = '';
// }
// }, 500);
},
}
})
</script>
</body>
</html>