文件
mashangyoujiu/Install/Home/View/Index/install.html

242 行
9.0 KiB
HTML
可执行文件

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在线安装码上有酒</title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.2.8.2.css"/>
<script type="text/javascript" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
<script type="text/javascript" src="__PUBLIC__/vue/element-ui.2.8.2.js"></script>
<style>
html, body {
padding: 0;
margin: 0;
background-color: #f5f5f5;
}
.logo-box {
text-align: center;
}
.logo {
height: 84px;
margin: 25px auto 0;
}
.tips {
font-size: 13px;
line-height: 18px;
color: #909399;
}
.big-title {
font-size: 16px;
margin-top: 10px;
}
.bottom-button {
margin-top: 10px;
text-align: right;
}
.success {
color: rgb(103, 194, 58);
}
.error {
color: #f56c6c;
}
</style>
</head>
<body>
<div id="app">
<div class="logo-box">
<img src="__PUBLIC__/Install/images/logo.png" alt="" class="logo"/>
</div>
<el-container>
<el-main>
<el-card shadow="always" style="width: 650px;margin: 0 auto">
<h3>码上有酒版本正在安装到您的服务器中,请稍等.....</h3>
<h4>如果安装失败,请检查数据库是否开启,或者是其他参数设置有误.....</h4>
<el-scrollbar ref="myScrollbar" style="width: 650px; height: calc(100vh - 330px)">
<div v-for="(item,index) in dataList">
<p :class="item.class">{{item.name}}</p>
</div>
<div v-if="installState==1">
<p><span class="success">{{count}}</span> 秒后返回主页</p>
</div>
<div v-if="installState==2">
<p class="error">安装失败</p>
<el-button type="danger" @click="refresh">刷新重试</el-button>
</div>
</el-scrollbar>
</el-card>
</el-main>
</el-container>
</div>
<script>
var app = new Vue({
el: '#app',
data() {
return {
installState: 0,
count: 5,
dataList: [
{name: '开始一本正经的安装零售数据库数据...', class: 'tips big-title'},
],
}
},
methods: {
//初始化数据表
unitSQL() {
fetch("{:U('Home/index/unitSQL')}", {
method: 'POST',
headers: {},
}).then((response) => response.json()).then((jsonData) => {
if (typeof jsonData != "object") {
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
} else {
this.dataList.push.apply(this.dataList, jsonData.data);
if (jsonData.status == 1) {
this.$nextTick(()=>{
this.unitTable();
})
} else {
this.installState = 2;
this.$message.error(res.message);
}
}
}).catch((error) => {
console.log(error);
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
});
},
unitTable() {
this.dataList.push({
name: '数据表数据安装完成,开始初始化用户数据...',
class: 'tips big-title'
});
this.dataList.push({
name: '开始注册创始人帐号...',
class: 'tips success'
})
fetch("{:U('Home/index/unitTable')}", {
method: 'POST',
headers: {},
}).then((response) => response.json()).then((jsonData) => {
if (typeof jsonData != "object") {
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
} else {
this.dataList.push.apply(this.dataList, jsonData.data);
if (jsonData.status == 1) {
this.$nextTick(()=>{
this.setVersion();
})
} else {
this.installState = 2;
this.$message.error(res.message);
}
}
}).catch((error) => {
console.log(error);
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
});
},
setVersion() {
this.dataList.push({
name: '设置当前的版本信息...',
class: 'tips big-title'
});
fetch("{:U('Home/index/setVersion')}", {
method: 'POST',
headers: {},
}).then((response) => response.json()).then((jsonData) => {
if (typeof jsonData != "object") {
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
} else {
this.dataList.push.apply(this.dataList, jsonData.data);
if (jsonData.status == 1) {
this.$nextTick(()=>{
this.setConfig();
})
} else {
this.installState = 2;
this.$message.error(res.message);
}
}
}).catch((error) => {
console.log(error);
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
});
},
setConfig() {
this.dataList.push({
name: '开始生成配置文件...',
class: 'tips big-title'
});
fetch("{:U('Home/index/setConfig')}", {
method: 'POST',
headers: {},
}).then((response) => response.json()).then((jsonData) => {
if (typeof jsonData != "object") {
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
} else {
this.dataList.push.apply(this.dataList, jsonData.data);
if (jsonData.status == 1) {
this.$nextTick(()=>{
this.installSuccess();
})
} else {
this.installState = 2;
this.$message.error(res.message);
}
}
}).catch((error) => {
console.log(error);
this.installState = 2;
this.$message.error('请求发生错误,请稍后重试');
});
},
installSuccess() {
this.installState = 1;
this.dataList.push({
name: '恭喜,成功安装,如有问题,请及时使用工单联系我们...',
class: 'tips big-title success'
});
this.count = 5;
let Timer = setInterval(() => {
this.count--;
if (this.count == 0) {
clearInterval(Timer);
window.location.href = "/index.php";
}
}, 1000)
},
refresh() {
location.reload();
}
},
created() {
this.unitSQL();
},
watch:{
dataList:{
deep: true,
handler(){
this.$nextTick(() => {
this.$refs['myScrollbar'].wrap.scrollTop = this.$refs['myScrollbar'].wrap.scrollHeight
})
}
}
}
});
</script>
</body>
</html>