import{d as h,g as i,an as I,y as l,f as c,n as f,D as d,i as y,j as r,T as b,B as g,aS as T,$ as v}from"./ResizeObserver.es.39b48a47.js";import{C as _}from"./index.a177d001.js";import{S as p}from"./index.f11db230.js";import{U as C}from"./index.4c32c83c.js";import{C as V}from"./index.970ad07b.js";import{o as u,a as U}from"./orderStatus.fbc0ddaf.js";import{t as P}from"./tradeOrder.c5307744.js";import{C as N}from"./index.b1c0c586.js";import{i as D}from"./icon-share.4e09e300.js";import{C as S}from"./index.6f45cb15.js";import{L as $}from"./live-item.f6fa9064.js";import"./index.db115763.js";import"./index.fcbcb027.js";import"./index.34ac729a.js";import"./bars.4f1962a6.js";import"./icon_album_active.cb923735.js";import"./icon_music_active.f55820b3.js";import"./index.9f5e14d1.js";import"./icon_teacher.40b6f077.js";import"./icon_timer2.5fb1750d.js";import"./index.dc19bc54.js";import"./index.0e35d2fb.js";import"./code-down-load.a26a0d5d.js";import"./logo.bcac726b.js";import"./browser.1f070884.js";import"./html2canvas.esm.3d083717.js";const q="_introduction_wlqmz_6",w="_btnGroup_wlqmz_11",B="_btnMore_wlqmz_15",O="_videoItem_wlqmz_22",A="_shareCourse_wlqmz_28",j="_coverClass_wlqmz_36";var n={"video-detail":"_video-detail_wlqmz_1",introduction:q,btnGroup:w,btnMore:B,videoItem:O,"van-cell__title":"_van-cell__title_wlqmz_22",shareCourse:A,coverClass:j};function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!v(e)}var de=h({name:"VideoDetail",data(){const e=this.$route.query;return{pageVisibility:"visible",userInfo:{},detailList:[],recomUserId:e.recomUserId,params:{groupId:e.groupId},platform:e.p,shareStatus:!1,shareUrl:""}},computed:{platformStatus(){const e=i.user.data,t=this.$route.query;return e.tenantId>0&&t.p=="tenant"}},async mounted(){var e,t;this.pageVisibility=I(),await this._init(),/(localhost|192)/g.test(location.origin)?this.shareUrl=`https://dev.colexiu.com/teacher#/shareVideo?recomUserId=${(e=i.user.data)==null?void 0:e.userId}&groupId=${this.params.groupId}&userType=${i.platformType}&p=tenant`:this.shareUrl=`${location.origin}/teacher#/shareVideo?recomUserId=${(t=i.user.data)==null?void 0:t.userId}&groupId=${this.params.groupId}&userType=${i.platformType}&p=tenant`},methods:{async _init(){var e;try{const a=(await l.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.params.groupId}})).data||{},s=a.lessonGroup||{},o=i.user.data,m=s.payType==="VIP"?!!(a.alreadyBuy||((e=o.userVip)==null?void 0:e.vipType)!=="NOT_VIP"):a.alreadyBuy;this.userInfo={alreadyBuy:m,username:s.username||`\u6E38\u5BA2${s.teacherId||""}`,headUrl:s.avatar,buyNum:s.countStudent,id:s.id,lessonNum:s.lessonCount,lessonName:s.lessonName,payType:s.payType,type:"video",lessonDesc:s.lessonDesc,lessonPrice:s.lessonPrice,relationType:s.relationType,teacherId:s.teacherId,lessonCoverUrl:s.lessonCoverUrl,auditVersion:s.auditVersion,isDegree:!!a.degreeFlag,isTeacher:!!a.teacherFlag},this.detailList=a.detailList||[]}catch{}},onPlay(e){this.$router.push({path:"/videoClassDetail",query:{groupId:this.params.groupId,classId:e.id}})},initVideo(){const e=this.userInfo;u.orderObject.orderType="VIDEO",u.orderObject.orderName="\u89C6\u9891\u8BFE\u8D2D\u4E70",u.orderObject.orderDesc="\u89C6\u9891\u8BFE\u8D2D\u4E70",u.orderObject.actualPrice=e.lessonPrice,u.orderObject.recomUserId=this.recomUserId,u.orderObject.orderNo="",u.orderObject.orderList=[{orderType:"VIDEO",goodsName:"\u89C6\u9891\u8BFE\u8D2D\u4E70",courseGroupId:e.id,courseGroupName:e.lessonName,coursePrice:e.lessonPrice,price: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}]},async onBuy(){try{if(this.userInfo.payType==="VIP"){c().isApp?f({api:"openWebView",content:{url:`${location.origin}${location.pathname}#/memberCenter`,orientation:1,isHideTitle:!1}}):this.$router.push({path:"/memberCenter"});return}if(this.userInfo.lessonPrice<=0){this.initVideo(),await U(()=>{d.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this._init()})});return}const a=(await l.post("/api-student/userOrder/getPendingOrder",{data:{goodType:"VIDEO",bizId:this.params.groupId}})).data;a?d.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()=>{P(a,this.routerTo)}).catch(()=>{d.close(),this.cancelPayment(a.orderNo)}):(this.initVideo(),this.routerTo())}catch{}},routerTo(){this.$router.push({path:"/orderDetail",query:{orderType:"VIDEO",courseGroupId:this.params.groupId}})},async cancelPayment(e){try{await l.post("/api-student/userOrder/orderCancel",{data:{orderNo:e}})}catch{}}},watch:{pageVisibility(){this.userInfo.payType==="VIP"&&this.pageVisibility==="visible"&&l.get("/api-student/student/queryUserInfo",{initRequest:!0}).then(e=>{var t;y(e.data),this.userInfo.alreadyBuy=!!(this.userInfo.alreadyBuy||((t=e.data.userVip)==null?void 0:t.vipType)!=="NOT_VIP")})}},render(){let e;return r("div",{class:[n["video-detail"]]},[r(V,null,{right:()=>r("img",{src:D,onClick:()=>this.shareStatus=!0},null)}),r(C,{userInfo:this.userInfo,onUserDetail:t=>{c().isApp&&i.platformType==="STUDENT"&&this.$router.push({path:"/teacherHome",query:{teacherId:t.teacherId,tabs:"video"}})}},null),r(p,{border:!1},{default:()=>[r("p",{class:n.introduction},[this.userInfo.lessonDesc])]}),r(p,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",class:"mb12",border:!1},L(e=this.detailList.map(t=>{const s=(t.musicAlbumInfos||[]).map(o=>({relationMusicAlbum:o.relationType,musicAlbumName:o.name,musicAlbumId:o.musicAlbumId,status:o.status,useRelationType:this.userInfo.relationType}));return r(_,{musicAlbumInfos:s,class:[n.videoItem],detail:{id:t.id,title:t.videoTitle,content:t.videoContent,imgUrl:t.coverUrl},onPlay:this.onPlay,onMusicAlbumDetail:o=>{if(!this.userInfo.alreadyBuy&&!o.status){b("\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&&r(N,{position:"bottom",background:"white"},{default:()=>[r("div",{class:["btnGroup",n.btnMore]},[r(g,{block:!0,round:!0,type:"primary",onClick:this.onBuy,disabled:this.platformStatus},{default:()=>[this.userInfo.payType==="VIP"?"\u5F00\u901A\u4F1A\u5458":this.userInfo.lessonPrice<=0?"\u514D\u8D39\u9886\u53D6":"\u7ACB\u5373\u8D2D\u4E70"]})])]}),r(T,{show:this.shareStatus,"onUpdate:show":t=>this.shareStatus=t,style:{background:"transparent"}},{default:()=>[r(S,{teacherId:this.userInfo.id,shareUrl:this.shareUrl,shareType:"video"},{default:()=>[r($,{class:n.shareCourse,coverClass:n.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,payType:this.userInfo.payType,teacherId:this.userInfo.id,avatar:this.userInfo.headUrl,studentCount:this.userInfo.buyNum,existBuy:0,subjectName:this.userInfo.lessonSubjectName}},null)]})]})])}});export{de as default};