From ee5741a752a5f5f44361d1a7ea2076a5493dd85d Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Thu, 14 Sep 2023 16:45:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=B0=81=E8=A3=85=E6=9A=82=E6=97=A0=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E7=BB=84=E4=BB=B6=202.=E4=BF=AE=E6=94=B9=E7=80=91?= =?UTF-8?q?=E5=B8=83=E6=B5=81=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pageScript/pageScript.tsx | 18 ++++++++++ src/components/videoList/videoList.tsx | 35 ++++++++++--------- src/pages/business/courType/courType.tsx | 3 +- src/pages/business/curHistory/curHistory.tsx | 3 +- src/pages/business/history/history.tsx | 3 +- src/pages/home/components/adware.tsx | 2 ++ src/pages/home/components/curRecommended.tsx | 13 ++++--- src/pages/home/home.module.scss | 4 +++ src/pages/index/components/videoList.tsx | 3 +- src/pages/index/index.tsx | 3 +- src/pages/manage/courseAdmin/courseAdmin.tsx | 3 +- src/pages/manage/student/student.tsx | 3 +- src/pages/preview/brand/info/info.tsx | 3 +- src/pages/preview/brand/list/list.tsx | 3 +- src/pages/preview/collect/collect.tsx | 28 ++++++++------- src/pages/preview/health/health.module.scss | 11 +++--- src/pages/preview/health/health.tsx | 3 +- src/pages/preview/illness/list/list.tsx | 2 +- .../preview/jumpArticles/jumpArticles.tsx | 7 +++- .../preview/profession/profession.module.scss | 2 +- src/pages/preview/profession/profession.tsx | 4 +-- 21 files changed, 99 insertions(+), 57 deletions(-) create mode 100644 src/components/pageScript/pageScript.tsx diff --git a/src/components/pageScript/pageScript.tsx b/src/components/pageScript/pageScript.tsx new file mode 100644 index 0000000..853a9eb --- /dev/null +++ b/src/components/pageScript/pageScript.tsx @@ -0,0 +1,18 @@ +import {CSSProperties, FC} from "react"; +import {View} from "@tarojs/components"; + +interface Props { + text?: string + styles?: CSSProperties + className?: string +} + +const PageScript: FC = (props) => { + return + {props.text || "暂无更多"} + +} + +export default PageScript diff --git a/src/components/videoList/videoList.tsx b/src/components/videoList/videoList.tsx index b20656c..0fb44a3 100644 --- a/src/components/videoList/videoList.tsx +++ b/src/components/videoList/videoList.tsx @@ -39,26 +39,29 @@ const VideoList: FC = (props) => { } return ( - - - - {data.title} - {data.introduction} + + - - - - - {(data.video_view || 0)} - + + + {data.title} + {data.introduction} + + + + + + {(data.video_view || 0)} + - - - {(data.collect_quantity || 0)} + + + {(data.collect_quantity || 0)} + - - {formatMinute(data.duration || 0)} + {formatMinute(data.duration || 0)} + ) diff --git a/src/pages/business/courType/courType.tsx b/src/pages/business/courType/courType.tsx index 1d6e057..985ecdf 100644 --- a/src/pages/business/courType/courType.tsx +++ b/src/pages/business/courType/courType.tsx @@ -5,6 +5,7 @@ import {courseApi} from "@/api"; import VideoCover from "@/components/videoCover/videoCover"; import {formatMinute} from "@/utils/time"; import Empty from "@/components/empty/empty"; +import PageScript from "@/components/pageScript/pageScript"; const CourType: FC = () => { const params = useRouter().params @@ -73,7 +74,7 @@ const CourType: FC = () => { />) } - 暂无更多 + : } diff --git a/src/pages/business/curHistory/curHistory.tsx b/src/pages/business/curHistory/curHistory.tsx index 5131f03..77f2ef0 100644 --- a/src/pages/business/curHistory/curHistory.tsx +++ b/src/pages/business/curHistory/curHistory.tsx @@ -6,6 +6,7 @@ import {userApi} from "@/api"; import {formatDateTime, formatMinute} from "@/utils/time"; import CustomPageContainer from "@/components/custom-page-container/custom-page-container"; import Empty from "@/components/empty/empty"; +import PageScript from "@/components/pageScript/pageScript"; const CurHistory = () => { const [show, setShow] = useState(false) @@ -106,7 +107,7 @@ const CurHistory = () => { /> ) } - 暂无更多 + : } diff --git a/src/pages/business/history/history.tsx b/src/pages/business/history/history.tsx index 8375e73..8a7c9c3 100644 --- a/src/pages/business/history/history.tsx +++ b/src/pages/business/history/history.tsx @@ -6,6 +6,7 @@ import {formatMinute} from "@/utils/time"; import Empty from "@/components/empty/empty"; import {userApi} from "@/api"; import Img from "@/components/image/image"; +import PageScript from "@/components/pageScript/pageScript"; const History = () => { const [data, setData] = useState([]) @@ -45,7 +46,7 @@ const History = () => { ) } - 暂无更多 + : } diff --git a/src/pages/home/components/adware.tsx b/src/pages/home/components/adware.tsx index 16724f8..699b723 100644 --- a/src/pages/home/components/adware.tsx +++ b/src/pages/home/components/adware.tsx @@ -41,6 +41,7 @@ const Adware: FC = ({data, only_flag, width}) => { fadeIn onClick={() => jumpAdware(adverts[0].image_path)} width={width} + errorType='profession' height={(space.height / space.width) * width}/> } { @@ -56,6 +57,7 @@ const Adware: FC = ({data, only_flag, width}) => { lazyLoad fadeIn width={width} + errorType='profession' height={(space.height / space.width) * width} onClick={() => jumpAdware(d.image_path)}/> )} diff --git a/src/pages/home/components/curRecommended.tsx b/src/pages/home/components/curRecommended.tsx index a8d88e9..bee851e 100644 --- a/src/pages/home/components/curRecommended.tsx +++ b/src/pages/home/components/curRecommended.tsx @@ -7,6 +7,7 @@ import VideoCover from "@/components/videoCover/videoCover"; import courseTag from '@/static/img/courseTag.png' import ArticlesBox from "@/components/articlesBox/articlesBox"; import arrowRight from '@/static/img/arrow-right.png' +import PageScript from "@/components/pageScript/pageScript"; const CurRecommended: FC = () => { const [page, setPage] = useState(1) @@ -45,17 +46,15 @@ const CurRecommended: FC = () => { let examines: ReactNode | undefined if (articles.length > 0) { examines = ( - - + + 推荐文章 查看更多 - { - articles.map(d => ) - } + {articles.map(d => )} ) } @@ -63,7 +62,7 @@ const CurRecommended: FC = () => { let videos: ReactNode | undefined if (data.length > 0) { videos = ( - + { @@ -85,7 +84,7 @@ const CurRecommended: FC = () => { <> {examines} {videos} - 暂无更多 + ) } diff --git a/src/pages/home/home.module.scss b/src/pages/home/home.module.scss index 50e2569..783ef55 100644 --- a/src/pages/home/home.module.scss +++ b/src/pages/home/home.module.scss @@ -1,3 +1,7 @@ +page { + padding: 0 !important; +} + .tipsLogin { padding: 20px; color: #fff; diff --git a/src/pages/index/components/videoList.tsx b/src/pages/index/components/videoList.tsx index 35d4e4a..e9a72dc 100644 --- a/src/pages/index/components/videoList.tsx +++ b/src/pages/index/components/videoList.tsx @@ -8,6 +8,7 @@ import {userApi} from "@/api"; import Empty from "@/components/empty/empty"; import {Profile} from "@/store"; import LoginView from "@/components/loginView"; +import PageScript from "@/components/pageScript/pageScript"; interface Props { categoryKey: CoursesKey @@ -128,7 +129,7 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { />) } - 暂无更多 + : } diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 18a74ed..856f624 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -8,6 +8,7 @@ import NavigationBar from "@/components/navigationBar/navigationBar"; import Spin from "@/components/spinner"; import {isBoolean} from "@tarojs/shared"; import ArticlesBox from "@/components/articlesBox/articlesBox"; +import PageScript from "@/components/pageScript/pageScript"; const category: TabList[] = [ {title: "企选课程", value: 'is_required'}, @@ -59,7 +60,7 @@ const AuditMode: FC = () => { articles.map(d => ) } - 暂无更多 + : } diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx index eaa2445..2cbaf09 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.tsx +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -8,6 +8,7 @@ import MyButton from "@/components/button/MyButton"; import storageDep from "@/hooks/storageDep"; import Spin from "@/components/spinner"; import Img from "@/components/image/image"; +import PageScript from "@/components/pageScript/pageScript"; const CourseAdmin: FC = () => { const [total, setTotal] = useState(0) @@ -172,7 +173,7 @@ const CourseAdmin: FC = () => { ) } - 暂无更多 + diff --git a/src/pages/manage/student/student.tsx b/src/pages/manage/student/student.tsx index 5ac49b2..3742d45 100644 --- a/src/pages/manage/student/student.tsx +++ b/src/pages/manage/student/student.tsx @@ -4,6 +4,7 @@ import {useEffect, useState} from "react"; import {View, Progress, CustomWrapper} from "@tarojs/components"; import './student.scss' import Taro from "@tarojs/taro"; +import PageScript from "@/components/pageScript/pageScript"; const Student = () => { const {id, name} = getCurrentInstance()?.router?.params as any @@ -32,7 +33,7 @@ const Student = () => { ) }) } - 暂无更多数据 + ) } diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx index 84432da..bf5c8c0 100644 --- a/src/pages/preview/brand/info/info.tsx +++ b/src/pages/preview/brand/info/info.tsx @@ -9,6 +9,7 @@ import Img from "@/components/image/image"; import Spin from "@/components/spinner"; import Collect from "@/components/collect/collect"; import ArticlesBox from "@/components/articlesBox/articlesBox"; +import PageScript from "@/components/pageScript/pageScript"; type Params = { id: number @@ -120,7 +121,7 @@ const BrandInfo: FC = () => { { articleList?.length ? <>{ articleList.map(d => )} - 暂无更多 + : } diff --git a/src/pages/preview/brand/list/list.tsx b/src/pages/preview/brand/list/list.tsx index 780416b..0845c9c 100644 --- a/src/pages/preview/brand/list/list.tsx +++ b/src/pages/preview/brand/list/list.tsx @@ -9,6 +9,7 @@ import {beforeTime} from "@/utils/time"; import styles from './list.module.scss' import articleLine from "@/static/img/articleLine.png" import Collect from "@/components/collect/collect"; +import PageScript from "@/components/pageScript/pageScript"; const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onClick}) => { let media: ReactNode @@ -130,7 +131,7 @@ const BrandList: FC = () => { brands.length ? <> {brands.map(d => jumpInfo(d.id)}/>)} - {text} + : } diff --git a/src/pages/preview/collect/collect.tsx b/src/pages/preview/collect/collect.tsx index e68e3db..fe96750 100644 --- a/src/pages/preview/collect/collect.tsx +++ b/src/pages/preview/collect/collect.tsx @@ -9,6 +9,7 @@ import Spin from "@/components/spinner"; import Img from "@/components/image/image"; import {rfc33392time} from "@/utils/day"; import play from "@/static/img/play.png"; +import PageScript from "@/components/pageScript/pageScript"; interface KillData { data: any[] @@ -59,9 +60,9 @@ const Profession = () => { } Taro.useDidShow(useCallback(() => { - if(categoryId){ + if (categoryId) { let tempMap = new Map() - tempMap.set(categoryId, { + tempMap.set(categoryId, { data: [], total: undefined, page: 1 @@ -69,7 +70,7 @@ const Profession = () => { setData(tempMap) getData() } - },[data])) + }, [data])) useEffect(() => { categoryId && getData() @@ -77,7 +78,7 @@ const Profession = () => { async function getCategory() { try { - const res = [{name:'视频',id:2},{name:'文章',id:1},{name:'课程',id:3},{name:'其他',id:4}] + const res = [{name: '视频', id: 2}, {name: '文章', id: 1}, {name: '课程', id: 3}, {name: '其他', id: 4}] const newTabs = res.map(d => ({title: d.name, value: d.id})) setTabs(newTabs) setCategoryId(newTabs[0].value as number) @@ -89,15 +90,16 @@ const Profession = () => { function tabsChange(tab: OnChangOpt) { setCategoryId(tab.tab?.value as number) } + function jumpInfo(info: any) { - console.log(info,'info') - if(info.article){ + console.log(info, 'info') + if (info.article) { Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${info.owner_id}`}) - }else if(info.course){ + } else if (info.course) { Taro.navigateTo({url: `/pages/business/videoInfo/videoInfo?id=${info.owner_id}`}) - }else if(info.video_records){ + } else if (info.video_records) { Taro.navigateTo({url: `/pages/preview/videoFull/videoFull?id=${info.owner_id}`}) - }else if(info.brand){ + } else if (info.brand) { Taro.navigateTo({url: `/pages/preview/brand/info/info?id=${info.owner_id}`}) } } @@ -144,7 +146,8 @@ const Profession = () => { { d.video_records && <> - + {d.video_records.title} @@ -159,15 +162,14 @@ const Profession = () => { {d.course.title} - 课时:{d.course.class_hour}节 销量:{d.course.charge} + 课时:{d.course.class_hour}节 销量:{d.course.charge} } - ) } - 暂无更多 + ) } diff --git a/src/pages/preview/health/health.module.scss b/src/pages/preview/health/health.module.scss index 5c28c7d..ee04a0c 100644 --- a/src/pages/preview/health/health.module.scss +++ b/src/pages/preview/health/health.module.scss @@ -1,18 +1,17 @@ .container { width: 100%; - padding: 20rpx; + padding: 0 20rpx; box-sizing: border-box; - columns: 2; + column-count: 2; column-gap: 20rpx; } .health { - break-inside: avoid; - background: #fff; border-radius: 10px; - overflow: hidden; - margin-bottom: 20rpx; + padding-top: 20rpx; position: relative; + break-inside: avoid; + overflow: hidden; } .play { diff --git a/src/pages/preview/health/health.tsx b/src/pages/preview/health/health.tsx index 7ff82e3..7d0ee4f 100644 --- a/src/pages/preview/health/health.tsx +++ b/src/pages/preview/health/health.tsx @@ -6,6 +6,7 @@ import styles from './health.module.scss' import Empty from "@/components/empty/empty"; import Spin from "@/components/spinner"; import VideoList from "@/components/videoList/videoList"; +import PageScript from "@/components/pageScript/pageScript"; const Health: FC = () => { const [page, setPage] = useState(1) @@ -44,7 +45,7 @@ const Health: FC = () => { {data.map(d => )} - 暂无更多 + : } diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index 2c0c6b3..805bcfb 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -49,7 +49,7 @@ const BrandList: FC = () => { articles.map(d => ) } - 暂无更多 + : } diff --git a/src/pages/preview/jumpArticles/jumpArticles.tsx b/src/pages/preview/jumpArticles/jumpArticles.tsx index b03503d..851007b 100644 --- a/src/pages/preview/jumpArticles/jumpArticles.tsx +++ b/src/pages/preview/jumpArticles/jumpArticles.tsx @@ -4,6 +4,8 @@ import {publicApi} from "@/api"; import Spin from "@/components/spinner"; import ArticlesBox from "@/components/articlesBox/articlesBox"; import {useReachBottom} from "@tarojs/taro"; +import PageScript from "@/components/pageScript/pageScript"; +import Empty from "@/components/empty/empty"; const JumpArticlesConfig: FC = () => { const [page, setPage] = useState(1) @@ -41,9 +43,12 @@ const JumpArticlesConfig: FC = () => { { - data.map(d => ) + data.length > 0 + ?data.map(d => ) + : } + ) } diff --git a/src/pages/preview/profession/profession.module.scss b/src/pages/preview/profession/profession.module.scss index 8c828f4..f1b2133 100644 --- a/src/pages/preview/profession/profession.module.scss +++ b/src/pages/preview/profession/profession.module.scss @@ -1,6 +1,6 @@ .container { width: 100%; - padding: 20rpx; + padding: 0 20rpx; box-sizing: border-box; columns: 2; column-gap: 20rpx; diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index d5cd9c8..06558cc 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -7,6 +7,7 @@ import Taro from "@tarojs/taro"; import styles from './profession.module.scss' import Spin from "@/components/spinner"; import VideoList from "@/components/videoList/videoList"; +import PageScript from "@/components/pageScript/pageScript"; interface KillData { data: VideList[] @@ -98,12 +99,11 @@ const Profession = () => { onScrollToLower={() => getData(true)} className={styles.height}> - { data.data.map(d => ) } - 暂无更多 + ) }