diff --git a/src/components/empty/empty.tsx b/src/components/empty/empty.tsx index 57ec81d..1702395 100644 --- a/src/components/empty/empty.tsx +++ b/src/components/empty/empty.tsx @@ -10,7 +10,7 @@ interface Props { const Empty: FC = ({name}) => { return ( - + {name} ) diff --git a/src/components/popPut/popPut.tsx b/src/components/popPut/popPut.tsx index 4184ffc..ed2f6dc 100644 --- a/src/components/popPut/popPut.tsx +++ b/src/components/popPut/popPut.tsx @@ -1,7 +1,8 @@ import {FC, ReactNode, useEffect, useState} from "react"; -import {View, Image} from "@tarojs/components"; +import {View} from "@tarojs/components"; import Icon from "@/components/icon"; import CustomPageContainer from "@/components/custom-page-container/custom-page-container"; +import Img from "@/components/image/image"; interface Props { height?: number | string @@ -46,13 +47,13 @@ const PopPut: FC = ({title, chevron, content, image, isProp, children, sh <> - {opt.leftImage != null && } + {opt.leftImage != null && } {title} {content} {!chevron && } - {image && } + {image && } { diff --git a/src/pages/business/videoInfo/videoInfo.tsx b/src/pages/business/videoInfo/videoInfo.tsx index 731c360..5dee99c 100644 --- a/src/pages/business/videoInfo/videoInfo.tsx +++ b/src/pages/business/videoInfo/videoInfo.tsx @@ -9,7 +9,6 @@ import eventsIndex from "@/hooks/eventsIndex"; import {formatMinute} from "@/utils/time"; import videoEvents from "@/hooks/videoEvents"; import unique_ident from "@/hooks/unique_ident"; -import Spin from "@/components/spinner"; import Img from "@/components/image/image"; const VideoInfo: FC = () => { @@ -18,7 +17,6 @@ const VideoInfo: FC = () => { const [playId, setPlayId] = useState(null) const [preview, setPreview] = useState(false) // 预览 const [playing, setPlaying] = useState(false) // 学习中 - const [enable, setEnable] = useState(true) const getData = useCallback(async (playing: boolean) => { try { @@ -27,7 +25,6 @@ const VideoInfo: FC = () => { playId != null && currentVideo(res, playing) // 用于自动播放 判断当前课程是否完成 } catch (e) { } - setEnable(false) }, [playing, playId]) const curEnd = (test?: boolean) => { @@ -106,31 +103,28 @@ const VideoInfo: FC = () => { videoEvents.videoOff() }) return ( - <> - - - - { - playId - ? - : - } - + + + { + playId + ? + : + } + - - - {data?.is_required ? '必修' : '选修'} - {data?.course.class_hour}课时 - - {data?.course.title} - - 时长:{formatMinute(data?.duration || 0)} - 学习进度{((data?.learn_hour_records.length || 0) / (data?.course.class_hour || 1) * 100).toFixed(0)}% - + + + {data?.is_required ? '必修' : '选修'} + {data?.course.class_hour}课时 + + {data?.course.title} + + 时长:{formatMinute(data?.duration || 0)} + 学习进度{((data?.learn_hour_records.length || 0) / (data?.course.class_hour || 1) * 100).toFixed(0)}% - - + + ) } diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index b91c4b0..c2f9131 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -40,7 +40,7 @@ const Home: FC = () => { {data && } { !token && - 登录后享受更多学习服务~ + 登录后享受更多服务~ 立即登录 } diff --git a/src/pages/index/index.config.ts b/src/pages/index/index.config.ts index 3637195..752ef7b 100644 --- a/src/pages/index/index.config.ts +++ b/src/pages/index/index.config.ts @@ -1,5 +1,5 @@ export default definePageConfig({ - navigationBarTitleText: '医学道', + navigationBarTitleText: '学习课程', navigationBarBackgroundColor: '#92ecc5', navigationBarTextStyle: 'white', }) diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx index 6f9b245..ad087dd 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.tsx +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -6,12 +6,14 @@ import styles from './courseAdmin.module.scss' import Taro, {useReachBottom} from "@tarojs/taro"; import MyButton from "@/components/button/MyButton"; import storageDep from "@/hooks/storageDep"; +import Spin from "@/components/spinner"; const CourseAdmin: FC = () => { const [total, setTotal] = useState(0) const [data, setData] = useState([]) const [batch, setBatch] = useState(false) const [curs, setCurs] = useState([]) + const [enable, setEnable] = useState(true) const [param, setParam] = useState({ page: 1, page_size: 10, @@ -34,6 +36,7 @@ const CourseAdmin: FC = () => { ]) } }) + setEnable(false) } useEffect(() => { @@ -149,6 +152,7 @@ const CourseAdmin: FC = () => { return ( + diff --git a/src/pages/manage/depAdmin/depAdmin.tsx b/src/pages/manage/depAdmin/depAdmin.tsx index df6af00..41a8e22 100644 --- a/src/pages/manage/depAdmin/depAdmin.tsx +++ b/src/pages/manage/depAdmin/depAdmin.tsx @@ -8,6 +8,7 @@ import folder from '@/static/img/folder.png' import ShowModel from "@/components/showModel/showModel"; import Empty from "@/components/empty/empty"; import {Profile} from '@/store' +import Spin from "@/components/spinner"; const DepAdmin: FC = () => { const router = useRouter() @@ -17,6 +18,7 @@ const DepAdmin: FC = () => { const [isPut, setIsPut] = useState(false) const [depName, setDepName] = useState('') const [reset, setReset] = useState(false) + const [enable, setEnable] = useState(true) const {company} = Profile.useContainer() @@ -31,6 +33,7 @@ const DepAdmin: FC = () => { } } catch (e) { } + setEnable(false) } function showPop(name: string | undefined) { @@ -137,6 +140,7 @@ const DepAdmin: FC = () => { return ( <> + {manages.map(d => { const [ids, setIds] = useState([]) const [deps, setDeps] = useState([]) const [required, setRequired] = useState([]) + const [enable, setEnable] = useState(true) useEffect(() => { curriculum.department().then(res => { setDeps(res.data) }) + setEnable(false) setIds(JSON.parse(params.depIds)) setRequired(JSON.parse(params.required || "[]")) }, []) @@ -79,6 +82,7 @@ const SelectDep: FC = () => { return ( + {deps.map((d) => onChange(d.id)}> diff --git a/src/pages/manage/userInfo/components/info.tsx b/src/pages/manage/userInfo/components/info.tsx index db7f5fc..973fdf0 100644 --- a/src/pages/manage/userInfo/components/info.tsx +++ b/src/pages/manage/userInfo/components/info.tsx @@ -1,6 +1,7 @@ import {FC} from "react"; -import {Image, Text, View} from "@tarojs/components"; +import { Text, View} from "@tarojs/components"; import styles from '../userInfo.module.scss' +import Img from "@/components/image/image"; interface Props { data: User | null @@ -12,7 +13,7 @@ const Info: FC = ({data}) => { return ( <> - + {data?.name} diff --git a/src/pages/manage/userInfo/userInfo.module.scss b/src/pages/manage/userInfo/userInfo.module.scss index 11d96fc..9cbc680 100644 --- a/src/pages/manage/userInfo/userInfo.module.scss +++ b/src/pages/manage/userInfo/userInfo.module.scss @@ -15,7 +15,6 @@ .image { width: 120rpx; height: 120rpx; - background: #ddd; border-radius: 10rpx; overflow: hidden; } diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx index b7bced8..b797fed 100644 --- a/src/pages/preview/brand/info/info.tsx +++ b/src/pages/preview/brand/info/info.tsx @@ -7,6 +7,7 @@ import LineEllipsis from "@/components/textCollapse/collapse"; import Empty from "@/components/empty/empty"; import Img from "@/components/image/image"; import {rfc33392time} from "@/utils/day"; +import Spin from "@/components/spinner"; type Params = { id: number @@ -15,18 +16,12 @@ const BrandInfo: FC = () => { const {id} = useRouter().params as unknown as Params const [brandInfo, setBrandInfo] = useState() const [articleList, setArticleList] = useState([]) - const [curIndex,setCurIndex] = useState(1) + const [curIndex, setCurIndex] = useState(1) const [page, setPage] = useState(1) const [total, setTotal] = useState(0) + const [enable, setEnable] = useState(true) useEffect(() => { - Taro.showLoading({ - title: '加载中', - mask: true - }) - setTimeout(function () { - Taro.hideLoading() - }, 1000) getData() }, [id]) @@ -35,7 +30,7 @@ const BrandInfo: FC = () => { const data = await brandApi.info(id) Taro.setNavigationBarTitle({title: data.name}) setBrandInfo(data) - const data1 = await brandApi.articleList(id,page) + const data1 = await brandApi.articleList(id, page) setTotal(data1.total) setArticleList([ ...(articleList || []), @@ -44,6 +39,7 @@ const BrandInfo: FC = () => { } catch (e) { // setBrandInfo({disabled: 0, graphic_introduction: "", id: 0, introductory_video: "", name: "", brand_album:['1','2','3']}) } + setEnable(false) } useReachBottom(useCallback(() => { @@ -53,7 +49,7 @@ const BrandInfo: FC = () => { }, [total, articleList])) useEffect(() => { - brandApi.articleList(id,page).then(res => { + brandApi.articleList(id, page).then(res => { setTotal(res.total) setArticleList([ ...(articleList || []), @@ -63,46 +59,46 @@ const BrandInfo: FC = () => { }, [page]) - function onChange(e){ - console.log(e) - setCurIndex(+e.detail.current+1) + function onChange(e) { + setCurIndex(+e.detail.current + 1) } return ( - - + + - { 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)} + {brandInfo?.name} diff --git a/src/pages/preview/brand/list/list.tsx b/src/pages/preview/brand/list/list.tsx index cf422a0..224a82b 100644 --- a/src/pages/preview/brand/list/list.tsx +++ b/src/pages/preview/brand/list/list.tsx @@ -1,10 +1,11 @@ import {FC, useCallback, useEffect, useState} from "react"; -import {Image, View} from "@tarojs/components"; +import {View} from "@tarojs/components"; import {brandApi, BrandRecord} from "@/api"; import styles from './list.module.scss' import Taro, {useReachBottom} from "@tarojs/taro"; import Empty from "@/components/empty/empty"; import Spinner from "@/components/spinner"; +import Img from "@/components/image/image"; const BrandList: FC = () => { const [page, setPage] = useState(1) @@ -52,13 +53,13 @@ const BrandList: FC = () => { return ( - + { brands.length ? <> {brands.map((d) => jumpInfo(d.id)} className={styles.box} key={d.id}> - + {d.name} {d.graphic_introduction} diff --git a/src/pages/preview/health/health.module.scss b/src/pages/preview/health/health.module.scss index f28a403..bd705b8 100644 --- a/src/pages/preview/health/health.module.scss +++ b/src/pages/preview/health/health.module.scss @@ -13,13 +13,6 @@ overflow: hidden; margin-bottom: 20rpx; position: relative; - - image, - Image { - background: #eee; - width: 100%; - min-height: 345rpx; - } } .play { diff --git a/src/pages/preview/health/health.tsx b/src/pages/preview/health/health.tsx index 7eede9d..a715fed 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 play from '@/static/img/play.png' import Empty from "@/components/empty/empty"; import Spin from "@/components/spinner"; +import Img from "@/components/image/image"; const Health: FC = () => { const [page, setPage] = useState(1) @@ -43,7 +44,7 @@ const Health: FC = () => { { data.length > 0 ? data.map(d => jump(d)}> - + {d.title} {d.video_view}观看 diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index a146c9b..c1b893a 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -4,29 +4,31 @@ import styles from './list.module.scss' import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; import {illnessApi} from "@/api/illness"; import Empty from "@/components/empty/empty"; +import Spin from "@/components/spinner"; const BrandList: FC = () => { const params = useRouter().params as unknown as { id: number } const [page, setPage] = useState(1) const [articles, setArticles] = useState([]) - const [illness,setIllness] = useState<{name:string;description:string;resource:any;album:string[]}>() + // const [illness, setIllness] = useState<{ name: string; description: string; resource: any; album: string[] }>() const [total, setTotal] = useState(0) const [fetchDone, setFetchDone] = useState(false) + const [enable, setEnable] = useState(true) useEffect(() => { - Taro.showLoading({title: '加载中', mask: true}) getData().then() }, [page]) const getData = useCallback(async () => { try { const data = await illnessApi.articleInfo(params.id, page, 20) - Taro.setNavigationBarTitle({title:data.illness.name}) - setIllness(data.illness) + Taro.setNavigationBarTitle({title: data?.illness?.name || '暂无文章'}) + // setIllness(data.illness) setTotal(data.list.total) setArticles([...articles, ...data.list.list]) } catch (e) { } + setEnable(false) setFetchDone(true) Taro.hideLoading() }, [page]) @@ -44,12 +46,17 @@ const BrandList: FC = () => { return ( - + + { 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/profession/profession.module.scss b/src/pages/preview/profession/profession.module.scss index 57291c2..a1ee13c 100644 --- a/src/pages/preview/profession/profession.module.scss +++ b/src/pages/preview/profession/profession.module.scss @@ -10,13 +10,10 @@ box-sizing: border-box; display: flex; margin-bottom: 20rpx; +} + - Image, - image { - width: 320rpx; - max-height: 180rpx; - margin-right: 20rpx; - border-radius: 10rpx; - background: #eee; - } +.image { + margin-right: 20rpx; + border-radius: 10rpx; } diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index bafc47d..82ce6bd 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -1,4 +1,4 @@ -import {Image, ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; +import {ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; import {HomeApi} from "@/api"; import {useEffect, useState} from "react"; import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; @@ -6,6 +6,7 @@ import Empty from "@/components/empty/empty"; import Taro from "@tarojs/taro"; import styles from './profession.module.scss' import Spin from "@/components/spinner"; +import Img from "@/components/image/image"; interface KillData { data: Kill[] @@ -18,7 +19,6 @@ const Profession = () => { const [categoryId, setCategoryId] = useState(null) const [data, setData] = useState>(new Map) const [enable, setEnable] = useState(true) - const [loading, setLoading] = useState(false) /** * more 开启加载更多 @@ -35,7 +35,6 @@ const Profession = () => { } try { - setLoading(true) const res = await HomeApi.skillList(categoryId!, page, 10) const dataList = res.data.reduce((pre, cur) => { const index = pre.findIndex(d => d.id === cur.id) @@ -55,7 +54,6 @@ const Profession = () => { setData(oldData) } catch (e) { } - setLoading(false) } useEffect(() => { @@ -101,12 +99,11 @@ const Profession = () => { { data.data.map(d => jump(d)}> - + {d?.resource?.name} ) } - ) } diff --git a/src/static/css/module.scss b/src/static/css/module.scss index 8f57891..b021177 100644 --- a/src/static/css/module.scss +++ b/src/static/css/module.scss @@ -59,11 +59,6 @@ taro-button-core::after { align-items: center; justify-content: center; } - - .image { - width: 68px; - height: 68px; - } } .Textarea {