1var re=Object.defineProperty;var Z=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var x=(F,r,d)=>r in F?re(F,r,{enumerable:!0,configurable:!0,writable:!0,value:d}):F[r]=d,G=(F,r)=>{for(var d in r||(r={}))oe.call(r,d)&&x(F,d,r[d]);if(Z)for(var d of Z(r))se.call(r,d)&&x(F,d,r[d]);return F};var z=(F,r,d)=>new Promise((f,S)=>{var v=c=>{try{w(d.next(c))}catch(C){S(C)}},I=c=>{try{w(d.throw(c))}catch(C){S(C)}},w=c=>c.done?f(c.value):Promise.resolve(c.value).then(v,I);w((d=d.apply(F,r)).next())});import{_ as de,d as ee,r as V,o as J,c as Q,i as a,w as e,j as A,t as m,l as t,a as k,s as ue,n as me,v as p,x as pe,y as M,P as X,eW as T,ak as ce,ae as ge}from"./index.7d418040.js";import{u as he}from"./useBatchPublish.6a0fb52a.js";import{u as fe}from"./useImgPreview.f562b757.js";const ye={key:0,class:"preview-container"},ve=["src"],we=pe({name:"myMaterialList"}),be=Object.assign(we,{emits:["refresh"],setup(F,{expose:r,emit:d}){const{t:f}=ee(),S=d,v=M(!1),I=M(!1),w=M(),c=M(""),C=M(""),B={id:null,name:"",width:"",height:"",img:"",sort:1e3},R=()=>G({},B),U=()=>{o.value=G({},B)},o=X(R()),W=l=>z(this,null,function*(){var i,g,h,_;I.value=!0;try{if(U(),(i=w==null?void 0:w.value)==null||i.resetFields(),l!=null&&l!==""){const O={filters:{id:l}},D=yield T.get(O);let $;$=D.data.results[0],c.value=$.imgUrl||""||null,Object.assign(o,{id:$.id,name:$.name||"",width:(g=$.true_width)!=null?g:"",height:(h=$.true_height)!=null?h:"",img:$.imgId,sort:(_=$.sort)!=null?_:1e3})}else c.value="",o.id=null;v.value=!0,I.value=!1}catch(O){v.value=!0,I.value=!1,p.Message.error(f("myFontList.pleaseRetry"))}}),q={name:[{required:!0,message:f("AiStyle.inputName"),trigger:"blur"}],width:[{required:!0,type:"number",message:f("differentFormManage.pleaseInputWidth"),trigger:"change"},{validator:(l,i,g)=>{i<0?g(new Error(f("differentFormManage.pleaseInputValidValue"))):g()},trigger:"blur"}],height:[{required:!0,type:"number",message:f("differentFormManage.pleaseInputHeight"),trigger:"change"},{validator:(l,i,g)=>{i<0?g(new Error(f("differentFormManage.pleaseInputValidValue"))):g()},trigger:"blur"}],img:[{required:!0,message:f("recharge.pleseUpload")}]},H=()=>z(this,null,function*(){try{if(!(yield new Promise(h=>{w.value.validate(_=>{h(_)})}))){p.Message.error(f("myFontList.pleaseFillInCompleteInformation"));return}I.value=!0,p.Spin.show();let i;C.value&&([i]=yield j([C.value]));const g={name:o.name,true_width:Number(o.width),true_height:Number(o.height),sort:Number(o.sort),img:o.id&&!i?o.img:i==null?void 0:i.id};if(o.id)yield T.update(o.id,g),p.Message.success(f("recharge.success"));else{const h=yield T.create(g);yield T.publish(h.data.id),p.Message.success(f("adminFontPublish.publishSuccess"))}v.value=!1,S("refresh")}catch(l){p.Message.error(f("recharge.addFailed"))}finally{I.value=!1,p.Spin.hide()}}),K=l=>z(this,null,function*(){if(!l.type.startsWith("image/"))return p.Message.error(f("myMaterialList.pleaseUploadImage")),!1;C.value=l,o.img="uploaded";const i=new FileReader;return i.onload=g=>{c.value=g.target.result},i.readAsDataURL(l),!1}),j=l=>z(this,null,function*(){const i=new FormData;if(Array.isArray(l))for(const h of l)i.append("files",h);else i.append("files",l);return(yield ce(i)).data}),L=()=>{c.value=null,C.value=null,o.img=null};return r({showModal:W}),(l,i)=>{const g=V("Input"),h=V("FormItem"),_=V("Button"),O=V("Upload"),D=V("InputNumber"),$=V("Form");return J(),Q("div",null,[a(t(p.Modal),{modelValue:t(v),"onUpdate:modelValue":i[5]||(i[5]=b=>me(v)?v.value=b:null),title:t(o).id?l.$t("recharge.pleaseEdit"):l.$t("recharge.pleaseAdd")},{footer:e(()=>[a(_,{type:"text",onClick:i[4]||(i[4]=b=>v.value=!1)},{default:e(()=>[A(m(l.$t("myMaterialList.cancel")),1)]),_:1}),a(_,{type:"primary",loading:t(I),onClick:H},{default:e(()=>[A(m(t(o).id?l.$t("recharge.edit"):l.$t("recharge.add")),1)]),_:1},8,["loading"])]),default:e(()=>[a($,{ref_key:"formRef",ref:w,"label-width":84,rules:q,model:t(o)},{default:e(()=>[a(h,{label:l.$t("keysElements.name"),prop:"name"},{default:e(()=>[a(g,{type:"text",modelValue:t(o).name,"onUpdate:modelValue":i[0]||(i[0]=b=>
1t(o).name=b),placeholder:l.$t("AiStyle.inputName")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:l.$t("differentFormManage.coverimg"),prop:"img"},{default:e(()=>[a(O,{ref:"upload",action:"/","before-upload":K,accept:"image/*"},{default:e(()=>[a(_,{icon:"ios-cloud-upload-outline"},{default:e(()=>[A(m(l.$t("AiStyle.uploadStyleimg")),1)]),_:1})]),_:1},512)]),_:1},8,["label"]),a(h,{label:l.$t("differentFormManage.previewCoverImg")},{default:e(()=>[t(c)?(J(),Q("div",ye,[k("img",{src:t(c),class:"preview-image"},null,8,ve),a(_,{type:"error",size:"small",shape:"circle",class:"delete-btn",icon:"ios-trash-outline",onClick:L})])):ue("",!0)]),_:1},8,["label"]),a(h,{label:l.$t("differentFormManage.width"),prop:"width"},{default:e(()=>[a(D,{modelValue:t(o).width,"onUpdate:modelValue":i[1]||(i[1]=b=>t(o).width=b),min:0,placeholder:l.$t("differentFormManage.pleaseInputWidth"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:l.$t("differentFormManage.height"),prop:"height"},{default:e(()=>[a(D,{modelValue:t(o).height,"onUpdate:modelValue":i[2]||(i[2]=b=>t(o).height=b),min:0,placeholder:l.$t("differentFormManage.pleaseInputHeight"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:l.$t("differentFormManage.sort"),prop:"sort"},{default:e(()=>[a(D,{modelValue:t(o).sort,"onUpdate:modelValue":i[3]||(i[3]=b=>t(o).sort=b),min:0,placeholder:l.$t("differentFormManage.pleaseInputSort"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])}}}),Me=de(be,[["__scopeId","data-v-6e403484"]]),_e={class:"home"},Ve={class:"title"},$e={class:"form"},ke={class:"preview-cell"},Se={__name:"index",setup(F){const{t:r}=ee(),d=M(null),f=M([{type:"selection",width:60,align:"center"},{title:r("keysMaterial.id"),key:"id",sortable:!0,width:80},{title:r("recharge.name"),key:"name",slot:"name",sortable:!0,minWidth:150,maxWidth:1e4},{title:r("differentFormManage.coverimg"),key:"img",slot:"img",width:200},{title:r("differentFormManage.width"),key:"width",slot:"width",width:80},{title:r("differentFormManage.height"),key:"height",slot:"height",width:100},{title:r("keyMaterial.sort"),key:"sort",sortable:!0,width:80},{title:r("MaterialView.status"),key:"status",slot:"status",width:100},{title:r("MaterialView.createdAt"),key:"createdAt",sortable:!0,slot:"createdAt",width:180},{title:r("MaterialView.updatedAt"),key:"updatedAt",sortable:!0,slot:"updatedAt",width:180},{title:r("MaterialView.publishedAt"),key:"publishedAt",sortable:!0,slot:"publishedAt",width:180},{title:r("MaterialView.operation"),slot:"action",width:270,align:"center",fixed:"right"}]),S=X({text:{$containsi:""},font_style_type:{id:null}}),v=M([]),I=M(0),w=M(1),c=M(20),C=M(""),B=M(!1),R=M([]),U=X({key:"",order:"normal"}),o=()=>z(this,null,function*(){var s;try{v.value=[],B.value=!0;const y={page:w.value,pageSize:c.value};if(U.key&&U.order!=="normal"){const u=U.order==="desc"?"desc":"asc";y.sort=[`${U.key}:${u}`]}const E={};(s=S.text.$containsi)!=null&&s.trim()&&(E.name={$containsi:S.text.$containsi.trim()}),C.value&&(E.pod_pro={name:{$contains:C.value}}),Object.keys(E).length>0&&(y.filters=E),p.Spin.show();const P=yield T.get(y);R.value=P.data.results,v.value=P.data.results.map(u=>({id:u.id,name:u.name,publishedAt:u.publishedAt,createdAt:u.createdAt,updatedAt:u.updatedAt,width:u.true_width,height:u.true_height,sort:u.sort,img:D(u,"img")})),I.value=P.data.pagination.total||0,v.value.length===0&&p.Message.info(r("MaterialView.noData"))}catch(y){console.error("è·åååå表失败:",y),p.Message.error(r("MaterialView.getListFailed"))}finally{B.value=!1,L.value=[],p.Spin.hide()}}),{publishStatus:W,deleteTool:q,batchPublish:H,batchUnpublish:K,batchDelete:j,selectedRows:L,handleSelect:l,handleSelectAll:i,handleSelectionChange:g}=he({getListHandle:o,apiKey:"api::df-film-cover.df-film-cover",fileKeys:["img"]}),{handleImageError:h,formatDate:_,getImageUrl:O,getImgItem:D}=fe(),$=s=>{p.Modal.confirm({title:r("MaterialView.confirmDelete")+s.name+"ï¼",content:r("MaterialView.unrecoverableAfterDelete"),onOk:()=>q(s)})},b=()=>z(this,null,function*(){w.value=1,o()}),te=s=>{if(s.key==="material_type")U.key="material_type.name";else{if(s.key==="preview")return;U.key=s.key}U.order=s.order;try{o()}catch(y){console.error("æåºå¤çæ¶åçé误:",y),p.Message.error(r("MaterialView.sortError")||"æåºå¤ç失败")}};return o(),(s,y)=>{const E=V("Input"),P=V("FormItem"),u=V("Button"),ae=V("Form"),le=V("Icon"),ie=V("Table"),ne=V("Page");return J(),Q("div",_e,[k("h2",Ve,m(s.$t("differentFormManage.filmCoverTitle")),1),k("div",null,[k("div",$e,[a(ae,{ref:"formInline",inline:"","label-position":"left"},{default:e(()=>[a(P,{label:s.$t("adminAddTemplate.name"),"label-width":40},{default:e(()=>[a(E,{type:"text",modelValue:S.text.$containsi,"onUpdate:modelValue":y[0]||(y[0]=n=>S.text.$containsi=n),placeholder:s.$t("Material.pleaseInputName"),onKeyup:ge(b,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(P,null,{default:e(()=>[a(t(p.Space),null,{default:e(()=>[a(u,{type:"primary",onClick:b},{default:e(()=>[A(m(s.$t("Banner.query")),1)]),_:1}),a(u,{type:"primary",onClick:y[1]||(y[1]=n=>{var N;return(N=d.value)==null?void 0:N.showModal()})},{default:e(()=>[A(m(s.$t("AiStyle.add")),1)]),_:1}),a(u,{type:"success",onClick:t(H),disabled:t(L).length===0},{default:e(()=>[A(m(s.$t("MaterialView.batchPublish")),1)]),_:1},8,["onClick","disabled"]),a(u,{type:"warning",onClick:t(K),disabled:t(L).length===0},{default:e(()=>[A(m(s.$t("MaterialView.batchUnpublish")),1)]),_:1},8,["onClick","disabled"]),a(u,{type:"error",onClick:t(j),disabled:t(L).length===0},{default:e(()=>[A(m(s.$t("MaterialView.batchDelete")),1)]),_:1},8,["onClick","disabled"])]),_:1})]),_:1})]),_:1},512)]),a(ie,{border:!0,columns:f.value,data:v.value,onOnSortChange:te,onOnSelect:t(l),onOnSelectAll:t(i),onOnSelectionChange:t
1(g)},{name:e(({row:n})=>[k("strong",null,m(n.name),1)]),img:e(({row:n})=>[k("div",ke,[a(t(p.Image),{src:t(O)(n.img,!1),preview:!0,"preview-list":[t(O)(n.img,!0)],fit:"contain",class:"preview-image",onError:N=>t(h)(N,n)},{error:e(()=>[a(le,{type:"ios-image-outline",size:"34",color:"#ccc"})]),_:1},8,["src","preview-list","onError"])])]),isCustom_bg:e(({row:n})=>[k("strong",null,m(n.isCustom_bg?s.$t("differentFormManage.yes"):s.$t("differentFormManage.no")),1)]),width:e(({row:n})=>[k("strong",null,m(n.width),1)]),height:e(({row:n})=>[k("strong",null,m(n.height),1)]),status:e(({row:n})=>[a(t(p.Tag),{color:n.publishedAt?"success":"warning"},{default:e(()=>[A(m(n.publishedAt?s.$t("MaterialView.published"):s.$t("MaterialView.unpublished")),1)]),_:2},1032,["color"])]),createdAt:e(({row:n})=>[k("span",null,m(t(_)(n.createdAt)),1)]),updatedAt:e(({row:n})=>[k("span",null,m(t(_)(n.updatedAt)),1)]),publishedAt:e(({row:n})=>[k("span",null,m(t(_)(n.publishedAt)),1)]),action:e(({row:n})=>[a(t(p.Space),null,{default:e(()=>[a(u,{type:"primary",size:"small",onClick:N=>{var Y;return(Y=d.value)==null?void 0:Y.showModal(n.id)}},{default:e(()=>[A(m(s.$t("MaterialView.edit")),1)]),_:1},8,["onClick"]),a(u,{type:"error",size:"small",onClick:N=>$(n)},{default:e(()=>[A(m(s.$t("MaterialView.delete")),1)]),_:1},8,["onClick"]),a(u,{type:n.publishedAt?"warning":"success",size:"small",onClick:N=>t(W)(n)},{default:e(()=>[A(m(n.publishedAt?s.$t("MaterialView.unpublish"):s.$t("MaterialView.publish")),1)]),_:2},1032,["type","onClick"])]),_:2},1024)]),_:1},8,["columns","data","onOnSelect","onOnSelectAll","onOnSelectionChange"]),a(ne,{class:"page",total:I.value,modelValue:w.value,"onUpdate:modelValue":y[2]||(y[2]=n=>w.value=n),onOnChange:o,onOnPageSizeChange:y[3]||(y[3]=n=>(c.value=n,o())),"page-size":c.value,"show-sizer":"","show-total":""},null,8,["total","modelValue","page-size"])]),a(t(Me),{ref_key:"listModalRef",ref:d,onRefresh:b},null,512)])}}};export{Se as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.