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