|
|
@@ -30,11 +30,11 @@ import SingleImage from "../components/single_img";
|
|
|
import { setFirstActiveId, setFirstEatId, setShowActionTip } from "@/store/health";
|
|
|
import FastSleepPopupContent from "../components/fast_sleep_popup_content";
|
|
|
import { StatusType } from "../base/status_indicator";
|
|
|
+import 'dayjs/locale/zh-cn';
|
|
|
+import 'dayjs/locale/en';
|
|
|
|
|
|
-let timestamp = 0;
|
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
|
-let scenario = '';
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
useRoute = require("@react-navigation/native").useRoute
|
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
|
@@ -85,7 +85,9 @@ export default function TimelineDetail() {
|
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
|
|
|
|
useShareAppMessage((e) => {
|
|
|
- var { timestamp } = detail.publish
|
|
|
+ console.log(detail)
|
|
|
+ var timestamp = detail.events ? detail.events[0].time.timestamp : detail.moments[0].time.timestamp
|
|
|
+ console.log(timestamp)
|
|
|
var shareDate = ''
|
|
|
if (TimeFormatter.isToday(timestamp)) {
|
|
|
shareDate = global.language == 'en' ? 'Today\'s' : '今日'
|
|
|
@@ -97,7 +99,7 @@ export default function TimelineDetail() {
|
|
|
shareDate = global.language == 'en' ? (dayjs(timestamp).format('dddd') + '\'s') : dayjs(timestamp).format('dddd')
|
|
|
}
|
|
|
else {
|
|
|
- shareDate = global.language == 'en' ? dayjs(timestamp).format('MMMM D') : dayjs(timestamp).format('MMMMD日')
|
|
|
+ shareDate = global.language == 'en' ? dayjs(timestamp).format('MMMM D') : dayjs(timestamp).format('MMMD日')
|
|
|
}
|
|
|
|
|
|
var title = ''
|
|
|
@@ -111,6 +113,7 @@ export default function TimelineDetail() {
|
|
|
defaultImg = SHARE_COVER_URL + 'my_long_fast.jpg'
|
|
|
}
|
|
|
else {
|
|
|
+
|
|
|
if (detail.events && detail.events.length > 0)
|
|
|
switch (detail.events[0].window) {
|
|
|
case 'FAST':
|
|
|
@@ -181,8 +184,14 @@ export default function TimelineDetail() {
|
|
|
strWindowId = ''
|
|
|
}
|
|
|
sharePath += `&window_id=${strWindowId}`
|
|
|
+ var nickname = detail.share_user ? detail.share_user.nickname : user.nickname
|
|
|
+ if (nickname.length > 10) {
|
|
|
+ nickname.substring(0, 10) + '...'
|
|
|
+ }
|
|
|
+ console.log('share_title', title)
|
|
|
+ console.log('sharePath', imageUrl)
|
|
|
return {
|
|
|
- title: title,
|
|
|
+ title: nickname + ': ' + title,
|
|
|
path: sharePath,
|
|
|
imageUrl: imageUrl
|
|
|
}
|
|
|
@@ -199,16 +208,23 @@ export default function TimelineDetail() {
|
|
|
backgroundColorBottom: '#ffffff'
|
|
|
})
|
|
|
|
|
|
- var title = ''
|
|
|
- if (router.params.timestamp) {
|
|
|
- setTitle(router.params.timestamp)
|
|
|
- }
|
|
|
- Taro.setNavigationBarTitle({
|
|
|
- title: title
|
|
|
- })
|
|
|
+ // var title = ''
|
|
|
+ // if (router.params.timestamp) {
|
|
|
+ // setTimeout(() => {
|
|
|
+ // setTitle(router.params.timestamp)
|
|
|
+ // }, 100)
|
|
|
+
|
|
|
+ // }
|
|
|
+ // Taro.setNavigationBarTitle({
|
|
|
+ // title: title
|
|
|
+ // })
|
|
|
}, [showPop])
|
|
|
|
|
|
function setTitle(timestamp) {
|
|
|
+ dayjs.locale(global.language == 'en' ? 'en' : 'zh-cn');
|
|
|
+ require('moment/locale/en-gb')
|
|
|
+ require('moment/locale/zh-cn')
|
|
|
+
|
|
|
var title = ''
|
|
|
var t = parseInt(timestamp + '')
|
|
|
if (TimeFormatter.isToday(t)) {
|
|
|
@@ -218,18 +234,29 @@ export default function TimelineDetail() {
|
|
|
title = TimeFormatter.getYesterdayUnit()
|
|
|
}
|
|
|
else {
|
|
|
- if (global.language == 'en') {
|
|
|
- title = dayjs(t).format('dddd, MMM D')
|
|
|
+ console.log(global.language)
|
|
|
+ if (global.language && global.language == 'zh') {
|
|
|
+ title = dayjs(t).format('MMMD日 dddd')
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
- title = dayjs(t).format('MMMD日 dddd')
|
|
|
+ title = dayjs(t).format('dddd, MMM D')
|
|
|
}
|
|
|
}
|
|
|
Taro.setNavigationBarTitle({
|
|
|
- title: title
|
|
|
+ title: title//global.language
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (router.params.timestamp) {
|
|
|
+
|
|
|
+ setTitle(router.params.timestamp)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }, [global.language])
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
Taro.onKeyboardHeightChange(res => {
|
|
|
setBottom(res.height > 0 ? res.height : 20)
|
|
|
@@ -402,7 +429,7 @@ export default function TimelineDetail() {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- var dt = new Date(selDate + ' ' + time + ':' + dayjs(enterTimestmap).format('ss'))
|
|
|
+ var dt = new Date(selDate + 'T' + time + ':' + dayjs(enterTimestmap).format('ss'))
|
|
|
dt.setMilliseconds(new Date(enterTimestmap).getMilliseconds())
|
|
|
var params: any = {
|
|
|
schedule_id: schedule_id,
|
|
|
@@ -674,6 +701,14 @@ export default function TimelineDetail() {
|
|
|
url: '/pages/clock/Clock'
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ function postBtnColor() {
|
|
|
+ if (detail.window)
|
|
|
+ return getThemeColor(detail.window)
|
|
|
+ if (detail.events){
|
|
|
+ return getThemeColor(detail.events[0].window)
|
|
|
+ }
|
|
|
+ }
|
|
|
return <View style={{ display: 'flex', flex: 1, flexDirection: 'column', backgroundColor: '#fff', height: '101vh' }}>
|
|
|
{
|
|
|
!showEmpty && <View className="detail_header">
|
|
|
@@ -861,8 +896,8 @@ export default function TimelineDetail() {
|
|
|
<Text style={{ opacity: 0 }}>{count}</Text>
|
|
|
<ListFooter />
|
|
|
{
|
|
|
- !window_id && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF') && <View className="add_note"><NewButton type={NewButtonType.link} title={t('health.add_note')} onClick={() => {
|
|
|
- timestamp = new Date().getTime()
|
|
|
+ !uid && detail.windows && detail.windows[0].status != 'DONE' && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF') && <View className="add_note"><NewButton type={NewButtonType.link} title={t('health.add_note')} onClick={() => {
|
|
|
+ // timestamp = new Date().getTime()
|
|
|
setShowPop(true)
|
|
|
|
|
|
}} /></View>
|
|
|
@@ -922,7 +957,7 @@ export default function TimelineDetail() {
|
|
|
|
|
|
|
|
|
<View style={{ flex: 1 }} />
|
|
|
- <View className="btn" style={{ backgroundColor: btnDisable ? '#b2b2b2' : getThemeColor(detail.window) }} onClick={tapPost}>{t('health.post')}</View>
|
|
|
+ <View className="btn" style={{ backgroundColor: btnDisable ? '#b2b2b2' : postBtnColor() }} onClick={tapPost}>{t('health.post')}</View>
|
|
|
</View>
|
|
|
|
|
|
<View style={{ height: bottom, flexShrink: 0 }} />
|