group-detail.0346a957.js 7.2 KB

1
  1. import{d as v,w as i,g as n,y as d,n as y,T as h,D as m,j as r,f as b,B as f,A as g,aS as T}from"./ResizeObserver.es.b7226882.js";import{S as N}from"./index.a841fff0.js";import{U as S}from"./index.c1be15b1.js";import{o as u,a as U}from"./orderStatus.1ca966f0.js";import{C as P}from"./index.969bba7f.js";import{C as I}from"./index.0b42adfa.js";import{C as D}from"./index.0b85a0cc.js";import{L as C}from"./live-item.77220bb5.js";import{i as G}from"./icon-share.4e09e300.js";import{t as j}from"./tradeOrder.b3e670b0.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.1eaf642c.js";import"./index.cf00521e.js";import"./code-down-load.95f00a21.js";import"./logo.bcac726b.js";import"./browser.b3690ea1.js";import"./html2canvas.esm.3d083717.js";const $="_introduction_1puau_1",w="_tips_1puau_12",O="_btnMore_1puau_35",_="_shareCourse_1puau_42";var l={"live-detail":"_live-detail_1puau_1",introduction:$,tips:w,btnMore:O,shareCourse:_},se=v({name:"LiveDetail",data(){const e=this.$route.query;return{joinRoom:e.joinRoom,recomUserId:e.recomUserId,groupId:e.groupId,courseId:e.classId,platform:e.p,live:{},shareStatus:!1,shareUrl:""}},computed:{userInfo(){var c,p;const e=this.live,t=e.planList||[],o=((c=t[0])==null?void 0:c.startTime)||new Date,s=((p=t[0])==null?void 0:p.endTime)||new Date,a=e.maxStudentNum||0-e.studentCount||0;return{avatar:e.avatar,headUrl:e.avatar,username:e.userName||`\u6E38\u5BA2${e.teacherId||""}`,id:e.teacherId,startTime:`${i(o).format("YYYY-MM-DD")} ${i(o).format("HH:mm")}~${i(s).format("HH:mm")}`||"",buyNum:e.studentCount,type:"group",lessonId:e.courseGroupId,lessonPrice:e.coursePrice,lessonNum:e.courseNum,mixStudentNum:a>0?a: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}},platformStatus(){const e=n.user.data,t=this.$route.query;return e.tenantId>0&&t.p=="tenant"},courseInfo(){const e=[],t=this.live;return(this.live.planList||[]).forEach(s=>{const a=s.startTime||new Date,c=s.endTime||new Date;e.push({courseTime:`${i(a).format("YYYY-MM-DD")} ${i(a).format("HH:mm")}~${i(c).format("HH:mm")}`,coursePlan:s.plan,roomUid:s.roomUid,teacherName:t.teacherName,subjectName:t.subjectName,liveState:s.liveState,id:s.courseId})}),e||[]},salesEndDate(){const e=this.live;return i(e.salesEndDate||new Date).format("YYYY-MM-DD")},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}},async mounted(){var e,t;await this._init(),/(localhost|192)/g.test(location.origin)?this.shareUrl=`https://dev.colexiu.com/teacher/#/shareGroup?recomUserId=${(e=n.user.data)==null?void 0:e.userId}&groupId=${this.groupId}&userType=${n.platformType}&p=tenant`:this.shareUrl=`${location.origin}/teacher/#/shareGroup?recomUserId=${(t=n.user.data)==null?void 0:t.userId}&groupId=${this.groupId}&userType=${n.platformType}&p=tenant`},methods:{async _init(){try{const e=await d.get("/api-student/courseGroup/queryLiveCourseInfo",{params:{groupId:this.groupId}});this.live=e.data||{},console.log(this.live,"list")}catch{}},async onJoinRoom(){try{const o=((await d.get("/api-student/courseGroup/queryLiveCourseInfo",{params:{courseType:"GROUP",groupId:this.groupId}})).data||{}).planList||[];let s={};o.forEach(a=>{a.courseId===Number(this.courseId)&&(s=a)}),s&&s.liveState===1?y({api:"joinLiveRoom",content:{roomId:s.roomUid,teacherId:this.live.teacherId}}):s&&s.liveState===2?setTimeout(()=>{h("\u8BFE\u7A0B\u5DF2\u7ED3\u675F")},100):setTimeout(()=>{h("\u8BFE\u7A0B\u5C1A\u672A\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5019")},100)}catch{}},initLive(){const e=this.live;u.orderObject.orderType="GROUP",u.orderObject.orderName="\u5C0F\u7EC4\u8BFE\u8D2D\u4E70",u.orderObject.orderDesc="\u5C0F\u7EC4\u8BFE\u8D2D\u4E70",u.orderObject.actualPrice=e.coursePrice,u.orderObject.recomUserId=this.recomUserId,u.orderObject.orderNo="",u.orderObject.orderList=[{orderType:"GROUP",goodsName:"\u5C0F\u7EC4\u8BFE\u8D2D\u4E70",courseGroupId:e.courseGroupId,courseGroupName:e.courseGroupName,coursePrice:e.coursePrice,price:e.coursePrice,teacherName:e.userName||`\u6E38\u5BA2${e.teacherId||""}`,teacherId:e.teacherId,avatar:e.avatar,courseInfo:this.courseInfo,recomUserId:this.recomUserId}]},async onBuy(){try{if(this.live.coursePrice<=0){this.initLive(),await U(()=>{m.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this._init()})});return}const o=(await d.post("/api-student/userOrder/getPendingOrder",{data:{goodType:"GROUP",bizId:this.groupId}})).data;o?m.confirm({title:"\u63D0\u793A",message:"\u60A8\u6709\u4E00\u4E2A\u672A\u652F\u4ED8\u7684\u8BA2\u5355\uFF0C\u662F\u5426\u7EE7\u7EED\u652F\u4ED8\uFF1F",confirmButtonColor:"#269a93",cancelButtonText:"\u53D6\u6D88\u8BA2\u5355",confirmButtonText:"\u7EE7\u7EED\u652F\u4ED8"}).then(async()=>{j(o,this.routerTo)}).catch(()=>{m.close(),this.cancelPayment(o.orderNo)}):(this.initLive(),this.routerTo())}catch{}},routerTo(){const e=this.live;this.$router.push({path:"/orderDetail",query:{orderType:"GROUP",courseGroupId:e.courseGroupId}})},async cancelPayment(e){try{await d.post("/api-student/userOrder/orderCancel",{data:{orderNo:e}})}catch{}}},render(){return r("div",{class:[l["live-detail"],"mb12"]},[r(P,null,{right:()=>r("img",{src:G,onClick:()=>this.shareStatus=!0},null)}),r(S,{userInfo:this.userInfo,showBuy:!0,onUserDetail:e=>{n.platformType==="STUDENT"&&b().isApp&&this.$router.push({path:"/teacherHome",query:{teacherId:e.id,tabs:"live"}})}},null),r(N,{border:!0},{default:()=>[r("p",{class:l.introduction},[this.userInfo.lessonDesc])]}),this.courseInfo.length>0&&r(L,{courseInfo:this.courseInfo,courseId:Number(this.courseId)||0},null),this.courseInfo.length>0&&this.live.existBuy!==1&&this.live.existBuy!==2&&r(I,{position:"bottom",background:"white"},{default:()=>[r("div",{class:["btnGroup",l.btnMore]},[r(f,{block:!0,round:!0,type:"primary",onClick:this.onBuy,disabled:this.platformStatus},{default:()=>[this.live.coursePrice<=0?"\u514D\u8D39\u9886\u53D6":"\u7ACB\u5373\u8D2D\u4E70"]})])]}),this.joinRoom=="1"&&this.liveStatus.liveStatus!==2&&r(I,{position:"bottom",background:"white"},{default:()=>[r("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[r(f,{block:!0,round:!0,type:"primary",onClick:this.onJoinRoom},{default:()=>[g("\u8FDB\u5165\u76F4\u64AD\u95F4")]})])]}),r(T,{show:this.shareStatus,"onUpdate:show":e=>this.shareStatus=e,style:{background:"transparent"}},{default:()=>[r(D,{teacherId:this.userInfo.id,shareUrl:this.shareUrl,shareType:"live"},{default:()=>[r(C,{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{se as default};