App.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <router-view />
  3. </template>
  4. <script setup lang="ts">
  5. import Speech from 'speak-tts';
  6. const { proxy } = getCurrentInstance() as any;
  7. let speech = new Speech();
  8. if (!speech.hasBrowserSupport()) {
  9. proxy?.$modal.msgWarning(`不支持TTS`);
  10. proxy?.$http.common.baiduToken({}).then((res: any) => {
  11. let tok = res.token;
  12. localStorage.setItem('tok', tok);
  13. });
  14. }
  15. let state = localStorage.getItem('ttsState');
  16. if (state == "1") {
  17. proxy?.$http.baiduToken.baiduToken({}).then((res: any) => {
  18. let tok = res.token;
  19. localStorage.setItem('tok', tok);
  20. });
  21. }
  22. // import { useWebSocket } from '@/utils/handWs';
  23. // const { handWs, startDevice, startHand, stateHand } = useWebSocket();
  24. // const router = useRouter();
  25. // const data = reactive<any>({
  26. // deviceInfo: {},//设备信息
  27. // });
  28. // const { deviceInfo } = toRefs(data);
  29. // /**
  30. // * 手势
  31. // */
  32. // const getHandWs = async () => {
  33. // //加载手势WS
  34. // handWs((e: any) => {
  35. // // console.log("eeee", e)
  36. // if (e?.wksid) {
  37. // //获取设备项目
  38. // let deviceid = localStorage.getItem("deviceid") || '';
  39. // if (deviceid) {
  40. // startDevice({ deviceid: deviceid })
  41. // }
  42. // }
  43. // //接收设备信息
  44. // if (e?.device_info) {
  45. // deviceInfo.value = e.device_info;
  46. // let handcontroller_id = deviceInfo.value.handcontroller_id;
  47. // stateHand(handcontroller_id);
  48. // }
  49. // //获取手势状态
  50. // if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
  51. // let handcontroller_id = deviceInfo.value.handcontroller_id;
  52. // startHand(handcontroller_id);
  53. // }
  54. // //刷新
  55. // if (e?.data?.result == "refresh") {
  56. // router.push({ path: '/gesture' });
  57. // //刷新
  58. // window.location.reload()
  59. // }
  60. // });
  61. // };
  62. // getHandWs()
  63. </script>
  64. <style scoped></style>