|
@@ -0,0 +1,83 @@
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { onMounted } from 'vue'
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
|
+
|
|
|
+const { push } = useRouter()
|
|
|
+const route = useRoute()
|
|
|
+
|
|
|
+// 设备检测
|
|
|
+const isMobileDevice = (): boolean => {
|
|
|
+ // const ua = navigator.userAgent.toLowerCase()
|
|
|
+ // return /mobile|android|iphone|ipad/i.test(ua) &&
|
|
|
+ // !/(windows|macintosh|linux)/i.test
|
|
|
+ const userAgentInfo = navigator.userAgent;
|
|
|
+ alert(userAgentInfo)
|
|
|
+ const mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
|
|
+
|
|
|
+ const mobileFlag = mobileAgents.some((mobileAgent) => {
|
|
|
+ return userAgentInfo.indexOf(mobileAgent) > 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ return mobileFlag;
|
|
|
+}
|
|
|
+
|
|
|
+// 业务路由映射
|
|
|
+const businessRoutes: Record<string, string> = {
|
|
|
+ 'generateInspect': 'InspectOrderWrite',
|
|
|
+ 'failureReport': 'BpmProcessInstanceDetail',
|
|
|
+ 'maintainOut': 'BpmProcessInstanceDetail',
|
|
|
+ 'generateOperation' :'',
|
|
|
+ 'generateMaintenance' : ''
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ const { type = '', id = '' } = route.query
|
|
|
+ const isValidType = Object.keys(businessRoutes).includes(type as string)
|
|
|
+
|
|
|
+ if (isMobileDevice()) {
|
|
|
+ // 移动端跳转deepoil协议
|
|
|
+ alert("app")
|
|
|
+ window.location.href = `deepoil://${type}/${id}`
|
|
|
+ } else if (isValidType) {
|
|
|
+ // PC端路由跳转
|
|
|
+ alert('pc')
|
|
|
+ if (type === 'generateInspect') {
|
|
|
+ push({ name:'InspectOrderWrite', params:{id} })
|
|
|
+ }else if(type === 'failureReport') {
|
|
|
+ push({
|
|
|
+ name: 'BpmProcessInstanceDetail',
|
|
|
+ query: {
|
|
|
+ id: id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (type === 'generateMaintain') {
|
|
|
+ push({ name: 'MaintainEdit', params: {id } })
|
|
|
+ } else if (type === 'maintainOut') {
|
|
|
+ push({
|
|
|
+ name: 'BpmProcessInstanceDetail',
|
|
|
+ query: {
|
|
|
+ id: id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 默认跳转
|
|
|
+ alert('login')
|
|
|
+ push({ name:'Login' })
|
|
|
+ }
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="loading">跳转处理中...</div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.loading {
|
|
|
+ text-align: center;
|
|
|
+ padding-top: 100px;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #666;
|
|
|
+}
|
|
|
+</style>
|