From da52fe659ca5bdc5f832ed40309b1158bff0df30 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Fri, 25 Aug 2023 14:23:40 +0800 Subject: [PATCH] bug --- src/app.config.ts | 7 +++++-- src/pages/business/sort/sort.config.ts | 3 --- src/pages/business/sort/sort.tsx | 21 ------------------- .../home/components/feature_recommended.tsx | 6 +++--- src/pages/home/home.module.scss | 2 +- src/pages/index/components/videoList.tsx | 16 +++++++++----- src/pages/preview/illness/list/list.tsx | 2 +- src/pages/preview/videoFull/videoFull.tsx | 13 ++++++++++++ 8 files changed, 34 insertions(+), 36 deletions(-) delete mode 100644 src/pages/business/sort/sort.config.ts delete mode 100644 src/pages/business/sort/sort.tsx diff --git a/src/app.config.ts b/src/app.config.ts index db352ba..4001fc0 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -45,6 +45,10 @@ export default defineAppConfig({ 'pages/my/my': { network: 'all', packages: ['pages/manage'] + }, + 'pages/home/home': { + network: 'all', + packages: ['pages/preview'] } }, subpackages: [ @@ -57,8 +61,7 @@ export default defineAppConfig({ 'history/history', 'curHistory/curHistory', 'hourHistory/hourHistory', - 'courType/courType', - 'sort/sort', // 公共二级分类 + 'courType/courType' ] }, { diff --git a/src/pages/business/sort/sort.config.ts b/src/pages/business/sort/sort.config.ts deleted file mode 100644 index f54b62b..0000000 --- a/src/pages/business/sort/sort.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '分类' -}) diff --git a/src/pages/business/sort/sort.tsx b/src/pages/business/sort/sort.tsx deleted file mode 100644 index e2cd428..0000000 --- a/src/pages/business/sort/sort.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import {FC} from "react"; -import {View} from "@tarojs/components"; -import {useRouter} from "@tarojs/taro"; - -type SortType = '' - -interface Params { - id: number - type: SortType - jumpUrl: (data:Record) => void -} - -const Sort: FC = () => { - const params = useRouter().params as unknown as Params - - return ( - ds - ) -} - -export default Sort diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index b251b88..8de747f 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -80,7 +80,7 @@ const FeatureRecommended: FC = () => { title: d.title, imageUrl: d.url_path, description: d.introduction, - path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.resource?.name}` + path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.title}` })) } catch (e) { } @@ -95,8 +95,8 @@ const FeatureRecommended: FC = () => { id: d.id, imageUrl: d.url_path, description: d.introduction, - title: d.resource?.name, - path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.resource?.name}` + title: d.title, + path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.title}` })) } catch (e) { } diff --git a/src/pages/home/home.module.scss b/src/pages/home/home.module.scss index c36351d..6fd3f7d 100644 --- a/src/pages/home/home.module.scss +++ b/src/pages/home/home.module.scss @@ -75,7 +75,7 @@ } .featureTitle { - height: 50rpx; + height: 42rpx; padding-bottom: 30rpx; } diff --git a/src/pages/index/components/videoList.tsx b/src/pages/index/components/videoList.tsx index 4352a77..002975c 100644 --- a/src/pages/index/components/videoList.tsx +++ b/src/pages/index/components/videoList.tsx @@ -1,4 +1,4 @@ -import {FC, useEffect, useState} from "react"; +import {FC, useEffect, useMemo, useState} from "react"; import {useDidShow} from "@tarojs/taro"; import {ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; import {Courses, CoursesKey, publicApi} from "@/api/public"; @@ -16,9 +16,9 @@ interface Props { export const VideoList: FC = ({categoryKey, setCategoryKey}) => { const [data, setData] = useState({ - is_finished: [], - is_not_required: [], is_required: [], + is_not_required: [], + is_finished: [], is_not_finished: [], }) const [page, setPage] = useState(1) @@ -105,9 +105,15 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { setCategoryKey(categoryKeys[index]) } + const categoryIndex = useMemo(() => { + const index = Object.keys(data).findIndex(d => d === categoryKey) + return index < 0 ? 0 : index + }, [data, categoryKey]) + return ( - d === categoryKey)}> + { Object.values(data).map((value) => setPage(page + 1)}> diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index 19eb6a5..4064d2b 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -41,7 +41,7 @@ const BrandList: FC = () => { return ( - + { brands.length > 0 ? brands.map((d, index) => jump(d.id)}> diff --git a/src/pages/preview/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx index 6c7bdba..6651cd1 100644 --- a/src/pages/preview/videoFull/videoFull.tsx +++ b/src/pages/preview/videoFull/videoFull.tsx @@ -34,10 +34,22 @@ const VideoFull: FC = () => { } } + function onError() { + Taro.showModal({ + title: '视频播放错误', + confirmText: '退出', + showCancel: true, + success() { + Taro.navigateBack() + } + }) + } + return ( <> {params.title && {params.title}}