@ledvance/group-ui-biz-bundle 1.0.25 → 1.0.26
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
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {useFeatureHook} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
2
|
+
import {Result} from '@ledvance/base/src/models/modules/Result'
|
|
3
3
|
import dayjs from 'dayjs'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import {useCountDown, useReactive} from 'ahooks'
|
|
5
|
+
import {useEffect, useMemo} from 'react'
|
|
6
|
+
import {I18nKey} from "../../../.yalc/@ledvance/base/src/i18n/index";
|
|
6
7
|
|
|
7
8
|
export interface TimerTask {
|
|
8
9
|
name: string
|
|
@@ -15,8 +16,8 @@ export interface TimerTask {
|
|
|
15
16
|
enable: boolean
|
|
16
17
|
}
|
|
17
18
|
status: TaskStatus
|
|
18
|
-
stringOn:
|
|
19
|
-
stringOff:
|
|
19
|
+
stringOn: I18nKey
|
|
20
|
+
stringOff: I18nKey
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export enum TaskStatus {
|
|
@@ -154,14 +155,21 @@ export interface TimerSettableDp {
|
|
|
154
155
|
code: string
|
|
155
156
|
enable: boolean
|
|
156
157
|
}
|
|
157
|
-
stringOn:
|
|
158
|
-
stringOff:
|
|
158
|
+
stringOn: I18nKey
|
|
159
|
+
stringOff: I18nKey
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
export interface TimerPageParams {
|
|
162
163
|
timerSettableDps: TimerSettableDp[]
|
|
163
164
|
}
|
|
164
165
|
|
|
166
|
+
export function timeFormatToRealTime(mCountdown: number) {
|
|
167
|
+
const date = new Date()
|
|
168
|
+
const now = date.getTime()
|
|
169
|
+
const after = new Date(now + mCountdown * 1000)
|
|
170
|
+
return `${after.getHours()}:${after.getMinutes().toString().padStart(2, '0')}`
|
|
171
|
+
}
|
|
172
|
+
|
|
165
173
|
export function timeFormat(time: number): string {
|
|
166
174
|
let hour = Math.trunc(time / 3600)
|
|
167
175
|
const beforeMin = (time % 3600) / 60
|
|
@@ -8,7 +8,7 @@ import LdvPickerView from '@ledvance/base/src/components/ldvPickerView'
|
|
|
8
8
|
import { useReactive } from 'ahooks'
|
|
9
9
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
10
10
|
import DeleteButton from '@ledvance/base/src/components/DeleteButton'
|
|
11
|
-
import {
|
|
11
|
+
import {TaskStatus, timeFormat, timeFormatToRealTime, TimerPageParams, TimerTask, useTimerTasks} from './TimerAction'
|
|
12
12
|
import { cloneDeep, groupBy } from 'lodash'
|
|
13
13
|
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
14
14
|
import GroupBizRes from '../../res/GroupBizRes'
|
|
@@ -188,7 +188,7 @@ const TimerPage = () => {
|
|
|
188
188
|
</View>
|
|
189
189
|
<Spacer height={cx(32)}/>
|
|
190
190
|
<Text
|
|
191
|
-
style={[styles.activeTaskDesc, { textAlign: 'center' }]}>{I18n.formatValue(startedTasks[0].dp.enable ? startedTasks[0].stringOff : startedTasks[0].stringOn,
|
|
191
|
+
style={[styles.activeTaskDesc, { textAlign: 'center' }]}>{I18n.formatValue(startedTasks[0].dp.enable ? startedTasks[0].stringOff : startedTasks[0].stringOn, timeFormatToRealTime(startedTasks[0].timeLeft))}</Text>
|
|
192
192
|
<Spacer height={cx(32)}/>
|
|
193
193
|
<TextButton
|
|
194
194
|
text={I18n.getLang('auto_scan_system_cancel')}
|
|
@@ -241,7 +241,7 @@ function ActiveTimerItem(task: TimerTask, onCancel: () => void) {
|
|
|
241
241
|
<Spacer/>
|
|
242
242
|
<View style={{ marginHorizontal: cx(20) }}>
|
|
243
243
|
<Text style={styles.activeTaskDesc}>{
|
|
244
|
-
I18n.formatValue(task.dp.enable ? task.stringOff : task.stringOn,
|
|
244
|
+
I18n.formatValue(task.dp.enable ? task.stringOff : task.stringOn, timeFormatToRealTime(task.timeLeft))
|
|
245
245
|
}</Text>
|
|
246
246
|
</View>
|
|
247
247
|
<Spacer height={cx(22)}/>
|
|
@@ -339,7 +339,7 @@ const styles = StyleSheet.create({
|
|
|
339
339
|
fontSize: cx(14),
|
|
340
340
|
},
|
|
341
341
|
activeTasBtn: {
|
|
342
|
-
width:
|
|
342
|
+
width: 'auto',
|
|
343
343
|
height: cx(36),
|
|
344
344
|
padding: 0,
|
|
345
345
|
backgroundColor: '#666',
|