heyang 3 years ago
parent
commit
9fbe3ba039
1 changed files with 9 additions and 4 deletions
  1. 9 4
      microserviceUserH5/vcloud/browserDetail.html

+ 9 - 4
microserviceUserH5/vcloud/browserDetail.html

@@ -45,9 +45,9 @@
 <script type="text/javascript">
 	document.addEventListener("visibilitychange",()=>{
 		if(document.hidden){
-			init();
+			init('visibilitychange');
 		}else{
-			init();
+			init('visibilitychange');
 		}
 	})
 	let title = decodeURIComponent(GetRequest().plateName);
@@ -57,7 +57,7 @@
 	(function(){
 		init();
 	})();
-	function init(){
+	function init(type){
 		$.ajax({
 			url: `${baseUrl}/api/public/v1/browserLabel/client/query/${GetRequest().plateId}`,
 			type: 'get',
@@ -77,7 +77,9 @@
 					return
 				}
 				labelId = list[0].id;
-				rankingGet();
+				if(type != 'visibilitychange'){
+					rankingGet();
+				}
 				for(let i=0; i < list.length; i++){
 					node += `<div class="tag-item ${i === index ? 'active' : ''}" data-id="${list[i].id}" data-index="${i}">${list[i].labelName}</div>`
 				}
@@ -235,6 +237,9 @@
 								// 进度条的位置也是translate,一开始是用translateX(-100%)挪到外面去
 								$('.progress')[index].style.transform = `translateX(${percentComplete * 100}%)`;
 								$('.text').eq(index).text(`${(percentComplete * 100).toFixed(1)}%`);
+								if((percentComplete * 100).toFixed(1) == 100){
+									$('.text').eq(index).text('下载完成');
+								}
 							}
 						}, false);
 						xhr.send();