mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-21 10:38:10 +00:00
2 lines
7.9 KiB
JavaScript
2 lines
7.9 KiB
JavaScript
import{d as te,f as ae,v as le,l as F,X as oe,k as a,r as y,bg as x,h as p,c as _,e as o,w as s,a as v,t as i,u as l,i as m,B as C,F as q,T as H,m as g,J as se,z as re,bh as ne,a4 as ie,E as pe,aC as de,D as ue,G as me,a3 as ce,ai as fe,H as ye,L as _e,a6 as ge,ac as ve,a7 as he,a8 as be,S as ke,M as Pe}from"./index-3f969305.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css *//* empty css */import{c as we,d as xe,m as Ce,f as Te,h as Ve,b as De,j as Ee}from"./poster-923c41d1.js";const Fe={class:"main-container"},$e={class:"flex justify-between items-center"},Ne={class:"text-page-title"},Be={key:0,class:"mt-[20px]"},Ue=v("span",{class:"!text-[14px]"},"检测到PHP未安装ImageMagick扩展,需安装后才能使用海报功能",-1),Re={key:0,class:"text-primary"},Se={key:1},ze={class:"mt-[16px] flex justify-end"},Ie={class:"dialog-footer"},Le={key:0},Me=["src"],mt=te({__name:"list",setup(je){const $=ae(),A=le().meta.title,b=F({}),c=F({name:"",type:""}),G=oe(()=>({name:[{required:!0,message:a("posterNamePlaceholder"),trigger:"blur"}],type:[{required:!0,message:a("posterTypePlaceholder"),trigger:"blur"}]})),N=y(),k=y(!1),J=async n=>{n&&await n.validate(async e=>{if(e){const u={type:c.type,name:c.name},D=$.resolve({path:"/poster/edit",query:u});window.open(D.href),k.value=!1,c.name="",c.type=""}})};(()=>{we({}).then(n=>{for(const e in b)delete b[e];for(const e in n.data)b[e]=n.data[e]})})();const r=F({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{name:"",type:""}}),B=y(),f=(n=1)=>{r.loading=!0,r.page=n,xe({page:r.page,limit:r.limit,...r.searchParam}).then(e=>{r.loading=!1,r.data=e.data.data,r.total=e.data.total,ne(r.page,r.limit,r.searchParam)}).catch(()=>{r.loading=!1})};f(x(r.searchParam).page);const O=n=>{const e=$.resolve({path:"/poster/edit",query:{id:n.id}});window.open(e.href)},d=y(!1),U=(n,e)=>{d.value||(d.value=!0,Ce({id:n,status:e}).then(u=>{f(x(r.searchParam).page),d.value=!1}))},X=n=>{d.value||(d.value=!0,Te({id:n}).then(e=>{f(x(r.searchParam).page),d.value=!1}))},K=n=>{ie.confirm(a("diyPosterDeleteTips"),a("warning"),{confirmButtonText:a("confirm"),cancelButtonText:a("cancel"),type:"warning"}).then(()=>{d.value||(d.value=!0,Ve(n).then(()=>{f(x(r.searchParam).page),d.value=!1}).catch(()=>{d.value=!1}))})},T=y(!1),V=y(""),Q=n=>{d.value||(d.value=!0,De({id:n.id,type:n.type}).then(e=>{e.data&&(V.value=e.data,T.value=!0),d.value=!1}))},W=n=>{n&&(n.resetFields(),f())},R=y(!0);return(()=>{Ee().then(n=>{R.value=n.data})})(),(n,e)=>{const u=pe,D=de,S=ue,P=me,E=ce,z=fe,I=ye,L=_e,h=ge,M=ve,Y=he,Z=be,j=ke,ee=Pe;return p(),_("div",Fe,[o(L,{class:"box-card !border-none",shadow:"never"},{default:s(()=>[v("div",$e,[v("span",Ne,i(l(A)),1),o(u,{type:"primary",class:"w-[100px]",onClick:e[0]||(e[0]=t=>k.value=!0)},{default:s(()=>[m(i(l(a)("添加海报")),1)]),_:1})]),!R.value&&!r.loading?(p(),_("div",Be,[o(D,{type:"warning","show-icon":"",closable:!1},{title:s(()=>[Ue]),_:1})])):C("",!0),o(L,{class:"box-card !border-none my-[10px] table-search-wrap",shadow:"never"},{default:s(()=>[o(I,{inline:!0,model:r.searchParam,ref_key:"searchFormDiyPosterRef",ref:B},{default:s(()=>[o(P,{label:l(a)("posterName"),prop:"name"},{default:s(()=>[o(S,{modelValue:r.searchParam.name,"onUpdate:modelValue":e[1]||(e[1]=t=>r.searchParam.name=t),modelModifiers:{trim:!0},placeholder:l(a)("posterNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(P,{label:l(a)("posterType"),prop:"type"},{default:s(()=>[o(z,{modelValue:r.searchParam.type,"onUpdate:modelValue":e[2]||(e[2]=t=>r.searchParam.type=t),placeholder:l(a)("posterTypePlaceholder")},{default:s(()=>[o(E,{label:l(a)("all"),value:""},null,8,["label"]),(p(!0),_(q,null,H(b,t=>(p(),g(E,{label:t.name,value:t.type,key:t.type},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o(P,null,{default:s(()=>[o(u,{type:"primary",onClick:e[3]||(e[3]=t=>f())},{default:s(()=>[m(i(l(a)("search")),1)]),_:1}),o(u,{onClick:e[4]||(e[4]=t=>W(B.value))},{default:s(()=>[m(i(l(a)("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),se((p(),g(Y,{data:r.data,size:"large"},{empty:s(()=>[v("span",null,i(r.loading?"":l(a)("emptyData")),1)]),default:s(()=>[o(h,{prop:"name",label:l(a)("posterName"),"min-width":"120"},null,8,["label"]),o(h,{prop:"type_name",label:l(a)("posterType"),"min-width":"80"},null,8,["label"]),o(h,{label:l(a)("status"),"min-width":"80"},{default:s(({row:t})=>[t.status==1?(p(),g(M,{key:0,type:"success",onClick:w=>U(t.id,0),class:"cursor-pointer"},{default:s(()=>[m(i(l(a)("启用")),1)]),_:2},1032,["onClick"])):(p(),g(M,{key:1,type:"info",onClick:w=>U(t.id,1),class:"cursor-pointer"},{default:s(()=>[m(i(l(a)("未启用")),1)]),_:2},1032,["onClick"]))]),_:1},8,["label"]),o(h,{label:l(a)("isDefault"),"min-width":"80"},{default:s(({row:t})=>[t.is_default==1?(p(),_("span",Re,i(l(a)("defaultPoster")),1)):(p(),_("span",Se,i(l(a)("noDefault")),1))]),_:1},8,["label"]),o(h,{prop:"update_time",label:l(a)("updateTime"),"min-width":"120"},null,8,["label"]),o(h,{label:l(a)("operation"),fixed:"right",align:"right","min-width":"160"},{default:s(({row:t})=>[o(u,{type:"primary",link:"",onClick:w=>Q(t)},{default:s(()=>[m(i(l(a)("preview")),1)]),_:2},1032,["onClick"]),t.is_default==0?(p(),g(u,{key:0,type:"primary",link:"",onClick:w=>X(t.id)},{default:s(()=>[m(i(l(a)("modifyDefault")),1)]),_:2},1032,["onClick"])):C("",!0),o(u,{type:"primary",link:"",onClick:w=>O(t)},{default:s(()=>[m(i(l(a)("edit")),1)]),_:2},1032,["onClick"]),t.is_default==0?(p(),g(u,{key:1,type:"primary",link:"",onClick:w=>K(t.id)},{default:s(()=>[m(i(l(a)("delete")),1)]),_:2},1032,["onClick"])):C("",!0)]),_:1},8,["label"])]),_:1},8,["data"])),[[ee,r.loading]]),v("div",ze,[o(Z,{"current-page":r.page,"onUpdate:current-page":e[5]||(e[5]=t=>r.page=t),"page-size":r.limit,"onUpdate:page-size":e[6]||(e[6]=t=>r.limit=t),layout:"total, sizes, prev, pager, next, jumper",total:r.total,onSizeChange:e[7]||(e[7]=t=>f()),onCurrentChange:f},null,8,["current-page","page-size","total"])])]),_:1}),o(j,{modelValue:k.value,"onUpdate:modelValue":e[12]||(e[12]=t=>k.value=t),title:l(a)("addPosterTitle"),width:"350px","destroy-on-close":"true"},{footer:s(()=>[v("span",Ie,[o(u,{onClick:e[10]||(e[10]=t=>k.value=!1)},{default:s(()=>[m(i(l(a)("cancel")),1)]),_:1}),o(u,{type:"primary",onClick:e[11]||(e[11]=t=>J(N.value))},{default:s(()=>[m(i(l(a)("confirm")),1)]),_:1})])]),default:s(()=>[o(I,{model:c,"label-width":"90px",ref_key:"formRef",ref:N,rules:l(G)},{default:s(()=>[o(P,{label:l(a)("posterName"),prop:"name"},{default:s(()=>[o(S,{modelValue:c.name,"onUpdate:modelValue":e[8]||(e[8]=t=>c.name=t),modelModifiers:{trim:!0},placeholder:l(a)("posterNamePlaceholder"),clearable:"",maxlength:"12","show-word-limit":"",class:"w-full"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(P,{label:l(a)("posterType"),prop:"type"},{default:s(()=>[o(z,{modelValue:c.type,"onUpdate:modelValue":e[9]||(e[9]=t=>c.type=t),placeholder:l(a)("posterTypePlaceholder"),class:"!w-full"},{default:s(()=>[(p(!0),_(q,null,H(b,t=>(p(),g(E,{label:t.name,value:t.type,key:t.type},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"]),o(j,{modelValue:T.value,"onUpdate:modelValue":e[13]||(e[13]=t=>T.value=t),title:l(a)("previewDialogTitle"),width:"400px",height:"640px"},{default:s(()=>[V.value?(p(),_("div",Le,[v("img",{src:l(re)(V.value),class:"w-[360px] h-[640px]"},null,8,Me)])):C("",!0)]),_:1},8,["modelValue","title"])])}}});export{mt as default};
|