live-detail.954f6dc5.js 6.3 KB

1
  1. import{d as g,u as i,w as u,g as f,n as I,T as n,j as t,C as T,F as y,B as l,z as c,aR as S}from"./index.394decd7.js";import{C as v}from"./index.f65267e5.js";import{S as m}from"./index.63f283ba.js";import{U as C}from"./index.6c72fde6.js";import{U as L}from"./index.d0a6db21.js";import{C as N}from"./index.52a60bda.js";import{C as d}from"./index.45d094fa.js";import{L as U}from"./live-item.d72fb44d.js";import"./index.3bbf4ddb.js";import"./index.f1b52763.js";import{T as D,a as b}from"./index.ae00317c.js";import{C as k}from"./index.e6e212d8.js";import"./index.f53ab473.js";import"./plyr.623e6d1e.js";import"./index.9e0d46e4.js";import"./index.9462d7c5.js";import"./index.ae2dd816.js";import"./icon_teacher.40b6f077.js";import"./icon_timer2.5fb1750d.js";import"./icon-jiaozi.20e415ca.js";import"./icon_student.c3c58354.js";import"./code-down-load.37c8e9cc.js";import"./logo.bcac726b.js";import"./browser.8379baf6.js";import"./html2canvas.esm.3d083717.js";import"./use-id.e2f22365.js";import"./use-tab-status.723110ee.js";import"./use-refs.09b2d19c.js";const P="_introduction_1bpz3_1",w="_shareCourse_1bpz3_9";var p={"live-detail":"_live-detail_1bpz3_1",introduction:P,shareCourse:w},ae=g({name:"LiveDetail",data(){const e=this.$route.query;return{share:e.share,joinRoom:e.joinRoom,groupId:e.groupId,courseId:e.classId,live:{},shareStatus:!1,shareUrl:"",myself:!1}},computed:{userInfo(){var a,h;const e=this.live,s=e.planList||[],r=((a=s[0])==null?void 0:a.startTime)||new Date,o=((h=s[0])==null?void 0:h.endTime)||new Date;return{headUrl:e.avatar,avatar:e.avatar,username:e.userName,id:e.teacherId,startTime:`${i(r).format("YYYY-MM-DD")} ${i(r).format("HH:mm")}~${i(o).format("HH:mm")}`||"",lessonPrice:e.coursePrice,buyNum:e.studentCount||0,lessonId:e.courseGroupId,lessonNum:e.courseNum||0,lessonDesc:e.courseIntroduce,lessonCoverUrl:e.backgroundPic||e.backgroundPicTemplate,lessonName:e.courseGroupName,subjectName:e.subjectName,courseStartTime:e.courseStartTime,auditVersion:e.auditVersion||0,isDegree:!!e.degreeFlag,isTeacher:!!e.teacherFlag}},courseInfo(){const e=[];return(this.live.planList||[]).forEach(r=>{const o=r.startTime||new Date,a=r.endTime||new Date;e.push({courseTime:`${i(o).format("YYYY-MM-DD")} ${i(o).format("HH:mm")}~${i(a).format("HH:mm")}`,coursePlan:r.plan,roomUid:r.roomUid,liveState:r.liveState,id:r.courseId})}),e||[]},liveStatus(){const e=this.live.planList||[],s={status:!1,liveStatus:0,roomUid:""};return e.forEach(r=>{r.courseId===Number(this.courseId)&&(s.status=!0,s.liveStatus=r.liveStatus,s.roomUid=r.roomUid)}),s},studentList(){return this.live.studentList||[]},courseOffStatus(){const e=this.live;let s=!1;return(e.status==="APPLY"&&e.studentList.length===0||e.status==="NOT_SALE")&&(s=!0),s}},async mounted(){var e;try{const s=await u.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}});this.live=s.data||{},f.platformType==="TEACHER"&&(this.myself=!s.data.myself),this.shareUrl=`${location.origin}/teacher/#/shareLive?recomUserId=${(e=f.user.data)==null?void 0:e.userId}&groupId=${this.groupId}&p=tenant`}catch{}},methods:{async onJoinRoom(){try{const r=((await u.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}})).data||{}).planList||[];let o={};r.forEach(a=>{a.courseId===Number(this.courseId)&&(o=a)}),o&&o.liveState===1?I({api:"joinLiveRoom",content:{roomId:o.roomUid,teacherId:this.live.teacherId}}):o&&o.liveState===2?setTimeout(()=>{n("\u8BFE\u7A0B\u5DF2\u7ED3\u675F")},100):setTimeout(()=>{n("\u8BFE\u7A0B\u5C1A\u672A\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5019")},100)}catch{}},async cancelCourseGroup(){try{await u.get("/api-teacher/courseGroup/cancelCourseGroup",{params:{groupId:this.groupId}}),n("\u53D6\u6D88\u8BFE\u7A0B\u6210\u529F"),setTimeout(()=>{I({api:"back",content:{}})},500)}catch{}}},render(){return t("div",{class:[p["live-detail"],"mb12"]},[t(k,null,null),t(C,{userInfo:this.userInfo},null),t(m,{border:!0},{default:()=>[t("p",{class:p.introduction},[this.userInfo.lessonDesc])]}),this.myself?t(m,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",border:!0},{default:()=>[t(v,{courseInfo:this.courseInfo,courseId:Number(this.courseId)||0},null)]}):t(m,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",titleShow:!1,contentStyle:{paddingTop:"0"}},{default:()=>[t(D,{color:"var(--van-primary)",lineWidth:20,sticky:!0},{default:()=>[t(b,{title:"\u8BFE\u7A0B",titleClass:"van-hairline--bottom"},{default:()=>[t(v,{courseInfo:this.courseInfo,courseId:Number(this.courseId)||0},null)]}),t(b,{title:"\u5B66\u5458\u5217\u8868",titleClass:"van-hairline--bottom"},{default:()=>[this.studentList.map(e=>t(L,{class:"mb12",users:{avatar:e.avatar,studentId:e.studentId,studentName:e.userName,createTime:e.createTime}},null)),this.studentList.length===0&&t(T,{tips:"\u6682\u65E0\u8D2D\u4E70\u5B66\u5458",classImgSize:"SMALL",btnStatus:!1},null)]})]})]}),this.live.status!=="OUT_SALE"&&t(y,null,[this.courseOffStatus&&t(d,{position:"bottom",background:"white"},{default:()=>[t("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[t(l,{block:!0,round:!0,type:"primary",onClick:this.cancelCourseGroup},{default:()=>[c("\u53D6\u6D88\u8BFE\u7A0B")]})])]}),this.joinRoom=="1"&&this.liveStatus.liveStatus!==2&&t(d,{position:"bottom",background:"white"},{default:()=>[t("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[t(l,{block:!0,round:!0,type:"primary",onClick:this.onJoinRoom},{default:()=>[c("\u8FDB\u5165\u76F4\u64AD\u95F4")]})])]}),this.share=="1"&&this.courseInfo.length>0&&t(d,{position:"bottom",background:"white"},{default:()=>[t("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[t(l,{block:!0,round:!0,type:"primary",onClick:()=>{this.shareStatus=!0}},{default:()=>[c("\u5206\u4EAB")]})])]})]),t(S,{show:this.shareStatus,"onUpdate:show":e=>this.shareStatus=e,style:{background:"transparent"}},{default:()=>[t(N,{teacherId:this.userInfo.id,shareUrl:this.shareUrl,shareType:"live"},{default:()=>[t(U,{class:p.shareCourse,liveInfo:{backgroundPic:this.userInfo.lessonCoverUrl,courseGroupId:this.userInfo.lessonId,courseGroupName:this.userInfo.lessonName,courseNum:this.userInfo.lessonNum,coursePrice:this.userInfo.lessonPrice,teacherName:this.userInfo.username,teacherId:this.userInfo.id,avatar:this.userInfo.avatar,studentCount:this.userInfo.buyNum,courseStartTime:this.userInfo.courseStartTime,existBuy:0,subjectName:this.userInfo.subjectName}},null)]})]})])}});export{ae as default};