import{j as e,a as l,G as a,N as s,o,e as t,f as r,g as u,w as d,I as i,r as m,c as n,q as c,h as f,p,i as _}from"./vendor.08ecc2ea.js";import{b,c as g,e as v}from"./slider.8d6ffbe7.js";import{_ as h}from"./index.4567af67.js";import"./request.33748d8c.js";const V={name:"slider-add",setup(){const o=e(),t=l([]),r=l({url:"127.0.0.1",sort:"100"}),u=a(null),d=()=>{o.query.id&&b(o.query).then((e=>{200==e.status?(console.log(e.msg),Object.keys(e.data).forEach((l=>{r[l]=e.data[l]}))):(Object.keys(r).forEach((e=>{r[e]=""})),i.error(e.msg))})),u.value=g(),console.log(u)};d(),s((()=>o.query.id),((e,l)=>{d()}),{deep:!0});const m=a(null),n=()=>{m.value.resetFields()};return{handleSuccess:(e,l)=>{r.img_url=e.data.img_url,r.name=l.name,console.log(l.name)},options:t,rules:{title:[{required:!0,message:"请输入广告标题",trigger:"blur"}]},formRef:m,form:r,onSubmit:()=>{m.value.validate((e=>{if(!e)return!1;v(r).then((e=>{200==e.status?i.success(e.msg):i.error(e.msg)})),n()}))},onReset:n,dataPath:u}}},y=e=>(p("data-v-42e27d3e"),e=e(),_(),e),j={class:"crumbs"},k=y((()=>r("i",{class:"el-icon-lx-sort"},null,-1))),q=f(" 新增广告 "),x={class:"container"},w={class:"form-box"},C=y((()=>r("i",{class:"el-icon-upload"},null,-1))),R=y((()=>r("div",{class:"el-upload__text"},[f(" 将文件拖到此处，或 "),r("em",null,"点击上传")],-1))),S=y((()=>r("div",{class:"el-upload__tip"},"只能上传 jpg/png 文件，且不超过 500kb",-1))),U=f("禁用"),E=f("启用"),I=f("提交"),O=f("重置");var P=h(V,[["render",function(e,l,a,s,i,f){const p=m("el-breadcrumb-item"),_=m("el-breadcrumb"),b=m("el-input"),g=m("el-form-item"),v=m("el-image"),h=m("el-upload"),V=m("el-radio"),y=m("el-radio-group"),P=m("el-button"),z=m("el-form");return o(),t("div",null,[r("div",j,[u(_,{separator:"/"},{default:d((()=>[u(p,null,{default:d((()=>[k,q])),_:1})])),_:1})]),r("div",x,[r("div",w,[u(z,{ref:"formRef",rules:s.rules,model:s.form,"label-width":"auto"},{default:d((()=>[u(g,{label:"广告标题",prop:"title"},{default:d((()=>[u(b,{modelValue:s.form.title,"onUpdate:modelValue":l[0]||(l[0]=e=>s.form.title=e),placeholder:"请输入广告标题"},null,8,["modelValue"])])),_:1}),u(g,{label:"链接地址",prop:"url"},{default:d((()=>[u(b,{modelValue:s.form.url,"onUpdate:modelValue":l[1]||(l[1]=e=>s.form.url=e),placeholder:"请输入链接地址"},null,8,["modelValue"])])),_:1}),u(g,{label:"广告排序",prop:"sort"},{default:d((()=>[u(b,{modelValue:s.form.sort,"onUpdate:modelValue":l[2]||(l[2]=e=>s.form.sort=e),placeholder:"请输入排序数字"},null,8,["modelValue"])])),_:1}),u(g,{label:"图片预览",prop:"sort"},{default:d((()=>[s.form.img_url?(o(),n(v,{key:0,class:"table-td-thumb",fit:"contain",lazy:"true",src:s.form.img_url,"preview-src-list":[s.form.img_url]},null,8,["src","preview-src-list"])):c("",!0)])),_:1}),u(g,{label:"长传图片",prop:"img_url"},{default:d((()=>[u(h,{class:"upload-demo",drag:"",action:s.dataPath,multiple:"","file-list":e.filelist,"on-success":s.handleSuccess},{tip:d((()=>[S])),default:d((()=>[C,R])),_:1},8,["action","file-list","on-success"])])),_:1}),u(g,{label:"状态",prop:"status"},{default:d((()=>[u(y,{modelValue:s.form.status,"onUpdate:modelValue":l[3]||(l[3]=e=>s.form.status=e)},{default:d((()=>[u(V,{label:0},{default:d((()=>[U])),_:1}),u(V,{label:1},{default:d((()=>[E])),_:1})])),_:1},8,["modelValue"])])),_:1}),u(g,null,{default:d((()=>[u(P,{type:"primary",onClick:s.onSubmit},{default:d((()=>[I])),_:1},8,["onClick"]),u(P,{onClick:s.onReset},{default:d((()=>[O])),_:1},8,["onClick"])])),_:1})])),_:1},8,["rules","model"])])])])}],["__scopeId","data-v-42e27d3e"]]);export{P as default};
