| <template> | 
|   <router-view/> | 
| </template> | 
|   | 
| <script setup lang="ts"> | 
| import * as echarts from 'echarts' | 
| import { getCurrentInstance, provide, onMounted } from "vue"; | 
| import { useStore } from "vuex"; | 
| import { useRoute } from 'vue-router'; | 
| import { ddLogin, getUserInfo, testLogin, getDingdingCorpId } from "@/apis"; | 
| import { Toast } from "vant"; | 
|   | 
| const { proxy }: any = getCurrentInstance() | 
|   | 
| provide('ec', echarts) | 
| const route = useRoute() | 
| const store = useStore() | 
|   | 
| const LOGIN = async () => { | 
|    | 
|   let timer: any = null | 
|   timer = setInterval(() => { | 
|     if (store.state.companyId) { | 
|       clearInterval(timer) | 
|       timer = null | 
|       if (proxy.$dd.env.platform !== 'notInDingTalk') { | 
|         if (store.state.companyId !== 'noLogin') { | 
|           // Toast.fail(store.state.companyId) | 
|           getDingdingCorpId(store.state.companyId) | 
|             .then(dataCode => { | 
|               if (dataCode.code === 200) { | 
|                 proxy.$dd.runtime.permission.requestAuthCode({ | 
|                   corpId: dataCode.data, | 
|                   onSuccess: async (result: any) => { | 
|                     // process.env.VUE_APP_CORPID | 
|                     // process.env.VUE_APP_COMPANYID | 
|                     let res: any = await ddLogin({ code: result.code, companyId: store.state.companyId }) | 
|                     if (res.code === 200) { | 
|                       let info: any = await getUserInfo() | 
|                       if (info.code === 200) { | 
|                         await store.commit('setEntrance', 'DD') | 
|                         await store.commit('setUserInfo', info.data) | 
|                         await store.dispatch('getMenuList', 2) | 
|                       } else { | 
|                         Toast.fail(info.message) | 
|                       } | 
|                     } else { | 
|                       Toast.fail(res.message) | 
|                     } | 
|                     proxy.$reslove() | 
|                   }, | 
|                   onFail: (err: any) => { | 
|                     Toast.fail('钉钉登录失败') | 
|                   } | 
|                 }) | 
|               } | 
|             }) | 
|         } else { | 
|           proxy.$reslove() | 
|         } | 
|       } else { | 
|         proxy.$reslove() | 
|       } | 
|     } | 
|   }, 1000) | 
| } | 
|   | 
| if (proxy.$dd.env.platform !== 'notInDingTalk') { | 
|   proxy.$dd.ready(function() { | 
|     // 页面被唤醒的事件监听(webview) | 
|     document.addEventListener('resume', function(e) { | 
|       e.preventDefault(); | 
|     }, false); | 
|     // 网络连接断开的事件监听 | 
|     document.addEventListener('offline', function(e) { | 
|       e.preventDefault(); | 
|     }, false); | 
|   }) | 
| } | 
|   | 
| onMounted(() => { | 
|   store.dispatch('mobilePhoneModel') | 
|   LOGIN() | 
| }) | 
| </script> | 
|   | 
| <style lang="scss"> | 
|   html, body, #app { | 
|     width: 100%; | 
|     height: 100%; | 
|     margin: 0; | 
|   } | 
| </style> |