|
|
@ -1,17 +1,83 @@
|
|
|
|
|
|
|
|
function getMemory() {
|
|
|
|
|
|
|
|
$.get("/Member/Memory", function(data) {
|
|
|
|
|
|
|
|
var dataObj = eval("(" + data + ")");
|
|
|
|
|
|
|
|
if (dataObj.rate >= 100) {
|
|
|
|
|
|
|
|
$("#memory_bar").css("width", "100%");
|
|
|
|
|
|
|
|
$("#memory_bar").addClass("progress-bar-warning");
|
|
|
|
|
|
|
|
toastr["error"]("您的已用容量已超过容量配额,请尽快删除多余文件或购买容量");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$("#memory_bar").css("width", dataObj.rate + "%");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#used").html(dataObj.used);
|
|
|
|
|
|
|
|
$("#total").html(dataObj.total);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
page = 1;
|
|
|
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
|
|
|
$.material.init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getMemory();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
|
|
$("#loadFinished").click(function(){
|
|
|
|
|
|
|
|
$.getJSON("/RemoteDownload/ListFinished?page="+page, function(data) {
|
|
|
|
|
|
|
|
if(data.length == 0){
|
|
|
|
|
|
|
|
$("#loadFinished").html("已加载全部");
|
|
|
|
|
|
|
|
$("#loadFinished").attr("disabled","true");
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$("#loadFinished").html("继续加载");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
data.forEach(function(e) {
|
|
|
|
|
|
|
|
$("#completeItemContent").append(function() {
|
|
|
|
|
|
|
|
var row = '<tr id="i-' + e["id"] + '" data-pid="'+e["pid"]+'"><th scope="row" class="centerTable">' + e["id"] + '</th><td>' + e["fileName"] + '</td>';
|
|
|
|
|
|
|
|
row = row + '<td class="centerTable">' + bytesToSize(e["totalLength"]) + '</td>';
|
|
|
|
|
|
|
|
row = row + '<td class="centerTable">' + e["save_dir"] + '</td>';
|
|
|
|
|
|
|
|
switch(e["status"]){
|
|
|
|
|
|
|
|
case "error":
|
|
|
|
|
|
|
|
row = row +'<td class="centerTable"><span class="download-error" data-toggle="tooltip" data-placement="top" title="'+e["msg"]+'">失败</span></td>'
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "canceled":
|
|
|
|
|
|
|
|
row = row +'<td class="centerTable"><span >取消</span></td>'
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "canceled":
|
|
|
|
|
|
|
|
row = row +'<td class="centerTable"><span >取消</span></td>'
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "complete":
|
|
|
|
|
|
|
|
row = row +'<td class="centerTable"><span class="download-success">完成</span></td>'
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row = row + '<td class="centerTable"><a href="javascript:" onclick="delete('+e["id"]+')" >删除记录</a></td>'
|
|
|
|
|
|
|
|
return row + "</tr>";
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
switch(e["status"]){
|
|
|
|
|
|
|
|
case "error":
|
|
|
|
|
|
|
|
$("#i-" + e["id"]).addClass("td-error");
|
|
|
|
|
|
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "complete":
|
|
|
|
|
|
|
|
$("#i-" + e["id"]).addClass("td-success");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
page++;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
$.get("/RemoteDownload/FlushUser", function() {
|
|
|
|
$.get("/RemoteDownload/FlushUser", function() {
|
|
|
|
$("#loadStatus").html("加载下载列表中...");
|
|
|
|
$("#loadStatus").html("加载下载列表中...");
|
|
|
|
loadDownloadingList();
|
|
|
|
loadDownloadingList();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function loadDownloadingList() {
|
|
|
|
function loadDownloadingList() {
|
|
|
|
|
|
|
|
$("#itemContent").html("");
|
|
|
|
$.getJSON("/RemoteDownload/ListDownloading", function(data) {
|
|
|
|
$.getJSON("/RemoteDownload/ListDownloading", function(data) {
|
|
|
|
$("#itemContent").html();
|
|
|
|
|
|
|
|
if(data.length == 0){
|
|
|
|
if(data.length == 0){
|
|
|
|
$("#loadStatus").html("下载列表为空");
|
|
|
|
$("#loadStatus").html("下载列表为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.forEach(function(e) {
|
|
|
|
data.forEach(function(e) {
|
|
|
|
$("#itemContent").append(function() {
|
|
|
|
$("#itemContent").append(function() {
|
|
|
|
var row = '<tr id="i-' + e["id"] + '"><th scope="row" class="centerTable">' + e["id"] + '</th><td>' + e["fileName"] + '</td>';
|
|
|
|
var row = '<tr id="i-' + e["id"] + '" data-pid="'+e["pid"]+'"><th scope="row" class="centerTable">' + e["id"] + '</th><td>' + e["fileName"] + '</td>';
|
|
|
|
row = row + '<td class="centerTable">' + bytesToSize(e["totalLength"]) + '</td>';
|
|
|
|
row = row + '<td class="centerTable">' + bytesToSize(e["totalLength"]) + '</td>';
|
|
|
|
row = row + '<td class="centerTable">' + e["save_dir"] + '</td>';
|
|
|
|
row = row + '<td class="centerTable">' + e["save_dir"] + '</td>';
|
|
|
|
if (e["downloadSpeed"] == "0") {
|
|
|
|
if (e["downloadSpeed"] == "0") {
|
|
|
@ -57,7 +123,17 @@ function loadDownloadingList() {
|
|
|
|
if(data.error){
|
|
|
|
if(data.error){
|
|
|
|
toastr["warning"](data.message);
|
|
|
|
toastr["warning"](data.message);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
|
|
|
|
var pid = $("#i-"+id).attr("data-pid");
|
|
|
|
|
|
|
|
$("[data-pid='"+pid+"'").remove();
|
|
|
|
toastr["success"](data.message);
|
|
|
|
toastr["success"](data.message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function refresh(){
|
|
|
|
|
|
|
|
$.get("/RemoteDownload/FlushUser?i="+Math.random(), function() {
|
|
|
|
|
|
|
|
$("#loadStatus").html("加载下载列表中...");
|
|
|
|
|
|
|
|
loadDownloadingList();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|