我的学习记录

v2
king 1 year ago
parent a318591244
commit cecc425f17
  1. 4
      .env
  2. 15
      src/pages/my/components/header/time.tsx
  3. 6
      src/pages/my/my.tsx

@ -1,5 +1,5 @@
#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://mooc.yaojiankang.top
#TARO_APP_API=https://shopfix.yaojiankang.top
#TARO_APP_API=https://playedu.yaojiankang.top
TARO_APP_LGOIN=true

@ -2,7 +2,7 @@ import {Image, View} from "@tarojs/components";
import styles from '../../my.module.scss'
import Taro from "@tarojs/taro";
import {curriculum} from "@/api";
import {FC, useState} from "react";
import {FC, useEffect, useState} from "react";
import {formatMinute} from "@/utils/time";
import time1 from "@/static/img/time1.png";
import time2 from "@/static/img/time2.png";
@ -28,20 +28,17 @@ const Time: FC = () => {
// {title: '未完成(必修)', time: '0', src: incomplete, type: 4},
])
Taro.useDidShow(async () => {
try {
const res = await curriculum.course()
useEffect(() => {
curriculum.course().then(res => {
const oldList: List[] = JSON.parse(JSON.stringify(list))
oldList[0].time = formatMinute(res.today_learn_time)
oldList[1].time = formatMinute(res.total_learn_time)
// oldList[2].time = res.required_count
// oldList[3].time = res.not_required_count
oldList[2].time = res.finished_count
oldList[3].time = res.not_finished_count
// oldList[2].time = res.finished_count
// oldList[3].time = res.not_finished_count
setList(oldList)
} catch (e) {
}
})
})
function jump(type?: number) {

@ -61,10 +61,10 @@ const My: FC = () => {
Taro.useDidShow(async () => {
try {
const res = await curriculum.course()
setAuditMode(res.audit_mode)
setAuditMode(!!res?.audit_mode)
const oldList: List[] = JSON.parse(JSON.stringify(list))
oldList[1].time = res.finished_count || 0
oldList[2].time = res.not_finished_count || 0
oldList[0].time = res.finished_count || 0
oldList[1].time = res.not_finished_count || 0
setList(oldList)
} catch (e) {
}

Loading…
Cancel
Save