import{C as L}from"./index.55a90ec9.js";import{S as f}from"./index.f4e1cfd8.js";import{U as g}from"./index.b5a9ab3d.js";import{U as y}from"./index.8ffe9926.js";import{s as n,r as u,p as h,C as S}from"./index.3d95a92c.js";import{d as x,g as i,T as l,a as e,G as C,H as v,S as I,B as b,j}from"./vendor.a0144ce9.js";/* empty css               *//* empty css               *//* empty css               */import"./index.faff78b9.js";/* empty css               *//* empty css              *//* empty css               *//* empty css                */import"./icon_teacher.40b6f077.js";import"./icon_timer2.563d016a.js";import"./icon_student.bbb32387.js";const D="_introduction_1aqns_1";var T={"live-detail":"_live-detail_1aqns_1",introduction:D},F=x({name:"LiveDetail",data(){const t=this.$route.query;return{joinRoom:t.joinRoom,groupId:t.groupId,courseId:t.classId,live:{}}},computed:{userInfo(){var a,c,d,m,p;const t=this.live,o=t.planList||[],s=((a=o[0])==null?void 0:a.startTime)||new Date,r=((c=o[0])==null?void 0:c.endTime)||new Date;return{headUrl:(d=n.user.data)==null?void 0:d.heardUrl,username:((m=n.user.data)==null?void 0:m.username)||`\u6E38\u5BA2${((p=n.user.data)==null?void 0:p.userId)||""}`,startTime:`${i(s).format("YYYY-MM-DD")} ${i(s).format("HH:mm")}~${i(r).format("HH:mm")}`||"",lessonPrice:t.coursePrice,buyNum:t.studentCount||0,lessonNum:t.courseNum||0,lessonDesc:t.courseIntroduce,lessonCoverUrl:t.backgroundPic||t.backgroundPicTemplate,lessonName:t.courseGroupName}},courseInfo(){const t=[];return(this.live.planList||[]).forEach(s=>{const r=s.startTime||new Date,a=s.endTime||new Date;t.push({courseTime:`${i(r).format("YYYY-MM-DD")} ${i(r).format("HH:mm")}~${i(a).format("HH:mm")}`,coursePlan:s.plan,roomUid:s.roomUid,liveState:s.liveState,id:s.courseId})}),t||[]},liveStatus(){const t=this.live.planList||[],o={status:!1,liveStatus:0,roomUid:""};return t.forEach(s=>{s.courseId===Number(this.courseId)&&(o.status=!0,o.liveStatus=s.liveStatus,o.roomUid=s.roomUid)}),o},studentList(){return this.live.studentList||[]},courseOffStatus(){const t=this.live;let o=!1;return(t.status==="APPLY"&&t.studentList.length===0||t.status==="NOT_SALE")&&(o=!0),o}},async mounted(){try{const t=await u.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}});console.log(t),this.live=t.data||{},console.log(this.live)}catch{}},methods:{async onJoinRoom(){try{const s=((await u.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}})).data||{}).planList||[];let r={};s.forEach(a=>{a.courseId===Number(this.courseId)&&(r=a)}),r&&r.liveState===1?h({api:"joinLiveRoom",content:{roomId:r.roomUid,teacherId:this.live.teacherId}}):r&&r.liveState===2?setTimeout(()=>{l("\u8BFE\u7A0B\u5DF2\u7ED3\u675F")},100):setTimeout(()=>{l("\u8BFE\u7A0B\u5C1A\u672A\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5019")},100)}catch{}},async cancelCourseGroup(){try{const t=await u.get("/api-teacher/courseGroup/cancelCourseGroup",{params:{groupId:this.groupId}});l("\u4E0B\u67B6\u6210\u529F"),setTimeout(()=>{h({api:"back",content:{}})},500)}catch{}}},render(){return e("div",{class:[T["live-detail"],"mb12"]},[e(g,{userInfo:this.userInfo},null),e(f,null,{default:()=>[e("p",{class:T.introduction},[this.userInfo.lessonDesc])]}),e(f,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",titleShow:!1,contentStyle:{paddingTop:"0"}},{default:()=>[e(C,{color:"var(--van-primary)",lineWidth:20,sticky:!0},{default:()=>[e(v,{title:"\u8BFE\u7A0B",titleClass:"van-hairline--bottom"},{default:()=>[e(L,{courseInfo:this.courseInfo,courseId:Number(this.courseId)||0},null)]}),e(v,{title:"\u5B66\u5458\u5217\u8868",titleClass:"van-hairline--bottom"},{default:()=>[this.studentList.map(t=>e(y,{class:"mb12",users:{avatar:t.avatar,studentId:t.studentId,studentName:t.userName,createTime:t.createTime}},null)),this.studentList.length===0&&e(S,{tips:"\u6682\u65E0\u8D2D\u4E70\u5B66\u5458",classImgSize:"SMALL",btnStatus:!1},null)]})]})]}),this.courseOffStatus&&e(I,{offsetBottom:0,position:"bottom"},{default:()=>[e("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[e(b,{block:!0,round:!0,type:"primary",onClick:this.cancelCourseGroup},{default:()=>[j("\u4E0B\u67B6")]})])]}),this.joinRoom=="1"&&this.liveStatus.liveStatus!==2&&e(I,{offsetBottom:0,position:"bottom"},{default:()=>[e("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[e(b,{block:!0,round:!0,type:"primary",onClick:this.onJoinRoom},{default:()=>[j("\u8FDB\u5165\u76F4\u64AD\u95F4")]})])]})])}});export{F as default};
