From 485bc0815b8514b0af0fc080290301642e16062f Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 5 Sep 2023 10:35:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=A6=E4=B9=A0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8A=A0=E8=BD=BD=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 ++-- .../learningRecord/learningRecord.tsx | 19 +++++++++++++------ src/components/lineChart/lineChart.tsx | 2 +- src/components/spinner/style.scss | 13 ++++++++++--- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.env b/.env index 3852d45..86e2b46 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -TARO_APP_API=https://yjx.dev.yaojiankang.top -#TARO_APP_API=https://mooc.yaojiankang.top +#TARO_APP_API=https://yjx.dev.yaojiankang.top +TARO_APP_API=https://mooc.yaojiankang.top #TARO_APP_API=https://shopfix.yaojiankang.top #TARO_APP_API=https://playedu.yaojiankang.top TARO_APP_LGOIN=true diff --git a/src/components/learningRecord/learningRecord.tsx b/src/components/learningRecord/learningRecord.tsx index 6562830..c4118e9 100644 --- a/src/components/learningRecord/learningRecord.tsx +++ b/src/components/learningRecord/learningRecord.tsx @@ -5,6 +5,7 @@ import LineChart from "@/components/lineChart/lineChart"; import {FC, useEffect, useState} from "react"; import {StatisticsParam, userApi} from "@/api"; import styles from './learningRecord.module.scss' +import Spin from "@/components/spinner"; const tabList: TabList[] = [ { @@ -38,16 +39,19 @@ interface Props { */ const LearningRecord: FC = ({userId}) => { const [lineData, setLineData] = useState([]) + const [loading, setLoading] = useState(false) async function getStatistics(data: StatisticsParam) { try { + setLoading(true) const res = await userApi.statistics(userId, data) const everyDayValue = everyDay(data.start_time, Number(data.end_time), res.data) setLineData(everyDayValue) } catch (e) { setLineData([]) } + setLoading(false) } function tabChange({tab}: OnChangOpt) { @@ -60,13 +64,16 @@ const LearningRecord: FC = ({userId}) => { return ( - - 总共学习 - - {formatTime(lineData.reduce((pre, cur) => pre + cur.value, 0) || 0)} - + + + + 总共学习 + + {formatTime(lineData.reduce((pre, cur) => pre + cur.value, 0) || 0)} + + + - ) } diff --git a/src/components/lineChart/lineChart.tsx b/src/components/lineChart/lineChart.tsx index 18a92ff..9bbf694 100644 --- a/src/components/lineChart/lineChart.tsx +++ b/src/components/lineChart/lineChart.tsx @@ -35,7 +35,7 @@ const LineChart: FC = ({data}) => { - {!maxHeight.value && 暂无数据} + {!maxHeight.value && 暂无学习记录} { !!maxHeight.value && lineChartList.map(d => diff --git a/src/components/spinner/style.scss b/src/components/spinner/style.scss index dbaa3e9..ac88fd3 100644 --- a/src/components/spinner/style.scss +++ b/src/components/spinner/style.scss @@ -5,9 +5,16 @@ width: auto; position: absolute; z-index: 99999; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); + background-color: rgba(#fff, 1.0); + width: 100%; + height: 100%; + top: 0; + left: 0; + right: 0; + bottom: 0; + //left: 50%; + //top: 50%; + //transform: translate(-50%, -50%); } &.is-fixed {