|
@@ -0,0 +1,139 @@
|
|
|
+import CourseVideoItem from "@/business-components/course-video-item";
|
|
|
+import SectionDetail from "@/business-components/section-detail";
|
|
|
+import ColHeader from "@/components/col-header";
|
|
|
+import ColVideo from "@/components/col-video";
|
|
|
+import request from "@/helpers/request";
|
|
|
+import { Cell, Icon, Rate, Tab, Tabs, Image, Button, Sticky, Field } from "vant";
|
|
|
+import { defineComponent } from "vue";
|
|
|
+import styles from './video-class-detail.module.less';
|
|
|
+import { state } from "@/state";
|
|
|
+
|
|
|
+import iconTeacher from '@common/images/icon_teacher.png';
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ name: 'VideoClassDetail',
|
|
|
+ data() {
|
|
|
+ const query = this.$route.query
|
|
|
+ return {
|
|
|
+ groupId: query.groupId,
|
|
|
+ classId: query.classId,
|
|
|
+ tabIndex: 1,
|
|
|
+ title: '',
|
|
|
+ detailList: [],
|
|
|
+ posterUrl: '',
|
|
|
+ srcUrl: '',
|
|
|
+ message: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ users() {
|
|
|
+ return state.user.data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ try {
|
|
|
+ const res = await request.get('/api-teacher/videoLessonGroup/selectVideoLesson', {
|
|
|
+ params: {
|
|
|
+ groupId: this.groupId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const result = res.data || {}
|
|
|
+ this.title = result.lessonGroup.lessonName
|
|
|
+ this.detailList = result.detailList || []
|
|
|
+ this.detailList.forEach((item: any) => {
|
|
|
+ if (item.id === Number(this.classId)) {
|
|
|
+ this.posterUrl = item.coverUrl
|
|
|
+ this.srcUrl = item.videoUrl
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch { }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onPlay(item: any) {
|
|
|
+ this.posterUrl = item.imgUrl
|
|
|
+ this.srcUrl = item.videoUrl
|
|
|
+ }
|
|
|
+ },
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ <div class={styles['video-class-detail']}>
|
|
|
+ <ColHeader v-slots={{
|
|
|
+ content: () => (
|
|
|
+ <ColVideo src={this.srcUrl} poster={this.posterUrl} />
|
|
|
+ )
|
|
|
+ }} />
|
|
|
+ <Cell border={false} class={styles.cell} title={this.title} titleClass={styles.titleInfo} v-slots={{
|
|
|
+ icon: () => (<Icon name="video" size={18} style={{ display: 'flex', alignItems: 'center' }} />),
|
|
|
+ value: () => (<div class={styles.label}><span>1</span>/4课时</div>)
|
|
|
+ }}></Cell>
|
|
|
+
|
|
|
+ <Tabs v-model:active={this.tabIndex} class={styles.infoField} color="var(--van-primary)" lineWidth={20}>
|
|
|
+ <Tab title="目录" name={1}>
|
|
|
+ <div style={{ height: 'calc(100vh - 320px)', overflowY: 'auto' }}>
|
|
|
+ <SectionDetail title="课程列表" icon="courseList" >
|
|
|
+ {this.detailList.map((item: any) => (
|
|
|
+ <CourseVideoItem class={'mb12'} detail={{
|
|
|
+ id: item.id,
|
|
|
+ title: item.videoTitle,
|
|
|
+ content: item.videoContent,
|
|
|
+ imgUrl: item.coverUrl,
|
|
|
+ videoUrl: item.videoUrl
|
|
|
+ }} onPlay={this.onPlay} />
|
|
|
+ ))}
|
|
|
+ </SectionDetail>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </Tab>
|
|
|
+ <Tab title="简介" name={2}>
|
|
|
+ <Cell class={styles['open-teacher-info']} border={false} v-slots={{
|
|
|
+ icon: () => (<Image class={styles.userLogo} src={this.users?.headUrl || iconTeacher} fit="cover" />)
|
|
|
+ }}>
|
|
|
+ <div class={styles['teacher-info']}>
|
|
|
+ <div class={styles['users']}>
|
|
|
+ <div class={styles['teacher-name']}>
|
|
|
+ {this.users?.username}
|
|
|
+ </div>
|
|
|
+ <Rate modelValue={this.users?.starGrade} iconPrefix="iconfont" color="#FFC459" void-icon="star_default" icon="star_active" size={15} />
|
|
|
+ </div>
|
|
|
+ <div class={styles.level}>
|
|
|
+ 粉丝{this.users?.fansNum}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class={styles['teacher-desc']}>
|
|
|
+ <Button type="primary" icon="plus" size="mini" style={{ borderRadius: '5px', padding: '0 8px' }}>关注</Button>
|
|
|
+ </div>
|
|
|
+ </Cell>
|
|
|
+ <SectionDetail>
|
|
|
+ <p class={styles.introduction}>课程介绍</p>
|
|
|
+ </SectionDetail>
|
|
|
+ </Tab>
|
|
|
+ <Tab title="讨论" name={3}>
|
|
|
+ <div style={{ height: 'calc(100vh - 365px)', overflowY: 'auto' }}>
|
|
|
+ {[1, 2, 3].map((item: any) => (
|
|
|
+ <Cell class={[styles['message-list'], styles['message-active']]} valueClass={styles['message-time']} v-slots={{
|
|
|
+ icon: () => (<Image class={styles.userLogo} src={this.users?.headUrl || iconTeacher} fit="cover" />),
|
|
|
+ title: () => (<div class={styles.title}>
|
|
|
+ <div class={styles['message-name']}>讨论讨论讨</div>
|
|
|
+ <div class={styles['message-time']}>2022年4月11日</div>
|
|
|
+ </div>),
|
|
|
+ label: () => (<div class={styles.label}>电光2323232323冷雾中</div>)
|
|
|
+ }} />
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Sticky offsetBottom={0} position='bottom'>
|
|
|
+ <Field
|
|
|
+ placeholder="快来讨论吧~"
|
|
|
+ v-model={this.message}
|
|
|
+ v-slots={{
|
|
|
+ button: () => (
|
|
|
+ <Button type="primary" disabled={!this.message} style={{ padding: '0 20px' }} size="small" round>发布</Button>
|
|
|
+ )
|
|
|
+ }} />
|
|
|
+ </Sticky>
|
|
|
+ </Tab>
|
|
|
+ </Tabs>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+})
|