heyang 3 years ago
parent
commit
3b202503fe
1 changed files with 11 additions and 86 deletions
  1. 11 86
      microserviceUserH5/vcloud/channel.html

+ 11 - 86
microserviceUserH5/vcloud/channel.html

@@ -45,21 +45,8 @@
 </div>
 <script type="text/javascript" th:inline="javascript">
 	var baseUrl = 'http://14.18.190.141:38051'
+	let code = '', platform = '', version = '', fileIp = '', downloadId = '';
 	goAppDownload();
-	$("#recv_ipt").bind('input propertychange', function (e) {
-		var ipt_phones = $('#recv_ipt').val();
-		var c = $(this);
-		if (/[^\d]/.test(c.val())) { //替换非数字字符
-			var temp_amount = c.val().replace(/[^\d]/g, '');
-			$(this).val(temp_amount);
-			toastr.error('请填写正确的手机号')
-		}
-		if (ipt_phones.length >= 12) {
-			toastr.error('请填写正确的手机号')
-			var recvstr = ipt_phones.substring(0, 11)
-			$("#recv_ipt").val(recvstr);
-		}
-	});
 	function goAppDownload() {
 		const data = {
 			code: GetRequest().code,
@@ -72,9 +59,12 @@
 			dataType: 'json',
 			cache: false,
 			success: function (res) {
-				console.log("res==", res);
 				if (res.status === 0) {
-					console.log("res==", res);
+					code = res.data.code;
+					fileIp = res.data.fileIp;
+					downloadId = res.data.downloadId;
+					platform = res.data.platform;
+					version = res.data.version;
 				} else {
 					toastr.error(res.msg)
 				}
@@ -83,12 +73,11 @@
 	}
 
 	function handleClick2() {
-		$(window).attr('location', $('#fileCenterDownloadIp').text() + $('#downloadId').text());
 		const data = {
-			"code": $('#code').text(),
-			"platform": $('#platform').text(),
-			"version": $('#version').text(),
-			"type": 5
+			code: code,
+			platform: platform,
+			version: version,
+			type: 5
 		}
 		$.ajax({
 			url: baseUrl + '/api/channelRecord/addChannelAppDownload',
@@ -99,7 +88,7 @@
 			cache: false,
 			success: function (res) {
 				if (res.status === 0) {
-					console.log("res==", res);
+					location.href = fileIp + downloadId;
 				} else {
 					toastr.error(res.msg)
 				}
@@ -107,70 +96,6 @@
 		})
 	}
 
-	function handleClick() {
-		var query = window.location.search.substring(1);
-		console.log(query)
-		var vars = query.split("&");
-		var data = {}
-		var username = vars.find(e => {
-			return e.startsWith('username')
-		})
-		var type = vars.find(e => {
-			return e.startsWith('type')
-		})
-		data.userName = username.substring(9, username.length)
-		data.type = type.substring(5, username.length)
-		toastr.options = {
-			positionClass: "toast-center-center"
-		};
-		var ipt_phone = $('#recv_ipt').val();
-		var validator = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/
-		var res = validator.test(ipt_phone)
-		if (!ipt_phone) {
-			toastr.error('请填写正确的手机号')
-		} else if (!res) {
-			toastr.error('请填写正确的手机号')
-		} else {
-			data.newPhone = ipt_phone
-			$.ajax({
-				url: baseUrl + '/api/user/v1/promote',
-				data: JSON.stringify(data),
-				type: 'post',
-				contentType: "application/json",
-				dataType: 'json',
-				cache: false,
-				success: function (res) {
-					if (res.status === 0) {
-						//$('#myModal').modal('show');
-						toastr.error('领取成功')
-						$(window).attr('location', res.data);
-					} else {
-						toastr.error(res.msg)
-					}
-				}
-			})
-		}
-	}
-	/*
-	function handleDownload() {
-			$.ajax({
-					url: baseUrl + '/api/user/promote/webUrl',
-					type: 'get',
-					cache: false,
-					dataType: 'text',
-					success: function (data) {
-							var uri;
-							if (data.startsWith('http')) {
-									uri = data
-							} else {
-									uri = 'http://' + data
-							}
-							$(window).attr('location',uri);
-					}
-			})
-
-	}
-	 */
 	function visit() {
 		$.ajax({
 			url: baseUrl + '/api/user/v3/invitation/client/addInviteData',