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