group-detail.48953071.js 5.1 KB

1
  1. import{d as v,w as u,y as n,g as d,n as p,T as c,j as s,F as g,B as h,A as f,aS as b}from"./ResizeObserver.es.b7226882.js";import{S as y}from"./index.a841fff0.js";import{U as N}from"./index.c1be15b1.js";import{C as S}from"./index.0b85a0cc.js";import{C as I}from"./index.0b42adfa.js";import{L as T}from"./live-item.77220bb5.js";import{C}from"./index.969bba7f.js";import{G as L}from"./index.58e0f077.js";import"./index.40f703b6.js";import"./index.9269bf1e.js";import"./index.20c0f4c5.js";import"./icon_teacher.40b6f077.js";import"./icon_timer2.5fb1750d.js";import"./index.cf00521e.js";import"./code-down-load.95f00a21.js";import"./logo.bcac726b.js";import"./browser.b3690ea1.js";import"./html2canvas.esm.3d083717.js";import"./index.1eaf642c.js";const D="_introduction_1bpz3_1",U="_shareCourse_1bpz3_9";var l={"live-detail":"_live-detail_1bpz3_1",introduction:D,shareCourse:U},z=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 i,m;const e=this.live,t=e.planList||[],o=((i=t[0])==null?void 0:i.startTime)||new Date,r=((m=t[0])==null?void 0:m.endTime)||new Date,a=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")} ${u(o).format("HH:mm")}~${u(r).format("HH:mm")}`||"",lessonPrice:e.coursePrice,buyNum:e.studentCount||0,type:"group",mixStudentNum:a>0?a: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=[],t=this.live.planList||[],o=this.live;return t.forEach(r=>{const a=r.startTime||new Date,i=r.endTime||new Date;e.push({courseTime:`${u(a).format("YYYY-MM-DD")} ${u(a).format("HH:mm")}~${u(i).format("HH:mm")}`,coursePlan:r.plan,teacherName:o.teacherName,subjectName:o.subjectName,roomUid:r.roomUid,liveState:r.liveState,id:r.courseId})}),e||[]},liveStatus(){const e=this.live.planList||[],t={status:!1,liveStatus:0,roomUid:""};return e.forEach(o=>{o.courseId===Number(this.courseId)&&(t.status=!0,t.liveStatus=o.liveStatus,t.roomUid=o.roomUid)}),t},studentList(){return this.live.studentList||[]},courseOffStatus(){const e=this.live;let t=!1;return(e.status==="APPLY"&&e.studentList.length===0||e.status==="NOT_SALE")&&(t=!0),t}},async mounted(){var e;try{const t=await n.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}});this.live=t.data||{},d.platformType==="TEACHER"&&(this.myself=!t.data.myself),this.shareUrl=`${location.origin}/teacher/#/shareLive?recomUserId=${(e=d.user.data)==null?void 0:e.userId}&groupId=${this.groupId}&p=tenant`}catch{}},methods:{async onJoinRoom(){try{const o=((await n.get("/api-teacher/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}})).data||{}).planList||[];let r={};o.forEach(a=>{a.courseId===Number(this.courseId)&&(r=a)}),r&&r.liveState===1?p({api:"joinLiveRoom",content:{roomId:r.roomUid,teacherId:this.live.teacherId}}):r&&r.liveState===2?setTimeout(()=>{c("\u8BFE\u7A0B\u5DF2\u7ED3\u675F")},100):setTimeout(()=>{c("\u8BFE\u7A0B\u5C1A\u672A\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5019")},100)}catch{}},async cancelCourseGroup(){try{await n.get("/api-teacher/courseGroup/cancelCourseGroup",{params:{groupId:this.groupId}}),c("\u53D6\u6D88\u8BFE\u7A0B\u6210\u529F"),setTimeout(()=>{p({api:"back",content:{}})},500)}catch{}}},render(){return s("div",{class:[l["live-detail"],"mb12"]},[s(C,null,null),s(N,{userInfo:this.userInfo},null),s(y,{border:!0},{default:()=>[s("p",{class:l.introduction},[this.userInfo.lessonDesc])]}),s(L,{courseInfo:this.courseInfo,courseId:Number(this.courseId)||0},null),this.live.status!=="OUT_SALE"&&s(g,null,[this.courseOffStatus&&s(I,{position:"bottom",background:"white"},{default:()=>[s("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[s(h,{block:!0,round:!0,type:"primary",onClick:this.cancelCourseGroup},{default:()=>[f("\u53D6\u6D88\u8BFE\u7A0B")]})])]}),this.joinRoom=="1"&&this.liveStatus.liveStatus!==2&&s(I,{position:"bottom",background:"white"},{default:()=>[s("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[s(h,{block:!0,round:!0,type:"primary",onClick:this.onJoinRoom},{default:()=>[f("\u8FDB\u5165\u76F4\u64AD\u95F4")]})])]})]),s(b,{show:this.shareStatus,"onUpdate:show":e=>this.shareStatus=e,style:{background:"transparent"}},{default:()=>[s(S,{teacherId:this.userInfo.id,shareUrl:this.shareUrl,shareType:"live"},{default:()=>[s(T,{class:l.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{z as default};