diff --git a/src/assets/power.svg b/src/assets/power.svg new file mode 100644 index 0000000..24beb91 --- /dev/null +++ b/src/assets/power.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/CustomNavBar.scss b/src/components/CustomNavBar.scss index c0aed03..1a8a6a8 100644 --- a/src/components/CustomNavBar.scss +++ b/src/components/CustomNavBar.scss @@ -2,19 +2,37 @@ position: relative; font-size: 12px; height: 16px; - padding-left: 2px; - padding-right: 2px; - color: var(--primaryColor); - border: solid 1px var(--primaryColor); - border-radius: 2px; - &::after { - content: " "; + padding: 0 5px; + background: rgba(0,0,0,0.3); + color: #ffffff; + border-radius: 4px; + width: 35px; + display: flex; + align-items: center; + justify-content: center; + .bg-color { position: absolute; - width: 4px; + height: 100%; + width: 50%; + left: 0; + border-radius: 4px; + z-index: 1; + background: var(--successColor); + } + .power-num{ + z-index: 10; + } + img { + width: 50%; + z-index: 10; + } + .power-head { + position: absolute; + width: 2px; height: 8px; - background-color: var(--primaryColor); - right: -4px; - top: 3px; + background-color: rgba(0,0,0,0.3); + right: -2px; + top: 3.5px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; } diff --git a/src/components/CustomNavBar.tsx b/src/components/CustomNavBar.tsx index 5a7ff24..ad24633 100644 --- a/src/components/CustomNavBar.tsx +++ b/src/components/CustomNavBar.tsx @@ -1,5 +1,6 @@ import icon_bluetooth from '../assets/icon_bluetooth.svg'; import icon_arr_d from '../assets/icon_arr_down.svg'; +import power_icon from '../assets/power.svg'; import './CustomNavBar.scss'; import { useState } from 'react'; import { useAppSelector } from '../utils/hooks'; @@ -26,22 +27,28 @@ export default function CustomNavBar({ title }: { title: string }) {

{title}

{/** 蓝牙连接状态 */} {device.connected ? ( -
setShowDetail(!showDetail)} - > -
{device.power}%
- icon - 设备已连接 - arr -
+
setShowDetail(!showDetail)} + > + icon + 设备已连接 + arr +
+
20 ? '#3e63cb' : 'red' }}>
+
20 ? '#3e63cb' : 'red' }}>
+ {device.power} + {device.flag === 1 && } +
+ +
) : (
r.id === railId[0])?.name || ''; diff --git a/src/services/mobileWsType.ts b/src/services/mobileWsType.ts index 2ea89cb..aa90ec7 100644 --- a/src/services/mobileWsType.ts +++ b/src/services/mobileWsType.ts @@ -1,6 +1,7 @@ export type PeripheralStatus = { type: 'peripheral-status'; data: { + flag:0 | 1; connected: boolean; power: number; inclinatorX: number; diff --git a/src/store/features/contextSlice.ts b/src/store/features/contextSlice.ts index c6c4622..372ab35 100644 --- a/src/store/features/contextSlice.ts +++ b/src/store/features/contextSlice.ts @@ -33,6 +33,7 @@ if (orgGwdXmStr) { const initialState: ContextState = { device: { + flag: 0, connected: true, //是否已连接蓝牙 power: 60, //电量 inclinatorX: 0.276, //x轴倾斜