App.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. proxy?.$http.common.baiduToken({}).then((res: any) => {
  8. let tok = res.token;
  9. localStorage.setItem('tok', tok);
  10. });
  11. //let speech = new Speech();
  12. //let state = localStorage.getItem('ttsState');
  13. // if (!speech.hasBrowserSupport()) {
  14. // proxy?.$modal.msgWarning(`不支持系统TTS,已切换百度TTS`);
  15. // localStorage.setItem('ttsState', "1");
  16. // proxy?.$http.common.baiduToken({}).then((res: any) => {
  17. // let tok = res.token;
  18. // localStorage.setItem('tok', tok);
  19. // });
  20. // } else {
  21. // // 如果支持,但是选择了使用百度TTS那就要获取新token
  22. // if (state == "1") {
  23. // proxy?.$http.common.baiduToken({}).then((res: any) => {
  24. // let tok = res.token;
  25. // localStorage.setItem('tok', tok);
  26. // });
  27. // }
  28. // }
  29. // import { useWebSocket } from '@/utils/handWs';
  30. // const { handWs, startDevice, startHand, stateHand } = useWebSocket();
  31. // const router = useRouter();
  32. // const data = reactive<any>({
  33. // deviceInfo: {},//设备信息
  34. // });
  35. // const { deviceInfo } = toRefs(data);
  36. // /**
  37. // * 手势
  38. // */
  39. // const getHandWs = async () => {
  40. // //加载手势WS
  41. // handWs((e: any) => {
  42. // // console.log("eeee", e)
  43. // if (e?.wksid) {
  44. // //获取设备项目
  45. // let deviceid = localStorage.getItem("deviceid") || '';
  46. // if (deviceid) {
  47. // startDevice({ deviceid: deviceid })
  48. // }
  49. // }
  50. // //接收设备信息
  51. // if (e?.device_info) {
  52. // deviceInfo.value = e.device_info;
  53. // let handcontroller_id = deviceInfo.value.handcontroller_id;
  54. // stateHand(handcontroller_id);
  55. // }
  56. // //获取手势状态
  57. // if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
  58. // let handcontroller_id = deviceInfo.value.handcontroller_id;
  59. // startHand(handcontroller_id);
  60. // }
  61. // //刷新
  62. // if (e?.data?.result == "refresh") {
  63. // router.push({ path: '/gesture' });
  64. // //刷新
  65. // window.location.reload()
  66. // }
  67. // });
  68. // };
  69. // getHandWs()
  70. </script>
  71. <style scoped></style>