|
|
@@ -17,17 +17,16 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import { IconAdd } from "@/components/basic/Icons";
|
|
|
import AddLabel from "../components/add_label";
|
|
|
import ScheduleItem from "../components/schedule_item";
|
|
|
+import { useTranslation } from "react-i18next";
|
|
|
|
|
|
export default function GuideActive() {
|
|
|
const health = useSelector((state: any) => state.health);
|
|
|
const [list,setList] = useState<any>(health.schedules)
|
|
|
const [errors, setErrors] = useState<any>([])
|
|
|
const [highlight, setHighlight] = useState(true)
|
|
|
-
|
|
|
- const [selItem, setSelItem] = useState<any>(null)
|
|
|
- const [showTimePicker, setShowTimePicker] = useState(false)
|
|
|
const [showModal, setShowModal] = useState(false)
|
|
|
const [labels, setLabels] = useState<any>([])
|
|
|
+ const {t} = useTranslation()
|
|
|
|
|
|
const dispatch = useDispatch()
|
|
|
const selMode = 'ACTIVE'
|
|
|
@@ -41,57 +40,6 @@ export default function GuideActive() {
|
|
|
}, 2000)
|
|
|
}, [])
|
|
|
|
|
|
- function itemStyle(obj) {
|
|
|
- if (obj.is_conflict) {
|
|
|
- return {
|
|
|
- backgroundColor: '#FF00001A',
|
|
|
- color: '#FF0000'
|
|
|
- }
|
|
|
- }
|
|
|
- if (errors.length > 0) {
|
|
|
- return {
|
|
|
- backgroundColor: '#B2B2B21A',
|
|
|
- color: '#000'
|
|
|
- }
|
|
|
- }
|
|
|
- return {
|
|
|
- backgroundColor: obj.window == selMode ? getThemeColor(selMode) + '1A' : '#B2B2B21A',
|
|
|
- color: obj.window == selMode ? getThemeColor(selMode) : '#000'
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function modalContent() {
|
|
|
- const strTime = selItem.time
|
|
|
-
|
|
|
- var title = selItem.title
|
|
|
- var color = getThemeColor(selItem.window)
|
|
|
-
|
|
|
- return <TimePicker time={strTime}
|
|
|
- color={color}
|
|
|
- title={title}
|
|
|
- confirm={(e) => {
|
|
|
- // selItem.time = e
|
|
|
- setSelItem(selItem)
|
|
|
- setShowTimePicker(false)
|
|
|
- var array = JSON.parse(JSON.stringify(list))
|
|
|
- array.map(item => {
|
|
|
- if (item.id == selItem.id) {
|
|
|
- item.time = e
|
|
|
- item.op_ms = new Date().getTime()
|
|
|
- }
|
|
|
- })
|
|
|
- setList(array)
|
|
|
- check(array)
|
|
|
- // var array = JSON.parse(JSON.stringify(list))
|
|
|
- // array[selIndex].time = e
|
|
|
- // setList(array)
|
|
|
- // checkData(array)
|
|
|
- }}
|
|
|
- cancel={() => {
|
|
|
- setShowTimePicker(false)
|
|
|
- }} />
|
|
|
- }
|
|
|
-
|
|
|
function check(array, tapDone = false) {
|
|
|
createSchedule({
|
|
|
schedules: array,
|
|
|
@@ -168,41 +116,12 @@ export default function GuideActive() {
|
|
|
check(array)
|
|
|
}}
|
|
|
/>
|
|
|
- // return <View className='schedule_item' key={i} style={{
|
|
|
- // width: rpxToPx(700),
|
|
|
- // boxSizing: 'border-box',
|
|
|
- // backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
|
|
|
-
|
|
|
- // }}>
|
|
|
- // <View className='item_left2'>
|
|
|
- // <View className='item_index'>
|
|
|
- // <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
|
|
|
- // </View>
|
|
|
- // <Text className='item_name'>{obj.title}</Text>
|
|
|
- // <View style={{ flex: 1 }} />
|
|
|
- // {
|
|
|
- // obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
|
|
|
- // }
|
|
|
- // {
|
|
|
- // !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
|
|
|
- // }
|
|
|
- // {
|
|
|
- // !obj.is_all_day && <View className='edit_item_time' onClick={() => {
|
|
|
- // setSelIndex(i)
|
|
|
- // setSelItem(obj)
|
|
|
- // setShowTimePicker(true)
|
|
|
- // }} style={itemStyle(obj)}>{obj.time}</View>
|
|
|
- // }
|
|
|
-
|
|
|
- // <View className='border_footer_line' />
|
|
|
- // </View>
|
|
|
- // </View>
|
|
|
})
|
|
|
}
|
|
|
<View className='item_add'
|
|
|
onClick={() => add()}>
|
|
|
<IconAdd color={MainColorType.eat} width={rpxToPx(34)} />
|
|
|
- <View className='toolbar_btn' style={{ color: MainColorType.eat }} >添加</View>
|
|
|
+ <View className='toolbar_btn' style={{ color: MainColorType.active }} >{t('health.add_active')}</View>
|
|
|
<View style={{ flex: 1 }} />
|
|
|
</View>
|
|
|
</Card>
|
|
|
@@ -235,43 +154,12 @@ export default function GuideActive() {
|
|
|
check(array)
|
|
|
}}
|
|
|
/>
|
|
|
- // return <View className='schedule_item' key={i} style={{
|
|
|
- // width: rpxToPx(700),
|
|
|
- // boxSizing: 'border-box',
|
|
|
- // backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
|
|
|
-
|
|
|
- // }}>
|
|
|
- // <View className='item_left2'>
|
|
|
- // <View className='item_index'>
|
|
|
- // <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
|
|
|
- // </View>
|
|
|
- // <Text className='item_name'>{obj.title}</Text>
|
|
|
- // <View style={{ flex: 1 }} />
|
|
|
- // {
|
|
|
- // obj.is_conflict && <Text className="conflict_tip">时间冲突,请调整</Text>
|
|
|
- // }
|
|
|
- // {
|
|
|
- // !obj.is_all_day && !obj.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
|
|
|
- // }
|
|
|
- // {
|
|
|
- // !obj.is_all_day && <View className='edit_item_time' onClick={() => {
|
|
|
- // setSelIndex(i)
|
|
|
- // setSelItem(obj)
|
|
|
- // setShowTimePicker(true)
|
|
|
- // }} style={itemStyle(obj)}>{obj.time}</View>
|
|
|
- // }
|
|
|
-
|
|
|
- // {
|
|
|
- // i < items.length - 1 && <View className='border_footer_line' />
|
|
|
- // }
|
|
|
- // </View>
|
|
|
- // </View>
|
|
|
})
|
|
|
}
|
|
|
</Card>
|
|
|
}
|
|
|
return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
|
|
|
- <NewHeader type={NewHeaderType.center_subtitle} title="保持活跃" subtitle="我的活动日程" />
|
|
|
+ <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_3_title')} subtitle={t('health.guide_3_desc')} />
|
|
|
{
|
|
|
items()
|
|
|
}
|
|
|
@@ -294,20 +182,6 @@ export default function GuideActive() {
|
|
|
}}
|
|
|
/>
|
|
|
</View>
|
|
|
- {
|
|
|
- showTimePicker && <Modal
|
|
|
- testInfo={null}
|
|
|
- dismiss={() => {
|
|
|
- setShowTimePicker(false)
|
|
|
- }}
|
|
|
- confirm={() => {
|
|
|
-
|
|
|
- }}>
|
|
|
- {
|
|
|
- modalContent()
|
|
|
- }
|
|
|
- </Modal>
|
|
|
- }
|
|
|
|
|
|
{
|
|
|
showModal && <Modal testInfo={null}
|