web_chenlw

This commit is contained in:
chenlw 2016-06-28 21:39:25 +08:00
parent 98ff399ee6
commit a28e1765eb
1 changed files with 21 additions and 15 deletions

View File

@ -210,7 +210,7 @@ module Developer {
}
$scope.model.uploadprocess = {};
}
$scope.upLoadFiles = ()=>{
if($scope.model.uploadedStatus == "once"){
return;
@ -239,9 +239,11 @@ module Developer {
alert("数据文件中没有可用上传的文件!");
}else{
var isuploaad = 1,i = 0;
var timerForUpload = setInterval(function(){
var timerForUpload = $interval(function(){
if(i >= isExited.length){
clearInterval(timerForUpload);
// clearInterval(timerForUpload);
$interval.cancle(timerForUpload);
}
if(isuploaad == 1){
var r = new Resumable({
@ -265,18 +267,16 @@ module Developer {
r.on('fileAdded', function(file){
r.upload();
update();
});
$scope.model.resumablejs.push({
dirname : isExited[i].id,
resumable : r
});
r.setRootPath(isExited[i].type+"/"+isExited[i].batch+"/"+isExited[i].id+"/"+isExited[i].version+"/");
r.myLoadFiles($scope.model.folderList[isExited[i].id]);
r.upload();
r.on('fileProgress',function(file){
var file_id=file.relativePath.replace(/^[a-z]*\/$/,'');
var filestr = "";
@ -287,12 +287,11 @@ module Developer {
}
file_id = filestr.replace(/\/*/g,'');
r.setFileId(file_id);
//$scope.$apply(function(){
$scope.model.uploadprocess[file_id] = Math.floor(r.progress()*98);
//});
// $scope.$apply(function(){
$scope.model.uploadprocess[file_id] = Math.floor(r.progress()*98);
// });
});
r.on('complete', function(){
var timerForchmod = setInterval(function(){
var pathjson = "\"path\":\""+r.getrootPath()+"\""
@ -341,6 +340,7 @@ module Developer {
},2000);
isuploaad = 1;
});
}
},2000);
}
@ -443,10 +443,16 @@ module Developer {
var dirId = $scope.model.resumablejs[i].dirname;
var r = $scope.model.resumablejs[i].resumable;
r.on('fileProgress', (file) =>{
$scope.$apply(function(){
$scope.model.uploadprocess[dirId] = Math.floor(r.progress()*100);
console.log(dirId+":"+Math.floor(r.progress()*100))
});
if(r.getisnowcheck().indexOf("0") == -1){
$scope.$apply(function(){
$scope.model.uploadprocess[dirId] = Math.floor(r.progress()*100);
});
}
else{
$scope.$apply(function(){
$scope.model.uploadprocess[dirId] = Math.floor(r.progress()*98);
});
}
});
}
}