@ledvance/ui-biz-bundle 1.1.7 → 1.1.9

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.1.7",
7
+ "version": "1.1.9",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -1,7 +1,7 @@
1
1
  import { useDps } from "@ledvance/base/src/models/modules/NativePropsSlice";
2
2
  import { FlagPageProps } from "./FlagPage";
3
3
  import { SceneNodeTransitionMode } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneInfo";
4
- import { WORK_MODE, parseJSON } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
4
+ import { WORK_MODE, nToHS, parseJSON, toFixed } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
5
5
  import { cloneDeep } from "lodash";
6
6
  import { FlagItemInfo, FlagUiInfo, defFlagList } from "./FlagInfo";
7
7
  import { hex2Int } from "@ledvance/base/src/utils/common";
@@ -10,6 +10,7 @@ import { useMemo, useState } from "react";
10
10
  import { useUpdateEffect } from "ahooks";
11
11
  import { NativeApi } from "@ledvance/base/src/api/native";
12
12
  import { hsv2Hex } from "@ledvance/base/src/utils";
13
+ import { stripDp2Obj } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneAction";
13
14
 
14
15
  export interface ExtraParams extends FlagPageProps, FlagOption {
15
16
  }
@@ -55,24 +56,21 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
55
56
  return setDps({ [flagCode]: hex })
56
57
  } else {
57
58
  const hex = obj2Dp(flagItem, extra)
58
- return setDps({ [flagCode]: hex, [extra.workModeCode]: WORK_MODE.SCENE })
59
+ return setDps({ [flagCode]: hex, [extra.workModeCode]: WORK_MODE.SCENE, [extra.switchLedCode]: true })
59
60
  }
60
61
  }
61
62
  return [flagState, setFlagFn]
62
63
  }
63
64
 
64
65
  export interface FlagOption {
65
- isFan?: boolean
66
- isUVCFan?: boolean
67
66
  isMixLight?: boolean
67
+ isStringLight?: boolean
68
68
  workModeCode: string
69
69
  }
70
70
 
71
71
  export function obj2Dp(flagItem: FlagItemInfo, option?: FlagOption): string {
72
- let fanEnableHex = ''
73
- let fanSpeedHex = ''
74
72
  const version = '00'
75
- const idHex = flagItem.id.toString(16).padStart(2, '0')
73
+ const idHex = nToHS(flagItem.id)
76
74
  if (option?.isMixLight) {
77
75
  const whiteEnable = '01'
78
76
  const whiteNum = '01'
@@ -80,34 +78,58 @@ export function obj2Dp(flagItem: FlagItemInfo, option?: FlagOption): string {
80
78
  const whiteHex = whiteEnable + whiteNum + whiteStatus + flagItem.whiteColors.map(colors => {
81
79
  const speed = '00'
82
80
  const mode = '00'
83
- const bHex = (colors.brightness * 10).toString(16).padStart(4, '0')
84
- const tHex = (colors.colorTemp * 10).toString(16).padStart(4, '0')
81
+ const bHex = nToHS(colors.brightness * 10, 4)
82
+ const tHex = nToHS(colors.colorTemp * 10, 4)
85
83
  return speed + speed + mode + bHex + tHex
86
84
  }).join('')
87
85
  const colorEnable = '01'
88
- const colorNum = flagItem.colors.length.toString(16).padStart(2, '0')
86
+ const colorNum = nToHS(flagItem.colors.length)
89
87
  const colorStatus = '03'
90
88
  const colorHex = colorEnable + colorNum + colorStatus + flagItem.colors.map(item => {
91
- const speed = flagItem.speed.toString(16).padStart(2, '0')
92
- const mode = flagItem.mode.toString(16).padStart(2, '0')
93
- const hHex = item.h.toString(16).padStart(4, '0')
94
- const sHex = (item.s * 10).toString(16).padStart(4, '0')
95
- const vHex = (item.v * 10).toString(16).padStart(4, '0')
89
+ const speed = nToHS(flagItem.speed)
90
+ const mode = nToHS(flagItem.mode)
91
+ const hHex = nToHS(item.h, 4)
92
+ const sHex = nToHS(item.s * 10, 4)
93
+ const vHex = nToHS(item.v * 10, 4)
96
94
  return speed + speed + mode + hHex + sHex + vHex
97
95
  }).join('')
98
96
  return version + idHex + whiteHex + colorHex
97
+ } else if (option?.isStringLight) {
98
+ const version = '00'
99
+ const idHex = nToHS(flagItem.id)
100
+ const expand = 0
101
+ const reserved1 = 0
102
+ const reserved2 = 0
103
+ const loop = 0
104
+ const excessive = 0
105
+ const direction = 0
106
+ const segmented = 0
107
+ const modeHex = nToHS(10)
108
+ const intervalTimeHex = nToHS(flagItem.speed)
109
+ const changeTimeHex = nToHS(flagItem.speed)
110
+ const optionAHex = nToHS(
111
+ parseInt(
112
+ `${segmented}${loop}${excessive}${direction}${toFixed(
113
+ expand.toString(2),
114
+ 2
115
+ )}${reserved1}${reserved2}`,
116
+ 2
117
+ )
118
+ );
119
+ const optionBHex = nToHS(0)
120
+ const optionCHex = nToHS(0)
121
+ const nodeHex = flagItem.colors.map(node => {
122
+ return `${nToHS(node.v)}${nToHS(node.h, 4)}${nToHS(node.s)}${nToHS(0, 4)}${nToHS(0, 4)}`
123
+ }).join('')
124
+ return version + idHex + modeHex + intervalTimeHex + changeTimeHex + optionAHex + optionBHex + optionCHex + nodeHex
99
125
  } else {
100
- if (option?.isFan) {
101
- fanEnableHex = (flagItem.fanEnable ? 1 : 0).toString(16).padStart(2, '0')
102
- fanSpeedHex = (flagItem.fanSpeed || 1).toString(16).padStart(2, '0')
103
- }
104
- const switchingIntervalHex = (option?.isUVCFan ? 101 - flagItem.speed : flagItem.speed).toString(16).padStart(2, '0')
105
- const transitionTimeHex = (option?.isUVCFan ? 101 - flagItem.speed : flagItem.speed).toString(16).padStart(2, '0')
106
- const transitionModeHex = flagItem.mode.toString(16).padStart(2, '0')
107
- const hex = idHex + fanEnableHex + fanSpeedHex + flagItem.colors.map(color => {
108
- const hHex = Math.round(color.h).toString(16).padStart(4, '0')
109
- const sHex = Math.round(color.s * 10).toString(16).padStart(4, '0')
110
- const vHex = Math.round(color.v * 10).toString(16).padStart(4, '0')
126
+ const switchingIntervalHex = nToHS(flagItem.speed)
127
+ const transitionTimeHex = nToHS(flagItem.speed)
128
+ const transitionModeHex = nToHS(flagItem.mode)
129
+ const hex = idHex + flagItem.colors.map(color => {
130
+ const hHex = nToHS(Math.round(color.h), 4)
131
+ const sHex = nToHS(Math.round(color.s * 10), 4)
132
+ const vHex = nToHS(Math.round(color.v * 10), 4)
111
133
  const brightnessHex = '0000'
112
134
  const colorTempHex = '0000'
113
135
  return switchingIntervalHex + transitionTimeHex + transitionModeHex + hHex + sHex + vHex + brightnessHex + colorTempHex
@@ -137,20 +159,27 @@ export function dp2Obj(dp: string, option?: FlagOption): FlagItemInfo | undefine
137
159
  }
138
160
  })
139
161
  return result
162
+ } else if (option?.isStringLight) {
163
+ const { speed, mode, id, nodes } = stripDp2Obj(dp, true)
164
+ const colors = nodes.map(node => ({
165
+ ...node,
166
+ s: node.s / 10,
167
+ v: node.v / 10
168
+ }))
169
+ return {
170
+ id,
171
+ mode,
172
+ speed,
173
+ whiteColors: [{ brightness: 100, colorTemp: 0 }],
174
+ colors
175
+ }
140
176
  } else {
141
177
  const id = hex2Int(dp.slice(0, 2))
142
- let fanEnable: any = undefined
143
- let fanSpeed: any = undefined
144
- if (option?.isFan) {
145
- fanEnable = hex2Int(dp.slice(2, 4)) === 1
146
- fanSpeed = hex2Int(dp.slice(4, 6))
147
- }
148
- const c = option?.isFan ? 6 : 2
149
- const sliceDp = dp.slice(c)
178
+ const sliceDp = dp.slice(2)
150
179
  let mode = SceneNodeTransitionMode.Jump
151
180
  let speed = 70
152
181
  const colors = spliceByStep(sliceDp, 26).map(nodeHex => {
153
- speed = option?.isUVCFan ? 101 - hex2Int(nodeHex.slice(0, 2)) : hex2Int(nodeHex.slice(0, 2))
182
+ speed = hex2Int(nodeHex.slice(0, 2))
154
183
  mode = hex2Int(nodeHex.slice(4, 6))
155
184
  const h = hex2Int(nodeHex.slice(6, 10))
156
185
  const s = hex2Int(nodeHex.slice(10, 14))
@@ -166,8 +195,6 @@ export function dp2Obj(dp: string, option?: FlagOption): FlagItemInfo | undefine
166
195
  id,
167
196
  mode,
168
197
  speed,
169
- fanEnable,
170
- fanSpeed,
171
198
  colors,
172
199
  whiteColors
173
200
  }
@@ -72,6 +72,7 @@ const FlagEditPage = () => {
72
72
  <Page
73
73
  backText={I18n.getLang('mesh_device_detail_mode')}
74
74
  showBackDialog={true}
75
+ loading={state.loading}
75
76
  backDialogTitle={
76
77
  I18n.getLang(params.mode === 'add' ?
77
78
  'flag_canceladding' :
@@ -87,7 +88,6 @@ const FlagEditPage = () => {
87
88
  if (state.loading) return
88
89
  state.loading = true
89
90
  const res = await params.modDeleteFlag(params.mode, state.mood)
90
- console.log(res, '< --- resss')
91
91
  if (res.success) {
92
92
  state.loading = false
93
93
  navigation.goBack()
@@ -39,7 +39,7 @@ export const defFlagList: FlagUiInfo[] = [
39
39
  ],
40
40
  colors: [
41
41
  {h: 48, s: 100, v: 100},
42
- {h: 360, s: 100, v: 86},
42
+ {h: 360, s: 100, v: 100},
43
43
  {h: 0, s: 0, v:0}],
44
44
  },
45
45
  {
@@ -51,7 +51,7 @@ export const defFlagList: FlagUiInfo[] = [
51
51
  whiteColors: [
52
52
  { brightness: 100, colorTemp: 0},
53
53
  ],
54
- colors: [{h: 350, s: 92, v: 78}, {h: 48, s: 100, v: 100}, {h: 25, s: 15, v: 17}]
54
+ colors: [{h: 360, s: 100, v: 100}, {h: 48, s: 100, v: 100}, {h: 0, s: 0, v: 0}]
55
55
  },
56
56
  {
57
57
  id: 253,
@@ -62,7 +62,7 @@ export const defFlagList: FlagUiInfo[] = [
62
62
  whiteColors: [
63
63
  { brightness: 100, colorTemp: 0},
64
64
  ],
65
- colors: [{h: 355, s: 82, v: 92}, {h: 0, s: 0, v: 100}, {h: 212, s: 100, v: 32}]
65
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}, {h: 212, s: 100, v: 100}]
66
66
  },
67
67
  {
68
68
  id: 252,
@@ -73,7 +73,7 @@ export const defFlagList: FlagUiInfo[] = [
73
73
  whiteColors: [
74
74
  { brightness: 100, colorTemp: 0},
75
75
  ],
76
- colors: [{h: 4, s: 87, v: 85}, {h: 4, s: 87, v: 85}, {h: 150, s: 96, v: 41}]
76
+ colors: [{h: 360, s: 100, v: 100}, {h: 360, s: 100, v: 100}, {h: 150, s: 96, v: 100}]
77
77
  },
78
78
  {
79
79
  id: 251,
@@ -84,7 +84,7 @@ export const defFlagList: FlagUiInfo[] = [
84
84
  whiteColors: [
85
85
  { brightness: 100, colorTemp: 0},
86
86
  ],
87
- colors: [{h: 209, s: 100, v: 72}, {h: 0, s: 0, v: 100}, {h: 209, s: 100, v: 72}]
87
+ colors: [{h: 209, s: 100, v: 100}, {h: 0, s: 0, v: 100}, {h: 209, s: 100, v: 100}]
88
88
  },
89
89
  {
90
90
  id: 250,
@@ -95,7 +95,7 @@ export const defFlagList: FlagUiInfo[] = [
95
95
  whiteColors: [
96
96
  { brightness: 100, colorTemp: 0},
97
97
  ],
98
- colors: [{h: 357, s: 87, v: 66}, {h: 47, s: 100, v: 94}, {h: 357, s: 87, v: 66}]
98
+ colors: [{h: 357, s: 87, v: 100}, {h: 47, s: 100, v: 100}, {h: 357, s: 87, v: 100}]
99
99
  },
100
100
  {
101
101
  id: 249,
@@ -106,7 +106,7 @@ export const defFlagList: FlagUiInfo[] = [
106
106
  whiteColors: [
107
107
  { brightness: 100, colorTemp: 0},
108
108
  ],
109
- colors: [{h: 350, s: 92, v: 78}, {h: 350, s: 92, v: 78}, {h: 0, s: 0, v: 100}]
109
+ colors: [{h: 360, s: 100, v: 100}, {h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}]
110
110
  },
111
111
  {
112
112
  id: 248,
@@ -117,7 +117,7 @@ export const defFlagList: FlagUiInfo[] = [
117
117
  whiteColors: [
118
118
  { brightness: 100, colorTemp: 0},
119
119
  ],
120
- colors: [{h: 355, s: 78, v: 93}, {h: 0, s: 0, v: 100}, {h: 355, s: 78, v: 93}]
120
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}, {h: 360, s: 100, v: 100}]
121
121
  },
122
122
  {
123
123
  id: 247,
@@ -128,7 +128,7 @@ export const defFlagList: FlagUiInfo[] = [
128
128
  whiteColors: [
129
129
  { brightness: 100, colorTemp: 0},
130
130
  ],
131
- colors: [{h: 0, s: 0, v: 100}, {h: 353, s: 91, v: 80}, {h: 0, s: 0, v: 100}]
131
+ colors: [{h: 0, s: 0, v: 100}, {h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}]
132
132
  },
133
133
  {
134
134
  id: 246,
@@ -139,7 +139,7 @@ export const defFlagList: FlagUiInfo[] = [
139
139
  whiteColors: [
140
140
  { brightness: 100, colorTemp: 0},
141
141
  ],
142
- colors: [{h: 133, s: 36, v: 43}, {h: 0, s: 0, v: 100}, {h: 354, s: 80, v: 80}]
142
+ colors: [{h: 133, s: 36, v: 100}, {h: 0, s: 0, v: 100}, {h: 360, s: 100, v: 100}]
143
143
  },
144
144
  {
145
145
  id: 245,
@@ -150,7 +150,7 @@ export const defFlagList: FlagUiInfo[] = [
150
150
  whiteColors: [
151
151
  { brightness: 100, colorTemp: 0},
152
152
  ],
153
- colors: [{h: 357, s: 88, v: 93}, {h: 213, s: 93, v: 63}, {h: 0, s: 0, v: 100}]
153
+ colors: [{h: 360, s: 100, v: 100}, {h: 213, s: 93, v: 100}, {h: 0, s: 0, v: 100}]
154
154
  },
155
155
  {
156
156
  id: 244,
@@ -161,7 +161,7 @@ export const defFlagList: FlagUiInfo[] = [
161
161
  whiteColors: [
162
162
  { brightness: 100, colorTemp: 0},
163
163
  ],
164
- colors: [{h: 4, s: 87, v: 85}, {h: 0, s: 0, v:0}, {h: 4, s: 87, v: 85}]
164
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v:0}, {h: 360, s: 100, v: 100}]
165
165
  },
166
166
  {
167
167
  id: 243,
@@ -172,7 +172,7 @@ export const defFlagList: FlagUiInfo[] = [
172
172
  whiteColors: [
173
173
  { brightness: 100, colorTemp: 0},
174
174
  ],
175
- colors: [{h: 350, s: 92, v: 78}, {h: 0, s: 0, v:0}, {h: 350, s: 92, v: 78}]
175
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v:0}, {h: 360, s: 100, v: 100}]
176
176
  },
177
177
  {
178
178
  id: 242,
@@ -183,7 +183,7 @@ export const defFlagList: FlagUiInfo[] = [
183
183
  whiteColors: [
184
184
  { brightness: 100, colorTemp: 0},
185
185
  ],
186
- colors: [{h: 217, s: 100, v: 64}, {h: 0, s: 0, v:0}, {h: 350, s: 92, v: 78}]
186
+ colors: [{h: 217, s: 100, v: 100}, {h: 0, s: 0, v:0}, {h: 360, s: 100, v: 100}]
187
187
  },
188
188
  {
189
189
  id: 241,
@@ -194,7 +194,7 @@ export const defFlagList: FlagUiInfo[] = [
194
194
  whiteColors: [
195
195
  { brightness: 100, colorTemp: 0},
196
196
  ],
197
- colors: [{h: 353, s: 91, v: 80}, {h: 48, s: 91, v: 98}, {h: 219, s: 100, v: 49}]
197
+ colors: [{h: 360, s: 100, v: 100}, {h: 48, s: 91, v: 100}, {h: 219, s: 100, v: 100}]
198
198
  },
199
199
  {
200
200
  id: 240,
@@ -205,7 +205,7 @@ export const defFlagList: FlagUiInfo[] = [
205
205
  whiteColors: [
206
206
  { brightness: 100, colorTemp: 0},
207
207
  ],
208
- colors: [{h: 4, s: 87, v: 85}, {h: 0, s: 0, v: 100}, {h: 4, s: 87, v: 85}]
208
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}, {h: 360, s: 100, v: 100}]
209
209
  },
210
210
  {
211
211
  id: 239,
@@ -216,7 +216,7 @@ export const defFlagList: FlagUiInfo[] = [
216
216
  whiteColors: [
217
217
  { brightness: 100, colorTemp: 0},
218
218
  ],
219
- colors: [{h: 0, s: 0, v: 100}, {h: 210, s: 89, v: 46}, {h: 357, s: 72, v: 77}]
219
+ colors: [{h: 0, s: 0, v: 100}, {h: 210, s: 89, v: 100}, {h: 360, s: 100, v: 100}]
220
220
  },
221
221
  {
222
222
  id: 238,
@@ -227,7 +227,7 @@ export const defFlagList: FlagUiInfo[] = [
227
227
  whiteColors: [
228
228
  { brightness: 100, colorTemp: 0},
229
229
  ],
230
- colors: [{h: 366, s: 83, v: 80}, {h: 212, s: 4, v: 100}, {h: 149, s: 100, v: 54}]
230
+ colors: [{h: 360, s: 100, v: 100}, {h: 212, s: 4, v: 100}, {h: 149, s: 100, v: 100}]
231
231
  },
232
232
  {
233
233
  id: 237,
@@ -238,7 +238,7 @@ export const defFlagList: FlagUiInfo[] = [
238
238
  whiteColors: [
239
239
  { brightness: 100, colorTemp: 0},
240
240
  ],
241
- colors: [{h: 358, s: 90, v: 84}, {h: 0, s: 0, v: 100}, {h: 211, s: 86, v: 49}]
241
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}, {h: 211, s: 86, v: 100}]
242
242
  },
243
243
  {
244
244
  id: 236,
@@ -249,7 +249,7 @@ export const defFlagList: FlagUiInfo[] = [
249
249
  whiteColors: [
250
250
  { brightness: 100, colorTemp: 0},
251
251
  ],
252
- colors: [{h: 360, s: 100, v: 100}, {h: 217, s: 100, v: 64}, {h: 0, s: 0, v: 100}]
252
+ colors: [{h: 360, s: 100, v: 100}, {h: 217, s: 100, v: 100}, {h: 0, s: 0, v: 100}]
253
253
  },
254
254
  {
255
255
  id: 235,
@@ -260,7 +260,7 @@ export const defFlagList: FlagUiInfo[] = [
260
260
  whiteColors: [
261
261
  { brightness: 100, colorTemp: 0},
262
262
  ],
263
- colors: [{h: 0, s: 0, v: 100}, {h: 220, s: 89, v: 54}, {h: 2, s: 89, v: 90}]
263
+ colors: [{h: 0, s: 0, v: 100}, {h: 220, s: 89, v: 100}, {h: 360, s: 100, v: 100}]
264
264
  },
265
265
  {
266
266
  id: 234,
@@ -271,7 +271,7 @@ export const defFlagList: FlagUiInfo[] = [
271
271
  whiteColors: [
272
272
  { brightness: 100, colorTemp: 0},
273
273
  ],
274
- colors: [{h: 201, s: 100, v: 65}, {h: 48, s: 99, v: 99}, {h: 201, s: 100, v: 65}]
274
+ colors: [{h: 201, s: 100, v: 100}, {h: 48, s: 99, v: 100}, {h: 201, s: 100, v: 100}]
275
275
  },
276
276
  {
277
277
  id: 233,
@@ -282,7 +282,7 @@ export const defFlagList: FlagUiInfo[] = [
282
282
  whiteColors: [
283
283
  { brightness: 100, colorTemp: 0},
284
284
  ],
285
- colors: [{h: 0, s: 0, v: 100}, {h: 218, s: 100, v: 35}, {h: 347, s: 93, v: 72}]
285
+ colors: [{h: 0, s: 0, v: 100}, {h: 218, s: 100, v: 100}, {h: 360, s: 100, v: 100}]
286
286
  },
287
287
  {
288
288
  id: 232,
@@ -293,6 +293,17 @@ export const defFlagList: FlagUiInfo[] = [
293
293
  whiteColors: [
294
294
  { brightness: 100, colorTemp: 0},
295
295
  ],
296
- colors: [{h: 348, s: 90, v: 86}, {h: 0, s: 0, v: 100}]
296
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}]
297
+ },
298
+ {
299
+ id: 231,
300
+ version: 0,
301
+ mode: SceneNodeTransitionMode.Jump,
302
+ speed: 70,
303
+ name: I18n.getLang('flag_leverkusen'),
304
+ whiteColors: [
305
+ { brightness: 100, colorTemp: 0},
306
+ ],
307
+ colors: [{h: 360, s: 100, v: 100}, {h: 0, s: 0, v: 100}, {h: 60, s: 100, v: 100}]
297
308
  },
298
309
  ]
@@ -24,8 +24,7 @@ export interface FlagPageProps {
24
24
  isSupportColor?: boolean
25
25
  isSupportBrightness?: boolean
26
26
  isSupportTemperature?: boolean
27
- isSupportFan?: boolean
28
- isSupportUVCFan?: boolean
27
+ isStringLight?: boolean
29
28
  isSupportMixScene?: boolean
30
29
  drawToolLight?: {
31
30
  drawToolCode: string
@@ -35,7 +34,7 @@ export interface FlagPageProps {
35
34
  getRemoteMoodList?: (devId: string) => Promise<Result<any>>
36
35
  sceneDataCode?: string
37
36
  workModeCode: string
38
- switchLed?: string
37
+ switchLedCode: string
39
38
  }
40
39
 
41
40
  const FlagPage = () => {
@@ -45,9 +44,8 @@ const FlagPage = () => {
45
44
  const navigation = useNavigation()
46
45
  const [, setDps] = useDps()
47
46
  const [flagState, setFlag] = useFlag((params.sceneDataCode || params?.drawToolLight?.drawToolCode)!!, {
48
- isFan: params.isSupportFan,
49
- isUVCFan: params.isSupportUVCFan,
50
47
  isMixLight: params.isSupportMixScene,
48
+ isStringLight: params.isStringLight,
51
49
  ...params
52
50
  })
53
51
  const state = useReactive({
@@ -84,7 +82,14 @@ const FlagPage = () => {
84
82
  const getRemoteFlagInfo = async () => {
85
83
  const res = await getRemoteFlag(devId)
86
84
  if (res.success) {
87
- state.flags = cloneDeep(res.data) || []
85
+ let cloneFlag: FlagUiInfo[] = cloneDeep(res.data) || []
86
+ if(params.drawToolLight){
87
+ cloneFlag = cloneFlag.map(flag => {
88
+ flag.colors = flag.colors.reverse()
89
+ return flag
90
+ })
91
+ }
92
+ state.flags = cloneFlag
88
93
  }
89
94
  }
90
95
 
@@ -124,6 +129,11 @@ const FlagPage = () => {
124
129
  const res = await saveFlag(devId, cloneDeep(newScene))
125
130
  if (res.success) {
126
131
  state.flags = cloneDeep(newScene)
132
+ if(mode === 'del' && currentMood.id !== flagState.id){
133
+ return {
134
+ success: true
135
+ }
136
+ }
127
137
  if(mood){
128
138
  setFlag(mood)
129
139
  }else{