|
|
@@ -2,10 +2,10 @@
|
|
|
|
|
|
import TabBar from "@/components/navigation/TabBar";
|
|
|
import { rpxToPx } from "@/utils/tools";
|
|
|
-import { View, Text, Image, ScrollView, Button } from "@tarojs/components";
|
|
|
+import { View, Text, Image, ScrollView, Button, Block } from "@tarojs/components";
|
|
|
import Taro, { useDidShow, useRouter, useShareAppMessage } from "@tarojs/taro";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
-import { useEffect, useState } from "react";
|
|
|
+import { useEffect, useRef, useState } from "react";
|
|
|
import { followUser, getFriendMoments, getMyFriends, getUserDashBoard } from "@/services/friend";
|
|
|
import FriendGuide from "./guide";
|
|
|
import EmptyContent from "./empty_content";
|
|
|
@@ -23,6 +23,11 @@ import dayjs from "dayjs";
|
|
|
import { IconClose, IconMenu } from "@/components/basic/Icons";
|
|
|
import MomentShare from "./moment_share";
|
|
|
import NoRecord from "@/_health/components/no_record";
|
|
|
+import ShareBtn from "@/components/basic/ShareBtn";
|
|
|
+import NewButton, { NewButtonType } from "@/_health/base/new_button";
|
|
|
+import MomentDetailShare from "./moment_detail_share";
|
|
|
+import { getThemeColor } from "@/features/health/hooks/health_hooks";
|
|
|
+import shareTitle from "./moment_unit";
|
|
|
|
|
|
|
|
|
|
|
|
@@ -54,6 +59,7 @@ export default function MomentMain() {
|
|
|
const [itemHeights, setItemHeights] = useState<any>([])
|
|
|
const [isPulling, setIsPulling] = useState(false)
|
|
|
const [pageTop, setPageTop] = useState(0)
|
|
|
+ const scrollRef = useRef()
|
|
|
|
|
|
|
|
|
let router
|
|
|
@@ -77,6 +83,8 @@ export default function MomentMain() {
|
|
|
const [endSignal, setEndSignal] = useState(0)
|
|
|
|
|
|
const [closeGuide, setCloseGuide] = useState(false)
|
|
|
+ const [showShareGuide, setShowShareGuide] = useState(false)
|
|
|
+ const [shareInfo, setShareInfo] = useState<any>(null)
|
|
|
const query = Taro.createSelectorQuery()
|
|
|
|
|
|
const dispatch = useDispatch()
|
|
|
@@ -95,10 +103,12 @@ export default function MomentMain() {
|
|
|
Taro.eventCenter.on('followUser', listenFollowUser)
|
|
|
Taro.eventCenter.on('unfollowUser', listenUnfollowUser)
|
|
|
Taro.eventCenter.on('refreshMoments', refreshMoments)
|
|
|
+ Taro.eventCenter.on('moment_share', momentShare)
|
|
|
return () => {
|
|
|
Taro.eventCenter.off('followUser')
|
|
|
Taro.eventCenter.off('unfollowUser')
|
|
|
Taro.eventCenter.off('refreshMoments')
|
|
|
+ Taro.eventCenter.off('moment_share')
|
|
|
clearInterval(timer)
|
|
|
}
|
|
|
|
|
|
@@ -115,10 +125,19 @@ export default function MomentMain() {
|
|
|
myFriends()
|
|
|
}
|
|
|
|
|
|
- function refreshMoments(e){
|
|
|
+ function refreshMoments(e) {
|
|
|
myFriends()
|
|
|
}
|
|
|
|
|
|
+ function momentShare(e) {
|
|
|
+ setShareInfo(e)
|
|
|
+ setShowShareGuide(true)
|
|
|
+ // var dt = scrollRef.current
|
|
|
+ // query.select(`#myscrollview`).boundingClientRect().exec(res=>{
|
|
|
+ // debugger
|
|
|
+ // })
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
@@ -268,7 +287,7 @@ export default function MomentMain() {
|
|
|
setHomeType((res as any).homepage_type)
|
|
|
setDashBoard(res)
|
|
|
Taro.hideLoading()
|
|
|
- }).catch(e=>{
|
|
|
+ }).catch(e => {
|
|
|
setLoaded(true)
|
|
|
Taro.hideLoading()
|
|
|
})
|
|
|
@@ -335,7 +354,7 @@ export default function MomentMain() {
|
|
|
}}>关闭</View> */}
|
|
|
{
|
|
|
user.isLogin && <View style={{
|
|
|
- position: 'absolute', left: 10, top: navigationBarHeight-44, width: 44, height: 44,
|
|
|
+ position: 'absolute', left: 10, top: navigationBarHeight - 44, width: 44, height: 44,
|
|
|
display: 'flex', alignItems: 'center', justifyContent: 'center'
|
|
|
}}
|
|
|
onClick={() => {
|
|
|
@@ -357,7 +376,7 @@ export default function MomentMain() {
|
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
|
{
|
|
|
user.isLogin && <View style={{
|
|
|
- position: 'absolute', left: 10, top: navigationBarHeight-44, width: 44, height: 44,
|
|
|
+ position: 'absolute', left: 10, top: navigationBarHeight - 44, width: 44, height: 44,
|
|
|
display: 'flex', alignItems: 'center', justifyContent: 'center'
|
|
|
}}
|
|
|
onClick={() => {
|
|
|
@@ -374,6 +393,40 @@ export default function MomentMain() {
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
+ function shareGuideContent() {
|
|
|
+ return <Block><View className="share_guide_bg" style={{ top: 0 }} onClick={(e) => {
|
|
|
+ if (process.env.TARO_ENV == 'weapp') {
|
|
|
+ e.stopPropagation()
|
|
|
+ }
|
|
|
+ setShowShareGuide(false)
|
|
|
+ }}>
|
|
|
+ <View className="share_guide_card" onClick={(e) => {
|
|
|
+ if (process.env.TARO_ENV == 'weapp') {
|
|
|
+ e.stopPropagation()
|
|
|
+ }
|
|
|
+
|
|
|
+ }}>
|
|
|
+ <Image className="share_guide_avatar" mode="aspectFill" src={shareInfo.join.user.avatar} />
|
|
|
+ <View className="h34 bold" style={{ marginTop: rpxToPx(60), marginBottom: rpxToPx(60) }}>{shareTitle(t, shareInfo.join.user)}</View>
|
|
|
+ <ShareBtn onClick={() => {
|
|
|
+ setShowShareGuide(false)
|
|
|
+ }}>
|
|
|
+ <NewButton
|
|
|
+ title="分享给微信好友"
|
|
|
+ type={NewButtonType.fill}
|
|
|
+ width={rpxToPx(480)}
|
|
|
+ height={rpxToPx(96)}
|
|
|
+ color={MainColorType.success}
|
|
|
+ onClick={() => {
|
|
|
+
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </ShareBtn>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </Block>
|
|
|
+ }
|
|
|
+
|
|
|
function listDetail() {
|
|
|
return <View >
|
|
|
<View style={{
|
|
|
@@ -400,9 +453,12 @@ export default function MomentMain() {
|
|
|
height: '90vh'
|
|
|
}}
|
|
|
enableBackToTop
|
|
|
- scrollY={true}
|
|
|
+ ref={scrollRef}
|
|
|
+ id="myscrollview"
|
|
|
+ scrollY={showShareGuide ? false : true}
|
|
|
refresherEnabled={true}
|
|
|
upperThreshold={70}
|
|
|
+ // scrollTop={showShareGuide ? pageTop : undefined}
|
|
|
// lowerThreshold={140}
|
|
|
refresherBackground={MainColorType.g05}
|
|
|
onRefresherRefresh={onRefresh}
|
|
|
@@ -450,16 +506,23 @@ export default function MomentMain() {
|
|
|
})
|
|
|
}
|
|
|
{
|
|
|
- moments.length == 0 && <NoRecord style={{marginTop:rpxToPx(160)}}/>
|
|
|
+ moments.length == 0 && <NoRecord style={{ marginTop: rpxToPx(160) }} />
|
|
|
}
|
|
|
|
|
|
<ListFooter noMore={noMore} loading={loading} />
|
|
|
<View id="footer" style={{ width: 1, height: 1 }}></View>
|
|
|
-
|
|
|
</View>
|
|
|
</ScrollView>
|
|
|
-
|
|
|
-
|
|
|
+ <Block>
|
|
|
+ {
|
|
|
+ showShareGuide && <MomentDetailShare user={shareInfo.join.user} btnColor={getThemeColor(shareInfo.join.window)} />
|
|
|
+ }
|
|
|
+ </Block>
|
|
|
+ <Block>
|
|
|
+ {
|
|
|
+ showShareGuide && shareGuideContent()
|
|
|
+ }
|
|
|
+ </Block>
|
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
|
}
|
|
|
@@ -469,6 +532,8 @@ export default function MomentMain() {
|
|
|
{
|
|
|
homeType == 'NO_MOMENT' && !closeGuide && empty()
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
</View>
|
|
|
|
|
|
}
|
|
|
@@ -562,7 +627,7 @@ export default function MomentMain() {
|
|
|
}
|
|
|
|
|
|
return <View>
|
|
|
-
|
|
|
+
|
|
|
{
|
|
|
content()
|
|
|
}
|