import{d as g,g as c,w as l,T as u,j as t,D as v,M as y,z as d,u as I,C as b,B as _,Z as C}from"./index.394decd7.js";import{C as T}from"./index.360ebc13.js";import{S as L}from"./index.63f283ba.js";import{C as S}from"./index.e6e212d8.js";import{C as U}from"./index.f53ab473.js";import{C as h}from"./index.9e0d46e4.js";import"./index.3bbf4ddb.js";import"./index.f1b52763.js";import{T as N,a as m}from"./index.ae00317c.js";import{I as D}from"./index.ae2dd816.js";import{F as x}from"./index.224299a1.js";import{L as w}from"./index.dc786267.js";import{i as k}from"./icon_teacher.40b6f077.js";import{o as r,a as B}from"./orderStatus.535346ee.js";import"./index.dab716ce.js";import"./bars.4f1962a6.js";import"./icon_album_active.469423f9.js";import"./icon_music_active.1e7b47ef.js";import"./index.9462d7c5.js";import"./plyr.623e6d1e.js";import"./use-id.e2f22365.js";import"./use-tab-status.723110ee.js";import"./use-refs.09b2d19c.js";const A="_videoDesc_hpnky_4",P="_titleInfo_hpnky_12",j="_label_hpnky_20",V="_title_hpnky_12",O="_userLogo_hpnky_50",H="_messageContainer_hpnky_69";var i={"video-class-detail":"_video-class-detail_hpnky_1",videoDesc:A,titleInfo:P,label:j,"message-list":"_message-list_hpnky_37","message-active":"_message-active_hpnky_37",title:V,"message-name":"_message-name_hpnky_41","message-time":"_message-time_hpnky_45",userLogo:O,messageContainer:H};function p(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!C(s)}var de=g({name:"VideoClassDetail",data(){const s=this.$route.query;return{groupId:s.groupId,classId:s.classId,tabIndex:1,title:"",lessonPrice:0,useRelationType:"",alreadyBuy:!1,videoDetail:{},detailList:[],posterUrl:"",srcUrl:"",message:"",navHeight:0,currentClassIndex:1,reload:!1,videoContent:"",list:[],dataShow:!0,loading:!1,finished:!1,params:{page:1,rows:20},freeRate:0,trySee:!1,videoHeight:"212px"}},computed:{users(){return c.user.data},offsetTop(){const s=this.navHeight;return Number(s)+44+"px"}},async mounted(){var a;const s=document.body.clientWidth||document.body.offsetWidth;this.videoHeight=s/16*9+"px",this.navHeight=sessionStorage.getItem("navHeight")||0;try{await this.__init();const e=await l.get("/api-student/sysConfig/queryByParamNameList",{params:{paramNames:"video_lesson_free_rate"}});this.freeRate=((a=e.data[0])==null?void 0:a.paramValue)||0}catch{}this.getList()},methods:{async __init(){try{this.reload=!0;const a=(await l.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.groupId}})).data||{};this.videoDetail=a.lessonGroup,this.title=a.lessonGroup.lessonName,this.lessonPrice=a.lessonGroup.lessonPrice,this.useRelationType=a.lessonGroup.relationType,this.alreadyBuy=a.alreadyBuy,this.detailList=a.detailList||[],this.trySee=!a.alreadyBuy,this.detailList.forEach((e,n)=>{e.id===Number(this.classId)&&(this.posterUrl=e.coverUrl,this.srcUrl=e.videoUrl,this.title=e.videoTitle,this.currentClassIndex=n+1,this.videoContent=e.videoContent)}),this.reload=!1}catch{}},onSearch(){this.params.page=1,this.list=[],this.dataShow=!0,this.loading=!1,this.finished=!1,this.getList()},async getList(){try{const s=this.params,a=await l.post("/api-student/videoLesson/page",{data:{...s,videoId:this.classId}});this.loading=!1;const e=a.data||{};if(this.list.length>0&&e.pageNo===1)return;this.list=this.list.concat(e.rows||[]),this.finished=e.pageNo>=e.totalPage,this.params.page=e.pageNo+1,this.dataShow=this.list.length>0}catch{this.dataShow=!1,this.finished=!0}},onPlay(s){s.id!==Number(this.classId)&&(this.reload=!0,this.posterUrl=s.imgUrl,this.srcUrl=s.videoUrl,this.title=s.title,this.currentClassIndex=s.index,this.videoContent=s.content,this.classId=s.id,this.onSearch(),setTimeout(()=>{this.reload=!1},0))},async onSubmit(){try{await l.post("/api-student/videoLesson/evaluate",{data:{isTeacher:0,videoId:this.classId,content:this.message,studentId:c.user.data.userId}}),u("\u8BC4\u8BBA\u6210\u529F"),this.message="",setTimeout(()=>{this.onSearch()},500)}catch{}}},render(){let s,a;return t("div",{class:i["video-class-detail"]},[t(S,null,{default:()=>!this.reload&&t(U,{freeRate:Number(this.freeRate),freeTitleStatus:this.lessonPrice>0,trySee:this.trySee,src:this.srcUrl,poster:this.posterUrl,height:this.videoHeight,isBuy:!0,onBuyEmit:async()=>{if(this.lessonPrice>0){this.$router.back();return}try{const e=this.videoDetail;r.orderObject.orderType="VIDEO",r.orderObject.orderName="\u89C6\u9891\u8BFE\u8D2D\u4E70",r.orderObject.orderDesc="\u89C6\u9891\u8BFE\u8D2D\u4E70",r.orderObject.actualPrice=e.lessonPrice,r.orderObject.recomUserId="",r.orderObject.orderNo="",r.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:e.relationType,courseInfo:this.detailList,recomUserId:""}],await B(()=>{v.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this.__init()})})}catch{}}},null)}),t(h,{border:!1,class:i.cell,title:this.title,titleClass:[i.titleInfo,"van-ellipsis"]},{icon:()=>t(y,{name:"video",size:18,color:"var(--van-primary)",style:{display:"flex",alignItems:"center"}},null),value:()=>t("div",{class:i.label},[t("span",null,[this.currentClassIndex]),d("/"),this.detailList.length,d("\u8BFE\u65F6")])}),t("div",{class:i.videoDesc},[this.videoContent]),t(N,{active:this.tabIndex,"onUpdate:active":e=>this.tabIndex=e,class:i.infoField,color:"var(--van-primary)",sticky:!0,offsetTop:this.offsetTop,lineWidth:20},{default:()=>[t(m,{title:"\u76EE\u5F55",name:1},{default:()=>[t("div",{style:{overflowY:"auto"}},[t(L,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",border:!0},p(s=this.detailList.map((e,n)=>{const f=(e.musicAlbumInfos||[]).map(o=>({relationMusicAlbum:o.relationType,musicAlbumName:o.name,musicAlbumId:o.musicAlbumId,status:o.status,useRelationType:this.useRelationType}));return t(T,{musicAlbumInfos:f,playId:Number(this.classId),detail:{id:e.id,title:e.videoTitle,content:e.videoContent,imgUrl:e.coverUrl,videoUrl:e.videoUrl,index:n+1},onPlay:this.onPlay,onMusicAlbumDetail:o=>{if(!this.alreadyBuy&&!o.status){u("\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)}))?s:{default:()=>[s]})])]}),t(m,{title:"\u8BA8\u8BBA",name:3},{default:()=>[t("div",{style:{overflowY:"auto",marginBottom:"calc(var(--van-cell-vertical-padding) * 2 + var( --van-cell-line-height))"}},[this.dataShow?t(w,{loading:this.loading,"onUpdate:loading":e=>this.loading=e,finished:this.finished,finishedText:" ",immediateCheck:!1,onLoad:this.getList},p(a=this.list.map(e=>t(h,{class:[i["message-list"],e.isTeacher===1&&i["message-active"]],valueClass:i["message-time"]},{icon:()=>t(D,{class:i.userLogo,src:e.avatar||k,fit:"cover"},null),title:()=>t("div",{class:i.title},[t("div",{class:i["message-name"]},[e.userName]),t("div",{class:i["message-time"]},[I(e.evaluateTime).format("YYYY\u5E74MM\u6708DD\u65E5")])]),label:()=>t("div",{class:i.label},[e.content])})))?a:{default:()=>[a]}):t(b,{btnStatus:!1,tips:"\u6682\u65E0\u8BA8\u8BBA"},null)]),t("div",{class:i.messageContainer},[t(x,{placeholder:"\u5FEB\u6765\u8BA8\u8BBA\u5427\uFF5E",modelValue:this.message,"onUpdate:modelValue":e=>this.message=e},{button:()=>t(_,{type:"primary",disabled:!this.message,style:{padding:"0 20px"},size:"small",round:!0,onClick:this.onSubmit},{default:()=>[d("\u53D1\u5E03")]})})])]})]})])}});export{de as default};