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/Messages-95a60791.js

2 lines
7.3 KiB

import{d as w,W as n,Y as t,Z as l,ak as R,aw as q,a4 as a,a5 as r,a8 as $,a9 as p,aa as v,a6 as S,a7 as i,a3 as h,b3 as D,bi as A,bj as P,bk as T,ae as E,bl as H,af as U,al as j,ac as V,ab as z,r as x,a2 as W,ai as Y,bm as Z,$ as G}from"./index-c17d3913.js";import{a as J}from"./formatTime-09781e30.js";import{_ as K}from"./Alert-e0e350bb.js";import{_ as Q}from"./Thing-2157b754.js";import{b as X,a as ee,_ as ne}from"./Skeleton-ca436747.js";import{_ as se}from"./main-nav.vue_vue_type_style_index_0_lang-d6b3b6a4.js";import{_ as te}from"./List-28c5febd.js";import{_ as oe}from"./Pagination-84d10fc7.js";const ae={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},re=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M464 128L240 384l-96-96"},null,-1),le=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M144 384l-96-96"},null,-1),ie=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128L232 284"},null,-1),ce=[re,le,ie],_e=w({name:"CheckmarkDoneOutline",render:function(_,d){return n(),t("svg",ae,ce)}}),de={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ue=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1),me=[ue],pe=w({name:"CheckmarkOutline",render:function(_,d){return n(),t("svg",de,me)}}),ge={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ke=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144"},null,-1),he=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 144L144 368"},null,-1),we=[ke,he],L=w({name:"CloseOutline",render:function(_,d){return n(),t("svg",ge,we)}}),ve={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},fe=l("path",{d:"M336 192h40a40 40 0 0 1 40 40v192a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V232a40 40 0 0 1 40-40h40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),ye=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 128l-80-80l-80 80"},null,-1),xe=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 321V48"},null,-1),$e=[fe,ye,xe],Ce=w({name:"ShareOutline",render:function(_,d){return n(),t("svg",ve,$e)}}),Me={class:"sender-wrap"},be={key:0,class:"nickname"},je={class:"username"},Be={key:1,class:"nickname"},Oe={class:"timestamp"},Le={class:"timestamp-txt"},Se={key:0,class:"brief-content"},Ve={key:1,class:"whisper-content-wrap"},ze={key:2,class:"requesting-friend-wrap"},Fe={key:2,class:"status-info"},Ie={key:3,class:"status-info"},Ne=w({__name:"message-item",props:{message:null},setup(e){const _="https://assets.paopao.info/public/avatar/default/admin.png",d=R(),c=s=>{u(s),(s.type===1||s.type===2||s.type===3)&&(s.post&&s.post.id>0?d.push({name:"post",query:{id:s.post_id}}):window.$message.error("该动态已被删除"))},g=s=>{u(s),A({user_id:s.sender_user_id}).then(o=>{s.reply_id=2,window.$message.success("已同意添加好友")}).catch(o=>{console.log(o)})},f=s=>{u(s),P({user_id:s.sender_user_id}).then(o=>{s.reply_id=3,window.$message.success("已拒绝添加好友")}).catch(o=>{console.log(o)})},u=s=>{s.is_read===0&&T({id:s.id}).then(o=>{s.is_read=1}).catch(o=>{console.log(o)})};return(s,o)=>{const C=E,m=q("router-link"),B=H,k=U,M=K,b=Q;return n(),t("div",{class:D(["message-item",{unread:e.message.is_read===0}]),onClick:o[4]||(o[4]=y=>u(e.message))},[a(b,{"content-indented":""},{avatar:r(()=>[a(C,{round:"",size:30,src:e.message.sender_user.id>0?e.message.sender_user.avatar:_},null,8,["src"])]),header:r(()=>[l("div",Me,[e.message.sender_user.id>0?(n(),t("span",be,[a(m,{onClick:o[0]||(o[0]=$(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.message.sender_user.username}}},{default:r(()=>[p(v(e.message.sender_user.nickname),1)]),_:1},8,["to"]),l("span",je," @"+v(e.message.sender_user.username),1)])):(n(),t("span",Be," 系统 "))])]),"header-extra":r(()=>[l("span",Oe,[e.message.is_read===0?(n(),S(B,{key:0,dot:"",processing:""})):i("",!0),l("span",Le,v(h(J)(e.message.created_on)),1)])]),description:r(()=>[a(M,{"show-icon":!1,class:"brief-wrap",type:e.message.is_read>0?"default":"success"},{default:r(()=>[e.message.type!=4?(n(),t("div",Se,[p(v(e.message.brief)+" ",1),e.message.type===1||e.message.type===2||e.message.type===3?(n(),t("span",{key:0,onClick:o[1]||(o[1]=$(y=>c(e.message),["stop"])),class:"hash-link view-link"},[a(k,null,{default:r(()=>[a(h(Ce))]),_:1}),p(" 查看详情 ")])):i("",!0)])):i("",!0),e.message.type===4?(n(),t("div",Ve,v(e.message.content),1)):i("",!0),e.message.type===5?(n(),t("div",ze,[p(v(e.message.content)+" ",1),e.message.reply_id===1?(n(),t("span",{key:0,onClick:o[2]||(o[2]=$(y=>g(e.message),["stop"])),class:"hash-link view-link"},[a(k,null,{default:r(()=>[a(h(pe))]),_:1}),p(" 同意 ")])):i("",!0),e.message.reply_id===1?(n(),t("span",{key:1,onClick:o[3]||(o[3]=$(y=>f(e.message),["stop"])),class:"hash-link view-link"},[a(k,null,{default:r(()=>[a(h(L))]),_:1}),p(" 拒绝 ")])):i("",!0),e.message.reply_id===2?(n(),t("span",Fe,[a(k,null,{default:r(()=>[a(h(_e))]),_:1}),p(" 已同意 ")])):i("",!0),e.message.reply_id===3?(n(),t("span",Ie,[a(k,null,{default:r(()=>[a(h(L))]),_:1}),p(" 已拒绝 ")])):i("",!0)])):i("",!0)]),_:1},8,["type"])]),_:1})],2)}}});const Re=j(Ne,[["__scopeId","data-v-00f99473"]]),qe={class:"content"},De=w({__name:"message-skeleton",props:{num:{default:1}},setup(e){return(_,d)=>{const c=X;return n(!0),t(z,null,V(new Array(e.num),g=>(n(),t("div",{class:"skeleton-item",key:g},[l("div",qe,[a(c,{text:"",repeat:2}),a(c,{text:"",style:{width:"60%"}})])]))),128)}}});const Ae=j(De,[["__scopeId","data-v-2eda9fa4"]]),Pe={key:0,class:"skeleton-wrap"},Te={key:1},Ee={key:0,class:"empty-wrap"},He={key:0,class:"pagination-wrap"},Ue=w({__name:"Messages",setup(e){const _=Y(),d=G(),c=x(!1),g=x(+_.query.p||1),f=x(10),u=x(0),s=x([]),o=()=>{c.value=!0,Z({page:g.value,page_size:f.value}).then(m=>{c.value=!1,s.value=m.list,u.value=Math.ceil(m.pager.total_rows/f.value)}).catch(m=>{c.value=!1})},C=m=>{g.value=m,o()};return W(()=>{o()}),(m,B)=>{const k=se,M=Ae,b=ee,y=Re,F=ne,I=oe,N=te;return n(),t("div",null,[a(k,{title:"消息"}),a(N,{class:"main-content-wrap messages-wrap",bordered:""},{footer:r(()=>[u.value>1?(n(),t("div",He,[a(I,{page:g.value,"onUpdate:page":C,"page-slot":h(d).state.collapsedRight?5:8,"page-count":u.value},null,8,["page","page-slot","page-count"])])):i("",!0)]),default:r(()=>[c.value?(n(),t("div",Pe,[a(M,{num:f.value},null,8,["num"])])):(n(),t("div",Te,[s.value.length===0?(n(),t("div",Ee,[a(b,{size:"large",description:"暂无数据"})])):i("",!0),(n(!0),t(z,null,V(s.value,O=>(n(),S(F,{key:O.id},{default:r(()=>[a(y,{message:O},null,8,["message"])]),_:2},1024))),128))]))]),_:1})])}}});const en=j(Ue,[["__scopeId","data-v-14709a1d"]]);export{en as default};