move logs to dev mode only, change navbar connection icon

This commit is contained in:
kerms 2024-04-02 10:06:20 +08:00
parent bb169b53e1
commit 7d2f3868aa
10 changed files with 19 additions and 17 deletions

4
env.d.ts vendored
View File

@ -1,3 +1 @@
/// <reference types="vite/client" />
declare const __APP_VERSION__: string; // defined in vite.config.ts, imported from package.json.version
declare const __BUILD_TIME__: string;
/// <reference types="vite/client" />

View File

@ -38,10 +38,9 @@ let websocketService: IWebsocketService;
onMounted(() => {
logHelloMessage();
let host = "";
if (isDevMode()) {
host = "192.168.43.61";
host = import.meta.env.VITE_DEVICE_HOST_NAME;
} else {
host = window.location.host
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.949 14.121 19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0l-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121a2.723 2.723 0 0 1-.844.57L13.414 12l1.414-1.414-.707-.707a4.965 4.965 0 0 0-3.535-1.465c-.235 0-.464.032-.691.066L3.707 2.293 2.293 3.707l18 18 1.414-1.414-5.536-5.536c.277-.184.538-.396.778-.636zm-6.363 3.536a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l1.476-1.475-1.414-1.414L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707z"></path></svg>

After

Width:  |  Height:  |  Size: 667 B

1
src/assets/icon/link.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465s-2.592.521-3.535 1.465L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.121z"></path><path d="m12 4.929-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121c-1.133 1.133-3.109 1.133-4.242 0L10.586 12l-1.414 1.414.707.707c.943.944 2.199 1.465 3.535 1.465s2.592-.521 3.535-1.465L19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0z"></path></svg>

After

Width:  |  Height:  |  Size: 712 B

View File

@ -147,8 +147,9 @@ class OneTimeWebsocket implements IWebsocket {
if (this.socket.readyState !== WebSocket.OPEN) {
return;
}
console.log('WebSocket proxies data ', msg);
if (isDevMode()) {
console.log('WebSocket proxies data ', msg);
}
if (msg.type === "binary") {
// this.socket.send(msg.data);
} else if (msg.type === "json") {

View File

@ -1,4 +1,5 @@
import type {ApiJsonMsg, ControlMsg, ServerMsg} from "@/api";
import {isDevMode} from "@/composables/buildMode";
export interface IModuleCallback {
ctrlCallback: (msg: ControlMsg) => void;
@ -27,10 +28,14 @@ export function routeModuleServerMsg(msg: ServerMsg) {
if (moduleHandler) {
moduleHandler.serverMsgCallback(msg);
} else {
console.log("routeModuleServerMsg module not loaded", module);
if (isDevMode()) {
console.log("routeModuleServerMsg module not loaded", module);
}
}
} else {
console.log("routeModuleServerMsg ignored:", msg);
if (isDevMode()) {
console.log("routeModuleServerMsg ignored:", msg);
}
}
}

View File

@ -6,11 +6,11 @@ const compileTime = import.meta.env.VITE_APP_LAST_COMMIT;
<template>
<div class="text-layout">
<el-divider></el-divider>
<el-divider>关于上位机</el-divider>
<el-divider>关于网页版上位机</el-divider>
<el-divider></el-divider>
<el-descriptions border :column="1" class="mt-5 description-style">
<el-descriptions-item label="上位机版本">{{version}}</el-descriptions-item>
<el-descriptions-item label="版本">{{version}}</el-descriptions-item>
<el-descriptions-item label="发布时间">{{compileTime}}</el-descriptions-item>
<el-descriptions-item label="许可证">MIT</el-descriptions-item>
</el-descriptions>

View File

@ -328,7 +328,6 @@ function onConnectClick() {
globalNotify("调试器未连接", 'error');
return;
}
console.log(ssidValidateForm.wifiSsid, ssidValidateForm.password);
if (ssidValidateForm.wifiSsid !== "") {
wifi_connect_to(ssidValidateForm.wifiSsid, ssidValidateForm.password);
connectBtnClicked = 1;

View File

@ -29,8 +29,8 @@
<!-- <a class="md:ml-auto md:mr-3"></a>-->
<div class="flex">
<el-button @click="stateMenuOpen=true" :type="wsColor" size="large" class="transition duration-1000">
<InlineSvg v-show="wsColor!=='success'" name="wifi-exclamation" class="mr-2" width="20"></InlineSvg>
<InlineSvg v-show="wsColor==='success'" name="wifi-3" class="mr-2" width="20"></InlineSvg>
<InlineSvg v-show="wsColor!=='success'" name="link-off" class="mr-2" width="20"></InlineSvg>
<InlineSvg v-show="wsColor==='success'" name="link" class="mr-2" width="20"></InlineSvg>
{{ wsState }}
</el-button>
</div>

View File

@ -7,7 +7,6 @@ import vue from '@vitejs/plugin-vue'
import svgLoader from "vite-svg-loader";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
import { viteSingleFile } from 'vite-plugin-singlefile'
import packageJson from "./package.json"
// https://vitejs.dev/config/
export default defineConfig({
@ -24,8 +23,7 @@ export default defineConfig({
viteSingleFile(),
],
define: {
'__APP_VERSION__': JSON.stringify(packageJson.version),
'__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
},
resolve: {
alias: {