video-class-detail.54f9549f.js 8.5 KB

1
  1. import{d as v,g as c,an as y,y as n,T as m,i as b,j as t,f as I,n as _,D as T,N as C,A as u,w as L,C as S,B as U,$ as j}from"./ResizeObserver.es.f28023e0.js";import{C as N}from"./index.46d36266.js";import{S as w}from"./index.07a2a95f.js";import{C as V}from"./index.bd375ca9.js";import{C as x}from"./index.070305bf.js";import{C as p}from"./index.3b2e70c8.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import{T as D,a as f}from"./index.aa87c0e3.js";import{I as P}from"./index.7a1af785.js";import{F as B}from"./index.975e8f79.js";import{L as A}from"./index.79f59946.js";import{i as O}from"./icon_teacher.40b6f077.js";import{o as r,a as R}from"./orderStatus.00354bd8.js";import{C as G}from"./index.8c937010.js";import"./index.af901340.js";import"./bars.4f1962a6.js";import"./icon_album_active.a67a159e.js";import"./icon_music_active.5a84cf57.js";import"./index.2a22730e.js";/* empty css */import"./tcplayer.v4.8.0.min.97e1acba.js";/* empty css */import"./use-id.cc14bbe9.js";import"./use-tab-status.653933d8.js";import"./use-refs.b4f9d723.js";import"./index.9a41251d.js";const H="_videoDesc_stehj_4",M="_titleInfo_stehj_12",$="_label_stehj_20",q="_title_stehj_12",E="_userLogo_stehj_50",Y="_messageContainer_stehj_69";var a={"video-class-detail":"_video-class-detail_stehj_1",videoDesc:H,titleInfo:M,label:$,"message-list":"_message-list_stehj_37","message-active":"_message-active_stehj_37",title:q,"message-name":"_message-name_stehj_41","message-time":"_message-time_stehj_45",userLogo:E,messageContainer:Y};function g(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!j(s)}var ye=v({name:"VideoClassDetail",data(){const s=this.$route.query;return{pageVisibility:"visible",groupId:s.groupId,classId:s.classId,tabIndex:1,title:"",lessonPrice:0,payType:"",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",offsetTop:"auto"}},computed:{users(){return c.user.data}},async mounted(){var i;this.pageVisibility=y();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 n.get("/api-student/sysConfig/queryByParamNameList",{params:{paramNames:"video_lesson_free_rate"}});this.freeRate=((i=e.data[0])==null?void 0:i.paramValue)||0}catch{}this.getList()},methods:{async __init(){this.reload=!0;try{const i=(await n.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.groupId}})).data||{},e=c.user.data,d=i.lessonGroup.payType==="VIP"?!!(i.alreadyBuy||e.isVip):i.alreadyBuy;this.videoDetail=i.lessonGroup,this.title=i.lessonGroup.lessonName,this.payType=i.lessonGroup.payType,this.lessonPrice=i.lessonGroup.lessonPrice,this.useRelationType=i.lessonGroup.relationType,this.alreadyBuy=d,this.detailList=i.detailList||[],this.trySee=!d,this.detailList.forEach((l,h)=>{l.id===Number(this.classId)&&(this.posterUrl=l.coverUrl,this.srcUrl=l.videoUrl,this.title=l.videoTitle,this.currentClassIndex=h+1,this.videoContent=l.videoContent)})}catch{}this.reload=!1},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,i=await n.post("/api-student/videoLesson/page",{data:{...s,videoId:this.classId}});this.loading=!1;const e=i.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 n.post("/api-student/videoLesson/evaluate",{data:{isTeacher:0,videoId:this.classId,content:this.message,studentId:c.user.data.userId}}),m("\u8BC4\u8BBA\u6210\u529F"),this.message="",setTimeout(()=>{this.onSearch()},500)}catch{}}},watch:{pageVisibility(){this.payType==="VIP"&&n.get("/api-student/student/queryUserInfo",{initRequest:!0}).then(s=>{b(s.data),this.__init()})}},render(){let s,i;return t("div",{class:a["video-class-detail"]},[t(G,{position:"top",onGetHeight:e=>{this.offsetTop=e+"px"}},{default:()=>[t(V,null,{default:()=>!this.reload&&t(x,{freeRate:Number(this.freeRate),freeTitleStatus:this.lessonPrice>0,trySee:this.trySee,src:this.srcUrl,payType:this.payType,poster:this.posterUrl,height:this.videoHeight,isBuy:!0,onBuyEmit:async()=>{if(this.payType==="VIP"){I().isApp?_({api:"openWebView",content:{url:`${location.origin}${location.pathname}#/memberCenter`,orientation:1,isHideTitle:!1}}):this.$router.push({path:"/memberCenter"});return}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 R(()=>{T.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this.__init()})})}catch{}}},null)}),t("div",{style:"overflow: hidden"},[t(p,{border:!1,class:a.cell,title:this.title,titleClass:[a.titleInfo,"van-ellipsis"]},{icon:()=>t(C,{name:"video",size:18,color:"var(--van-primary)",style:{display:"flex",alignItems:"center"}},null),value:()=>t("div",{class:a.label},[t("span",null,[this.currentClassIndex]),u("/"),this.detailList.length,u("\u8BFE\u65F6")])}),t("div",{class:a.videoDesc},[this.videoContent])])]}),t(D,{active:this.tabIndex,"onUpdate:active":e=>this.tabIndex=e,class:a.infoField,color:"var(--van-primary)",sticky:!0,offsetTop:this.offsetTop,lineWidth:20},{default:()=>[t(f,{title:"\u76EE\u5F55",name:1},{default:()=>[t("div",{style:{height:"calc(100vh - var(--van-tabs-line-height) - var(--header-height))",overflowY:"auto"}},[t(w,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",style:{marginBottom:"12px"}},g(s=this.detailList.map((e,d)=>{const h=(e.musicAlbumInfos||[]).map(o=>({relationMusicAlbum:o.relationType,musicAlbumName:o.name,musicAlbumId:o.musicAlbumId,status:o.status,useRelationType:this.useRelationType}));return t(N,{musicAlbumInfos:h,playId:Number(this.classId),detail:{id:e.id,title:e.videoTitle,content:e.videoContent,imgUrl:e.coverUrl,videoUrl:e.videoUrl,index:d+1},onPlay:this.onPlay,onMusicAlbumDetail:o=>{if(!this.alreadyBuy&&!o.status){m("\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(f,{title:"\u8BA8\u8BBA",name:3},{default:()=>[t("div",{style:{overflowY:"auto",height:"calc(100vh - var(--van-tabs-line-height) - var(--header-height) - (var(--van-cell-vertical-padding) * 2 + var( --van-cell-line-height)))",marginBottom:"calc(var(--van-cell-vertical-padding) * 2 + var( --van-cell-line-height))"}},[this.dataShow?t(A,{loading:this.loading,"onUpdate:loading":e=>this.loading=e,finished:this.finished,finishedText:" ",immediateCheck:!1,onLoad:this.getList},g(i=this.list.map(e=>t(p,{class:[a["message-list"],e.isTeacher===1&&a["message-active"]],valueClass:a["message-time"]},{icon:()=>t(P,{class:a.userLogo,src:e.avatar||O,fit:"cover"},null),title:()=>t("div",{class:a.title},[t("div",{class:a["message-name"]},[e.userName]),t("div",{class:a["message-time"]},[L(e.evaluateTime).format("YYYY\u5E74MM\u6708DD\u65E5")])]),label:()=>t("div",{class:a.label},[e.content])})))?i:{default:()=>[i]}):t(S,{btnStatus:!1,tips:"\u6682\u65E0\u8BA8\u8BBA"},null)]),t("div",{class:a.messageContainer},[t(B,{placeholder:"\u5FEB\u6765\u8BA8\u8BBA\u5427\uFF5E",modelValue:this.message,"onUpdate:modelValue":e=>this.message=e},{button:()=>t(U,{type:"primary",disabled:!this.message,style:{padding:"0 20px"},size:"small",round:!0,onClick:this.onSubmit},{default:()=>[u("\u53D1\u5E03")]})})])]})]})])}});export{ye as default};