import{d as y,q as b,r as i,x as m,y as h,a as e,h as z,a0 as S,a5 as p,M as T}from"./index-f1aa8576.js";import{i as B,a as M,b as C}from"./api-aa910812.js";import{M as E}from"./index-fee32a87.js";import{q as L}from"./base-aba1ba3e.js";import{N as W}from"./Image-0752b1f1.js";import"./index-8c4ec4c7.js";import"./index-2e59479e.js";import"./fade-in-scale-up.cssr-1e4c62f1.js";const q="_container_1k99z_1",D="_back_1k99z_10",N="_centerSearch_1k99z_25",j="_section_1k99z_39",x="_directorySection_1k99z_43",F="_directionc_1k99z_50",R="_dirItem_1k99z_63",V="_active_1k99z_77",A="_content_1k99z_83",H="_wrap_1k99z_96",P="_emtpyWrap_1k99z_103",G="_wrapfirstI_1k99z_118",J="_wrapItem_1k99z_122",K="_item_1k99z_132",O="_name_1k99z_163",Q="_favoriteBtn_1k99z_170",U="_containerImg_1k99z_176",X="_cover_1k99z_202",Y="_loaded_1k99z_232",t={container:q,back:D,centerSearch:N,section:j,directorySection:x,directionc:F,dirItem:R,active:V,content:A,wrap:H,emtpyWrap:P,wrapfirstI:G,wrapItem:J,item:K,name:O,favoriteBtn:Q,containerImg:U,cover:X,loaded:Y},na=y({name:"baseIndex-list",setup(){b(),i(!1);const r=i([]),k=()=>{p({api:"goBack"})},c=m({musicTagId:null,keyword:null,page:1,rows:999}),g=i(!1),o=m({list:[],loading:!1,favoriteList:[],details:[],bookData:{},showBook:!1,book:{}}),v=i(),f=i([]),I=async()=>{try{const{data:a}=await M();r.value=a||[],r.value.length>0&&(c.musicTagId=r.value[0].id)}catch(a){}},l=async()=>{var _,u;o.loading=!0;const{musicTagId:a,...n}=c,s=await C({musicTagIds:[a],subjectId:((_=T.user.data)==null?void 0:_.subjectId)||"",...n});(s==null?void 0:s.code)===200&&Array.isArray((u=s==null?void 0:s.data)==null?void 0:u.rows)&&(o.list=s.data.rows.map(d=>(d.load=!1,d.key=Date.now()+d.id,d))),o.loading=!1,g.value=!0};h(async()=>{o.loading=!0,await I(),await l(),o.loading=!1});const w=a=>{const n=L.stringify({musicTagId:c.musicTagId,id:a.id,name:a.name}),s=location.origin+location.pathname+"#/co-ai-detail?"+n;console.log("🚀 ~ url:",s),p({api:"openWebView",content:{url:s,orientation:0,isHideTitle:!1,c_orientation:0}})};return()=>e("div",{class:t.container},[e("div",{class:t.back,onClick:k},[e("img",{src:B},null)]),e("div",{class:t.centerSearch},[e("div",{id:"coai-0"},[e(E,{class:["searchNotice"],shape:"round",background:"transparent",clearable:!1,placeholder:"请输入关键字",onSearch:a=>{c.keyword=a,l()}},null)])]),e("div",{class:t.section},[e("div",{class:t.directorySection},[e("div",{class:t.directionc},[r.value.map(a=>e("p",{class:[t.dirItem,c.musicTagId==a.id?t.active:""],onClick:()=>{c.musicTagId=a.id,l()}},[a.name]))])]),e("div",{class:t.content},[e("div",{class:[t.wrap,o.list.length<=0&&!o.loading?t.emtpyWrap:""],ref:v},[o.list.map((a,n)=>e("div",{class:t.wrapfirstI},[e("div",{ref:s=>f.value[n]=s,class:[t.wrapItem,o.bookData.id===a.id&&o.showBook?t.wrapItemHide:""],key:a.key,onClick:()=>w(a)},[e("div",{class:t.item},[e(W,z({"data-id":a.id},{id:n==0?"courseware-0":""},{class:[t.cover,a.load?t.loaded:""],objectFit:"cover",src:a.coverImg,onLoad:()=>{a.load=!0},onError:()=>{a.load=!0}}),null)]),e("div",{class:t.name},[a.name])])])),o.list.length<=0&&!o.loading&&e(S,{image:"list",description:"暂无数据"},null)])])])])}});export{na as default};
