下载优化

This commit is contained in:
GaoHao 2025-01-13 11:14:17 +08:00
parent 0dd632eaff
commit 4638a4a30d
1 changed files with 48 additions and 52 deletions

View File

@ -29,33 +29,32 @@
}) })
onLoad(() => { 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 = "跳转网页版首页" data.confirmBtn = "跳转网页版首页"
// #endif
} }
if ( u.toLowerCase().indexOf('micromessenger') !== -1) { if ( u.toLowerCase().indexOf('micromessenger') !== -1) {
data.isWeixin = true data.isWeixin = true
} }
// #endif
}) })
function download() { function download() {
var u = navigator.userAgent; console.log(uni.getSystemInfoSync().platform == 'android')
if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) { if (uni.getSystemInfoSync().platform == 'android') {
commonType(49).then(res => { commonType(49).then(res => {
if (res.code === 0) { console.log(res)
if (res.data && res.data.value) { if (res && res.value) {
// #ifndef H5 // #ifndef H5
plus.runtime.openURL(res.data.value, function(res) { plus.runtime.openURL(res.value, function(res) {
}); });
// #endif // #endif
// #ifdef H5 // #ifdef H5
uni.setClipboardData({ uni.setClipboardData({
data: res.data.value, data: res.value,
success: r => { success: r => {
// this.$queue.showToast(''); // this.$queue.showToast('');
uni.showToast({ uni.showToast({
@ -64,23 +63,21 @@
}); });
} }
}); });
window.location.href = res.data.value; window.location.href = res.value;
// #endif // #endif
} }
}
}); });
} else { } else {
commonType(50).then(res => { commonType(50).then(res => {
if (res.code === 0) { if (res && res.value) {
if (res.data && res.data.value) {
// #ifndef H5 // #ifndef H5
plus.runtime.openURL(res.data.value, function(res) { plus.runtime.openURL(res.value, function(res) {
}); });
// #endif // #endif
// #ifdef H5 // #ifdef H5
uni.setClipboardData({ uni.setClipboardData({
data: res.data.value, data: res.value,
success: r => { success: r => {
uni.showToast({ uni.showToast({
title: '邀请码复制成功', title: '邀请码复制成功',
@ -95,7 +92,6 @@
// window.location.href = res.data.value; // window.location.href = res.data.value;
// #endif // #endif
} }
}
}); });
} }
} }