|
|
@ -4,7 +4,7 @@ |
|
|
|
<div v-if="route.path !== '/home'" class="w-0.5 h-5 bg-white mx-3"></div> |
|
|
|
<p class="text-lg">{{ pageNameMap[route.path] }}</p> |
|
|
|
|
|
|
|
<img src="@/assets/icon_wifi.svg" alt="" class="ml-auto w-8" /> |
|
|
|
<img :src="`${isWifiNormal ? icon_wifi : icon_wifi2}`" alt="" class="ml-auto w-8" /> |
|
|
|
|
|
|
|
<div v-if="route.path === '/home'" class="btn-light px-5 py-1 mx-6 rounded min-w-[102px]"> |
|
|
|
<el-dropdown trigger="click"> |
|
|
@ -16,13 +16,13 @@ |
|
|
|
<el-dropdown-menu> |
|
|
|
<el-dropdown-item> |
|
|
|
<div class="flex items-center gap-4 text-lg text-primary" @click="router.push('/matrixManage')"> |
|
|
|
<img :src="icon_substrate" class="w-[18px]" alt=""> |
|
|
|
<img :src="icon_substrate" class="w-[18px]" alt="" /> |
|
|
|
<span>基质管理</span> |
|
|
|
</div> |
|
|
|
</el-dropdown-item> |
|
|
|
<el-dropdown-item> |
|
|
|
<div class="flex items-center gap-4 text-lg text-primary" @click="router.push('/debug')"> |
|
|
|
<img :src="icon_debug" class="w-[18px]" alt=""> |
|
|
|
<img :src="icon_debug" class="w-[18px]" alt="" /> |
|
|
|
<span>调试</span> |
|
|
|
</div> |
|
|
|
</el-dropdown-item> |
|
|
@ -37,14 +37,28 @@ |
|
|
|
</header> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { watch, ref, computed } from "vue"; |
|
|
|
import { watch, ref, computed, onMounted, onUnmounted } from "vue"; |
|
|
|
import Time from "@/components/Time.vue"; |
|
|
|
import icon_substrate from "@/assets/menu/icon_substrate.svg" |
|
|
|
import icon_substrate from "@/assets/menu/icon_substrate.svg"; |
|
|
|
import icon_debug from "@/assets/menu/icon_debug.svg"; |
|
|
|
import icon_wifi from "@/assets/icon_wifi.svg"; |
|
|
|
import icon_wifi2 from "@/assets/icon_wifi_red.svg"; |
|
|
|
import { useRoute, useRouter } from "vue-router"; |
|
|
|
import { createWebSocket, sharedWsUrl } from "@/services/socket"; |
|
|
|
|
|
|
|
const route = useRoute(); |
|
|
|
const router = useRouter(); |
|
|
|
const isWifiNormal = ref(true); |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
const wsClient = createWebSocket(sharedWsUrl); |
|
|
|
const subscription = wsClient.stateOb.subscribe(state => { |
|
|
|
isWifiNormal.value = state === "open"; |
|
|
|
}); |
|
|
|
onUnmounted(() => { |
|
|
|
subscription.unsubscribe(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
const pageNameMap: Record<string, string> = { |
|
|
|
"/": "基质喷涂转印仪", |
|
|
@ -55,7 +69,7 @@ const pageNameMap: Record<string, string> = { |
|
|
|
"/matrixManage": "基质管理", |
|
|
|
"/matrixCraft": "工艺管理", |
|
|
|
"/debug": "调试", |
|
|
|
"/history": "历史喷涂" |
|
|
|
"/history": "历史喷涂", |
|
|
|
}; |
|
|
|
|
|
|
|
function onReturnBtnClick() { |
|
|
@ -65,13 +79,4 @@ function onReturnBtnClick() { |
|
|
|
// router.push("/menu"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// watch( |
|
|
|
// () => route.path, |
|
|
|
// newPath => { |
|
|
|
// console.log(newPath); |
|
|
|
// if (newPath !== "/") { |
|
|
|
// } |
|
|
|
// } |
|
|
|
// ); |
|
|
|
</script> |