From 4638a4a30d49e7738630653a2b40d6c6d45925fb Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Mon, 13 Jan 2025 11:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/download.vue | 100 +++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/pages/login/download.vue b/pages/login/download.vue index 410dc30..b7c6370 100644 --- a/pages/login/download.vue +++ b/pages/login/download.vue @@ -29,72 +29,68 @@ }) onLoad(() => { - let u = navigator.userAgent; - if ( u.indexOf('iPhone') > -1) { - // #ifdef H5 + // #ifdef H5 + let u = window.navigator.userAgent; + if ( uni.getSystemInfoSync().platform == 'ios') { data.confirmBtn = "跳转网页版首页" - // #endif } - if ( u.toLowerCase().indexOf('micromessenger') !== -1) { data.isWeixin = true } + // #endif }) - function download() { - var u = navigator.userAgent; - if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) { + function download() { + console.log(uni.getSystemInfoSync().platform == 'android') + if (uni.getSystemInfoSync().platform == 'android') { commonType(49).then(res => { - if (res.code === 0) { - if (res.data && res.data.value) { - // #ifndef H5 - plus.runtime.openURL(res.data.value, function(res) { - - }); - // #endif - // #ifdef H5 - uni.setClipboardData({ - data: res.data.value, - success: r => { - // this.$queue.showToast('邀请码复制成功'); - uni.showToast({ - title: '邀请码复制成功', - icon: 'none', - }); - } - }); - window.location.href = res.data.value; - // #endif - } + console.log(res) + if (res && res.value) { + // #ifndef H5 + plus.runtime.openURL(res.value, function(res) { + + }); + // #endif + // #ifdef H5 + uni.setClipboardData({ + data: res.value, + success: r => { + // this.$queue.showToast('邀请码复制成功'); + uni.showToast({ + title: '邀请码复制成功', + icon: 'none', + }); + } + }); + window.location.href = res.value; + // #endif } }); } else { commonType(50).then(res => { - if (res.code === 0) { - if (res.data && res.data.value) { - // #ifndef H5 - plus.runtime.openURL(res.data.value, function(res) { - - }); - // #endif - // #ifdef H5 - uni.setClipboardData({ - data: res.data.value, - success: r => { - uni.showToast({ - title: '邀请码复制成功', - icon: 'none', - }); - } - }); + if (res && res.value) { + // #ifndef H5 + plus.runtime.openURL(res.value, function(res) { - uni.switchTab({ - url: '/pages/index/index' - }) - // window.location.href = res.data.value; - // #endif - } + }); + // #endif + // #ifdef H5 + uni.setClipboardData({ + data: res.value, + success: r => { + uni.showToast({ + title: '邀请码复制成功', + icon: 'none', + }); + } + }); + + uni.switchTab({ + url: '/pages/index/index' + }) + // window.location.href = res.data.value; + // #endif } }); }