import{d as v,w as u,y as i,g as c,A as I,n as l,T as n,j as r,F as g,E as m,B as d}from"./ResizeObserver.es.62ab429c.js";import{S as b}from"./index.7f3f7360.js";import{U as y}from"./index.58a086a9.js";import{C as T}from"./index.786e83cc.js";import{G as S}from"./index.66bf1d0a.js";import{T as p}from"./index.1db64c88.js";import"./index.d7a13e47.js";import"./index.e24f8570.js";import"./index.021584f9.js";import"./icon_teacher.40b6f077.js";import"./index.a6e5e68b.js";const N="_introduction_1bpz3_1",C="_shareCourse_1bpz3_9";var h={"live-detail":"_live-detail_1bpz3_1",introduction:N,shareCourse:C},E=v({name:"GroupDetail",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;const e=this.live,o=((a=(e.planList||[])[0])==null?void 0:a.startTime)||new Date,t=(e.maxStudentNum||0)-(e.studentCount||0);return{headUrl:e.avatar,avatar:e.avatar,username:e.userName,id:e.teacherId,startTime:`${u(o).format("YYYY-MM-DD HH:mm")}`||"",lessonPrice:e.coursePrice,buyNum:e.studentCount||0,type:"group",mixStudentNum:t>0?t:0,lessonId:e.courseGroupId,completeCourseNum:e.completeCourseNum,isShowCourse:e.status!=="APPLY",lessonNum:e.courseNum||0,lessonDesc:e.courseIntroduce,lessonCoverUrl:e.backgroundPic||e.backgroundPicTemplate,lessonName:e.courseGroupName,subjectName:e.subjectName,courseStartTime:u(e.courseStartTime).format("YYYY-MM-DD HH:mm"),auditVersion:e.auditVersion||0,isDegree:!!e.degreeFlag,isTeacher:!!e.teacherFlag}},courseInfo(){const e=[],s=this.live.planList||[],o=this.live;return s.forEach(t=>{const a=t.startTime||new Date,f=t.endTime||new Date;e.push({courseTime:`${u(a).format("YYYY-MM-DD")} ${u(a).format("HH:mm")}~${u(f).format("HH:mm")}`,coursePlan:t.plan,teacherName:o.userName,subjectName:o.subjectName,roomUid:t.roomUid,liveState:t.liveState,id:t.courseId})}),e||[]},liveStatus(){const e=this.live.planList||[],s={status:!1,liveStatus:0,roomUid:""};return e.forEach(o=>{o.courseId===Number(this.courseId)&&(s.status=!0,s.liveStatus=o.liveStatus,s.roomUid=o.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 i.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}});this.live=s.data||{},c.platformType==="TEACHER"&&(this.myself=!s.data.myself),this.shareUrl=`${I()}/teacher/#/shareLive?recomUserId=${(e=c.user.data)==null?void 0:e.userId}&groupId=${this.groupId}&p=tenant`}catch{}},methods:{async onJoinRoom(){try{const o=((await i.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}})).data||{}).planList||[];let t={};o.forEach(a=>{a.courseId===Number(this.courseId)&&(t=a)}),t&&t.liveState===1?l({api:"joinLiveRoom",content:{roomId:t.roomUid,teacherId:this.live.teacherId}}):t&&t.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 i.get("/api-teacher/courseGroup/cancelCourseGroup",{params:{groupId:this.groupId}}),n("\u53D6\u6D88\u8BFE\u7A0B\u6210\u529F"),setTimeout(()=>{l({api:"back",content:{}})},500)}catch{}}},render(){return r("div",{class:[h["live-detail"],"mb12"]},[r(T,null,null),r(y,{userInfo:this.userInfo},null),r(b,{border:!0},{default:()=>[r("p",{class:h.introduction},[this.userInfo.lessonDesc])]}),r(S,{courseInfo:this.courseInfo,courseId:Number(this.courseId)||0},null),this.live.status!=="OUT_SALE"&&r(g,null,[this.courseOffStatus&&r(p,{position:"bottom"},{default:()=>[r("div",{class:["btnGroup"],style:{paddingTop:"10px",background:"#fff"}},[r(m,{block:!0,round:!0,type:"primary",onClick:this.cancelCourseGroup},{default:()=>[d("\u53D6\u6D88\u8BFE\u7A0B")]})])]}),this.joinRoom=="1"&&this.liveStatus.liveStatus!==2&&r(p,{position:"bottom"},{default:()=>[r("div",{class:["btnGroup"],style:{paddingTop:"10px",background:"#fff"}},[r(m,{block:!0,round:!0,type:"primary",onClick:this.onJoinRoom},{default:()=>[d("\u8FDB\u5165\u76F4\u64AD\u95F4")]})])]})])])}});export{E as default};
