|
|
@@ -6,11 +6,13 @@ import ShareBtn from "@/components/basic/ShareBtn";
|
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
import { getScenario } from "@/features/health/hooks/health_hooks";
|
|
|
-import { setFollow, setJoinData } from "@/store/long";
|
|
|
+import { setFollow, setJoinData, setJoinTitle } from "@/store/long";
|
|
|
|
|
|
-export default function LongCard(props: { join?: any, user?: any, hideJoin?: boolean,share?:any }) {
|
|
|
- const { status, key, from,window } = props.join
|
|
|
+export default function LongCard(props: { join?: any, user?: any, hideJoin?: boolean, share?: any, title?: string }) {
|
|
|
+ const { status, key, from, window } = props.join
|
|
|
const health = useSelector((state: any) => state.health);
|
|
|
+ const user = useSelector((state: any) => state.user);
|
|
|
+ const long = useSelector((state: any) => state.long);
|
|
|
const dispatch = useDispatch()
|
|
|
let type = 0
|
|
|
function join(e) {
|
|
|
@@ -20,10 +22,17 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
if (props.user) {
|
|
|
dispatch(setFollow(props.user))
|
|
|
}
|
|
|
+ if (props.title) {
|
|
|
+ dispatch(setJoinTitle(props.title))
|
|
|
+ }
|
|
|
dispatch(setJoinData(props.join))
|
|
|
+ if (!user.isLogin) {
|
|
|
+ jumpPage('/_account/pages/ChooseAuth')
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if (window == 'ACTIVE' || window == 'EAT') {
|
|
|
- jumpPage(`/_health/pages/add_moment?join_id=${key}&is_temp=${true}&window=${window}`)
|
|
|
+ jumpPage(`/_health/pages/add_moment?join_id=${key}&is_temp=${true}&window=${window}&title=${props.title ?? long.title}`)
|
|
|
}
|
|
|
else {
|
|
|
if (window == 'FAST') {
|
|
|
@@ -54,16 +63,23 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
}
|
|
|
|
|
|
function goDetail() {
|
|
|
+ if (!user.isLogin) {
|
|
|
+ jumpPage('/_account/pages/ChooseAuth')
|
|
|
+ return
|
|
|
+ }
|
|
|
if (props.user) {
|
|
|
dispatch(setFollow(props.user))
|
|
|
}
|
|
|
+ if (props.title) {
|
|
|
+ dispatch(setJoinTitle(props.title))
|
|
|
+ }
|
|
|
dispatch(setJoinData(props.join))
|
|
|
jumpPage(`/_moment/pages/long_detail?join_id=${key}&window=${window}`)
|
|
|
}
|
|
|
|
|
|
function share() {
|
|
|
- global.join_id = key
|
|
|
- if (props.share){
|
|
|
+ // global.join_id = key
|
|
|
+ if (props.share) {
|
|
|
props.share()
|
|
|
}
|
|
|
}
|
|
|
@@ -72,7 +88,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
|
|
|
{
|
|
|
props.join.users.map((item, index) => {
|
|
|
- if (index>4) return
|
|
|
+ if (index > 4) return
|
|
|
return <Image className="long_avatar" style={{
|
|
|
zIndex: 10 - index,
|
|
|
marginLeft: index == 0 ? 0 : -rpxToPx(20)
|
|
|
@@ -80,7 +96,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
})
|
|
|
}
|
|
|
{/* <View className="long_avatar"></View> */}
|
|
|
- <View className="h26" style={{ marginLeft: rpxToPx(6) }}>{props.join.users.length>5?`+${props.join.users.length-5} more `:''}跟卡</View>
|
|
|
+ <View className="h26" style={{ marginLeft: rpxToPx(6) }}>{props.join.users.length > 5 ? `+${props.join.users.length - 5} more ` : ''}</View>
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
@@ -92,7 +108,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
}}>
|
|
|
<View className="h20 g02" style={{ marginBottom: rpxToPx(6) }}>接自</View>
|
|
|
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
|
|
|
- <View className="h26">{from.nickname}</View>
|
|
|
+ <View className="h26" style={{ marginRight: rpxToPx(8) }}>{from.nickname}</View>
|
|
|
{
|
|
|
users()
|
|
|
}
|
|
|
@@ -111,7 +127,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
if (status == 'JOIN')
|
|
|
return <View onClick={goDetail} className="long_card_bg long_card_begin">
|
|
|
{
|
|
|
- (!props.join || props.join.user_count == 0) && <View className="h26 g02">一起接龙打卡</View>
|
|
|
+ (!props.join || props.join.user_count == 0) && <View className="h26 g02">{props.join.user.nickname}喊我一起打卡</View>
|
|
|
}
|
|
|
|
|
|
{
|
|
|
@@ -121,10 +137,21 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: bo
|
|
|
</View>
|
|
|
|
|
|
if (status == 'SHARE') {
|
|
|
+ if (!props.join || props.join.user_count == 0) {
|
|
|
+ return <View onClick={goDetail} className="long_card_bg long_card_begin" style={{ alignItems: 'center', justifyContent: 'center' }}>
|
|
|
+ <ShareBtn onClick={share}>
|
|
|
+ <View style={{
|
|
|
+ display: 'flex', flexDirection: 'row',
|
|
|
+ alignItems: 'center', justifyContent: 'center'
|
|
|
+ }}>
|
|
|
+ <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44), marginRight: rpxToPx(6) }} />
|
|
|
+ <View className="h26 bold" style={{ color: MainColorType.success }} >邀请好友加入</View>
|
|
|
+ </View>
|
|
|
+
|
|
|
+ </ShareBtn>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
return <View onClick={goDetail} className="long_card_bg long_card_begin">
|
|
|
- {
|
|
|
- (!props.join || props.join.user_count == 0) && <View className="h26 g02">一起接龙打卡</View>
|
|
|
- }
|
|
|
{
|
|
|
props.join && props.join.user_count > 0 && users()
|
|
|
}
|