|
|
|
@ -22,8 +22,8 @@ const Time: FC = () => { |
|
|
|
|
const [list, setList] = useState<List[]>([ |
|
|
|
|
{title: '今日时长', time: '00:00', src: time1}, |
|
|
|
|
{title: '累计时长', time: '00:00', src: time2}, |
|
|
|
|
{title: '必修课', time: '0/0', src: curriculum1, type: 1}, |
|
|
|
|
{title: '选修课', time: '0/0', src: curriculum2, type: 2}, |
|
|
|
|
{title: '必修课', time: '0', src: curriculum1, type: 1}, |
|
|
|
|
{title: '选修课', time: '0', src: curriculum2, type: 2}, |
|
|
|
|
{title: '已完成', time: '0', src: over, type: 3}, |
|
|
|
|
{title: '未完成', time: '0', src: incomplete, type: 4}, |
|
|
|
|
]) |
|
|
|
@ -31,14 +31,14 @@ const Time: FC = () => { |
|
|
|
|
|
|
|
|
|
Taro.useDidShow(async () => { |
|
|
|
|
try { |
|
|
|
|
const {stats} = await curriculum.course() |
|
|
|
|
const res = await curriculum.course() |
|
|
|
|
const oldList: List[] = JSON.parse(JSON.stringify(list)) |
|
|
|
|
oldList[0].time = formatMinute(stats.today_learn_duration) |
|
|
|
|
oldList[1].time = formatMinute(stats.learn_duration) |
|
|
|
|
oldList[2].time = stats.required_course_count |
|
|
|
|
oldList[3].time = stats.nun_required_course_count |
|
|
|
|
oldList[4].time = stats.required_finished_course_count + stats.nun_required_finished_course_count |
|
|
|
|
oldList[5].time = stats.total_course_count - (stats.required_finished_course_count + stats.nun_required_finished_course_count) |
|
|
|
|
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[4].time = res.finished_count |
|
|
|
|
oldList[5].time = res.not_finished_count |
|
|
|
|
setList(oldList) |
|
|
|
|
} catch (e) { |
|
|
|
|
} |
|
|
|
|