소스 검색

下载优化

heyang 3 년 전
부모
커밋
a54cb3a2ec
1개의 변경된 파일25개의 추가작업 그리고 4개의 파일을 삭제
  1. 25 4
      microserviceUserH5/vcloud/maJiaBaoGoApp.html

+ 25 - 4
microserviceUserH5/vcloud/maJiaBaoGoApp.html

@@ -57,14 +57,18 @@
 				dataType: 'json',
 				cache: false,
 				success: function (res) {
-					console.log(res)
+					if(accessType === 1){
+						getAppDownload();
+					}
 				},
 			})
 		}
-	    $('.btn-content')[0].addEventListener('click',getAppDownload,false);
 		//点击下载APP
+	    $('.btn-content')[0].addEventListener('click',()=>{
+			operate(1)
+		},false);
+		//调用下载接口
 		function getAppDownload(){
-			operate(1);
 			$.ajax({
 				url: baseUrl + '/api/user/v1/ditchClient/addChannelAppDownload',
 				type: 'post',
@@ -78,7 +82,7 @@
 				cache: false,
 				success: function (res) {
 					if(res.status === 0){
-
+						downloadApp();
 					}else{
 						stopManyClick(() =>{
 							toastr.error(res.msg)
@@ -87,6 +91,23 @@
 				},
 			})
 		}
+		//下载文件
+		function downloadApp(){
+			$.ajax({
+				url: baseUrl + '/file-center/fileOperate/downloadFile?id=169403',
+				type: 'get',
+				contentType: "application/json",
+				dataType: 'json',
+				cache: false,
+				success: function (res) {
+					if(res.status !== 0){
+						stopManyClick(() =>{
+							toastr.error(res.msg)
+						})
+					}
+				},
+			})
+		}
 		//防止提示一秒内重复显示
 		function stopManyClick(fn) {
 			if (flag) {