去除jquery

pull/1463/head^2
gedoor 3 years ago
parent 1a483c2a04
commit b015d1c4d2
  1. 63
      app/src/main/assets/web/uploadBook/js/common.js

@ -91,37 +91,18 @@ function fileQueued(file, type) {
size = countFileSize(file.size); size = countFileSize(file.size);
name = substr_string(file.name); name = substr_string(file.name);
//创建要插入的元素 //创建要插入的元素
var HTML = var li = document.createElement("li");
'<li id="tr_"' + li.id = `tr_${fid}`;
fid + li.innerHTML = `<dl class="grybg">
">" + <dt>${name}</dt>
'<dl class="grybg">' + <dd>${size}</dd>
"<dt>" + <dd id="handle_button_${fid}" onclick=userCancelUpload("${fid}",${type}) class="orange">
name + <span id="progress_bar_span_${fid}">0%</span> ${jsonLang.t9}
"</dt>" + </dd>
"<dd>" + </dl>
size + <div class="jdt"><p id="progress_bar_p_${fid}" ></p></div>`;
"</dd>" +
'<dd id="handle_button_' +
fid +
'" onclick=userCancelUpload("' +
fid +
'",' +
type +
') class="orange">' +
'<span id="progress_bar_span_' +
fid +
'">0%</span> ' +
jsonLang.t9 +
"</dd>" +
"</dl>" +
'<div class="jdt"><p id="progress_bar_p_' +
fid +
'" ></p></div>' +
"</li>";
var table = document.getElementById("tableStyle"); var table = document.getElementById("tableStyle");
table.innerHTML = table.innerHTML + HTML; table.appendChild(li);
//保存falsh_id,为上传做准备 //保存falsh_id,为上传做准备
//global_flash_id.push(file.id); //global_flash_id.push(file.id);
//更改背景颜色 //更改背景颜色
@ -147,16 +128,18 @@ function uploadProgress(file, bytesLoaded, bytesTotal) {
if (!progressClass.contains("orange")) { if (!progressClass.contains("orange")) {
progressClass.add("orange"); progressClass.add("orange");
} }
document.getElementById("progress_bar_p_" + file.id).style.width = (bytesLoaded / bytesTotal) * 100 + "%" document.getElementById("progress_bar_p_" + file.id).style.width =
document.getElementById("progress_bar_span_" + file.id).innerHTML = parseInt((bytesLoaded / bytesTotal) * 100) + "%" (bytesLoaded / bytesTotal) * 100 + "%";
document.getElementById("progress_bar_span_" + file.id).innerHTML =
parseInt((bytesLoaded / bytesTotal) * 100) + "%";
} }
//上传成功 //上传成功
function uploadSuccess(file, serverData, res) { function uploadSuccess(file, serverData, res) {
var id = "handle_button_" + file.id; var id = "handle_button_" + file.id;
var dd = document.createElement("dd") var dd = document.createElement("dd");
dd.innerHTML = jsonLang.t10 dd.innerHTML = jsonLang.t10;
document.getElementById(id).replaceWith(dd) document.getElementById(id).replaceWith(dd);
} }
//取消上传 //取消上传
@ -166,12 +149,12 @@ function userCancelUpload(file_id, type) {
} else { } else {
HTML5Funs.cancelUpload(file_id); HTML5Funs.cancelUpload(file_id);
} }
var element = document.getElementById("handle_button_" + file_id) var element = document.getElementById("handle_button_" + file_id);
element.innerHTML = jsonLang.t14 element.innerHTML = jsonLang.t14;
element.classList.remove("orange") element.classList.remove("orange");
element.classList.add("gray") 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")) { if (progressElement.classList.contains("orange")) {
progressElement.classList.remove("orange"); progressElement.classList.remove("orange");
progressElement.classList.add("gray"); progressElement.classList.add("gray");

Loading…
Cancel
Save