From c9afe279869e67c1a5a761302a7319bc2e780010 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Fri, 11 Aug 2023 10:00:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=BB=91=E5=AE=9A=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=202.=E6=B7=BB=E5=8A=A0=E8=AF=BE=E6=97=B6?= =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=AE=B0=E5=BD=95=E6=97=B6=E9=97=B4=E6=AE=B5?= =?UTF-8?q?=203.=E5=AD=A6=E5=91=98=E6=97=A0=E5=AD=A6=E4=B9=A0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/lineChart/lineChart.tsx | 5 +++-- src/pages/business/hourHistory/hourHistory.tsx | 8 ++++++-- src/pages/business/videoInfo/videoInfo.tsx | 9 +++++---- src/pages/check/check.tsx | 11 ++++++----- src/pages/manage/depAdmin/depAdmin.tsx | 17 ++++++++++------- src/utils/time.ts | 1 + 6 files changed, 31 insertions(+), 20 deletions(-) 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 {