@ledvance/ui-biz-bundle 1.1.55 → 1.1.57
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 +2 -1
- package/src/modules/biorhythm/Router.ts +34 -0
- package/src/modules/fixedTime/Router.ts +26 -0
- package/src/modules/flags/FlagActions.ts +12 -4
- package/src/modules/flags/FlagPage.tsx +31 -11
- package/src/modules/flags/Router.ts +25 -0
- package/src/modules/history/Router.ts +16 -0
- package/src/modules/mood/FantasyRouter.ts +35 -0
- package/src/modules/mood/MixMood/Router.ts +44 -0
- package/src/modules/mood/Router.ts +53 -0
- package/src/modules/music/Router.ts +16 -0
- package/src/modules/powerOnBehavior/Router.ts +16 -0
- package/src/modules/randomTime/Router.ts +25 -0
- package/src/modules/sleepWakeup/Router.ts +25 -0
- package/src/modules/timeSchedule/Router.ts +25 -0
- package/src/modules/timer/Router.ts +16 -0
- package/src/navigation/Routers.d.ts +0 -7
- package/src/navigation/Routers.ts +15 -304
- package/src/newModules/childLock/ChildLockPage.tsx +97 -0
- package/src/newModules/childLock/Router.ts +16 -0
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -0
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -0
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +321 -0
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +392 -0
- package/src/newModules/energyConsumption/Router.ts +34 -0
- package/src/newModules/energyConsumption/co2Data.ts +23655 -0
- package/src/newModules/energyConsumption/component/BarChart.tsx +93 -0
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +282 -0
- package/src/newModules/energyConsumption/component/Overview.tsx +116 -0
- package/src/newModules/fixedTime/FixedTimeActions.ts +234 -0
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +341 -0
- package/src/newModules/fixedTime/FixedTimePage.tsx +231 -0
- package/src/newModules/fixedTime/Router.ts +25 -0
- package/src/newModules/lightMode/LightModePage.tsx +204 -0
- package/src/newModules/lightMode/Router.ts +16 -0
- package/src/newModules/mood/AddMoodPage.tsx +178 -0
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +653 -0
- package/src/newModules/mood/Interface.ts +219 -0
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +781 -0
- package/src/newModules/mood/MoodActions.ts +235 -0
- package/src/newModules/mood/MoodInfo.ts +2151 -0
- package/src/newModules/mood/MoodItem.tsx +148 -0
- package/src/newModules/mood/MoodPage.tsx +385 -0
- package/src/newModules/mood/MoodParse.ts +442 -0
- package/src/newModules/mood/RecommendMoodItem.tsx +68 -0
- package/src/newModules/mood/Router.ts +53 -0
- package/src/newModules/mood/StaticMoodEditorPage.tsx +343 -0
- package/src/newModules/mood/tools.ts +12 -0
- package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -0
- package/src/newModules/overchargeSwitch/Router.ts +16 -0
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -0
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -0
- package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -0
- package/src/newModules/powerOnBehavior/Router.ts +16 -0
- package/src/newModules/randomTime/RandomTimeActions.ts +232 -0
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +322 -0
- package/src/newModules/randomTime/RandomTimePage.tsx +230 -0
- package/src/newModules/randomTime/Router.ts +25 -0
- package/src/newModules/randomTime/Summary.tsx +116 -0
- package/src/newModules/swithInching/Router.ts +16 -0
- package/src/newModules/swithInching/SwithInching.tsx +231 -0
- package/src/newModules/swithInching/SwithInchingAction.ts +55 -0
- package/src/newModules/swithInching/pickerView.tsx +91 -0
- package/src/newModules/timeSchedule/Interface.ts +111 -0
- package/src/newModules/timeSchedule/Router.ts +25 -0
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +662 -0
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +222 -0
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +259 -0
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +109 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import React, { useEffect, useMemo } from "react";
|
|
2
|
+
import { ScrollView, StyleSheet, View, Text, Image, TouchableOpacity } from "react-native";
|
|
3
|
+
import { useNavigation } from '@react-navigation/core'
|
|
4
|
+
import { useRoute } from '@react-navigation/core'
|
|
5
|
+
import Page from "@ledvance/base/src/components/Page";
|
|
6
|
+
import res from "@ledvance/base/src/res";
|
|
7
|
+
import I18n from "@ledvance/base/src/i18n";
|
|
8
|
+
import { Utils } from "tuya-panel-kit";
|
|
9
|
+
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
10
|
+
import Card from "@ledvance/base/src/components/Card";
|
|
11
|
+
import OverView from "./component/Overview";
|
|
12
|
+
import { useReactive, useUpdateEffect } from "ahooks";
|
|
13
|
+
import { getDpResultByMonth } from "@ledvance/base/src/models/TuyaApi";
|
|
14
|
+
import {useDeviceId, useEngergyGeneration, useTimeZoneCity} from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
15
|
+
import { flattenDeep, isEmpty } from "lodash";
|
|
16
|
+
import { exchangeNumber, exportFile, localeNumber, monthFormat, monthFormatShort } from "@ledvance/base/src/utils/common";
|
|
17
|
+
import {updatePrice, useElectricCurrent, usePower, useVoltage} from "./EnergyConsumptionActions";
|
|
18
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
19
|
+
import { EnergyConsumptionDetailProps } from "./EnergyConsumptionDetail";
|
|
20
|
+
import { EnergyConsumptionChartProps } from "./EnergyConsumptionChart";
|
|
21
|
+
import EnergyPopup, { EnergyData, UnitList } from "./component/EnergyModal";
|
|
22
|
+
import { NativeApi } from "@ledvance/base/src/api/native";
|
|
23
|
+
import { carbonDioxideEmission, countryAndRegion } from "./co2Data";
|
|
24
|
+
|
|
25
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
26
|
+
|
|
27
|
+
export interface EnergyConsumptionPageProps {
|
|
28
|
+
electricDpCode: string
|
|
29
|
+
powerDpCode: string
|
|
30
|
+
voltageDpCode: string
|
|
31
|
+
addEleDpCode: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface OverviewItem {
|
|
35
|
+
key: string
|
|
36
|
+
value: number | string
|
|
37
|
+
headlineText: string
|
|
38
|
+
chartTitle: string
|
|
39
|
+
}
|
|
40
|
+
export type PopupType = 'co2' | 'money' | 'unit' | ''
|
|
41
|
+
|
|
42
|
+
interface EnergyConsumptionState {
|
|
43
|
+
todayElectricity: string
|
|
44
|
+
totalElectricity: string
|
|
45
|
+
overviewList: OverviewItem[]
|
|
46
|
+
price: string
|
|
47
|
+
unit: string
|
|
48
|
+
showPopup: boolean
|
|
49
|
+
popupType: PopupType
|
|
50
|
+
co2Saved: string
|
|
51
|
+
}
|
|
52
|
+
const EnergyConsumptionPage = () => {
|
|
53
|
+
const props = useRoute().params as EnergyConsumptionPageProps
|
|
54
|
+
const devId = useDeviceId()
|
|
55
|
+
const navigation = useNavigation()
|
|
56
|
+
const timeZoneCity = useTimeZoneCity()
|
|
57
|
+
const power = usePower(props.powerDpCode)
|
|
58
|
+
const voltage = useVoltage(props.voltageDpCode)
|
|
59
|
+
const electric = useElectricCurrent(props.electricDpCode)
|
|
60
|
+
const isSolarPlug = useEngergyGeneration()
|
|
61
|
+
const state = useReactive<EnergyConsumptionState>({
|
|
62
|
+
todayElectricity: '0',
|
|
63
|
+
totalElectricity: '0',
|
|
64
|
+
overviewList: [],
|
|
65
|
+
price: '',
|
|
66
|
+
unit: UnitList[0],
|
|
67
|
+
showPopup: false,
|
|
68
|
+
popupType: '',
|
|
69
|
+
co2Saved: '0'
|
|
70
|
+
})
|
|
71
|
+
const chartHeadline = useMemo(() => {
|
|
72
|
+
const len = state.overviewList.length
|
|
73
|
+
return state.overviewList?.length ? `${state.overviewList[len - 1].key} - ${state.overviewList[0].key}` : ''
|
|
74
|
+
}, [state.overviewList])
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
getElectricity().then()
|
|
78
|
+
getInitPrice().then()
|
|
79
|
+
}, [])
|
|
80
|
+
|
|
81
|
+
useUpdateEffect(() =>{
|
|
82
|
+
if(Number(state.totalElectricity) > 0 && timeZoneCity){
|
|
83
|
+
const letOut = carbonDioxideEmission(timeZoneCity, countryAndRegion) || 0
|
|
84
|
+
state.co2Saved = localeNumber((letOut * Number(state.totalElectricity)) / 1000, 4)
|
|
85
|
+
}
|
|
86
|
+
}, [state.totalElectricity, timeZoneCity])
|
|
87
|
+
|
|
88
|
+
const getElectricity = async () => {
|
|
89
|
+
const res = await getDpResultByMonth(devId, props.addEleDpCode, 'sum')
|
|
90
|
+
if (!isEmpty(res)) {
|
|
91
|
+
state.todayElectricity = res.thisDay
|
|
92
|
+
state.totalElectricity = res.sum
|
|
93
|
+
console.log(res, '< --- res')
|
|
94
|
+
if (!isEmpty(res.years)) {
|
|
95
|
+
const yearsList = Object.keys(res.years)
|
|
96
|
+
yearsList.sort((a, b) => parseInt(b) - parseInt(a))
|
|
97
|
+
const monthList = yearsList.map(year => {
|
|
98
|
+
const curMonth = res.years[year]
|
|
99
|
+
const curMonthList = Object.keys(curMonth).sort((a, b) => parseInt(b) - parseInt(a))
|
|
100
|
+
const monthData = curMonthList.map(month => {
|
|
101
|
+
return {
|
|
102
|
+
key: `${monthFormat(month)} ${year}`,
|
|
103
|
+
value: (Number(curMonth[month]) || 0).toFixed(2),
|
|
104
|
+
headlineText: `${year}${month}`,
|
|
105
|
+
chartTitle: `${monthFormatShort(month)}\n${year}`
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
return monthData
|
|
109
|
+
})
|
|
110
|
+
state.overviewList = flattenDeep(monthList)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const getInitPrice = async () => {
|
|
116
|
+
const res = await NativeApi.getJson(devId, 'energiepreise')
|
|
117
|
+
if (res.success && res.data) {
|
|
118
|
+
const v = JSON.parse(res.data)
|
|
119
|
+
state.price = v?.price
|
|
120
|
+
state.unit = v?.unit
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const updateEnergyData = (data: EnergyData) => {
|
|
125
|
+
updatePrice(devId, data).then()
|
|
126
|
+
state.price = data.price
|
|
127
|
+
state.unit = data.unit
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Page
|
|
132
|
+
style={{ position: 'relative' }}
|
|
133
|
+
backText={I18n.getLang(isSolarPlug ? 'sockets_headline_power' : 'consumption_data_annual_bar_chart_system_back_text')}
|
|
134
|
+
headlineText={I18n.getLang(isSolarPlug ? 'sockets_headline_power' : 'consumption_data_annual_bar_chart_system_back_text')}
|
|
135
|
+
headlineIcon={state.overviewList.length ? res.download_icon : undefined}
|
|
136
|
+
onHeadlineIconClick={() => {
|
|
137
|
+
exportFile(state.overviewList)
|
|
138
|
+
}}
|
|
139
|
+
showGreenery={isSolarPlug}
|
|
140
|
+
greeneryIcon={res.energy_consumption_greenery}
|
|
141
|
+
>
|
|
142
|
+
<ScrollView nestedScrollEnabled={true}>
|
|
143
|
+
<View>
|
|
144
|
+
{/* tip */}
|
|
145
|
+
<Spacer height={cx(15)} />
|
|
146
|
+
<View style={styles.showTip}>
|
|
147
|
+
<Text style={{ fontSize: cx(14) }}>{I18n.getLang(isSolarPlug ? 'generation_data_description_text' : 'consumption_data_description_text')}</Text>
|
|
148
|
+
</View>
|
|
149
|
+
<Spacer />
|
|
150
|
+
{/* Today */}
|
|
151
|
+
<Card
|
|
152
|
+
style={styles.cardContainer}
|
|
153
|
+
>
|
|
154
|
+
<Text style={styles.cardTitle}>{I18n.getLang('consumption_data_field1_headline_text')}</Text>
|
|
155
|
+
<Spacer height={cx(15)} />
|
|
156
|
+
<View style={{ flexDirection: 'row', alignItems: 'flex-end' }}>
|
|
157
|
+
<Text style={[styles.consumptionNum, { fontSize: cx(38), marginRight: cx(8) }]}>{localeNumber(state.todayElectricity)}</Text>
|
|
158
|
+
<Text style={[styles.consumptionNum, { fontSize: cx(22), marginBottom: cx(4) }]}>kWh</Text>
|
|
159
|
+
</View>
|
|
160
|
+
<Spacer height={cx(10)} />
|
|
161
|
+
</Card>
|
|
162
|
+
<Spacer />
|
|
163
|
+
<Card
|
|
164
|
+
style={styles.cardContainer}
|
|
165
|
+
>
|
|
166
|
+
<Text style={styles.cardTitle}>{I18n.getLang('consumption_data_field2_headline_text')}</Text>
|
|
167
|
+
<Spacer height={cx(15)} />
|
|
168
|
+
<View style={styles.consumedEnergyContent}>
|
|
169
|
+
<ConsumedEnergyItem
|
|
170
|
+
value={power}
|
|
171
|
+
unit={I18n.getLang('consumption_data_field2_value_text1')} />
|
|
172
|
+
<ConsumedEnergyItem
|
|
173
|
+
value={electric}
|
|
174
|
+
unit={I18n.getLang('consumption_data_field2_value_text2')} />
|
|
175
|
+
<ConsumedEnergyItem
|
|
176
|
+
value={voltage}
|
|
177
|
+
unit={I18n.getLang('consumption_data_field2_value_text3')} />
|
|
178
|
+
</View>
|
|
179
|
+
</Card>
|
|
180
|
+
<Spacer />
|
|
181
|
+
{/* 365 day */}
|
|
182
|
+
<Card
|
|
183
|
+
style={styles.cardContainer}
|
|
184
|
+
>
|
|
185
|
+
<Text style={styles.cardTitle}>{I18n.getLang('consumption_data_field3_headline_text')}</Text>
|
|
186
|
+
<Spacer height={cx(15)} />
|
|
187
|
+
<View style={{ flexDirection: 'row', alignItems: 'flex-end' }}>
|
|
188
|
+
<Text style={[styles.consumptionNum, { fontSize: cx(38), marginRight: cx(8) }]}>{localeNumber(state.totalElectricity)}</Text>
|
|
189
|
+
<Text style={[styles.consumptionNum, { fontSize: cx(22), marginBottom: cx(4) }]}>kWh</Text>
|
|
190
|
+
</View>
|
|
191
|
+
<Spacer />
|
|
192
|
+
{/* CO2 */}
|
|
193
|
+
{isSolarPlug && <>
|
|
194
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
195
|
+
<View style={styles.priceBg}>
|
|
196
|
+
<Image
|
|
197
|
+
source={res.energy_consumption_cash}
|
|
198
|
+
resizeMode="contain"
|
|
199
|
+
style={{ height: cx(20), width: cx(20), tintColor: '#FF6600' }}
|
|
200
|
+
/>
|
|
201
|
+
</View>
|
|
202
|
+
<View style={styles.priceNum}>
|
|
203
|
+
<View style={{ flexDirection: 'row' }}>
|
|
204
|
+
<Text style={{ color: '#666', marginRight: cx(5) }}>{I18n.getLang('consumption_data_field3_co2_topic_text')}</Text>
|
|
205
|
+
<TouchableOpacity
|
|
206
|
+
onPress={() => {
|
|
207
|
+
state.showPopup = true
|
|
208
|
+
state.popupType = 'co2'
|
|
209
|
+
}}
|
|
210
|
+
>
|
|
211
|
+
<Image
|
|
212
|
+
source={res.co2Icon}
|
|
213
|
+
resizeMode="contain"
|
|
214
|
+
style={{ height: cx(20), width: cx(20), tintColor: '#FF6600' }}
|
|
215
|
+
/>
|
|
216
|
+
</TouchableOpacity>
|
|
217
|
+
</View>
|
|
218
|
+
<Text style={{ color: '#000', fontWeight: 'bold' }}>{`${state.co2Saved} kg`}</Text>
|
|
219
|
+
</View>
|
|
220
|
+
</View>
|
|
221
|
+
<Spacer height={cx(10)} />
|
|
222
|
+
</>}
|
|
223
|
+
{/* money */}
|
|
224
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
225
|
+
<View style={styles.priceBg}>
|
|
226
|
+
<Image
|
|
227
|
+
source={res.energy_consumption_cash}
|
|
228
|
+
resizeMode="contain"
|
|
229
|
+
style={{ height: cx(20), width: cx(20), tintColor: '#FF6600' }}
|
|
230
|
+
/>
|
|
231
|
+
</View>
|
|
232
|
+
<View>
|
|
233
|
+
<View style={styles.priceNum}>
|
|
234
|
+
<Text style={{ color: '#666' }}>{I18n.getLang(isSolarPlug ? 'consumption_data_monthly_overview_field1_text2' : 'consumption_data_field3_value_text2')}</Text>
|
|
235
|
+
<Text style={{ color: '#000', fontWeight: 'bold' }}>{state.price ? `${localeNumber(Number(state.price ) * Number(state.totalElectricity), 2)} ${state.unit}` : '-'}</Text>
|
|
236
|
+
</View>
|
|
237
|
+
<TouchableOpacity onPress={() => {
|
|
238
|
+
state.showPopup = true
|
|
239
|
+
state.popupType = 'money'
|
|
240
|
+
}}>
|
|
241
|
+
<View style={styles.priceButton}>
|
|
242
|
+
<Text style={{ color: '#fff' }}>{I18n.getLang('consumption_data_field3_button_text')}</Text>
|
|
243
|
+
</View>
|
|
244
|
+
</TouchableOpacity>
|
|
245
|
+
</View>
|
|
246
|
+
</View>
|
|
247
|
+
</Card>
|
|
248
|
+
<Spacer height={cx(30)} />
|
|
249
|
+
{/* Annual overview */}
|
|
250
|
+
<OverView
|
|
251
|
+
style={{ marginHorizontal: cx(24) }}
|
|
252
|
+
headlineText={I18n.getLang('consumption_data_field4_headline_text')}
|
|
253
|
+
headlineClick={() => {
|
|
254
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_chart, {
|
|
255
|
+
headlineText: chartHeadline,
|
|
256
|
+
chartData: state.overviewList
|
|
257
|
+
} as EnergyConsumptionChartProps)
|
|
258
|
+
}}
|
|
259
|
+
overviewItemClick={(item) => {
|
|
260
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_detail, {
|
|
261
|
+
addEleDpCode: props.addEleDpCode,
|
|
262
|
+
curMonth: item,
|
|
263
|
+
price: state.price,
|
|
264
|
+
unit: state.unit,
|
|
265
|
+
updateEnergyData
|
|
266
|
+
} as EnergyConsumptionDetailProps)
|
|
267
|
+
}}
|
|
268
|
+
overViewList={state.overviewList}
|
|
269
|
+
/>
|
|
270
|
+
{/* modal */}
|
|
271
|
+
<EnergyPopup
|
|
272
|
+
visible={!!(state.popupType && state.showPopup)}
|
|
273
|
+
popupType={state.popupType || 'co2'}
|
|
274
|
+
title={state.popupType === 'co2' ? I18n.getLang('consumption_data_field3_co2_topic_text') : ''}
|
|
275
|
+
cancelText={state.popupType === 'co2' ? '' : I18n.getLang("auto_scan_system_cancel")}
|
|
276
|
+
confirmText={I18n.getLang(state.popupType === 'co2' ? 'home_screen_home_dialog_yes_con' : 'auto_scan_system_wifi_confirm')}
|
|
277
|
+
energyData={{ price: state.price, unit: state.unit }}
|
|
278
|
+
onConfirm={(energyData) => {
|
|
279
|
+
state.popupType = ''
|
|
280
|
+
state.showPopup = false
|
|
281
|
+
if(energyData){
|
|
282
|
+
updateEnergyData({
|
|
283
|
+
...energyData,
|
|
284
|
+
price: exchangeNumber(energyData.price)
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
}}
|
|
288
|
+
onCancel={() => {
|
|
289
|
+
state.popupType = ''
|
|
290
|
+
state.showPopup = false
|
|
291
|
+
}}
|
|
292
|
+
/>
|
|
293
|
+
</View>
|
|
294
|
+
</ScrollView>
|
|
295
|
+
</Page>
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const styles = StyleSheet.create({
|
|
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
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import EnergyConsumptionPage from "./EnergyConsumptionPage";
|
|
3
|
+
import EnergyConsumptionDetail from "./EnergyConsumptionDetail";
|
|
4
|
+
import EnergyConsumptionChart from "./EnergyConsumptionChart";
|
|
5
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
6
|
+
|
|
7
|
+
const EnergyConsumptionPageRouters: NavigationRoute[] = [
|
|
8
|
+
{
|
|
9
|
+
name: ui_biz_routerKey.ui_biz_energy_consumption,
|
|
10
|
+
component: EnergyConsumptionPage,
|
|
11
|
+
options:{
|
|
12
|
+
hideTopbar: true,
|
|
13
|
+
showOfflineView: false,
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: ui_biz_routerKey.ui_biz_energy_consumption_detail,
|
|
18
|
+
component: EnergyConsumptionDetail,
|
|
19
|
+
options:{
|
|
20
|
+
hideTopbar: true,
|
|
21
|
+
showOfflineView: false,
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: ui_biz_routerKey.ui_biz_energy_consumption_chart,
|
|
26
|
+
component: EnergyConsumptionChart,
|
|
27
|
+
options:{
|
|
28
|
+
hideTopbar: true,
|
|
29
|
+
showOfflineView: false,
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export default EnergyConsumptionPageRouters
|