@ledvance/ui-biz-bundle 1.0.21 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.21",
7
+ "version": "1.0.23",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -25,11 +25,12 @@ type UseBiorhythmType = (dpKey: string) => [BiorhythmBean, SetBiorhythmType];
25
25
  type SetBiorhythmType = (deviceId: string, biorhythmObj: BiorhythmBean) => Promise<Result<any>>;
26
26
 
27
27
  export const useBiorhythm: UseBiorhythmType = (dpKey: string) => {
28
- const [dp] = useDp<string, any>(dpKey) ||
29
- '0000007f0501060000000000000001061e00000000141901090000000000646401140000000000503201171e000000000000'
28
+ const [dp] = useDp<string, any>(dpKey)
30
29
  const deviceId = useDeviceId()
31
30
  const [biorhythmState, setBiorhythmState] = useState(dp2Obj(dp))
31
+ console.log('生物节律', dpKey, biorhythmState)
32
32
  useEffect(() => {
33
+ console.log('生物节律2', biorhythmState)
33
34
  getRemoteBiorhythm(deviceId, biorhythmState).then(res => {
34
35
  if (res.success && res.data) {
35
36
  setBiorhythmState(dto2Vo(res.data))
@@ -83,6 +84,9 @@ export const userOperation = async (deviceId: string, value: boolean) => {
83
84
  }
84
85
 
85
86
  export function dp2Obj(dp: string): BiorhythmBean {
87
+ if (!dp || dp === '0000000000') {
88
+ return dp2Obj('0000007f0501060000000000000001061e00000000141901090000000000646401140000000000503201171e000000000000')
89
+ }
86
90
  let dpCopy = dp
87
91
  // 版本
88
92
  hex2Int(dpCopy.slice(0, 2))
@@ -114,7 +118,7 @@ export function dp2Obj(dp: string): BiorhythmBean {
114
118
  hex2Int(dpCopy.slice(0, 2))
115
119
  dpCopy = dpCopy.slice(2)
116
120
  // 节点列表
117
- const planList: Plan[] = spliceByStep(dpCopy, 18).map((planHex, index) => {
121
+ const planList: Plan[] = dpCopy === '00' ? [] : spliceByStep(dpCopy, 18).map((planHex, index) => {
118
122
  let hex = planHex
119
123
  // 节点开关
120
124
  const enable = hex2Int(hex.slice(0, 2)) === 1