|
@@ -1,4 +1,9 @@
|
|
|
|
|
|
|
|
+<template>
|
|
|
|
+ <div class="loading">跳转处理中...</div>
|
|
|
|
+ <a ref="myLink" :href="href" v-show="false">跳转app</a>
|
|
|
|
+</template>
|
|
|
|
+
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { onMounted } from 'vue'
|
|
import { onMounted } from 'vue'
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
@@ -12,8 +17,7 @@ const isMobileDevice = (): boolean => {
|
|
// return /mobile|android|iphone|ipad/i.test(ua) &&
|
|
// return /mobile|android|iphone|ipad/i.test(ua) &&
|
|
// !/(windows|macintosh|linux)/i.test
|
|
// !/(windows|macintosh|linux)/i.test
|
|
const userAgentInfo = navigator.userAgent;
|
|
const userAgentInfo = navigator.userAgent;
|
|
- alert(userAgentInfo)
|
|
|
|
- const mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
|
|
|
|
|
+ const mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod","OpenHarmony"];
|
|
|
|
|
|
const mobileFlag = mobileAgents.some((mobileAgent) => {
|
|
const mobileFlag = mobileAgents.some((mobileAgent) => {
|
|
return userAgentInfo.indexOf(mobileAgent) > 0;
|
|
return userAgentInfo.indexOf(mobileAgent) > 0;
|
|
@@ -31,17 +35,32 @@ const businessRoutes: Record<string, string> = {
|
|
'generateMaintenance' : ''
|
|
'generateMaintenance' : ''
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const href = ref('')
|
|
|
|
+const myLink = ref(null);
|
|
|
|
+
|
|
|
|
+const clickA = () =>{
|
|
|
|
+ alert("click")
|
|
|
|
+ alert(href.value)
|
|
|
|
+ myLink.value.click();
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
const { type = '', id = '' } = route.query
|
|
const { type = '', id = '' } = route.query
|
|
const isValidType = Object.keys(businessRoutes).includes(type as string)
|
|
const isValidType = Object.keys(businessRoutes).includes(type as string)
|
|
-
|
|
|
|
if (isMobileDevice()) {
|
|
if (isMobileDevice()) {
|
|
// 移动端跳转deepoil协议
|
|
// 移动端跳转deepoil协议
|
|
- alert("app")
|
|
|
|
- window.location.href = `deepoil://${type}/${id}`
|
|
|
|
|
|
+ // try{
|
|
|
|
+ // const typelower = type.toLowerCase();
|
|
|
|
+ // window.location.href = `<a>deepoil://${typelower}/${id}</a>`
|
|
|
|
+ // }catch (error) {
|
|
|
|
+ // alert(error.message)
|
|
|
|
+ // }
|
|
|
|
+ href.value = 'deepoil://'+type+'/'+id
|
|
|
|
+ nextTick(()=>{
|
|
|
|
+ setTimeout(clickA,1000)
|
|
|
|
+ })
|
|
} else if (isValidType) {
|
|
} else if (isValidType) {
|
|
// PC端路由跳转
|
|
// PC端路由跳转
|
|
- alert('pc')
|
|
|
|
if (type === 'generateInspect') {
|
|
if (type === 'generateInspect') {
|
|
push({ name:'InspectOrderWrite', params:{id} })
|
|
push({ name:'InspectOrderWrite', params:{id} })
|
|
}else if(type === 'failureReport') {
|
|
}else if(type === 'failureReport') {
|
|
@@ -63,15 +82,11 @@ onMounted(() => {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 默认跳转
|
|
// 默认跳转
|
|
- alert('login')
|
|
|
|
push({ name:'Login' })
|
|
push({ name:'Login' })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-</script>
|
|
|
|
|
|
|
|
-<template>
|
|
|
|
- <div class="loading">跳转处理中...</div>
|
|
|
|
-</template>
|
|
|
|
|
|
+</script>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
.loading {
|
|
.loading {
|