import{C as m}from"./index.4a637b5e.js";import{S as d}from"./index.cdcb8b18.js";import{U as h}from"./index.bf2a894b.js";import{d as p,s as u,e as n,D as l,i as t,b as I,T as f,B as y,aT as b,$ as g}from"./index.6b776f4b.js";import{C as v}from"./index.33f0ddb9.js";import{o as a,a as _}from"./orderStatus.d66eca14.js";import{t as T}from"./tradeOrder.021d4979.js";import{C}from"./index.5070a0ba.js";import{i as U}from"./icon-share.324bceb0.js";import{C as N}from"./index.f8224084.js";import{L as D}from"./live-item.07457117.js";import"./index.7486196c.js";import"./index.7cc0b0e7.js";import"./index.beb9a25a.js";import"./bars.82474962.js";import"./icon_album_active.ce98b2a8.js";import"./icon_music_active.3b316ab8.js";import"./index.aa464e80.js";import"./icon_teacher.40b6f077.js";import"./icon_timer2.5fb1750d.js";import"./icon-jiaozi.20e415ca.js";import"./index.f0306d29.js";import"./use-height.c83159bc.js";import"./index.e6c57a63.js";import"./index.570314c1.js";import"./code-down-load.ece1391b.js";import"./logo.bcac726b.js";import"./browser.ff6962bf.js";const P="_introduction_wlqmz_6",w="_btnGroup_wlqmz_11",O="_btnMore_wlqmz_15",S="_videoItem_wlqmz_22",$="_shareCourse_wlqmz_28",q="_coverClass_wlqmz_36";var i={"video-detail":"_video-detail_wlqmz_1",introduction:P,btnGroup:w,btnMore:O,videoItem:S,"van-cell__title":"_van-cell__title_wlqmz_22",shareCourse:$,coverClass:q};function A(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!g(e)}var ne=p({name:"VideoDetail",data(){const e=this.$route.query;return{userInfo:{},detailList:[],recomUserId:e.recomUserId,params:{groupId:e.groupId},shareStatus:!1,shareUrl:""}},async mounted(){var e,r;await this._init(),/(localhost|192)/g.test(location.origin)?this.shareUrl=`https://dev.colexiu.com/teacher#/shareVideo?recomUserId=${(e=u.user.data)==null?void 0:e.userId}&groupId=${this.params.groupId}&userType=${u.platformType}`:this.shareUrl=`${location.origin}/teacher#/shareVideo?recomUserId=${(r=u.user.data)==null?void 0:r.userId}&groupId=${this.params.groupId}&userType=${u.platformType}`},methods:{async _init(){try{const r=(await n.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.params.groupId}})).data||{},s=r.lessonGroup||{},c=r.teachertTag||"";this.userInfo={alreadyBuy:r.alreadyBuy,username:s.username||`\u6E38\u5BA2${s.teacherId||""}`,headUrl:s.avatar,buyNum:s.countStudent,id:s.id,lessonNum:s.lessonCount,lessonName:s.lessonName,lessonDesc:s.lessonDesc,lessonPrice:s.lessonPrice,relationType:s.relationType,teacherId:s.teacherId,lessonCoverUrl:s.lessonCoverUrl,auditVersion:s.auditVersion,isDegree:!!r.degreeFlag,isTeacher:!!r.teacherFlag},this.detailList=r.detailList||[]}catch{}},onPlay(e){this.$router.push({path:"/videoClassDetail",query:{groupId:this.params.groupId,classId:e.id}})},async onBuy(){try{const e=this.userInfo;if(a.orderObject.orderType="VIDEO",a.orderObject.orderName="\u89C6\u9891\u8BFE\u8D2D\u4E70",a.orderObject.orderDesc="\u89C6\u9891\u8BFE\u8D2D\u4E70",a.orderObject.actualPrice=e.lessonPrice,a.orderObject.recomUserId=this.recomUserId,a.orderObject.orderNo="",a.orderObject.orderList=[{orderType:"VIDEO",goodsName:"\u89C6\u9891\u8BFE\u8D2D\u4E70",courseGroupId:e.id,courseGroupName:e.lessonName,coursePrice:e.lessonPrice,teacherName:e.username||`\u6E38\u5BA2${e.teacherId||""}`,teacherId:e.teacherId,avatar:e.headUrl,relationType:this.userInfo.relationType,courseInfo:this.detailList,recomUserId:this.recomUserId}],e.lessonPrice<=0){await _(()=>{l.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this._init()})});return}const s=(await n.post("/api-student/userOrder/getPendingOrder",{data:{goodType:"VIDEO",bizId:this.params.groupId}})).data;s?l.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()=>{T(s,this.routerTo)}).catch(()=>{l.close(),this.cancelPayment(s.orderNo)}):this.routerTo()}catch{}},routerTo(){this.$router.push({path:"/orderDetail",query:{orderType:"VIDEO",courseGroupId:this.params.groupId}})},async cancelPayment(e){try{await n.post("/api-student/userOrder/orderCancel",{data:{orderNo:e}})}catch{}}},render(){let e;return t("div",{class:[i["video-detail"]]},[t(v,null,{right:()=>t("img",{src:U,onClick:()=>this.shareStatus=!0},null)}),t(h,{userInfo:this.userInfo,onUserDetail:r=>{console.log(r),I().isApp&&u.platformType==="STUDENT"&&this.$router.push({path:"/teacherHome",query:{teacherId:r.teacherId,tabs:"video"}})}},null),t(d,{border:!1},{default:()=>[t("p",{class:i.introduction},[this.userInfo.lessonDesc])]}),t(d,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",class:"mb12",border:!1},A(e=this.detailList.map(r=>{const c=(r.musicAlbumInfos||[]).map(o=>({relationMusicAlbum:o.relationType,musicAlbumName:o.name,musicAlbumId:o.musicAlbumId,status:o.status,useRelationType:this.userInfo.relationType}));return t(m,{musicAlbumInfos:c,class:[i.videoItem],detail:{id:r.id,title:r.videoTitle,content:r.videoContent,imgUrl:r.coverUrl},onPlay:this.onPlay,onMusicAlbumDetail:o=>{if(!this.userInfo.alreadyBuy&&!o.status){f("\u6570\u636E\u6B63\u5728\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}o.relationMusicAlbum==="MUSIC"?this.$router.push({path:"/music-detail",query:{id:o.musicAlbumId}}):o.relationMusicAlbum==="ALBUM"&&this.$router.push({path:"/music-album-detail/"+o.musicAlbumId})}},null)}))?e:{default:()=>[e]}),this.userInfo.id&&!this.userInfo.alreadyBuy&&t(C,{position:"bottom",background:"white"},{default:()=>[t("div",{class:["btnGroup",i.btnMore]},[t(y,{block:!0,round:!0,type:"primary",onClick:this.onBuy},{default:()=>[this.userInfo.lessonPrice<=0?"\u514D\u8D39\u9886\u53D6":"\u7ACB\u5373\u8D2D\u4E70"]})])]}),t(b,{show:this.shareStatus,"onUpdate:show":r=>this.shareStatus=r,style:{background:"transparent"}},{default:()=>[t(N,{teacherId:this.userInfo.id,shareUrl:this.shareUrl,shareType:"video"},{default:()=>[t(D,{class:i.shareCourse,coverClass:i.coverClass,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.headUrl,studentCount:this.userInfo.buyNum,existBuy:0,subjectName:this.userInfo.lessonSubjectName}},null)]})]})])}});export{ne as default};