liuq 2 месяцев назад
Родитель
Сommit
68794082d7
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      frontend/src/views/PlatformLaunchpad.vue

+ 12 - 1
frontend/src/views/PlatformLaunchpad.vue

@@ -49,6 +49,11 @@ import { useRouter } from 'vue-router'
 
 const router = useRouter()
 
+// 检测是否为移动端设备
+const isMobile = () => {
+  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
+}
+
 // Types
 interface Mapping {
   app_name: string
@@ -134,7 +139,13 @@ const handleAppClick = async (app: Mapping) => {
     )
     
     if (res.data && res.data.redirect_url) {
-      window.open(res.data.redirect_url, '_blank')
+      if (isMobile()) {
+        // 手机端直接在当前标签页打开
+        window.location.href = res.data.redirect_url
+      } else {
+        // PC端在新标签页打开
+        window.open(res.data.redirect_url, '_blank')
+      }
       loadingMsg.close()
       ElMessage.success('已打开应用')
     } else {