|
@@ -1,14 +1,14 @@
|
|
|
-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 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';
|
|
|
+import iconTeacher from '@common/images/icon_teacher.png'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'VideoClassDetail',
|
|
@@ -22,7 +22,10 @@ export default defineComponent({
|
|
|
detailList: [],
|
|
|
posterUrl: '',
|
|
|
srcUrl: '',
|
|
|
- message: ''
|
|
|
+ message: '',
|
|
|
+ navHeight: 0 as any,
|
|
|
+ currentClassIndex: 1,
|
|
|
+ reload: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -31,76 +34,144 @@ export default defineComponent({
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
|
+ this.navHeight = sessionStorage.getItem('navHeight') || 0
|
|
|
try {
|
|
|
- const res = await request.get('/api-teacher/videoLessonGroup/selectVideoLesson', {
|
|
|
- params: {
|
|
|
- groupId: this.groupId
|
|
|
+ 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) => {
|
|
|
+ this.detailList.forEach((item: any, index: number) => {
|
|
|
if (item.id === Number(this.classId)) {
|
|
|
this.posterUrl = item.coverUrl
|
|
|
this.srcUrl = item.videoUrl
|
|
|
+ this.title = item.videoTitle
|
|
|
+ this.currentClassIndex = index + 1
|
|
|
}
|
|
|
})
|
|
|
- } catch { }
|
|
|
+ } catch {}
|
|
|
},
|
|
|
methods: {
|
|
|
onPlay(item: any) {
|
|
|
+ this.reload = true
|
|
|
this.posterUrl = item.imgUrl
|
|
|
this.srcUrl = item.videoUrl
|
|
|
+ this.title = item.title
|
|
|
+ this.currentClassIndex = item.index
|
|
|
+ setTimeout(() => {
|
|
|
+ this.reload = false
|
|
|
+ }, 0)
|
|
|
}
|
|
|
},
|
|
|
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>
|
|
|
+ <ColHeader
|
|
|
+ v-slots={{
|
|
|
+ content: () =>
|
|
|
+ !this.reload && (
|
|
|
+ <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}
|
|
|
+ color="var(--van-primary)"
|
|
|
+ style={{ display: 'flex', alignItems: 'center' }}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ value: () => (
|
|
|
+ <div class={styles.label}>
|
|
|
+ <span>{this.currentClassIndex}</span>/{this.detailList.length}
|
|
|
+ 课时
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ ></Cell>
|
|
|
|
|
|
- <Tabs v-model:active={this.tabIndex} class={styles.infoField} color="var(--van-primary)" lineWidth={20}>
|
|
|
+ <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" >
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ height: `calc(100vh - 320px - ${this.navHeight}px)`,
|
|
|
+ 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} />
|
|
|
+ <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" />)
|
|
|
- }}>
|
|
|
+ <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}
|
|
|
+ <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>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ icon="plus"
|
|
|
+ size="mini"
|
|
|
+ style={{ borderRadius: '5px', padding: '0 8px' }}
|
|
|
+ >
|
|
|
+ 关注
|
|
|
+ </Button>
|
|
|
</div>
|
|
|
</Cell>
|
|
|
<SectionDetail>
|
|
@@ -108,32 +179,60 @@ export default defineComponent({
|
|
|
</SectionDetail>
|
|
|
</Tab>
|
|
|
<Tab title="讨论" name={3}>
|
|
|
- <div style={{ height: 'calc(100vh - 365px)', overflowY: 'auto' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ height: `calc(100vh - 380px - ${this.navHeight}px)`,
|
|
|
+ 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>)
|
|
|
- }} />
|
|
|
+ <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'>
|
|
|
+ <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>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ disabled={!this.message}
|
|
|
+ style={{ padding: '0 20px' }}
|
|
|
+ size="small"
|
|
|
+ round
|
|
|
+ >
|
|
|
+ 发布
|
|
|
+ </Button>
|
|
|
)
|
|
|
- }} />
|
|
|
+ }}
|
|
|
+ />
|
|
|
</Sticky>
|
|
|
</Tab>
|
|
|
</Tabs>
|
|
|
</div>
|
|
|
- );
|
|
|
+ )
|
|
|
}
|
|
|
-})
|
|
|
+})
|