|
@@ -5,13 +5,55 @@ import Segment from '@/components/navigation/Segment';
|
|
|
import TimelineFastSleep from './TimelineFastSleep';
|
|
import TimelineFastSleep from './TimelineFastSleep';
|
|
|
import Stage from './Stage';
|
|
import Stage from './Stage';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
+import Switch from '@/components/input/Switch';
|
|
|
|
|
+import { useSelector } from 'react-redux';
|
|
|
|
|
+import Taro from '@tarojs/taro';
|
|
|
|
|
|
|
|
|
|
|
|
|
-export default function Component(props: { data: any, title?: string, subTitle?: string,isSchedule?:boolean }) {
|
|
|
|
|
|
|
+export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean }) {
|
|
|
const [segmentIndex, setSegmentIndex] = useState(0)
|
|
const [segmentIndex, setSegmentIndex] = useState(0)
|
|
|
- const {t} = useTranslation()
|
|
|
|
|
|
|
+ const permission = useSelector((state: any) => state.permission);
|
|
|
|
|
+ const common = useSelector((state: any) => state.common);
|
|
|
|
|
+ const { t } = useTranslation()
|
|
|
|
|
+
|
|
|
|
|
+ function followWxPub() {
|
|
|
|
|
+ const resource = common.resources.filter((item: any) => {
|
|
|
|
|
+ return item.code == 'follow_wx_pub'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const title = permission.wxPubFollow ?t('feature.track_time_duration.follow_wx_pub.h5_followed_title'):
|
|
|
|
|
+ t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
|
|
|
|
|
+
|
|
|
|
|
+ Taro.showModal({
|
|
|
|
|
+ title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
|
|
|
|
|
+ t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
|
|
|
|
|
+ content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
|
|
|
|
|
+ t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
|
|
|
|
|
+ showCancel: true,
|
|
|
|
|
+ cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
|
|
|
|
|
+ t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
|
|
|
|
|
+ confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
|
|
|
|
|
+ t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
|
|
|
|
|
+ success(result) {
|
|
|
|
|
+ if (result.confirm) {
|
|
|
|
|
+ global.forceRefreshWXPub = true
|
|
|
|
|
+ Taro.navigateTo({
|
|
|
|
|
+ url: '/pages/common/H5?title=' + title + '&url=' + resource[0].url,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return <View style={{ display: 'flex', flexDirection: 'column', width: '578rpx' }}>
|
|
return <View style={{ display: 'flex', flexDirection: 'column', width: '578rpx' }}>
|
|
|
- <Text className='box_title'>{props.title ? props.title : 'Title'}</Text>
|
|
|
|
|
|
|
+ {/* <Text className='box_title'>{props.title ? props.title : 'Title'}</Text> */}
|
|
|
|
|
+ <View className="box_header" style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
|
|
|
|
|
+ <Text className="box_title" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{props.title ? props.title : 'Title'}</Text>
|
|
|
|
|
+ {
|
|
|
|
|
+ props.isSchedule &&
|
|
|
|
|
+ <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
<Text className='box_subtitle'>{props.subTitle ? props.subTitle : 'subTitle'}</Text>
|
|
<Text className='box_subtitle'>{props.subTitle ? props.subTitle : 'subTitle'}</Text>
|
|
|
<View className="segment_detail" style={{
|
|
<View className="segment_detail" style={{
|
|
|
display: 'flex', alignItems: 'center',
|
|
display: 'flex', alignItems: 'center',
|
|
@@ -31,7 +73,7 @@ export default function Component(props: { data: any, title?: string, subTitle?:
|
|
|
<View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
|
|
<View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
|
|
|
<TimelineFastSleep data={props.data} />
|
|
<TimelineFastSleep data={props.data} />
|
|
|
</View>
|
|
</View>
|
|
|
- {props.data.scenario == 'FAST_SLEEP' &&<View style={{
|
|
|
|
|
|
|
+ {props.data.scenario == 'FAST_SLEEP' && <View style={{
|
|
|
opacity: segmentIndex == 1 ? 1 : 0,
|
|
opacity: segmentIndex == 1 ? 1 : 0,
|
|
|
position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
|
|
position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
|
|
|
}}>
|
|
}}>
|
|
@@ -57,8 +99,8 @@ export default function Component(props: { data: any, title?: string, subTitle?:
|
|
|
{
|
|
{
|
|
|
props.data.scenario == 'FAST_SLEEP' &&
|
|
props.data.scenario == 'FAST_SLEEP' &&
|
|
|
<View style={{ marginBottom: 0 }}>
|
|
<View style={{ marginBottom: 0 }}>
|
|
|
- <Segment titles={[props.isSchedule?t('feature.track_time_duration.schedule.timeline'):
|
|
|
|
|
- t('feature.track_time_duration.record_fast_sleep.timeline'),
|
|
|
|
|
|
|
+ <Segment titles={[props.isSchedule ? t('feature.track_time_duration.schedule.timeline') :
|
|
|
|
|
+ t('feature.track_time_duration.record_fast_sleep.timeline'),
|
|
|
t('feature.track_time_duration.schedule.stage')]} changed={(e) => {
|
|
t('feature.track_time_duration.schedule.stage')]} changed={(e) => {
|
|
|
setSegmentIndex(e);
|
|
setSegmentIndex(e);
|
|
|
global.segmentIndex = e
|
|
global.segmentIndex = e
|