import{u as e,e as t,a9 as a,r as s,Q as i,p as n,cv as l,x as o,h as d,w as r,B as u,z as c,o as p,i as _,a as m,cw as f,a0 as h,cx as v,bl as x}from"./index-WeUkftbp.js";import{d as g}from"./index.BcUDVLb2.js";import{c as b}from"./editor.-kp7yMij.js";import{g as j}from"./index.NTbA_2SX.js";import{_ as w}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-nav-bar.cBITQXNK.js";import"./uni-icons.B3nCnuXe.js";/* empty css                                                                  *//* empty css                                                                    *//* empty css                                                              */import"./uni-row.DLutFlIQ.js";const T=w({__name:"create",setup(w){e((e=>({"13639b03":S.value})));const T=t({title:"",content:"",contents:"",tab:"",pid:"",isEdit:!1,defaultTitle:"",isShowTitle:!1,default:{}});a((e=>{e.tab&&(T.tab=e.tab,T.pid=e.pid,e.id?(T.defaultTitle="编辑笔记",T.isShowTitle=!0,T.isEdit=!0,C(e.id)):(T.defaultTitle="创建笔记",T.isShowTitle=!0))}));const y=u(),S=s(0),$=s(!1);i((()=>{n().in(y).select("#input").boundingClientRect((e=>{S.value=Math.floor(e.height)+"px"})).exec()}));const C=e=>{l(e).then((e=>{e.data&&(T.default=e.data,T.title=e.data.title,T.content=e.data.content,T.contents=e.data.content)})).catch((e=>{o.error(e.message)}))},E=e=>{T.contents=e},V=()=>{if(!T.title)return o.error("请输入记事本标题"),!1;if(!T.contents)return o.error("请输入记事本内容"),!1;const e={title:T.title,content:T.contents,pid:T.pid};$.value||(T.isEdit?(e.pid=T.default.pid,Q(T.default.id,e)):L(e))},L=e=>{$.value=!0,f(e).then((e=>{o.success(e.message),$.value=!0,h(`/pages/users/memorandum/index?tab=${T.tab}&id=${T.pid}`)})).catch((e=>{$.value=!1,o.error(e.message)}))},Q=(e,t)=>{$.value=!0,v(e,t).then((e=>{o.success("编辑成功"),$.value=!0,h(`/pages/users/memorandum/index?tab=${T.tab}&id=${T.pid}`)})).catch((e=>{$.value=!1,o.error(e.message)}))};return(e,t)=>{const a=c,s=x;return p(),d(a,{class:"content"},{default:r((()=>[_(a,{class:"cr-position-header"},{default:r((()=>[_(a,{class:"status_bar"}),_(m(g),{"is-right":!0,"is-show-title":T.isShowTitle,"default-title":T.defaultTitle,"right-text":"保存",onHandleClickRight:V},null,8,["is-show-title","default-title"])])),_:1}),_(a,{class:"create-content m10"},{default:r((()=>[_(s,{id:"input",modelValue:T.title,"onUpdate:modelValue":t[0]||(t[0]=e=>T.title=e),class:"input",type:"text","placeholder-class":"input-placeholder",maxlength:32,placeholder:"请输入标题"},null,8,["modelValue"]),_(b,{content:T.content,onSaveContent:E},null,8,["content"])])),_:1}),_(j)])),_:1})}}},[["__scopeId","data-v-81e0452e"]]);export{T as default};
