|
@@ -0,0 +1,604 @@
|
|
|
+import React, {
|
|
|
+ useCallback,
|
|
|
+ useEffect,
|
|
|
+ useLayoutEffect,
|
|
|
+ useMemo,
|
|
|
+ useState,
|
|
|
+} from 'react';
|
|
|
+import {
|
|
|
+ DeviceEventEmitter,
|
|
|
+ FlatList,
|
|
|
+ Image,
|
|
|
+ NativeScrollPoint,
|
|
|
+ RefreshControl,
|
|
|
+ SafeAreaView,
|
|
|
+ StyleSheet,
|
|
|
+ Text,
|
|
|
+ useWindowDimensions,
|
|
|
+ View,
|
|
|
+} from 'react-native';
|
|
|
+import { CompositeScreenProps, useFocusEffect } from '@react-navigation/native';
|
|
|
+import { useHeaderHeight } from '@react-navigation/elements';
|
|
|
+import { StackScreenProps } from '@react-navigation/stack';
|
|
|
+import { BottomTabScreenProps } from '@react-navigation/bottom-tabs';
|
|
|
+import { MainParamList, MainTabParamList } from '@app/routes/MainParamList';
|
|
|
+import LinearGradient from 'react-native-linear-gradient';
|
|
|
+import HeaderRight from './components/HeaderRight';
|
|
|
+import HomeTopView from './components/HomeTopView';
|
|
|
+import HomeTodoView from './components/HomeTodoView';
|
|
|
+import HomeCarousel from '@app/screens/components/HomeCarousel';
|
|
|
+import HomeBulletin from './components/HomeBulletin';
|
|
|
+import { useBannerList } from '@app/screens/api';
|
|
|
+import {
|
|
|
+ Article,
|
|
|
+ useArticleCategory,
|
|
|
+ useArticleListByCategory,
|
|
|
+ useBadgeNum,
|
|
|
+ useFeatureList,
|
|
|
+ useNoticeList,
|
|
|
+} from './api';
|
|
|
+import HomeFeaturesView from './components/HomeFeaturesView';
|
|
|
+import Spinner from '@common/components/Spinner';
|
|
|
+import HomeArticlesView from './components/HomeArticlesView';
|
|
|
+import HomeArticleItem from './components/HomeArticleItem';
|
|
|
+import { DEVICE_ENENT_UPDATE_HOME_FEATURE_LIST_KEY } from '@common/constants';
|
|
|
+import { useHandleClickFeatureListItem } from './hooks/useHandleClickFeatureListItem';
|
|
|
+import { useHandleClickBannerListItem } from './hooks/useHandleClickBannerListItem';
|
|
|
+import { useAuth } from '@common/contexts/useAuth';
|
|
|
+import { useHandleUnreadRemind } from './hooks/useHandleUnreadRemind';
|
|
|
+import { debounce } from '@common/utils/commonUtils';
|
|
|
+import { showErrorMessage } from '@common/ToastHelper.ts';
|
|
|
+import ListEmpty from '@common/components/ListEmpty.tsx';
|
|
|
+
|
|
|
+const OPACITY_START = 1; // 导航栏起始透明度
|
|
|
+const OPACITY_END = 0; // 导航栏终点透明度
|
|
|
+const PADDING_HORIZONTAL = 12;
|
|
|
+const BACKGROUND_COLOR = '#F3F4F5'; // 背景色
|
|
|
+const ARTICLE_PAGE_SIZE = 10; // 热门推荐每页数量
|
|
|
+
|
|
|
+type Props = CompositeScreenProps<
|
|
|
+ BottomTabScreenProps<MainTabParamList, 'Home'>,
|
|
|
+ StackScreenProps<MainParamList, 'MainTab'>
|
|
|
+>;
|
|
|
+
|
|
|
+export default function HomeScreen(props: Props) {
|
|
|
+ const { navigation } = props;
|
|
|
+ const headerHeight = useHeaderHeight();
|
|
|
+ const { width } = useWindowDimensions();
|
|
|
+
|
|
|
+ const {
|
|
|
+ state: { userInfo },
|
|
|
+ } = useAuth();
|
|
|
+
|
|
|
+
|
|
|
+ // 【状态】
|
|
|
+ const [contentOffset, setContentOffset] = useState<NativeScrollPoint>({
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ });
|
|
|
+
|
|
|
+ // 【子组件】
|
|
|
+
|
|
|
+ // 创建导航栏背景
|
|
|
+ const createHeaderBackground = useCallback(() => {
|
|
|
+ return (
|
|
|
+ <View
|
|
|
+ style={[
|
|
|
+ styles.headerBackground,
|
|
|
+ {
|
|
|
+ opacity:
|
|
|
+ contentOffset.y <= 0
|
|
|
+ ? OPACITY_END
|
|
|
+ : contentOffset.y >= headerHeight
|
|
|
+ ? OPACITY_START
|
|
|
+ : contentOffset.y / headerHeight,
|
|
|
+ }, // 滑动 ScrollView 导航栏透明度逐渐变化
|
|
|
+ ]}
|
|
|
+ />
|
|
|
+ );
|
|
|
+ }, [contentOffset.y, headerHeight]);
|
|
|
+
|
|
|
+ const { unread, unreadRemindLoading, handleUnreadRemindFetch } =
|
|
|
+ useHandleUnreadRemind(); // 处理未读消息相关
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ handleUnreadRemindFetch();
|
|
|
+ }, [handleUnreadRemindFetch]);
|
|
|
+
|
|
|
+ const createHeaderRight = useCallback(() => {
|
|
|
+ return (
|
|
|
+ <HeaderRight
|
|
|
+ badge={unread}
|
|
|
+ onPressLeftButton={() => {
|
|
|
+ debounce(() => {});
|
|
|
+ }}
|
|
|
+ onPressRightButton={() => {
|
|
|
+ debounce(() => {});
|
|
|
+ // navigation.navigate('Scan'); // 以后再更换新的扫一扫,工作量太大
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ );
|
|
|
+ }, [unread]);
|
|
|
+
|
|
|
+ // 【副作用】
|
|
|
+
|
|
|
+ useLayoutEffect(() => {
|
|
|
+ navigation.setOptions({
|
|
|
+ headerTitle: '医网信',
|
|
|
+ headerTransparent: true,
|
|
|
+ headerBackground: () => createHeaderBackground(),
|
|
|
+ headerRight: () => createHeaderRight(),
|
|
|
+ });
|
|
|
+ return () => {
|
|
|
+ };
|
|
|
+ }, [createHeaderBackground, createHeaderRight, navigation]);
|
|
|
+
|
|
|
+ const {
|
|
|
+ response: bannerList,
|
|
|
+ error: bannerListError,
|
|
|
+ loading: bannerListLoading,
|
|
|
+ fetch: bannerListFetch,
|
|
|
+ } = useBannerList(); // 轮播图
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (bannerListError && bannerListError.type !== 'Cancel') {
|
|
|
+ showErrorMessage(bannerListError.message);
|
|
|
+ }
|
|
|
+ }, [bannerListError]);
|
|
|
+
|
|
|
+ const {
|
|
|
+ response: noticeList,
|
|
|
+ error: noticeListError,
|
|
|
+ loading: noticeListLoading,
|
|
|
+ fetch: noticeListFetch,
|
|
|
+ } = useNoticeList(); // 公告
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (noticeListError && noticeListError.type !== 'Cancel') {
|
|
|
+ showErrorMessage(noticeListError.message);
|
|
|
+ }
|
|
|
+ }, [noticeListError]);
|
|
|
+
|
|
|
+ const {
|
|
|
+ response: featureList,
|
|
|
+ error: featureListError,
|
|
|
+ loading: featureListLoading,
|
|
|
+ fetch: featureListFetch,
|
|
|
+ } = useFeatureList(); // 精品服务数组
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (featureListError && featureListError.type !== 'Cancel') {
|
|
|
+ showErrorMessage(featureListError.message);
|
|
|
+ }
|
|
|
+ }, [featureListError]);
|
|
|
+
|
|
|
+ const {
|
|
|
+ response: articleCategory,
|
|
|
+ error: articleCategoryError,
|
|
|
+ loading: articleCategoryLoading,
|
|
|
+ fetch: articleCategoryFetch,
|
|
|
+ } = useArticleCategory(); // 热门推荐分类
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (articleCategoryError && articleCategoryError.type !== 'Cancel') {
|
|
|
+ showErrorMessage(articleCategoryError.message);
|
|
|
+ }
|
|
|
+ }, [articleCategoryError]);
|
|
|
+
|
|
|
+ const [selectedCategoryCode, setSelectedCategoryCode] = useState<
|
|
|
+ number | undefined
|
|
|
+ >(undefined);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (articleCategory !== undefined && articleCategory.length > 0) {
|
|
|
+ const filteredArticleCategory = articleCategory.filter(
|
|
|
+ c => c.isDefault === true,
|
|
|
+ );
|
|
|
+ if (filteredArticleCategory.length > 0) {
|
|
|
+ setSelectedCategoryCode(filteredArticleCategory[0].code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, [articleCategory]);
|
|
|
+
|
|
|
+ const {
|
|
|
+ response: articleList,
|
|
|
+ error: articleListError,
|
|
|
+ loading: articleListLoading,
|
|
|
+ fetch: articleListFetch,
|
|
|
+ } = useArticleListByCategory(selectedCategoryCode ?? 0); // 热门推荐数组
|
|
|
+ const [displayArticleList, setDisplayArticleList] = useState<Article[]>([]); // 当前展示的热门推荐数组
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (articleListError && articleListError.type !== 'Cancel') {
|
|
|
+ showErrorMessage(articleListError.message);
|
|
|
+ }
|
|
|
+ }, [articleListError]);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (selectedCategoryCode !== undefined) {
|
|
|
+ articleListFetch();
|
|
|
+ }
|
|
|
+ }, [articleListFetch, selectedCategoryCode]);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (articleList) {
|
|
|
+ setDisplayArticleList(articleList.slice(0, ARTICLE_PAGE_SIZE));
|
|
|
+ }
|
|
|
+ }, [articleList]);
|
|
|
+
|
|
|
+ const {
|
|
|
+ response: badgeNum,
|
|
|
+ error: badgeNumError,
|
|
|
+ fetch: badgeNumFetch,
|
|
|
+ } = useBadgeNum(); // 今日未处理数据和精品服务角标
|
|
|
+
|
|
|
+ // 对于首页角标数据,频繁调用
|
|
|
+ useFocusEffect(
|
|
|
+ useCallback(() => {
|
|
|
+ badgeNumFetch();
|
|
|
+ }, [badgeNumFetch]),
|
|
|
+ );
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (badgeNumError && badgeNumError.type !== 'Cancel') {
|
|
|
+ showErrorMessage(badgeNumError.message);
|
|
|
+ }
|
|
|
+ }, [badgeNumError]);
|
|
|
+
|
|
|
+ // 下拉刷新
|
|
|
+ const handleRefresh = useCallback(() => {
|
|
|
+ bannerListFetch();
|
|
|
+ noticeListFetch();
|
|
|
+ featureListFetch();
|
|
|
+ articleCategoryFetch();
|
|
|
+ badgeNumFetch();
|
|
|
+ handleUnreadRemindFetch();
|
|
|
+ }, [
|
|
|
+ articleCategoryFetch,
|
|
|
+ badgeNumFetch,
|
|
|
+ bannerListFetch,
|
|
|
+ featureListFetch,
|
|
|
+ handleUnreadRemindFetch,
|
|
|
+ noticeListFetch,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ // 【计算属性】
|
|
|
+
|
|
|
+ // 处理过的精品服务列表,增加了badge的状态
|
|
|
+ const computedFeatureList = useMemo(() => {
|
|
|
+ if (badgeNum === undefined || badgeNum.length === 0) {
|
|
|
+ return featureList;
|
|
|
+ }
|
|
|
+ return featureList?.map(feature => {
|
|
|
+ const filteredBadgeItems = badgeNum.filter(badgeItem => {
|
|
|
+ return badgeItem.nsId && badgeItem.nsId === feature.uniqueId;
|
|
|
+ });
|
|
|
+ let badge = false;
|
|
|
+ if (filteredBadgeItems.length > 0) {
|
|
|
+ badge = filteredBadgeItems[0].shouldRemind;
|
|
|
+ }
|
|
|
+ return { ...feature, badge: badge };
|
|
|
+ });
|
|
|
+ }, [badgeNum, featureList]); // 在原有精品服务功能数组的基础上增加了角标的是否展示
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ const filteredFeatureList = computedFeatureList?.filter(feature => {
|
|
|
+ return feature.recommend === true;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 当这个列表更新的更新时,发通知,tab栏会接收通知更新tab标签
|
|
|
+ if (filteredFeatureList !== undefined) {
|
|
|
+ DeviceEventEmitter.emit(
|
|
|
+ DEVICE_ENENT_UPDATE_HOME_FEATURE_LIST_KEY,
|
|
|
+ filteredFeatureList.length > 0 ? filteredFeatureList[0] : undefined, // 如果没有推荐的则传空
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }, [computedFeatureList]);
|
|
|
+
|
|
|
+ // 今日未处理三个功能块未处理数
|
|
|
+ const computedBadgeNum = useMemo(() => {
|
|
|
+ if (badgeNum === undefined || badgeNum.length === 0) {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ let yiwangqianNum = '0';
|
|
|
+ let suifangNum = '0';
|
|
|
+ let hospitalNum = '0';
|
|
|
+ for (let index = 0; index < badgeNum.length; index++) {
|
|
|
+ const badgeItem = badgeNum[index];
|
|
|
+ // 医网签id
|
|
|
+ if (badgeItem.nsId === '101') {
|
|
|
+ yiwangqianNum = badgeItem.num.toString();
|
|
|
+ }
|
|
|
+ // 随访id
|
|
|
+ if (badgeItem.nsId === 'Y_T_A2310053073') {
|
|
|
+ suifangNum = badgeItem.num.toString();
|
|
|
+ }
|
|
|
+ // 云诊室id
|
|
|
+ if (badgeItem.nsId === 'CLOUD_CLINIC') {
|
|
|
+ hospitalNum = badgeItem.num.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ yiwangqianNum,
|
|
|
+ suifangNum,
|
|
|
+ hospitalNum,
|
|
|
+ };
|
|
|
+ }, [badgeNum]);
|
|
|
+
|
|
|
+ // 【点击事件方法】
|
|
|
+
|
|
|
+ const { subServerCheckLoading, handleClickFeatureListItem } =
|
|
|
+ useHandleClickFeatureListItem(); // 点击精品服务功能块
|
|
|
+
|
|
|
+ const handleClickBannerListItem = useHandleClickBannerListItem(
|
|
|
+ handleClickFeatureListItem,
|
|
|
+ ); // 点击轮播图
|
|
|
+
|
|
|
+ return (
|
|
|
+ <View
|
|
|
+ style={styles.container}
|
|
|
+ onLayout={() => {
|
|
|
+ // 今日未处理视图时引导的开始位置,当这个视图渲染好之后就可以开始了
|
|
|
+ // if (info.appTourVersion !== APP_TOUR_VERSION) {
|
|
|
+ // start('今日未处理', scrollRef.current);
|
|
|
+ // }
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {/* 顶部背景 */}
|
|
|
+ <View style={styles.topBackground}>
|
|
|
+ <Image
|
|
|
+ style={styles.backgroundImage}
|
|
|
+ source={require('@app/assets/images/home/home_background.png')}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ <FlatList
|
|
|
+ style={styles.list}
|
|
|
+ contentInsetAdjustmentBehavior="scrollableAxes"
|
|
|
+ showsVerticalScrollIndicator={false}
|
|
|
+ onScroll={event => {
|
|
|
+ setContentOffset(event.nativeEvent.contentOffset);
|
|
|
+ }}
|
|
|
+ data={displayArticleList}
|
|
|
+ renderItem={({ item, index }) => (
|
|
|
+ <View key={index}>
|
|
|
+ <HomeArticleItem
|
|
|
+ title={item.title}
|
|
|
+ summary={item.summary}
|
|
|
+ totalReadCount={item.totalReadCount}
|
|
|
+ coverImgUrl={item.coverImgUrl}
|
|
|
+ onPress={() => {
|
|
|
+ if (articleList && articleList.length > 0) {
|
|
|
+ const article = articleList[index];
|
|
|
+ if (article.id === undefined || article.id.length === 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ navigation.navigate('ArticleDetail', {
|
|
|
+ id: article.id,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ )}
|
|
|
+ ListEmptyComponent={ListEmpty}
|
|
|
+ ListHeaderComponent={
|
|
|
+ <SafeAreaView>
|
|
|
+ <View style={{ height: headerHeight }} />
|
|
|
+ {/* 医生信息视图 */}
|
|
|
+ <HomeTopView
|
|
|
+ isVerified={
|
|
|
+ userInfo?.realNameStatus === 'success'
|
|
|
+ ? true
|
|
|
+ : userInfo?.realNameStatus === undefined
|
|
|
+ ? undefined
|
|
|
+ : false
|
|
|
+ }
|
|
|
+ nickname={userInfo?.nickname}
|
|
|
+ picUrl={userInfo?.picUrl}
|
|
|
+ onPress={() => {
|
|
|
+ debounce(() => {});
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ {/* 今日未处理视图 */}
|
|
|
+ <HomeTodoView
|
|
|
+ yiwangqianNum={computedBadgeNum.yiwangqianNum}
|
|
|
+ suifangNum={computedBadgeNum.suifangNum}
|
|
|
+ hospitalNum={computedBadgeNum.hospitalNum}
|
|
|
+ onPressYiwangqian={() => {
|
|
|
+ debounce(() => {
|
|
|
+ const filteredFeatureList = computedFeatureList?.filter(
|
|
|
+ feature => {
|
|
|
+ return feature.uniqueId === '101';
|
|
|
+ },
|
|
|
+ );
|
|
|
+ if (
|
|
|
+ filteredFeatureList !== undefined &&
|
|
|
+ filteredFeatureList.length > 0
|
|
|
+ ) {
|
|
|
+ handleClickFeatureListItem(filteredFeatureList[0]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ onPressSuifang={() => {
|
|
|
+ debounce(() => {
|
|
|
+ const filteredFeatureList = computedFeatureList?.filter(
|
|
|
+ feature => {
|
|
|
+ return feature.uniqueId === 'Y_T_A2310053073';
|
|
|
+ },
|
|
|
+ );
|
|
|
+ if (
|
|
|
+ filteredFeatureList !== undefined &&
|
|
|
+ filteredFeatureList.length > 0
|
|
|
+ ) {
|
|
|
+ handleClickFeatureListItem(filteredFeatureList[0]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ onPressHospital={() => {
|
|
|
+ debounce(() => {
|
|
|
+ const filteredFeatureList = computedFeatureList?.filter(
|
|
|
+ feature => {
|
|
|
+ return feature.uniqueId === 'CLOUD_CLINIC';
|
|
|
+ },
|
|
|
+ );
|
|
|
+ if (
|
|
|
+ filteredFeatureList !== undefined &&
|
|
|
+ filteredFeatureList.length > 0
|
|
|
+ ) {
|
|
|
+ handleClickFeatureListItem(filteredFeatureList[0]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ {/* 轮播图 */}
|
|
|
+ {bannerList && bannerList.length > 0 && (
|
|
|
+ <LinearGradient
|
|
|
+ style={styles.carousel}
|
|
|
+ start={{ x: 0.5, y: 0 }}
|
|
|
+ end={{ x: 0.5, y: 1 }}
|
|
|
+ colors={['#F8FDFF', BACKGROUND_COLOR]}
|
|
|
+ >
|
|
|
+ <HomeCarousel
|
|
|
+ width={width - 2 * PADDING_HORIZONTAL}
|
|
|
+ data={bannerList}
|
|
|
+ onPress={(index: number) => {
|
|
|
+ debounce(() => {
|
|
|
+ if (bannerList && bannerList.length > 0) {
|
|
|
+ handleClickBannerListItem(bannerList[index]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </LinearGradient>
|
|
|
+ )}
|
|
|
+ {/* 公告栏 */}
|
|
|
+ {noticeList && noticeList.list.length > 0 && (
|
|
|
+ <View style={styles.bulletin}>
|
|
|
+ <HomeBulletin
|
|
|
+ width={width - 2 * PADDING_HORIZONTAL}
|
|
|
+ data={noticeList.list}
|
|
|
+ onPress={index => {
|
|
|
+ debounce(() => {});
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ )}
|
|
|
+ {/* 精品服务 */}
|
|
|
+ <HomeFeaturesView
|
|
|
+ features={computedFeatureList}
|
|
|
+ error={featureListError}
|
|
|
+ reload={() => {
|
|
|
+ featureListFetch();
|
|
|
+ }}
|
|
|
+ onPress={index => {
|
|
|
+ debounce(() => {
|
|
|
+ if (computedFeatureList && computedFeatureList.length > 0) {
|
|
|
+ handleClickFeatureListItem(computedFeatureList[index]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ {/* 热门推荐头部视图 */}
|
|
|
+ <HomeArticlesView
|
|
|
+ articleCategory={articleCategory}
|
|
|
+ selectedCode={selectedCategoryCode}
|
|
|
+ articleCategoryError={articleCategoryError}
|
|
|
+ onPressTag={code => {
|
|
|
+ setSelectedCategoryCode(code);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </SafeAreaView>
|
|
|
+ }
|
|
|
+ ListFooterComponent={articleList === undefined ? FooterEmpty : Footer}
|
|
|
+ refreshing={false}
|
|
|
+ refreshControl={
|
|
|
+ <RefreshControl refreshing={false} onRefresh={handleRefresh} />
|
|
|
+ }
|
|
|
+ onRefresh={() => {
|
|
|
+ handleRefresh();
|
|
|
+ }}
|
|
|
+ onEndReachedThreshold={0.2}
|
|
|
+ onEndReached={() => {
|
|
|
+ if (articleList === undefined) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const startIndex = displayArticleList.length;
|
|
|
+ const endEndex = startIndex + ARTICLE_PAGE_SIZE;
|
|
|
+
|
|
|
+ if (startIndex < articleList.length) {
|
|
|
+ setDisplayArticleList(prev => [
|
|
|
+ ...prev,
|
|
|
+ ...articleList.slice(startIndex, endEndex),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ {(bannerListLoading ||
|
|
|
+ noticeListLoading ||
|
|
|
+ featureListLoading ||
|
|
|
+ articleCategoryLoading ||
|
|
|
+ articleListLoading ||
|
|
|
+ subServerCheckLoading ||
|
|
|
+ unreadRemindLoading) && <Spinner />}
|
|
|
+ </View>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+function FooterEmpty() {
|
|
|
+ return <View style={styles.footerEmpty} />;
|
|
|
+}
|
|
|
+
|
|
|
+function Footer() {
|
|
|
+ return (
|
|
|
+ <View style={styles.footer}>
|
|
|
+ <Text>没有更多数据了</Text>
|
|
|
+ </View>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+const styles = StyleSheet.create({
|
|
|
+ alertText: {
|
|
|
+ textAlign: 'center',
|
|
|
+ color: '#999999',
|
|
|
+ fontSize: 12,
|
|
|
+ },
|
|
|
+ headerBackground: {
|
|
|
+ flex: 1,
|
|
|
+ backgroundColor: '#FFFFFF',
|
|
|
+ },
|
|
|
+ container: {
|
|
|
+ flex: 1,
|
|
|
+ backgroundColor: BACKGROUND_COLOR,
|
|
|
+ },
|
|
|
+ topBackground: {
|
|
|
+ position: 'absolute',
|
|
|
+ top: 0,
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ height: 240,
|
|
|
+ },
|
|
|
+ backgroundImage: {
|
|
|
+ flex: 1,
|
|
|
+ width: '100%',
|
|
|
+ },
|
|
|
+ list: {
|
|
|
+ flex: 1,
|
|
|
+ },
|
|
|
+ carousel: {
|
|
|
+ paddingHorizontal: PADDING_HORIZONTAL,
|
|
|
+ paddingBottom: 6,
|
|
|
+ },
|
|
|
+ bulletin: {
|
|
|
+ paddingHorizontal: PADDING_HORIZONTAL,
|
|
|
+ paddingVertical: 4,
|
|
|
+ backgroundColor: BACKGROUND_COLOR,
|
|
|
+ },
|
|
|
+ footerEmpty: {
|
|
|
+ height: 25,
|
|
|
+ },
|
|
|
+ footer: {
|
|
|
+ height: 40,
|
|
|
+ alignItems: 'center',
|
|
|
+ justifyContent: 'center',
|
|
|
+ },
|
|
|
+});
|