|
|
@@ -1,64 +1,108 @@
|
|
|
-
|
|
|
<template>
|
|
|
- <div v-if="isMobileDevice&&!isDingTalk()" class="loading">跳转处理中...</div>
|
|
|
-<!-- <a ref="myLink" :href="href" v-show="false">跳转app</a>-->
|
|
|
-<!-- <div v-if="isMobileDevice()&&isDingTalk()" class="wxtip" id="JweixinTip">-->
|
|
|
-<!-- <span class="wxtip-icon"></span>-->
|
|
|
-<!-- </div>-->
|
|
|
+ <div v-if="isMobileDevice && !isDingTalk()" class="loading">跳转处理中...</div>
|
|
|
+ <!-- <a ref="myLink" :href="href" v-show="false">跳转app</a>-->
|
|
|
+ <!-- <div v-if="isMobileDevice()&&isDingTalk()" class="wxtip" id="JweixinTip">-->
|
|
|
+ <!-- <span class="wxtip-icon"></span>-->
|
|
|
+ <!-- </div>-->
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { onMounted } from 'vue'
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
-import * as LoginApi from "@/api/login";
|
|
|
-import * as authUtil from "@/utils/auth";
|
|
|
+import * as LoginApi from '@/api/login'
|
|
|
+import * as authUtil from '@/utils/auth'
|
|
|
|
|
|
const { push } = useRouter()
|
|
|
const route = useRoute()
|
|
|
|
|
|
// 设备检测
|
|
|
const isMobileDevice = (): boolean => {
|
|
|
- const userAgentInfo = navigator.userAgent;
|
|
|
- const mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod","OpenHarmony"];
|
|
|
+ const userAgentInfo = navigator.userAgent
|
|
|
+ const mobileAgents = [
|
|
|
+ 'Android',
|
|
|
+ 'iPhone',
|
|
|
+ 'SymbianOS',
|
|
|
+ 'Windows Phone',
|
|
|
+ 'iPad',
|
|
|
+ 'iPod',
|
|
|
+ 'OpenHarmony'
|
|
|
+ ]
|
|
|
|
|
|
const mobileFlag = mobileAgents.some((mobileAgent) => {
|
|
|
- return userAgentInfo.indexOf(mobileAgent) > 0;
|
|
|
- });
|
|
|
+ return userAgentInfo.indexOf(mobileAgent) > 0
|
|
|
+ })
|
|
|
|
|
|
- return mobileFlag;
|
|
|
+ return mobileFlag
|
|
|
}
|
|
|
|
|
|
// 判断是否是钉钉环境
|
|
|
const isDingTalk = (): boolean => {
|
|
|
- const userAgent = navigator.userAgent.toLowerCase();
|
|
|
- return userAgent.includes('dingtalk');
|
|
|
+ const userAgent = navigator.userAgent.toLowerCase()
|
|
|
+ return userAgent.includes('dingtalk')
|
|
|
}
|
|
|
|
|
|
// 业务路由映射
|
|
|
const businessRoutes: Record<string, string> = {
|
|
|
- 'generateInspect': 'InspectOrderWrite',
|
|
|
- 'failureReport': 'BpmProcessInstanceDetail',
|
|
|
- 'maintainOut': 'BpmProcessInstanceDetail',
|
|
|
- 'generateOperation' :'',
|
|
|
- 'generateMaintenance' : '',
|
|
|
- 'generateMaintain':''
|
|
|
+ generateInspect: 'InspectOrderWrite',
|
|
|
+ failureReport: 'BpmProcessInstanceDetail',
|
|
|
+ maintainOut: 'BpmProcessInstanceDetail',
|
|
|
+ generateOperation: '',
|
|
|
+ generateMaintenance: '',
|
|
|
+ generateMaintain: '',
|
|
|
+ rdReportApproval: 'rdReportApproval'
|
|
|
}
|
|
|
|
|
|
const href = ref('')
|
|
|
-const myLink = ref(null);
|
|
|
+const myLink = ref(null)
|
|
|
|
|
|
-const clickA = () =>{
|
|
|
- myLink.value.click();
|
|
|
+const clickA = () => {
|
|
|
+ myLink.value.click()
|
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- let { type = '', id = '', userId='', deptId='',createTime='',orderStatus='',orderName='',userName='' } = route.query
|
|
|
+ let {
|
|
|
+ type = '',
|
|
|
+ id = '',
|
|
|
+ userId = '',
|
|
|
+ deptId = '',
|
|
|
+ createTime = '',
|
|
|
+ orderStatus = '',
|
|
|
+ orderName = '',
|
|
|
+ userName = ''
|
|
|
+ } = route.query
|
|
|
+
|
|
|
+ console.log('route.query :>> ', route.query)
|
|
|
const isValidType = Object.keys(businessRoutes).includes(type as string)
|
|
|
+
|
|
|
if (isMobileDevice()) {
|
|
|
- if (type==='generateOperation') {
|
|
|
- window.location.href = import.meta.env.VITE_BASE_URL + '/deepoil/#/?type=' + type+'&id='+id+'&userId='+userId+'&deptId='+deptId+'&createTime='+createTime+'&orderStatus='+orderStatus+'&orderName='+orderName+'&userName='+userName;
|
|
|
- }else {
|
|
|
- window.location.href = import.meta.env.VITE_BASE_URL + '/deepoil/#/?type=' + type+'&id='+id+'&userId='+userId;
|
|
|
+ if (type === 'generateOperation') {
|
|
|
+ window.location.href =
|
|
|
+ import.meta.env.VITE_BASE_URL +
|
|
|
+ '/deepoil/#/?type=' +
|
|
|
+ type +
|
|
|
+ '&id=' +
|
|
|
+ id +
|
|
|
+ '&userId=' +
|
|
|
+ userId +
|
|
|
+ '&deptId=' +
|
|
|
+ deptId +
|
|
|
+ '&createTime=' +
|
|
|
+ createTime +
|
|
|
+ '&orderStatus=' +
|
|
|
+ orderStatus +
|
|
|
+ '&orderName=' +
|
|
|
+ orderName +
|
|
|
+ '&userName=' +
|
|
|
+ userName
|
|
|
+ } else {
|
|
|
+ window.location.href =
|
|
|
+ import.meta.env.VITE_BASE_URL +
|
|
|
+ '/deepoil/#/?type=' +
|
|
|
+ type +
|
|
|
+ '&id=' +
|
|
|
+ id +
|
|
|
+ '&userId=' +
|
|
|
+ userId
|
|
|
}
|
|
|
// 移动端跳转deepoil协议
|
|
|
// try{
|
|
|
@@ -72,17 +116,17 @@ onMounted(async () => {
|
|
|
// setTimeout(clickA,1000)
|
|
|
// })
|
|
|
} else if (isValidType) {
|
|
|
- authUtil.setTenantId(1)
|
|
|
+ authUtil.setTenantId('1')
|
|
|
const res = await LoginApi.simpleLogin(userId)
|
|
|
if (!res) {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
authUtil.setToken(res)
|
|
|
// PC端路由跳转
|
|
|
- debugger
|
|
|
if (type === 'generateInspect') {
|
|
|
- push({ name:'InspectOrderWrite', params:{id} })
|
|
|
- }else if(type === 'failureReport') {
|
|
|
+ push({ name: 'InspectOrderWrite', params: { id } })
|
|
|
+ } else if (type === 'failureReport') {
|
|
|
push({
|
|
|
name: 'BpmProcessInstanceDetail',
|
|
|
query: {
|
|
|
@@ -91,7 +135,7 @@ onMounted(async () => {
|
|
|
})
|
|
|
} else if (type === 'generateMaintain') {
|
|
|
debugger
|
|
|
- push({ name: 'MaintainEdit', params: {id } })
|
|
|
+ push({ name: 'MaintainEdit', params: { id } })
|
|
|
} else if (type === 'maintainOut') {
|
|
|
push({
|
|
|
name: 'BpmProcessInstanceDetail',
|
|
|
@@ -99,13 +143,13 @@ onMounted(async () => {
|
|
|
id: id
|
|
|
}
|
|
|
})
|
|
|
- } else if(type === 'generateOperation'){
|
|
|
+ } else if (type === 'generateOperation') {
|
|
|
// push({
|
|
|
// name: 'FillOrderInfo',
|
|
|
// params: { deptId,userId,createTime,id,orderStatus }
|
|
|
// })
|
|
|
- id = deptId+','+userId+','+createTime+','+id+','+orderStatus
|
|
|
- push({ name: 'FillOrderInfo',params:{id}})
|
|
|
+ id = deptId + ',' + userId + ',' + createTime + ',' + id + ',' + orderStatus
|
|
|
+ push({ name: 'FillOrderInfo', params: { id } })
|
|
|
} else if (type === 'generateMaintenance') {
|
|
|
push({
|
|
|
name: 'IotMainWorkOrderBom',
|
|
|
@@ -124,44 +168,44 @@ onMounted(async () => {
|
|
|
}
|
|
|
} else {
|
|
|
// 默认跳转
|
|
|
- push({ name:'Login' })
|
|
|
+ push({ name: 'Login' })
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.loading {
|
|
|
- text-align: center;
|
|
|
padding-top: 100px;
|
|
|
font-size: 16px;
|
|
|
color: #666;
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
+
|
|
|
.wxtip {
|
|
|
- background: rgba(0, 0, 0, 0.8);
|
|
|
- text-align: center;
|
|
|
position: fixed;
|
|
|
- left: 0;
|
|
|
top: 0;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
+ left: 0;
|
|
|
z-index: 998;
|
|
|
display: block;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ text-align: center;
|
|
|
+ background: rgb(0 0 0 / 80%);
|
|
|
}
|
|
|
|
|
|
.wxtip-icon {
|
|
|
+ position: absolute;
|
|
|
+ display: block;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
- background: url(@/assets/imgs/bgzz.png) center center no-repeat;
|
|
|
+ background: url('@/assets/imgs/bgzz.png') center center no-repeat;
|
|
|
background-size: cover; /* 新增样式,使背景图片覆盖整个元素 */
|
|
|
- display: block;
|
|
|
- position: absolute;
|
|
|
}
|
|
|
|
|
|
.wxtip-txt {
|
|
|
margin-top: 107px;
|
|
|
- color: #fff;
|
|
|
font-size: 16px;
|
|
|
line-height: 1.5;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
</style>
|