@ledvance/ui-biz-bundle 1.1.58 → 1.1.61
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 +1 -1
- package/src/modules/flags/FlagEditPage.tsx +22 -14
- package/src/modules/flags/FlagInfo.tsx +5 -5
- package/src/modules/flags/FlagPage.tsx +7 -18
- package/src/modules/mood/DynamicMoodEditorPage.tsx +12 -14
- package/src/modules/mood/FantasyMoodEditPage.tsx +12 -14
- package/src/modules/mood/StaticMoodEditorPage.tsx +12 -13
- package/src/modules/timer/TimerPage.tsx +58 -56
- package/src/newModules/biorhythm/BiorhythmActions.ts +374 -0
- package/src/newModules/biorhythm/BiorhythmBean.ts +230 -0
- package/src/newModules/biorhythm/BiorhythmEditPage.tsx +267 -0
- package/src/newModules/biorhythm/BiorhythmPage.tsx +638 -0
- package/src/newModules/biorhythm/IconSelect.tsx +85 -0
- package/src/newModules/biorhythm/Router.ts +34 -0
- package/src/newModules/biorhythm/circular/ItemIcon.d.ts +22 -0
- package/src/newModules/biorhythm/circular/ItemIcon.tsx +173 -0
- package/src/newModules/biorhythm/circular/Progress.d.ts +24 -0
- package/src/newModules/biorhythm/circular/Progress.tsx +372 -0
- package/src/newModules/biorhythm/circular/TimeCircular.d.ts +11 -0
- package/src/newModules/biorhythm/circular/TimeCircular.tsx +64 -0
- package/src/newModules/biorhythm/circular/biorhythm_plantimer.png +0 -0
- package/src/newModules/biorhythm/circular/rhythm_icon.png +0 -0
- package/src/newModules/biorhythm/iconListData.ts +30 -0
- package/src/newModules/biorhythm/pIdList.ts +36 -0
- package/src/newModules/biorhythm/res/BiologicalRes.d.ts +43 -0
- package/src/newModules/biorhythm/res/BiologicalRes.ts +42 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm.png +0 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm_12.png +0 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm_new.png +0 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm_new_12.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@3x.png +0 -0
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +84 -83
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +133 -132
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +119 -117
- package/src/newModules/energyConsumption/component/Overview.tsx +38 -36
- package/src/newModules/mood/AddMoodPage.tsx +37 -21
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +7 -2
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +8 -2
- package/src/newModules/mood/StaticMoodEditorPage.tsx +9 -2
- package/src/newModules/timeSchedule/Interface.ts +1 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +203 -202
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +35 -34
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +11 -10
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +63 -60
|
@@ -23,6 +23,7 @@ import { NativeApi } from "@ledvance/base/src/api/native";
|
|
|
23
23
|
import { carbonDioxideEmission, countryAndRegion } from "./co2Data";
|
|
24
24
|
|
|
25
25
|
const { convertX: cx } = Utils.RatioUtils
|
|
26
|
+
const { withTheme } = Utils.ThemeUtils
|
|
26
27
|
|
|
27
28
|
export interface EnergyConsumptionPageProps {
|
|
28
29
|
electricDpCode: string
|
|
@@ -49,14 +50,14 @@ interface EnergyConsumptionState {
|
|
|
49
50
|
popupType: PopupType
|
|
50
51
|
co2Saved: string
|
|
51
52
|
}
|
|
52
|
-
const EnergyConsumptionPage = () => {
|
|
53
|
-
const
|
|
53
|
+
const EnergyConsumptionPage = (props: {theme?: any}) => {
|
|
54
|
+
const params = useRoute().params as EnergyConsumptionPageProps
|
|
54
55
|
const devId = useDeviceId()
|
|
55
56
|
const navigation = useNavigation()
|
|
56
57
|
const timeZoneCity = useTimeZoneCity()
|
|
57
|
-
const power = usePower(
|
|
58
|
-
const voltage = useVoltage(
|
|
59
|
-
const electric = useElectricCurrent(
|
|
58
|
+
const power = usePower(params.powerDpCode)
|
|
59
|
+
const voltage = useVoltage(params.voltageDpCode)
|
|
60
|
+
const electric = useElectricCurrent(params.electricDpCode)
|
|
60
61
|
const isSolarPlug = useEngergyGeneration()
|
|
61
62
|
const state = useReactive<EnergyConsumptionState>({
|
|
62
63
|
todayElectricity: '0',
|
|
@@ -86,7 +87,7 @@ const EnergyConsumptionPage = () => {
|
|
|
86
87
|
}, [state.totalElectricity, timeZoneCity])
|
|
87
88
|
|
|
88
89
|
const getElectricity = async () => {
|
|
89
|
-
const res = await getDpResultByMonth(devId,
|
|
90
|
+
const res = await getDpResultByMonth(devId, params.addEleDpCode, 'sum')
|
|
90
91
|
if (!isEmpty(res)) {
|
|
91
92
|
state.todayElectricity = res.thisDay
|
|
92
93
|
state.totalElectricity = res.sum
|
|
@@ -127,6 +128,99 @@ const EnergyConsumptionPage = () => {
|
|
|
127
128
|
state.unit = data.unit
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
const styles = StyleSheet.create({
|
|
132
|
+
showTip: {
|
|
133
|
+
marginHorizontal: cx(24)
|
|
134
|
+
},
|
|
135
|
+
cardContainer: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
marginHorizontal: cx(24),
|
|
138
|
+
padding: cx(16)
|
|
139
|
+
},
|
|
140
|
+
cardTitle: {
|
|
141
|
+
color: props.theme.global.fontColor,
|
|
142
|
+
fontSize: cx(16),
|
|
143
|
+
fontWeight: 'bold'
|
|
144
|
+
},
|
|
145
|
+
consumedEnergyContent: {
|
|
146
|
+
flex: 1,
|
|
147
|
+
flexDirection: 'row',
|
|
148
|
+
},
|
|
149
|
+
consumptionNum: {
|
|
150
|
+
color: props.theme.global.secondBrand,
|
|
151
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
152
|
+
},
|
|
153
|
+
subContent: {
|
|
154
|
+
flex: 1,
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
marginBottom: cx(9)
|
|
157
|
+
},
|
|
158
|
+
valueText: {
|
|
159
|
+
fontSize: cx(24),
|
|
160
|
+
fontWeight: 'bold',
|
|
161
|
+
color: props.theme.global.secondBrand,
|
|
162
|
+
},
|
|
163
|
+
titleText: {
|
|
164
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
165
|
+
fontSize: cx(14),
|
|
166
|
+
color: props.theme.global.secondFontColor,
|
|
167
|
+
textAlign: 'center',
|
|
168
|
+
},
|
|
169
|
+
priceBg: {
|
|
170
|
+
height: cx(40),
|
|
171
|
+
width: cx(40),
|
|
172
|
+
borderRadius: cx(40),
|
|
173
|
+
backgroundColor: props.theme.global.thirdBrand,
|
|
174
|
+
justifyContent: 'center',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
marginRight: cx(10)
|
|
177
|
+
},
|
|
178
|
+
priceNum: {
|
|
179
|
+
marginRight: cx(10)
|
|
180
|
+
},
|
|
181
|
+
priceButton: {
|
|
182
|
+
borderRadius: cx(5),
|
|
183
|
+
paddingHorizontal: cx(10),
|
|
184
|
+
paddingVertical: cx(8),
|
|
185
|
+
marginTop: cx(8),
|
|
186
|
+
backgroundColor: props.theme.button.active,
|
|
187
|
+
alignItems: 'center',
|
|
188
|
+
justifyContent: 'center'
|
|
189
|
+
},
|
|
190
|
+
unitItem: {
|
|
191
|
+
flexDirection: 'row',
|
|
192
|
+
justifyContent: 'space-between',
|
|
193
|
+
paddingHorizontal: cx(10),
|
|
194
|
+
alignItems: 'center',
|
|
195
|
+
height: cx(40),
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
const unitDivision = (str) => {
|
|
202
|
+
if (!str) { return ['', ''] }
|
|
203
|
+
const strIndex = str.indexOf('(' || '(')
|
|
204
|
+
const unit = str.substring(strIndex)
|
|
205
|
+
const name = str.split(unit)[0]
|
|
206
|
+
return [name, unit]
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const ConsumedEnergyItem = (props: { value: number, unit: string }) => {
|
|
210
|
+
return (
|
|
211
|
+
<View style={styles.subContent}>
|
|
212
|
+
<Text style={styles.valueText}>{(props.value) || 0}</Text>
|
|
213
|
+
<Spacer height={cx(4)} />
|
|
214
|
+
<Text style={styles.titleText}>
|
|
215
|
+
{unitDivision(props.unit)[0]}
|
|
216
|
+
</Text>
|
|
217
|
+
<Text style={styles.titleText}>
|
|
218
|
+
{unitDivision(props.unit)[1]}
|
|
219
|
+
</Text>
|
|
220
|
+
</View>
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
130
224
|
return (
|
|
131
225
|
<Page
|
|
132
226
|
style={{ position: 'relative' }}
|
|
@@ -191,34 +285,34 @@ const EnergyConsumptionPage = () => {
|
|
|
191
285
|
<Spacer />
|
|
192
286
|
{/* CO2 */}
|
|
193
287
|
{isSolarPlug && <>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
288
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
289
|
+
<View style={styles.priceBg}>
|
|
290
|
+
<Image
|
|
291
|
+
source={res.energy_consumption_cash}
|
|
292
|
+
resizeMode="contain"
|
|
293
|
+
style={{ height: cx(20), width: cx(20), tintColor: props.theme.button.active }}
|
|
294
|
+
/>
|
|
295
|
+
</View>
|
|
296
|
+
<View style={styles.priceNum}>
|
|
297
|
+
<View style={{ flexDirection: 'row' }}>
|
|
298
|
+
<Text style={{ color: props.theme.global.secondFontColor, marginRight: cx(5) }}>{I18n.getLang('consumption_data_field3_co2_topic_text')}</Text>
|
|
299
|
+
<TouchableOpacity
|
|
300
|
+
onPress={() => {
|
|
301
|
+
state.showPopup = true
|
|
302
|
+
state.popupType = 'co2'
|
|
303
|
+
}}
|
|
304
|
+
>
|
|
305
|
+
<Image
|
|
306
|
+
source={res.co2Icon}
|
|
307
|
+
resizeMode="contain"
|
|
308
|
+
style={{ height: cx(20), width: cx(20), tintColor: props.theme.button.active }}
|
|
309
|
+
/>
|
|
310
|
+
</TouchableOpacity>
|
|
311
|
+
</View>
|
|
312
|
+
<Text style={{ color: props.theme.global.fontColor, fontWeight: 'bold' }}>{`${state.co2Saved} kg`}</Text>
|
|
313
|
+
</View>
|
|
219
314
|
</View>
|
|
220
|
-
|
|
221
|
-
<Spacer height={cx(10)} />
|
|
315
|
+
<Spacer height={cx(10)} />
|
|
222
316
|
</>}
|
|
223
317
|
{/* money */}
|
|
224
318
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
@@ -226,20 +320,20 @@ const EnergyConsumptionPage = () => {
|
|
|
226
320
|
<Image
|
|
227
321
|
source={res.energy_consumption_cash}
|
|
228
322
|
resizeMode="contain"
|
|
229
|
-
style={{ height: cx(20), width: cx(20), tintColor:
|
|
323
|
+
style={{ height: cx(20), width: cx(20), tintColor: props.theme.button.active }}
|
|
230
324
|
/>
|
|
231
325
|
</View>
|
|
232
326
|
<View>
|
|
233
327
|
<View style={styles.priceNum}>
|
|
234
|
-
<Text style={{ color:
|
|
235
|
-
<Text style={{ color:
|
|
328
|
+
<Text style={{ color: props.theme.global.secondFontColor }}>{I18n.getLang(isSolarPlug ? 'consumption_data_monthly_overview_field1_text2' : 'consumption_data_field3_value_text2')}</Text>
|
|
329
|
+
<Text style={{ color: props.theme.global.fontColor, fontWeight: 'bold' }}>{state.price ? `${localeNumber(Number(state.price ) * Number(state.totalElectricity), 2)} ${state.unit}` : '-'}</Text>
|
|
236
330
|
</View>
|
|
237
331
|
<TouchableOpacity onPress={() => {
|
|
238
332
|
state.showPopup = true
|
|
239
333
|
state.popupType = 'money'
|
|
240
334
|
}}>
|
|
241
335
|
<View style={styles.priceButton}>
|
|
242
|
-
<Text style={{ color:
|
|
336
|
+
<Text style={{ color: props.theme.button.fontColor }}>{I18n.getLang('consumption_data_field3_button_text')}</Text>
|
|
243
337
|
</View>
|
|
244
338
|
</TouchableOpacity>
|
|
245
339
|
</View>
|
|
@@ -258,7 +352,7 @@ const EnergyConsumptionPage = () => {
|
|
|
258
352
|
}}
|
|
259
353
|
overviewItemClick={(item) => {
|
|
260
354
|
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_detail, {
|
|
261
|
-
addEleDpCode:
|
|
355
|
+
addEleDpCode: params.addEleDpCode,
|
|
262
356
|
curMonth: item,
|
|
263
357
|
price: state.price,
|
|
264
358
|
unit: state.unit,
|
|
@@ -296,97 +390,4 @@ const EnergyConsumptionPage = () => {
|
|
|
296
390
|
)
|
|
297
391
|
}
|
|
298
392
|
|
|
299
|
-
|
|
300
|
-
showTip: {
|
|
301
|
-
marginHorizontal: cx(24)
|
|
302
|
-
},
|
|
303
|
-
cardContainer: {
|
|
304
|
-
flex: 1,
|
|
305
|
-
marginHorizontal: cx(24),
|
|
306
|
-
padding: cx(16)
|
|
307
|
-
},
|
|
308
|
-
cardTitle: {
|
|
309
|
-
color: '#000',
|
|
310
|
-
fontSize: cx(16),
|
|
311
|
-
fontWeight: 'bold'
|
|
312
|
-
},
|
|
313
|
-
consumedEnergyContent: {
|
|
314
|
-
flex: 1,
|
|
315
|
-
flexDirection: 'row',
|
|
316
|
-
},
|
|
317
|
-
consumptionNum: {
|
|
318
|
-
color: '#FF8555',
|
|
319
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
320
|
-
},
|
|
321
|
-
subContent: {
|
|
322
|
-
flex: 1,
|
|
323
|
-
alignItems: 'center',
|
|
324
|
-
marginBottom: cx(9)
|
|
325
|
-
},
|
|
326
|
-
valueText: {
|
|
327
|
-
fontSize: cx(24),
|
|
328
|
-
fontWeight: 'bold',
|
|
329
|
-
color: '#ff8555',
|
|
330
|
-
},
|
|
331
|
-
titleText: {
|
|
332
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
333
|
-
fontSize: cx(14),
|
|
334
|
-
color: '#666666',
|
|
335
|
-
textAlign: 'center',
|
|
336
|
-
},
|
|
337
|
-
priceBg: {
|
|
338
|
-
height: cx(40),
|
|
339
|
-
width: cx(40),
|
|
340
|
-
borderRadius: cx(40),
|
|
341
|
-
backgroundColor: '#FFE0D4',
|
|
342
|
-
justifyContent: 'center',
|
|
343
|
-
alignItems: 'center',
|
|
344
|
-
marginRight: cx(10)
|
|
345
|
-
},
|
|
346
|
-
priceNum: {
|
|
347
|
-
marginRight: cx(10)
|
|
348
|
-
},
|
|
349
|
-
priceButton: {
|
|
350
|
-
borderRadius: cx(5),
|
|
351
|
-
paddingHorizontal: cx(10),
|
|
352
|
-
paddingVertical: cx(8),
|
|
353
|
-
marginTop: cx(8),
|
|
354
|
-
backgroundColor: '#FF6600',
|
|
355
|
-
alignItems: 'center',
|
|
356
|
-
justifyContent: 'center'
|
|
357
|
-
},
|
|
358
|
-
unitItem: {
|
|
359
|
-
flexDirection: 'row',
|
|
360
|
-
justifyContent: 'space-between',
|
|
361
|
-
paddingHorizontal: cx(10),
|
|
362
|
-
alignItems: 'center',
|
|
363
|
-
height: cx(40),
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
})
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const unitDivision = (str) => {
|
|
370
|
-
if (!str) { return ['', ''] }
|
|
371
|
-
const strIndex = str.indexOf('(' || '(')
|
|
372
|
-
const unit = str.substring(strIndex)
|
|
373
|
-
const name = str.split(unit)[0]
|
|
374
|
-
return [name, unit]
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export const ConsumedEnergyItem = (props: { value: number, unit: string }) => {
|
|
378
|
-
return (
|
|
379
|
-
<View style={styles.subContent}>
|
|
380
|
-
<Text style={styles.valueText}>{(props.value) || 0}</Text>
|
|
381
|
-
<Spacer height={cx(4)} />
|
|
382
|
-
<Text style={styles.titleText}>
|
|
383
|
-
{unitDivision(props.unit)[0]}
|
|
384
|
-
</Text>
|
|
385
|
-
<Text style={styles.titleText}>
|
|
386
|
-
{unitDivision(props.unit)[1]}
|
|
387
|
-
</Text>
|
|
388
|
-
</View>
|
|
389
|
-
)
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
export default EnergyConsumptionPage
|
|
393
|
+
export default withTheme(EnergyConsumptionPage)
|
|
@@ -10,6 +10,7 @@ import { useReactive, useUpdateEffect } from "ahooks";
|
|
|
10
10
|
import { cloneDeep } from "lodash";
|
|
11
11
|
|
|
12
12
|
const { convertX: cx, height } = Utils.RatioUtils
|
|
13
|
+
const { withTheme } = Utils.ThemeUtils
|
|
13
14
|
|
|
14
15
|
export const UnitList = [
|
|
15
16
|
I18n.getLang('consumption_data_price_per_kwh_currency_value1'),
|
|
@@ -23,6 +24,7 @@ export interface EnergyData {
|
|
|
23
24
|
unit: string
|
|
24
25
|
}
|
|
25
26
|
interface EnergyModalProps {
|
|
27
|
+
theme?: any
|
|
26
28
|
visible: boolean
|
|
27
29
|
popupType: 'money' | 'co2' | 'unit'
|
|
28
30
|
title: string
|
|
@@ -49,14 +51,14 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
49
51
|
const text = string.split(separators)
|
|
50
52
|
const length = text.length - 1
|
|
51
53
|
return <View>
|
|
52
|
-
<Text style={{ color:
|
|
54
|
+
<Text style={{ color: props.theme.global.fontColor }}>{text[length - 6] + '.'}</Text>
|
|
53
55
|
<Spacer />
|
|
54
|
-
<Text style={{ color:
|
|
56
|
+
<Text style={{ color: props.theme.global.fontColor }}>{text[length - 5] + '.'}</Text>
|
|
55
57
|
<Spacer />
|
|
56
|
-
<Text style={{ color:
|
|
58
|
+
<Text style={{ color: props.theme.global.fontColor }}>{text[length - 4] + text[length - 3] + ':'}</Text>
|
|
57
59
|
<Spacer />
|
|
58
60
|
<Text
|
|
59
|
-
style={{ textDecorationLine: 'underline', color:
|
|
61
|
+
style={{ textDecorationLine: 'underline', color: props.theme.button.active }}
|
|
60
62
|
onPress={() => openLink(`${text[length - 2]}:${text[length - 1]}${text[length]}`)}
|
|
61
63
|
>
|
|
62
64
|
{`${text[length - 2]}:${text[length - 1]}${text[length]}`}
|
|
@@ -68,6 +70,48 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
68
70
|
state.energyData = cloneDeep(props.energyData)
|
|
69
71
|
}, [props.energyData])
|
|
70
72
|
|
|
73
|
+
const styles = StyleSheet.create({
|
|
74
|
+
popupTip: {
|
|
75
|
+
fontSize: cx(16),
|
|
76
|
+
color: props.theme.global.fontColor,
|
|
77
|
+
fontWeight: 'bold'
|
|
78
|
+
},
|
|
79
|
+
textInput: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
height: cx(44),
|
|
82
|
+
marginStart: cx(16),
|
|
83
|
+
marginEnd: cx(6),
|
|
84
|
+
fontSize: cx(16),
|
|
85
|
+
color: props.theme.textInput.fontColor,
|
|
86
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
87
|
+
},
|
|
88
|
+
textInputGroup: {
|
|
89
|
+
flexDirection: 'row',
|
|
90
|
+
borderRadius: cx(4),
|
|
91
|
+
backgroundColor: props.theme.textInput.background,
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
},
|
|
94
|
+
iconTouchable: {
|
|
95
|
+
marginEnd: cx(18),
|
|
96
|
+
padding: cx(4),
|
|
97
|
+
},
|
|
98
|
+
line: {
|
|
99
|
+
height: 1,
|
|
100
|
+
position: 'absolute',
|
|
101
|
+
start: cx(4),
|
|
102
|
+
end: cx(4),
|
|
103
|
+
bottom: 0,
|
|
104
|
+
backgroundColor: props.theme.textInput.line,
|
|
105
|
+
},
|
|
106
|
+
unitItem: {
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
justifyContent: 'space-between',
|
|
109
|
+
paddingHorizontal: cx(10),
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
height: cx(40),
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
})
|
|
71
115
|
|
|
72
116
|
const getContent = () => {
|
|
73
117
|
if (props.popupType === 'money') {
|
|
@@ -76,12 +120,12 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
76
120
|
<Spacer />
|
|
77
121
|
<Text style={styles.popupTip}>{I18n.getLang('consumption_data_price_per_kwh_headline_text')}</Text>
|
|
78
122
|
<Spacer height={cx(40)} />
|
|
79
|
-
<Text style={{ fontSize: cx(14), color:
|
|
123
|
+
<Text style={{ fontSize: cx(14), color: props.theme.global.fontColor }}>{I18n.getLang('consumption_data_price_per_kwh_description_text')}</Text>
|
|
80
124
|
<Spacer height={cx(15)} />
|
|
81
125
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
82
126
|
<View style={{ flex: 3 }}>
|
|
83
127
|
<Spacer height={cx(4)} />
|
|
84
|
-
<Text style={{ color:
|
|
128
|
+
<Text style={{ color: props.theme.global.secondFontColor, marginStart: cx(13), fontFamily: 'helvetica_neue_lt_std_bd' }}>{I18n.getLang('consumption_data_price_per_kwh_headline_text')}</Text>
|
|
85
129
|
<View style={styles.textInputGroup}>
|
|
86
130
|
<TextInput
|
|
87
131
|
value={state.energyData?.price}
|
|
@@ -125,16 +169,16 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
125
169
|
data={UnitList}
|
|
126
170
|
renderItem={({ item }) => (
|
|
127
171
|
<View style={styles.unitItem}>
|
|
128
|
-
<Text style={{ fontSize: cx(16), color:
|
|
172
|
+
<Text style={{ fontSize: cx(16), color: props.theme.global.fontColor }}>{item}</Text>
|
|
129
173
|
{props.energyData && props.energyData.unit === item && <Image
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
174
|
+
style={{ width: cx(16), height: cx(16) }}
|
|
175
|
+
source={res.app_music_check}
|
|
176
|
+
resizeMode="contain"
|
|
133
177
|
/>}
|
|
134
178
|
</View>
|
|
135
179
|
)}
|
|
136
180
|
ItemSeparatorComponent={() => (
|
|
137
|
-
<View style={{ flex: 1, height: 1, backgroundColor:
|
|
181
|
+
<View style={{ flex: 1, height: 1, backgroundColor: props.theme.card.background }}></View>
|
|
138
182
|
)}
|
|
139
183
|
keyExtractor={item => item}
|
|
140
184
|
/>
|
|
@@ -153,25 +197,83 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
153
197
|
}
|
|
154
198
|
|
|
155
199
|
}
|
|
200
|
+
|
|
201
|
+
const energyPopup = ({energyData, onItemClick}: {
|
|
202
|
+
energyData?: EnergyData,
|
|
203
|
+
onItemClick: (unit: string) => void
|
|
204
|
+
}) => {
|
|
205
|
+
return (
|
|
206
|
+
Popup.custom({
|
|
207
|
+
title: (
|
|
208
|
+
<View style={{ backgroundColor: props.theme.card.head, flexDirection: 'row', height: cx(60), justifyContent: 'space-between', alignItems: 'center', borderTopLeftRadius: cx(10), borderTopRightRadius: cx(10), paddingHorizontal: cx(8) }}>
|
|
209
|
+
<TouchableOpacity onPress={() => Popup.close()}>
|
|
210
|
+
<Text style={{ color: props.theme.global.secondBrand, fontSize: cx(16) }}>{I18n.getLang('auto_scan_system_cancel')}</Text>
|
|
211
|
+
</TouchableOpacity>
|
|
212
|
+
</View>
|
|
213
|
+
),
|
|
214
|
+
wrapperStyle: {
|
|
215
|
+
height: height - cx(40),
|
|
216
|
+
backgroundColor: props.theme.global.background
|
|
217
|
+
},
|
|
218
|
+
footer: (<View style={{ backgroundColor: props.theme.global.background}}></View>),
|
|
219
|
+
onMaskPress: () => { },
|
|
220
|
+
motionType: 'none',
|
|
221
|
+
useKeyboardView: true,
|
|
222
|
+
content: (
|
|
223
|
+
<View
|
|
224
|
+
style={{ backgroundColor: props.theme.global.background, paddingHorizontal: cx(16) }}>
|
|
225
|
+
<Spacer />
|
|
226
|
+
<Card>
|
|
227
|
+
<FlatList
|
|
228
|
+
data={UnitList}
|
|
229
|
+
renderItem={({ item }) => (
|
|
230
|
+
<TouchableOpacity
|
|
231
|
+
onPress={() => {
|
|
232
|
+
onItemClick(item)
|
|
233
|
+
Popup.close()
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
<View style={styles.unitItem}>
|
|
237
|
+
<Text style={{ fontSize: cx(16), color: props.theme.global.fontColor }}>{item}</Text>
|
|
238
|
+
{energyData && energyData.unit === item && <Image
|
|
239
|
+
style={{ width: cx(16), height: cx(16) }}
|
|
240
|
+
source={res.app_music_check}
|
|
241
|
+
resizeMode="contain"
|
|
242
|
+
/>}
|
|
243
|
+
</View>
|
|
244
|
+
</TouchableOpacity>
|
|
245
|
+
)}
|
|
246
|
+
ItemSeparatorComponent={() => (
|
|
247
|
+
<View style={{ flex: 1, height: 1, backgroundColor: props.theme.card.background }}></View>
|
|
248
|
+
)}
|
|
249
|
+
keyExtractor={item => item}
|
|
250
|
+
/>
|
|
251
|
+
</Card>
|
|
252
|
+
<Spacer />
|
|
253
|
+
</View>
|
|
254
|
+
)
|
|
255
|
+
})
|
|
256
|
+
)
|
|
257
|
+
}
|
|
156
258
|
return (
|
|
157
259
|
<Modal
|
|
158
260
|
visible={props.visible}
|
|
159
261
|
>
|
|
160
262
|
<ScrollView>
|
|
161
|
-
<View style={{ backgroundColor:
|
|
263
|
+
<View style={{ backgroundColor: props.theme.card.head, flexDirection: 'row', height: cx(60), justifyContent: 'space-between', alignItems: 'center', borderTopLeftRadius: cx(10), borderTopRightRadius: cx(10), paddingHorizontal: cx(8) }}>
|
|
162
264
|
<TouchableOpacity onPress={() => {
|
|
163
265
|
props.onCancel && props.onCancel()
|
|
164
266
|
}}>
|
|
165
|
-
<Text style={{ color:
|
|
267
|
+
<Text style={{ color: props.theme.global.brand, fontSize: cx(16) }}>{props.cancelText}</Text>
|
|
166
268
|
</TouchableOpacity>
|
|
167
|
-
<Text style={{ color:
|
|
269
|
+
<Text style={{ color: props.theme.global.fontColor, fontSize: cx(16), fontWeight: 'bold' }}>{props.title}</Text>
|
|
168
270
|
<TouchableOpacity onPress={() => {
|
|
169
271
|
props.onConfirm && props.onConfirm(state.energyData)
|
|
170
272
|
}}>
|
|
171
|
-
<Text style={{ color:
|
|
273
|
+
<Text style={{ color: props.theme.global.brand, fontSize: cx(16) }}>{props.confirmText}</Text>
|
|
172
274
|
</TouchableOpacity>
|
|
173
275
|
</View>
|
|
174
|
-
<View style={{ height: height - cx(100), paddingHorizontal: cx(16), backgroundColor:
|
|
276
|
+
<View style={{ height: height - cx(100), paddingHorizontal: cx(16), backgroundColor: props.theme.global.background }}>
|
|
175
277
|
{getContent()}
|
|
176
278
|
</View>
|
|
177
279
|
</ScrollView>
|
|
@@ -179,104 +281,4 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
179
281
|
)
|
|
180
282
|
}
|
|
181
283
|
|
|
182
|
-
|
|
183
|
-
popupTip: {
|
|
184
|
-
fontSize: cx(16),
|
|
185
|
-
color: '#000',
|
|
186
|
-
fontWeight: 'bold'
|
|
187
|
-
},
|
|
188
|
-
textInput: {
|
|
189
|
-
flex: 1,
|
|
190
|
-
height: cx(44),
|
|
191
|
-
marginStart: cx(16),
|
|
192
|
-
marginEnd: cx(6),
|
|
193
|
-
fontSize: cx(16),
|
|
194
|
-
color: '#000',
|
|
195
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
196
|
-
},
|
|
197
|
-
textInputGroup: {
|
|
198
|
-
flexDirection: 'row',
|
|
199
|
-
borderRadius: cx(4),
|
|
200
|
-
backgroundColor: '#F6F6F6',
|
|
201
|
-
alignItems: 'center',
|
|
202
|
-
},
|
|
203
|
-
iconTouchable: {
|
|
204
|
-
marginEnd: cx(18),
|
|
205
|
-
padding: cx(4),
|
|
206
|
-
},
|
|
207
|
-
line: {
|
|
208
|
-
height: 1,
|
|
209
|
-
position: 'absolute',
|
|
210
|
-
start: cx(4),
|
|
211
|
-
end: cx(4),
|
|
212
|
-
bottom: 0,
|
|
213
|
-
backgroundColor: '#cbcbcb',
|
|
214
|
-
},
|
|
215
|
-
unitItem: {
|
|
216
|
-
flexDirection: 'row',
|
|
217
|
-
justifyContent: 'space-between',
|
|
218
|
-
paddingHorizontal: cx(10),
|
|
219
|
-
alignItems: 'center',
|
|
220
|
-
height: cx(40),
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
const energyPopup = (props: {
|
|
226
|
-
energyData?: EnergyData,
|
|
227
|
-
onItemClick: (unit: string) => void
|
|
228
|
-
}) => {
|
|
229
|
-
return (
|
|
230
|
-
Popup.custom({
|
|
231
|
-
title: (
|
|
232
|
-
<View style={{ backgroundColor: '#DFDEDE', flexDirection: 'row', height: cx(60), justifyContent: 'space-between', alignItems: 'center', borderTopLeftRadius: cx(10), borderTopRightRadius: cx(10), paddingHorizontal: cx(8) }}>
|
|
233
|
-
<TouchableOpacity onPress={() => Popup.close()}>
|
|
234
|
-
<Text style={{ color: '#FF6600', fontSize: cx(16) }}>{I18n.getLang('auto_scan_system_cancel')}</Text>
|
|
235
|
-
</TouchableOpacity>
|
|
236
|
-
</View>
|
|
237
|
-
),
|
|
238
|
-
wrapperStyle: {
|
|
239
|
-
height: height - cx(40)
|
|
240
|
-
},
|
|
241
|
-
footer: (<View></View>),
|
|
242
|
-
onMaskPress: () => { },
|
|
243
|
-
motionType: 'none',
|
|
244
|
-
useKeyboardView: true,
|
|
245
|
-
content: (
|
|
246
|
-
<View
|
|
247
|
-
style={{ paddingHorizontal: cx(16) }}>
|
|
248
|
-
<Spacer />
|
|
249
|
-
<Card>
|
|
250
|
-
<FlatList
|
|
251
|
-
data={UnitList}
|
|
252
|
-
renderItem={({ item }) => (
|
|
253
|
-
<TouchableOpacity
|
|
254
|
-
onPress={() => {
|
|
255
|
-
props.onItemClick(item)
|
|
256
|
-
Popup.close()
|
|
257
|
-
}}
|
|
258
|
-
>
|
|
259
|
-
<View style={styles.unitItem}>
|
|
260
|
-
<Text style={{ fontSize: cx(16), color: '#000' }}>{item}</Text>
|
|
261
|
-
{props.energyData && props.energyData.unit === item && <Image
|
|
262
|
-
style={{ width: cx(16), height: cx(16) }}
|
|
263
|
-
source={res.app_music_check}
|
|
264
|
-
resizeMode="contain"
|
|
265
|
-
/>}
|
|
266
|
-
</View>
|
|
267
|
-
</TouchableOpacity>
|
|
268
|
-
)}
|
|
269
|
-
ItemSeparatorComponent={() => (
|
|
270
|
-
<View style={{ flex: 1, height: 1, backgroundColor: '#ccc' }}></View>
|
|
271
|
-
)}
|
|
272
|
-
keyExtractor={item => item}
|
|
273
|
-
/>
|
|
274
|
-
</Card>
|
|
275
|
-
<Spacer />
|
|
276
|
-
</View>
|
|
277
|
-
)
|
|
278
|
-
})
|
|
279
|
-
)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export default EnergyModal
|
|
284
|
+
export default withTheme(EnergyModal)
|