feat(sys) add serial number display
This commit is contained in:
		
							parent
							
								
									72079d0cf9
								
							
						
					
					
						commit
						e53b0ed883
					
				|  | @ -3,6 +3,7 @@ import {type ApiJsonMsg, sendJsonMsg, WtModuleID} from '@/api' | ||||||
| export enum WtSytemCmd { | export enum WtSytemCmd { | ||||||
|     WT_SYS_GET_FM_INFO      = 1, |     WT_SYS_GET_FM_INFO      = 1, | ||||||
|     WT_SYS_REBOOT           = 2, |     WT_SYS_REBOOT           = 2, | ||||||
|  |     WT_SYS_GET_SYS_INFO     = 3, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export interface ISysFmInfo extends ApiJsonMsg { | export interface ISysFmInfo extends ApiJsonMsg { | ||||||
|  | @ -15,6 +16,10 @@ export interface ISysHwInfo extends ApiJsonMsg { | ||||||
|     mf_date: string; |     mf_date: string; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | export interface ISysInfo { | ||||||
|  |     sn: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| export function wt_sys_get_fm_info() { | export function wt_sys_get_fm_info() { | ||||||
|     const msg: ApiJsonMsg = { |     const msg: ApiJsonMsg = { | ||||||
|         module: WtModuleID.SYSTEM, |         module: WtModuleID.SYSTEM, | ||||||
|  | @ -30,3 +35,11 @@ export function wt_sys_reboot() { | ||||||
|     }; |     }; | ||||||
|     sendJsonMsg(msg); |     sendJsonMsg(msg); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | export function wt_sys_get_sys_info() { | ||||||
|  |     const msg: ApiJsonMsg = { | ||||||
|  |         module: WtModuleID.SYSTEM, | ||||||
|  |         cmd: WtSytemCmd.WT_SYS_GET_SYS_INFO, | ||||||
|  |     }; | ||||||
|  |     sendJsonMsg(msg); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import {useSystemStore} from "@/stores/useSystemStore"; | import {useSystemStore} from "@/stores/useSystemStore"; | ||||||
| import {registerModule} from "@/router/msgRouter"; | import {registerModule} from "@/router/msgRouter"; | ||||||
| import {type ApiJsonMsg, ControlEvent, type ControlMsg, ControlMsgType, WtModuleID} from "@/api"; | import {type ApiJsonMsg, ControlEvent, type ControlMsg, ControlMsgType, WtModuleID} from "@/api"; | ||||||
| import {type ISysFmInfo, wt_sys_get_fm_info, WtSytemCmd} from "@/api/apiSystem"; | import {type ISysFmInfo, type ISysInfo, wt_sys_get_fm_info, wt_sys_get_sys_info, WtSytemCmd} from "@/api/apiSystem"; | ||||||
| import {isDevMode} from "@/composables/buildMode"; | import {isDevMode} from "@/composables/buildMode"; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -15,6 +15,7 @@ export function useSystemModule() { | ||||||
| 
 | 
 | ||||||
|         if (msg.data === ControlEvent.CONNECTED) { |         if (msg.data === ControlEvent.CONNECTED) { | ||||||
|             wt_sys_get_fm_info(); |             wt_sys_get_fm_info(); | ||||||
|  |             wt_sys_get_sys_info(); | ||||||
|             sysStore.rebootInProgress = false; |             sysStore.rebootInProgress = false; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | @ -30,6 +31,11 @@ export function useSystemModule() { | ||||||
|                 sysStore.curFmInfo.ver = fm_info.fm_ver; |                 sysStore.curFmInfo.ver = fm_info.fm_ver; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|  |             case WtSytemCmd.WT_SYS_GET_SYS_INFO: { | ||||||
|  |                 const sysInfo: ISysInfo = msg as ISysInfo & ApiJsonMsg; | ||||||
|  |                 Object.assign(sysStore.sysInfo, sysInfo); | ||||||
|  |                 break; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|         if (isDevMode()) { |         if (isDevMode()) { | ||||||
|             console.log(msg); |             console.log(msg); | ||||||
|  |  | ||||||
|  | @ -13,11 +13,16 @@ export const useSystemStore = defineStore('system', () => { | ||||||
|         date: "-", |         date: "-", | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|  |     const sys_info = ref({ | ||||||
|  |         sn: "-", | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     const rebootInProgress = ref(false); |     const rebootInProgress = ref(false); | ||||||
| 
 | 
 | ||||||
|     return { |     return { | ||||||
|         curFmInfo, |         curFmInfo, | ||||||
|         hwInfo, |         hwInfo, | ||||||
|  |         sysInfo: sys_info, | ||||||
|         rebootInProgress, |         rebootInProgress, | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -47,6 +47,7 @@ const sysStore = useSystemStore(); | ||||||
|           <el-descriptions-item label="官网"><a target="_blank" href="https://yunsi.studio/wireless-debugger">https://yunsi.studio/wireless-debugger</a></el-descriptions-item> |           <el-descriptions-item label="官网"><a target="_blank" href="https://yunsi.studio/wireless-debugger">https://yunsi.studio/wireless-debugger</a></el-descriptions-item> | ||||||
|           <el-descriptions-item label="版本">{{ sysStore.curFmInfo.ver }}</el-descriptions-item> |           <el-descriptions-item label="版本">{{ sysStore.curFmInfo.ver }}</el-descriptions-item> | ||||||
|           <el-descriptions-item label="更新日期">{{ sysStore.curFmInfo.date }}</el-descriptions-item> |           <el-descriptions-item label="更新日期">{{ sysStore.curFmInfo.date }}</el-descriptions-item> | ||||||
|  |           <el-descriptions-item label="序列号">{{ sysStore.sysInfo.sn }}</el-descriptions-item> | ||||||
|         </el-descriptions> |         </el-descriptions> | ||||||
| 
 | 
 | ||||||
|         <el-descriptions title="鸣谢" border :column="1" class="mt-5 description-style"> |         <el-descriptions title="鸣谢" border :column="1" class="mt-5 description-style"> | ||||||
|  |  | ||||||
|  | @ -540,7 +540,6 @@ const onClientMsg = (msg: ApiJsonMsg) => { | ||||||
|     } |     } | ||||||
|     case WifiCmd.WIFI_API_JSON_STA_GET_STATIC_INFO: { |     case WifiCmd.WIFI_API_JSON_STA_GET_STATIC_INFO: { | ||||||
|       const staticInfo = msg as IWifiStaStaticInfo & ApiJsonMsg; |       const staticInfo = msg as IWifiStaStaticInfo & ApiJsonMsg; | ||||||
|       console.log("@@@", staticInfo); |  | ||||||
|       Object.assign(wifiStaticInfo, staticInfo); |       Object.assign(wifiStaticInfo, staticInfo); | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue