|
|
@@ -1,13 +1,205 @@
|
|
|
-import { View,Image } from "@tarojs/components";
|
|
|
+import { View, Image } from "@tarojs/components";
|
|
|
import './long_detail.scss'
|
|
|
+import { useEffect, useState } from "react";
|
|
|
+import Taro, { useRouter } from "@tarojs/taro";
|
|
|
+import { joinDetail } from "@/services/friend";
|
|
|
+import NewButton, { NewButtonType } from "@/_health/base/new_button";
|
|
|
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
+import { rpxToPx } from "@/utils/tools";
|
|
|
+import { MainColorType } from "@/context/themes/color";
|
|
|
+import { getScenario } from "@/features/health/hooks/health_hooks";
|
|
|
+import { useDispatch, useSelector } from "react-redux";
|
|
|
+import { IconClose } from "@/components/basic/Icons";
|
|
|
|
|
|
-export default function LongDetail(){
|
|
|
- return <View>
|
|
|
- <Image className="main_avatar" src=""/>
|
|
|
- <View className="h26 g02">累计获得 10888 次跟卡</View>
|
|
|
- <View className="member_group">
|
|
|
- <View>56人已跟卡</View>
|
|
|
- <View className="members"></View>
|
|
|
+let useRoute;
|
|
|
+let useNavigation;
|
|
|
+let scenario = '';
|
|
|
+if (process.env.TARO_ENV == 'rn') {
|
|
|
+ useRoute = require("@react-navigation/native").useRoute
|
|
|
+ useNavigation = require("@react-navigation/native").useNavigation
|
|
|
+}
|
|
|
+
|
|
|
+export default function LongDetail() {
|
|
|
+ let router
|
|
|
+ let navigation;
|
|
|
+ if (useNavigation) {
|
|
|
+ navigation = useNavigation()
|
|
|
+ }
|
|
|
+
|
|
|
+ if (process.env.TARO_ENV == 'rn') {
|
|
|
+ router = useRoute()
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ router = useRouter()
|
|
|
+ }
|
|
|
+ const health = useSelector((state: any) => state.health);
|
|
|
+ const [detail, setDetail] = useState<any>(null)
|
|
|
+ const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
|
+ const navigationBarHeight = systemInfo.statusBarHeight + 44;
|
|
|
+ const [showFull, setShowFull] = useState(false)
|
|
|
+ const [selUser, setSelUser] = useState<any>(null)
|
|
|
+ // const [loaded, setLoaded] = useState(false)
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getDetail()
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ function getDetail() {
|
|
|
+ joinDetail(router.params.join_id).then(res => {
|
|
|
+ setDetail(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function join() {
|
|
|
+ const { window } = router.params
|
|
|
+ const key = router.params.join_id
|
|
|
+ if (window == 'ACTIVE' || window == 'EAT') {
|
|
|
+ jumpPage(`/_health/pages/add_moment?join_id=${key}&is_temp=${true}&window=${window}`)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (window == 'FAST') {
|
|
|
+ if (getScenario(health.windows, 'FAST').status == 'WFS') {
|
|
|
+ //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
|
|
|
+ jumpPage(`/_health/pages/log_time?join_id=${key}&index=0&single=1&is_start=1&window=${window}`)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //jumpPage(`/_health/pages/log_time?type=home&index=${health.mode == 'FAST' ? 3 : 2}&single=${sceniaro.status == 'OG' ? 1 : 0}&is_start=0&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
|
|
|
+ jumpPage(`/_health/pages/log_time?join_id=${key}&index=3&single=1&is_start=0&window=${window}`)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (getScenario(health.windows, 'SLEEP').status == 'WFS') {
|
|
|
+ //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
|
|
|
+ jumpPage(`/_health/pages/log_time?join_id=${key}&index=1&single=1&is_start=1&window=${window}`)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //jumpPage(`/_health/pages/log_time?type=home&index=${health.mode == 'FAST' ? 3 : 2}&single=${sceniaro.status == 'OG' ? 1 : 0}&is_start=0&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
|
|
|
+ jumpPage(`/_health/pages/log_time?join_id=${key}&index=2&single=1&is_start=0&window=${window}`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!detail) return <View />
|
|
|
+
|
|
|
+ return <View style={{
|
|
|
+ display: 'flex',
|
|
|
+ flexDirection: 'column',
|
|
|
+ alignItems: 'center',
|
|
|
+ height: '100vh'
|
|
|
+ }}>
|
|
|
+ <View style={{
|
|
|
+ position: 'fixed',
|
|
|
+ top: 0,
|
|
|
+ left: 0,
|
|
|
+ zIndex: 10,
|
|
|
+ height: navigationBarHeight, width: rpxToPx(750), display: 'flex',
|
|
|
+ flexDirection: 'column', justifyContent: 'flex-end'
|
|
|
+ }}>
|
|
|
+ <View style={{ height: 44, width: rpxToPx(750), position: 'relative', display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
+ <Image src={require('@assets/_health/navi_back.png')} style={{
|
|
|
+ position: 'absolute',
|
|
|
+ width: rpxToPx(92),
|
|
|
+ height: rpxToPx(64),
|
|
|
+ left: 0,
|
|
|
+ top: 22 - rpxToPx(32)
|
|
|
+ }}
|
|
|
+ onClick={() => {
|
|
|
+ Taro.navigateBack()
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
+ <Image className="main_avatar" style={{ marginTop: navigationBarHeight }} src={detail.user.avatar} />
|
|
|
+ <View className="h34 bold">{detail.user.nickname}</View>
|
|
|
+ <View className="h22 g02">{detail.user.relation_desc}</View>
|
|
|
+ <View className="h26 g02">累计获得 {detail.user.joined_total} 次跟卡</View>
|
|
|
+ {
|
|
|
+ detail.join_count > 0 && <View className="member_group">
|
|
|
+ <View className="join_count">{detail.join_count}人已跟卡
|
|
|
+ <View className="border_footer_line" />
|
|
|
+ </View>
|
|
|
+ <View className="members">
|
|
|
+ {
|
|
|
+ detail.join_users.map((item, index) => {
|
|
|
+ return <View key={index} className="member_item" onClick={() => {
|
|
|
+ setSelUser(item)
|
|
|
+ setShowFull(true)
|
|
|
+ }}>
|
|
|
+ <Image className="member_avatar" src={item.avatar} />
|
|
|
+ <View className="h22 g02" style={{ marginTop: rpxToPx(12) }}>{item.relation_desc}</View>
|
|
|
+ </View>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ detail.join_count == 0 && <View className="join_no_data">
|
|
|
+ <Image src={require('@assets/_health/social2.png')} style={{width:rpxToPx(108),height:rpxToPx(108)}}/>
|
|
|
+ <View className="h34 g01" style={{ marginBottom: rpxToPx(12), marginTop: rpxToPx(24) }}>No joins,yet</View>
|
|
|
+ <View className="h26 g01">Be ths first to joins</View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
+ {
|
|
|
+ detail.join_count > 0 && <View style={{ width: rpxToPx(275), height: rpxToPx(40), marginBottom: rpxToPx(24) }}>
|
|
|
+ <NewButton
|
|
|
+ type={NewButtonType.link}
|
|
|
+ title="查看完整历史"
|
|
|
+ onClick={() => {
|
|
|
+ jumpPage('./long_full?join_id=' + router.params.join_id)
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ <NewButton type={NewButtonType.fill}
|
|
|
+ width={rpxToPx(646)}
|
|
|
+ height={rpxToPx(96)}
|
|
|
+ title="Join"
|
|
|
+ onClick={join}
|
|
|
+ color={MainColorType.eat}
|
|
|
+ />
|
|
|
+ <View style={{ height: rpxToPx(128) }} />
|
|
|
+ {
|
|
|
+ showFull && <View className="full_avatar_bg">
|
|
|
+ <Image style={{
|
|
|
+ width: rpxToPx(750),
|
|
|
+ height: rpxToPx(750)
|
|
|
+ }} src={selUser.avatar} />
|
|
|
+ <View style={{
|
|
|
+ position: 'absolute', left: 10, top: navigationBarHeight - 44, width: 44, height: 44,
|
|
|
+ display: 'flex', alignItems: 'center', justifyContent: 'center'
|
|
|
+ }} onClick={() => {
|
|
|
+ setShowFull(false)
|
|
|
+ }}>
|
|
|
+ <IconClose color="#fff" width={30} height={30} />
|
|
|
+ </View>
|
|
|
+ <View style={{
|
|
|
+ position: 'absolute',
|
|
|
+ bottom: rpxToPx(128),
|
|
|
+ left: rpxToPx(56)
|
|
|
+ }}>
|
|
|
+ <NewButton
|
|
|
+ type={NewButtonType.fill}
|
|
|
+ color={MainColorType.blue}
|
|
|
+ title="View Profile"
|
|
|
+ width={rpxToPx(646)}
|
|
|
+ height={rpxToPx(96)}
|
|
|
+ onClick={() => {
|
|
|
+ jumpPage(`./home?uid=${selUser.id}`)
|
|
|
+ setTimeout(() => {
|
|
|
+ setShowFull(false)
|
|
|
+ }, 1000)
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
</View>
|
|
|
}
|