import{d as m,ah as p,ag as f,R as y,r as _,$ as v,m as n,c as o,aj as I,q as s,B as U,o as i}from"./index.28bb778f.js";import{O as g}from"./index.18ed6044.js";import{a as h}from"./toolsValidate.4388d7ee.js";import{F as r}from"./index.5332ff88.js";import"./oss-file-upload.a6733202.js";import"./index.e91c4bbc.js";import"./ImagePreview.45ee17fc.js";import"./index.0534ba7c.js";import"./index.7e0a75cb.js";import"./function-call.c1d8444f.js";import"./index.49de14a4.js";const k="_addInformation_fp5d5_1",O="_title_fp5d5_4",T="_icon_fp5d5_12",V="_icon1_fp5d5_18",B="_icon2_fp5d5_22",w="_icon3_fp5d5_26",F="_icon4_fp5d5_30",q="_upload_fp5d5_34",N="_field_fp5d5_39";var t={addInformation:k,title:O,icon:T,icon1:V,icon2:B,icon3:w,icon4:F,upload:q,field:N},M=m({name:"add-information",props:{selectType:{type:String,default:"add"},selectItem:{type:Object,default:{}}},emits:["close","getList"],setup(x,{emit:C}){const l=p(),c=f(),u=y("\u6DFB\u52A0\u8D44\u8BAF"),e=_({type:"HOT_CONSULTATION",clientType:"SCHOOL",coverImage:null,title:null,linkUrl:"",linkType:"OUT",status:!0,summary:null}),d=async()=>{if(e.coverImage)if(e.title)if(e.summary)if(e.linkUrl){if(!h(e.linkUrl)){i("\u94FE\u63A5\u8F93\u5165\u6709\u8BEF");return}}else{i("\u8BF7\u8F93\u5165\u94FE\u63A5");return}else{i("\u8BF7\u8F93\u5165\u5185\u5BB9\u7B80\u4ECB");return}else{i("\u8BF7\u8F93\u5165\u8D44\u8BAF\u6807\u9898");return}else{i("\u8BF7\u4E0A\u4F20\u5C01\u9762\u56FE\u7247");return}try{l.query.id?await n.post("/api-school/sysNewsInformation/update",{data:{...e,id:l.query.id}}):await n.post("/api-school/sysNewsInformation/save",{data:{...e}}),c.back()}catch{}};return v(async()=>{if(l.query.id){u.value="\u7F16\u8F91\u8D44\u8BAF";const{data:a}=await n.get("/api-school/sysNewsInformation/detail/"+l.query.id);e.linkUrl=a.linkUrl,e.coverImage=a.coverImage,e.summary=a.summary,e.title=a.title}}),()=>o("div",{class:t.addInformation},[o(I,{title:u.value,desotry:!1},null),o("div",{class:t.title},[o("i",{class:[t.icon,t.icon1]},null),s("\u8BF7\u4E0A\u4F20\u5C01\u9762\u56FE\u7247")]),o(g,{class:t.upload,modelValue:e.coverImage,"onUpdate:modelValue":a=>e.coverImage=a},null),o("div",{class:t.title},[o("i",{class:[t.icon,t.icon2]},null),s("\u8D44\u8BAF\u6807\u9898")]),o(r,{placeholder:"\u8BF7\u8F93\u5165\u8D44\u8BAF\u6807\u9898",class:t.field,modelValue:e.title,"onUpdate:modelValue":a=>e.title=a,autofocus:!1,maxlength:50},null),o("div",{class:t.title},[o("i",{class:[t.icon,t.icon3]},null),s("\u5185\u5BB9\u7B80\u4ECB")]),o(r,{placeholder:"\u8BF7\u8F93\u5165\u8D44\u8BAF\u5185\u5BB9\u7B80\u8981\u6982\u8FF0",type:"textarea",rows:2,class:t.field,modelValue:e.summary,"onUpdate:modelValue":a=>e.summary=a,autofocus:!1,maxlength:200},null),o("div",{class:t.title},[o("i",{class:[t.icon,t.icon4]},null),s("\u6DFB\u52A0\u94FE\u63A5")]),o(r,{placeholder:"\u8BF7\u8F93\u5165\u94FE\u63A5",class:t.field,modelValue:e.linkUrl,"onUpdate:modelValue":a=>e.linkUrl=a},null),o("div",{class:"btnGroup",style:{marginTop:"24px"}},[o(U,{type:"primary",block:!0,round:!0,onClick:d},{default:()=>[l.query.id?"\u786E\u8BA4\u4FEE\u6539":"\u53D1\u5E03\u8D44\u8BAF"]})])])}});export{M as default};
