|
@@ -19,6 +19,9 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import './friend.scss'
|
|
import './friend.scss'
|
|
|
import ListFooter from "@/_health/components/list_footer";
|
|
import ListFooter from "@/_health/components/list_footer";
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
|
|
+import dayjs from "dayjs";
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
let useRoute;
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
@@ -33,7 +36,7 @@ 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 observerObjBottom = Taro.createIntersectionObserver().relativeToViewport({ bottom: 100 })
|
|
const observerObjBottom = Taro.createIntersectionObserver().relativeToViewport({ bottom: 100 })
|
|
|
const [loading, setLoading] = useState(false)
|
|
const [loading, setLoading] = useState(false)
|
|
@@ -69,12 +72,18 @@ export default function FriendMain() {
|
|
|
const [moments, setMoments] = useState<any>([])
|
|
const [moments, setMoments] = useState<any>([])
|
|
|
const [page, setPage] = useState(1)
|
|
const [page, setPage] = useState(1)
|
|
|
const [endSignal, setEndSignal] = useState(0)
|
|
const [endSignal, setEndSignal] = useState(0)
|
|
|
|
|
+
|
|
|
|
|
+ const [closeGuide, setCloseGuide] = useState(false)
|
|
|
const query = Taro.createSelectorQuery()
|
|
const query = Taro.createSelectorQuery()
|
|
|
|
|
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
+ dayjs.locale(global.language == 'en' ? 'en' : 'zh-cn');
|
|
|
|
|
+ require('moment/locale/en-gb')
|
|
|
|
|
+ require('moment/locale/zh-cn')
|
|
|
|
|
+
|
|
|
timer = setInterval(() => {
|
|
timer = setInterval(() => {
|
|
|
setCount(count => count + 1)
|
|
setCount(count => count + 1)
|
|
|
}, 1000)
|
|
}, 1000)
|
|
@@ -88,6 +97,8 @@ export default function FriendMain() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
function listenFollowUser(e) {
|
|
function listenFollowUser(e) {
|
|
@@ -104,10 +115,14 @@ export default function FriendMain() {
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
myFriends()
|
|
myFriends()
|
|
|
|
|
+ // const launchObj = Taro.getLaunchOptionsSync()
|
|
|
|
|
+ // console.log("heeee", router.params, launchObj)
|
|
|
if (router.params.type == 'share') {
|
|
if (router.params.type == 'share') {
|
|
|
- if (launchObj.shareTicket) {
|
|
|
|
|
|
|
+ // console.log('share begin')
|
|
|
|
|
+ // console.log(launchObj)
|
|
|
|
|
+ if (global.shareTicket) {
|
|
|
Taro.getShareInfo({
|
|
Taro.getShareInfo({
|
|
|
- shareTicket: launchObj.shareTicket,
|
|
|
|
|
|
|
+ shareTicket: global.shareTicket,
|
|
|
success(result) {
|
|
success(result) {
|
|
|
console.log('share info', result)
|
|
console.log('share info', result)
|
|
|
updateRelation(result)
|
|
updateRelation(result)
|
|
@@ -120,6 +135,7 @@ export default function FriendMain() {
|
|
|
}
|
|
}
|
|
|
}, [user.isLogin])
|
|
}, [user.isLogin])
|
|
|
|
|
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (moments.length == 0) return
|
|
if (moments.length == 0) return
|
|
|
|
|
|
|
@@ -148,7 +164,6 @@ export default function FriendMain() {
|
|
|
query.select(`#history2-${index}`).boundingClientRect()
|
|
query.select(`#history2-${index}`).boundingClientRect()
|
|
|
});
|
|
});
|
|
|
query.exec((res) => {
|
|
query.exec((res) => {
|
|
|
- debugger
|
|
|
|
|
var layouts: any = []
|
|
var layouts: any = []
|
|
|
var heights: any = []
|
|
var heights: any = []
|
|
|
res.forEach((rect, index) => {
|
|
res.forEach((rect, index) => {
|
|
@@ -205,6 +220,8 @@ export default function FriendMain() {
|
|
|
|
|
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+ setItemHeights([])
|
|
|
|
|
+ setItemLayouts([])
|
|
|
|
|
|
|
|
|
|
|
|
|
getDashBoard()
|
|
getDashBoard()
|
|
@@ -212,7 +229,7 @@ export default function FriendMain() {
|
|
|
getMoments(1)
|
|
getMoments(1)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function onRefresh(){
|
|
|
|
|
|
|
+ function onRefresh() {
|
|
|
setIsPulling(true)
|
|
setIsPulling(true)
|
|
|
getMoments(1)
|
|
getMoments(1)
|
|
|
}
|
|
}
|
|
@@ -311,11 +328,11 @@ export default function FriendMain() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function friendGuide() {
|
|
function friendGuide() {
|
|
|
- return <View>
|
|
|
|
|
|
|
+ return <View style={{ position: 'fixed', left: 0, top: 0, width: rpxToPx(750), height: '100vh', zIndex: 100 }}>
|
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
|
<View onClick={() => {
|
|
<View onClick={() => {
|
|
|
- jumpPage('/_moment/pages/message')
|
|
|
|
|
- }}>My Message</View>
|
|
|
|
|
|
|
+ setCloseGuide(true)
|
|
|
|
|
+ }}>关闭</View>
|
|
|
<FriendGuide />
|
|
<FriendGuide />
|
|
|
{
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
@@ -323,8 +340,11 @@ export default function FriendMain() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function empty() {
|
|
function empty() {
|
|
|
- return <View>
|
|
|
|
|
|
|
+ return <View style={{ position: 'fixed', left: 0, top: 0, width: rpxToPx(750), height: '100vh', zIndex: 100 }}>
|
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
<View style={{ height: navigationBarHeight, width: rpxToPx(750), backgroundColor: '#fff' }} />
|
|
|
|
|
+ <View onClick={() => {
|
|
|
|
|
+ setCloseGuide(true)
|
|
|
|
|
+ }}>关闭</View>
|
|
|
<EmptyContent friends={dashBoard.friends} />
|
|
<EmptyContent friends={dashBoard.friends} />
|
|
|
{
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
@@ -345,13 +365,13 @@ export default function FriendMain() {
|
|
|
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 style={{fontWeight:'bold',}}>{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>
|
|
|
<ScrollView style={{
|
|
<ScrollView style={{
|
|
|
- marginTop:navigationBarHeight,
|
|
|
|
|
- height:'90vh'
|
|
|
|
|
|
|
+ marginTop: navigationBarHeight,
|
|
|
|
|
+ height: '90vh'
|
|
|
}}
|
|
}}
|
|
|
enableBackToTop
|
|
enableBackToTop
|
|
|
scrollY={true}
|
|
scrollY={true}
|
|
@@ -414,6 +434,12 @@ export default function FriendMain() {
|
|
|
{
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
process.env.TARO_ENV == 'weapp' && <TabBar index={4} />
|
|
|
}
|
|
}
|
|
|
|
|
+ {
|
|
|
|
|
+ homeType == 'NO_FRIEND' && !closeGuide && friendGuide()
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ homeType == 'NO_MOMENT' && !closeGuide && empty()
|
|
|
|
|
+ }
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -429,13 +455,7 @@ export default function FriendMain() {
|
|
|
if (!user.isLogin) {
|
|
if (!user.isLogin) {
|
|
|
return friendGuide()
|
|
return friendGuide()
|
|
|
}
|
|
}
|
|
|
- switch (homeType) {
|
|
|
|
|
- case 'NO_FRIEND':
|
|
|
|
|
- return friendGuide()
|
|
|
|
|
- case 'NO_MOMENT':
|
|
|
|
|
- return empty()
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
return listDetail()
|
|
return listDetail()
|
|
|
return <View >
|
|
return <View >
|