diff --git a/src/api/public.ts b/src/api/public.ts index b8c363a..cd4acc1 100644 --- a/src/api/public.ts +++ b/src/api/public.ts @@ -15,9 +15,9 @@ interface CategoryList { export interface Courses { /** 已完成 */ - is_finished: Curriculum[] + // is_finished: Curriculum[] /** 未完成 */ - is_not_finished: Curriculum[] + // is_not_finished: Curriculum[] /** 选秀 */ is_not_required: Curriculum[] /** 必修 */ diff --git a/src/components/tabs/tabs.scss b/src/components/tabs/tabs.scss index 3d1c9c0..50623dc 100644 --- a/src/components/tabs/tabs.scss +++ b/src/components/tabs/tabs.scss @@ -15,11 +15,12 @@ View::-webkit-scrollbar { display: -webkit-flex; display: flex; text-align: center; + align-items: baseline; } .tabs-item { padding: 20rpx; - font-size: 36rpx; + font-size: 30rpx; font-family: PingFang SC-Medium, PingFang SC; font-weight: 500; color: #606563; diff --git a/src/pages/index/components/videoList.tsx b/src/pages/index/components/videoList.tsx index 002975c..10bffd6 100644 --- a/src/pages/index/components/videoList.tsx +++ b/src/pages/index/components/videoList.tsx @@ -7,7 +7,8 @@ import styles from '../index.module.scss' import {formatMinute} from "@/utils/time"; import {userApi} from "@/api"; import Empty from "@/components/empty/empty"; -import eventsIndex from "@/hooks/eventsIndex"; +import {Profile} from "@/store"; +import LoginView from "@/components/loginView"; interface Props { categoryKey: CoursesKey @@ -18,11 +19,12 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { const [data, setData] = useState({ is_required: [], is_not_required: [], - is_finished: [], - is_not_finished: [], + // is_finished: [], + // is_not_finished: [], }) const [page, setPage] = useState(1) const [records, setRecords] = useState([]) + const {token} = Profile.useContainer() function screen(oldData: Curriculum[], data: Curriculum[]): Curriculum[] { return data.reduce((pre, cur) => { @@ -43,8 +45,8 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { setData({ is_required: screen(old.is_required, res.is_required || []), is_not_required: screen(old.is_not_required, res.is_not_required || []), - is_finished: screen(old.is_finished, res.is_finished || []), - is_not_finished: screen(old.is_not_finished, res.is_not_finished || []), + // is_finished: screen(old.is_finished, res.is_finished || []), + // is_not_finished: screen(old.is_not_finished, res.is_not_finished || []), }) } catch (e) { } @@ -63,7 +65,6 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { switch (categoryKey) { case "is_required": case "is_not_required": - case "is_not_finished": const find = records.find(d => d?.course_id === id) if (find) { if (class_hour === find.finished_count) { @@ -72,21 +73,19 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { return ({`共${class_hour}节/已学${find.finished_count}节`}) } return ({`共${class_hour}节/已学0节`}) - case "is_finished": - return 已完成 } } - eventsIndex.on(({id}) => { - if (id == null) return; - for (const [index, notFinished] of data.is_not_finished.entries()) { - if (notFinished.id === id) { - data.is_finished.push(notFinished) - data.is_not_finished.splice(index, 1) - return - } - } - }) + // eventsIndex.on(({id}) => { + // if (id == null) return; + // for (const [index, notFinished] of data.is_not_finished.entries()) { + // if (notFinished.id === id) { + // data.is_finished.push(notFinished) + // data.is_not_finished.splice(index, 1) + // return + // } + // } + // }) useDidShow(() => { getData().then() @@ -115,21 +114,28 @@ export const VideoList: FC = ({categoryKey, setCategoryKey}) => { onChange={changeSwiper} current={categoryIndex}> { - Object.values(data).map((value) => - setPage(page + 1)}> + Object.entries(data).map(([key, value]) => + setPage(page + 1)} enhanced + showScrollbar={false}> { - value?.length ? value?.map(c => - ) - : + !token + && key === 'is_required' + ? : value?.length ? + <> + {value?.map(c => + )} + 暂无更多 + + : } diff --git a/src/pages/index/index.config.ts b/src/pages/index/index.config.ts index 23c20dd..90c348c 100644 --- a/src/pages/index/index.config.ts +++ b/src/pages/index/index.config.ts @@ -1,3 +1,3 @@ export default definePageConfig({ - navigationStyle: 'custom' + navigationStyle: 'custom', }) diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index d1028c6..4a97c22 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,21 +1,17 @@ import {FC, useState} from "react"; -import {View, Text} from "@tarojs/components"; +import {View} from "@tarojs/components"; import styles from './index.module.scss' import {VideoList} from "@/pages/index/components/videoList"; import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; import {CoursesKey} from "@/api/public"; -import LoginView from "@/components/loginView"; -import Taro from "@tarojs/taro"; -import {Profile} from "@/store" +import NavigationBar from "@/components/navigationBar/navigationBar"; const Index: FC = () => { - const globalData = Taro.getApp().globalData - const {token} = Profile.useContainer() const category: TabList[] = [ {title: "必修", value: 'is_required'}, {title: "选修", value: 'is_not_required'}, - {title: "已完成", value: 'is_finished'}, - {title: "未完成", value: 'is_not_finished'}, + // {title: "已完成", value: 'is_finished'}, + // {title: "未完成", value: 'is_not_finished'}, ] const [categoryKey, setCategoryKey] = useState('is_required') @@ -25,19 +21,14 @@ const Index: FC = () => { return ( - - { !token ? - - : - <> - - 学习课程 - - - setCategoryKey(categoryKey)}/> - - } - + + } + backgroundColor={'transparent'}/> + setCategoryKey(categoryKey)}/> + ) } diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx index 596c6a1..dabb565 100644 --- a/src/pages/preview/brand/info/info.tsx +++ b/src/pages/preview/brand/info/info.tsx @@ -1,5 +1,5 @@ import {FC, useCallback, useEffect, useState} from "react"; -import {Image, Swiper, SwiperItem, Text, Video, View} from "@tarojs/components"; +import {Swiper, SwiperItem, Text, Video, View} from "@tarojs/components"; import {ArticleRecord, brandApi, BrandRecord} from "@/api"; import styles from './info.module.scss' import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; @@ -67,40 +67,40 @@ const BrandInfo: FC = () => { { - brandInfo?.introductory_video_resource?.url || brandInfo?.brand_album?.length && + (brandInfo?.introductory_video_resource?.url || brandInfo?.brand_album?.length) && <> - - {brandInfo?.introductory_video_resource?.url && - } - {brandInfo?.brand_album?.length - && brandInfo?.brand_album?.split(',').map((d) => - - - ) - } - - - {curIndex} / {(brandInfo?.brand_album?.split(',').length || 0) + ((brandInfo && brandInfo.introductory_video_resource) ? 1 : 0)} - + + {brandInfo?.introductory_video_resource?.url && + } + {brandInfo?.brand_album?.length + && brandInfo?.brand_album?.split(',').map((d) => + + + ) + } + + + {curIndex} / {(brandInfo?.brand_album?.split(',').length || 0) + ((brandInfo && brandInfo.introductory_video_resource) ? 1 : 0)} + }