|
@@ -3,10 +3,10 @@
|
|
|
import TabBar from "@/components/navigation/TabBar";
|
|
import TabBar from "@/components/navigation/TabBar";
|
|
|
import { rpxToPx } from "@/utils/tools";
|
|
import { rpxToPx } from "@/utils/tools";
|
|
|
import { View, Text, Image, ScrollView, Button } from "@tarojs/components";
|
|
import { View, Text, Image, ScrollView, Button } from "@tarojs/components";
|
|
|
-import Taro, { useRouter, useShareAppMessage } from "@tarojs/taro";
|
|
|
|
|
|
|
+import Taro, { useDidShow, useRouter, useShareAppMessage } from "@tarojs/taro";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
import { useEffect, useState } from "react";
|
|
import { useEffect, useState } from "react";
|
|
|
-import { followUser, getFriendDashBoard, getFriendMoments, getMyFriends, getUserHome } from "@/services/friend";
|
|
|
|
|
|
|
+import { followUser, getFriendMoments, getMyFriends, getUserDashBoard } from "@/services/friend";
|
|
|
import FriendGuide from "./guide";
|
|
import FriendGuide from "./guide";
|
|
|
import EmptyContent from "./empty_content";
|
|
import EmptyContent from "./empty_content";
|
|
|
import MomentItem from "./moment_item";
|
|
import MomentItem from "./moment_item";
|
|
@@ -16,6 +16,8 @@ import { setFastWithSleep, setFinishSetup, setLongFast, setRefreshs, setWindows
|
|
|
import { getInfoSuccess } from "@/store/user";
|
|
import { getInfoSuccess } from "@/store/user";
|
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
|
|
+import './friend.scss'
|
|
|
|
|
+import ListFooter from "@/_health/components/list_footer";
|
|
|
|
|
|
|
|
let useRoute;
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
@@ -25,18 +27,27 @@ if (process.env.TARO_ENV == 'rn') {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let timer;
|
|
let timer;
|
|
|
|
|
+
|
|
|
|
|
+let myScrollTop = 0
|
|
|
|
|
+
|
|
|
export default function FriendMain() {
|
|
export default function FriendMain() {
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
|
const launchObj = Taro.getLaunchOptionsSync()
|
|
const launchObj = Taro.getLaunchOptionsSync()
|
|
|
|
|
|
|
|
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>([])
|
|
const [friends, setFriends] = useState<any>([])
|
|
|
const [count, setCount] = useState(0)
|
|
const [count, setCount] = useState(0)
|
|
|
|
|
|
|
|
const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
|
const navigationBarHeight = systemInfo.statusBarHeight + 44;
|
|
const navigationBarHeight = systemInfo.statusBarHeight + 44;
|
|
|
|
|
|
|
|
|
|
+ const [itemLayouts, setItemLayouts] = useState<any>([])
|
|
|
|
|
+ const [itemHeights, setItemHeights] = useState<any>([])
|
|
|
|
|
+ const [pageTop, setPageTop] = useState(0)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
let router
|
|
let router
|
|
|
let navigation;
|
|
let navigation;
|
|
|
if (useNavigation) {
|
|
if (useNavigation) {
|
|
@@ -54,30 +65,39 @@ export default function FriendMain() {
|
|
|
const [homeType, setHomeType] = useState('NO_FRIEND')
|
|
const [homeType, setHomeType] = useState('NO_FRIEND')
|
|
|
const [dashBoard, setDashBoard] = useState<any>(null)
|
|
const [dashBoard, setDashBoard] = useState<any>(null)
|
|
|
const [moments, setMoments] = useState<any>([])
|
|
const [moments, setMoments] = useState<any>([])
|
|
|
|
|
+ const [page, setPage] = useState(1)
|
|
|
|
|
+ const [endSignal, setEndSignal] = useState(0)
|
|
|
|
|
+ const query = Taro.createSelectorQuery()
|
|
|
|
|
+
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- loadData()
|
|
|
|
|
timer = setInterval(() => {
|
|
timer = setInterval(() => {
|
|
|
setCount(count => count + 1)
|
|
setCount(count => count + 1)
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
|
|
+
|
|
|
|
|
+ Taro.eventCenter.on('followUser', listenFollowUser)
|
|
|
|
|
+ Taro.eventCenter.on('unfollowUser', listenUnfollowUser)
|
|
|
return () => {
|
|
return () => {
|
|
|
|
|
+ Taro.eventCenter.off('followUser')
|
|
|
|
|
+ Taro.eventCenter.off('unfollowUser')
|
|
|
clearInterval(timer)
|
|
clearInterval(timer)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
- function loadData() {
|
|
|
|
|
- var userData = Taro.getStorageSync('userData')
|
|
|
|
|
- if (userData) {
|
|
|
|
|
- console.log('load user cache')
|
|
|
|
|
- dispatch(getInfoSuccess(JSON.parse(userData)));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ function listenFollowUser(e) {
|
|
|
|
|
+ console.log('home follow user', e)
|
|
|
|
|
+ myFriends()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function listenUnfollowUser(e) {
|
|
|
|
|
+ console.log('home unfollow user', e)
|
|
|
|
|
+ myFriends()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -98,25 +118,130 @@ export default function FriendMain() {
|
|
|
}
|
|
}
|
|
|
}, [user.isLogin])
|
|
}, [user.isLogin])
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (moments.length == 0) return
|
|
|
|
|
+
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ measureItemLayouts()
|
|
|
|
|
+ }, 300)
|
|
|
|
|
+
|
|
|
|
|
+ observerObjBottom.observe('#footer', (res) => {
|
|
|
|
|
+ setEndSignal(endSignal => endSignal + 1)
|
|
|
|
|
+ // console.log(moments.length)
|
|
|
|
|
+ // if (moments.length==0) return
|
|
|
|
|
+ // loadMore()
|
|
|
|
|
+ })
|
|
|
|
|
+ }, [moments])
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (moments.length == 0) return
|
|
|
|
|
+ loadMore()
|
|
|
|
|
+ }, [endSignal])
|
|
|
|
|
+
|
|
|
|
|
+ function measureItemLayouts() {
|
|
|
|
|
+
|
|
|
|
|
+ console.log('开始计算位置', new Date().getTime(), moments.length)
|
|
|
|
|
+ if (moments.length <= 10) {
|
|
|
|
|
+ moments.forEach((item, index) => {
|
|
|
|
|
+ query.select(`#history2-${index}`).boundingClientRect()
|
|
|
|
|
+ });
|
|
|
|
|
+ query.exec((res) => {
|
|
|
|
|
+ debugger
|
|
|
|
|
+ var layouts: any = []
|
|
|
|
|
+ var heights: any = []
|
|
|
|
|
+ res.forEach((rect, index) => {
|
|
|
|
|
+ if (rect) {
|
|
|
|
|
+ layouts[index] = rect.top + myScrollTop
|
|
|
|
|
+ heights[index] = rect.height
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ setItemLayouts(layouts)
|
|
|
|
|
+ setItemHeights(heights)
|
|
|
|
|
+ console.log('结束计算位置', new Date().getTime())
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ moments.forEach((item, index) => {
|
|
|
|
|
+ if (index >= itemLayouts.length) {
|
|
|
|
|
+ query.select(`#history2-${index}`).boundingClientRect()
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ query.exec((res) => {
|
|
|
|
|
+ var layouts: any = []
|
|
|
|
|
+ var heights: any = []
|
|
|
|
|
+ // console.log(res)
|
|
|
|
|
+ res.forEach((rect, index) => {
|
|
|
|
|
+
|
|
|
|
|
+ if (rect) {
|
|
|
|
|
+ layouts[index] = rect.top + myScrollTop
|
|
|
|
|
+ heights[index] = rect.height
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ setItemLayouts([...itemLayouts, ...layouts])
|
|
|
|
|
+ setItemHeights([...itemHeights, ...heights])
|
|
|
|
|
+ console.log('结束计算位置', new Date().getTime())
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function onScroll(e) {
|
|
|
|
|
+ // var top = e.detail.scrollTop
|
|
|
|
|
+ // myScrollTop = top
|
|
|
|
|
+ var top = e.detail.scrollTop - e.detail.deltaY
|
|
|
|
|
+ myScrollTop = e.detail.scrollTop
|
|
|
|
|
+ setPageTop(top)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ useDidShow(() => {
|
|
|
|
|
+ getDashBoard()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
function myFriends() {
|
|
function myFriends() {
|
|
|
if (!user.isLogin) {
|
|
if (!user.isLogin) {
|
|
|
setLoaded(true)
|
|
setLoaded(true)
|
|
|
|
|
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- getFriendDashBoard().then(res => {
|
|
|
|
|
- setLoaded(true)
|
|
|
|
|
- setHomeType((res as any).homepage_type)
|
|
|
|
|
- setDashBoard(res)
|
|
|
|
|
- })
|
|
|
|
|
|
|
|
|
|
|
|
+ getDashBoard()
|
|
|
|
|
+
|
|
|
|
|
+ getMoments(1)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function getMoments(index) {
|
|
|
|
|
+ setPage(index)
|
|
|
getFriendMoments({
|
|
getFriendMoments({
|
|
|
- page: 1,
|
|
|
|
|
|
|
+ page: index,
|
|
|
limit: 10
|
|
limit: 10
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
- setMoments((res as any).data)
|
|
|
|
|
|
|
+ console.log(index)
|
|
|
|
|
+ if (index == 1) {
|
|
|
|
|
+ console.log('ss')
|
|
|
|
|
+ setMoments((res as any).data)
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ console.log('ooo')
|
|
|
|
|
+ setMoments([...moments, ...(res as any).data])
|
|
|
|
|
+ }
|
|
|
|
|
+ setLoading(false)
|
|
|
|
|
+
|
|
|
|
|
+ if ((res as any).data.length == 0) {
|
|
|
|
|
+ setNoMore(true)
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ setNoMore(false)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function getDashBoard() {
|
|
|
|
|
+ getUserDashBoard().then(res => {
|
|
|
|
|
+ setLoaded(true)
|
|
|
|
|
+ setHomeType((res as any).homepage_type)
|
|
|
|
|
+ setDashBoard(res)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -126,67 +251,42 @@ export default function FriendMain() {
|
|
|
Taro.setStorageSync('share_info', JSON.stringify(obj))
|
|
Taro.setStorageSync('share_info', JSON.stringify(obj))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- console.log('user login')
|
|
|
|
|
if (user.id != router.params.uid) {
|
|
if (user.id != router.params.uid) {
|
|
|
var params: any = {
|
|
var params: any = {
|
|
|
- follow_origin: obj ? 'WECHAT_GROUP_CHAT' : 'WECHAT_PRIVATE_CHAT'
|
|
|
|
|
|
|
+ follow_origin: obj ? 'WECHAT_GROUP_CHAT' : 'WECHAT_PRIVATE_CHAT',
|
|
|
|
|
+ user_id: router.params.uid,
|
|
|
}
|
|
}
|
|
|
if (obj) {
|
|
if (obj) {
|
|
|
params.wechat = obj
|
|
params.wechat = obj
|
|
|
}
|
|
}
|
|
|
- followUser(router.params.uid, params).then(res => {
|
|
|
|
|
|
|
+ followUser(params).then(res => {
|
|
|
myFriends()
|
|
myFriends()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- useEffect(() => {
|
|
|
|
|
- // observerObjBottom.observe('#a', (res) => {
|
|
|
|
|
- // console.log('a')
|
|
|
|
|
- // })
|
|
|
|
|
- // observerObjBottom.observe('#b', (res) => {
|
|
|
|
|
- // console.log('b')
|
|
|
|
|
- // })
|
|
|
|
|
- // observerObjBottom.observe('#c', (res) => {
|
|
|
|
|
- // console.log('c')
|
|
|
|
|
- // })
|
|
|
|
|
- // observerObjBottom.observe('#d', (res) => {
|
|
|
|
|
- // console.log('d')
|
|
|
|
|
- // })
|
|
|
|
|
- observerObjBottom.observe('#e', (res) => {
|
|
|
|
|
- console.log('e')
|
|
|
|
|
- })
|
|
|
|
|
- }, [])
|
|
|
|
|
|
|
|
|
|
- if (process.env.TARO_ENV == 'weapp' /*&& global.allowShare*/) {
|
|
|
|
|
- Taro.updateShareMenu({
|
|
|
|
|
- withShareTicket: true,
|
|
|
|
|
- success() { }
|
|
|
|
|
- })
|
|
|
|
|
|
|
|
|
|
- useShareAppMessage((e) => {
|
|
|
|
|
- var sharePath = ``
|
|
|
|
|
- if (global.shareData) {
|
|
|
|
|
- console.log(global.shareData)
|
|
|
|
|
- }
|
|
|
|
|
- console.log('share_url', '/pages/friend/friend?type=share&uid=' + user.id)
|
|
|
|
|
- return {
|
|
|
|
|
- title: 'Friends ',
|
|
|
|
|
- path: '/pages/friend/friend?type=share&uid=' + user.id,
|
|
|
|
|
- // imageUrl: imageUrl
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ function loadMore() {
|
|
|
|
|
+ if (loading) return;
|
|
|
|
|
+ if (noMore) return;
|
|
|
|
|
+ setLoading(true)
|
|
|
|
|
+ console.log(page)
|
|
|
|
|
+ var index = page;
|
|
|
|
|
+ index++;
|
|
|
|
|
+ setPage(index)
|
|
|
|
|
+ getMoments(index)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function more(){
|
|
|
|
|
|
|
+ function more() {
|
|
|
showActionSheet({
|
|
showActionSheet({
|
|
|
- title:'',
|
|
|
|
|
- itemList:['个人主页','我的搭子','消息通知'],
|
|
|
|
|
- success:(index)=>{
|
|
|
|
|
- switch(index){
|
|
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ itemList: ['个人主页', '我的搭子', '消息通知'],
|
|
|
|
|
+ success: (index) => {
|
|
|
|
|
+ switch (index) {
|
|
|
case 0:
|
|
case 0:
|
|
|
- jumpPage('/_moment/pages/home')
|
|
|
|
|
|
|
+ jumpPage('/_moment/pages/home?uid=' + user.id)
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
|
jumpPage('/_moment/pages/relation')
|
|
jumpPage('/_moment/pages/relation')
|
|
@@ -202,6 +302,9 @@ export default function FriendMain() {
|
|
|
function friendGuide() {
|
|
function friendGuide() {
|
|
|
return <View>
|
|
return <View>
|
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
|
|
|
+ <View onClick={() => {
|
|
|
|
|
+ jumpPage('/_moment/pages/message')
|
|
|
|
|
+ }}>My Message</View>
|
|
|
<FriendGuide />
|
|
<FriendGuide />
|
|
|
{
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
@@ -218,6 +321,89 @@ export default function FriendMain() {
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // console.log(pageTop, itemLayouts)
|
|
|
|
|
+
|
|
|
|
|
+ function 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>
|
|
|
|
|
+ <ScrollView style='height:100vh'
|
|
|
|
|
+ enableBackToTop
|
|
|
|
|
+ scrollY={true}
|
|
|
|
|
+ // refresherEnabled={props.onRefresherRefresh}
|
|
|
|
|
+ // upperThreshold={70}
|
|
|
|
|
+ // lowerThreshold={140}
|
|
|
|
|
+ // refresherBackground={MainColorType.g05}
|
|
|
|
|
+ // onRefresherRefresh={props.onRefresherRefresh}
|
|
|
|
|
+ // refresherTriggered={props.isPulling}
|
|
|
|
|
+ onScroll={onScroll}
|
|
|
|
|
+ onScrollToUpper={() => {
|
|
|
|
|
+ setPage(1)
|
|
|
|
|
+ if (moments.length > 10) {
|
|
|
|
|
+ setMoments(moments.slice(0, 10))
|
|
|
|
|
+ setItemHeights(itemHeights.slice(0, 10))
|
|
|
|
|
+ setItemLayouts(itemLayouts.slice(0, 10))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }}
|
|
|
|
|
+ // onScrollToLower={props.loadMore}
|
|
|
|
|
+ >
|
|
|
|
|
+ <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 && index > 5) {
|
|
|
|
|
+ if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
|
|
|
|
|
+ return <View style={{ height: itemHeights[index] }} id={`history—temp-${index}`}>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return <View key={index} id={`history2-${index}`}>
|
|
|
|
|
+ <MomentItem data={item} />
|
|
|
|
|
+ </View>
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ <ListFooter noMore={noMore} loading={loading} />
|
|
|
|
|
+ <View id="footer" style={{ width: 1, height: 1 }}></View>
|
|
|
|
|
+
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </ScrollView>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+ process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function content() {
|
|
function content() {
|
|
|
if (!loaded) {
|
|
if (!loaded) {
|
|
|
return <View >
|
|
return <View >
|
|
@@ -236,33 +422,88 @@ export default function FriendMain() {
|
|
|
return empty()
|
|
return empty()
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ return listDetail()
|
|
|
return <View >
|
|
return <View >
|
|
|
<View style={{
|
|
<View style={{
|
|
|
|
|
+ position: 'fixed',
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ left: 0,
|
|
|
|
|
+ zIndex: 10,
|
|
|
height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff', display: 'flex',
|
|
height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff', display: 'flex',
|
|
|
flexDirection: 'column', justifyContent: 'flex-end'
|
|
flexDirection: 'column', justifyContent: 'flex-end'
|
|
|
}}>
|
|
}}>
|
|
|
- <View style={{ height: 44, width: rpxToPx(750),position:'relative', display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
|
|
|
|
+ <View style={{ height: 44, width: rpxToPx(750), position: 'relative', display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
<View>{t('health.moments')}</View>
|
|
<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 onClick={more} style={{ position: 'absolute', left: 0, top: 0, bottom: 0, width: 80, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>More</View>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- <View style={{ backgroundColor: '#fff', minHeight: '100vh' }}>
|
|
|
|
|
|
|
+ <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) => {
|
|
moments.map((item, index) => {
|
|
|
- return <View key={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} />
|
|
<MomentItem data={item} />
|
|
|
</View>
|
|
</View>
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ <ListFooter noMore={noMore} loading={loading} />
|
|
|
|
|
+
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
|
}
|
|
}
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return content()
|
|
|
|
|
|
|
+ return <View>
|
|
|
|
|
+ {
|
|
|
|
|
+ content()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ </View>
|
|
|
|
|
|
|
|
|
|
|
|
|
return <View>
|
|
return <View>
|