leon 1 rok pred
rodič
commit
da821ab4b2

+ 28 - 8
src/_health/pages/log_time.tsx

@@ -68,6 +68,7 @@ export default function LogTime() {
     const [loaded, setLoaded] = useState(false)
     const [autoCheck, setAutoCheck] = useState(false)
     const [initCheck, setInitCheck] = useState(router.params.initCheck == '1')
+    const [initSeconds,setInitSeconds] = useState(router.params.initCheck == '1') //初始化时,带入打卡时的秒数
     const [count, setCount] = useState(0)
 
     const [ignoreCheck, setIgnoreCheck] = useState(false)
@@ -75,14 +76,7 @@ export default function LogTime() {
 
 
 
-
-
-
     useEffect(() => {
-        // if (isSingle) {
-
-        // }
-
         loadData()
 
         var now = new Date()
@@ -95,7 +89,6 @@ export default function LogTime() {
         t2 += 24 * 3600 * 1000
         var left = t2 - t + 500
 
-        //前端待处理,日期更新
         setTimeout(() => {
             setCount(count => count + 1)
             setArray(array => {
@@ -337,7 +330,30 @@ export default function LogTime() {
     }
 
     function getTimestamp(obj) {
+        const {event_id} = obj
+        var tempObj:any = null
+
+        if (data.fast){
+            data.fast.timeline.map((item)=>{
+                if (item.event_id == event_id){
+                    tempObj = item
+                }
+            })
+        }
+        if (data.sleep){
+            data.sleep.timeline.map((item)=>{
+                if (item.event_id == event_id){
+                    tempObj = item
+                }
+            })
+        }
+        
         var time = obj.time
+        if (tempObj && tempObj.real && dayjs(tempObj.real.timestamp).format('YYYY-MM-DDTHH:mm')==obj.date + 'T' + time){
+            debugger
+            return tempObj.real.timestamp
+        }
+        
         // var hour = parseInt(time.split(':')[0])
         // var minute = parseInt(time.split(':')[1])
         // var date = obj.date
@@ -518,6 +534,7 @@ export default function LogTime() {
     }
 
     function commit(list, onlyCheck, save_confirm) {
+        debugger
         const sortedData = list.sort((a, b) => {
             return b.extra.confirm_time - a.extra.confirm_time; // 降序
         });
@@ -552,6 +569,9 @@ export default function LogTime() {
         if (posting) return
         setPosting(true)
         clockTimes(params).then(res => {
+            if (onlyCheck){
+                setRequestId(new Date().getTime())
+            }
 
             if ((res as any).result) {
                 setErrors([])

+ 7 - 5
src/_health/pages/timeline_detail.tsx

@@ -78,7 +78,7 @@ export default function TimelineDetail() {
         router = useRouter()
     }
 
-    const { schedule_id, event_id, window_id, isfastsleep, islongfast, disable_edit } = router.params
+    const { schedule_id, event_id, window_id, isfastsleep, islongfast, disable_edit, uid } = router.params
 
 
     if (process.env.TARO_ENV == 'weapp') {
@@ -108,10 +108,12 @@ export default function TimelineDetail() {
 
                 }
             }
+            var imgs = imgList()
+            var imageUrl = imgs.length > 0 ? imgs[0] : 'https://background-pictures.oss-cn-beijing.aliyuncs.com/windows/eat2.jpg'
             return {
                 title: title,
-                path: `/_health/pages/timeline_detail?type=${router.params.type}&schedule_id=${schedule_id}&window_id=${window_id}&event_id=${event_id}&uid=${user.id}&isfastsleep=${isfastsleep}&disable_edit=1&enter_type=share`,
-                imageUrl: 'https://background-pictures.oss-cn-beijing.aliyuncs.com/windows/eat2.jpg'
+                path: `/_health/pages/timeline_detail?type=${router.params.type}&schedule_id=${schedule_id}&window_id=${window_id}&event_id=${event_id}&uid=${uid ?? user.id}&isfastsleep=${isfastsleep}&disable_edit=1&enter_type=share`,
+                imageUrl: imageUrl
             }
         })
     }
@@ -725,9 +727,9 @@ export default function TimelineDetail() {
                         <Text className="h24 g02">{footerTime(publish)}</Text>
                         <View style={{ flex: 1 }} />
                         <View className="share_btn_bg">
-                            
+
                             <View className="share_icon_bg">
-                                <IconShare color={MainColorType.link+'cc'} width={rpxToPx(32)}/>
+                                <IconShare color={MainColorType.link + 'cc'} width={rpxToPx(32)} />
                             </View>
                             <Button className="share_btn" openType="share">1</Button>
                         </View>

+ 7 - 5
src/pages/account/JournalDetail.tsx

@@ -97,11 +97,13 @@ export default function JournalDetail() {
             else if (router.params.window == 'ACTIVE') {
                 title = t('health.share_my_activity_journal')
             }
-            debugger
+            const uid = router.params.uid
+
+            var imageUrl = imgs.length > 0 ? imgs[0] : 'https://background-pictures.oss-cn-beijing.aliyuncs.com/windows/eat2.jpg'
             return {
                 title: title,
-                path: `pages/account/JournalDetail?date=${date}&uid=${user.id}&window=${router.params.window}`,
-                imageUrl: 'https://background-pictures.oss-cn-beijing.aliyuncs.com/windows/eat2.jpg'
+                path: `pages/account/JournalDetail?date=${date}&uid=${uid ?? user.id}&window=${router.params.window}`,
+                imageUrl: imageUrl
                 // imageUrl:'/src/assets/_health/share_01.jpg'
             }
         })
@@ -308,8 +310,8 @@ export default function JournalDetail() {
                         />
                     })
                 }
-                <View style={{display:'flex',flexDirection:'row',justifyContent:'space-between',alignItems:'center',marginTop: rpxToPx(17),}}>
-                    <Text className="h24" style={{ color: MainColorType.g02,  lineHeight: rpxToPx(60) + 'px' }}>{t(data.publish.edited ? 'health.journal_updated' : 'health.journal_created', {
+                <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginTop: rpxToPx(17), }}>
+                    <Text className="h24" style={{ color: MainColorType.g02, lineHeight: rpxToPx(60) + 'px' }}>{t(data.publish.edited ? 'health.journal_updated' : 'health.journal_created', {
                         date_time: global.language == 'en' ?
                             dayjs(data.publish.timestamp).format('MMM D HH:mm') :
                             dayjs(data.publish.timestamp).format('M月D日 HH:mm')