|
@ -3,12 +3,12 @@ |
|
|
* @email: 18603454788@163.com |
|
|
* @email: 18603454788@163.com |
|
|
* @Date: 2021-04-19 10:23:19 |
|
|
* @Date: 2021-04-19 10:23:19 |
|
|
* @LastEditors: aBin |
|
|
* @LastEditors: aBin |
|
|
* @LastEditTime: 2021-05-31 15:55:52 |
|
|
* @LastEditTime: 2021-06-11 15:50:57 |
|
|
--> |
|
|
--> |
|
|
<template> |
|
|
<template> |
|
|
<a-config-provider :locale="zh_CN"> |
|
|
<a-config-provider :locale="zh_CN"> |
|
|
<div class="d-flex flex-row flex-nowrap" id="app"> |
|
|
<div v-if="isRouter" class="d-flex flex-row flex-nowrap" id="app"> |
|
|
<btn-con /> |
|
|
<!-- <btn-con /> --> |
|
|
<router-view class="flex-1 bg" style="padding: 6px"></router-view> |
|
|
<router-view class="flex-1 bg" style="padding: 6px"></router-view> |
|
|
</div> |
|
|
</div> |
|
|
</a-config-provider> |
|
|
</a-config-provider> |
|
@ -17,33 +17,30 @@ |
|
|
<script> |
|
|
<script> |
|
|
import { mapState, mapActions, mapMutations } from 'vuex'; |
|
|
import { mapState, mapActions, mapMutations } from 'vuex'; |
|
|
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN'; |
|
|
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN'; |
|
|
import BtnCon from 'components/BtnCom/BtnCon.vue'; |
|
|
// import BtnCon from 'components/BtnCom/BtnCon.vue'; |
|
|
import { getHId } from 'config/api'; |
|
|
import { getHId } from 'config/api'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'App', |
|
|
name: 'App', |
|
|
components: { BtnCon }, |
|
|
// components: { BtnCon }, |
|
|
data() { |
|
|
data() { |
|
|
return { zh_CN }; |
|
|
return { zh_CN, isRouter: false }; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
computed: mapState('home', ['anyringToken', 'ptProps']), |
|
|
|
|
|
|
|
|
|
|
|
watch: { |
|
|
watch: { |
|
|
ptProps(val) { |
|
|
anyringToken(val) { |
|
|
if (val.userId) { |
|
|
if (val) { |
|
|
const params = { userId: val.userId }; |
|
|
this.isRouter = true; |
|
|
this.getUserId(params); |
|
|
|
|
|
this.getHospitalId(val.projectId); |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
// created() { |
|
|
computed: mapState('home', ['anyringToken', 'ptProps']), |
|
|
|
|
|
|
|
|
async created() { |
|
|
async created() { |
|
|
const userId = '1387952026067013632'; |
|
|
// async created() { |
|
|
const params = { userId }; |
|
|
// const userId = '1387952026067013632'; |
|
|
await this.getUserId(params); |
|
|
// const params = { userId }; |
|
|
await this.getToken(); |
|
|
// await this.getUserId(params); |
|
|
|
|
|
// await this.getToken(); |
|
|
if (localStorage.getItem('patientId')) { |
|
|
if (localStorage.getItem('patientId')) { |
|
|
this.setPatientId(localStorage.getItem('patientId')); |
|
|
this.setPatientId(localStorage.getItem('patientId')); |
|
|
} |
|
|
} |
|
@ -53,15 +50,10 @@ export default { |
|
|
if (localStorage.getItem('recordCode')) { |
|
|
if (localStorage.getItem('recordCode')) { |
|
|
this.setRecordCode(localStorage.getItem('recordCode')); |
|
|
this.setRecordCode(localStorage.getItem('recordCode')); |
|
|
} |
|
|
} |
|
|
const that = this; |
|
|
await this.isMobile(); |
|
|
window.plugin = window.TallPlugin.init(); |
|
|
if (this.anyringToken) { |
|
|
// 调用created方法 向主窗体发送created消息,以便来接受、存储主窗体传递来的参数 |
|
|
this.isRouter = true; |
|
|
// created接受一个回调函数 created成功后调用 可选参数 |
|
|
} |
|
|
// 接受PT传过来的 插件id,项目id,角色id,任务id,userId |
|
|
|
|
|
window.plugin.created(function(props) { |
|
|
|
|
|
that.setPtProps(props); |
|
|
|
|
|
that.getHospitalId(props.projectId); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
@ -77,6 +69,49 @@ export default { |
|
|
} |
|
|
} |
|
|
} catch (error) {} |
|
|
} catch (error) {} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isMobile() { |
|
|
|
|
|
this.flag = navigator.userAgent.match( |
|
|
|
|
|
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i, |
|
|
|
|
|
); |
|
|
|
|
|
if (this.flag === null) { |
|
|
|
|
|
console.log('pc端'); |
|
|
|
|
|
this.getPtpropsPC(); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('移动端'); |
|
|
|
|
|
this.getPtpropsMove(); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
getPtpropsMove() { |
|
|
|
|
|
const that = this; |
|
|
|
|
|
window.parent.postMessage('created', '*'); |
|
|
|
|
|
window.addEventListener('message', async function(event) { |
|
|
|
|
|
try { |
|
|
|
|
|
const data = JSON.parse(event.data); |
|
|
|
|
|
if (data.type !== 'data') return; |
|
|
|
|
|
console.log('Props', data.data); |
|
|
|
|
|
await that.setPtProps(data.data); |
|
|
|
|
|
console.log('ptProps', that.ptProps); |
|
|
|
|
|
const params = { userId: data.data.userId }; |
|
|
|
|
|
await that.getUserId(params); |
|
|
|
|
|
await that.getToken(); |
|
|
|
|
|
await that.getHospitalId(data.data.projectId); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.log('error:', error); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
getPtpropsPC() { |
|
|
|
|
|
const that = this; |
|
|
|
|
|
window.TallPlugin.init(async function(props) { |
|
|
|
|
|
console.log('props:', props); |
|
|
|
|
|
that.setPtProps(props); |
|
|
|
|
|
const params = { userId: props.userId }; |
|
|
|
|
|
await that.getUserId(params); |
|
|
|
|
|
await that.getToken(); |
|
|
|
|
|
await that.getHospitalId(data.data.projectId); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|