|
@@ -3,7 +3,7 @@ import SectionDetail from '@/business-components/section-detail'
|
|
|
import UserDetail from '@/business-components/user-detail'
|
|
|
import request from '@/helpers/request'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { Icon, Sticky, Button, Dialog } from 'vant'
|
|
|
+import { Icon, Sticky, Button, Dialog, Toast } from 'vant'
|
|
|
import { defineComponent } from 'vue'
|
|
|
import styles from './live-detail.module.less'
|
|
|
import iconTips from '@common/images/icon_tips.png'
|
|
@@ -97,6 +97,39 @@ export default defineComponent({
|
|
|
} catch {}
|
|
|
},
|
|
|
methods: {
|
|
|
+ async onJoinRoom() {
|
|
|
+ try {
|
|
|
+ const res = await request.get(
|
|
|
+ '/api-student/courseGroup/queryLiveCourseInfo',
|
|
|
+ {
|
|
|
+ params: {
|
|
|
+ groupId: this.groupId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ const result = res.data || {}
|
|
|
+ const coursePlanList = result.planList || []
|
|
|
+ let tempObj: any = {}
|
|
|
+ coursePlanList.forEach((item: any) => {
|
|
|
+ if (item.courseId === Number(this.courseId)) {
|
|
|
+ tempObj = item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (tempObj && tempObj.liveState === 1) {
|
|
|
+ postMessage({
|
|
|
+ api: 'joinLiveRoom',
|
|
|
+ content: {
|
|
|
+ roomId: this.liveStatus.roomUid,
|
|
|
+ teacherId: this.live.teacherId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ Toast('课程尚未开始,请耐心等候')
|
|
|
+ }, 100)
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
+ },
|
|
|
async onBuy() {
|
|
|
try {
|
|
|
const res = await request.post(
|
|
@@ -222,20 +255,7 @@ export default defineComponent({
|
|
|
{this.joinRoom == '1' && this.courseInfo.length > 0 && (
|
|
|
<Sticky offsetBottom={0} position="bottom">
|
|
|
<div class={['btnGroup']} style={{ paddingTop: '12px' }}>
|
|
|
- <Button
|
|
|
- block
|
|
|
- round
|
|
|
- type="primary"
|
|
|
- onClick={() => {
|
|
|
- postMessage({
|
|
|
- api: 'joinLiveRoom',
|
|
|
- content: {
|
|
|
- roomId: this.liveStatus.roomUid,
|
|
|
- teacherId: this.live.teacherId
|
|
|
- }
|
|
|
- })
|
|
|
- }}
|
|
|
- >
|
|
|
+ <Button block round type="primary" onClick={this.onJoinRoom}>
|
|
|
进入直播间
|
|
|
</Button>
|
|
|
</div>
|