@ledvance/group-ui-biz-bundle 1.0.106 → 1.0.108
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 +6 -36
- package/src/modules/childLock/ChildLockPage.tsx +17 -44
- package/src/modules/diyScene/DiySceneEditorPage.tsx +2 -2
- package/src/modules/energyConsumption/EnergyConsumptionActions.ts +29 -3
- package/src/modules/energyConsumption/EnergyConsumptionPage.tsx +28 -18
- package/src/modules/music/MusicActions.ts +4 -4
- package/src/modules/overchargeSwitch/OverchargeSwitchPage.tsx +23 -42
- package/src/modules/time_schedule/Interface.ts +0 -90
- package/src/modules/time_schedule/ScheduleCard.tsx +0 -128
- package/src/modules/time_schedule/TimeScheduleActions.ts +0 -102
- package/src/modules/time_schedule/TimeScheduleDetailPage.tsx +0 -910
- package/src/modules/time_schedule/TimeSchedulePage.tsx +0 -256
package/package.json
CHANGED
|
@@ -4,68 +4,38 @@
|
|
|
4
4
|
"name": "@ledvance/group-ui-biz-bundle",
|
|
5
5
|
"pid": [],
|
|
6
6
|
"uiid": "",
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.108",
|
|
8
8
|
"scripts": {},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@ledvance/base": "^1.x",
|
|
11
11
|
"@ledvance/react-native-echarts-pro": "^1.x",
|
|
12
|
-
"@reduxjs/toolkit": "^1.8.6",
|
|
13
12
|
"@tuya/tuya-panel-api": "^1.12.0",
|
|
14
13
|
"@tuya/tuya-panel-lamp-sdk": "^1.14.1",
|
|
15
14
|
"ahooks": "^2.x",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"events": "^1.1.1",
|
|
19
|
-
"lodash": "^4.17.19",
|
|
20
|
-
"moment": "^2.20.1",
|
|
15
|
+
"dayjs": "^1.11.13",
|
|
16
|
+
"lodash": "^4.17.21",
|
|
21
17
|
"prop-types": "^15.6.1",
|
|
22
18
|
"react": "16.8.3",
|
|
23
|
-
"react-addons-shallow-compare": "^15.6.2",
|
|
24
19
|
"react-native": "0.59.10",
|
|
25
|
-
"react-native-render-html": "^6.3.4",
|
|
26
20
|
"react-native-svg": "5.5.1",
|
|
27
|
-
"react-redux": "^7.2.1",
|
|
28
|
-
"redux": "^4.0.0",
|
|
29
|
-
"redux-actions": "^2.6.1",
|
|
30
|
-
"redux-logger": "^3.0.6",
|
|
31
|
-
"redux-observable": "^1.0.0",
|
|
32
|
-
"redux-thunk": "^2.3.0",
|
|
33
|
-
"rxjs": "^6.3.1",
|
|
34
|
-
"rxjs-compat": "^6.3.1",
|
|
35
|
-
"style-equal": "^1.0.0",
|
|
36
21
|
"tuya-panel-kit": "^4.9.4"
|
|
37
22
|
},
|
|
38
23
|
"devDependencies": {
|
|
39
24
|
"@babel/plugin-proposal-decorators": "^7.12.1",
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/react": "^16.0.4",
|
|
44
|
-
"@types/react-native": "^0.60.0",
|
|
45
|
-
"@types/react-redux": "^7.1.2",
|
|
46
|
-
"@types/redux": "^3.6.0",
|
|
47
|
-
"@types/redux-actions": "^2.6.1",
|
|
48
|
-
"@types/redux-logger": "^3.0.7",
|
|
25
|
+
"@types/lodash": "^4.17.13",
|
|
26
|
+
"@types/react": "17.0.83",
|
|
27
|
+
"@types/react-native": "^0.65",
|
|
49
28
|
"@types/tuya-panel-kit": "^4.7.3",
|
|
50
|
-
"babel-jest": "^22.1.0",
|
|
51
29
|
"babel-plugin-import": "^1.11.0",
|
|
52
30
|
"babel-plugin-module-resolver": "^4.0.0",
|
|
53
31
|
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
|
54
32
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
55
|
-
"commitizen": "^4.2.2",
|
|
56
|
-
"commitlint-config-cz": "^0.13.2",
|
|
57
|
-
"cz-customizable": "^6.3.0",
|
|
58
|
-
"eslint-config-airbnb": "^18.2.1",
|
|
59
33
|
"eslint-config-tuya": "^1.0.0",
|
|
60
34
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
61
35
|
"eslint-import-resolver-react-native": "^0.2.0",
|
|
62
36
|
"eslint-plugin-react-native": "^3.10.0",
|
|
63
|
-
"husky": "^4.3.0",
|
|
64
|
-
"jest": "^22.1.1",
|
|
65
37
|
"metro-react-native-babel-preset": "^0.63.0",
|
|
66
38
|
"react-native-typescript-transformer": "^1.2.13",
|
|
67
|
-
"react-test-renderer": "^16.2.0",
|
|
68
|
-
"standard-version": "^9.0.0",
|
|
69
39
|
"typescript": "^4.1.2"
|
|
70
40
|
},
|
|
71
41
|
"jest": {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {Utils} from "tuya-panel-kit";
|
|
3
3
|
import Page from "@ledvance/base/src/components/Page";
|
|
4
4
|
import I18n from "@ledvance/base/src/i18n/index";
|
|
5
5
|
import {useDeviceInfo, useFeatureHook} from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
6
6
|
import {useReactive} from "ahooks";
|
|
7
|
-
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
8
7
|
import {View, Text, StyleSheet, Image} from "react-native";
|
|
9
8
|
import {Result} from "@ledvance/base/src/models/modules/Result";
|
|
10
9
|
import res from "@ledvance/base/src/res";
|
|
11
10
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
11
|
+
import Card from "@ledvance/base/src/components/Card";
|
|
12
|
+
import LdvSwitch from "@ledvance/base/src/components/ldvSwitch";
|
|
12
13
|
|
|
13
14
|
const { convertX: cx } = Utils.RatioUtils
|
|
14
15
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -40,36 +41,6 @@ const ChildLockPage = (props: { theme?: ThemeType }) => {
|
|
|
40
41
|
marginRight: cx(5),
|
|
41
42
|
tintColor: props.theme?.global.fontColor
|
|
42
43
|
},
|
|
43
|
-
titleBGView: {
|
|
44
|
-
flexDirection: 'row',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
paddingHorizontal: cx(16),
|
|
47
|
-
marginHorizontal: cx(24),
|
|
48
|
-
},
|
|
49
|
-
colorBlock: {
|
|
50
|
-
width: cx(20),
|
|
51
|
-
height: cx(20),
|
|
52
|
-
marginStart: cx(12),
|
|
53
|
-
borderRadius: cx(4),
|
|
54
|
-
},
|
|
55
|
-
title: {
|
|
56
|
-
color: props.theme?.global.fontColor,
|
|
57
|
-
fontSize: cx(14),
|
|
58
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
59
|
-
paddingVertical: cx(16),
|
|
60
|
-
},
|
|
61
|
-
shadow: {
|
|
62
|
-
shadowColor: props.theme?.card.shadowColor,
|
|
63
|
-
shadowOpacity: 0.2,
|
|
64
|
-
shadowRadius: 8,
|
|
65
|
-
elevation:8,
|
|
66
|
-
shadowOffset: {
|
|
67
|
-
width: 0,
|
|
68
|
-
height: 4,
|
|
69
|
-
},
|
|
70
|
-
backgroundColor: props.theme?.card.background,
|
|
71
|
-
borderRadius: 8,
|
|
72
|
-
},
|
|
73
44
|
})
|
|
74
45
|
|
|
75
46
|
return (<Page
|
|
@@ -82,18 +53,20 @@ const ChildLockPage = (props: { theme?: ThemeType }) => {
|
|
|
82
53
|
{I18n.getLang('childlock_overview_description_text')}
|
|
83
54
|
</Text>
|
|
84
55
|
</View>
|
|
85
|
-
<
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
56
|
+
<Card style={{marginHorizontal: cx(24)}}>
|
|
57
|
+
<LdvSwitch
|
|
58
|
+
title={I18n.getLang('sockets_specific_settings_child_lock')}
|
|
59
|
+
colorAlpha={1}
|
|
60
|
+
enable={childLock}
|
|
61
|
+
setEnable={async (enable: boolean) => {
|
|
62
|
+
state.loading = true
|
|
63
|
+
await setChildLock(enable, undefined, {
|
|
64
|
+
'controlLock': enable
|
|
65
|
+
})
|
|
66
|
+
state.loading = false
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</Card>
|
|
97
70
|
</Page>)
|
|
98
71
|
}
|
|
99
72
|
|
|
@@ -203,9 +203,9 @@ const DiySceneEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
203
203
|
state.sceneInfo.type !== 'DIY' && <TouchableOpacity onPress={() => {
|
|
204
204
|
toggleLoveScene(state.sceneInfo.id)
|
|
205
205
|
}}>
|
|
206
|
-
{isLove ? <Image source={res.like} style={{width: cx(
|
|
206
|
+
{isLove ? <Image source={res.like} style={{width: cx(30), height: cx(26)}}/>
|
|
207
207
|
: <Image source={res.un_like}
|
|
208
|
-
style={{width: cx(
|
|
208
|
+
style={{width: cx(30), height: cx(26), tintColor: props.theme?.global.fontColor}}/>}
|
|
209
209
|
</TouchableOpacity>
|
|
210
210
|
}
|
|
211
211
|
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
@@ -7,12 +7,13 @@ import {
|
|
|
7
7
|
} from "@ledvance/base/src/models/TuyaApi";
|
|
8
8
|
import { overDays } from "@ledvance/base/src/utils";
|
|
9
9
|
import { exportCsvFile, loopsText, monthFormat, monthFormatShort } from "@ledvance/base/src/utils/common";
|
|
10
|
-
import { DateType } from "
|
|
11
|
-
import { OverviewItem } from "
|
|
10
|
+
import { DateType } from "./co2Data";
|
|
11
|
+
import { OverviewItem } from "./EnergyConsumptionPage";
|
|
12
12
|
import dayjs from "dayjs";
|
|
13
13
|
import { isNumber } from "lodash";
|
|
14
14
|
import { EnergyData, UnitList } from "./component/EnergyModal";
|
|
15
15
|
import I18n from "@ledvance/base/src/i18n";
|
|
16
|
+
import {NativeApi} from "@ledvance/base/src/api/native";
|
|
16
17
|
|
|
17
18
|
interface LightConfig {
|
|
18
19
|
energyConsumption?: EnergyData
|
|
@@ -177,4 +178,29 @@ export const exportEnergyCsv = (values: any[][], unit: string) => {
|
|
|
177
178
|
const headers = [I18n.getLang('date'), `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')} (kWh)`, `Price(${unit})`]
|
|
178
179
|
const functionName = `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}`
|
|
179
180
|
exportCsvFile(headers, values, functionName)
|
|
180
|
-
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const EnergyGenerationId = 'EnergyGeneration'
|
|
184
|
+
|
|
185
|
+
export interface EnergyHistory {
|
|
186
|
+
time: number
|
|
187
|
+
generationMode: boolean
|
|
188
|
+
type: 'Consumption' | 'Generation'
|
|
189
|
+
value: number
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface EnergyGeneration {
|
|
193
|
+
generationMode: boolean
|
|
194
|
+
totalElectricity: number
|
|
195
|
+
history: EnergyHistory[]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export async function getEnergyGenerationValue(devId: string): Promise<EnergyGeneration | undefined> {
|
|
199
|
+
const res = await NativeApi.getJson(devId, EnergyGenerationId)
|
|
200
|
+
if (res.success && res.data) {
|
|
201
|
+
return JSON.parse(res.data)
|
|
202
|
+
} else {
|
|
203
|
+
console.log('getEnergyGenerationValue failed', res)
|
|
204
|
+
return undefined
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -13,14 +13,14 @@ import { useReactive, useUpdateEffect } from 'ahooks';
|
|
|
13
13
|
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
14
14
|
import { DpResultByMonthResData, getDpResultByMonth } from '@ledvance/base/src/models/TuyaApi';
|
|
15
15
|
import { useTimeZoneCity } from '@ledvance/base/src/models/modules/NativePropsSlice';
|
|
16
|
-
import {
|
|
16
|
+
import {flattenDeep, isNumber, sum, sumBy} from 'lodash';
|
|
17
17
|
import {
|
|
18
18
|
exchangeNumber,
|
|
19
19
|
localeNumber,
|
|
20
20
|
monthFormat,
|
|
21
21
|
monthFormatShort,
|
|
22
22
|
} from '@ledvance/base/src/utils/common';
|
|
23
|
-
import { unitDivision, useEnergyConsumption
|
|
23
|
+
import {getEnergyGenerationValue, unitDivision, useEnergyConsumption} from './EnergyConsumptionActions';
|
|
24
24
|
import EnergyPopup, { EnergyData } from './component/EnergyModal';
|
|
25
25
|
import { carbonDioxideEmission, countryAndRegion } from './co2Data';
|
|
26
26
|
import { EnergyConsumptionDetailProps } from './EnergyConsumptionDetail';
|
|
@@ -49,7 +49,7 @@ export interface OverviewItem {
|
|
|
49
49
|
headlineText: string;
|
|
50
50
|
chartTitle: string;
|
|
51
51
|
}
|
|
52
|
-
export type PopupType = 'co2' | 'money' | 'unit' | ''
|
|
52
|
+
export type PopupType = 'co2' | 'money' | 'unit' | ''
|
|
53
53
|
|
|
54
54
|
interface EnergyConsumptionState {
|
|
55
55
|
solarTodayElectricity: string
|
|
@@ -118,13 +118,23 @@ const EnergyConsumptionPage = (props: { theme?: ThemeType }) => {
|
|
|
118
118
|
const solarPromise = params.solarPlugGroup.map(devId =>
|
|
119
119
|
getDpResultByMonth(devId, params.addEleDpCode, 'sum').catch(error => ({ error }))
|
|
120
120
|
);
|
|
121
|
+
const solarEnergyGenerationPromise = params.solarPlugGroup.map(devId =>
|
|
122
|
+
getEnergyGenerationValue(devId)
|
|
123
|
+
);
|
|
121
124
|
const wifiPromise = params.wifiPlugGroup.map(devId =>
|
|
122
125
|
getDpResultByMonth(devId, params.addEleDpCode, 'sum').catch(error => ({ error }))
|
|
123
126
|
);
|
|
127
|
+
const wifiEnergyGenerationPromise = params.wifiPlugGroup.map(devId =>
|
|
128
|
+
getEnergyGenerationValue(devId)
|
|
129
|
+
);
|
|
124
130
|
state.loading = true
|
|
125
131
|
const solarRes = await Promise.all(solarPromise);
|
|
126
132
|
const wifiRes = await Promise.all(wifiPromise)
|
|
133
|
+
const solarEnergyGenerationRes = await Promise.all(solarEnergyGenerationPromise);
|
|
134
|
+
const wifiEnergyGenerationRes = await Promise.all(wifiEnergyGenerationPromise);
|
|
127
135
|
state.loading = false
|
|
136
|
+
const solarEnergy: number = sum(solarEnergyGenerationRes.map(item => item?.totalElectricity || 0))
|
|
137
|
+
const wifiEnergy: number = sum(wifiEnergyGenerationRes.map(item => item?.totalElectricity || 0))
|
|
128
138
|
// @ts-ignore
|
|
129
139
|
const solarGroup: DpResultByMonthResData[] = solarRes.filter(v => !v.error);
|
|
130
140
|
// @ts-ignore
|
|
@@ -133,10 +143,10 @@ const EnergyConsumptionPage = (props: { theme?: ThemeType }) => {
|
|
|
133
143
|
const solarData = getMergeData(solarGroup)
|
|
134
144
|
const wifiData = getMergeData(wifiGroup)
|
|
135
145
|
state.solarTodayElectricity = solarData.thisDay
|
|
136
|
-
state.solarTotalElectricity = solarData.sum
|
|
146
|
+
state.solarTotalElectricity = Math.max(Number(solarData.sum) - solarEnergy, 0).toFixed(2)
|
|
137
147
|
state.solarOverviewList = flattenDeep(solarData.overviewList)
|
|
138
148
|
state.wifiTodayElectricity = wifiData.thisDay
|
|
139
|
-
state.wifiTotalElectricity = wifiData.sum
|
|
149
|
+
state.wifiTotalElectricity = Math.max(Number(wifiData.sum) - wifiEnergy, 0).toFixed(2)
|
|
140
150
|
state.wifiOverviewList = flattenDeep(wifiData.overviewList)
|
|
141
151
|
};
|
|
142
152
|
|
|
@@ -458,19 +468,19 @@ const EnergyConsumptionPage = (props: { theme?: ThemeType }) => {
|
|
|
458
468
|
<Spacer height={cx(30)} />
|
|
459
469
|
{/* Annual overview */}
|
|
460
470
|
<OverView
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
471
|
+
style={{marginHorizontal: cx(24)}}
|
|
472
|
+
headlineText={I18n.getLang('consumption_data_field4_headline_text')}
|
|
473
|
+
headlineClick={() => {
|
|
474
|
+
navigation.navigate(ui_biz_routerKey.group_ui_biz_energy_consumption_chart, {
|
|
475
|
+
headlineText: chartHeadline,
|
|
476
|
+
chartData: state.isSolarMode ? state.solarOverviewList : state.wifiOverviewList,
|
|
477
|
+
price: state.price,
|
|
478
|
+
unit: state.unit,
|
|
479
|
+
addEleDpCode: params.addEleDpCode,
|
|
480
|
+
date: (new Date()).getFullYear().toString(),
|
|
481
|
+
deviceIdGroup: state.isSolarMode ? params.solarPlugGroup : params.wifiPlugGroup,
|
|
482
|
+
} as EnergyConsumptionChartProps)
|
|
483
|
+
}}
|
|
474
484
|
overviewItemClick={(item) => {
|
|
475
485
|
navigation.navigate(ui_biz_routerKey.group_ui_biz_energy_consumption_detail, {
|
|
476
486
|
addEleDpCode: params.addEleDpCode,
|
|
@@ -2,7 +2,7 @@ import { useFeatureHook } from '@ledvance/base/src/models/modules/NativePropsSli
|
|
|
2
2
|
import { Formatter } from '@tuya/tuya-panel-lamp-sdk'
|
|
3
3
|
import { DreamLightMicMusicUIState, defMusicData, dreamMusicData } from './MusicDataBean'
|
|
4
4
|
import { WorkMode } from '@ledvance/base/src/utils/interface'
|
|
5
|
-
import { MusicPageParams } from '
|
|
5
|
+
import { MusicPageParams } from './MusicPage'
|
|
6
6
|
const DreamMusicFormatter = new Formatter.DreamLightMicMusicFormatter()
|
|
7
7
|
|
|
8
8
|
interface MusicConfig {
|
|
@@ -13,7 +13,7 @@ interface MusicConfig {
|
|
|
13
13
|
phoneMusicData: any[]
|
|
14
14
|
musicType: number
|
|
15
15
|
musicSwitch: boolean
|
|
16
|
-
phoneDpData: string
|
|
16
|
+
phoneDpData: string
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const defMusicConfig: MusicConfig = {
|
|
@@ -29,7 +29,7 @@ const defMusicConfig: MusicConfig = {
|
|
|
29
29
|
|
|
30
30
|
interface LightConfig {
|
|
31
31
|
musicConfig?: MusicConfig
|
|
32
|
-
musicData: string
|
|
32
|
+
musicData: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const useDreamMusicData = (musicOption: MusicPageParams) => {
|
|
@@ -48,7 +48,7 @@ export const useDreamMusicData = (musicOption: MusicPageParams) => {
|
|
|
48
48
|
dps[musicOption.workModeDp] = WorkMode.Music
|
|
49
49
|
dps[musicOption.switchLedDp] = true
|
|
50
50
|
if (musicOption.colourLedDp && musicOption.isCeilingLight){
|
|
51
|
-
dps[musicOption.colourLedDp] = true
|
|
51
|
+
dps[musicOption.colourLedDp] = true
|
|
52
52
|
}
|
|
53
53
|
}else{
|
|
54
54
|
dps[musicOption.workModeDp] = v.lastWorkMode
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {Utils} from "tuya-panel-kit";
|
|
3
3
|
import Page from "@ledvance/base/src/components/Page";
|
|
4
4
|
import I18n from "@ledvance/base/src/i18n/index";
|
|
5
5
|
import {useDeviceInfo, useFeatureHook} from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
6
6
|
import {useReactive} from "ahooks";
|
|
7
7
|
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
8
|
-
import {StyleSheet, Text
|
|
8
|
+
import {StyleSheet, Text} from "react-native";
|
|
9
9
|
import {Result} from "@ledvance/base/src/models/modules/Result";
|
|
10
10
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
11
|
+
import Card from "@ledvance/base/src/components/Card";
|
|
12
|
+
import LdvSwitch from "@ledvance/base/src/components/ldvSwitch";
|
|
11
13
|
|
|
12
14
|
const { convertX: cx } = Utils.RatioUtils
|
|
13
15
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -28,55 +30,34 @@ const OverchargeSwitchPage = (props: { theme?: ThemeType }) => {
|
|
|
28
30
|
})
|
|
29
31
|
|
|
30
32
|
const styles = StyleSheet.create({
|
|
31
|
-
titleBGView: {
|
|
32
|
-
flexDirection: 'row',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
paddingHorizontal: cx(16),
|
|
35
|
-
marginHorizontal: cx(24),
|
|
36
|
-
marginTop: cx(30)
|
|
37
|
-
},
|
|
38
33
|
title: {
|
|
39
34
|
color: props.theme?.global.fontColor,
|
|
40
|
-
fontSize: cx(
|
|
35
|
+
fontSize: cx(16),
|
|
36
|
+
fontWeight: 'bold',
|
|
41
37
|
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
desc: {
|
|
45
|
-
color: props.theme?.global.fontColor,
|
|
46
|
-
},
|
|
47
|
-
shadow: {
|
|
48
|
-
shadowColor: props.theme?.card.shadowColor,
|
|
49
|
-
shadowOpacity: 0.2,
|
|
50
|
-
shadowRadius: 8,
|
|
51
|
-
elevation:8,
|
|
52
|
-
shadowOffset: {
|
|
53
|
-
width: 0,
|
|
54
|
-
height: 4,
|
|
55
|
-
},
|
|
56
|
-
backgroundColor: props.theme?.card.background,
|
|
57
|
-
borderRadius: 8,
|
|
38
|
+
paddingTop: cx(16),
|
|
39
|
+
paddingHorizontal: cx(16),
|
|
58
40
|
},
|
|
59
41
|
})
|
|
60
42
|
|
|
61
43
|
return (<Page
|
|
62
44
|
backText={devInfo.name}
|
|
63
45
|
loading={state.loading}>
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</View>
|
|
46
|
+
<Spacer height={cx(24)}/>
|
|
47
|
+
<Card style={{marginHorizontal: cx(24)}}>
|
|
48
|
+
<Text style={styles.title}>{I18n.getLang('switch_overcharge_headline_text')}</Text>
|
|
49
|
+
<LdvSwitch
|
|
50
|
+
title={I18n.getLang('switch_overcharge_headline_description')}
|
|
51
|
+
titleStyle={{fontWeight: 'normal', fontSize: cx(14)}}
|
|
52
|
+
colorAlpha={1}
|
|
53
|
+
enable={overchargeSwitch}
|
|
54
|
+
setEnable={async (v) => {
|
|
55
|
+
state.loading = true
|
|
56
|
+
await setOverchargeSwitch(v)
|
|
57
|
+
state.loading = false
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
</Card>
|
|
80
61
|
</Page>)
|
|
81
62
|
}
|
|
82
63
|
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export interface Timer {
|
|
2
|
-
status: number;
|
|
3
|
-
loops: string;
|
|
4
|
-
time: string;
|
|
5
|
-
id: number;
|
|
6
|
-
isAppPush: boolean;
|
|
7
|
-
dps: string;
|
|
8
|
-
groupOrder?: number;
|
|
9
|
-
groupId?: string;
|
|
10
|
-
aliasName: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IAddSingleTime {
|
|
14
|
-
bizId: string;
|
|
15
|
-
bizType?: string;
|
|
16
|
-
actions: any;
|
|
17
|
-
loops?: string;
|
|
18
|
-
category?: string;
|
|
19
|
-
status?: number;
|
|
20
|
-
isAppPush?: boolean;
|
|
21
|
-
aliasName?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface IQueryTimerTasks {
|
|
25
|
-
bizId: string;
|
|
26
|
-
bizType?: string;
|
|
27
|
-
category?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type Timers = Array<{
|
|
31
|
-
/**
|
|
32
|
-
* 初始化状态,0:关闭;1:开启。
|
|
33
|
-
*/
|
|
34
|
-
status: number;
|
|
35
|
-
/**
|
|
36
|
-
* 在0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
|
|
37
|
-
*/
|
|
38
|
-
loops: string;
|
|
39
|
-
/**
|
|
40
|
-
* 定时时间。
|
|
41
|
-
*/
|
|
42
|
-
time: string;
|
|
43
|
-
/**
|
|
44
|
-
* 定时任务主键。
|
|
45
|
-
*/
|
|
46
|
-
id: number;
|
|
47
|
-
/**
|
|
48
|
-
* 是否发送执行通知。
|
|
49
|
-
*/
|
|
50
|
-
isAppPush: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* DP 值。
|
|
53
|
-
*/
|
|
54
|
-
dps: string;
|
|
55
|
-
/**
|
|
56
|
-
* 分组定时排序。
|
|
57
|
-
*/
|
|
58
|
-
groupOrder: number;
|
|
59
|
-
/**
|
|
60
|
-
* 分组定时 ID。
|
|
61
|
-
*/
|
|
62
|
-
groupId: string;
|
|
63
|
-
/**
|
|
64
|
-
* 分组定时定时备注。
|
|
65
|
-
*/
|
|
66
|
-
aliasName: string;
|
|
67
|
-
}>;
|
|
68
|
-
|
|
69
|
-
export interface IModifySingleTimer {
|
|
70
|
-
bizId: string;
|
|
71
|
-
bizType?: string;
|
|
72
|
-
id: string | number;
|
|
73
|
-
actions: any;
|
|
74
|
-
loops?: string;
|
|
75
|
-
status?: number;
|
|
76
|
-
isAppPush?: boolean;
|
|
77
|
-
aliasName?: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface IModDeleteTaskByIds {
|
|
81
|
-
bizId: string;
|
|
82
|
-
bizType?: string;
|
|
83
|
-
ids: string;
|
|
84
|
-
status?: number;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export enum UVCFanMode {
|
|
88
|
-
Nature = 'nature',
|
|
89
|
-
Normal = 'normal'
|
|
90
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ViewStyle, View, Text, StyleSheet } from "react-native";
|
|
3
|
-
import Card from "@ledvance/base/src/components/Card";
|
|
4
|
-
import { SwitchButton, Utils } from 'tuya-panel-kit';
|
|
5
|
-
import { convertTo12HourFormat, loopText, showDialog } from '@ledvance/base/src/utils/common';
|
|
6
|
-
import { Timer } from "./Interface";
|
|
7
|
-
import { useSystemTimeFormate } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
8
|
-
import I18n from "@ledvance/base/src/i18n";
|
|
9
|
-
const { convertX: cx } = Utils.RatioUtils;
|
|
10
|
-
|
|
11
|
-
interface ScheduleCardProps {
|
|
12
|
-
item: Timer
|
|
13
|
-
style?: ViewStyle
|
|
14
|
-
onEnableChange: (enable: boolean) => void
|
|
15
|
-
onPress: (item: any) => void
|
|
16
|
-
onLongPress: (item: any) => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const ScheduleCard = (props: ScheduleCardProps) => {
|
|
20
|
-
const { item, style, onEnableChange, onPress } = props;
|
|
21
|
-
const is24HourClock = useSystemTimeFormate()
|
|
22
|
-
return (
|
|
23
|
-
<Card
|
|
24
|
-
style={styles.card}
|
|
25
|
-
containerStyle={[styles.container, style]}
|
|
26
|
-
onPress={() => {
|
|
27
|
-
onPress(item);
|
|
28
|
-
}}
|
|
29
|
-
onLongPress={() => {
|
|
30
|
-
onPress(item);
|
|
31
|
-
// onLongPress(item);
|
|
32
|
-
}}>
|
|
33
|
-
<View style={styles.infoContainer}>
|
|
34
|
-
<Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
|
|
35
|
-
<Text style={styles.loop}>
|
|
36
|
-
{loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
|
|
37
|
-
</Text>
|
|
38
|
-
<Text style={styles.name}>{item.aliasName}</Text>
|
|
39
|
-
{/* {showTags() && <View style={styles.typeContainer}>
|
|
40
|
-
{renderTag()}
|
|
41
|
-
</View>} */}
|
|
42
|
-
</View>
|
|
43
|
-
<View style={styles.switchContainer}>
|
|
44
|
-
<SwitchButton
|
|
45
|
-
value={!!item.status}
|
|
46
|
-
thumbStyle={{ elevation: 0 }}
|
|
47
|
-
onValueChange={() => {
|
|
48
|
-
if (!item.status) {
|
|
49
|
-
showDialog({
|
|
50
|
-
method: 'confirm',
|
|
51
|
-
title: I18n.getLang('conflict_dialog_active_item_timeschedule_titel'),
|
|
52
|
-
subTitle: I18n.getLang('group_conflict_feature'),
|
|
53
|
-
confirmText: I18n.getLang('registration_dialog_button_yes'),
|
|
54
|
-
cancelText: I18n.getLang('registration_dialog_button_no'),
|
|
55
|
-
onConfirm: (_, {close}) => {
|
|
56
|
-
onEnableChange(!item.status);
|
|
57
|
-
close()
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
onEnableChange(!item.status);
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
</View>
|
|
66
|
-
</Card>
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const styles = StyleSheet.create({
|
|
72
|
-
card: {
|
|
73
|
-
marginHorizontal: cx(24),
|
|
74
|
-
borderRadius: cx(8),
|
|
75
|
-
},
|
|
76
|
-
container: {
|
|
77
|
-
flexDirection: 'row',
|
|
78
|
-
justifyContent: 'space-between',
|
|
79
|
-
},
|
|
80
|
-
infoContainer: {
|
|
81
|
-
flex: 1,
|
|
82
|
-
marginTop: cx(16),
|
|
83
|
-
marginBottom: cx(16),
|
|
84
|
-
flexDirection: 'column',
|
|
85
|
-
marginLeft: cx(16),
|
|
86
|
-
},
|
|
87
|
-
time: {
|
|
88
|
-
marginBottom: cx(5),
|
|
89
|
-
fontSize: 16,
|
|
90
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
91
|
-
fontWeight: 'bold',
|
|
92
|
-
},
|
|
93
|
-
loop: {
|
|
94
|
-
color: '#000',
|
|
95
|
-
fontSize: cx(14),
|
|
96
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
97
|
-
marginTop: cx(8),
|
|
98
|
-
},
|
|
99
|
-
name: {
|
|
100
|
-
color: '#000',
|
|
101
|
-
fontSize: cx(14),
|
|
102
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
103
|
-
marginTop: cx(8),
|
|
104
|
-
},
|
|
105
|
-
switchContainer: {
|
|
106
|
-
marginRight: cx(16),
|
|
107
|
-
// backgroundColor: 'red',
|
|
108
|
-
marginTop: cx(16),
|
|
109
|
-
},
|
|
110
|
-
switch: {},
|
|
111
|
-
typeContainer: {
|
|
112
|
-
flexDirection: 'row',
|
|
113
|
-
marginTop: cx(8),
|
|
114
|
-
},
|
|
115
|
-
typeWrap: {
|
|
116
|
-
backgroundColor: '#E6E7E8',
|
|
117
|
-
marginRight: cx(10),
|
|
118
|
-
borderRadius: cx(10),
|
|
119
|
-
},
|
|
120
|
-
typeText: {
|
|
121
|
-
fontSize: cx(12),
|
|
122
|
-
color: '#000',
|
|
123
|
-
paddingHorizontal: cx(8),
|
|
124
|
-
paddingVertical: cx(2)
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
export default ScheduleCard
|