leon 1 ano atrás
pai
commit
c82da81a30

+ 72 - 18
src/_record/pages/log_record.tsx

@@ -1,7 +1,7 @@
 import { View, Image, PageMeta, NavigationBar, Input, Textarea } from "@tarojs/components";
 import './log_record.scss'
 import { useEffect, useState } from "react";
-import Taro, { useRouter } from "@tarojs/taro";
+import Taro, { useRouter, useShareAppMessage } from "@tarojs/taro";
 import { rpxToPx } from "@/utils/tools";
 import { IconArrow, IconCheck, IconClose } from "@/components/basic/Icons";
 import { MainColorType } from "@/context/themes/color";
@@ -17,6 +17,7 @@ import { useSelector } from "react-redux";
 import { addEvents, addUserTag, createMoment, updateMoment, userTags } from "@/services/health";
 import PostMomentTime from "@/_health/components/post_moment_time";
 import ShareBtn from "@/components/basic/ShareBtn";
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 
 let useRoute;
 let useNavigation;
@@ -31,6 +32,7 @@ export default function LogRecord() {
     const long = useSelector((state: any) => state.long);
     const health = useSelector((state: any) => state.health);
     const record = useSelector((state: any) => state.record);
+    const user = useSelector((state: any) => state.user);
 
     const [title, setTitle] = useState('')
     const [chooseTitle, setChooseTitle] = useState('')
@@ -65,16 +67,45 @@ export default function LogRecord() {
         router = useRouter()
     }
 
-    const { event_id, is_temp, schedule_id, scenario, imgs } = router.params
+    const { event_id, is_temp, schedule_id, scenario, imgs ,only_text} = router.params
 
     const moment = router.params.moment ? JSON.parse(router.params.moment) : null
 
     const window = router.params.window ?? health.mode
     const [pics, setPics] = useState<any>(imgs ? JSON.parse(imgs) : [])
+    const [focus,setFocus] = useState(only_text?true:false)
+
+    if (process.env.TARO_ENV == 'weapp') {
+
+
+        useShareAppMessage((e) => {
+
+            var path;
+            if (result && result.event_id) {
+                var sharePath = `/_health/pages/timeline_detail?type=recent&fast_type=IF&event_id=${result.event_id}&uid=${user.id}&isfastsleep=${0}&disable_edit=1&enter_type=share`
+                if (user.isLogin) {
+                    sharePath += `&share_uid=${user.id}`
+                }
+                path = sharePath
+            }
+            else {
+                path = 'pages/clock/Clock'
+            }
+            return {
+                title: '分享标题',
+                path: path,
+                // imageUrl: shareUrl
+            }
+        })
+    }
+
 
     useEffect(() => {
         global.set_time = new Date().getTime()
         getTags()
+        if (router.params.check_in == 1){
+            setStep(0)
+        }
     }, [])
 
     function getTags() {
@@ -493,7 +524,7 @@ export default function LogRecord() {
         </View>
         <View style={{ height: navigationBarHeight }} />
         {
-            step == 0 && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(152) }}>
+            step == 0 && <View className="cardShowAni" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(152) }}>
                 <Image src={require('@assets/_health/eat.png')} style={{ width: rpxToPx(96), height: rpxToPx(96) }} />
                 <View className="h50 bold">选择打卡的{scenario == 'MEAL' ? '餐次' : '活动'}</View>
                 <View className="operate_bg">
@@ -501,21 +532,26 @@ export default function LogRecord() {
                         tags.map((item, index) => {
                             return <View key={index} className="operate_item h30 bold" onClick={() => {
                                 setChooseTitle(item.title)
+                                setPostCount(item.log_count + 1)
                                 setStep(2)
                             }}>{item.title}</View>
                         })
                     }
 
                     <View className="operate_item h30 bold" onClick={() => {
+                        setTitle('')
+                        setChooseTitle('')
+                        setPostCount(1)
                         setStep(1)
                     }}>自定义</View>
                 </View>
             </View>
         }
         {
-            step == 1 && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(152) }}>
+            step == 1 && <View className="cardShowAni" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(152) }}>
                 <View className="input_form">
                     <Input className="input_content h36" placeholder="请输入自定义名称" value={title}
+                        focus
                         onInput={(e: any) => {
                             setTitle(e.target.value)
                         }} />
@@ -527,6 +563,7 @@ export default function LogRecord() {
                             onClick={() => {
                                 if (title.length == 0) return
                                 setChooseTitle(title)
+                                setPostCount(1)
                                 setStep(2)
                                 addTag()
                             }}
@@ -540,17 +577,28 @@ export default function LogRecord() {
                 <View className="content_card">
                     <View style={{ display: 'flex', flexDirection: 'row' }} onClick={() => {
                         setStep(0)
+                        setFocus(false)
                     }}>
-                        <View className="sel_tag h34 bold">
-                            <View>{selPostCount}次</View>
-                            {chooseTitle}
+                        <View className="sel_tag">
+                            <View className="h34 bold">{selPostCount}</View>
+                            <View className="h34" style={{ marginLeft: rpxToPx(6) }}>次</View>
+                            <View style={{
+                                width: rpxToPx(2),
+                                height: rpxToPx(32),
+                                backgroundColor: '#000',
+                                opacity: 0.2,
+                                marginLeft: rpxToPx(12),
+                                marginRight: rpxToPx(12)
+                            }} />
+                            <View className="h34 bold">{chooseTitle}</View>
                             <View style={{ width: rpxToPx(6) }} />
-                            <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
+                            <IconArrow width={rpxToPx(34)} color='#000' />
                         </View>
                     </View>
                     <Textarea placeholder={t('health.add_text')} className="textarea2 h44 bold"
                         placeholder-style="color:rgba(0,0,0,0.2)"
                         value={desc}
+                        focus={focus}
                         onInput={e => {
                             setDesc(e.detail.value)
                         }} />
@@ -606,16 +654,16 @@ export default function LogRecord() {
                     <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
                     <View className="border_footer_line" style={{ left: rpxToPx(48) }} />
                 </View>
-                <View style={{ flex: 1,marginLeft:rpxToPx(52),marginTop:rpxToPx(35) }}>
-
-                <NewButton
-                    type={NewButtonType.fill}
-                    color={MainColorType.orange}
-                    width={rpxToPx(646)}
-                    height={rpxToPx(96)}
-                    title={t('health.log_moment')}
-                    onClick={save}
-                />
+                <View style={{ flex: 1, marginLeft: rpxToPx(52), marginTop: rpxToPx(35) }}>
+
+                    <NewButton
+                        type={NewButtonType.fill}
+                        color={MainColorType.orange}
+                        width={rpxToPx(646)}
+                        height={rpxToPx(96)}
+                        title={t('health.log_moment')}
+                        onClick={save}
+                    />
                 </View>
 
             </View>
@@ -694,6 +742,12 @@ export default function LogRecord() {
                     />
                 </ShareBtn>
 
+                <View className="h30" style={{ marginTop: rpxToPx(26), color: 'rgba(255,255,255,0.5)' }} onClick={() => {
+                    Taro.reLaunch({
+                        url: '/pages/moment/moment'
+                    })
+                }}>去搭子圈查看</View>
+
             </View>
         }
     </View>

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

@@ -31,6 +31,7 @@ export default function TimeRecord() {
     const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
     const navigationBarHeight = systemInfo.statusBarHeight + 44;
     const record = useSelector((state: any) => state.record);
+    const user = useSelector((state: any) => state.user);
     const [enterTime] = useState(new Date().getTime())
 
     const [showDatePicker, setShowDatePicker] = useState(false)
@@ -63,12 +64,27 @@ export default function TimeRecord() {
     }
 
     const { scenario } = router.params
+    
 
     if (process.env.TARO_ENV == 'weapp') {
+
+
         useShareAppMessage((e) => {
+
+            var path;
+            if (info && info.id) {
+                var sharePath = `/_health/pages/timeline_detail?type=recent&fast_type=IF&window_id=${info.id}&uid=${user.id}&isfastsleep=${0}&disable_edit=1&enter_type=share`
+                if (user.isLogin) {
+                    sharePath += `&share_uid=${user.id}`
+                }
+                path = sharePath
+            }
+            else {
+                path = 'pages/clock/Clock'
+            }
             return {
                 title: '分享标题',
-                path: 'pages/clock/Clock',
+                path: path,
                 imageUrl: shareUrl
             }
         })
@@ -521,7 +537,11 @@ export default function TimeRecord() {
                         color={MainColorType.orange}
                         onClick={end}
                     />
-                        <View onClick={more}>More</View>
+                        <NewButton
+                            type={NewButtonType.more}
+                            onClick={more}
+                        />
+                        {/* <View onClick={more}>More</View> */}
                     </View>
                 }
                 {

+ 34 - 0
src/pages/clock/components/choose_actions.scss

@@ -24,4 +24,38 @@
     align-items: center;
     justify-content: center;
     position: relative;
+}
+
+.cardShowAni {
+    animation: showAni 0.2s linear forwards;
+}
+
+.btnAni{
+    opacity: 0;
+    animation: showAni2 0.2s 0.5s linear forwards;
+}
+
+
+@keyframes showAni {
+    0% {
+        opacity: 0;
+        transform: translateY(300px);
+    }
+
+    100% {
+        opacity: 1;
+        transform: translateY(0px);
+    }
+}
+
+@keyframes showAni2 {
+    0% {
+        opacity: 0;
+        // transform: translateY(300px);
+    }
+
+    100% {
+        opacity: 1;
+        // transform: translateY(0px);
+    }
 }

+ 15 - 7
src/pages/clock/components/choose_actions.tsx

@@ -34,7 +34,12 @@ export default function ChooseActions(props: { close: any, scenario: string }) {
 
     function text() {
         props.close()
-        jumpPage(`/_record/pages/log_record?scenario=${props.scenario}`)
+        jumpPage(`/_record/pages/log_record?scenario=${props.scenario}&only_text=1`)
+    }
+
+    function checkin(){
+        props.close()
+        jumpPage(`/_record/pages/log_record?scenario=${props.scenario}&check_in=1`)
     }
 
     function addImage(isCamera) {
@@ -142,21 +147,24 @@ export default function ChooseActions(props: { close: any, scenario: string }) {
         });
     };
 
-    return <View className="actions_bg" onClick={props.close}>
+    return <View className="actions_bg" >
+        <NewButton type={NewButtonType.img} onClick={checkin}>
+            <View className='action_btn h30 bold cardShowAni'>check in</View>
+        </NewButton>
         <NewButton type={NewButtonType.img} onClick={camera}>
-            <View className='action_btn h30 bold'>take a photo</View>
+            <View className='action_btn h30 bold cardShowAni'>take a photo</View>
         </NewButton>
         <NewButton type={NewButtonType.img} onClick={album}>
-            <View className='action_btn h30 bold'>Choose from photos</View>
+            <View className='action_btn h30 bold cardShowAni'>Choose from photos</View>
         </NewButton>
         <NewButton type={NewButtonType.img} onClick={chat}>
-            <View className='action_btn h30 bold'>Import from chats</View>
+            <View className='action_btn h30 bold cardShowAni'>Import from chats</View>
         </NewButton>
         <NewButton type={NewButtonType.img} onClick={text}>
-            <View className='action_btn h30 bold'>Only text</View>
+            <View className='action_btn h30 bold cardShowAni'>Only text</View>
         </NewButton>
 
-        <View style={{ marginBottom: rpxToPx(84), marginTop: rpxToPx(60) }}>
+        <View className='btnAni' style={{ marginBottom: rpxToPx(84), marginTop: rpxToPx(60) }} onClick={props.close}>
             <IconClose color="#fff" width={rpxToPx(64)} height={rpxToPx(64)} />
         </View>
     </View>