|
@@ -21,8 +21,7 @@ import i18n from '@/locale/index'
|
|
|
import { useUserStore } from '@/store/user'
|
|
import { useUserStore } from '@/store/user'
|
|
|
import { formatNumber } from '@/utils'
|
|
import { formatNumber } from '@/utils'
|
|
|
import { toPage } from '@/utils/page'
|
|
import { toPage } from '@/utils/page'
|
|
|
-import { handleWhatsApp } from '@/utils/social'
|
|
|
|
|
-import { toast } from '@/utils/toast'
|
|
|
|
|
|
|
+import { checkAppInstalled, getPlusRuntime, handleWhatsApp } from '@/utils/social'
|
|
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
|
name: 'Mine', // 我的
|
|
name: 'Mine', // 我的
|
|
@@ -52,12 +51,38 @@ function copyReferrerCode() {
|
|
|
return
|
|
return
|
|
|
uni.setClipboardData({
|
|
uni.setClipboardData({
|
|
|
data: code,
|
|
data: code,
|
|
|
- success: () => {
|
|
|
|
|
- toast.success(t('mine.pages.share.copySuccess'))
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ success: () => {},
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function openWhatsAppStore() {
|
|
|
|
|
+ const runtime = getPlusRuntime()
|
|
|
|
|
+ if (!runtime)
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ const platform = uni.getSystemInfoSync().platform
|
|
|
|
|
+ // Android:优先使用 market:// 拉起 Google Play,其次回退 https
|
|
|
|
|
+ if (platform === 'android') {
|
|
|
|
|
+ runtime.openURL(
|
|
|
|
|
+ 'market://details?id=com.whatsapp',
|
|
|
|
|
+ () => {
|
|
|
|
|
+ runtime.openURL('https://play.google.com/store/apps/details?id=com.whatsapp&pli=1')
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // iOS:使用 itms-apps:// 拉起 App Store,其次回退 https
|
|
|
|
|
+ if (platform === 'ios') {
|
|
|
|
|
+ runtime.openURL(
|
|
|
|
|
+ 'itms-apps://itunes.apple.com/app/id310633997',
|
|
|
|
|
+ () => {
|
|
|
|
|
+ runtime.openURL('https://apps.apple.com/app/id310633997')
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const groupList = computed(() => {
|
|
const groupList = computed(() => {
|
|
|
// 依赖 locale,确保切换语言后这里会重新计算
|
|
// 依赖 locale,确保切换语言后这里会重新计算
|
|
|
const _locale = i18n.global.locale
|
|
const _locale = i18n.global.locale
|
|
@@ -111,6 +136,11 @@ async function menuClick(item: any) {
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
const res = await getConfig(item.config)
|
|
const res = await getConfig(item.config)
|
|
|
|
|
+ const runtime = getPlusRuntime()
|
|
|
|
|
+ if (runtime && !checkAppInstalled('whatsapp')) {
|
|
|
|
|
+ openWhatsAppStore()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
handleWhatsApp(item.config as 'live_chat' | 'activity_group', res)
|
|
handleWhatsApp(item.config as 'live_chat' | 'activity_group', res)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|