基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.7 KiB

7 months ago
7 months ago
7 months ago
7 months ago
5 months ago
5 months ago
5 months ago
7 months ago
  1. <template>
  2. <header class="h-[--headerHeight] bg-primary flex items-center text-white">
  3. <img class="w-[83px] ml-6" src="@/assets/logo.png" alt="logo" />
  4. <div v-if="route.path !== '/home'" class="w-0.5 h-5 bg-white mx-3"></div>
  5. <p class="text-lg">{{ pageNameMap[route.path] }}</p>
  6. <img :src="`${isWifiNormal ? icon_wifi : icon_wifi2}`" alt="" class="ml-auto w-8" />
  7. <div v-if="route.path === '/home'" class="btn-light px-5 py-1 mx-6 rounded min-w-[102px]">
  8. <el-dropdown trigger="click">
  9. <div class="el-dropdown-link flex items-center">
  10. <img src="@/assets/menu.svg" alt="menu" />
  11. <p class="text-lg ml-2 text-primary">菜单</p>
  12. </div>
  13. <template #dropdown>
  14. <el-dropdown-menu>
  15. <el-dropdown-item>
  16. <div class="flex items-center gap-4 text-lg text-primary" @click="router.push('/matrixManage')">
  17. <img :src="icon_substrate" class="w-[18px]" alt="" />
  18. <span>基质管理</span>
  19. </div>
  20. </el-dropdown-item>
  21. <el-dropdown-item>
  22. <div class="flex items-center gap-4 text-lg text-primary" @click="router.push('/debug')">
  23. <img :src="icon_debug" class="w-[18px]" alt="" />
  24. <span>调试</span>
  25. </div>
  26. </el-dropdown-item>
  27. </el-dropdown-menu>
  28. </template>
  29. </el-dropdown>
  30. </div>
  31. <div v-else class="btn-light px-5 py-1 mx-6 rounded" @click="onReturnBtnClick">
  32. <img src="@/assets/return.svg" alt="return" />
  33. <p class="text-lg ml-2 text-primary">返回</p>
  34. </div>
  35. </header>
  36. </template>
  37. <script setup lang="ts">
  38. import { watch, ref, computed, onMounted, onUnmounted } from "vue";
  39. import Time from "@/components/Time.vue";
  40. import icon_substrate from "@/assets/menu/icon_substrate.svg";
  41. import icon_debug from "@/assets/menu/icon_debug.svg";
  42. import icon_wifi from "@/assets/icon_wifi.svg";
  43. import icon_wifi2 from "@/assets/icon_wifi_red.svg";
  44. import { useRoute, useRouter } from "vue-router";
  45. import { createWebSocket, sharedWsUrl } from "@/services/socket";
  46. const route = useRoute();
  47. const router = useRouter();
  48. const isWifiNormal = ref(true);
  49. onMounted(() => {
  50. const wsClient = createWebSocket(sharedWsUrl);
  51. const subscription = wsClient.stateOb.subscribe(state => {
  52. isWifiNormal.value = state === "open";
  53. });
  54. onUnmounted(() => {
  55. subscription.unsubscribe();
  56. });
  57. });
  58. const pageNameMap: Record<string, string> = {
  59. "/": "基质喷涂转印仪",
  60. "/environment": "环境设置",
  61. "/spray": "喷涂设置",
  62. "/preSpray": "喷涂设置",
  63. "/print": "转印设置",
  64. "/matrixManage": "基质管理",
  65. "/matrixCraft": "工艺管理",
  66. "/debug": "调试",
  67. "/history": "历史喷涂",
  68. };
  69. function onReturnBtnClick() {
  70. if (route.path !== "/home") {
  71. router.back();
  72. } else {
  73. // router.push("/menu");
  74. }
  75. }
  76. </script>