diff --git a/src/components/lineChart/lineChart.tsx b/src/components/lineChart/lineChart.tsx index 474306b..dad4a8e 100644 --- a/src/components/lineChart/lineChart.tsx +++ b/src/components/lineChart/lineChart.tsx @@ -30,11 +30,12 @@ const LineChart: FC = ({data}) => { return ( <> - {maxHeight.time}日最努力,学习了{formatMinute(maxHeight.value)} + {maxHeight.time && {maxHeight.time}日最努力,学习了{formatMinute(maxHeight.value)}} + {!maxHeight.value && 暂无数据} { - maxHeight.value && lineChartList.map(d => + !!maxHeight.value && lineChartList.map(d => diff --git a/src/pages/business/hourHistory/hourHistory.tsx b/src/pages/business/hourHistory/hourHistory.tsx index ea89ca9..15d5bd6 100644 --- a/src/pages/business/hourHistory/hourHistory.tsx +++ b/src/pages/business/hourHistory/hourHistory.tsx @@ -52,10 +52,14 @@ const HourHistory: FC = () => { { times.map(d => - {formatDateTime(new Date(d.start_at), 'MM-dd')} + + {formatDateTime(new Date(d.start_at), 'MM-dd')} + {formatDateTime(new Date(d.start_at), 'HH:mm:ss')} - + {formatDateTime(new Date(d.end_at), 'HH:mm:ss')} + { } } - function setHors(is_complete: boolean, play_id: number) { + function setHors(preview: boolean, play_id: number) { + console.log(preview) setPlaying(true) - setPreview(is_complete) + setPreview(preview) setPlayId(play_id) } @@ -48,7 +49,7 @@ const VideoInfo: FC = () => { /** 播放下一个视频 */ const playNext = useCallback(() => { const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] - if (playId === flats?.[flats.length - 1]?.id) { + if (playId === flats?.[flats.length - 1]?.id && !preview) { Taro.showModal({title: '当前课程结束'}) eventsIndex.trigger({id: Number(id)}) return; @@ -70,7 +71,7 @@ const VideoInfo: FC = () => { return } } - }, [playId, data]) + }, [playId, data, preview]) /** * 判断当前课程是否完成 diff --git a/src/pages/check/check.tsx b/src/pages/check/check.tsx index a558a36..149fac2 100644 --- a/src/pages/check/check.tsx +++ b/src/pages/check/check.tsx @@ -1,5 +1,5 @@ import {FC, useCallback, useEffect, useRef, useState} from "react"; -import {Button, Form, Image, Input, View} from "@tarojs/components"; +import { Form, Image, Input, View} from "@tarojs/components"; import {Profile} from "@/store"; import {userApi} from "@/api"; import Taro from "@tarojs/taro"; @@ -7,6 +7,7 @@ import {regexTel} from "@/utils/regu"; import styles from './check.module.scss' import code from '@/static/img/vCode.png' import tel from '@/static/img/tel.png' +import MyButton from "@/components/button/MyButton"; const Bing: FC = () => { const form = useRef(null) @@ -66,7 +67,7 @@ const Bing: FC = () => { }, [codeTime, phone_number]) return ( - +
@@ -94,14 +95,14 @@ const Bing: FC = () => { - +
) diff --git a/src/pages/manage/depAdmin/depAdmin.tsx b/src/pages/manage/depAdmin/depAdmin.tsx index 5287b66..df6af00 100644 --- a/src/pages/manage/depAdmin/depAdmin.tsx +++ b/src/pages/manage/depAdmin/depAdmin.tsx @@ -16,15 +16,20 @@ const DepAdmin: FC = () => { const [users, setUsers] = useState([]) const [isPut, setIsPut] = useState(false) const [depName, setDepName] = useState('') + const [reset, setReset] = useState(false) const {company} = Profile.useContainer() async function getData() { show && setShow(false) - const res = await ManageApi.depList(router.params.dep_id || 0) - if (res) { - setManages(res.department) - setUsers(res.data) + try { + const res = await ManageApi.depList(router.params.dep_id || 0) + if (res) { + setReset(true) + setManages(res.department) + setUsers(res.data) + } + } catch (e) { } } @@ -127,9 +132,7 @@ const DepAdmin: FC = () => { }, []) Taro.useDidShow(() => { - if (manages.length) { - getData() - } + reset && getData() }) return ( diff --git a/src/utils/time.ts b/src/utils/time.ts index c043e85..a9eba5e 100644 --- a/src/utils/time.ts +++ b/src/utils/time.ts @@ -108,6 +108,7 @@ export function everyDay(start_time: number, end_time: number, data: Record { const day = start_time + index * time return {