|
|
import{_ as Be,a as Ee}from"./post-item.vue_vue_type_style_index_0_lang-012a0d00.js";import{_ as Ue}from"./post-skeleton-57252170.js";import{d as me,H as i,b as _e,e as p,f as w,bf as B,j as b,k as t,w as n,q as x,Y as k,y as pe,A as P,x as J,F as ue,u as ce,c as de,E as Te}from"./@vue-a481fc63.js";import{u as ge}from"./vuex-44de225f.js";import{l as ve}from"./lodash-e0b37ac3.js";import{g as Ne,a as Ve,c as xe,b as Re,d as Ge,e as Oe,_ as Ye}from"./index-73ce700e.js";import{p as Fe}from"./content-e89d4904.js";import{V as G,P as j}from"./IEnum-a180d93e.js";import{I as Pe,V as qe,A as Le,d as Me,E as Se}from"./@vicons-9939c40b.js";import{o as fe,v as Ke,j as Qe,e as We,w as je,x as He,y as Ze,z as Je,A as Xe,B as $e,C as et,a as he,D as tt,E as at,F as st,G as ot,l as nt,H as lt,I as it,k as rt}from"./naive-ui-d8de3dda.js";import{_ as ut}from"./main-nav.vue_vue_type_style_index_0_lang-b101efde.js";import{b as ct,u as pt}from"./vue-router-e5a2430e.js";import{W as dt}from"./v3-infinite-loading-2c58ec2f.js";import{S as vt}from"./@opentiny-d73a2d67.js";import"./formatTime-4210fcd1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-4ef7d3eb.js";import"./@babel-725317a4.js";import"./toggle-selection-93f4ad84.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./evtd-b614532e.js";import"./@css-render-7124a1a5.js";import"./vooks-6d99783e.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./paopao-video-player-2fe58954.js";import"./vue-1e3b54ec.js";import"./xss-a5544f63.js";import"./cssfilter-af71ba68.js";const mt=H=>{const R=new FileReader,C=r=>["application/zip","application/x-zip","application/octet-stream","application/x-zip-compressed"].includes(r),E=()=>{const r=new Uint8Array(R.result).subarray(0,4);let U="";for(let _=0;_<r.length;_++)U+=r[_].toString(16);switch(U){case"504b0304":case"504b0506":case"504b0708":return C("application/zip");case"504b030414":return C("application/x-zip-compressed");case"504b0508":return C("application/x-zip");case"504b5370":return C("application/octet-stream");default:return!1}};return new Promise((r,U)=>{R.onloadend=()=>{const _=H.type;r(_===""||_==="application/octet-stream"?E():C(_))},R.readAsArrayBuffer(H.slice(0,4))})},_t={key:0,class:"compose-wrap"},gt={class:"compose-line"},ft={class:"compose-user"},ht={class:"compose-line compose-options"},wt={class:"attachment"},yt={class:"submit-wrap"},At={class:"attachment-list-wrap"},kt={key:0,class:"attachment-price-wrap"},bt=b("span",null," 附件价格¥",-1),Ct={key:0,class:"eye-wrap"},zt={key:1,class:"link-wrap"},It={key:1,class:"compose-wrap"},Dt=b("div",{class:"login-wrap"},[b("span",{class:"login-banner"}," 登录后,精彩更多")],-1),Bt={key:0,class:"login-only-wrap"},Et={key:1,class:"login-wrap"},Ut=me({__name:"compose",emits:["post-success"],setup(H,{emit:R}){const C=ge(),E=i([]),r=i(!1),U=i(!1),_=i(!1),V=i(!1),g=i(""),y=i([]),N=i(),q=i(0),f=i("public/image"),c=i([]),v=i([]),D=i([]),z=i([]),O=i(G.FRIEND),Y=i(G.FRIEND),L=[{value:G.PUBLIC,label:"公开"},{value:G.PRIVATE,label:"私密"},{value:G.FRIEND,label:"好友可见"}],M=+"400",S=i("true".toLowerCase()==="true"),F=i("true".toLowerCase()==="true"),Z=i("true".toLowerCase()==="true"),X=i("false".toLowerCase()==="true"),K=i("true".toLowerCase()==="true"),$="/v1/attachment",l=i(),d=()=>{_.value=!_.value,_.value&&V.value&&(V.value=!1)},T=()=>{V.value=!V.value,V.value&&_.value&&(_.value=!1)},A=ve.debounce(e=>{Ne({k:e}).then(a=>{let o=[];a.suggest.map(s=>{o.push({label:s,value:s})}),E.value=o,r.value=!1}).catch(a=>{r.value=!1})},200),I=ve.debounce(e=>{Ve({k:e}).then(a=>{let o=[];a.suggest.map(s=>{o.push({label:s,value:s})}),E.value=o,r.value=!1}).catch(a=>{r.value=!1})},200),ee=(e,a)=>{r.value||(r.value=!0,a==="@"?A(e):I(e))},te=e=>{e.length>M?g.value=e.substring(0,M):g.value=e},Q=e=>{f.value=e},ae=e=>{for(let u=0;u<e.length;u++){var a=e[u].name,o=a.split(".").slice(0,-1).join("."),s=a.split(".").pop();o.length>30&&(e[u].name=o.substring(0,18)+"..."+o.substring(o.length-9)+"."+s)}c.value=e},se=async e=>{var a,o,s,u,h;return f.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((a=e.file.file)==null?void 0:a.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):f.value==="image"&&((o=e.file.file)==null?void 0:o.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):f.value==="public/video"&&!["video/mp4","video/quicktime"].includes((s=e.file.file)==null?void 0:s.type)?(window.$message.warning("视频仅允许 mp4/mov 格式"),!1):f.value==="public/video"&&((u=e.file.file)==null?void 0:u.size)>104857600?(window.$message.warning("视频大小不能超过100MB"),!1):f.value==="attachment"&&!await mt(e.file.file)?(window.$message.warning("附件仅允许 zip 格式"),!1):f.value==="attachment"&&((h=e.file.file)==null?void 0:h.size)>104857600?(window.$message.warning("附件大小不能超过100MB"),!1):!0},oe=({file:e,event:a})=>{var o;try{let s=JSON.parse((o=a.target)==null?void 0:o.response);s.code===0&&(f.value==="public/image"&&v.value.push({id:e.id,content:s.data.content}),f.value==="public/video"&&D.value.push({id:e.id,content:s.data.content}),f.value==="attachment"&&z.value.push({id:e.id,content:s.data.content}))}catch{window.$message.error("上传失败")}},ne=({file:e,event:a})=>{var o;try{let s=JSON.parse((o=a.target)==null?void 0:o.response);if(s.code!==0){let u=s.msg||"上传失败";s.details&&s.details.length>0&&s.details.map(h=>{u+=":"+h}),window.$message.error(u)}}catch{window.$message.error("上传失败")}},le=({file:e})=>{let a=v.value.findIndex(o=>o.id===e.id);a>-1&&v.value.splice(a,1),a=D.value.findIndex(o=>o.id===e.id),a>-1&&D.value.splice(a,1),a=z.value.findIndex(o=>o.id===e.id),a>-1&&z.value.splice(a,1)},ie=()=>{if(g.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{tags:e,users:a}=Fe(g.value);const o=[];let s=100;o.push({content:g.value,type:j.TEXT,sort:s}),v.value.map(u=>{s++,o.push({content:u.content,type:j.IMAGEURL,sort:s})}),D.value.map(u=>{s++,o.push({content:u.content,type:j.VIDEOURL,sort:s})}),z.value.map(u=>{s++,o.push({content:u.content,type:j.ATTACHMENT,sort:s})}),y.value.length>0&&y.value.map(u=>{s++,o.push({content:u,type:j.LINKURL,sort:s})}),U.value=!0,xe({contents:o,tags:Array.from(new Set(e)),users:Array.from(new Set(a)),attachment_price:+q.value*100,visibility:O.value}).then(u=>{var h;window.$message.success("发布成功"),U.value=!1,R("post-success",u),_.value=!1,V.value=!1,(h=N.value)==null||h.clear(),c.value=[],g.value="",y.value=[],v.value=[],D.value=[],z.value=[],O.value=Y.value}).catch(u=>{U.value=!1})},W=e=>{C.commit("triggerAuth",!0),C.commit("triggerAuthKey",e)};return _e(()=>{"friend".toLowerCase()==="friend"?Y.value=G.FRIEND:"friend".toLowerCase()==="public"?Y.value=G.PUBLIC:Y.value=G.PRIVATE,O.value=Y.value,l.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(e,a)=>{const o=fe,s=Ke,u=Qe,h=We,re=je,we=He,ye=Ze,Ae=Je,ke=Xe,be=$e,Ce=et,ze=he,Ie=tt,De=at;return p(),w("div",null,[B(C).state.userInfo.id>0?(p(),w("div",_t,[b("div",gt,[b("div",ft,[t(o,{round:"",size:30,src:B(C).state.userInfo.avatar},null,8,["src"])]),t(s,{type:"textarea",size:"large",autosize:"",bordered:!1,loading:r.value,value:g.value,prefix:["@","#"],options:E.value,onSearch:ee,"onUpdate:value":te,placeholder:"说说您的新鲜事..."},null,8,["loading","value","options"])]),t(be,{ref_key:"uploadRef",ref:N,abstract:"","list-type":"image",multiple:!0,max:9,action:$,headers:{Authorization:l.value},data:{type:f.value},"file-list":c.value,onBeforeUpload:se,onFinish:oe,onError:ne,onRemove:le,"onUpdate:fileList":ae},{default:n(()=>[b("div",ht,[b("div",wt,[t(re,{abstract:""},{default:n(({handleClick:m})=>[t(h,{disabled:c.value.length>0&&f.value==="public/video"||c.value.length===9,onClick:()=>{Q("public/image"),m()},quaternary:"",circle:"",type:"primary"},{icon:n(()=>[t(u,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(B(Pe))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),F.value?(p(),x(re,{key:0,abstract:""},{default:n(({handleClick:m})=>[t(h,{disabled:c.value.length>0&&f.value!=="public/video"||c.value.length===9,onClick:()=>{Q("public/video"),m()},quaternary:"",circle:"",type:"primary"},{icon:n(()=>[t(u,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(B(qe))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):k("",!0),Z.value?(p(),x(re,{key:1,abstract:""},{default:n(({handleClick:m})=>[t(h,{disabled:c.value.length>0&&f.value==="public/video"||c.value.length===9,onClick:()=>{Q("attachment"),m()},quaternary:"",circle:"",type:"primary"},{icon:n(()=>[t(u,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(B(Le))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):k("",!0),t(h,{quaternary:"",circle:"",type:"primary",onClick:pe(d,["stop"])},{icon:n(()=>[t(u,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(B(Me))]),_:1})]),_:1},8,["onClick"]),K.value?(p(),x(h,{key:2,quaternary:"",circle:"",type:"primary",onClick:pe(T,["stop"])},{icon:n(()=>[t(u,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(B(Se))]),_:1})]),_:1},8,["onClick"])):k("",!0)]),b("div",yt,[t(ye,{trigger:"hover",placement:"bottom"},{trigger:n(()=>[t(we,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:g.value.length/B(M)*100},null,8,["percentage"])]),default:n(()=>[P(" "+J(g.value.length)+" / "+J(B(M)),1)]),_:1}),t(h,{loading:U.value,onClick:ie,type:"primary",secondary:"",round:""},{default:n(()=>[P(" 发布 ")]),_:1},8,["loading"])])]),b("div",At,[t(Ae),z.value.length>0?(p(),w("div",kt,[X.value?(p(),x(ke,{key:0,value:q.value,"onUpdate:value":a[0]||(a[0]=m=>q.value=m),min:0,max:1e5,placeholder:"请输入附件价格,0为免费附件"},{prefix:n(()=>[bt]),_:1},8,["value"])):k("",!0)])):k("",!0)])]),_:1},8,["headers","data","file-list"]),V.value?(p(),w("div",Ct,[t(Ie,{value:O.value,"onUpdate:value":a[1]||(a[1]=m=>O.value=m),name:"radiogroup"},{default:n(()=>[t(ze,null,{default:n(()=>[(p(),w(ue,null,ce(L,m=>t(Ce,{key:m.value,value:m.value,label:m.label},null,8,["value","label"])),64))]),_:1})]),_:1},8,["value"])])):k("",!0),_.value?(p(),w("div",zt,[t(De,{value:y.value,"onUpdate:value":a[2]||(a[2]=m=>y.value=m),placeholder:"请输入以http(s)://开头的链接",min:0,max:3},{"create-button-default":n(()=>[P(" 创建链接 ")]),_:1},8,["value"])])):k("",!0)])):(p(),w("div",It,[Dt,S.value?k("",!0):(p(),w("div",Bt,[t(h,{strong:"",secondary:"",round:"",type:"primary",onClick:a[3]||(a[3]=m=>W("signin"))},{default:n(()=>[P(" 登录 ")]),_:1})])),S.value?(p(),w("div",Et,[t(h,{strong:"",secondary:"",round:"",type:"primary",onClick:a[4]||(a[4]=m=>W("signin"))},{default:n(()=>[P(" 登录 ")]),_:1}),t(h,{strong:"",secondary:"",round:"",type:"info",onClick:a[5]||(a[5]=m=>W("signup"))},{default:n(()=>[P(" 注册 ")]),_:1})])):k("",!0)]))])}}});const Tt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIW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JDs7sCUrk72+kXduDKsEVjh1wipFjRX9wSDsceYpw9UKWxP4PDuDJDtTrM1k+IKNMYcDqbwLdjzfTdUE74wRsl7GI3Cp/wZOCOtsk3dmqXxnCn1we/JLEU3kZ5ZWVViLmez3g6cko7tkdK9YVoiAWYQyxz8fvQksA/4Kd90HFIWVtTwzzb2sU3O2q0tspwYjjMBi5wCFROZ4zdCPZ9P+zIyG1Msu2Yq2wZH1G30Pos8AG+3dKENrdujMcr0UNda+wuCFAuGFTggNAkCYw2mboIvp5WQzv6HMV3NePzx7GgmwVAO63DTUByW62mNd1mLEb0H/8DkOAXi0+nceAAAAAASUVORK5CYII=",Nt={class:"slide-bar-item"},Vt={class:"slide-bar-item-title slide-bar-user-link"},xt={key:1,class:"skeleton-wrap"},Rt={key:0,class:"empty-wrap"},Gt={key:1},Ot={key:2},Yt={class:"load-more-wrap"},Ft={class:"load-more-spinner"},Pt=me({__name:"Home",setup(H){const R="true".toLowerCase()==="true",C="true".toLowerCase()==="true",E=ge(),r=ct(),U=pt(),_=i(9),V=i(8),g=i([{title:"全部动态",style:1,username:"",avatar:Tt,show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0},{title:"",style:1,username:"",avatar:"",show:!0}]),y=i(!1),N=i(!1),q=i(1),f=i(""),c=i([]),v=i(1),D=i(20),z=i(0),O=de(()=>{let l="泡泡广场";return r.query&&r.query.q&&(r.query.t&&r.query.t==="tag"?l="#"+decodeURIComponent(r.query.q):l="搜索: "+decodeURIComponent(r.query.q)),l}),Y=de(()=>R&&C&&E.state.desktopModelShow&&E.state.userInfo.id>0),L=()=>{y.value=!1,N.value=!1,c.value=[],v.value=1,z.value=0},M=(l,d)=>{switch(L(),q.value=l.style,l.style){case 1:F();break;case 2:F();break;case 21:f.value=l.username,Z();break}g.value[d].show=!1},S=()=>{!R||!C||E.state.userInfo.id===0||(g.value=g.value.slice(0,1),Re({page:1,page_size:50}).then(l=>{var d=0;const T=l.list||[];let A=[];for(;d<T.length;d++){let I=T[d];A.push({title:I.nickname,style:21,username:I.username,avatar:I.avatar,show:!1})}A.length>0&&(g.value=g.value.concat(A))}).catch(l=>{console.log(l)}))},F=()=>{y.value=!0,Ge({query:r.query.q?decodeURIComponent(r.query.q):null,type:r.query.t,page:v.value,page_size:D.value}).then(l=>{y.value=!1,l.list.length===0&&(N.value=!0),v.value>1?c.value=c.value.concat(l.list):(c.value=l.list,window.scrollTo(0,0)),z.value=Math.ceil(l.pager.total_rows/D.value)}).catch(l=>{y.value=!1,v.value>1&&v.value--})},Z=()=>{y.value=!0,Oe({username:f.value,style:"post",page:v.value,page_size:D.value}).then(l=>{y.value=!1,l.list.length===0&&(N.value=!0),v.value>1?c.value=c.value.concat(l.list):(c.value=l.list||[],window.scrollTo(0,0)),z.value=Math.ceil(l.pager.total_rows/D.value)}).catch(l=>{c.value=[],v.value>1&&v.value--,y.value=!1})},X=l=>{if(v.value!=1){U.push({name:"post",query:{id:l.id}});return}let d=[],T=c.value.length;T==D.value&&T--;for(var A=0;A<T;A++){let I=c.value[A];if(!I.is_top)break;d.push(I)}for(d.push(l);A<T;A++)d.push(c.value[A]);c.value=d},K=()=>{switch(q.value){case 1:F();break;case 2:F();break;case 21:Z();break}},$=()=>{v.value<z.value||z.value==0?(N.value=!1,v.value++,K()):N.value=!0};return _e(()=>{L(),S(),F()}),Te(()=>({path:r.path,query:r.query,refresh:E.state.refresh}),(l,d)=>{if(l.refresh!==d.refresh){L(),setTimeout(()=>{S(),K()},0);return}d.path!=="/post"&&l.path==="/"&&(L(),setTimeout(()=>{S(),K()},0))}),(l,d)=>{const T=ut,A=Ut,I=ot,ee=fe,te=nt,Q=lt,ae=Ue,se=it,oe=Be,ne=Ee,le=st,ie=rt,W=he;return p(),w("div",null,[t(T,{title:O.value},null,8,["title"]),t(le,{class:"main-content-wrap",bordered:""},{default:n(()=>[t(I,null,{default:n(()=>[t(A,{onPostSuccess:X})]),_:1}),Y.value?(p(),x(I,{key:0},{default:n(()=>[t(B(vt),{modelValue:g.value,"onUpdate:modelValue":d[0]||(d[0]=e=>g.value=e),"wheel-blocks":V.value,"init-blocks":_.value,onClick:M,tag:"div","sub-tag":"div"},{default:n(e=>[b("div",Nt,[t(te,{value:"1",offset:[0,48],dot:"",show:e.slotData.show},{default:n(()=>[t(ee,{round:"",size:48,src:e.slotData.avatar,class:"slide-bar-item-avatar"},null,8,["src"])]),_:2},1032,["show"]),b("div",Vt,[t(Q,{"line-clamp":2},{default:n(()=>[P(J(e.slotData.title),1)]),_:2},1024)])])]),_:1},8,["modelValue","wheel-blocks","init-blocks"])]),_:1})):k("",!0),y.value&&c.value.length===0?(p(),w("div",xt,[t(ae,{num:D.value},null,8,["num"])])):k("",!0),b("div",null,[c.value.length===0?(p(),w("div",Rt,[t(se,{size:"large",description:"暂无数据"})])):k("",!0),B(E).state.desktopModelShow?(p(),w("div",Gt,[(p(!0),w(ue,null,ce(c.value,e=>(p(),x(I,{key:e.id},{default:n(()=>[t(oe,{post:e},null,8,["post"])]),_:2},1024))),128))])):(p(),w("div",Ot,[(p(!0),w(ue,null,ce(c.value,e=>(p(),x(I,{key:e.id},{default:n(()=>[t(ne,{post:e},null,8,["post"])]),_:2},1024))),128))]))])]),_:1}),z.value>0?(p(),x(W,{key:0,justify:"center"},{default:n(()=>[t(B(dt),{class:"load-more",slots:{complete:"没有更多泡泡了",error:"加载出错"},onInfinite:d[1]||(d[1]=e=>$())},{spinner:n(()=>[b("div",Yt,[N.value?k("",!0):(p(),x(ie,{key:0,size:14})),b("span",Ft,J(N.value?"没有更多泡泡了":"加载更多"),1)])]),_:1})]),_:1})):k("",!0)])}}});const za=Ye(Pt,[["__scopeId","data-v-abc4c700"]]);export{za as default};
|