You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/Home-cb5e314d.js

2 lines
20 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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