diff --git a/src/components/learningRecord/learningRecord.tsx b/src/components/learningRecord/learningRecord.tsx index dea1629..54cabdf 100644 --- a/src/components/learningRecord/learningRecord.tsx +++ b/src/components/learningRecord/learningRecord.tsx @@ -5,7 +5,7 @@ import LineChart from "@/components/lineChart/lineChart"; import {CSSProperties, FC, useEffect, useState} from "react"; import {StatisticsParam, userApi} from "@/api"; import styles from './learningRecord.module.scss' -import Spin from "@/components/spinner"; +// import Spin from "@/components/spinner"; import {Profile} from "@/store"; import Taro from "@tarojs/taro"; @@ -43,20 +43,19 @@ interface Props { */ const LearningRecord: FC = ({userId, style, className}) => { const [lineData, setLineData] = useState([]) - const [loading, setLoading] = useState(false) + // const [loading, setLoading] = useState(false) const {token} = Profile.useContainer() async function getStatistics(data: StatisticsParam) { - if (!userId) return; try { - setLoading(true) + if (!userId) return; + setLineData([]) const res = await userApi.statistics(userId, data) const everyDayValue = everyDay(data.start_time, Number(data.end_time), res.data) setLineData(everyDayValue) } catch (e) { setLineData([]) } - setLoading(false) } function tabChange({tab}: OnChangOpt) { @@ -74,7 +73,7 @@ const LearningRecord: FC = ({userId, style, className}) => { return ( - + {/**/} 总共学习 diff --git a/src/pages/business/courType/courType.tsx b/src/pages/business/courType/courType.tsx index cc7cba0..1d6e057 100644 --- a/src/pages/business/courType/courType.tsx +++ b/src/pages/business/courType/courType.tsx @@ -57,17 +57,27 @@ const CourType: FC = () => { }) return ( - - {data.length > 0 ? data.map(c => - ) : } - + <> + { + data.length > 0 ? + <> + + { + data.map(c => ) + } + + 暂无更多 + + : + } + ) } diff --git a/src/pages/business/curHistory/curHistory.tsx b/src/pages/business/curHistory/curHistory.tsx index 0015159..5131f03 100644 --- a/src/pages/business/curHistory/curHistory.tsx +++ b/src/pages/business/curHistory/curHistory.tsx @@ -106,6 +106,7 @@ const CurHistory = () => { /> ) } + 暂无更多 : } diff --git a/src/pages/business/history/history.tsx b/src/pages/business/history/history.tsx index efb372b..8375e73 100644 --- a/src/pages/business/history/history.tsx +++ b/src/pages/business/history/history.tsx @@ -1,7 +1,7 @@ import {Text, View} from "@tarojs/components"; import styles from './history.module.scss' import Taro from "@tarojs/taro"; -import {useEffect, useState} from "react"; +import React, {useEffect, useState} from "react"; import {formatMinute} from "@/utils/time"; import Empty from "@/components/empty/empty"; import {userApi} from "@/api"; @@ -27,21 +27,28 @@ const History = () => { return ( - {data.length ? data.map((d, index) => - jump(d.userCourseRecord.course_id)}> - - - 共{d.userCourseRecord.hour_count}节/已学{d.userCourseRecord.finished_count}节 - - - {d.title} - - 观看{formatMinute(durations[d.id])} - 学习进度:{(d.userCourseRecord.finished_count / d.userCourseRecord.hour_count * 100).toFixed(0)}% - - - ) : } + { + data.length ? <> { + data.map((d, index) => + jump(d.userCourseRecord.course_id)}> + + + 共{d.userCourseRecord.hour_count}节/已学{d.userCourseRecord.finished_count}节 + + + {d.title} + + 观看{formatMinute(durations[d.id])} + 学习进度:{(d.userCourseRecord.finished_count / d.userCourseRecord.hour_count * 100).toFixed(0)}% + + + ) + } + 暂无更多 + + : + } ) } diff --git a/src/pages/home/components/curRecommended.tsx b/src/pages/home/components/curRecommended.tsx index 95aa016..d80a496 100644 --- a/src/pages/home/components/curRecommended.tsx +++ b/src/pages/home/components/curRecommended.tsx @@ -5,8 +5,8 @@ import Taro, {useReachBottom} from "@tarojs/taro"; import styles from "../home.module.scss"; import VideoCover from "@/components/videoCover/videoCover"; import courseTag from '@/static/img/courseTag.png' -import {rfc33392time} from "@/utils/day"; import Img from "@/components/image/image"; +import {beforeTime} from "@/utils/time"; const toArticlePage = (d: any) => { console.log({d}) @@ -60,15 +60,15 @@ const CurRecommended: FC = () => { 推荐文章 - {articles.map((d, i) => toArticlePage(d)}> - {i > 0 && } + {articles.map((d, i) => toArticlePage(d)}> + {i > 0 && } {d.title} {(d.intro || '').length > 40 && ( {d.intro} - {d.cover && } + {d.cover && } )} - {rfc33392time(d.created_at).split(' ')[0]} + {beforeTime(d.created_at)} 阅读 {d.page_view || 0} )} @@ -102,7 +102,7 @@ const CurRecommended: FC = () => { <> {examines} {videos} - - 暂无更多 - + 暂无更多 ) } diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 5de95de..db3454d 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -1,4 +1,4 @@ -import {FC, useEffect, useState} from "react"; +import {FC, useState} from "react"; import {Image, View, Text} from "@tarojs/components"; import styles from "./home.module.scss"; import Adware from "@/pages/home/components/adware"; @@ -27,14 +27,14 @@ const Home: FC = () => { Taro.navigateTo({url: '/pages/login/login'}) } - useEffect(() => { + Taro.useDidShow(() => { HomeApi.home().then(res => { setData(res) }) setTimeout(() => { setEnable(false) }, 600) - }, []) + }) Taro.usePageScroll((e) => { const v = (Math.min(e.scrollTop / navbarHeight, 1) * 0.9).toFixed(6) diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 8d70f42..a4d3037 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -7,8 +7,7 @@ import {CoursesKey, publicApi} from "@/api/public"; import NavigationBar from "@/components/navigationBar/navigationBar"; import Spin from "@/components/spinner"; import Img from "@/components/image/image"; -import {rfc33392time} from "@/utils/day"; -// import Taro from "@tarojs/taro"; +import {beforeTime} from "@/utils/time"; const category: TabList[] = [ {title: "企选课程", value: 'is_required'}, @@ -65,12 +64,13 @@ const AuditMode: FC = () => { {d.cover && } )} - {rfc33392time(d.created_at).split(' ')[0]} + {beforeTime(d.created_at)} 阅读 {d.page_view || 0} ) } + 暂无更多 : } diff --git a/src/pages/login/login.tsx b/src/pages/login/login.tsx index bf19ea2..54a6278 100644 --- a/src/pages/login/login.tsx +++ b/src/pages/login/login.tsx @@ -57,10 +57,8 @@ const Login: FC = () => { setToken(token) setCompany(company) setLoading(false) - Taro.switchTab({url: '/pages/home/home'}) - + Taro.navigateBack() } else { - Taro.setStorageSync('openid', catch_key) Taro.reLaunch({url: '/pages/check/check'}) } @@ -98,7 +96,6 @@ const Login: FC = () => { {error} setError(null)}/> : null} - {/*{process.env.TARO_APP_LGOIN === 'true' && 线下登录}*/} ) diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx index ebcceb7..70c0a28 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.tsx +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -171,6 +171,7 @@ const CourseAdmin: FC = () => { ) } + 暂无更多 diff --git a/src/pages/manage/depAdmin/depAdmin.tsx b/src/pages/manage/depAdmin/depAdmin.tsx index 4b558c5..13d3b7f 100644 --- a/src/pages/manage/depAdmin/depAdmin.tsx +++ b/src/pages/manage/depAdmin/depAdmin.tsx @@ -158,6 +158,7 @@ const DepAdmin: FC = () => { onClick={() => Taro.navigateTo({url: '/pages/manage/userInfo/userInfo?userId=' + d.id})} content={['学员', '管理员', '超级管理员'][d.role_type]} />)} + 暂无更多 {!manages.length && !users.length && } diff --git a/src/pages/manage/selectDep/selectDep.tsx b/src/pages/manage/selectDep/selectDep.tsx index 8a34de9..cf1e907 100644 --- a/src/pages/manage/selectDep/selectDep.tsx +++ b/src/pages/manage/selectDep/selectDep.tsx @@ -59,6 +59,7 @@ const SelectDep: FC = () => { leftImage={folder}/> )} + 暂无更多 确定 diff --git a/src/pages/manage/userInfo/userInfo.tsx b/src/pages/manage/userInfo/userInfo.tsx index c9be6c3..eb91867 100644 --- a/src/pages/manage/userInfo/userInfo.tsx +++ b/src/pages/manage/userInfo/userInfo.tsx @@ -58,7 +58,6 @@ const UserInfo: FC = () => { useEffect(() => { - userApi.info(userId).then(res => { setData(res) }) @@ -76,7 +75,7 @@ const UserInfo: FC = () => { - + diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx index 8978cf0..b3065cf 100644 --- a/src/pages/preview/brand/info/info.tsx +++ b/src/pages/preview/brand/info/info.tsx @@ -113,11 +113,9 @@ const BrandInfo: FC = () => { { - articleList?.length ? - articleList.map((i: any) => - { - Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`}) - }}> + articleList?.length ? <>{ + articleList.map((i: any) => Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`})}> {i.title} @@ -127,8 +125,9 @@ const BrandInfo: FC = () => { - - ) + )} + 暂无更多 + : } diff --git a/src/pages/preview/brand/list/list.tsx b/src/pages/preview/brand/list/list.tsx index 006230e..c786088 100644 --- a/src/pages/preview/brand/list/list.tsx +++ b/src/pages/preview/brand/list/list.tsx @@ -5,7 +5,7 @@ import Taro, {useReachBottom} from "@tarojs/taro"; import Empty from "@/components/empty/empty"; import Spinner from "@/components/spinner"; import Img from "@/components/image/image"; -import {formatDate} from "@/utils/time"; +import {beforeTime} from "@/utils/time"; const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onClick}) => { let media: ReactNode @@ -16,7 +16,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl /> } else if (data.brand_album) { media = = ({data, onCl return ( - {media} - + - + {data.name} + {beforeTime(data.created_at)}·加入 - + + + {media} + + + {data.graphic_introduction} - {formatDate(new Date(data.created_at), "YY-MM-dd hh:mm:ss")} + 文章:{data.article_count || 0} 点赞:{(Math.random() * 100).toFixed(0)} @@ -105,7 +111,7 @@ const BrandList: FC = () => { content = ( <> {brands.map(d => jumpInfo(d.id)}/>)} - {text} + {text} ) } else { diff --git a/src/pages/preview/health/health.tsx b/src/pages/preview/health/health.tsx index 84b4f7a..fcf18cb 100644 --- a/src/pages/preview/health/health.tsx +++ b/src/pages/preview/health/health.tsx @@ -55,7 +55,7 @@ const Health: FC = () => { )} - 没有更多了 + 暂无更多 : } diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index c1b893a..877995b 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -50,13 +50,16 @@ const BrandList: FC = () => { { articles.length > 0 ? - - { - articles.map((d, index) => jump(d.id)}> - {index + 1} . {d.title} - ) - } - + <> + + { + articles.map((d, index) => jump(d.id)}> + {index + 1} . {d.title} + ) + } + + 暂无更多 + : } diff --git a/src/pages/preview/illness/sort/sort.module.scss b/src/pages/preview/illness/sort/sort.module.scss index 2367ac9..ebff4fa 100644 --- a/src/pages/preview/illness/sort/sort.module.scss +++ b/src/pages/preview/illness/sort/sort.module.scss @@ -58,6 +58,7 @@ font-family: PingFang SC-Bold, PingFang SC; font-weight: bold; color: #323635; + position: relative; } .list { diff --git a/src/pages/preview/illness/sort/sort.tsx b/src/pages/preview/illness/sort/sort.tsx index 6ad6f1d..8b0ef59 100644 --- a/src/pages/preview/illness/sort/sort.tsx +++ b/src/pages/preview/illness/sort/sort.tsx @@ -96,14 +96,14 @@ const Sort: FC = () => { scrollY className={styles.tree} scrollWithAnimation> + { - loading ? : <> - { - list.length ? - list.map(d => jump(d.id)}>{d.name}) - : - } - + list.length ? + <> + {list.map(d => jump(d.id)}>{d.name})} + 暂无更多 + + : } diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index 82ce6bd..7ee3f03 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -104,6 +104,7 @@ const Profession = () => { ) } + 暂无更多 ) } diff --git a/src/utils/time.tsx b/src/utils/time.tsx index 7dd1e6c..d3e9fb0 100644 --- a/src/utils/time.tsx +++ b/src/utils/time.tsx @@ -153,8 +153,7 @@ export function beforeTime(time?: string): string { const initiateTime = new Date(time || 0).getTime() const today = Date.now() const timeDifference = Math.floor((today - initiateTime) / 86400000) - console.log(timeDifference) - if (timeDifference < 0) { + if (timeDifference <= 0) { return '今天' } else if (timeDifference >= 365) { return `${Math.floor(timeDifference / 365)}年前`