leon vor 1 Jahr
Ursprung
Commit
f022330037
3 geänderte Dateien mit 94 neuen und 44 gelöschten Zeilen
  1. 13 0
      src/_record/pages/time_record.scss
  2. 25 2
      src/_record/pages/time_record.tsx
  3. 56 42
      src/pages/clock/ClockIndex.tsx

+ 13 - 0
src/_record/pages/time_record.scss

@@ -64,4 +64,17 @@ page {
     display: flex;
     align-items: center;
     justify-content: center;
+}
+
+.operate_content{
+    display: flex;
+    flex-direction: row;
+    margin-bottom: 40px;
+}
+
+.operate_item{
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    width: 320px;
 }

+ 25 - 2
src/_record/pages/time_record.tsx

@@ -97,6 +97,18 @@ export default function TimeRecord() {
                     }}
                 />
             </View>
+            <View className="operate_content">
+                <View className="operate_item">
+                    <View className="g02 h24">STARTED</View>
+                    <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>今天 13:54</View>
+                    <View className="h30 bold" style={{ color: MainColorType.orange }}>Edit Start</View>
+                </View>
+                <View className="operate_item">
+                    <View className="g02 h24">STARTED</View>
+                    <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>今天 13:54</View>
+                    <View className="h30 bold" style={{ color: MainColorType.orange }}>Edit Start</View>
+                </View>
+            </View>
             <NewButton
                 type={NewButtonType.fill}
                 title="Start fasting"
@@ -106,9 +118,9 @@ export default function TimeRecord() {
             />
         </View>
 
-        <View className="eat_card" onClick={()=>{
+        <View className="eat_card" onClick={() => {
             Taro.redirectTo({
-                url:'./log_record'
+                url: './log_record'
             })
         }}>
             <View className="h30 bold">Or share your meals</View>
@@ -118,6 +130,17 @@ export default function TimeRecord() {
             </View>
         </View>
 
+        <View className="eat_card" style={{height:rpxToPx(120)}} onClick={() => {
+            Taro.redirectTo({
+                url: './log_record'
+            })
+        }}>
+            <View className="h24 g02" style={{ marginTop: rpxToPx(12) }}>How are you feeling?</View>
+            <View className="eat_card_arrow">
+                <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
+            </View>
+        </View>
+
 
         <View className="time_card_bg">
             <View className="time_card" onClick={tapStart}>

+ 56 - 42
src/pages/clock/ClockIndex.tsx

@@ -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} />