Merge branch 'x/gorm' into x/sqlx

r/paopao-ce-plus
Michael Li 1 year ago
commit d1ad76ca6b
No known key found for this signature in database

@ -14,6 +14,6 @@ type MessageService interface {
GetUnreadCount(userID int64) (int64, error)
GetMessageByID(id int64) (*ms.Message, error)
ReadMessage(message *ms.Message) error
GetMessages(conditions *ms.ConditionsT, offset, limit int) ([]*ms.MessageFormated, error)
GetMessageCount(conditions *ms.ConditionsT) (int64, error)
GetMessages(userId int64, offset, limit int) ([]*ms.MessageFormated, error)
GetMessageCount(userId int64) (int64, error)
}

@ -38,6 +38,7 @@ type MessageFormated struct {
SenderUserID int64 `json:"sender_user_id"`
SenderUser *UserFormated `json:"sender_user"`
ReceiverUserID int64 `json:"receiver_user_id"`
ReceiverUser *UserFormated `json:"receiver_user,omitempty"`
Type MessageT `json:"type"`
Brief string `json:"brief"`
Content string `json:"content"`
@ -61,6 +62,7 @@ func (m *Message) Format() *MessageFormated {
SenderUserID: m.SenderUserID,
SenderUser: &UserFormated{},
ReceiverUserID: m.ReceiverUserID,
ReceiverUser: &UserFormated{},
Type: m.Type,
Brief: m.Brief,
Content: m.Content,
@ -114,39 +116,20 @@ func (m *Message) FetchBy(db *gorm.DB, predicates Predicates) ([]*Message, error
return messages, nil
}
func (c *Message) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*Message, error) {
var messages []*Message
var err error
func (c *Message) List(db *gorm.DB, userId int64, offset, limit int) (res []*Message, err error) {
if offset >= 0 && limit > 0 {
db = db.Offset(offset).Limit(limit)
}
for k, v := range *conditions {
if k == "ORDER" {
db = db.Order(v)
} else {
db = db.Where(k, v)
}
}
if err = db.Where("is_del = ?", 0).Find(&messages).Error; err != nil {
return nil, err
}
return messages, nil
err = db.Where("receiver_user_id=? OR (sender_user_id=? AND type=4)", userId, userId).Order("id DESC").Find(&res).Error
return
}
func (m *Message) Count(db *gorm.DB, conditions *ConditionsT) (int64, error) {
var count int64
for k, v := range *conditions {
if k != "ORDER" {
db = db.Where(k, v)
}
}
if err := db.Model(m).Count(&count).Error; err != nil {
return 0, err
func (m *Message) Count(db *gorm.DB, userId int64) (res int64, err error) {
err = db.Model(m).Where("receiver_user_id=? OR (sender_user_id=? AND type=4)", userId, userId).Count(&res).Error
return
}
return count, nil
func (m *Message) CountUnread(db *gorm.DB, userId int64) (res int64, err error) {
err = db.Model(m).Where("receiver_user_id=? AND is_read=0", userId).Count(&res).Error
return
}

@ -30,10 +30,7 @@ func (s *messageSrv) CreateMessage(msg *ms.Message) (*ms.Message, error) {
}
func (s *messageSrv) GetUnreadCount(userID int64) (int64, error) {
return (&dbr.Message{}).Count(s.db, &dbr.ConditionsT{
"receiver_user_id": userID,
"is_read": dbr.MsgStatusUnread,
})
return (&dbr.Message{}).CountUnread(s.db, userID)
}
func (s *messageSrv) GetMessageByID(id int64) (*ms.Message, error) {
@ -49,21 +46,19 @@ func (s *messageSrv) ReadMessage(message *ms.Message) error {
return message.Update(s.db)
}
func (s *messageSrv) GetMessages(conditions *ms.ConditionsT, offset, limit int) ([]*ms.MessageFormated, error) {
messages, err := (&dbr.Message{}).List(s.db, conditions, offset, limit)
func (s *messageSrv) GetMessages(userId int64, offset, limit int) ([]*ms.MessageFormated, error) {
messages, err := (&dbr.Message{}).List(s.db, userId, offset, limit)
if err != nil {
return nil, err
}
mfs := []*dbr.MessageFormated{}
for _, message := range messages {
mf := message.Format()
mfs = append(mfs, mf)
}
return mfs, nil
}
func (s *messageSrv) GetMessageCount(conditions *ms.ConditionsT) (int64, error) {
return (&dbr.Message{}).Count(s.db, conditions)
func (s *messageSrv) GetMessageCount(userId int64) (int64, error) {
return (&dbr.Message{}).Count(s.db, userId)
}

@ -84,18 +84,19 @@ func (s *coreSrv) GetUserInfo(req *web.UserInfoReq) (*web.UserInfoResp, mir.Erro
}
func (s *coreSrv) GetMessages(req *web.GetMessagesReq) (*web.GetMessagesResp, mir.Error) {
conditions := &ms.ConditionsT{
"receiver_user_id": req.UserId,
"ORDER": "id DESC",
}
messages, err := s.Ds.GetMessages(conditions, (req.Page-1)*req.PageSize, req.PageSize)
messages, err := s.Ds.GetMessages(req.UserId, (req.Page-1)*req.PageSize, req.PageSize)
for _, mf := range messages {
// TODO: 优化处理这里的user获取逻辑以及错误处理
if mf.SenderUserID > 0 {
user, err := s.Ds.GetUserByID(mf.SenderUserID)
if err == nil {
if user, err := s.Ds.GetUserByID(mf.SenderUserID); err == nil {
mf.SenderUser = user.Format()
}
}
if mf.Type == ms.MsgTypeWhisper && mf.ReceiverUserID != req.UserId {
if user, err := s.Ds.GetUserByID(mf.ReceiverUserID); err == nil {
mf.ReceiverUser = user.Format()
}
}
// 好友申请消息不需要获取其他信息
if mf.Type == ms.MsgTypeRequestingFriend {
continue
@ -123,7 +124,7 @@ func (s *coreSrv) GetMessages(req *web.GetMessagesReq) (*web.GetMessagesResp, mi
logrus.Errorf("Ds.GetMessages err: %v\n", err)
return nil, web.ErrGetMessagesFailed
}
totalRows, _ := s.Ds.GetMessageCount(conditions)
totalRows, _ := s.Ds.GetMessageCount(req.UserId)
resp := base.PageRespFrom(messages, req.Page, req.PageSize, totalRows)
return (*web.GetMessagesResp)(resp), nil
}

@ -1 +1 @@
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-3b4e457a.js";import{u as a}from"./vue-router-e5a2430e.js";import{F as i,e as c,a2 as u}from"./naive-ui-d8de3dda.js";import{d as l,f as d,k as t,w as o,e as f,A as x}from"./@vue-a481fc63.js";import{_ as g}from"./index-7ab58e72.js";import"./vuex-44de225f.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-33f992ab.js";import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./@css-render-7124a1a5.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"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-048bd56b.js";import{u as a}from"./vue-router-e5a2430e.js";import{F as i,e as c,a2 as u}from"./naive-ui-d8de3dda.js";import{d as l,f as d,k as t,w as o,e as f,A as x}from"./@vue-a481fc63.js";import{_ as g}from"./index-757c547c.js";import"./vuex-44de225f.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-1a3558c6.js";import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./@css-render-7124a1a5.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"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{_ as F}from"./post-skeleton-bae19eed.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-3b4e457a.js";import{u as z}from"./vuex-44de225f.js";import{b as A}from"./vue-router-e5a2430e.js";import{a as R}from"./formatTime-4210fcd1.js";import{F as S,Q as V,I as q,G as I}from"./naive-ui-d8de3dda.js";import{d as P,H as n,b as j,f as o,k as a,w as p,e,bf as u,Y as l,F as D,u as E,q as G,j as s,x as _,l as H}from"./@vue-a481fc63.js";import{_ as L}from"./index-7ab58e72.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-33f992ab.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./@css-render-7124a1a5.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"./axios-4a70c6fc.js";/* empty css */const M={key:0,class:"pagination-wrap"},O={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},Y=P({__name:"Anouncement",setup($){const d=z(),g=A(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),m=n(0),h=c=>{i.value=c};return j(()=>{}),(c,J)=>{const k=N,y=V,x=F,w=q,B=I,C=S;return e(),o("div",null,[a(k,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[m.value>1?(e(),o("div",M,[a(y,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",O,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(D,null,E(r.value,t=>(e(),G(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:H({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(R)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const yt=L(Y,[["__scopeId","data-v-d4d04859"]]);export{yt as default};
import{_ as F}from"./post-skeleton-c82f8a59.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-048bd56b.js";import{u as z}from"./vuex-44de225f.js";import{b as A}from"./vue-router-e5a2430e.js";import{a as R}from"./formatTime-4210fcd1.js";import{F as S,Q as V,I as q,G as I}from"./naive-ui-d8de3dda.js";import{d as P,H as n,b as j,f as o,k as a,w as p,e,bf as u,Y as l,F as D,u as E,q as G,j as s,x as _,l as H}from"./@vue-a481fc63.js";import{_ as L}from"./index-757c547c.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-1a3558c6.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./@css-render-7124a1a5.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"./axios-4a70c6fc.js";/* empty css */const M={key:0,class:"pagination-wrap"},O={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},Y=P({__name:"Anouncement",setup($){const d=z(),g=A(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),m=n(0),h=c=>{i.value=c};return j(()=>{}),(c,J)=>{const k=N,y=V,x=F,w=q,B=I,C=S;return e(),o("div",null,[a(k,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[m.value>1?(e(),o("div",M,[a(y,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",O,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(D,null,E(r.value,t=>(e(),G(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:H({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(R)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const yt=L(Y,[["__scopeId","data-v-d4d04859"]]);export{yt as default};

@ -1 +1 @@
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-3755d97f.js";import{_ as $}from"./post-skeleton-bae19eed.js";import{_ as q}from"./main-nav.vue_vue_type_style_index_0_lang-3b4e457a.js";import{u as I}from"./vuex-44de225f.js";import{b as N}from"./vue-router-e5a2430e.js";import{O as R,_ as V}from"./index-7ab58e72.js";import{d as E,H as a,b as G,f as o,k as e,w as c,bf as g,Y as v,e as t,F as f,u as k,q as h}from"./@vue-a481fc63.js";import{F as H,Q as L,I as O,G as Q}from"./naive-ui-d8de3dda.js";import"./content-77341dc8.js";import"./@vicons-33f992ab.js";import"./paopao-video-player-2fe58954.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"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./@css-render-7124a1a5.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";const T={key:0,class:"skeleton-wrap"},U={key:1},Y={key:0,class:"empty-wrap"},j={key:1},A={key:2},D={key:0,class:"pagination-wrap"},J=E({__name:"Collection",setup(K){const m=I(),y=N(),_=a(!1),i=a([]),p=a(+y.query.p||1),l=a(20),r=a(0),u=()=>{_.value=!0,R({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return G(()=>{u()}),(n,W)=>{const b=q,C=$,x=O,z=P,d=Q,B=S,F=H,M=L;return t(),o("div",null,[e(b,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",T,[e(C,{num:l.value},null,8,["num"])])):(t(),o("div",U,[i.value.length===0?(t(),o("div",Y,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",j,[(t(!0),o(f,null,k(i.value,s=>(t(),h(d,{key:s.id},{default:c(()=>[e(z,{post:s},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",A,[(t(!0),o(f,null,k(i.value,s=>(t(),h(d,{key:s.id},{default:c(()=>[e(B,{post:s},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",D,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Pt=V(J,[["__scopeId","data-v-a5302c9b"]]);export{Pt as default};
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-cf11e2c5.js";import{_ as $}from"./post-skeleton-c82f8a59.js";import{_ as q}from"./main-nav.vue_vue_type_style_index_0_lang-048bd56b.js";import{u as I}from"./vuex-44de225f.js";import{b as N}from"./vue-router-e5a2430e.js";import{O as R,_ as V}from"./index-757c547c.js";import{d as E,H as a,b as G,f as o,k as e,w as c,bf as g,Y as v,e as t,F as f,u as k,q as h}from"./@vue-a481fc63.js";import{F as H,Q as L,I as O,G as Q}from"./naive-ui-d8de3dda.js";import"./content-d5264b98.js";import"./@vicons-1a3558c6.js";import"./paopao-video-player-2fe58954.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"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./@css-render-7124a1a5.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";const T={key:0,class:"skeleton-wrap"},U={key:1},Y={key:0,class:"empty-wrap"},j={key:1},A={key:2},D={key:0,class:"pagination-wrap"},J=E({__name:"Collection",setup(K){const m=I(),y=N(),_=a(!1),i=a([]),p=a(+y.query.p||1),l=a(20),r=a(0),u=()=>{_.value=!0,R({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return G(()=>{u()}),(n,W)=>{const b=q,C=$,x=O,z=P,d=Q,B=S,F=H,M=L;return t(),o("div",null,[e(b,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",T,[e(C,{num:l.value},null,8,["num"])])):(t(),o("div",U,[i.value.length===0?(t(),o("div",Y,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",j,[(t(!0),o(f,null,k(i.value,s=>(t(),h(d,{key:s.id},{default:c(()=>[e(z,{post:s},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",A,[(t(!0),o(f,null,k(i.value,s=>(t(),h(d,{key:s.id},{default:c(()=>[e(B,{post:s},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",D,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Pt=V(J,[["__scopeId","data-v-a5302c9b"]]);export{Pt as default};

@ -1 +1 @@
import{u as P,b as R}from"./vue-router-e5a2430e.js";import{b as S}from"./formatTime-4210fcd1.js";import{d as k,e as o,f as s,j as e,k as a,x as l,bf as b,H as c,b as U,w as f,Y as h,F as y,u as V,q as x}from"./@vue-a481fc63.js";import{o as M,F as T,Q as j,I as E,G}from"./naive-ui-d8de3dda.js";import{_ as w,b as H}from"./index-7ab58e72.js";import{_ as L}from"./post-skeleton-bae19eed.js";import{_ as Q}from"./main-nav.vue_vue_type_style_index_0_lang-3b4e457a.js";import{u as Y}from"./vuex-44de225f.js";import"./moment-2ab8298d.js";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"./axios-4a70c6fc.js";import"./@vicons-33f992ab.js";/* empty css */const A={class:"avatar"},J={class:"base-info"},K={class:"username"},O={class:"user-info"},W={class:"info-item"},X={class:"info-item"},Z=k({__name:"contact-item",props:{contact:{}},setup(C){const u=P(),m=t=>{u.push({name:"user",query:{s:t}})};return(t,n)=>{const _=M;return o(),s("div",{class:"contact-item",onClick:n[0]||(n[0]=i=>m(t.contact.username))},[e("div",A,[a(_,{size:54,src:t.contact.avatar},null,8,["src"])]),e("div",J,[e("div",K,[e("strong",null,l(t.contact.nickname),1),e("span",null," @"+l(t.contact.username),1)]),e("div",O,[e("span",W,"UID. "+l(t.contact.user_id),1),e("span",X,l(b(S)(t.contact.created_on))+" 加入",1)])])])}}});const tt=w(Z,[["__scopeId","data-v-644d2c15"]]),et={key:0,class:"skeleton-wrap"},ot={key:1},nt={key:0,class:"empty-wrap"},st={key:0,class:"pagination-wrap"},at=k({__name:"Contacts",setup(C){const u=Y(),m=R(),t=c(!1),n=c([]),_=c(+m.query.p||1),i=c(20),d=c(0),$=r=>{_.value=r,v()};U(()=>{v()});const v=(r=!1)=>{n.value.length===0&&(t.value=!0),H({page:_.value,page_size:i.value}).then(p=>{t.value=!1,n.value=p.list,d.value=Math.ceil(p.pager.total_rows/i.value),r&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(r,p)=>{const I=Q,z=L,B=E,q=tt,D=G,F=T,N=j;return o(),s(y,null,[e("div",null,[a(I,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(o(),s("div",et,[a(z,{num:i.value},null,8,["num"])])):(o(),s("div",ot,[n.value.length===0?(o(),s("div",nt,[a(B,{size:"large",description:"暂无数据"})])):h("",!0),(o(!0),s(y,null,V(n.value,g=>(o(),x(D,{key:g.user_id},{default:f(()=>[a(q,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),d.value>0?(o(),s("div",st,[a(N,{page:_.value,"onUpdate:page":$,"page-slot":b(u).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const Nt=w(at,[["__scopeId","data-v-3b2bf978"]]);export{Nt as default};
import{u as P,b as R}from"./vue-router-e5a2430e.js";import{b as S}from"./formatTime-4210fcd1.js";import{d as k,e as o,f as s,j as e,k as a,x as l,bf as b,H as c,b as U,w as f,Y as h,F as y,u as V,q as x}from"./@vue-a481fc63.js";import{o as M,F as T,Q as j,I as E,G}from"./naive-ui-d8de3dda.js";import{_ as w,b as H}from"./index-757c547c.js";import{_ as L}from"./post-skeleton-c82f8a59.js";import{_ as Q}from"./main-nav.vue_vue_type_style_index_0_lang-048bd56b.js";import{u as Y}from"./vuex-44de225f.js";import"./moment-2ab8298d.js";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"./axios-4a70c6fc.js";import"./@vicons-1a3558c6.js";/* empty css */const A={class:"avatar"},J={class:"base-info"},K={class:"username"},O={class:"user-info"},W={class:"info-item"},X={class:"info-item"},Z=k({__name:"contact-item",props:{contact:{}},setup(C){const u=P(),m=t=>{u.push({name:"user",query:{s:t}})};return(t,n)=>{const _=M;return o(),s("div",{class:"contact-item",onClick:n[0]||(n[0]=i=>m(t.contact.username))},[e("div",A,[a(_,{size:54,src:t.contact.avatar},null,8,["src"])]),e("div",J,[e("div",K,[e("strong",null,l(t.contact.nickname),1),e("span",null," @"+l(t.contact.username),1)]),e("div",O,[e("span",W,"UID. "+l(t.contact.user_id),1),e("span",X,l(b(S)(t.contact.created_on))+" 加入",1)])])])}}});const tt=w(Z,[["__scopeId","data-v-644d2c15"]]),et={key:0,class:"skeleton-wrap"},ot={key:1},nt={key:0,class:"empty-wrap"},st={key:0,class:"pagination-wrap"},at=k({__name:"Contacts",setup(C){const u=Y(),m=R(),t=c(!1),n=c([]),_=c(+m.query.p||1),i=c(20),d=c(0),$=r=>{_.value=r,v()};U(()=>{v()});const v=(r=!1)=>{n.value.length===0&&(t.value=!0),H({page:_.value,page_size:i.value}).then(p=>{t.value=!1,n.value=p.list,d.value=Math.ceil(p.pager.total_rows/i.value),r&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(r,p)=>{const I=Q,z=L,B=E,q=tt,D=G,F=T,N=j;return o(),s(y,null,[e("div",null,[a(I,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(o(),s("div",et,[a(z,{num:i.value},null,8,["num"])])):(o(),s("div",ot,[n.value.length===0?(o(),s("div",nt,[a(B,{size:"large",description:"暂无数据"})])):h("",!0),(o(!0),s(y,null,V(n.value,g=>(o(),x(D,{key:g.user_id},{default:f(()=>[a(q,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),d.value>0?(o(),s("div",st,[a(N,{page:_.value,"onUpdate:page":$,"page-slot":b(u).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const Nt=w(at,[["__scopeId","data-v-3b2bf978"]]);export{Nt as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.message-item[data-v-b2ee6429]{padding:16px}.message-item.unread[data-v-b2ee6429]{background:#fcfffc}.message-item .sender-wrap[data-v-b2ee6429]{display:flex;align-items:center}.message-item .sender-wrap .top-tag[data-v-b2ee6429]{transform:scale(.75)}.message-item .sender-wrap .username[data-v-b2ee6429]{opacity:.75;font-size:14px}.message-item .timestamp[data-v-b2ee6429]{opacity:.75;font-size:12px;display:flex;align-items:center}.message-item .timestamp .timestamp-txt[data-v-b2ee6429]{margin-left:6px}.message-item .brief-wrap[data-v-b2ee6429]{margin-top:10px}.message-item .brief-wrap .brief-content[data-v-b2ee6429],.message-item .brief-wrap .whisper-content-wrap[data-v-b2ee6429],.message-item .brief-wrap .requesting-friend-wrap[data-v-b2ee6429]{display:flex;width:100%}.message-item .view-link[data-v-b2ee6429]{margin-left:8px;display:flex;align-items:center}.message-item .status-info[data-v-b2ee6429]{margin-left:8px;align-items:center}.dark .message-item[data-v-b2ee6429]{background-color:#101014bf}.dark .message-item.unread[data-v-b2ee6429]{background:#0f180b}.dark .message-item .brief-wrap[data-v-b2ee6429]{background-color:#18181c}.skeleton-item[data-v-01d2e871]{padding:12px;display:flex}.skeleton-item .content[data-v-01d2e871]{width:100%}.dark .skeleton-item[data-v-01d2e871]{background-color:#101014bf}.pagination-wrap[data-v-4e7b1342]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .empty-wrap[data-v-4e7b1342],.dark .messages-wrap[data-v-4e7b1342],.dark .pagination-wrap[data-v-4e7b1342]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
.message-item[data-v-07fc447f]{padding:16px}.message-item.unread[data-v-07fc447f]{background:#fcfffc}.message-item .sender-wrap[data-v-07fc447f]{display:flex;align-items:center}.message-item .sender-wrap .username[data-v-07fc447f]{opacity:.75;font-size:14px}.message-item .timestamp[data-v-07fc447f]{opacity:.75;font-size:12px;display:flex;align-items:center}.message-item .timestamp .timestamp-txt[data-v-07fc447f]{margin-left:6px}.message-item .brief-wrap[data-v-07fc447f]{margin-top:10px}.message-item .brief-wrap .brief-content[data-v-07fc447f],.message-item .brief-wrap .whisper-content-wrap[data-v-07fc447f],.message-item .brief-wrap .requesting-friend-wrap[data-v-07fc447f]{display:flex;width:100%}.message-item .view-link[data-v-07fc447f]{margin-left:8px;display:flex;align-items:center}.message-item .status-info[data-v-07fc447f]{margin-left:8px;align-items:center}.dark .message-item[data-v-07fc447f]{background-color:#101014bf}.dark .message-item.unread[data-v-07fc447f]{background:#0f180b}.dark .message-item .brief-wrap[data-v-07fc447f]{background-color:#18181c}.skeleton-item[data-v-01d2e871]{padding:12px;display:flex}.skeleton-item .content[data-v-01d2e871]{width:100%}.dark .skeleton-item[data-v-01d2e871]{background-color:#101014bf}.pagination-wrap[data-v-4e7b1342]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .empty-wrap[data-v-4e7b1342],.dark .messages-wrap[data-v-4e7b1342],.dark .pagination-wrap[data-v-4e7b1342]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{z as $,A as I,B as M,C as O,_ as U}from"./index-7ab58e72.js";import{w as j}from"./@vicons-33f992ab.js";import{d as F,H as i,c as A,b as q,r as x,e as c,f as _,k as n,w as s,q as b,A as B,x as f,Y as p,bf as h,E as D,al as H,F as Y,u as G}from"./@vue-a481fc63.js";import{o as J,M as C,j as K,e as P,O as Q,L as R,F as W,f as X,g as Z,a as ee,k as oe}from"./naive-ui-d8de3dda.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-3b4e457a.js";import{u as ne}from"./vuex-44de225f.js";import"./vue-router-e5a2430e.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";const se={key:0,class:"tag-item"},ae={key:0,class:"tag-quote"},ce={key:1,class:"tag-quote tag-follow"},le={key:0,class:"options"},ie=F({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(T){const t=T,r=i(!1),m=A(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=e=>{switch(e){case"follow":M({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return q(()=>{r.value=!1}),(e,o)=>{const w=x("router-link"),g=J,k=C,a=K,d=P,v=Q,u=R;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(u,null,{header:s(()=>[(c(),b(k,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(g,{src:e.tag.user.avatar},null,8,["src"])]),default:s(()=>[n(w,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[B(" #"+f(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?p("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):p("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),_("div",le,[n(v,{placement:"bottom-end",trigger:"click",size:"small",options:m.value,onSelect:l},{default:s(()=>[n(d,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(a,null,{default:s(()=>[n(h(j))]),_:1})]),_:1})]),_:1},8,["options"])])):p("",!0)]),_:1})])):p("",!0)}}});const _e=F({__name:"Topic",setup(T){const t=ne(),r=i([]),m=i("hot"),l=i(!1),e=i(!1),o=i(!1);D(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=A({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,O({type:m.value,num:50}).then(a=>{r.value=a.topics,l.value=!1}).catch(a=>{console.log(a),l.value=!1})},k=a=>{m.value=a,a=="follow"?o.value=!0:o.value=!1,g()};return q(()=>{g()}),(a,d)=>{const v=te,u=X,L=C,V=Z,N=ie,S=ee,z=oe,E=W;return c(),_("div",null,[n(v,{title:"话题"}),n(E,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(V,{type:"line",animated:"","onUpdate:value":k},H({default:s(()=>[n(u,{name:"hot",tab:"热门"}),n(u,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(u,{key:0,name:"follow",tab:"关注"})):p("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(L,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[B(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(z,{show:l.value},{default:s(()=>[n(S,null,{default:s(()=>[(c(!0),_(Y,null,G(r.value,y=>(c(),b(N,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Ne=U(_e,[["__scopeId","data-v-1fb31ecf"]]);export{Ne as default};
import{z as $,A as I,B as M,C as O,_ as U}from"./index-757c547c.js";import{w as j}from"./@vicons-1a3558c6.js";import{d as F,H as i,c as A,b as q,r as x,e as c,f as _,k as n,w as s,q as b,A as B,x as f,Y as p,bf as h,E as D,al as H,F as Y,u as G}from"./@vue-a481fc63.js";import{o as J,M as C,j as K,e as P,O as Q,L as R,F as W,f as X,g as Z,a as ee,k as oe}from"./naive-ui-d8de3dda.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-048bd56b.js";import{u as ne}from"./vuex-44de225f.js";import"./vue-router-e5a2430e.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";const se={key:0,class:"tag-item"},ae={key:0,class:"tag-quote"},ce={key:1,class:"tag-quote tag-follow"},le={key:0,class:"options"},ie=F({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(T){const t=T,r=i(!1),m=A(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=e=>{switch(e){case"follow":M({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return q(()=>{r.value=!1}),(e,o)=>{const w=x("router-link"),g=J,k=C,a=K,d=P,v=Q,u=R;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(u,null,{header:s(()=>[(c(),b(k,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(g,{src:e.tag.user.avatar},null,8,["src"])]),default:s(()=>[n(w,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[B(" #"+f(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?p("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):p("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),_("div",le,[n(v,{placement:"bottom-end",trigger:"click",size:"small",options:m.value,onSelect:l},{default:s(()=>[n(d,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(a,null,{default:s(()=>[n(h(j))]),_:1})]),_:1})]),_:1},8,["options"])])):p("",!0)]),_:1})])):p("",!0)}}});const _e=F({__name:"Topic",setup(T){const t=ne(),r=i([]),m=i("hot"),l=i(!1),e=i(!1),o=i(!1);D(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=A({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,O({type:m.value,num:50}).then(a=>{r.value=a.topics,l.value=!1}).catch(a=>{console.log(a),l.value=!1})},k=a=>{m.value=a,a=="follow"?o.value=!0:o.value=!1,g()};return q(()=>{g()}),(a,d)=>{const v=te,u=X,L=C,V=Z,N=ie,S=ee,z=oe,E=W;return c(),_("div",null,[n(v,{title:"话题"}),n(E,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(V,{type:"line",animated:"","onUpdate:value":k},H({default:s(()=>[n(u,{name:"hot",tab:"热门"}),n(u,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(u,{key:0,name:"follow",tab:"关注"})):p("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(L,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[B(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(z,{show:l.value},{default:s(()=>[n(S,null,{default:s(()=>[(c(!0),_(Y,null,G(r.value,y=>(c(),b(N,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Ne=U(_e,[["__scopeId","data-v-1fb31ecf"]]);export{Ne as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{a3 as B}from"./index-757c547c.js";import{u as E}from"./vuex-44de225f.js";import{u as S}from"./vue-router-e5a2430e.js";import{j as z}from"./vooks-6d99783e.js";import{Z as C,_ as N,$ as P,a0 as D}from"./@vicons-1a3558c6.js";import{a3 as R,a4 as x,j as H,e as I,a5 as V,h as j}from"./naive-ui-d8de3dda.js";import{d as q,H as h,b as $,e as a,f,bf as o,k as e,w as t,Y as c,j as F,q as _,A as L,x as U,F as Y}from"./@vue-a481fc63.js";const Z={key:0},G={class:"navbar"},oe=q({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(g){const i=g,n=E(),m=S(),l=h(!1),k=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return $(()=>{localStorage.getItem("PAOPAO_THEME")||u(z()==="dark")}),(s,d)=>{const b=B,y=R,O=x,r=H,p=I,M=V,T=j;return a(),f(Y,null,[o(n).state.drawerModelShow?(a(),f("div",Z,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=A=>l.value=A),width:212,placement:k.value,resizable:""},{default:t(()=>[e(y,null,{default:t(()=>[e(b)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[F("div",G,[o(n).state.drawerModelShow&&!s.back?(a(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),s.back?(a(),_(p,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(N))]),_:1})]),_:1})):c("",!0),L(" "+U(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(D)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};

@ -1 +0,0 @@
import{a3 as B}from"./index-7ab58e72.js";import{u as E}from"./vuex-44de225f.js";import{u as S}from"./vue-router-e5a2430e.js";import{j as z}from"./vooks-6d99783e.js";import{Y as C,Z as N,_ as P,$ as D}from"./@vicons-33f992ab.js";import{a3 as R,a4 as x,j as H,e as I,a5 as V,h as j}from"./naive-ui-d8de3dda.js";import{d as q,H as h,b as $,e as a,f,bf as o,k as e,w as t,Y as c,j as F,q as _,A as L,x as U,F as Y}from"./@vue-a481fc63.js";const Z={key:0},G={class:"navbar"},oe=q({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(g){const i=g,n=E(),m=S(),l=h(!1),k=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return $(()=>{localStorage.getItem("PAOPAO_THEME")||u(z()==="dark")}),(s,d)=>{const b=B,y=R,O=x,r=H,p=I,M=V,T=j;return a(),f(Y,null,[o(n).state.drawerModelShow?(a(),f("div",Z,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=A=>l.value=A),width:212,placement:k.value,resizable:""},{default:t(()=>[e(y,null,{default:t(()=>[e(b)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[F("div",G,[o(n).state.drawerModelShow&&!s.back?(a(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),s.back?(a(),_(p,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(N))]),_:1})]),_:1})):c("",!0),L(" "+U(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(D)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};

@ -1 +1 @@
import{U as r}from"./naive-ui-d8de3dda.js";import{d as c,e as s,f as n,u as p,j as o,k as t,F as l}from"./@vue-a481fc63.js";import{_ as i}from"./index-7ab58e72.js";const m={class:"user"},u={class:"content"},d=c({__name:"post-skeleton",props:{num:{default:1}},setup(f){return(_,k)=>{const e=r;return s(!0),n(l,null,p(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",u,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(d,[["__scopeId","data-v-ab0015b4"]]);export{b as _};
import{U as r}from"./naive-ui-d8de3dda.js";import{d as c,e as s,f as n,u as p,j as o,k as t,F as l}from"./@vue-a481fc63.js";import{_ as i}from"./index-757c547c.js";const m={class:"user"},u={class:"content"},d=c({__name:"post-skeleton",props:{num:{default:1}},setup(f){return(_,k)=>{const e=r;return s(!0),n(l,null,p(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",u,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(d,[["__scopeId","data-v-ab0015b4"]]);export{b as _};

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />
<link rel="manifest" href="/manifest.json" />
<title></title>
<script type="module" crossorigin src="/assets/index-7ab58e72.js"></script>
<script type="module" crossorigin src="/assets/index-757c547c.js"></script>
<link rel="modulepreload" crossorigin href="/assets/@vue-a481fc63.js">
<link rel="modulepreload" crossorigin href="/assets/vue-router-e5a2430e.js">
<link rel="modulepreload" crossorigin href="/assets/vuex-44de225f.js">
@ -27,7 +27,7 @@
<link rel="modulepreload" crossorigin href="/assets/async-validator-dee29e8b.js">
<link rel="modulepreload" crossorigin href="/assets/date-fns-975a2d8f.js">
<link rel="modulepreload" crossorigin href="/assets/naive-ui-d8de3dda.js">
<link rel="modulepreload" crossorigin href="/assets/@vicons-33f992ab.js">
<link rel="modulepreload" crossorigin href="/assets/@vicons-1a3558c6.js">
<link rel="stylesheet" href="/assets/index-75351f40.css">
<link rel="stylesheet" href="/assets/vfonts-7afd136d.css">
</head>

@ -1,16 +1,19 @@
<template>
<div class="message-item" :class="{ unread: message.is_read === 0 }" @click="handleReadMessage(message)">
<div class="message-item" :class="{ unread: isNotWhisperSender && message.is_read === 0 }" @click="handleReadMessage(message)">
<n-thing content-indented>
<template #avatar>
<n-avatar round :size="30" :src="
message.sender_user.id > 0
message.type == 4 && message.sender_user_id == store.state.userInfo.id
? message.receiver_user.avatar
: ( message.sender_user.id > 0
? message.sender_user.avatar
: defaultavatar
)
" />
</template>
<template #header>
<div class="sender-wrap">
<span class="nickname" v-if="message.sender_user.id > 0">
<span class="nickname" v-if="(message.type !=4 && message.sender_user.id > 0) || isWhisperReceiver">
<router-link @click.stop class="username-link" :to="{
name: 'user',
query: {
@ -23,19 +26,74 @@
@{{ message.sender_user.username }}
</span>
</span>
<span class="nickname" v-else-if="isWhisperSender">
<router-link @click.stop class="username-link" :to="{
name: 'user',
query: {
s: message.receiver_user.username,
},
}">
{{ message.receiver_user.nickname }}
</router-link>
<span class="username">
@{{ message.receiver_user.username }}
</span>
</span>
<span class="nickname" v-else> </span>
<n-tag
v-if="message.type == 4"
class="top-tag"
type="success"
size="small"
round
>
</n-tag>
<!-- <n-tag
v-if="message.type != 4"
class="top-tag"
type="info"
size="small"
round
>
</n-tag> -->
<n-tag
v-if="isWhisperSender"
class="top-tag"
type="info"
size="small"
round
>
<template #icon>
<n-icon :component="CheckmarkCircle" />
</template>
</n-tag>
<n-tag
v-if="message.type == 4 && message.receiver_user_id == store.state.userInfo.id"
class="top-tag"
type="warning"
size="small"
round
>
<template #icon>
<n-icon :component="CheckmarkCircle" />
</template>
</n-tag>
</div>
</template>
<template #header-extra>
<span class="timestamp">
<n-badge v-if="message.is_read === 0" dot processing />
<n-badge v-if="isNotWhisperSender && message.is_read === 0" dot processing />
<span class="timestamp-txt">
{{ formatRelativeTime(message.created_on) }}
</span>
</span>
</template>
<template #description>
<n-alert :show-icon="false" class="brief-wrap" :type="message.is_read > 0 ? 'default' : 'success'">
<n-alert :show-icon="false" class="brief-wrap" :type="!isNotWhisperSender || message.is_read > 0 ? 'default' : 'success'">
<div v-if="message.type != 4" class="brief-content">
{{ message.brief }}
<span v-if="message.type === 1 || message.type === 2 || message.type === 3"
@ -82,14 +140,18 @@
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';
import { ShareOutline, CheckmarkOutline, CloseOutline, CheckmarkDoneOutline } from '@vicons/ionicons5';
import { readMessage, addFriend, rejectFriend } from '@/api/user';
import { formatRelativeTime } from '@/utils/formatTime';
import { CheckmarkCircle } from '@vicons/ionicons5'
const defaultavatar = 'https://assets.paopao.info/public/avatar/default/admin.png';
const router = useRouter();
const store = useStore();
const props = withDefaults(
defineProps<{
message: Item.MessageProps;
@ -97,6 +159,18 @@ const props = withDefaults(
{}
);
const isNotWhisperSender = computed(() => {
return props.message.type !== 4 || props.message.sender_user_id !== store.state.userInfo.id
});
const isWhisperReceiver = computed(() => {
return props.message.type == 4 && props.message.receiver_user_id == store.state.userInfo.id
});
const isWhisperSender = computed(() => {
return props.message.type == 4 && props.message.sender_user_id == store.state.userInfo.id
});
const viewDetail = (message: Item.MessageProps) => {
handleReadMessage(message);
if (message.type === 1 || message.type === 2 || message.type === 3) {
@ -142,6 +216,9 @@ const rejectAddFriend = (message: Item.MessageProps) => {
}
const handleReadMessage = (message: Item.MessageProps) => {
if (props.message.receiver_user_id != store.state.userInfo.id) {
return
}
if (message.is_read === 0) {
readMessage({
id: message.id,
@ -167,7 +244,9 @@ const handleReadMessage = (message: Item.MessageProps) => {
.sender-wrap {
display: flex;
align-items: center;
.top-tag {
transform: scale(0.75);
}
.username {
opacity: 0.75;
font-size: 14px;

@ -250,6 +250,8 @@ declare module Item {
sender_user: UserInfo;
/** 接收方UID */
receiver_user_id: number;
/** 接收人用户数据 */
receiver_user: UserInfo;
/** 帖子ID */
post_id: number;
/** 帖子内容 */

Loading…
Cancel
Save