|
|
@@ -23,7 +23,7 @@ if (process.env.TARO_ENV == 'rn') {
|
|
|
let operateType = ''
|
|
|
let min = 0
|
|
|
let max = 0
|
|
|
-let current = 0
|
|
|
+let defaultTimestamp = 0
|
|
|
let isTimeout = false
|
|
|
export default function IndexConsole(props: { record: any }) {
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
@@ -37,7 +37,7 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
const common = useSelector((state: any) => state.common);
|
|
|
const [firstEnter, setFirstEnter] = useState(true);
|
|
|
const [showTimePicker, setShowTimePicker] = useState(false);
|
|
|
- const dayMillionSeconds = 24 * 3600 * 1000;
|
|
|
+ const dayMilliSeconds = 24 * 3600 * 1000;
|
|
|
const [btnDisable, setBtnDisable] = useState(false)
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
@@ -47,6 +47,7 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
let navigation;
|
|
|
if (useNavigation) {
|
|
|
navigation = useNavigation()
|
|
|
+ var date = new Date()
|
|
|
}
|
|
|
|
|
|
useDidShow(() => {
|
|
|
@@ -84,9 +85,9 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
global.pauseIndexTimer = true
|
|
|
global.set_time = new Date().getTime()
|
|
|
|
|
|
- current = new Date().getTime()
|
|
|
- min = current - 6 * 24 * 3600 * 1000
|
|
|
- max = current
|
|
|
+ defaultTimestamp = new Date().getTime()
|
|
|
+ min = defaultTimestamp - 6 * 24 * 3600 * 1000
|
|
|
+ max = defaultTimestamp
|
|
|
isTimeout = false
|
|
|
|
|
|
setShowTimePicker(true)
|
|
|
@@ -119,25 +120,28 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
|
|
|
isTimeout = false
|
|
|
if (props.record.scenario.name == 'SLEEP') {
|
|
|
- current = new Date().getTime()
|
|
|
- min = current - 6 * dayMillionSeconds
|
|
|
- max = current
|
|
|
+ defaultTimestamp = new Date().getTime()
|
|
|
+ min = defaultTimestamp - 6 * dayMilliSeconds
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
else {
|
|
|
//todolist
|
|
|
var now = new Date().getTime()
|
|
|
var last_check_time = props.record.current_record.last_real_check_time
|
|
|
- if (now - last_check_time >= dayMillionSeconds) {
|
|
|
+ if (now - last_check_time >= dayMilliSeconds) {
|
|
|
//ongoing1 严重超时单独处理
|
|
|
- var schedule_start_time = props.record.current_record.sleep.target_start_time
|
|
|
- current = Math.min(now, schedule_start_time)
|
|
|
- min = Math.max(last_check_time, schedule_start_time - 3 * dayMillionSeconds)
|
|
|
- max = Math.min(now, schedule_start_time + 3 * dayMillionSeconds)
|
|
|
+ // var schedule_start_time = props.record.current_record.sleep.target_start_time
|
|
|
+ // defaultTimestamp = Math.min(now, schedule_start_time)
|
|
|
+ // min = Math.max(last_check_time, schedule_start_time - 3 * dayMillionSeconds)
|
|
|
+ // max = Math.min(now, schedule_start_time + 3 * dayMillionSeconds)
|
|
|
+ defaultTimestamp = now
|
|
|
+ min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
else {
|
|
|
- current = now
|
|
|
- min = Math.max(last_check_time, current - 6 * dayMillionSeconds)
|
|
|
- max = current
|
|
|
+ defaultTimestamp = now
|
|
|
+ min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -172,18 +176,21 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
var real_start_time = props.record.current_record.sleep.real_start_time
|
|
|
var last_check_time = props.record.current_record.last_real_check_time
|
|
|
var now = new Date().getTime()
|
|
|
- if (now - real_start_time >= dayMillionSeconds) {
|
|
|
+ if (now - real_start_time >= dayMilliSeconds) {
|
|
|
//严重超时
|
|
|
isTimeout = true
|
|
|
- current = props.record.current_record.sleep.target_end_time
|
|
|
- min = Math.max(last_check_time, current - 3 * dayMillionSeconds)
|
|
|
- max = Math.min(now, current + 3 * dayMillionSeconds)
|
|
|
+ // defaultTimestamp = Math.min(props.record.current_record.sleep.target_end_time, now)
|
|
|
+ // min = Math.max(last_check_time, defaultTimestamp - 3 * dayMillionSeconds)
|
|
|
+ // max = Math.min(now, defaultTimestamp + 3 * dayMillionSeconds)
|
|
|
+ defaultTimestamp = now
|
|
|
+ min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
else {
|
|
|
isTimeout = false
|
|
|
- current = now
|
|
|
- min = Math.max(last_check_time, current - 6 * dayMillionSeconds)
|
|
|
- max = current
|
|
|
+ defaultTimestamp = now
|
|
|
+ min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
|
|
|
setShowTimePicker(true)
|
|
|
@@ -219,18 +226,22 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
var real_start_time = props.record.current_record.fast.real_start_time
|
|
|
var last_check_time = props.record.current_record.last_real_check_time
|
|
|
var now = new Date().getTime()
|
|
|
- if (now - real_start_time >= dayMillionSeconds) {
|
|
|
+ if (now - real_start_time >= dayMilliSeconds) {
|
|
|
//严重超时
|
|
|
isTimeout = true
|
|
|
- current = props.record.current_record.fast.target_end_time
|
|
|
- min = Math.max(last_check_time, current - 3 * dayMillionSeconds)
|
|
|
- max = Math.min(now, current + 3 * dayMillionSeconds)
|
|
|
+ // defaultTimestamp = Math.min(props.record.current_record.fast.target_end_time, now)
|
|
|
+ // min = Math.max(last_check_time, defaultTimestamp - 3 * dayMillionSeconds)
|
|
|
+ // max = Math.min(now, defaultTimestamp + 3 * dayMillionSeconds)
|
|
|
+ // debugger
|
|
|
+ defaultTimestamp = now
|
|
|
+ min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
else {
|
|
|
isTimeout = false
|
|
|
- current = now
|
|
|
- min = Math.max(last_check_time, current - 6 * dayMillionSeconds)
|
|
|
- max = current
|
|
|
+ defaultTimestamp = now
|
|
|
+ min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
|
|
|
+ max = defaultTimestamp
|
|
|
}
|
|
|
|
|
|
setShowTimePicker(true)
|
|
|
@@ -323,7 +334,7 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
onCancel={hidePicker}
|
|
|
min={min}
|
|
|
max={max}
|
|
|
- current={current}
|
|
|
+ current={defaultTimestamp}
|
|
|
duration={duration}
|
|
|
endTimestamp={endTimestamp}
|
|
|
isFast={operateType == 'startFast' || operateType == 'endFast'}
|
|
|
@@ -448,7 +459,7 @@ export default function IndexConsole(props: { record: any }) {
|
|
|
setFirstEnter(false)
|
|
|
hidePicker()
|
|
|
setBtnDisable(false)
|
|
|
-
|
|
|
+
|
|
|
if (permission.wxPubFollow) {
|
|
|
Taro.showModal({
|
|
|
title: t('feature.track_time_duration.reminders.wake_title'),
|