diff --git a/app/src/main/assets/web/uploadBook/js/common.js b/app/src/main/assets/web/uploadBook/js/common.js index 16a344840..a8ba3ff7d 100644 --- a/app/src/main/assets/web/uploadBook/js/common.js +++ b/app/src/main/assets/web/uploadBook/js/common.js @@ -91,37 +91,18 @@ function fileQueued(file, type) { size = countFileSize(file.size); name = substr_string(file.name); //创建要插入的元素 - var HTML = - '
  • " + - '
    ' + - "
    " + - name + - "
    " + - "
    " + - size + - "
    " + - '
    ' + - '0% ' + - jsonLang.t9 + - "
    " + - "
    " + - '

    ' + - "
  • "; - + var li = document.createElement("li"); + li.id = `tr_${fid}`; + li.innerHTML = `
    +
    ${name}
    +
    ${size}
    +
    + 0% ${jsonLang.t9} +
    +
    +

    `; var table = document.getElementById("tableStyle"); - table.innerHTML = table.innerHTML + HTML; + table.appendChild(li); //保存falsh_id,为上传做准备 //global_flash_id.push(file.id); //更改背景颜色 @@ -147,16 +128,18 @@ function uploadProgress(file, bytesLoaded, bytesTotal) { if (!progressClass.contains("orange")) { progressClass.add("orange"); } - document.getElementById("progress_bar_p_" + file.id).style.width = (bytesLoaded / bytesTotal) * 100 + "%" - document.getElementById("progress_bar_span_" + file.id).innerHTML = parseInt((bytesLoaded / bytesTotal) * 100) + "%" + document.getElementById("progress_bar_p_" + file.id).style.width = + (bytesLoaded / bytesTotal) * 100 + "%"; + document.getElementById("progress_bar_span_" + file.id).innerHTML = + parseInt((bytesLoaded / bytesTotal) * 100) + "%"; } //上传成功 function uploadSuccess(file, serverData, res) { var id = "handle_button_" + file.id; - var dd = document.createElement("dd") - dd.innerHTML = jsonLang.t10 - document.getElementById(id).replaceWith(dd) + var dd = document.createElement("dd"); + dd.innerHTML = jsonLang.t10; + document.getElementById(id).replaceWith(dd); } //取消上传 @@ -166,12 +149,12 @@ function userCancelUpload(file_id, type) { } else { HTML5Funs.cancelUpload(file_id); } - var element = document.getElementById("handle_button_" + file_id) - element.innerHTML = jsonLang.t14 - element.classList.remove("orange") - element.classList.add("gray") + var element = document.getElementById("handle_button_" + file_id); + element.innerHTML = jsonLang.t14; + element.classList.remove("orange"); + element.classList.add("gray"); //如果已经上传一部分了 - var progressElement = document.getElementById("progress_bar_p_" + file_id) + var progressElement = document.getElementById("progress_bar_p_" + file_id); if (progressElement.classList.contains("orange")) { progressElement.classList.remove("orange"); progressElement.classList.add("gray");