下载优化

This commit is contained in:
GaoHao
2025-01-13 11:14:17 +08:00
parent 0dd632eaff
commit 4638a4a30d

View File

@@ -29,72 +29,68 @@
}) })
onLoad(() => { onLoad(() => {
let u = navigator.userAgent; // #ifdef H5
if ( u.indexOf('iPhone') > -1) { let u = window.navigator.userAgent;
// #ifdef H5 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({
title: '邀请码复制成功', title: '邀请码复制成功',
icon: 'none', icon: 'none',
}); });
} }
}); });
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.value, function(res) {
plus.runtime.openURL(res.data.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: '邀请码复制成功',
icon: 'none', icon: 'none',
}); });
} }
}); });
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
}) })
// window.location.href = res.data.value; // window.location.href = res.data.value;
// #endif // #endif
}
} }
}); });
} }