import{d as y,w as i,y as u,g as f,n as I,T as n,j as t,C as g,F as T,B as l,A as c,aS as S}from"./ResizeObserver.es.f28023e0.js";import{C as v}from"./index.b5a4aa90.js";import{S as m}from"./index.07a2a95f.js";import{U as C}from"./index.d9fd7ad5.js";import{U as L}from"./index.27b78462.js";import{C as N}from"./index.b76c8ebe.js";import{C as d}from"./index.8c937010.js";import{L as U}from"./live-item.bf79c28b.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import{T as D,a as b}from"./index.aa87c0e3.js";import{C as k}from"./index.bd375ca9.js";import"./index.070305bf.js";/* empty css */import"./tcplayer.v4.8.0.min.97e1acba.js";/* empty css */import"./index.3b2e70c8.js";import"./index.2a22730e.js";import"./index.7a1af785.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.7b8e3080.js";import"./logo.bcac726b.js";import"./browser.8379baf6.js";import"./html2canvas.esm.3d083717.js";import"./index.9a41251d.js";import"./use-id.cc14bbe9.js";import"./use-tab-status.653933d8.js";import"./use-refs.b4f9d723.js";const P="_introduction_1bpz3_1",w="_shareCourse_1bpz3_9";var p={"live-detail":"_live-detail_1bpz3_1",introduction:P,shareCourse:w},ne=y({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,type:"live",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(g,{tips:"\u6682\u65E0\u8D2D\u4E70\u5B66\u5458",classImgSize:"SMALL",btnStatus:!1},null)]})]})]}),this.live.status!=="OUT_SALE"&&t(T,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{ne as default};