video-detail.996c5efe.js 7.4 KB

1
  1. 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.b7226882.js";import{C as _}from"./index.54d01dd3.js";import{S as p}from"./index.a841fff0.js";import{U as C}from"./index.c1be15b1.js";import{C as V}from"./index.969bba7f.js";import{o as u,a as U}from"./orderStatus.1ca966f0.js";import{t as P}from"./tradeOrder.b3e670b0.js";import{C as N}from"./index.0b42adfa.js";import{i as D}from"./icon-share.4e09e300.js";import{C as S}from"./index.0b85a0cc.js";import{L as $}from"./live-item.77220bb5.js";import"./index.40f703b6.js";import"./index.20c0f4c5.js";import"./index.ed3a5560.js";import"./bars.4f1962a6.js";import"./icon_album_active.cb923735.js";import"./icon_music_active.f55820b3.js";import"./index.9269bf1e.js";import"./icon_teacher.40b6f077.js";import"./icon_timer2.5fb1750d.js";import"./index.1eaf642c.js";import"./index.cf00521e.js";import"./code-down-load.95f00a21.js";import"./logo.bcac726b.js";import"./browser.b3690ea1.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};