|
@@ -8,7 +8,7 @@ import dayjs from "dayjs";
|
|
|
import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
|
|
import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
|
|
|
import { baseUrl, SHARE_COVER_URL } from "@/services/http/api";
|
|
import { baseUrl, SHARE_COVER_URL } from "@/services/http/api";
|
|
|
import { checkAuthorized } from "@/utils/check_authorized";
|
|
import { checkAuthorized } from "@/utils/check_authorized";
|
|
|
-import { createMoment, delEvents, delRecord, getEvents, getRecordDetail, makeDone } from "@/services/health";
|
|
|
|
|
|
|
+import { createMoment, delEvents, delRecord, getEvents, getRecordDetail, makeDone, windows } from "@/services/health";
|
|
|
import NewButton, { NewButtonType } from "../base/new_button";
|
|
import NewButton, { NewButtonType } from "../base/new_button";
|
|
|
import { IconClose, IconError, IconLongFast, IconShare } from "@/components/basic/Icons";
|
|
import { IconClose, IconError, IconLongFast, IconShare } from "@/components/basic/Icons";
|
|
|
import { rpxToPx, vibrate } from "@/utils/tools";
|
|
import { rpxToPx, vibrate } from "@/utils/tools";
|
|
@@ -27,13 +27,14 @@ import { TimeFormatter } from "@/utils/time_format";
|
|
|
import TargetProgress from "../components/target_progress";
|
|
import TargetProgress from "../components/target_progress";
|
|
|
import formatMilliseconds from "@/utils/format_time";
|
|
import formatMilliseconds from "@/utils/format_time";
|
|
|
import SingleImage from "../components/single_img";
|
|
import SingleImage from "../components/single_img";
|
|
|
-import { setFirstActiveId, setFirstEatId, setShowActionTip } from "@/store/health";
|
|
|
|
|
|
|
+import { setFastWithSleep, setFirstActiveId, setFirstEatId, setLongFast, setShowActionTip, setWindows } from "@/store/health";
|
|
|
import FastSleepPopupContent from "../components/fast_sleep_popup_content";
|
|
import FastSleepPopupContent from "../components/fast_sleep_popup_content";
|
|
|
import { StatusType } from "../base/status_indicator";
|
|
import { StatusType } from "../base/status_indicator";
|
|
|
import 'dayjs/locale/zh-cn';
|
|
import 'dayjs/locale/zh-cn';
|
|
|
import 'dayjs/locale/en';
|
|
import 'dayjs/locale/en';
|
|
|
import { getInfoSuccess } from "@/store/user";
|
|
import { getInfoSuccess } from "@/store/user";
|
|
|
import LongCard from "@/_moment/components/long_card";
|
|
import LongCard from "@/_moment/components/long_card";
|
|
|
|
|
+import { setFollow } from "@/store/long";
|
|
|
|
|
|
|
|
let useRoute;
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
@@ -64,6 +65,7 @@ export default function TimelineDetail() {
|
|
|
const [count, setCount] = useState(0)
|
|
const [count, setCount] = useState(0)
|
|
|
const [fastSleepPop, setFastSleepPop] = useState(false)
|
|
const [fastSleepPop, setFastSleepPop] = useState(false)
|
|
|
const [shareUser, setShareUser] = useState<any>(null)
|
|
const [shareUser, setShareUser] = useState<any>(null)
|
|
|
|
|
+ const [join, setJoin] = useState<any>(null)
|
|
|
const [showEmpty, setShowEmpty] = useState(false)
|
|
const [showEmpty, setShowEmpty] = useState(false)
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
|
|
|
|
@@ -98,7 +100,7 @@ export default function TimelineDetail() {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (process.env.TARO_ENV == 'weapp' && global.allowShare) {
|
|
|
|
|
|
|
+ if (process.env.TARO_ENV == 'weapp'/* && global.allowShare*/) {
|
|
|
Taro.updateShareMenu({
|
|
Taro.updateShareMenu({
|
|
|
withShareTicket: true,
|
|
withShareTicket: true,
|
|
|
success() { }
|
|
success() { }
|
|
@@ -297,7 +299,7 @@ export default function TimelineDetail() {
|
|
|
setBottom(res.height > 0 ? res.height : 20)
|
|
setBottom(res.height > 0 ? res.height : 20)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- getDatas()
|
|
|
|
|
|
|
+ // getDatas()
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!window_id && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF') && autoPost == '1') {
|
|
if (!window_id && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF') && autoPost == '1') {
|
|
@@ -308,6 +310,18 @@ export default function TimelineDetail() {
|
|
|
}
|
|
}
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ getDatas()
|
|
|
|
|
+ if (user.isLogin) {
|
|
|
|
|
+ windows().then(res => {
|
|
|
|
|
+ dispatch(setFastWithSleep((res as any).fast_with_sleep))
|
|
|
|
|
+ dispatch(setWindows((res as any).windows))
|
|
|
|
|
+ dispatch(setLongFast((res as any).long_fast))
|
|
|
|
|
+ }).catch(e => {
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [user.isLogin])
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (desc.length > 0 || imgUrl.length > 0) {
|
|
if (desc.length > 0 || imgUrl.length > 0) {
|
|
|
setBtnDisable(false)
|
|
setBtnDisable(false)
|
|
@@ -323,7 +337,6 @@ export default function TimelineDetail() {
|
|
|
|
|
|
|
|
function getDatas() {
|
|
function getDatas() {
|
|
|
var showWindow = true
|
|
var showWindow = true
|
|
|
- console.log('获取接口数据')
|
|
|
|
|
|
|
|
|
|
if (!window_id || op_page == 'HOME_EAT' || op_page == 'HOME_ACTIVE') showWindow = false
|
|
if (!window_id || op_page == 'HOME_EAT' || op_page == 'HOME_ACTIVE') showWindow = false
|
|
|
if (window_id == 'undefined') showWindow = false
|
|
if (window_id == 'undefined') showWindow = false
|
|
@@ -344,9 +357,10 @@ export default function TimelineDetail() {
|
|
|
setHistory((res as any).events)
|
|
setHistory((res as any).events)
|
|
|
// setList((res as any).moments)
|
|
// setList((res as any).moments)
|
|
|
setPublish((res as any).publish)
|
|
setPublish((res as any).publish)
|
|
|
-
|
|
|
|
|
|
|
+ setJoin((res as any).join)
|
|
|
if ((res as any).share_user) {
|
|
if ((res as any).share_user) {
|
|
|
setShareUser((res as any).share_user)
|
|
setShareUser((res as any).share_user)
|
|
|
|
|
+ dispatch(setFollow((res as any).share_user))
|
|
|
}
|
|
}
|
|
|
console.log('获取window数据成功')
|
|
console.log('获取window数据成功')
|
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
@@ -368,8 +382,10 @@ export default function TimelineDetail() {
|
|
|
setDetail(res)
|
|
setDetail(res)
|
|
|
setList((res as any).moments)
|
|
setList((res as any).moments)
|
|
|
setPublish((res as any).publish)
|
|
setPublish((res as any).publish)
|
|
|
|
|
+ setJoin((res as any).join)
|
|
|
if ((res as any).share_user) {
|
|
if ((res as any).share_user) {
|
|
|
setShareUser((res as any).share_user)
|
|
setShareUser((res as any).share_user)
|
|
|
|
|
+ dispatch(setFollow((res as any).share_user))
|
|
|
}
|
|
}
|
|
|
console.log('获取event数据成功')
|
|
console.log('获取event数据成功')
|
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
@@ -779,7 +795,8 @@ export default function TimelineDetail() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function addNoteBtn() {
|
|
function addNoteBtn() {
|
|
|
- if (!uid && (detail.share_user && user.id != detail.share_user.id)) {
|
|
|
|
|
|
|
+ if (!detail) return null
|
|
|
|
|
+ if (!uid && (detail && detail.share_user && user.id != detail.share_user.id)) {
|
|
|
return null
|
|
return null
|
|
|
}
|
|
}
|
|
|
if (detail.windows && detail.windows[0].status != 'DONE' && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF'))
|
|
if (detail.windows && detail.windows[0].status != 'DONE' && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF'))
|
|
@@ -962,7 +979,10 @@ export default function TimelineDetail() {
|
|
|
canvasId={`double_${detail.windows[0].window_range.start_timestamp}`}
|
|
canvasId={`double_${detail.windows[0].window_range.start_timestamp}`}
|
|
|
/>
|
|
/>
|
|
|
}
|
|
}
|
|
|
- <LongCard join={{}} link={{}}/>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ join && <LongCard join={join} />
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
publish && <View style={{ display: 'flex', flexDirection: 'row', height: rpxToPx(60), marginTop: rpxToPx(17), alignItems: 'center' }}>
|
|
publish && <View style={{ display: 'flex', flexDirection: 'row', height: rpxToPx(60), marginTop: rpxToPx(17), alignItems: 'center' }}>
|
|
|
{/* <Text className="h24 g02">{publish.edited ? '编辑于' : '发布于'}{dayjs(publish.timestamp).format('M月D日 HH:mm')}</Text> */}
|
|
{/* <Text className="h24 g02">{publish.edited ? '编辑于' : '发布于'}{dayjs(publish.timestamp).format('M月D日 HH:mm')}</Text> */}
|