|
|
@@ -2,7 +2,7 @@
|
|
|
import Back from '@/components/back.uvue'
|
|
|
import Loading from '@/components/loading.uvue'
|
|
|
import { ref, onMounted, watch, nextTick, onUnmounted } from 'vue'
|
|
|
-import { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress } from '@/services/subject/course'
|
|
|
+import { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress, queryNextSubjectCourse } from '@/services/subject/course'
|
|
|
import { router, user } from '@/.cool'
|
|
|
const isLoading = ref(true)
|
|
|
const showControls = ref(true)
|
|
|
@@ -51,10 +51,10 @@ function initOnlibeRecord() {
|
|
|
|
|
|
const course = ref<SubjectCourseResult>()
|
|
|
//通过路由参数获取课程id
|
|
|
-async function fetchCatalog() {
|
|
|
- course.value = await fetchSubjectCourseApp({ id: router.query().id })
|
|
|
+async function fetchCatalog(isRefresh = false) {
|
|
|
+ course.value = await fetchSubjectCourseApp({ id: user.courseId.value })
|
|
|
progressStatus.value = course.value?.courseUserProgress.status
|
|
|
- progress2.value = Number(router.query().progress)
|
|
|
+ progress2.value = isRefresh ? 1 : Number(router.query().progress)
|
|
|
console.log(progress2.value);
|
|
|
// if (!course.value?.courseUserProgress) {
|
|
|
// await updateSubjectProgress({
|
|
|
@@ -84,6 +84,7 @@ async function handleEnded() {
|
|
|
progress2.value++
|
|
|
}
|
|
|
const status = ref('wait')
|
|
|
+const visible = ref(false)
|
|
|
onShow(async () => {
|
|
|
isLoading.value = true
|
|
|
var pages = getCurrentPages();
|
|
|
@@ -92,16 +93,34 @@ onShow(async () => {
|
|
|
console.log(status.value);
|
|
|
if (status.value === 'success') {
|
|
|
if (progress2.value === 6) {
|
|
|
+ let nextCourseId = ''
|
|
|
if (progressStatus.value === 0) {
|
|
|
- const res = await updateSubjectProgress({
|
|
|
+ nextCourseId = await updateSubjectProgress({
|
|
|
courseId: course.value?.id,
|
|
|
mainProgress: 1,
|
|
|
assistantProgress: 6,
|
|
|
status: 1
|
|
|
})
|
|
|
- user.setCourseId(res as string)
|
|
|
+ console.log(nextCourseId);
|
|
|
+ user.setCourseId(nextCourseId)
|
|
|
+ await fetchCatalog(true)
|
|
|
+ uni.createVideoContext('video1').pause()
|
|
|
+ console.log(222);
|
|
|
+ isLoading.value = false
|
|
|
+ visible.value = true
|
|
|
+ } else {
|
|
|
+ nextCourseId = await queryNextSubjectCourse({
|
|
|
+ id: course.value?.id,
|
|
|
+ })
|
|
|
+ console.log(nextCourseId);
|
|
|
+ user.setCourseId(nextCourseId)
|
|
|
+ await fetchCatalog(true)
|
|
|
+ uni.createVideoContext('video1').pause()
|
|
|
+ console.log(222);
|
|
|
+ isLoading.value = false
|
|
|
+ visible.value = true
|
|
|
}
|
|
|
- router.back()
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
progress2.value++;
|
|
|
@@ -206,8 +225,13 @@ function playVoice(val) {
|
|
|
}
|
|
|
function handleLoadedMetadata() {
|
|
|
// 视频加载完成后,设置全屏播放
|
|
|
- uni.createVideoContext('video1').requestFullScreen()
|
|
|
+ // uni.createVideoContext('video1').requestFullScreen()
|
|
|
}
|
|
|
+function playNext() {
|
|
|
+ visible.value = false
|
|
|
+ progress2.value = 1
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
@@ -331,6 +355,16 @@ onUnmounted(() => {
|
|
|
</view>
|
|
|
|
|
|
</cl-page>
|
|
|
+ <cl-popup v-model="visible" direction="center" title="诗词欣赏" :show-header="false" :maskClosable="false">
|
|
|
+ <view class="p-2">
|
|
|
+ <cl-image lazy-load :src="course?.ossIconPath" mode="heightFix"
|
|
|
+ class="!w-full !h-[28vh] mb-[2vh] rounded-xl"></cl-image>
|
|
|
+ <cl-row :gutter="12">
|
|
|
+ <cl-col :span="12"> <cl-button type="info" @click="router.back()">返回</cl-button></cl-col>
|
|
|
+ <cl-col :span="12"> <cl-button type="success" @click="playNext">播放下集</cl-button></cl-col>
|
|
|
+ </cl-row>
|
|
|
+ </view>
|
|
|
+ </cl-popup>
|
|
|
</template>
|
|
|
<style lang="scss" scoped>
|
|
|
.translate50 {
|