index.eb20c0ff.js 5.7 KB

1
  1. import{d as m,j as e,A as l,F as u,g as a,y as d,N as S,C as v,aS as j,$ as g}from"./ResizeObserver.es.39b48a47.js";import{C as _}from"./index.970ad07b.js";import{S as N}from"./index.e10a1ae2.js";import{S as y}from"./index.608320e9.js";import{L as C}from"./index.6c529ad4.js";import{I as T}from"./index.fcbcb027.js";import{O as E}from"./organ-search.31aca7ed.js";import{a as h,S as p,u as L}from"./hooks.6df65925.js";import"./index.db115763.js";import"./index.428ab1a8.js";import"./use-id.b004ff17.js";import"./use-tab-status.bcc0c503.js";import"./index.34ac729a.js";const I="_videoClass_1udm0_1",V="_label_1udm0_9",D="_classHeader_1udm0_21",w="_banner_1udm0_24",P="_videoList_1udm0_28";var r={videoClass:I,label:V,classHeader:D,banner:w,videoList:P};const F="_videoItem_9rujg_1",U="_viCover_9rujg_8",k="_viSection_9rujg_13",O="_viTitle_9rujg_16",x="_viUserNum_9rujg_21",H="_viPrice_9rujg_26",A="_priceNum_9rujg_31",$="_label_9rujg_40",B="_subjectName_9rujg_43";var i={videoItem:F,viCover:U,viSection:k,viTitle:O,viUserNum:x,viPrice:H,priceNum:A,label:$,subjectName:B},R=m({name:"VideoItem",props:{item:Object,onClick:{type:Function,default:s=>{}}},render(){const s=this.item;return e("div",{class:i.videoItem,onClick:()=>{this.onClick(s)}},[e("div",{style:{position:"relative"}},[e(T,{class:i.viCover,fit:"cover",src:s==null?void 0:s.lessonCoverUrl},null),e("span",{class:i.subjectName},[s==null?void 0:s.lessonSubjectName])]),e("div",{class:i.viSection},[e("div",{class:[i.viTitle,"van-ellipsis"]},[s==null?void 0:s.lessonName]),e("div",{class:i.viPrice},[e("span",{class:i.priceNum},[s.payType==="VIP"?e("span",{style:{color:"#C76E21"}},[l("\u4F1A\u5458")]):e(u,null,[(s==null?void 0:s.lessonPrice)>0&&e(u,null,[e("i",null,[l("\uFFE5")]),s==null?void 0:s.lessonPrice]),(s==null?void 0:s.lessonPrice)<=0&&s.auditVersion!==0&&e(u,null,[e("i",null,[l("\uFFE5")]),l("0")]),(s==null?void 0:s.lessonPrice)<=0&&s.auditVersion===0&&e("span",{style:{color:"#20BEA0"}},[l("\u514D\u8D39")])])]),e("span",{class:i.label},[l("/"),s==null?void 0:s.lessonCount,l("\u8BFE\u65F6")])]),e("div",{class:i.viUserNum},[s==null?void 0:s.countStudent,l("\u4EBA\u5B66\u4E60")])])])}});function q(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!g(s)}var is=m({name:"VideoClass",data(){return{apiSuffix:a.platformType==="STUDENT"?"/api-student":"/api-teacher",search:"",list:[],dataShow:!0,loading:!1,finished:!1,listLoading:!0,params:{search:"",lessonSubject:null,subjectName:"\u5168\u90E8\u58F0\u90E8",page:1,rows:20},searchStatus:!1,openStatus:!1,subjectList:[]}},async mounted(){var s;try{const t=await d.get(`${this.apiSuffix}/subject/subjectSelect?type=VIDEO`);this.subjectList=t.data||[]}catch{}if(a.platformType==="TEACHER"){const t=a.user.data;t.defaultSubject&&(this.params.lessonSubject=t.defaultSubject,this.params.subjectName=t.defaultSubjectName)}else{const t=h(p.VIDEO);if(t.id)this.params.lessonSubject=Number(t.id),this.params.subjectName=t.name;else{const n=this.subjectList,o=((s=a.user.data)==null?void 0:s.subjectId)||"",f=o?Number(o.split(",")[0]):null;n.forEach(b=>{(b.subjects||[]).forEach(c=>{c.id===Number(f)&&(this.params.lessonSubject=c.id,this.params.subjectName=c.name)})})}}this.listLoading=!1,this.getList(),L("\u89C6\u9891\u8BFE")},methods:{async getList(){try{if(this.listLoading)return;this.listLoading=!0;const s={...this.params};a.version&&(s.version=a.version||"",s.platform=a.platformType==="STUDENT"?"ios-student":"ios-teacher");const t=a.platformType==="STUDENT"?"/api-student/videoLesson/selectGroup":"/api-teacher/videoLessonGroup/page";s.myself=!1;const n=await d.post(t,{data:{...s}});this.loading=!1;const o=n.data||{};if(this.list.length>0&&o.pageNo===1)return;this.list=this.list.concat(o.rows||[]),this.finished=o.pageNo>=o.totalPage,this.params.page=o.pageNo+1,this.dataShow=this.list.length>0}catch{this.dataShow=!1,this.finished=!0}finally{this.listLoading=!1}},async setDefaultSubject(s){try{await d.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:s}})}catch{}},onSort(){this.params.page=1,this.list=[],this.dataShow=!0,this.loading=!1,this.finished=!1,this.searchStatus=!1,a.platformType==="TEACHER"?this.setDefaultSubject(this.params.lessonSubject):this.params.lessonSubject&&h(p.VIDEO,JSON.stringify({id:this.params.lessonSubject,name:this.params.subjectName}),"set"),this.getList()},onSearch(s){this.params.search=s,this.onSort()},onDetail(s){const t={groupId:s.id};a.platformType==="TEACHER"&&(t.share=1),this.$router.push({path:"/videoDetail",query:t})}},render(){let s;return e("div",{class:r.videoClass},[e(y,{offsetTop:0,position:"top"},{default:()=>[e(_,{class:r.classHeader,border:!1,isFixed:!1,background:"transparent"},null),e(N,{placeholder:"\u8BF7\u8F93\u5165\u8001\u5E08\u540D\u79F0/\u8BFE\u7A0B\u540D\u79F0",onSearch:this.onSearch},{left:()=>e("div",{class:r.label,onClick:()=>{this.searchStatus=!this.searchStatus,this.openStatus=!this.openStatus}},[this.params.subjectName,e(S,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),e("div",null,[this.dataShow?e(C,{class:r.videoList,loading:this.loading,"onUpdate:loading":t=>this.loading=t,finished:this.finished,finishedText:"\u6CA1\u6709\u66F4\u591A\u4E86",onLoad:this.getList,immediateCheck:!1},q(s=this.list.map(t=>e(R,{item:t,onClick:this.onDetail},null)))?s:{default:()=>[s]}):e(v,{btnStatus:!1,tips:"\u6682\u65E0\u89C6\u9891\u8BFE"},null)]),e(j,{show:this.searchStatus,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>this.searchStatus=!1,onClosed:()=>this.openStatus=!1},{default:()=>[this.openStatus&&e(E,{subjectList:this.subjectList,onSort:this.onSort,modelValue:this.params.lessonSubject,"onUpdate:modelValue":t=>this.params.lessonSubject=t,subjectName:this.params.subjectName,"onUpdate:subjectName":t=>this.params.subjectName=t},null)]})])}});export{is as default};