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