Skip to content

feature: 三端检测 #3

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/azure-staticwebapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ name: Deploy EOEFANS LANDING to Azure Static Web Apps
on:
push:
branches: [ "release" ]
pull_request:
types: [synchronize, closed]
branches: [ "release" ]
# pull_request:
# types: [synchronize, closed]
# branches: [ "release" ]

# Environment variables available to all jobs and steps in this workflow
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dev-azure-staticwebapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ name: Deploy DEV EOEFANS LANDING to Azure Static Web Apps
on:
push:
branches: ["main"]
pull_request:
types: [synchronize, closed]
branches: ["main"]
# pull_request:
# types: [synchronize, closed]
# branches: ["main"]

# Environment variables available to all jobs and steps in this workflow
env:
Expand Down
17 changes: 17 additions & 0 deletions src/utils/tools.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export function getBrowserInfo() {
const ua = navigator.userAgent

const isIOS = /(iPhone|iPad|iPod|iOS)/i.test(ua)
const isMac = ua.match(/(Mac OS X)\s([\d_]+)/i)
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua)

const isSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1
const isWx = /MicroMessenger/i.test(ua)
return {
isIOS,
isMobile,
isMac,
isSafari,
isWx
}
}
26 changes: 22 additions & 4 deletions src/views/Page1/Page1.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive, onMounted, computed } from 'vue'
import { getBrowserInfo } from '@/utils/tools'
import { Swiper, SwiperSlide } from 'swiper/vue'
import 'swiper/css'
Expand All @@ -23,10 +25,26 @@ const swiperList = [
]
const mainIntroduce = ref('E个魂的APP')
onMounted(() => {})
// onMounted(() => {})
const { isIOS, isMobile } = getBrowserInfo()
const buttontext = computed(() => {
if (!isMobile) {
return '前往官网'
}
if (isIOS) {
return '暂无下载链接'
}
return '前往下载'
})
const download = () => {
window.open('https://alist.vtb.link/EOEFANS/client')
if (!isMobile) {
window.open('https://eoefans.com')
return
}
if (!isIOS) {
window.open('https://eoe.best/appdl')
}
}
</script>
<template>
Expand All @@ -47,7 +65,7 @@ const download = () => {
Welcome to eoe world.
</div>
<section class="button-section">
<div class="download-button__base" @click="download">前往下载</div>
<div class="download-button__base" @click="download">{{ buttontext }}</div>
</section>
</section>
<!-- 使用示例 -->
Expand Down