import{_ as e}from"./VideoUploader-21753a6d.js";import{e as a}from"./index-a3908905.js";import{d as l,k as s,p as i,r,K as o,J as u,f as d,o as m,j as t,w as n,a as p,e as v,b as _,t as c}from"./index-018fb6dd.js";const f=v("div",{class:"items-center w-full"},[_(" 支持MP4格式 "),v("span",{class:"text-red-400"},"上传文件统一命名格式要求,例：1.mp4; 11.mp4; 333.mp4")],-1),y={class:"w-full"},b={class:"flex justify-end"},g=l({__name:"uploadVideo",props:{primary:String|Number},emits:["close"],setup(l,{emit:g}){const V=l,h=s(),x=s(!1),j=s({videos:[]}),k=s([]),w=e=>{j.value.videos=j.value.videos.filter((a=>a.name!=e.name)),j.value},q=e=>{j.value.videos.push({name:e.fname,duration:parseInt(e.duration),url:e.url,key:e.key}),j.value};return V.primary&&(V.primary,j.value.video_id=V.primary.id,j.value.name=V.primary.name,j.value.total_episode_num=V.primary.total_episode_num,j.value.cover_image=V.primary.cover_image),i((async()=>{})),(l,s)=>{const i=r("el-input"),V=r("el-form-item"),U=e,L=r("el-button"),S=r("el-form"),C=o("loading");return u((m(),t(S,{model:d(j),"label-width":"120px",ref_key:"form",ref:h,class:"pr-4"},{default:n((()=>[p(V,{label:"短剧名称",prop:"name",rules:[{required:!0,message:"短剧名称必须填写"}]},{default:n((()=>[p(i,{disabled:"",modelValue:d(j).name,"onUpdate:modelValue":s[0]||(s[0]=e=>d(j).name=e),name:"name",clearable:""},null,8,["modelValue"])])),_:1}),p(V,{label:"集数",prop:"total_episode_num",rules:[{required:!0,message:"集数必须填写"}]},{default:n((()=>[p(i,{disabled:"",modelValue:d(j).total_episode_num,"onUpdate:modelValue":s[1]||(s[1]=e=>d(j).total_episode_num=e),name:"author",clearable:""},null,8,["modelValue"])])),_:1}),p(V,{label:"上传",prop:"videos",rules:[{required:!0,message:"请上传文件",trigger:"change"}]},{default:n((()=>[f,v("div",y,[p(U,{fileList:d(k),public_video_url:d(j).cover_image,onFileRemove:w,onSuccess:q},null,8,["fileList","public_video_url"])])])),_:1}),v("div",b,[p(L,{type:"primary",onClick:s[2]||(s[2]=e=>{return l=d(h),x.value=!0,j.value,void(l&&l.validate((e=>{if(e){let e={video_id:j.value.video_id,videos:j.value.videos};a(e).then((e=>{x.value=!1,k.value=[],g("close")})).catch((e=>{x.value=!1})),j.value}else x.value=!1})).then((()=>{})));var l})},{default:n((()=>[_(c(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[C,d(x)]])}}});export{g as _};
