|
|
@@ -2,16 +2,23 @@ import Buttons from "@/components/Buttons";
|
|
|
import { setPlan } from "@/services/trackTimeDuration";
|
|
|
import { setScenario, setStep } from "@/store/scenario";
|
|
|
import { View, Text } from "@tarojs/components";
|
|
|
-import { Picker } from '@tarojs/components'
|
|
|
-import Taro from "@tarojs/taro";
|
|
|
+import "./SetSchedule.scss";
|
|
|
+import Taro, { useReady } from "@tarojs/taro";
|
|
|
import TimePickers from "@/components/TimePickers";
|
|
|
// import { AtList, AtListItem } from 'taro-ui'
|
|
|
import { useState } from "react";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
+import Footer from "@/components/Footer";
|
|
|
+import PickerViews from "@/components/PickerViews";
|
|
|
+import { AtFloatLayout } from "taro-ui";
|
|
|
+import "taro-ui/dist/style/components/float-layout.scss";
|
|
|
+import { pickerDurations } from "../hooks/Console";
|
|
|
|
|
|
export default function Component() {
|
|
|
const dispatch = useDispatch();
|
|
|
const scenario = useSelector((state: any) => state.scenario);
|
|
|
+ const [pickerValue, setPickerValue] = useState(0)
|
|
|
+ const [isOpen, setIsOpen] = useState(false)
|
|
|
var scheduleObj: { start_time: any; end_time: any; };
|
|
|
if (scenario.name == 'FAST') {
|
|
|
scheduleObj = scenario.schedule.fast
|
|
|
@@ -92,11 +99,61 @@ export default function Component() {
|
|
|
setEndTime(e)
|
|
|
}
|
|
|
|
|
|
+ useReady(() => {
|
|
|
+ var title = scenario.step == 'fast' ? 'Fast schedule' : 'Sleep schedule'
|
|
|
+ Taro.setNavigationBarTitle({
|
|
|
+ title: title
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ function showPicker() {
|
|
|
+ setIsOpen(true)
|
|
|
+ }
|
|
|
+
|
|
|
+ function durationChange(e) {
|
|
|
+ var count = e[0] * 5 + 60;
|
|
|
+ setPickerValue(e[0])
|
|
|
+ }
|
|
|
+
|
|
|
+ function layoutContent() {
|
|
|
+ return <View style={{color:'#000'}}>
|
|
|
+ <Text>11111</Text>
|
|
|
+ <PickerViews onChange={durationChange} items={[pickerDurations()]} value={[pickerValue]} height={200}/>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
return <View >
|
|
|
- <Text>场景名称{scenario.name}</Text>
|
|
|
- <TimePickers time={startTime} content={'开始时间' + startTime} change={onStartTimeChange} />
|
|
|
- <TimePickers time={endTime} content={'结束时间' + endTime} change={onEndTimeChange} />
|
|
|
+ {/* <Text>场景名称{scenario.name}</Text> */}
|
|
|
+
|
|
|
+ <View className="box">
|
|
|
+ <View className="header">
|
|
|
+ <View className="item">
|
|
|
+ <TimePickers time={startTime} content={scenario.step == 'fast' ? 'Fast starts\n' + startTime : 'Sleep starts\n' + startTime} change={onStartTimeChange} />
|
|
|
+ </View>
|
|
|
+ <View className="item">
|
|
|
+ <TimePickers time={endTime} content={scenario.step == 'fast' ? 'Fast ends\n' + endTime : 'Sleep ends\n' + endTime} change={onEndTimeChange} />
|
|
|
+ </View>
|
|
|
+
|
|
|
+
|
|
|
+ </View>
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
+ <Text className="duration" onClick={()=>{setIsOpen(true)}}>16 hours 00 mins</Text>
|
|
|
+ </View>
|
|
|
+
|
|
|
+ {/* <Footer child={
|
|
|
+ <Buttons title={scenario.step == 'fast' ? 'Set fast schedule' : 'Set sleep schedule'} style={{ backgroundColor: scenario.step == 'fast' ? '#AAFF00' : '#00ffff', width: 320 }} onClick={() => start()}></Buttons>
|
|
|
+ } /> */}
|
|
|
+
|
|
|
+ <AtFloatLayout
|
|
|
+ isOpened={isOpen}
|
|
|
+ onClose={() => {
|
|
|
+ setIsOpen(false)
|
|
|
+ }}
|
|
|
+ title="111">
|
|
|
+ {
|
|
|
+ layoutContent()
|
|
|
+ }
|
|
|
+ </AtFloatLayout>
|
|
|
|
|
|
- <Buttons title="Start" onClick={() => start()}></Buttons>
|
|
|
</View>;
|
|
|
}
|