fix: 修改多图片上传页面
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div id="topbar"><button class="addfile primary">+ 添加文件</button><button class="upall primary">全部上传</button><button class="removeall">清空列表</button></div>
|
||||
<div id="topbar"><button class="addfile primary">+ 添加文件</button><button class="removeall">清空列表</button></div>
|
||||
<ul id="file_list"></ul>
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
blobInfo.blob = function(){return this.file;}
|
||||
var upload_handler = axupimgs.images_upload_handler;
|
||||
var upload_base_path = axupimgs.images_upload_base_path;
|
||||
|
||||
//为列表添加排序
|
||||
function reSort(){
|
||||
document.querySelectorAll('#file_list li').forEach((el,i)=>{
|
||||
@@ -74,8 +73,17 @@
|
||||
li.setAttribute('data-time',file.lastModified);
|
||||
li.innerHTML='<div class="picbox"><img src="'+blobUrl+'"></div><div class="namebox"><span>'+file.name+'</span></div><div class="tools"><a class="remove"></a></div>';
|
||||
vDom.appendChild(li);
|
||||
|
||||
}
|
||||
|
||||
document.querySelector('#file_list').appendChild(vDom);
|
||||
if(axupimgs.res.length>0){
|
||||
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
|
||||
el.classList ? el.classList.add('up-now') : el.className+=' up-now';
|
||||
});
|
||||
upAllFiles(0);
|
||||
}
|
||||
|
||||
//reSort();
|
||||
}
|
||||
|
||||
@@ -134,7 +142,7 @@
|
||||
file_i = n;
|
||||
if(len == n){
|
||||
file_i=0;
|
||||
document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
// document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
return true;
|
||||
}
|
||||
if( axupimgs.res[n].url!='' ){
|
||||
@@ -142,9 +150,8 @@
|
||||
upAllFiles(n)
|
||||
}else{
|
||||
blobInfo.file=axupimgs.res[n].file;
|
||||
upload_handler(blobInfo,function(url){
|
||||
upload_handler(blobInfo,function(url,name){
|
||||
if(upload_base_path){
|
||||
|
||||
if(upload_base_path.slice(-1)=='/' && url.substr(0,1)=='/' ){
|
||||
url = upload_base_path + url.slice(1);
|
||||
}else if(upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){
|
||||
@@ -154,33 +161,34 @@
|
||||
}
|
||||
}
|
||||
axupimgs.res[file_i].url = url;
|
||||
filename = url.split('/').pop();
|
||||
// filename = url.split('/').pop();
|
||||
filename = name
|
||||
var li = document.querySelectorAll('#file_list li')[file_i];
|
||||
li.setAttribute('class','up-over');
|
||||
li.querySelector('.namebox span').innerText = filename;
|
||||
n++
|
||||
upAllFiles(n);
|
||||
},function(err){
|
||||
document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
|
||||
el.setAttribute('class','up-no');
|
||||
});
|
||||
alert(err);
|
||||
// document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
// document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
|
||||
// el.setAttribute('class','up-no');
|
||||
// });
|
||||
// alert(err);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
|
||||
if(e.target.innerText!='全部上传'){return false;}
|
||||
if(axupimgs.res.length>0){
|
||||
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
|
||||
el.classList ? el.classList.add('up-now') : el.className+=' up-now';
|
||||
});
|
||||
e.target.innerText='上传中...';
|
||||
upAllFiles(0);
|
||||
}
|
||||
});
|
||||
//
|
||||
// document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
|
||||
// if(e.target.innerText!='全部上传'){return false;}
|
||||
// if(axupimgs.res.length>0){
|
||||
// document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
|
||||
// el.classList ? el.classList.add('up-now') : el.className+=' up-now';
|
||||
// });
|
||||
// e.target.innerText='上传中...';
|
||||
// upAllFiles(0);
|
||||
// }
|
||||
// });
|
||||
|
||||
var observ_flist = new MutationObserver( (muList,observe)=>{
|
||||
if(muList[0].addedNodes.length>0){
|
||||
|
||||
Reference in New Issue
Block a user