import{d as O,R as p,g as M,ag as L,r as F,ai as t,$ as b,m as N,o as C,c as a,aj as H,F as g,q as u,B as I,_ as V,a5 as w,ak as A,al as U}from"./index.5f7ffb46.js";import{O as j}from"./index.7790de2a.js";import{i as $}from"./isBetween.318963fd.js";import{O as q}from"./index.1d6ac2c5.js";import{i as W}from"./icon_teacher.df08d662.js";import{c as v}from"./index.b28db9f5.js";import{C as J}from"./index.47129549.js";import{D as K,a as Q}from"./index.63a4a300.js";import{L as X}from"./index.9ef28852.js";import{C as Z}from"./index.052b3caa.js";import{C as D}from"./index.abd668f7.js";import{I as ee}from"./index.276a5d68.js";import"./index.6bbd7daa.js";import"./use-tab-status.69b57a37.js";import"./index.99e0cf1f.js";import"./index.61ab9823.js";import"./utils.0f86fc1f.js";import"./Picker.148c9d83.js";const ae="_coursewareGroup_1z06z_1",se="_top1_1z06z_9",re="_top2_1z06z_14",oe="_userLogo_1z06z_19",te="_courseName_1z06z_26",ce="_userName_1z06z_27",le="_courseRange_1z06z_36",ue="_courseRangeTips_1z06z_46",ne="_exerciseRecord_1z06z_50",ie="_searchMore_1z06z_53",pe="_searchContainer_1z06z_70",me="_searchMoreGroup_1z06z_78",he="_searchTitle_1z06z_84",de="_searchTypeGroup_1z06z_92",ve="_searchTypeFlex_1z06z_99",Te="_searchTypeItem_1z06z_99",fe="_searchTypeFlex1_1z06z_102",ye="_searchTypeFlex2_1z06z_114",_e="_searchTypeItemLine_1z06z_117",ge="_searchPreview_1z06z_141",we="_searchPreviewItem_1z06z_148",ze="_cross_1z06z_162";var r={coursewareGroup:ae,top1:se,top2:re,userLogo:oe,courseName:te,userName:ce,courseRange:le,courseRangeTips:ue,exerciseRecord:ne,searchMore:ie,searchContainer:pe,searchMoreGroup:me,searchTitle:he,searchTypeGroup:de,searchTypeFlex:ve,searchTypeItem:Te,searchTypeFlex1:fe,searchTypeFlex2:ye,searchTypeItemLine:_e,"is-active":"_is-active_1z06z_136",searchPreview:ge,searchPreviewItem:we,cross:ze};t.extend($);function Ye(m){return typeof m=="function"||Object.prototype.toString.call(m)==="[object Object]"&&!U(m)}var Ve=O({name:"exercise-record",setup(){const m=p(M.platformApi);L();const l=F({showSearchStatus:!0,showPopoverTime:!1,actions:[],subjects:[]}),s=F({startTime:t().day(1).format("YYYY-MM-DD"),endTime:t().day(7).format("YYYY-MM-DD"),orchestraId:"",orchestraName:"",courseType:"",courseTypeName:"",coursewareErr:null,coursewareErrName:"",keyword:"",page:1,rows:20}),n=p(!1),z=p(!1),T=p(!1),f=p(!0),h=p([]),i=async()=>{try{n.value&&(s.page=1,h.value=[],n.value=!1);const{endTime:o,startTime:e,...c}=s,d=await N.post(`${m.value}/courseSchedule/coursewareErrPage`,{data:{...c,endTime:o+" 23:59:59",startTime:e+" 00:00:00"}});if(h.value.length>0&&d.data.pages===1)return;h.value=h.value.concat(d.data.rows||[]),T.value=d.data.current>=d.data.pages,f.value=h.value.length>0,s.page=d.data.current+1,z.value=!1}catch(o){const e=o.message;C(e),f.value=!1,T.value=!0}};b(()=>{i(),P()});const E=o=>{console.log(o,"val"),s.coursewareErr=o.value,s.coursewareErrName=o.name},k=o=>{s.orchestraId=o.value,s.orchestraName=o.name},x=o=>{s.courseType=o.value,s.courseTypeName=o.name},P=async()=>{try{const o=await N.post(`${m.value}/orchestra/page`,{data:{page:1,rows:9999,status:"DONE"}});l.actions=o.data.rows.map(e=>({name:e.name,value:e.id}))}catch(o){const e=o.message;C(e)}},R=()=>{T.value=!1,z.value=!0,i()},_=o=>{if(o.length>11){const e=o.substring(0,6),c=o.substring(o.length-5,o.length);return e+"..."+c}else return o},Y=o=>{if(o){const e=Math.floor(o/60),c=o%60;return(e>=10?e:"0"+e)+":"+(c>=10?c:"0"+c)}else return"00:00"},S=p(),y=p(),B=()=>{var o;s.startTime=t().day(1).format("YYYY-MM-DD"),s.endTime=t().day(7).format("YYYY-MM-DD"),s.orchestraId="",s.orchestraName="",s.courseType="",s.courseTypeName="",s.coursewareErr=null,s.coursewareErrName="",(o=y.value)==null||o.toggle(),n.value=!0,i()},G=()=>{var o;(o=y.value)==null||o.toggle(),n.value=!0,i()};return()=>{let o;return a("div",{class:[f.value?"":"emptyRootContainer",r.exerciseRecord]},[a(j,{position:"top",background:"#F8F8F8",onGetHeight:e=>{document.documentElement.style.setProperty("--header-height",e+"px")}},{default:()=>[a(H,{border:!1},{right:()=>a(K,{class:r.searchMore,closeOnClickOverlay:!1,closeOnClickOutside:!1,ref:S},{default:()=>[a(Q,{title:"\u7B5B\u9009",modelValue:l.showSearchStatus,"onUpdate:modelValue":e=>l.showSearchStatus=e,ref:y},{default:()=>[a("div",{class:r.searchContainer},[l.actions.length>0&&a(g,null,[a("div",{class:r.searchTitle},[u("\u4E50\u56E2")]),a("div",{class:[r.searchTypeGroup,r.searchTypeFlex]},[l.actions.map(e=>a("div",{class:[r.searchTypeItem,e.value===s.orchestraId&&r["is-active"]],onClick:()=>k(e)},[_(e.name)]))])]),a("div",{class:r.searchTitle},[u("\u65F6\u95F4\u6BB5")]),a("div",{class:[r.searchTypeGroup,r.searchTypeFlex2]},[a("div",{class:r.searchTypeItem,onClick:()=>l.showPopoverTime=!0},[s.startTime]),a("div",{class:r.searchTypeItemLine,onClick:()=>l.showPopoverTime=!0},null),a("div",{class:r.searchTypeItem,onClick:()=>l.showPopoverTime=!0},[s.endTime])]),a("div",{class:r.searchTitle},[u("\u8BFE\u7A0B\u7C7B\u578B")]),a("div",{class:[r.searchTypeGroup,r.searchTypeFlex1]},[Object.keys(v).map(e=>a("div",{class:[r.searchTypeItem,e===s.courseType&&r["is-active"]],onClick:()=>{x({name:v[e],value:e})}},[v[e]]))]),a("div",{class:r.searchTitle},[u("\u8BFE\u4EF6\u4F7F\u7528\u72B6\u6001")]),a("div",{class:[r.searchTypeGroup,r.searchTypeFlex]},[[{name:"\u6B63\u5E38",value:!1},{name:"\u5F02\u5E38",value:!0}].map(e=>a("div",{class:[r.searchTypeItem,s.coursewareErr===e.value&&r["is-active"]],onClick:()=>E(e)},[e.name]))])]),a("div",{class:[r.searchMoreGroup,"van-hairline--top"]},[a(I,{type:"default",block:!0,round:!0,onClick:B},{default:()=>[u("\u91CD\u7F6E")]}),a(I,{type:"primary",block:!0,round:!0,onClick:G},{default:()=>[u("\u67E5\u8BE2")]})])]})]})}),a("div",{style:{backgroundColor:"#fff"}},[a("div",{class:r.searchPreview},[a("div",{class:r.searchPreviewItem,onClick:()=>{var e;(e=y.value)==null||e.toggle(),V(()=>{document.querySelectorAll(".van-dropdown-item--down")[0].style.top=`calc(var(--van-nav-bar-height) + ${M.navBarHeight}px`})}},[s.startTime,u("~"),s.endTime]),s.orchestraId&&a("div",{class:r.searchPreviewItem},[_(s.orchestraName),a(w,{name:"cross",class:r.cross,onClick:e=>{s.orchestraId="",s.orchestraName="",e.stopPropagation(),n.value=!0,i()}},null)]),s.courseType&&a("div",{class:r.searchPreviewItem},[s.courseTypeName,a(w,{name:"cross",class:r.cross,onClick:e=>{s.courseType="",s.courseTypeName="",e.stopPropagation(),n.value=!0,i()}},null)]),s.coursewareErr!=null&&a("div",{class:r.searchPreviewItem},[s.coursewareErrName,a(w,{name:"cross",class:r.cross,onClick:e=>{s.coursewareErr=null,s.coursewareErrName="",e.stopPropagation(),n.value=!0,i()}},null)])])])]}),f.value?a(q,{modelValue:n.value,"onUpdate:modelValue":e=>n.value=e,onRefresh:R,style:{minHeight:"calc(100vh - var(--header-height))"}},{default:()=>[a(X,{"loading-text":" ",finished:T.value,style:{paddingTop:"12px"},"finished-text":" ",immediateCheck:!1,onLoad:i},Ye(o=h.value.map(e=>a(Z,{inset:!0,class:r.coursewareGroup},{default:()=>[a(D,{class:r.top1},{title:()=>a(g,null,[t(e.startTime).format("YYYY-MM-DD HH:mm"),u("~"),t(e.endTime).format("HH:mm")]),value:()=>a(g,null,[_(e.orchestraName)])}),a(D,{class:r.top2,center:!0},{icon:()=>a(ee,{class:r.userLogo,src:e.teacherAvatar||W,fit:"cover"},null),title:()=>a("div",{class:r.userInfo},[a("p",{class:[r.userName,"van-ellipsis"]},[e.teacherName]),a("p",{class:[r.courseName,"van-ellipsis"]},[["INSTRUMENTAL_ENSEMBLE","EUPHONIUM_SINGLE"].includes(e.type)?v[e.type]:v[e.type]+"\u5355\u6280\u8BFE"])]),value:()=>a("div",{class:r.courseCount},[a("p",{class:r.courseRange},[a("span",{style:{color:e.coursewarePlayTime>=e.adviseStudyTimeSecond?"#333":"#f44541"}},[Y(e.coursewarePlayTime)]),u("/"),Y(e.adviseStudyTimeSecond)]),a("p",{class:r.courseRangeTips},[u("\u4F7F\u7528\u65F6\u957F/\u6807\u51C6\u65F6\u957F")])])})]})))?o:{default:()=>[o]})]}):a(A,{tips:"\u6682\u65E0\u8BFE\u4EF6\u8BB0\u5F55"},null),a(J,{show:l.showPopoverTime,"onUpdate:show":e=>l.showPopoverTime=e,firstDayOfWeek:1,showConfirm:!1,type:"range",maxRange:7,minDate:new Date("2023-02-27"),defaultDate:[t(s.startTime).toDate(),t(s.endTime).toDate()],style:{height:"70%"},onSelect:e=>{if(s.startTime="",s.endTime="",!t(e[0]).isBetween(t(s.startTime),t(s.endTime))){const c=t(e[0]).day();c===0?(s.startTime=t(e[0]).subtract(6,"day").format("YYYY-MM-DD"),s.endTime=t(e[0]).format("YYYY-MM-DD")):c===1?(s.startTime=t(e[0]).format("YYYY-MM-DD"),s.endTime=t(e[0]).add(6,"day").format("YYYY-MM-DD")):(s.startTime=t(e[0]).subtract(c-1,"day").format("YYYY-MM-DD"),s.endTime=t(e[0]).add(7-c,"day").format("YYYY-MM-DD"))}l.showPopoverTime=!1}},null)])}}});export{Ve as default};