new files
This commit is contained in:
211
pro_v3.5.1/public/upgrade/step.html
Normal file
211
pro_v3.5.1/public/upgrade/step.html
Normal file
@@ -0,0 +1,211 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{$title|default=''} - {$powered|default=''}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="../statics/css/layui.css" rel="stylesheet">
|
||||
<script src="../statics/js/layui.js"></script>
|
||||
<script src="../statics/js/jquery.js"></script>
|
||||
<script src="../statics/js/vue.js"></script>
|
||||
<script src="../statics/js/axios.js"></script>
|
||||
<style>
|
||||
body {
|
||||
background-color: #f3f3f4;
|
||||
}
|
||||
.layui-fluid {
|
||||
padding: 15px;
|
||||
}
|
||||
.layui-card-header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.layui-elem-quote {
|
||||
border-left-color: #1E9FFF;
|
||||
font-size: 16px;
|
||||
}
|
||||
.layui-elem-quote span {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid" id="app" v-cloak>
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">数据迁移系统</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<blockquote class="layui-elem-quote">迁移版本:<span>标准版{$version_bz} - pro{$version_pro}</span></blockquote>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">服务器地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="hostname" autocomplete="off" placeholder="请输入数据库服务器地址" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">数据库名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="database" autocomplete="off" placeholder="请输入数据库名" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="username" autocomplete="off" placeholder="请输入数据库用户名" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">数据库密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="password" autocomplete="off" placeholder="请输入数据库密码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">数据库端口</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="hostport" autocomplete="off" placeholder="请输入数据库端口" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">表前缀</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="prefix" autocomplete="off" placeholder="请输入表前缀" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-normal" v-if="isUpgrade && executeIng">正在迁移中</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal" v-if="!isUpgrade && !executeIng">迁移完毕</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal" v-if="isUpgrade && !executeIng" @click="startUpgrade">立即迁移</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>表名</th>
|
||||
<th>迁移状态</th>
|
||||
<th style="overflow: hidden;word-break: break-all;">错误原因</th>
|
||||
<th>执行时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in upgradeData" :key="index">
|
||||
<td>{{item.table}}</td>
|
||||
<td>{{ item.status ? '迁移成功' : '迁移失败' }}</td>
|
||||
<td>{{ item.error }}</td>
|
||||
<td>{{ item.add_time }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var isUpgrade = <?=$isUpgrade ? 'true' : 'false'?>;
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
sleep: 0,
|
||||
hostname: '',
|
||||
username: '',
|
||||
database: '',
|
||||
password: '',
|
||||
hostport: '3306',
|
||||
prefix: 'eb_',
|
||||
upgradeData: [],
|
||||
isUpgrade: isUpgrade,
|
||||
executeIng: false,
|
||||
},
|
||||
methods: {
|
||||
startUpgrade: function () {
|
||||
var that = this;
|
||||
if (!that.hostname) {
|
||||
return that.showMsg('请填写数据库服务器地址');
|
||||
}
|
||||
if (!that.database) {
|
||||
return that.showMsg('请填写数据库名');
|
||||
}
|
||||
if (!that.username) {
|
||||
return that.showMsg('请填写数据库用户名');
|
||||
}
|
||||
if (!that.password) {
|
||||
return that.showMsg('请填写数据库密码');
|
||||
}
|
||||
if (!that.hostport) {
|
||||
return that.showMsg('请填写表前缀');
|
||||
}
|
||||
if (!that.prefix) {
|
||||
return that.showMsg('请填写表前缀');
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'upgrade_transfer',
|
||||
data: {
|
||||
hostname:that.hostname,
|
||||
database:that.database,
|
||||
username:that.username,
|
||||
password:that.password,
|
||||
hostport:that.hostport,
|
||||
prefix:that.prefix,
|
||||
sleep:that.sleep
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(res){
|
||||
if (res.data.sleep !== -1) {
|
||||
that.sleep = res.data.sleep;
|
||||
that.upgradeData.push(res.data);
|
||||
that.executeIng = true;
|
||||
setTimeout(function () {
|
||||
that.startUpgrade();
|
||||
}, 100);
|
||||
} else {
|
||||
that.isUpgrade = false;
|
||||
that.executeIng = false;
|
||||
return that.showMsg('执行完毕');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
requestGet: function (url, data) {
|
||||
var params = Object.keys(data).map(function (key) {
|
||||
return key + '=' + data[key];
|
||||
}).join('&');
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios.get(url + (params ? '?' + params : '')).then(function (res) {
|
||||
if (res.status == 200) {
|
||||
resolve(res.data)
|
||||
} else {
|
||||
reject(res.data);
|
||||
}
|
||||
}).catch(function (err) {
|
||||
reject({msg: err})
|
||||
});
|
||||
})
|
||||
},
|
||||
showMsg: function (msg, success) {
|
||||
layui.use(['layer'], function () {
|
||||
layui.layer.msg(msg, success);
|
||||
});
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
155
pro_v3.5.1/public/upgrade/step1.html
Normal file
155
pro_v3.5.1/public/upgrade/step1.html
Normal file
@@ -0,0 +1,155 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{$title|default=''} - {$powered|default=''}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="../statics/css/layui.css" rel="stylesheet">
|
||||
<script src="../statics/js/layui.js"></script>
|
||||
<script src="../statics/js/jquery.js"></script>
|
||||
<script src="../statics/js/vue.js"></script>
|
||||
<script src="../statics/js/axios.js"></script>
|
||||
<style>
|
||||
body {
|
||||
background-color: #f3f3f4;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.centered {
|
||||
text-align: center;
|
||||
}
|
||||
.centered button {
|
||||
width: 200px;
|
||||
height: 60px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-row layui-col-space15" id="app" v-cloak="">
|
||||
<div class="layui-card">
|
||||
<div class="centered">
|
||||
<div class="layui-progress">
|
||||
<div class="layui-progress-bar layui-bg-blue" lay-percent="100%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-header">升级系统</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row">
|
||||
<p style="font-size: 18px;">版本更迭: <span style="color: red">{$version_now} - {$version_new}</span></p>
|
||||
<div class="layui-form-item" style="margin-top: 10px">
|
||||
<label class="layui-form-label" style="font-size: 18px;padding-left: 0;">表前缀</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" style="width: 10%" v-model="prefix" name="title" lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入表前缀" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="centered">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" v-if="isUpgrade && executeIng">
|
||||
正在升级中
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" v-if="isUpgrade && !executeIng"
|
||||
@click="startUpgrade">立即升级
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" v-else-if="isUpgrade == false">无需升级</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>表名</th>
|
||||
<th>执行状态</th>
|
||||
<th width="40%">错误原因</th>
|
||||
<th>执行时间</th>
|
||||
<th width="12%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in upgradeData">
|
||||
<td>{{item.table}}</td>
|
||||
<td>{{item.status ? '执行成功':'执行失败'}}</td>
|
||||
<td>{{item.error}}</td>
|
||||
<td>{{item.add_time}}</td>
|
||||
<td>无操作</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layui-form">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var isUpgrade = <?=$isUpgrade ? 'true' : 'false'?>;
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
sleep: 0,
|
||||
prefix: 'eb_',
|
||||
upgradeData: [],
|
||||
isUpgrade: isUpgrade,
|
||||
executeIng: false,
|
||||
page: 1,
|
||||
},
|
||||
methods: {
|
||||
startUpgrade: function () {
|
||||
var that = this;
|
||||
if (!that.prefix) {
|
||||
return that.showMsg('请填写表前缀');
|
||||
}
|
||||
this.requestGet('upgrade', {
|
||||
sleep: this.sleep,
|
||||
prefix: this.prefix,
|
||||
page: this.page
|
||||
}).then(function (res) {
|
||||
if (res.data.sleep !== -1) {
|
||||
if (res.data.page) {
|
||||
that.page = res.data.page;
|
||||
}
|
||||
that.sleep = res.data.sleep;
|
||||
that.upgradeData.push(res.data);
|
||||
that.executeIng = true;
|
||||
setTimeout(function () {
|
||||
that.startUpgrade();
|
||||
}, 100);
|
||||
} else {
|
||||
that.isUpgrade = false;
|
||||
that.nextAction = true;
|
||||
that.executeIng = false;
|
||||
return that.showMsg('执行完毕');
|
||||
}
|
||||
}).catch(function (res) {
|
||||
return that.showMsg(res.msg);
|
||||
});
|
||||
},
|
||||
requestGet: function (url, data) {
|
||||
var params = Object.keys(data).map(function (key) {
|
||||
return key + '=' + data[key];
|
||||
}).join('&');
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios.get(url + (params ? '?' + params : '')).then(function (res) {
|
||||
if (res.status == 200) {
|
||||
resolve(res.data)
|
||||
} else {
|
||||
reject(res.data);
|
||||
}
|
||||
}).catch(function (err) {
|
||||
reject({msg: err})
|
||||
});
|
||||
})
|
||||
},
|
||||
showMsg: function (msg, success) {
|
||||
layui.use(['layer'], function () {
|
||||
layui.layer.msg(msg, success);
|
||||
});
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user