import{ak as c,al as T,a as L,r as i,W as P,b as m,a7 as S,Z as Y,c as y,j as V,h as o,f as u,u as D,m as H,x,l as W,am as X}from"./index.4d061c66.js";import{r as k}from"./responseHandle.fe68d5aa.js";import{u as Z}from"./useNav.5e73c372.js";import{I as z}from"./image.e35d846c.js";const{VITE_PROXY_DOMAIN_REAL:p}=T();async function G(n){return c.request("post",`${p}admin/videoAdd`,{data:n})}async function le(n){return c.request("post",`${p}admin/videoDelete`,{data:n})}async function J(n){return c.request("post",`${p}admin/videoEdit`,{data:n})}async function oe(n){return c.request("post",`${p}admin/videoChange`,{data:n})}async function K(n){return c.request("post",`${p}admin/videoRead`,{data:n})}async function ne(n){return c.request("post",`${p}admin/videoList`,{data:n})}const Q={class:"flex justify-end"},re=L({__name:"edit-dialog",emits:["reload"],setup(n,{expose:B,emit:q}){const{logout:b}=Z(),f=i(!1),A=i(""),s=i("create"),h=i(null),v=i(!1),_=i(""),E=i(""),F={video_img:"",video_name:"",id:"",video_url:"",remark:""},a=i({...F}),I=P({video_img:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u5C01\u9762\u56FE"}],video_name:[{required:!0,trigger:"bulr",message:"\u8BF7\u8F93\u5165\u89C6\u9891\u540D\u79F0"}],video_url:[{required:!0,trigger:"bulr",message:"\u8BF7\u8F93\u5165\u89C6\u9891\u94FE\u63A5"},{validator:(r,e,l)=>{e===""?l(new Error("12")):l()}}],remark:[{required:!0,trigger:"bulr",message:"\u8BF7\u8F93\u5165\u89C6\u9891\u63CF\u8FF0"}]}),U=async()=>{const{code:r,data:e,message:l}=await K({id:E.value});k({code:r,message:l,logout:b,handler:()=>{Object.keys(a.value).forEach(t=>{a.value[t]=e[t]?e[t]+"":""})}})};async function $(r,e,l){switch(E.value=e,Object.keys(a.value).forEach(t=>{a.value[t]=F[t]?F[t]+"":""}),s.value=l,s.value){case"create":_.value="\u65B0\u5EFA\u89C6\u9891";break;case"edit":_.value="\u7F16\u8F91\u89C6\u9891";break;case"view":_.value="\u89C6\u9891\u8BE6\u60C5";break;default:_.value="\u65B0\u5EFA\u89C6\u9891"}s.value!=="create"&&await U(),f.value=!0}function j(){return{data:{...a.value},api:J}}function N(){return{data:{...a.value},api:G}}function M(){h.value.validate(async r=>{if(r){if(v.value)return;const e=s.value==="create"?N:j;v.value=!0;const{api:l,data:t}=e(),{message:g,code:C}=await l(t);v.value=!1,k({code:C,message:g,logout:b,handler:()=>{f.value=!1,q("reload")}})}})}return B({show:$,changeCurrentMenuId:r=>A.value=r}),(r,e)=>{const l=m("el-form-item"),t=m("el-col"),g=m("ElInput"),C=m("el-row"),w=m("el-button"),R=m("el-dialog"),O=S("loading");return Y((y(),V(R,{modelValue:f.value,"onUpdate:modelValue":e[5]||(e[5]=d=>f.value=d),"close-on-press-escape":!1,center:"","append-to-body":"","destroy-on-close":"",width:"800px",title:_.value},{default:o(()=>[u(D(X),{ref_key:"formRef",ref:h,model:a.value,rules:I,"label-width":"90px",style:{"margin-top":"-10px"},class:"demo-ruleForm","status-icon":""},{default:o(()=>[u(C,null,{default:o(()=>[u(t,{span:24},{default:o(()=>[u(l,{label:"\u5C01\u9762\u56FE",prop:"video_img"},{default:o(()=>[u(D(z),{url:a.value.video_img,"onUpdate:url":e[0]||(e[0]=d=>a.value.video_img=d),disabled:s.value==="view",descs:["\u5C0F\u4E8E1Mb"],types:["png","jpg","jpeg"]},null,8,["url","disabled"])]),_:1})]),_:1}),u(t,{span:24},{default:o(()=>[u(l,{label:"\u89C6\u9891\u540D\u79F0",prop:"video_name"},{default:o(()=>[u(g,{placeholder:"\u89C6\u9891\u540D\u79F0",disabled:s.value==="view",maxlength:"50",modelValue:a.value.video_name,"onUpdate:modelValue":e[1]||(e[1]=d=>a.value.video_name=d)},null,8,["disabled","modelValue"])]),_:1})]),_:1}),u(t,{span:24},{default:o(()=>[u(l,{label:"\u89C6\u9891\u94FE\u63A5",prop:"video_url"},{default:o(()=>[u(g,{placeholder:"\u89C6\u9891\u94FE\u63A5",disabled:s.value==="view",maxlength:"50",modelValue:a.value.video_url,"onUpdate:modelValue":e[2]||(e[2]=d=>a.value.video_url=d)},null,8,["disabled","modelValue"])]),_:1})]),_:1}),u(t,{span:24},{default:o(()=>[u(l,{label:"\u89C6\u9891\u63CF\u8FF0",prop:"remark"},{default:o(()=>[u(g,{placeholder:"\u89C6\u9891\u63CF\u8FF0",disabled:s.value==="view",type:"textarea",maxlength:"600",modelValue:a.value.remark,"onUpdate:modelValue":e[3]||(e[3]=d=>a.value.remark=d)},null,8,["disabled","modelValue"])]),_:1})]),_:1})]),_:1}),H("div",Q,[s.value!=="view"?(y(),V(w,{key:0,loading:v.value,disabled:v.value,type:"primary",onClick:M},{default:o(()=>[x("\u4FDD\u5B58")]),_:1},8,["loading","disabled"])):W("",!0),u(w,{onClick:e[4]||(e[4]=d=>f.value=!1)},{default:o(()=>[x("\u53D6\u6D88")]),_:1})])]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])),[[O,v.value]])}}});export{re as _,oe as a,ne as b,le as h};
