video-class-detail.0927f9d4.js 8.1 KB

1
  1. import{d as g,g as c,am as v,x as n,T as p,i as b,j as s,f as I,n as _,D as T,M as C,z as h,v as L,C as U,B as S,Z as N}from"./index.79e75ce0.js";import{C as V}from"./index.cb3d89b3.js";import{S as w}from"./index.33cbd994.js";import{C as x}from"./index.06bc7daf.js";import{C as D}from"./index.d6eb7f67.js";import{C as m}from"./index.09d7c110.js";import"./index.a8bab255.js";import"./index.34eae8fb.js";import{T as P,a as y}from"./index.8d613b0f.js";import{I as k}from"./index.c5a2cef6.js";import{F as A}from"./index.d444ae18.js";import{L as B}from"./index.4008f59f.js";import{i as j}from"./icon_teacher.40b6f077.js";import{o as r,a as O}from"./orderStatus.2009824c.js";import"./index.f3c1b46f.js";import"./bars.4f1962a6.js";import"./icon_album_active.469423f9.js";import"./icon_music_active.1e7b47ef.js";import"./index.090876b3.js";/* empty css */import"./tcplayer.v4.8.0.min.c6dc3597.js";/* empty css */import"./use-id.1a08b493.js";import"./use-tab-status.1f580b07.js";import"./use-refs.9959a5bc.js";const H="_videoDesc_hpnky_4",M="_titleInfo_hpnky_12",R="_label_hpnky_20",G="_title_hpnky_12",$="_userLogo_hpnky_50",q="_messageContainer_hpnky_69";var a={"video-class-detail":"_video-class-detail_hpnky_1",videoDesc:H,titleInfo:M,label:R,"message-list":"_message-list_hpnky_37","message-active":"_message-active_hpnky_37",title:G,"message-name":"_message-name_hpnky_41","message-time":"_message-time_hpnky_45",userLogo:$,messageContainer:q};function f(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!N(t)}var ye=g({name:"VideoClassDetail",data(){const t=this.$route.query;return{pageVisibility:"visible",groupId:t.groupId,classId:t.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"}},computed:{users(){return c.user.data},offsetTop(){const t=this.navHeight;return Number(t)+44+"px"}},async mounted(){var i;this.pageVisibility=v();const t=document.body.clientWidth||document.body.offsetWidth;this.videoHeight=t/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"?!!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,u)=>{l.id===Number(this.classId)&&(this.posterUrl=l.coverUrl,this.srcUrl=l.videoUrl,this.title=l.videoTitle,this.currentClassIndex=u+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 t=this.params,i=await n.post("/api-student/videoLesson/page",{data:{...t,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(t){t.id!==Number(this.classId)&&(this.reload=!0,this.posterUrl=t.imgUrl,this.srcUrl=t.videoUrl,this.title=t.title,this.currentClassIndex=t.index,this.videoContent=t.content,this.classId=t.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(t=>{b(t.data),this.__init()})}},render(){let t,i;return s("div",{class:a["video-class-detail"]},[s(x,null,{default:()=>!this.reload&&s(D,{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 O(()=>{T.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this.__init()})})}catch{}}},null)}),s(m,{border:!1,class:a.cell,title:this.title,titleClass:[a.titleInfo,"van-ellipsis"]},{icon:()=>s(C,{name:"video",size:18,color:"var(--van-primary)",style:{display:"flex",alignItems:"center"}},null),value:()=>s("div",{class:a.label},[s("span",null,[this.currentClassIndex]),h("/"),this.detailList.length,h("\u8BFE\u65F6")])}),s("div",{class:a.videoDesc},[this.videoContent]),s(P,{active:this.tabIndex,"onUpdate:active":e=>this.tabIndex=e,class:a.infoField,color:"var(--van-primary)",sticky:!0,offsetTop:this.offsetTop,lineWidth:20},{default:()=>[s(y,{title:"\u76EE\u5F55",name:1},{default:()=>[s("div",{style:{overflowY:"auto"}},[s(w,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",border:!0},f(t=this.detailList.map((e,d)=>{const u=(e.musicAlbumInfos||[]).map(o=>({relationMusicAlbum:o.relationType,musicAlbumName:o.name,musicAlbumId:o.musicAlbumId,status:o.status,useRelationType:this.useRelationType}));return s(V,{musicAlbumInfos:u,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){p("\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)}))?t:{default:()=>[t]})])]}),s(y,{title:"\u8BA8\u8BBA",name:3},{default:()=>[s("div",{style:{overflowY:"auto",marginBottom:"calc(var(--van-cell-vertical-padding) * 2 + var( --van-cell-line-height))"}},[this.dataShow?s(B,{loading:this.loading,"onUpdate:loading":e=>this.loading=e,finished:this.finished,finishedText:" ",immediateCheck:!1,onLoad:this.getList},f(i=this.list.map(e=>s(m,{class:[a["message-list"],e.isTeacher===1&&a["message-active"]],valueClass:a["message-time"]},{icon:()=>s(k,{class:a.userLogo,src:e.avatar||j,fit:"cover"},null),title:()=>s("div",{class:a.title},[s("div",{class:a["message-name"]},[e.userName]),s("div",{class:a["message-time"]},[L(e.evaluateTime).format("YYYY\u5E74MM\u6708DD\u65E5")])]),label:()=>s("div",{class:a.label},[e.content])})))?i:{default:()=>[i]}):s(U,{btnStatus:!1,tips:"\u6682\u65E0\u8BA8\u8BBA"},null)]),s("div",{class:a.messageContainer},[s(A,{placeholder:"\u5FEB\u6765\u8BA8\u8BBA\u5427\uFF5E",modelValue:this.message,"onUpdate:modelValue":e=>this.message=e},{button:()=>s(S,{type:"primary",disabled:!this.message,style:{padding:"0 20px"},size:"small",round:!0,onClick:this.onSubmit},{default:()=>[h("\u53D1\u5E03")]})})])]})]})])}});export{ye as default};