|
|
@@ -14,12 +14,54 @@ export default function ClockIndex() {
|
|
|
const dispatch = useDispatch();
|
|
|
global.dispatch = dispatch;
|
|
|
|
|
|
+ const list = [{
|
|
|
+ title: '饮食',
|
|
|
+ icon: '',
|
|
|
+ scenario: 'EAT'
|
|
|
+ }, {
|
|
|
+ title: '锻炼',
|
|
|
+ icon: '',
|
|
|
+ scenario: 'ACTIVE'
|
|
|
+ }, {
|
|
|
+ title: '断食',
|
|
|
+ icon: '',
|
|
|
+ scenario: 'FAST'
|
|
|
+ }, {
|
|
|
+ title: '睡眠',
|
|
|
+ icon: '',
|
|
|
+ scenario: 'SLEEP'
|
|
|
+ }, {
|
|
|
+ title: '指标',
|
|
|
+ icon: '',
|
|
|
+ scenario: 'METRIC'
|
|
|
+ }]
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
homeInfo().then(res => {
|
|
|
|
|
|
})
|
|
|
}, [user.isLogin])
|
|
|
|
|
|
+ function tapItem(index) {
|
|
|
+ if (!user.isLogin) {
|
|
|
+ jumpPage('/_account/pages/ChooseAuth')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ case 1:
|
|
|
+ jumpPage('/_record/pages/log_record')
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+ jumpPage('/_record/pages/time_record')
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ jumpPage('/_record/pages/metric_record')
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
return <View><View
|
|
|
onClick={() => {
|
|
|
@@ -33,49 +75,21 @@ export default function ClockIndex() {
|
|
|
<View className="h60 bold" style={{ marginLeft: rpxToPx(52) }}>早上好</View>
|
|
|
<View className="h44 bold" style={{ marginLeft: rpxToPx(52), marginTop: rpxToPx(66), marginBottom: rpxToPx(58) }}>打卡</View>
|
|
|
<View className="operate_panel">
|
|
|
- <View className="operate_card" onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/_account/pages/ChooseAuth')
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_record/pages/log_record')
|
|
|
- }}>
|
|
|
- <View className="h36 bold">饮食</View>
|
|
|
- <View style={{ flex: 1 }} />
|
|
|
- <View style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
|
- <IconNext width={rpxToPx(36)} color="#000" />
|
|
|
- <IconNext width={rpxToPx(36)} color="#000" />
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- <View className="operate_card" onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/_account/pages/ChooseAuth')
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_record/pages/log_record')
|
|
|
- }}></View>
|
|
|
- <View className="operate_card" onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/_account/pages/ChooseAuth')
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_record/pages/time_record')
|
|
|
- }}></View>
|
|
|
- <View className="operate_card" onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/_account/pages/ChooseAuth')
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_record/pages/time_record')
|
|
|
- }}></View>
|
|
|
+ {
|
|
|
+ list.map((item, index) => {
|
|
|
+ return <View key={index} className="operate_card" onClick={() => {
|
|
|
+ tapItem(index)
|
|
|
|
|
|
- <View className="operate_card" onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/_account/pages/ChooseAuth')
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_record/pages/metric_record')
|
|
|
- }}></View>
|
|
|
+ }}>
|
|
|
+ <View className="h36 bold">{item.title}</View>
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
+ <View style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
|
+ <IconNext width={rpxToPx(36)} color="#000" />
|
|
|
+ <IconNext width={rpxToPx(36)} color="#000" />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ })
|
|
|
+ }
|
|
|
</View>
|
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={0} />
|