|
|
|
@ -60,9 +60,6 @@ export const VideoList: FC<Props> = ({categoryKey, setCategoryKey}) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rateOfLearning(id: number, class_hour: number): JSX.Element { |
|
|
|
|
switch (categoryKey) { |
|
|
|
|
case "is_required": |
|
|
|
|
case "is_not_required": |
|
|
|
|
const find = records.find(d => d?.course_id === id) |
|
|
|
|
if (find) { |
|
|
|
|
if (class_hour === find.finished_count) { |
|
|
|
@ -72,6 +69,16 @@ export const VideoList: FC<Props> = ({categoryKey, setCategoryKey}) => { |
|
|
|
|
} |
|
|
|
|
return (<View>{`共${class_hour}节/已学0节`}</View>) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function rateOfPercent(id: number, class_hour: number): string { |
|
|
|
|
const find = records.find(d => d?.course_id === id) |
|
|
|
|
if (find) { |
|
|
|
|
if (class_hour === find.finished_count) { |
|
|
|
|
return '100%' |
|
|
|
|
} |
|
|
|
|
return ` ${((find.finished_count / class_hour) * 100).toFixed(0)}%` |
|
|
|
|
} |
|
|
|
|
return '0%' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -117,6 +124,7 @@ export const VideoList: FC<Props> = ({categoryKey, setCategoryKey}) => { |
|
|
|
|
key={c.id} |
|
|
|
|
time={formatMinute(c.course_duration)} |
|
|
|
|
content={rateOfLearning(c.id, c.class_hour)} |
|
|
|
|
schedule={`学习进度${rateOfPercent(c.id, c.class_hour)}`} |
|
|
|
|
/>) |
|
|
|
|
} |
|
|
|
|
</View> |
|
|
|
|