import{_ as e}from"./index-7266ee79.js";import{_ as l}from"./myUpload-affaeee3.js";import a from"./videoList-85d0bb30.js";import{d as t,G as s,a5 as u,k as r,p as i,r as o,K as n,o as d,c as m,J as p,f as c,j as f,w as v,a as _,F as b,q as g,e as y,bY as j,s as h,b as V,t as x,Q as w,O as k,_ as q}from"./index-018fb6dd.js";import{h as O}from"./http-338d117f.js";import{o as S}from"./index-981be696.js";/* empty css             *//* empty css                   */function J(e,l){return O.post(`/operation/banner/editStatus/${e}`,l)}function U(e,l){return O.post(`/operation/banner/del/${e}`,l)}const C={key:0,class:"flex flex-wrap items-center mb-5"},L={class:"flex justify-end"},M=q(t({__name:"create",props:{primary:Object},emits:["close"],setup(t,{emit:q}){const J=t;s(),u();const U=r(!1),M=r(!1);r("");const N=r(),z=r({}),$=r([]),F=()=>{z.value.duanjus=""},I=e=>{z.value.img_url=e},T=e=>{z.value.img_url=""},G=()=>{M.value=!0},H=e=>{z.value.duanjus=e,M.value=!1},K=e=>{z.value,e&&(U.value=!0,e.validate((e=>{var l,a;if(e){const e={title:z.value.title,video_id:null==(l=z.value.duanjus)?void 0:l.id,miniprogram_type:z.value.miniprogram_type,sort:z.value.sort,img_url:z.value.img_url,status:z.value.status};(null==(a=J.primary)?void 0:a.id)?function(e,l){return O.post(`/operation/banner/edit/${e}`,l)}(z.value.id,e).then((e=>{k.success(e.message),q("close")})):function(e){return O.post("/operation/banner/add",e)}(e).then((e=>{k.success(e.message),q("close")})),U.value=!1}else U.value=!1})).then((()=>{})))};return J.primary.id?(z.value=JSON.parse(JSON.stringify(J.primary)),z.value.duanjus=JSON.parse(JSON.stringify(J.primary.videoInfo)),z.value.fileList=[{uid:J.primary.id,url:J.primary.img_url}],J.primary,z.value):z.value.fileList=[],i((()=>{S().then((e=>{$.value=e.data.miniprogramType}))})),(t,s)=>{const u=o("el-option"),r=o("el-select"),i=o("el-form-item"),k=o("el-input"),q=l,O=o("el-icon"),S=o("el-button"),J=o("el-switch"),P=o("el-form"),Q=e,R=n("loading");return d(),m(b,null,[p((d(),f(P,{model:c(z),"label-width":"120px",ref_key:"form",ref:N,class:"pr-4"},{default:v((()=>[_(i,{label:"小程序类型",prop:"miniprogram_type",rules:[{required:!0,message:"选择小程序类型"}],"label-width":"120px"},{default:v((()=>[_(r,{modelValue:c(z).miniprogram_type,"onUpdate:modelValue":s[0]||(s[0]=e=>c(z).miniprogram_type=e),clearable:"",filterable:"",placeholder:"请选择小程序类型"},{default:v((()=>[(d(!0),m(b,null,g(c($),((e,l)=>(d(),f(u,{key:l,label:e.label,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),_(i,{label:"轮播图名称",prop:"title",rules:[{required:!0,message:"轮播图名称必须填写"}],"label-width":"120px"},{default:v((()=>[_(k,{modelValue:c(z).title,"onUpdate:modelValue":s[1]||(s[1]=e=>c(z).title=e),size:"default",clearable:""},null,8,["modelValue"])])),_:1}),_(i,{label:"排序",prop:"sort",rules:[{required:!0,message:"排序必须填写"}],"label-width":"120px"},{default:v((()=>[_(k,{modelValue:c(z).sort,"onUpdate:modelValue":s[2]||(s[2]=e=>c(z).sort=e),modelModifiers:{number:!0},min:"1",type:"number",size:"default",clearable:""},null,8,["modelValue"])])),_:1}),_(i,{label:"封面图",prop:"img_url",rules:[{required:!0,message:"请上传封面图"}]},{default:v((()=>[_(q,{acceptType:".png,.jpg,.jpeg",isCheckMM:!1,isMultiple:!0,onFileRemove:T,onFileSuccess:I,fileList:c(z).fileList,action:"/qiniu/upload/image"},null,8,["fileList"])])),_:1}),_(i,{label:"链接短剧信息",prop:"duanjus",rules:[{required:!1,message:"选择链接短剧信息",trigger:"change"}]},{default:v((()=>{var e,l;return[y("div",null,[(null==(l=null==(e=c(z))?void 0:e.duanjus)?void 0:l.name)?(d(),m("div",C,[_(k,{modelValue:c(z).duanjus.name,"onUpdate:modelValue":s[3]||(s[3]=e=>c(z).duanjus.name=e),disabled:"",placeholder:"短剧名称",style:{width:"200px"},class:"input-with-select"},null,8,["modelValue"]),_(O,{class:"ml-3 cursor-pointer",onClick:F},{default:v((()=>[_(c(j))])),_:1})])):h("",!0),y("div",null,[_(S,{type:"primary",size:"default",onClick:G},{default:v((()=>[V("选择短剧")])),_:1})])])]})),_:1}),_(i,{label:"状态",prop:"status","label-width":"120px",rules:[{required:!0,message:"选择状态"}]},{default:v((()=>[_(J,{modelValue:c(z).status,"onUpdate:modelValue":s[4]||(s[4]=e=>c(z).status=e),"active-value":1,"inactive-value":0},null,8,["modelValue"])])),_:1}),y("div",L,[_(S,{type:"primary",onClick:s[5]||(s[5]=e=>K(c(N)))},{default:v((()=>[V(x(t.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[R,c(U)]]),_(Q,{modelValue:c(M),"onUpdate:modelValue":s[6]||(s[6]=e=>w(M)?M.value=e:null),title:"选择短剧",width:"90%",alignCenter:!0,"destroy-on-close":""},{default:v((()=>[_(a,{onConfirm:H,primary:c(z).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-330e442a"]]),N=Object.freeze(Object.defineProperty({__proto__:null,default:M},Symbol.toStringTag,{value:"Module"}));export{U as a,N as b,M as c,J as o};
