add-information.1b7df5d9.js 3.0 KB

1
  1. import{d as m,ah as p,ag as f,R as y,r as _,$ as v,m as n,c as t,aj as I,q as s,B as U,o as i}from"./index.332c7f08.js";import{O as g}from"./index.8e2187c0.js";import{a as k}from"./toolsValidate.4388d7ee.js";import{F as r}from"./index.1ed6273e.js";import"./oss-file-upload.e630303f.js";import"./index.ee7951f5.js";import"./ImagePreview.e5b44a77.js";import"./index.1e2dfe6e.js";import"./index.96a8db5e.js";import"./function-call.3db51140.js";import"./index.91135ff9.js";const h="_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 o={addInformation:h,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(C,{emit:b}){const a=p(),c=f(),u=y("\u6DFB\u52A0\u8D44\u8BAF"),e=_({type:"HOT_CONSULTATION",clientType:"SCHOOL",coverImage:null,title:null,linkUrl:"",linkType:"OUT",summary:null}),d=async()=>{if(e.coverImage)if(e.title)if(e.summary)if(e.linkUrl){if(!k(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{a.query.id?await n.post("/api-school/sysNewsInformation/update",{data:{...e,id:a.query.id}}):await n.post("/api-school/sysNewsInformation/save",{data:{...e}}),c.back()}catch{}};return v(async()=>{if(a.query.id){u.value="\u7F16\u8F91\u8D44\u8BAF";const{data:l}=await n.get("/api-school/sysNewsInformation/detail/"+a.query.id);console.log(l),e.linkUrl=l.linkUrl,e.coverImage=l.coverImage,e.summary=l.summary,e.title=l.title}}),()=>t("div",{class:o.addInformation},[t(I,{title:u.value,desotry:!1},null),t("div",{class:o.title},[t("i",{class:[o.icon,o.icon1]},null),s("\u8BF7\u4E0A\u4F20\u5C01\u9762\u56FE\u7247")]),t(g,{class:o.upload,modelValue:e.coverImage,"onUpdate:modelValue":l=>e.coverImage=l},null),t("div",{class:o.title},[t("i",{class:[o.icon,o.icon2]},null),s("\u8D44\u8BAF\u6807\u9898")]),t(r,{placeholder:"\u8BF7\u8F93\u5165\u8D44\u8BAF\u6807\u9898",class:o.field,modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,autofocus:!1},null),t("div",{class:o.title},[t("i",{class:[o.icon,o.icon3]},null),s("\u5185\u5BB9\u7B80\u4ECB")]),t(r,{placeholder:"\u8BF7\u8F93\u5165\u8D44\u8BAF\u5185\u5BB9\u7B80\u8981\u6982\u8FF0",type:"textarea",rows:2,class:o.field,modelValue:e.summary,"onUpdate:modelValue":l=>e.summary=l,autofocus:!1},null),t("div",{class:o.title},[t("i",{class:[o.icon,o.icon4]},null),s("\u6DFB\u52A0\u94FE\u63A5")]),t(r,{placeholder:"\u8BF7\u8F93\u5165\u94FE\u63A5",class:o.field,modelValue:e.linkUrl,"onUpdate:modelValue":l=>e.linkUrl=l},null),t("div",{class:"btnGroup",style:{marginTop:"24px"}},[t(U,{type:"primary",block:!0,round:!0,onClick:d},{default:()=>[a.query.id?"\u786E\u8BA4\u4FEE\u6539":"\u53D1\u5E03\u8D44\u8BAF"]})])])}});export{M as default};