Authored by 李靖

优化

... ... @@ -23,7 +23,7 @@
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon">https://huodong.yoho.cn/</span>
<input id="actPath" type="text" class="form-control col-sm-10" placeholder="请输入上传地址" value="activity/2017/09/famous/007">
<input id="actPath" type="text" class="form-control col-sm-10" placeholder="请输入上传地址">
<span class="input-group-addon">/index.html</span>
</div>
</div>
... ... @@ -70,13 +70,17 @@
<script>
let $uploadList = $('#upload-list tbody');
let marker = '';
let page = 0;
let page = 1;
$('#upload').on('click', function() {
var formData = new FormData();
var file = $('#fileInput').prop('files')[0];
var actPath = $('#actPath').val();
if (!$('#actPath').val()) {
$('.logs').prepend('<p>state: 请输入上传地址!</p>');
return false;
}
actPath = `/${actPath}`;
formData.append('file', file);
formData.append('actPath', actPath);
... ... @@ -91,8 +95,9 @@
success: function(result) {
if (result) {
if (result.code === 200) {
$('.logs').prepend('<p>state: 上传成功!</p>');
$('.logs').prepend('<p>state: 上传完成!</p>');
$('#upload-list tr[class!=title]').remove();
page = 1;
getList();
} else if (result.code === 400) {
$('.logs').prepend('<p>state: 请选择上传文件!</p>');
... ... @@ -123,9 +128,9 @@
<tr>
<td>${item._id}</td>
<td>${item.actPath}</td>
<td>${item.fileName}</td>
<td>${item.date}</td>
<td>${item.username}</td>
<td style="text-align:center;">${item.fileName}</td>
<td style="text-align:center;">${item.date}</td>
<td style="text-align:center;">${item.username}</td>
<td style="text-align: center;">
<a class="detail-btn btn btn-warning btn-block" data-path="${item.actPath}">展开详情</a>
<a class="get-more btn btn-success btn-block hide" data-path="${item.actPath}">加载更多</a>
... ... @@ -178,9 +183,9 @@
result.data.items.forEach(function(item){
detail += `<tr class="detail-list">
<td>${item.key}</td>
<td>${item.fsize}</td>
<td>${item.mimeType}</td>
<td>${item.putTimeFormat}</td>
<td style="text-align:center;">${item.fsizekb}</td>
<td style="text-align:center;">${item.mimeType}</td>
<td style="text-align:center;">${item.putTimeFormat}</td>
</tr>`;
});
$uploadDetail.next('.detail-c').find('.detail-table tbody').append(detail);
... ...