|
|
@ -1,7 +1,7 @@ |
|
|
|
import {FC, useState} from "react"; |
|
|
|
import {FC, useState} from "react"; |
|
|
|
import Tabs, {OnChangOpt} from "@/components/tabs/tabs"; |
|
|
|
import Tabs, {OnChangOpt} from "@/components/tabs/tabs"; |
|
|
|
import {Image, View} from "@tarojs/components"; |
|
|
|
import {Image, View} from "@tarojs/components"; |
|
|
|
import {CourseDepData} from "@/api"; |
|
|
|
import {CourseDepData, curriculum} from "@/api"; |
|
|
|
import Collapse from "@/components/collapse/collapse"; |
|
|
|
import Collapse from "@/components/collapse/collapse"; |
|
|
|
import Hours from "@/pages/business/videoInfo/components/hours"; |
|
|
|
import Hours from "@/pages/business/videoInfo/components/hours"; |
|
|
|
import Taro from "@tarojs/taro"; |
|
|
|
import Taro from "@tarojs/taro"; |
|
|
@ -95,6 +95,7 @@ const Catalogue: FC<Props> = ({data, setHors, id, playId}) => { |
|
|
|
|
|
|
|
|
|
|
|
function learning() { |
|
|
|
function learning() { |
|
|
|
const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] |
|
|
|
const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] |
|
|
|
|
|
|
|
|
|
|
|
if ((data?.learn_hour_records?.length || undefined) == data?.learn_record?.hour_count && flats.length) { |
|
|
|
if ((data?.learn_hour_records?.length || undefined) == data?.learn_record?.hour_count && flats.length) { |
|
|
|
if (flats[0].id === playId) { |
|
|
|
if (flats[0].id === playId) { |
|
|
|
videoEvents.setVideoState('play') |
|
|
|
videoEvents.setVideoState('play') |
|
|
@ -106,9 +107,28 @@ const Catalogue: FC<Props> = ({data, setHors, id, playId}) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data?.learn_hour_records.length) { |
|
|
|
if (data?.learn_hour_records.length) { |
|
|
|
const lastTimeId = data.learn_hour_records[data.learn_hour_records.length - 1].id |
|
|
|
const lastHours = data.learn_hour_records[data.learn_hour_records.length - 1] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (lastHours.courseHourRecordsFinish < 1) { |
|
|
|
|
|
|
|
Taro.showModal({ |
|
|
|
|
|
|
|
title: '考卷未完成,是否前往', |
|
|
|
|
|
|
|
content: '考卷未完成不能播放下一个视频', |
|
|
|
|
|
|
|
confirmText: '前往考试', |
|
|
|
|
|
|
|
cancelText: '观看视频', |
|
|
|
|
|
|
|
async success({confirm}) { |
|
|
|
|
|
|
|
if (confirm) { |
|
|
|
|
|
|
|
const {hour_test} = await curriculum.hourPlay(lastHours.course_id, lastHours.id) |
|
|
|
|
|
|
|
Taro.navigateTo({url: `/pages/business/test/test?testId=${hour_test?.id}`}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
setHors(true, lastHours.id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (const [index, flat] of flats.entries()) { |
|
|
|
for (const [index, flat] of flats.entries()) { |
|
|
|
if (flat.id === lastTimeId) { |
|
|
|
if (flat.id === lastHours.id) { |
|
|
|
const next = flats[index + 1] |
|
|
|
const next = flats[index + 1] |
|
|
|
if (next) { |
|
|
|
if (next) { |
|
|
|
if (next.id === playId) { |
|
|
|
if (next.id === playId) { |
|
|
@ -119,8 +139,6 @@ const Catalogue: FC<Props> = ({data, setHors, id, playId}) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
Taro.showToast({title: "无播放视频", icon: 'error'}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|