|
|
@@ -46,7 +46,7 @@ export default function MomentMain() {
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
|
|
|
|
|
|
- const observerObjBottom = Taro.createIntersectionObserver().relativeToViewport({ bottom: 100 })
|
|
|
+ // const observerObjBottom = Taro.createIntersectionObserver().relativeToViewport({ bottom: 100 })
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
const [noMore, setNoMore] = useState(false)
|
|
|
const [friends, setFriends] = useState<any>([])
|
|
|
@@ -54,6 +54,7 @@ export default function MomentMain() {
|
|
|
|
|
|
const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
|
const navigationBarHeight = systemInfo.statusBarHeight + 44;
|
|
|
+ const screenHeight = systemInfo.screenHeight
|
|
|
|
|
|
const [itemLayouts, setItemLayouts] = useState<any>([])
|
|
|
const [itemHeights, setItemHeights] = useState<any>([])
|
|
|
@@ -83,7 +84,7 @@ export default function MomentMain() {
|
|
|
const [endSignal, setEndSignal] = useState(0)
|
|
|
|
|
|
const [closeGuide, setCloseGuide] = useState(false)
|
|
|
- const [showGuide,setShowGuide] = useState(false)
|
|
|
+ const [showGuide, setShowGuide] = useState(false)
|
|
|
const [showShareGuide, setShowShareGuide] = useState(false)
|
|
|
const [shareInfo, setShareInfo] = useState<any>(null)
|
|
|
const query = Taro.createSelectorQuery()
|
|
|
@@ -173,7 +174,7 @@ export default function MomentMain() {
|
|
|
|
|
|
useEffect(() => {
|
|
|
myFriends()
|
|
|
- if (router.params.type == 'share') {
|
|
|
+ if (router.params && router.params.type == 'share') {
|
|
|
if (global.shareTicket) {
|
|
|
Taro.getShareInfo({
|
|
|
shareTicket: global.shareTicket,
|
|
|
@@ -196,11 +197,14 @@ export default function MomentMain() {
|
|
|
measureItemLayouts()
|
|
|
}, 300)
|
|
|
|
|
|
- observerObjBottom.observe('#footer', (res) => {
|
|
|
- setEndSignal(endSignal => endSignal + 1)
|
|
|
- // if (moments.length==0) return
|
|
|
- // loadMore()
|
|
|
- })
|
|
|
+ if (process.env.TARO_ENV == 'weapp') {
|
|
|
+ const observerObjBottom = Taro.createIntersectionObserver().relativeToViewport({ bottom: 100 })
|
|
|
+ observerObjBottom && observerObjBottom.observe('#footer', (res) => {
|
|
|
+ setEndSignal(endSignal => endSignal + 1)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}, [moments])
|
|
|
|
|
|
useEffect(() => {
|
|
|
@@ -378,7 +382,7 @@ export default function MomentMain() {
|
|
|
}
|
|
|
|
|
|
function friendGuide() {
|
|
|
- return <View style={{ position: 'fixed', left: 0, top: 0, width: rpxToPx(750), height: '100vh', zIndex: 100 }}>
|
|
|
+ return <View style={{ position: process.env.TARO_ENV == 'weapp' ? 'fixed' : 'absolute', left: 0, top: 0, width: rpxToPx(750), height: process.env.TARO_ENV == 'weapp' ? '100vh' : screenHeight, zIndex: 100 }}>
|
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
|
{/* <View onClick={() => {
|
|
|
setCloseGuide(true)
|
|
|
@@ -397,18 +401,18 @@ export default function MomentMain() {
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
- <FriendGuide closeShare={()=>{
|
|
|
- setTimeout(()=>{
|
|
|
+ <FriendGuide closeShare={() => {
|
|
|
+ setTimeout(() => {
|
|
|
setShowGuide(false)
|
|
|
- },500)
|
|
|
- }}/>
|
|
|
+ }, 500)
|
|
|
+ }} />
|
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
|
}</View>
|
|
|
}
|
|
|
|
|
|
function empty() {
|
|
|
- return <View style={{ position: 'fixed', left: 0, top: 0, width: rpxToPx(750), height: '100vh', zIndex: 100 }}>
|
|
|
+ return <View style={{ position: process.env.TARO_ENV == 'weapp' ? 'fixed' : 'absolute', left: 0, top: 0, width: rpxToPx(750), height: process.env.TARO_ENV == 'weapp' ? '100vh' : screenHeight, zIndex: 100 }}>
|
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
|
{
|
|
|
user.isLogin && <View style={{
|
|
|
@@ -467,7 +471,7 @@ export default function MomentMain() {
|
|
|
function listDetail() {
|
|
|
return <View >
|
|
|
<View style={{
|
|
|
- position: 'fixed',
|
|
|
+ position: process.env.TARO_ENV == 'weapp' ? 'fixed' : 'absolute',
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
zIndex: 10,
|
|
|
@@ -479,7 +483,7 @@ export default function MomentMain() {
|
|
|
<View onClick={more} style={{ position: 'absolute', left: 10, top: 0, bottom: 0, width: 44, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
<IconMenu color="#000" width={rpxToPx(40)} />
|
|
|
</View>
|
|
|
- <View onClick={()=>{
|
|
|
+ <View onClick={() => {
|
|
|
setShowGuide(true)
|
|
|
}} style={{ position: 'absolute', left: 54, top: 0, bottom: 0, width: 44, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
<Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(48), height: rpxToPx(48) }} />
|
|
|
@@ -601,78 +605,6 @@ export default function MomentMain() {
|
|
|
|
|
|
|
|
|
return listDetail()
|
|
|
- return <View >
|
|
|
- <View style={{
|
|
|
- position: 'fixed',
|
|
|
- top: 0,
|
|
|
- left: 0,
|
|
|
- zIndex: 10,
|
|
|
- height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff', display: 'flex',
|
|
|
- flexDirection: 'column', justifyContent: 'flex-end'
|
|
|
- }}>
|
|
|
- <View style={{ height: 44, width: rpxToPx(750), position: 'relative', display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
- <View>{t('health.moments')}</View>
|
|
|
- <View onClick={more} style={{ position: 'absolute', left: 0, top: 0, bottom: 0, width: 80, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>More</View>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- <View style={{ backgroundColor: '#fff', minHeight: '100vh', paddingTop: navigationBarHeight, marginTop: rpxToPx(60), paddingBottom: 100 }}>
|
|
|
- {
|
|
|
- dashBoard && dashBoard.new_message && <View className="new_message_bg">
|
|
|
-
|
|
|
- <View className="new_message" onClick={() => {
|
|
|
- jumpPage('/_moment/pages/message')
|
|
|
- }}>
|
|
|
- {
|
|
|
- dashBoard.new_message.avatars.map((item, index) => {
|
|
|
- return <Image className="message_avatar" src={item} key={index} style={{ zIndex: 9 - index, marginLeft: index == 0 ? rpxToPx(8) : -15 }} />
|
|
|
- })
|
|
|
- }
|
|
|
- <View className="h26 bold" style={{ color: '#fff', minWidth: rpxToPx(260), textAlign: 'center' }}>{dashBoard.new_message.message_tip}</View>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- }
|
|
|
- {
|
|
|
- moments.map((item, index) => {
|
|
|
- if (itemLayouts.length >= index + 1 && pageTop > 0) {
|
|
|
- if (Math.abs(itemLayouts[index] - pageTop) > 2000) {
|
|
|
- return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
|
|
|
- </View>
|
|
|
- }
|
|
|
- // if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
|
|
|
- // return <View style={{
|
|
|
- // height: itemHeights[index], display: 'flex',
|
|
|
- // paddingLeft: rpxToPx(40),
|
|
|
- // paddingRight: rpxToPx(40),
|
|
|
- // boxSizing: 'border-box',
|
|
|
- // flexDirection: 'row'
|
|
|
- // }} id={`history-${index}`}>
|
|
|
- // <TimelineDate timestamp={item.window_range.start_timestamp}
|
|
|
- // pre_timestamp={index > 0 ? list[index - 1].window_range.start_timestamp : null}
|
|
|
- // />
|
|
|
- // <View style={{
|
|
|
- // display: 'flex', flexDirection: 'column', flex: 1,
|
|
|
- // width: rpxToPx(552), height: itemHeights[index] - rpxToPx(60), backgroundColor: '#fafafa'
|
|
|
- // }}>
|
|
|
- // </View>
|
|
|
- // </View>
|
|
|
- // }
|
|
|
-
|
|
|
- }
|
|
|
- return <View key={index} id={`history-{index}`}>
|
|
|
- <MomentItem data={item} />
|
|
|
- </View>
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- <ListFooter noMore={noMore} loading={loading} />
|
|
|
-
|
|
|
- </View>
|
|
|
-
|
|
|
-
|
|
|
- {
|
|
|
- process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
|
- }
|
|
|
- </View>
|
|
|
}
|
|
|
|
|
|
return <View>
|
|
|
@@ -680,7 +612,10 @@ export default function MomentMain() {
|
|
|
{
|
|
|
content()
|
|
|
}
|
|
|
- <MomentShare />
|
|
|
+ {
|
|
|
+ process.env.TARO_ENV == 'weapp' && <MomentShare />
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
</View>
|
|
|
|