video-class-detail.675885fb.js 8.6 KB

1
  1. import{d as v,g as c,an as y,y as n,T as p,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.39b48a47.js";import{C as N}from"./index.a177d001.js";import{S as V}from"./index.f11db230.js";import{C as w}from"./index.970ad07b.js";import{C as P}from"./index.1aca6fb4.js";import{C as m}from"./index.db115763.js";import"./index.608320e9.js";import"./index.0e35d2fb.js";import{T as x,a as f}from"./index.5d4d28cc.js";import{I as D}from"./index.fcbcb027.js";import{F as B}from"./index.428ab1a8.js";import{L as A}from"./index.6c529ad4.js";import{i as O}from"./icon_teacher.40b6f077.js";import{o as l,a as R}from"./orderStatus.fbc0ddaf.js";import{C as G}from"./index.b1c0c586.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";/* empty css */import"./tcplayer.v4.8.0.min.3b1de996.js";import"./use-id.b004ff17.js";import"./use-tab-status.bcc0c503.js";import"./use-refs.07204da6.js";import"./index.dc19bc54.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 i={"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 ve=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 o;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=((o=e.data[0])==null?void 0:o.paramValue)||0}catch{}this.getList()},methods:{async __init(){var s;this.reload=!0;try{const e=(await n.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.groupId}})).data||{},d=c.user.data,h=e.lessonGroup.payType==="VIP"?!!(e.alreadyBuy||((s=d.userVip)==null?void 0:s.vipType)!=="NOT_VIP"):e.alreadyBuy;this.videoDetail=e.lessonGroup,this.title=e.lessonGroup.lessonName,this.payType=e.lessonGroup.payType,this.lessonPrice=e.lessonGroup.lessonPrice,this.useRelationType=e.lessonGroup.relationType,this.alreadyBuy=h,this.detailList=e.detailList||[],this.trySee=!h,this.detailList.forEach((r,a)=>{r.id===Number(this.classId)&&(this.posterUrl=r.coverUrl,this.srcUrl=r.videoUrl,this.title=r.videoTitle,this.currentClassIndex=a+1,this.videoContent=r.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,o=await n.post("/api-student/videoLesson/page",{data:{...s,videoId:this.classId}});this.loading=!1;const e=o.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}}),p("\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,o;return t("div",{class:i["video-class-detail"]},[t(G,{position:"top",onGetHeight:e=>{this.offsetTop=e+"px"}},{default:()=>[t(w,null,{default:()=>!this.reload&&t(P,{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;l.orderObject.orderType="VIDEO",l.orderObject.orderName="\u89C6\u9891\u8BFE\u8D2D\u4E70",l.orderObject.orderDesc="\u89C6\u9891\u8BFE\u8D2D\u4E70",l.orderObject.actualPrice=e.lessonPrice,l.orderObject.recomUserId="",l.orderObject.orderNo="",l.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: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(m,{border:!1,class:i.cell,title:this.title,titleClass:[i.titleInfo,"van-ellipsis"]},{icon:()=>t(C,{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]),u("/"),this.detailList.length,u("\u8BFE\u65F6")])}),t("div",{class:i.videoDesc},[this.videoContent])])]}),t(x,{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(f,{title:"\u76EE\u5F55",name:1},{default:()=>[t("div",{style:{height:"calc(100vh - var(--van-tabs-line-height) - var(--header-height))",overflowY:"auto"}},[t(V,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",style:{marginBottom:"12px"}},g(s=this.detailList.map((e,d)=>{const r=(e.musicAlbumInfos||[]).map(a=>({relationMusicAlbum:a.relationType,musicAlbumName:a.name,musicAlbumId:a.musicAlbumId,status:a.status,useRelationType:this.useRelationType}));return t(N,{musicAlbumInfos:r,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:a=>{if(!this.alreadyBuy&&!a.status){p("\u6570\u636E\u6B63\u5728\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}a.relationMusicAlbum==="MUSIC"?this.$router.push({path:"/music-detail",query:{id:a.musicAlbumId}}):a.relationMusicAlbum==="ALBUM"&&this.$router.push({path:"/music-album-detail/"+a.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(o=this.list.map(e=>t(m,{class:[i["message-list"],e.isTeacher===1&&i["message-active"]],valueClass:i["message-time"]},{icon:()=>t(D,{class:i.userLogo,src:e.avatar||O,fit:"cover"},null),title:()=>t("div",{class:i.title},[t("div",{class:i["message-name"]},[e.userName]),t("div",{class:i["message-time"]},[L(e.evaluateTime).format("YYYY\u5E74MM\u6708DD\u65E5")])]),label:()=>t("div",{class:i.label},[e.content])})))?o:{default:()=>[o]}):t(S,{btnStatus:!1,tips:"\u6682\u65E0\u8BA8\u8BBA"},null)]),t("div",{class:i.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{ve as default};