"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[986],{4924:function(e,s,t){var n=t(8870),a=t(1212),i=t(467),o=t(5544),c=t(6540),r=t(758),l=t.n(r),u=t(118),d=t(374),p=t(3401),h=t(2978),v=t(4149),_=t(5313),m=t(4848),x={public:"\u516c\u5f00",friends:"\u6c6a\u53cb\u53ef\u89c1",private:"\u4ec5\u81ea\u5df1"};function b(){var e=(0,d.v)(),s=e.statusBarHeight,t=e.safeBottom,n=(0,r.useRouter)(),b=n.params.postId||"",f=(0,_.bI)(b),j=(0,c.useState)((null===f||void 0===f?void 0:f.body)||""),w=(0,o.A)(j,2),N=w[0],S=w[1],g=(0,c.useState)((null===f||void 0===f?void 0:f.visibility)||"public"),k=(0,o.A)(g,2),A=k[0],y=k[1],C=(0,c.useState)(!1),B=(0,o.A)(C,2),E=B[0],T=B[1],Y=(0,c.useState)(!1),I=(0,o.A)(Y,2),M=I[0],z=I[1];(0,c.useEffect)(function(){!f&&b&&(0,v.aC)(b).then(function(e){var s=e.post;s&&(S(s.body||""),y(s.visibility||"public"))}).catch(function(){})},[]);var H=N.trim().length,J=H>0&&H<=2e3,O=function(){var e=(0,i.A)((0,a.A)().m(function e(){return(0,a.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!M){e.n=1;break}return e.a(2);case 1:if(J){e.n=2;break}return l().showToast({title:H?"\u6b63\u6587\u6700\u591a 2000 \u5b57":"\u5199\u70b9\u4ec0\u4e48\u5427",icon:"none"}),e.a(2);case 2:return z(!0),e.p=3,e.n=4,(0,v.gg)(b,{content:N.trim(),visibility:A});case 4:l().showToast({title:"\u5df2\u4fdd\u5b58",icon:"success"}),setTimeout(function(){return l().navigateBack()},500),e.n=6;break;case 5:e.p=5,e.v,l().showToast({title:"\u4fdd\u5b58\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 6:return e.p=6,z(!1),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}));return function(){return e.apply(this,arguments)}}();return(0,m.jsxs)(u.Ss,{className:"post-edit",children:[(0,m.jsx)(u.Ss,{className:"post-edit__nav",style:{paddingTop:"".concat(s,"px")},children:(0,m.jsxs)(u.Ss,{className:"post-edit__nav-row",children:[(0,m.jsx)(u.Ss,{className:"post-edit__close",onClick:function(){return l().navigateBack()},children:(0,m.jsx)(p.A,{name:"close",size:22})}),(0,m.jsx)(u.EY,{className:"post-edit__nav-title",children:"\u7f16\u8f91\u52a8\u6001"}),(0,m.jsx)(u.Ss,{className:"post-edit__nav-spacer"})]})}),(0,m.jsxs)(u.BM,{scrollY:!0,className:"post-edit__body",enhanced:!0,showScrollbar:!1,children:[(0,m.jsx)(u.TM,{className:"post-edit__textarea",value:N,placeholder:"\u8bf4\u70b9\u4ec0\u4e48\u2026",placeholderClass:"post-edit__placeholder",maxlength:2e3,autoHeight:!0,onInput:function(e){return S(e.detail.value)}}),(0,m.jsxs)(u.EY,{className:"post-edit__count",children:[H,"/2000"]}),(0,m.jsxs)(u.Ss,{className:"post-edit__row",onClick:function(){return T(!0)},children:[(0,m.jsx)(u.EY,{className:"post-edit__row-label",children:"\u53ef\u89c1\u8303\u56f4"}),(0,m.jsxs)(u.Ss,{className:"post-edit__row-value",children:[(0,m.jsx)(u.EY,{children:x[A]}),(0,m.jsx)(p.A,{name:"chev",size:16})]})]}),(0,m.jsx)(u.EY,{className:"post-edit__hint",children:"\u6b64\u5904\u4ec5\u7f16\u8f91\u6587\u5b57\u4e0e\u53ef\u89c1\u8303\u56f4\uff1b\u5982\u9700\u4fee\u6539\u56fe\u7247\u6216\u8bdd\u9898\uff0c\u8bf7\u5220\u9664\u540e\u91cd\u65b0\u53d1\u5e03\u3002"})]}),(0,m.jsx)(u.Ss,{className:"post-edit__footer",style:{paddingBottom:"".concat(Math.max(16,t),"px")},children:(0,m.jsx)(u.Ss,{className:"post-edit__submit ".concat(J&&!M?"":"post-edit__submit--disabled"),onClick:O,children:M?"\u4fdd\u5b58\u4e2d\u2026":"\u4fdd\u5b58"})}),(0,m.jsx)(h.A,{visible:E,value:A,onChange:y,onClose:function(){return T(!1)}})]})}var f={},j=(0,n.eU)(b,"pages/post-edit/index",{root:{cn:[]}},f||{});b&&b.behaviors&&(j.behaviors=(j.behaviors||[]).concat(b.behaviors));Page(j)}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(4924)});e.O()}]);