Skip to content

Commit

Permalink
1、文件上传问题修复和补充
Browse files Browse the repository at this point in the history
2、站点未安装web服务修改和补充
  • Loading branch information
songchudong committed Jan 12, 2022
1 parent cea2bb3 commit a44c78c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
19 changes: 14 additions & 5 deletions BTPanel/static/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $('#cutMode .tabs-item').on('click', function () {
switch (type) {
case 'php':
$('#bt_site_table').empty();
if (!isSetup) $('.site_table_view .mask_layer').removeClass('hide').find('.prompt_description.web-model').html('未安装Web服务器,<a href="javascript:;" class="btlink" onclick="bt.soft.install(\'nginx\')">安装Nginx</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:;" class="btlink" onclick="bt.soft.install(\'apache\')">安装Apache</a>');
// if (!isSetup) $('.site_table_view .mask_layer').removeClass('hide').find('.prompt_description.web-model').html('未安装Web服务器,<a href="javascript:;" class="btlink" onclick="bt.soft.install(\'nginx\')">安装Nginx</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:;" class="btlink" onclick="bt.soft.install(\'apache\')">安装Apache</a>');
site.php_table_view();
site.get_types();
break;
Expand Down Expand Up @@ -8135,18 +8135,27 @@ var site = {
]
bt.render_tab('ssl_tabs', _tabs);
$('#ssl_tabs').append('<div class="ss-text pull-right mr30" style="position: relative;top:-4px"><em>强制HTTPS</em><div class="ssh-item"><input class="btswitch btswitch-ios" id="toHttps" type="checkbox"><label class="btswitch-btn" for="toHttps"></label></div></div>');
$("#toHttps").attr('checked', rdata.httpTohttps);
$('#toHttps').click(function (sdata) {
var isHttps = $("#toHttps").attr('checked');
var ssl_open = $("#toHttps")
ssl_open.attr('checked', rdata.httpTohttps);
ssl_open.click(function (sdata) {
var isHttps = $(this).prop('checked')
if (isHttps) {
layer.confirm('关闭强制HTTPS后需要清空浏览器缓存才能看到效果,继续吗?', { icon: 3, title: "关闭强制HTTPS" }, function () {
layer.confirm('关闭强制HTTPS后需要清空浏览器缓存才能看到效果,继续吗?', {
icon: 3,
title: "关闭强制HTTPS",
cancel:function () {
ssl_open.prop('checked', !isHttps);
}
}, function () {
bt.site.close_http_to_https(web.name, function (rdata) {
if (rdata.status) {
setTimeout(function () {
site.reload(7);
}, 3000);
}
})
},function () {
ssl_open.prop('checked', !isHttps);
});
} else {
bt.site.set_http_to_https(web.name, function (rdata) {
Expand Down
16 changes: 10 additions & 6 deletions BTPanel/static/js/upload-drog.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ UploadFile.prototype = {
this.uploadStatus = 2;
this.uploaded_files = []; // 上传过的文件
this.uploadTime.startTime = this.get_time_real(); // 设置上传开始时间
this.queryEl('.upload_file_gourp').classList.add('hide');
var startUpload = this.queryEl('.startUpload');
startUpload.setAttribute('disabled','disabled')
startUpload.innerText = '正在上传';
}
// 结束上传
if (this.fileList.length === index) {
Expand Down Expand Up @@ -545,8 +547,10 @@ UploadFile.prototype = {
this.bind(file_upload_info.querySelector('.ico-tips-close'), function (ev) {
var parent = this.parentNode.parentNode;
parent.querySelector('.btn-group').classList.remove('hide');
parent.querySelector('.file_upload_info').classList.add('hide')
document.querySelector('.upload_file_gourp').classList.remove('hide');
parent.querySelector('.file_upload_info').classList.add('hide');
var startUpload = this.queryEl('.startUpload')
startUpload.removeAttribute('disabled')
startUpload.innerText = '开始上传'
});
return false;
}
Expand Down Expand Up @@ -758,7 +762,6 @@ UploadFile.prototype = {
type: extName.length > 1 ? extName[extName.length - 1] : 'txt',
status: 0
});
console.log(this.fileTotalNumber);
this.fileTotalNumber ++;
this.fileTotalSize += e.size;
if (this.fileTotalNumber >= this.limit.number) {
Expand All @@ -769,6 +772,7 @@ UploadFile.prototype = {
layer.msg('当前文件大小已超过文件上传' + bt.format_size(e.size) + '限制, 请使用SFTP/FTP等工具上传文件!');
return false;
}
return true
},

test_index:0,
Expand All @@ -780,9 +784,8 @@ UploadFile.prototype = {
traverse_file_tree: function traverse_file_tree (item) {
var _this6 = this;
var path = item.fullPath || '';

if (item.isFile) {
// console.log(item,'-----')

item.file(function (e) {
_this6.file_upload_limit(e, path);
});
Expand Down Expand Up @@ -829,6 +832,7 @@ UploadFile.prototype = {
this.load = bt.load('正在获取文件信息,请稍后...');
this.timeNumber = 0;
if (ev.target.files) {
console.log('文件选择上传')
var items = ev.target.files;
[].forEach.call(items, function (item) {
_this7.traverse_file_tree(item);
Expand Down
7 changes: 3 additions & 4 deletions BTPanel/templates/default/site.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<div class="tab-con" style="padding: 0;overflow: inherit;">
<div class="tab-con-block">
<div id="bt_site_table"></div>
<div class="mask_layer hide">
<!-- <div class="mask_layer hide">
<div class="prompt_description web-model"></div>
</div>
</div> -->
</div>
<div class="tab-con-block">
<div id="bt_java_table" class="bt_table" v-cloak>
Expand Down Expand Up @@ -311,8 +311,7 @@
<script type="text/javascript" src="{{g.cdn_url}}/editor/ace.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
<script type="text/javascript">
{% if not data['isSetup'] %}
layer.msg('test', { time: 0, icon: 2 });
layer.msg('{{data["lan"]["JS1"]}}<a href="/soft" style="color:#20a53a; float: right;">{{data["lan"]["JS2"]}}</a>', { icon: 7, shade: [0.3, '#000'], time: 0 });
layer.msg('未安装Web服务器,<a href="javascript:;" class="btlink" onclick="bt.soft.install(\'nginx\')">安装Nginx</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:;" class="btlink" onclick="bt.soft.install(\'apache\')">安装Apache</a>', { icon: 7, shade: [0.3, '#000'], time: 0,area:'380px' });
$(".layui-layer-shade").css("margin-left", "180px");
{% else %}
if (isSetup) site.plugin_firewall()
Expand Down

0 comments on commit a44c78c

Please sign in to comment.