视图修改、接口修改
This commit is contained in:
@@ -3,16 +3,17 @@
|
||||
v-if="courseId"
|
||||
:course-id="courseId"
|
||||
:show-back-button="true"
|
||||
back-button-text="返回课程列表"
|
||||
back-button-text="返回"
|
||||
@back="handleBack"
|
||||
@start-learning="handleStartLearning"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { computed, onMounted } from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { CourseDetail } from '@/views/public/course/components';
|
||||
import { courseApi } from '@/apis/study';
|
||||
|
||||
defineOptions({
|
||||
name: 'CourseDetailView'
|
||||
@@ -27,6 +28,10 @@ const courseId = computed(() => route.query.courseId as string || '');
|
||||
function handleBack() {
|
||||
router.back();
|
||||
}
|
||||
onMounted(() => {
|
||||
// 调用接口更新浏览记录
|
||||
courseApi.incrementViewCount(courseId.value);
|
||||
});
|
||||
|
||||
// 开始学习课程
|
||||
function handleStartLearning(courseId: string, chapterIndex: number, nodeIndex: number) {
|
||||
|
||||
Reference in New Issue
Block a user