Merge branch 'dev' into alpha

pull/398/head v0.5.0-alpha.6
Michael Li 1 year ago
commit 07664a4c9d
No known key found for this signature in database

@ -62,11 +62,13 @@ type cacheMyFollowIdsEvent struct {
} }
func OnExpireIndexTweetEvent(userId int64) { func OnExpireIndexTweetEvent(userId int64) {
// TODO: 这里暴躁的将所有 最新/热门/关注 的推文列表缓存都过期掉,后续需要更精细话处理
events.OnEvent(&expireIndexTweetsEvent{ events.OnEvent(&expireIndexTweetsEvent{
ac: _appCache, ac: _appCache,
keysPattern: []string{ keysPattern: []string{
conf.PrefixIdxTweetsNewest + "*", conf.PrefixIdxTweetsNewest + "*",
conf.PrefixIdxTweetsHots + "*", conf.PrefixIdxTweetsHots + "*",
conf.PrefixIdxTweetsFollowing + "*",
fmt.Sprintf("%s%d:*", conf.PrefixUserTweets, userId), fmt.Sprintf("%s%d:*", conf.PrefixUserTweets, userId),
}, },
}) })

@ -191,7 +191,6 @@ func (s *coreSrv) GetCollections(req *web.GetCollectionsReq) (*web.GetCollection
logrus.Errorf("Ds.GetUserPostCollectionCount err: %s", err) logrus.Errorf("Ds.GetUserPostCollectionCount err: %s", err)
return nil, web.ErrGetCollectionsFailed return nil, web.ErrGetCollectionsFailed
} }
var posts []*ms.Post var posts []*ms.Post
for _, collection := range collections { for _, collection := range collections {
posts = append(posts, collection.Post) posts = append(posts, collection.Post)
@ -201,8 +200,11 @@ func (s *coreSrv) GetCollections(req *web.GetCollectionsReq) (*web.GetCollection
logrus.Errorf("Ds.MergePosts err: %s", err) logrus.Errorf("Ds.MergePosts err: %s", err)
return nil, web.ErrGetCollectionsFailed return nil, web.ErrGetCollectionsFailed
} }
if err = s.PrepareTweets(req.UserId, postsFormated); err != nil {
logrus.Errorf("get collections prepare tweets err: %s", err)
return nil, web.ErrGetCollectionsFailed
}
resp := base.PageRespFrom(postsFormated, req.Page, req.PageSize, totalRows) resp := base.PageRespFrom(postsFormated, req.Page, req.PageSize, totalRows)
return (*web.GetCollectionsResp)(resp), nil return (*web.GetCollectionsResp)(resp), nil
} }

@ -131,17 +131,17 @@ func (s *looseSrv) getIndexTweets(req *web.TimelineReq, limit int, offset int) (
} }
func (s *looseSrv) indexTweetsFromCache(req *web.TimelineReq, limit int, offset int) (res *web.TimelineResp, key string, ok bool) { func (s *looseSrv) indexTweetsFromCache(req *web.TimelineReq, limit int, offset int) (res *web.TimelineResp, key string, ok bool) {
switch req.Style {
case web.StyleTweetsFollowing:
username := "_" username := "_"
if req.User != nil { if req.User != nil {
username = req.User.Username username = req.User.Username
} }
switch req.Style {
case web.StyleTweetsFollowing:
key = fmt.Sprintf("%s%s:%d:%d", s.prefixIdxTweetsFollowing, username, offset, limit) key = fmt.Sprintf("%s%s:%d:%d", s.prefixIdxTweetsFollowing, username, offset, limit)
case web.StyleTweetsNewest: case web.StyleTweetsNewest:
key = fmt.Sprintf("%s%d:%d", s.prefixIdxTweetsNewest, offset, limit) key = fmt.Sprintf("%s%s:%d:%d", s.prefixIdxTweetsNewest, username, offset, limit)
case web.StyleTweetsHots: case web.StyleTweetsHots:
key = fmt.Sprintf("%s%d:%d", s.prefixIdxTweetsHots, offset, limit) key = fmt.Sprintf("%s%s:%d:%d", s.prefixIdxTweetsHots, username, offset, limit)
default: default:
return return
} }

@ -207,10 +207,3 @@ func checkPermision(user *ms.User, targetUserId int64) mir.Error {
} }
return nil return nil
} }
// visbleTansform 可见性等价转换,暂时处理方式,后续需要去掉这个步骤
func _visbleTansform(list []*ms.PostFormated) {
for _, post := range list {
post.Visibility = ms.PostVisibleT(post.Visibility.ToOutValue())
}
}

@ -1 +1 @@
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-832ff0ed.js";import{u as i}from"./vue-router-e5a2430e.js";import{G as a,e as c,a2 as u}from"./naive-ui-defd0b2d.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-537a241d.js";import"./vuex-44de225f.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-4ed09704.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";import"./moment-2ab8298d.js";/* empty css */const v=l({__name:"404",setup(h){const e=i(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=a;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 O=g(v,[["__scopeId","data-v-e62daa85"]]);export{O as default}; import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-202c8ebb.js";import{u as i}from"./vue-router-e5a2430e.js";import{G as a,e as c,a2 as u}from"./naive-ui-defd0b2d.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-043b20da.js";import"./vuex-44de225f.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-4ed09704.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";import"./moment-2ab8298d.js";/* empty css */const v=l({__name:"404",setup(h){const e=i(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=a;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 O=g(v,[["__scopeId","data-v-e62daa85"]]);export{O as default};

@ -1 +1 @@
import{_ as N}from"./post-skeleton-5d89319a.js";import{_ as R}from"./main-nav.vue_vue_type_style_index_0_lang-832ff0ed.js";import{u as z}from"./vuex-44de225f.js";import{b as A}from"./vue-router-e5a2430e.js";import{H as F,_ as H}from"./index-537a241d.js";import{G as S,R as V,J as q,H as P}from"./naive-ui-defd0b2d.js";import{d as j,H as n,b as D,f as o,k as a,w as p,e as t,bf as u,Y as l,F as E,u as G,q as I,j as s,x as _,l as J}from"./@vue-a481fc63.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-4ed09704.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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 L={key:0,class:"pagination-wrap"},M={key:0,class:"skeleton-wrap"},O={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},Y=j({__name:"Anouncement",setup($){const d=z(),g=A(),v=n(!1),i=n([]),r=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{r.value=m};return D(()=>{}),(m,K)=>{const k=R,y=V,x=N,w=q,B=P,C=S;return t(),o("div",null,[a(k,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(t(),o("div",L,[a(y,{page:r.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(t(),o("div",M,[a(x,{num:f.value},null,8,["num"])])):(t(),o("div",O,[i.value.length===0?(t(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(t(!0),o(E,null,G(i.value,e=>(t(),I(B,{key:e.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(e.id),1),s("div",null,_(e.reason),1),s("div",{class:J({income:e.change_amount>=0,out:e.change_amount<0})},_((e.change_amount>0?"+":"")+(e.change_amount/100).toFixed(2)),3),s("div",null,_(u(F)(e.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const ke=H(Y,[["__scopeId","data-v-d4d04859"]]);export{ke as default}; import{_ as N}from"./post-skeleton-f8a7d430.js";import{_ as R}from"./main-nav.vue_vue_type_style_index_0_lang-202c8ebb.js";import{u as z}from"./vuex-44de225f.js";import{b as A}from"./vue-router-e5a2430e.js";import{I as F,_ as S}from"./index-043b20da.js";import{G as V,R as q,J as H,H as I}from"./naive-ui-defd0b2d.js";import{d as P,H as n,b as j,f as o,k as a,w as p,e as t,bf as u,Y as l,F as D,u as E,q as G,j as s,x as _,l as J}from"./@vue-a481fc63.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./@vicons-4ed09704.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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 L={key:0,class:"pagination-wrap"},M={key:0,class:"skeleton-wrap"},O={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),i=n([]),r=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{r.value=m};return j(()=>{}),(m,K)=>{const k=R,y=q,x=N,w=H,B=I,C=V;return t(),o("div",null,[a(k,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(t(),o("div",L,[a(y,{page:r.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(t(),o("div",M,[a(x,{num:f.value},null,8,["num"])])):(t(),o("div",O,[i.value.length===0?(t(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(t(!0),o(D,null,E(i.value,e=>(t(),G(B,{key:e.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(e.id),1),s("div",null,_(e.reason),1),s("div",{class:J({income:e.change_amount>=0,out:e.change_amount<0})},_((e.change_amount>0?"+":"")+(e.change_amount/100).toFixed(2)),3),s("div",null,_(u(F)(e.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const ke=S(Y,[["__scopeId","data-v-d4d04859"]]);export{ke as default};

@ -0,0 +1 @@
import{_ as T}from"./whisper-3ea0f829.js";import{_ as U,a as q}from"./post-item.vue_vue_type_style_index_0_lang-f4681b38.js";import{_ as N}from"./post-skeleton-f8a7d430.js";import{_ as V}from"./main-nav.vue_vue_type_style_index_0_lang-202c8ebb.js";import{u as W}from"./vuex-44de225f.js";import{b as D}from"./vue-router-e5a2430e.js";import{R as E,u as G,f as J,_ as L}from"./index-043b20da.js";import{d as Y,H as a,b as j,f as t,k as s,w as f,bf as c,Y as y,e as o,F as C,u as x,q as F}from"./@vue-a481fc63.js";import{F as K,G as Q,R as X,J as Z,H as ee}from"./naive-ui-defd0b2d.js";import"./content-70c346cf.js";import"./@vicons-4ed09704.js";import"./paopao-video-player-2fe58954.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";import"./moment-2ab8298d.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 oe={key:0,class:"skeleton-wrap"},te={key:1},se={key:0,class:"empty-wrap"},ne={key:1},ae={key:2},ie={key:0,class:"pagination-wrap"},le=Y({__name:"Collection",setup(re){const i=W(),S=D(),$=K(),l=a(!1),r=a([]),u=a(+S.query.p||1),p=a(20),m=a(0),d=a(!1),g=a({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),v=e=>{g.value=e,d.value=!0},b=()=>{d.value=!1},w=e=>{$.success({title:"提示",content:"确定"+(e.user.is_following?"取消关注":"关注")+"该用户吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e.user.is_following?G({user_id:e.user.id}).then(_=>{window.$message.success("操作成功"),e.user.is_following=!1}).catch(_=>{}):J({user_id:e.user.id}).then(_=>{window.$message.success("关注成功"),e.user.is_following=!0}).catch(_=>{})}})},h=()=>{l.value=!0,E({page:u.value,page_size:p.value}).then(e=>{l.value=!1,r.value=e.list,m.value=Math.ceil(e.pager.total_rows/p.value),window.scrollTo(0,0)}).catch(e=>{l.value=!1})},R=e=>{u.value=e,h()};return j(()=>{h()}),(e,_)=>{const O=V,P=N,z=Z,A=U,k=ee,B=q,H=T,I=Q,M=X;return o(),t("div",null,[s(O,{title:"收藏"}),s(I,{class:"main-content-wrap",bordered:""},{default:f(()=>[l.value?(o(),t("div",oe,[s(P,{num:p.value},null,8,["num"])])):(o(),t("div",te,[r.value.length===0?(o(),t("div",se,[s(z,{size:"large",description:"暂无数据"})])):y("",!0),c(i).state.desktopModelShow?(o(),t("div",ne,[(o(!0),t(C,null,x(r.value,n=>(o(),F(k,{key:n.id},{default:f(()=>[s(A,{post:n,isOwner:c(i).state.userInfo.id==n.user_id,addFollowAction:!0,onSendWhisper:v,onHandleFollowAction:w},null,8,["post","isOwner"])]),_:2},1024))),128))])):(o(),t("div",ae,[(o(!0),t(C,null,x(r.value,n=>(o(),F(k,{key:n.id},{default:f(()=>[s(B,{post:n,isOwner:c(i).state.userInfo.id==n.user_id,addFollowAction:!0,onSendWhisper:v,onHandleFollowAction:w},null,8,["post","isOwner"])]),_:2},1024))),128))]))])),s(H,{show:d.value,user:g.value,onSuccess:b},null,8,["show","user"])]),_:1}),m.value>0?(o(),t("div",ie,[s(M,{page:u.value,"onUpdate:page":R,"page-slot":c(i).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):y("",!0)])}}});const Ne=L(le,[["__scopeId","data-v-c8f8eee7"]]);export{Ne as default};

@ -0,0 +1 @@
.pagination-wrap[data-v-c8f8eee7]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .main-content-wrap[data-v-c8f8eee7],.dark .empty-wrap[data-v-c8f8eee7],.dark .skeleton-wrap[data-v-c8f8eee7]{background-color:#101014bf}

@ -1 +0,0 @@
import{_ as H}from"./whisper-7c8226c3.js";import{_ as N,a as V}from"./post-item.vue_vue_type_style_index_0_lang-1243f33f.js";import{_ as W}from"./post-skeleton-5d89319a.js";import{_ as E}from"./main-nav.vue_vue_type_style_index_0_lang-832ff0ed.js";import{u as G}from"./vuex-44de225f.js";import{b as I}from"./vue-router-e5a2430e.js";import{R as J,_ as L}from"./index-537a241d.js";import{d as T,H as s,b as U,f as o,k as n,w as u,bf as h,Y as w,e,F as k,u as y,q as C}from"./@vue-a481fc63.js";import{G as Y,R as j,J as A,H as D}from"./naive-ui-defd0b2d.js";import"./content-f21e8034.js";import"./@vicons-4ed09704.js";import"./paopao-video-player-2fe58954.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";import"./moment-2ab8298d.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 K={key:0,class:"skeleton-wrap"},O={key:1},Q={key:0,class:"empty-wrap"},X={key:1},Z={key:2},ee={key:0,class:"pagination-wrap"},oe=T({__name:"Collection",setup(te){const m=G(),S=I(),_=s(!1),i=s([]),l=s(+S.query.p||1),p=s(20),r=s(0),c=s(!1),d=s({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),f=t=>{d.value=t,c.value=!0},b=()=>{c.value=!1},v=()=>{_.value=!0,J({page:l.value,page_size:p.value}).then(t=>{_.value=!1,i.value=t.list,r.value=Math.ceil(t.pager.total_rows/p.value),window.scrollTo(0,0)}).catch(t=>{_.value=!1})},x=t=>{l.value=t,v()};return U(()=>{v()}),(t,ne)=>{const R=E,$=W,z=A,B=N,g=D,M=V,P=H,q=Y,F=j;return e(),o("div",null,[n(R,{title:"收藏"}),n(q,{class:"main-content-wrap",bordered:""},{default:u(()=>[_.value?(e(),o("div",K,[n($,{num:p.value},null,8,["num"])])):(e(),o("div",O,[i.value.length===0?(e(),o("div",Q,[n(z,{size:"large",description:"暂无数据"})])):w("",!0),h(m).state.desktopModelShow?(e(),o("div",X,[(e(!0),o(k,null,y(i.value,a=>(e(),C(g,{key:a.id},{default:u(()=>[n(B,{post:a,onSendWhisper:f},null,8,["post"])]),_:2},1024))),128))])):(e(),o("div",Z,[(e(!0),o(k,null,y(i.value,a=>(e(),C(g,{key:a.id},{default:u(()=>[n(M,{post:a,onSendWhisper:f},null,8,["post"])]),_:2},1024))),128))]))])),n(P,{show:c.value,user:d.value,onSuccess:b},null,8,["show","user"])]),_:1}),r.value>0?(e(),o("div",ee,[n(F,{page:l.value,"onUpdate:page":x,"page-slot":h(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):w("",!0)])}}});const Ne=L(oe,[["__scopeId","data-v-760779af"]]);export{Ne as default};

@ -1 +0,0 @@
.pagination-wrap[data-v-760779af]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .main-content-wrap[data-v-760779af],.dark .empty-wrap[data-v-760779af],.dark .skeleton-wrap[data-v-760779af]{background-color:#101014bf}

@ -1 +1 @@
import{_ as O}from"./whisper-7c8226c3.js";import{d as N,c as T,r as j,e as s,f as c,k as t,w as n,j as _,y as A,A as U,x as v,bf as g,h as I,H as a,b as W,Y as S,F as z,u as E,q as G}from"./@vue-a481fc63.js";import{I as J,_ as P,b as L}from"./index-537a241d.js";import{k as Y,r as K}from"./@vicons-4ed09704.js";import{j as x,o as Q,e as X,P as Z,O as ee,G as te,R as ne,J as oe,H as se}from"./naive-ui-defd0b2d.js";import{_ as ae}from"./post-skeleton-5d89319a.js";import{_ as ce}from"./main-nav.vue_vue_type_style_index_0_lang-832ff0ed.js";import{u as _e}from"./vuex-44de225f.js";import{b as ie}from"./vue-router-e5a2430e.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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 re={class:"contact-item"},le={class:"nickname-wrap"},pe={class:"username-wrap"},ue={class:"user-info"},me={class:"info-item"},de={class:"info-item"},fe={class:"item-header-extra"},ve=N({__name:"contact-item",props:{contact:{}},emits:["send-whisper"],setup(C,{emit:h}){const i=C,r=e=>()=>I(x,null,{default:()=>I(e)}),l=T(()=>[{label:"私信",key:"whisper",icon:r(K)}]),u=e=>{switch(e){case"whisper":const o={id:i.contact.user_id,avatar:i.contact.avatar,username:i.contact.username,nickname:i.contact.nickname,is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1};h("send-whisper",o);break}};return(e,o)=>{const m=Q,d=j("router-link"),w=X,k=Z,y=ee;return s(),c("div",re,[t(y,{"content-indented":""},{avatar:n(()=>[t(m,{size:54,src:e.contact.avatar},null,8,["src"])]),header:n(()=>[_("span",le,[t(d,{onClick:o[0]||(o[0]=A(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:e.contact.username}}},{default:n(()=>[U(v(e.contact.nickname),1)]),_:1},8,["to"])]),_("span",pe," @"+v(e.contact.username),1),_("div",ue,[_("span",me," UID. "+v(e.contact.user_id),1),_("span",de,v(g(J)(e.contact.created_on))+" 加入 ",1)])]),"header-extra":n(()=>[_("div",fe,[t(k,{placement:"bottom-end",trigger:"click",size:"small",options:l.value,onSelect:u},{default:n(()=>[t(w,{quaternary:"",circle:""},{icon:n(()=>[t(g(x),null,{default:n(()=>[t(g(Y))]),_:1})]),_:1})]),_:1},8,["options"])])]),_:1})])}}});const ge=P(ve,[["__scopeId","data-v-d62f19da"]]),he={key:0,class:"skeleton-wrap"},we={key:1},ke={key:0,class:"empty-wrap"},ye={key:0,class:"pagination-wrap"},Ce=N({__name:"Contacts",setup(C){const h=_e(),i=ie(),r=a(!1),l=a([]),u=a(+i.query.p||1),e=a(20),o=a(0),m=a(!1),d=a({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),w=p=>{d.value=p,m.value=!0},k=()=>{m.value=!1},y=p=>{u.value=p,$()};W(()=>{$()});const $=(p=!1)=>{l.value.length===0&&(r.value=!0),L({page:u.value,page_size:e.value}).then(f=>{r.value=!1,l.value=f.list,o.value=Math.ceil(f.pager.total_rows/e.value),p&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(f=>{r.value=!1})};return(p,f)=>{const q=ce,B=ae,M=oe,R=ge,V=se,D=O,F=te,H=ne;return s(),c(z,null,[_("div",null,[t(q,{title:"好友"}),t(F,{class:"main-content-wrap",bordered:""},{default:n(()=>[r.value?(s(),c("div",he,[t(B,{num:e.value},null,8,["num"])])):(s(),c("div",we,[l.value.length===0?(s(),c("div",ke,[t(M,{size:"large",description:"暂无数据"})])):S("",!0),(s(!0),c(z,null,E(l.value,b=>(s(),G(V,{class:"list-item",key:b.user_id},{default:n(()=>[t(R,{contact:b,onSendWhisper:w},null,8,["contact"])]),_:2},1024))),128))])),t(D,{show:m.value,user:d.value,onSuccess:k},null,8,["show","user"])]),_:1})]),o.value>0?(s(),c("div",ye,[t(H,{page:u.value,"onUpdate:page":y,"page-slot":g(h).state.collapsedRight?5:8,"page-count":o.value},null,8,["page","page-slot","page-count"])])):S("",!0)],64)}}});const Le=P(Ce,[["__scopeId","data-v-e20fef94"]]);export{Le as default}; import{_ as O}from"./whisper-3ea0f829.js";import{d as N,c as T,r as j,e as s,f as c,k as t,w as n,j as _,y as A,A as J,x as v,bf as g,h as S,H as a,b as U,Y as z,F as I,u as W,q as E}from"./@vue-a481fc63.js";import{J as G,_ as P,b as L}from"./index-043b20da.js";import{k as Y,r as K}from"./@vicons-4ed09704.js";import{j as x,o as Q,e as X,P as Z,O as ee,G as te,R as ne,J as oe,H as se}from"./naive-ui-defd0b2d.js";import{_ as ae}from"./post-skeleton-f8a7d430.js";import{_ as ce}from"./main-nav.vue_vue_type_style_index_0_lang-202c8ebb.js";import{u as _e}from"./vuex-44de225f.js";import{b as ie}from"./vue-router-e5a2430e.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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 re={class:"contact-item"},le={class:"nickname-wrap"},pe={class:"username-wrap"},ue={class:"user-info"},me={class:"info-item"},de={class:"info-item"},fe={class:"item-header-extra"},ve=N({__name:"contact-item",props:{contact:{}},emits:["send-whisper"],setup(C,{emit:h}){const i=C,r=e=>()=>S(x,null,{default:()=>S(e)}),l=T(()=>[{label:"私信",key:"whisper",icon:r(K)}]),u=e=>{switch(e){case"whisper":const o={id:i.contact.user_id,avatar:i.contact.avatar,username:i.contact.username,nickname:i.contact.nickname,is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1};h("send-whisper",o);break}};return(e,o)=>{const m=Q,d=j("router-link"),w=X,k=Z,y=ee;return s(),c("div",re,[t(y,{"content-indented":""},{avatar:n(()=>[t(m,{size:54,src:e.contact.avatar},null,8,["src"])]),header:n(()=>[_("span",le,[t(d,{onClick:o[0]||(o[0]=A(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:e.contact.username}}},{default:n(()=>[J(v(e.contact.nickname),1)]),_:1},8,["to"])]),_("span",pe," @"+v(e.contact.username),1),_("div",ue,[_("span",me," UID. "+v(e.contact.user_id),1),_("span",de,v(g(G)(e.contact.created_on))+" 加入 ",1)])]),"header-extra":n(()=>[_("div",fe,[t(k,{placement:"bottom-end",trigger:"click",size:"small",options:l.value,onSelect:u},{default:n(()=>[t(w,{quaternary:"",circle:""},{icon:n(()=>[t(g(x),null,{default:n(()=>[t(g(Y))]),_:1})]),_:1})]),_:1},8,["options"])])]),_:1})])}}});const ge=P(ve,[["__scopeId","data-v-d62f19da"]]),he={key:0,class:"skeleton-wrap"},we={key:1},ke={key:0,class:"empty-wrap"},ye={key:0,class:"pagination-wrap"},Ce=N({__name:"Contacts",setup(C){const h=_e(),i=ie(),r=a(!1),l=a([]),u=a(+i.query.p||1),e=a(20),o=a(0),m=a(!1),d=a({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),w=p=>{d.value=p,m.value=!0},k=()=>{m.value=!1},y=p=>{u.value=p,$()};U(()=>{$()});const $=(p=!1)=>{l.value.length===0&&(r.value=!0),L({page:u.value,page_size:e.value}).then(f=>{r.value=!1,l.value=f.list,o.value=Math.ceil(f.pager.total_rows/e.value),p&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(f=>{r.value=!1})};return(p,f)=>{const q=ce,B=ae,M=oe,R=ge,V=se,D=O,F=te,H=ne;return s(),c(I,null,[_("div",null,[t(q,{title:"好友"}),t(F,{class:"main-content-wrap",bordered:""},{default:n(()=>[r.value?(s(),c("div",he,[t(B,{num:e.value},null,8,["num"])])):(s(),c("div",we,[l.value.length===0?(s(),c("div",ke,[t(M,{size:"large",description:"暂无数据"})])):z("",!0),(s(!0),c(I,null,W(l.value,b=>(s(),E(V,{class:"list-item",key:b.user_id},{default:n(()=>[t(R,{contact:b,onSendWhisper:w},null,8,["contact"])]),_:2},1024))),128))])),t(D,{show:m.value,user:d.value,onSuccess:k},null,8,["show","user"])]),_:1})]),o.value>0?(s(),c("div",ye,[t(H,{page:u.value,"onUpdate:page":y,"page-slot":g(h).state.collapsedRight?5:8,"page-count":o.value},null,8,["page","page-slot","page-count"])])):z("",!0)],64)}}});const Le=P(Ce,[["__scopeId","data-v-e20fef94"]]);export{Le 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

@ -1 +1 @@
.compose-wrap{width:100%;padding:16px;box-sizing:border-box}.compose-wrap .compose-line{display:flex;flex-direction:row}.compose-wrap .compose-line .compose-user{width:42px;height:42px;display:flex;align-items:center}.compose-wrap .compose-line.compose-options{margin-top:6px;padding-left:42px;display:flex;justify-content:space-between}.compose-wrap .compose-line.compose-options .submit-wrap{display:flex;align-items:center}.compose-wrap .compose-line.compose-options .submit-wrap .text-statistic{margin-right:8px;width:20px;height:20px;transform:rotate(180deg)}.compose-wrap .link-wrap{margin-left:42px;margin-right:42px}.compose-wrap .eye-wrap{margin-left:64px}.compose-wrap .login-only-wrap{display:flex;justify-content:center;width:100%}.compose-wrap .login-only-wrap button{margin:0 4px;width:50%}.compose-wrap .login-wrap{display:flex;justify-content:center;width:100%}.compose-wrap .login-wrap .login-banner{margin-bottom:12px;opacity:.8}.compose-wrap .login-wrap button{margin:0 4px}.attachment-list-wrap{margin-top:12px;margin-left:42px}.attachment-list-wrap .n-upload-file-info__thumbnail{overflow:hidden}.dark .compose-wrap{background-color:#101014bf}.tiny-slide-bar .tiny-slide-bar__list>div.tiny-slide-bar__select .slide-bar-item .slide-bar-item-title[data-v-aee71446]{color:#18a058;opacity:.8}.tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item[data-v-aee71446]{cursor:pointer}.tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item .slide-bar-item-avatar[data-v-aee71446]{color:#18a058;opacity:.8}.tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item .slide-bar-item-title[data-v-aee71446]{color:#18a058;opacity:.8}.tiny-slide-bar[data-v-aee71446]{margin-top:-30px;margin-bottom:-30px}.tiny-slide-bar .slide-bar-item[data-v-aee71446]{min-height:170px;width:64px;display:flex;flex-direction:column;justify-content:center;align-items:center;margin-top:8px}.tiny-slide-bar .slide-bar-item .slide-bar-item-title[data-v-aee71446]{justify-content:center;font-size:12px;margin-top:4px;height:40px}.load-more[data-v-aee71446]{margin:20px}.load-more .load-more-wrap[data-v-aee71446]{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:14px}.load-more .load-more-wrap .load-more-spinner[data-v-aee71446]{font-size:14px;opacity:.65}.dark .main-content-wrap[data-v-aee71446],.dark .pagination-wrap[data-v-aee71446],.dark .empty-wrap[data-v-aee71446],.dark .skeleton-wrap[data-v-aee71446]{background-color:#101014bf}.dark .tiny-slide-bar .tiny-slide-bar__list>div.tiny-slide-bar__select .slide-bar-item .slide-bar-item-title[data-v-aee71446]{color:#63e2b7;opacity:.8}.dark .tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item .slide-bar-item-title[data-v-aee71446]{color:#63e2b7;opacity:.8} .compose-wrap{width:100%;padding:16px;box-sizing:border-box}.compose-wrap .compose-line{display:flex;flex-direction:row}.compose-wrap .compose-line .compose-user{width:42px;height:42px;display:flex;align-items:center}.compose-wrap .compose-line.compose-options{margin-top:6px;padding-left:42px;display:flex;justify-content:space-between}.compose-wrap .compose-line.compose-options .submit-wrap{display:flex;align-items:center}.compose-wrap .compose-line.compose-options .submit-wrap .text-statistic{margin-right:8px;width:20px;height:20px;transform:rotate(180deg)}.compose-wrap .link-wrap{margin-left:42px;margin-right:42px}.compose-wrap .eye-wrap{margin-left:64px}.compose-wrap .login-only-wrap{display:flex;justify-content:center;width:100%}.compose-wrap .login-only-wrap button{margin:0 4px;width:50%}.compose-wrap .login-wrap{display:flex;justify-content:center;width:100%}.compose-wrap .login-wrap .login-banner{margin-bottom:12px;opacity:.8}.compose-wrap .login-wrap button{margin:0 4px}.attachment-list-wrap{margin-top:12px;margin-left:42px}.attachment-list-wrap .n-upload-file-info__thumbnail{overflow:hidden}.dark .compose-wrap{background-color:#101014bf}.tiny-slide-bar .tiny-slide-bar__list>div.tiny-slide-bar__select .slide-bar-item .slide-bar-item-title[data-v-c53a3615]{color:#18a058;opacity:.8}.tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item[data-v-c53a3615]{cursor:pointer}.tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item .slide-bar-item-avatar[data-v-c53a3615]{color:#18a058;opacity:.8}.tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item .slide-bar-item-title[data-v-c53a3615]{color:#18a058;opacity:.8}.tiny-slide-bar[data-v-c53a3615]{margin-top:-30px;margin-bottom:-30px}.tiny-slide-bar .slide-bar-item[data-v-c53a3615]{min-height:170px;width:64px;display:flex;flex-direction:column;justify-content:center;align-items:center;margin-top:8px}.tiny-slide-bar .slide-bar-item .slide-bar-item-title[data-v-c53a3615]{justify-content:center;font-size:12px;margin-top:4px;height:40px}.load-more[data-v-c53a3615]{margin:20px}.load-more .load-more-wrap[data-v-c53a3615]{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:14px}.load-more .load-more-wrap .load-more-spinner[data-v-c53a3615]{font-size:14px;opacity:.65}.dark .main-content-wrap[data-v-c53a3615],.dark .pagination-wrap[data-v-c53a3615],.dark .empty-wrap[data-v-c53a3615],.dark .skeleton-wrap[data-v-c53a3615]{background-color:#101014bf}.dark .tiny-slide-bar .tiny-slide-bar__list>div.tiny-slide-bar__select .slide-bar-item .slide-bar-item-title[data-v-c53a3615]{color:#63e2b7;opacity:.8}.dark .tiny-slide-bar .tiny-slide-bar__list>div:hover .slide-bar-item .slide-bar-item-title[data-v-c53a3615]{color:#63e2b7;opacity:.8}

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 +0,0 @@
.profile-baseinfo[data-v-756dadd0]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-756dadd0]{width:72px}.profile-baseinfo .base-info[data-v-756dadd0]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-756dadd0]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-756dadd0]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-756dadd0]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-756dadd0]{transform:scale(.75)}.profile-tabs-wrap[data-v-756dadd0]{padding:0 16px}.load-more[data-v-756dadd0]{margin:20px}.load-more .load-more-wrap[data-v-756dadd0]{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:14px}.load-more .load-more-wrap .load-more-spinner[data-v-756dadd0]{font-size:14px;opacity:.65}.dark .profile-wrap[data-v-756dadd0],.dark .pagination-wrap[data-v-756dadd0]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.profile-baseinfo[data-v-4727fe2e]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-4727fe2e]{width:72px}.profile-baseinfo .base-info[data-v-4727fe2e]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-4727fe2e]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-4727fe2e]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-4727fe2e]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-4727fe2e]{transform:scale(.75)}.profile-tabs-wrap[data-v-4727fe2e]{padding:0 16px}.load-more[data-v-4727fe2e]{margin:20px}.load-more .load-more-wrap[data-v-4727fe2e]{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:14px}.load-more .load-more-wrap .load-more-spinner[data-v-4727fe2e]{font-size:14px;opacity:.65}.dark .profile-wrap[data-v-4727fe2e],.dark .pagination-wrap[data-v-4727fe2e]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{D as $,E as I,F as M,G as O,_ as D}from"./index-537a241d.js";import{z as G}from"./@vicons-4ed09704.js";import{d as F,H as i,c as q,b as A,r as U,e as c,f as _,k as n,w as s,q as b,A as B,x as f,Y as u,bf as h,E as j,al as x,F as H,u as P}from"./@vue-a481fc63.js";import{o as Y,M as C,j as J,e as K,P as Q,O as R,G as W,f as X,g as Z,a as ee,k as oe}from"./naive-ui-defd0b2d.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-832ff0ed.js";import{u as ne}from"./vuex-44de225f.js";import"./vue-router-e5a2430e.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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=q(()=>{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 A(()=>{r.value=!1}),(e,o)=>{const w=U("router-link"),g=Y,k=C,a=J,d=K,v=Q,p=R;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(p,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?u("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):u("",!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(G))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!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);j(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=q({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 A(()=>{g()}),(a,d)=>{const v=te,p=X,V=C,E=Z,L=ie,N=ee,S=oe,z=W;return c(),_("div",null,[n(v,{title:"话题"}),n(z,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(E,{type:"line",animated:"","onUpdate:value":k},x({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(p,{key:0,name:"follow",tab:"关注"})):u("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(V,{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(S,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(H,null,P(r.value,y=>(c(),b(L,{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=D(_e,[["__scopeId","data-v-1fb31ecf"]]);export{Ne as default}; import{E as $,F as I,G as M,H as O,_ as G}from"./index-043b20da.js";import{z as H}from"./@vicons-4ed09704.js";import{d as F,H as i,c as q,b as A,r as U,e as c,f as _,k as n,w as s,q as b,A as B,x as f,Y as u,bf as h,E as j,al as x,F as D,u as P}from"./@vue-a481fc63.js";import{o as Y,M as C,j as J,e as K,P as Q,O as R,G as W,f as X,g as Z,a as ee,k as oe}from"./naive-ui-defd0b2d.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-202c8ebb.js";import{u as ne}from"./vuex-44de225f.js";import"./vue-router-e5a2430e.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.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=q(()=>{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 A(()=>{r.value=!1}),(e,o)=>{const w=U("router-link"),g=Y,k=C,a=J,d=K,v=Q,p=R;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(p,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?u("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):u("",!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(H))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!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);j(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=q({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 A(()=>{g()}),(a,d)=>{const v=te,p=X,V=C,E=Z,L=ie,N=ee,S=oe,z=W;return c(),_("div",null,[n(v,{title:"话题"}),n(z,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(E,{type:"line",animated:"","onUpdate:value":k},x({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(p,{key:0,name:"follow",tab:"关注"})):u("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(V,{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(S,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(D,null,P(r.value,y=>(c(),b(L,{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=G(_e,[["__scopeId","data-v-1fb31ecf"]]);export{Ne as default};

@ -0,0 +1 @@
.profile-tabs-wrap[data-v-8046429c]{padding:0 16px}.profile-baseinfo[data-v-8046429c]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-8046429c]{width:72px}.profile-baseinfo .base-info[data-v-8046429c]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-8046429c]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-8046429c]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-8046429c]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-8046429c]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-8046429c]{position:absolute;top:16px;right:16px;opacity:.75}.load-more[data-v-8046429c]{margin:20px}.load-more .load-more-wrap[data-v-8046429c]{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:14px}.load-more .load-more-wrap .load-more-spinner[data-v-8046429c]{font-size:14px;opacity:.65}.dark .profile-wrap[data-v-8046429c],.dark .pagination-wrap[data-v-8046429c]{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

@ -1 +0,0 @@
.whisper-wrap .whisper-line[data-v-60be56a2]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-60be56a2]{width:100%}.dark .whisper-wrap[data-v-60be56a2]{background-color:#101014bf}.profile-tabs-wrap[data-v-ebc19734]{padding:0 16px}.profile-baseinfo[data-v-ebc19734]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-ebc19734]{width:72px}.profile-baseinfo .base-info[data-v-ebc19734]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-ebc19734]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-ebc19734]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-ebc19734]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-ebc19734]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-ebc19734]{position:absolute;top:16px;right:16px;opacity:.75}.load-more[data-v-ebc19734]{margin:20px}.load-more .load-more-wrap[data-v-ebc19734]{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:14px}.load-more .load-more-wrap .load-more-spinner[data-v-ebc19734]{font-size:14px;opacity:.65}.dark .profile-wrap[data-v-ebc19734],.dark .pagination-wrap[data-v-ebc19734]{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{a8 as A}from"./index-537a241d.js";import{u as B}from"./vuex-44de225f.js";import{u as E}from"./vue-router-e5a2430e.js";import{j as z}from"./vooks-6d99783e.js";import{$ as C,a0 as N,a1 as P,a2 as D}from"./@vicons-4ed09704.js";import{u as R,a3 as $,a4 as x,j as H,e as I,a5 as V,h as j}from"./naive-ui-defd0b2d.js";import{d as q,H as h,b as F,e as n,f,bf as a,k as e,w as t,Y as c,j as L,q as _,A as U,x as Y,F as G}from"./@vue-a481fc63.js";const J={key:0},K={class:"navbar"},ae=q({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(w){const i=w,o=B(),m=E(),l=h(!1),g=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),o.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),o.commit("triggerTheme","light"))},k=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return F(()=>{localStorage.getItem("PAOPAO_THEME")||u(z()==="dark"),o.state.desktopModelShow||(window.$store=o,window.$message=R())}),(s,d)=>{const b=A,y=$,M=x,r=H,p=I,O=V,S=j;return n(),f(G,null,[a(o).state.drawerModelShow?(n(),f("div",J,[e(M,{show:l.value,"onUpdate:show":d[0]||(d[0]=T=>l.value=T),width:212,placement:g.value,resizable:""},{default:t(()=>[e(y,null,{default:t(()=>[e(b)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(S,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[L("div",K,[a(o).state.drawerModelShow&&!s.back?(n(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(a(C))]),_:1})]),_:1})):c("",!0),s.back?(n(),_(p,{key:1,class:"back-btn",onClick:k,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(a(N))]),_:1})]),_:1})):c("",!0),U(" "+Y(i.title)+" ",1),i.theme?(n(),_(O,{key:2,value:a(o).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:a(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:a(D)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{ae as _}; import{a8 as A}from"./index-043b20da.js";import{u as B}from"./vuex-44de225f.js";import{u as E}from"./vue-router-e5a2430e.js";import{j as z}from"./vooks-6d99783e.js";import{$ as C,a0 as N,a1 as P,a2 as D}from"./@vicons-4ed09704.js";import{u as R,a3 as $,a4 as x,j as H,e as I,a5 as V,h as j}from"./naive-ui-defd0b2d.js";import{d as q,H as h,b as F,e as n,f,bf as a,k as e,w as t,Y as c,j as L,q as _,A as U,x as Y,F as G}from"./@vue-a481fc63.js";const J={key:0},K={class:"navbar"},ae=q({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(w){const i=w,o=B(),m=E(),l=h(!1),g=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),o.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),o.commit("triggerTheme","light"))},k=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return F(()=>{localStorage.getItem("PAOPAO_THEME")||u(z()==="dark"),o.state.desktopModelShow||(window.$store=o,window.$message=R())}),(s,d)=>{const b=A,y=$,M=x,r=H,p=I,O=V,S=j;return n(),f(G,null,[a(o).state.drawerModelShow?(n(),f("div",J,[e(M,{show:l.value,"onUpdate:show":d[0]||(d[0]=T=>l.value=T),width:212,placement:g.value,resizable:""},{default:t(()=>[e(y,null,{default:t(()=>[e(b)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(S,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[L("div",K,[a(o).state.drawerModelShow&&!s.back?(n(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(a(C))]),_:1})]),_:1})):c("",!0),s.back?(n(),_(p,{key:1,class:"back-btn",onClick:k,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(a(N))]),_:1})]),_:1})):c("",!0),U(" "+Y(i.title)+" ",1),i.theme?(n(),_(O,{key:2,value:a(o).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:a(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:a(D)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{ae as _};

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{U as r}from"./naive-ui-defd0b2d.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-537a241d.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-defd0b2d.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-043b20da.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 _};

@ -1 +1 @@
import{X as b,_ as k}from"./index-537a241d.js";import{S as B,I as C,T as N,b as U,e as V,i as $}from"./naive-ui-defd0b2d.js";import{d as z,H as p,e as I,q as R,w as s,j as a,k as n,A as _,x as i}from"./@vue-a481fc63.js";const S={class:"whisper-wrap"},T={class:"whisper-line"},W={class:"whisper-line send-wrap"},j=z({__name:"whisper",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(r,{emit:u}){const d=r,o=p(""),t=p(!1),c=()=>{u("success")},m=()=>{t.value=!0,b({user_id:d.user.id,content:o.value}).then(e=>{window.$message.success("发送成功"),t.value=!1,o.value="",c()}).catch(e=>{t.value=!1})};return(e,l)=>{const h=B,w=C,f=N,v=U,g=V,y=$;return I(),R(y,{show:e.show,"onUpdate:show":c,class:"whisper-card",preset:"card",size:"small",title:"私信","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:s(()=>[a("div",S,[n(f,{"show-icon":!1},{default:s(()=>[_(" 即将发送私信给: "),n(w,{style:{"max-width":"100%"}},{default:s(()=>[n(h,{type:"success"},{default:s(()=>[_(i(e.user.nickname)+"@"+i(e.user.username),1)]),_:1})]),_:1})]),_:1}),a("div",T,[n(v,{type:"textarea",placeholder:"请输入私信内容(请勿发送不和谐内容,否则将会被封号)",autosize:{minRows:5,maxRows:10},value:o.value,"onUpdate:value":l[0]||(l[0]=x=>o.value=x),maxlength:"200","show-count":""},null,8,["value"])]),a("div",W,[n(g,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:m},{default:s(()=>[_(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const H=k(j,[["__scopeId","data-v-0cbfe47c"]]);export{H as _}; import{X as b,_ as k}from"./index-043b20da.js";import{d as B,H as p,e as C,q as N,w as s,j as a,k as n,A as _,x as i}from"./@vue-a481fc63.js";import{S as U,I as V,T as z,b as I,e as R,i as S}from"./naive-ui-defd0b2d.js";const T={class:"whisper-wrap"},W={class:"whisper-line"},$={class:"whisper-line send-wrap"},j=B({__name:"whisper",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(r,{emit:u}){const d=r,o=p(""),t=p(!1),c=()=>{u("success")},m=()=>{t.value=!0,b({user_id:d.user.id,content:o.value}).then(e=>{window.$message.success("发送成功"),t.value=!1,o.value="",c()}).catch(e=>{t.value=!1})};return(e,l)=>{const h=U,w=V,f=z,v=I,g=R,y=S;return C(),N(y,{show:e.show,"onUpdate:show":c,class:"whisper-card",preset:"card",size:"small",title:"私信","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:s(()=>[a("div",T,[n(f,{"show-icon":!1},{default:s(()=>[_(" 即将发送私信给: "),n(w,{style:{"max-width":"100%"}},{default:s(()=>[n(h,{type:"success"},{default:s(()=>[_(i(e.user.nickname)+"@"+i(e.user.username),1)]),_:1})]),_:1})]),_:1}),a("div",W,[n(v,{type:"textarea",placeholder:"请输入私信内容(请勿发送不和谐内容,否则将会被封号)",autosize:{minRows:5,maxRows:10},value:o.value,"onUpdate:value":l[0]||(l[0]=x=>o.value=x),maxlength:"200","show-count":""},null,8,["value"])]),a("div",$,[n(g,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:m},{default:s(()=>[_(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const H=k(j,[["__scopeId","data-v-0cbfe47c"]]);export{H as _};

@ -0,0 +1 @@
.whisper-wrap .whisper-line[data-v-60be56a2]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-60be56a2]{width:100%}.dark .whisper-wrap[data-v-60be56a2]{background-color:#101014bf}

@ -0,0 +1 @@
import{M as b,_ as k}from"./index-043b20da.js";import{S as B,I as A,T as C,b as F,e as N,i as V}from"./naive-ui-defd0b2d.js";import{d as W,H as i,e as q,q as z,w as s,j as a,k as n,A as _,x as r}from"./@vue-a481fc63.js";const I={class:"whisper-wrap"},M={class:"whisper-line"},R={class:"whisper-line send-wrap"},S=W({__name:"whisper-add-friend",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(p,{emit:d}){const u=p,o=i(""),t=i(!1),l=()=>{d("success")},m=()=>{t.value=!0,b({user_id:u.user.id,greetings:o.value}).then(e=>{window.$message.success("发送成功"),t.value=!1,o.value="",l()}).catch(e=>{t.value=!1})};return(e,c)=>{const h=B,w=A,f=C,g=F,v=N,y=V;return q(),z(y,{show:e.show,"onUpdate:show":l,class:"whisper-card",preset:"card",size:"small",title:"申请添加朋友","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:s(()=>[a("div",I,[n(f,{"show-icon":!1},{default:s(()=>[_(" 发送添加朋友申请给: "),n(w,{style:{"max-width":"100%"}},{default:s(()=>[n(h,{type:"success"},{default:s(()=>[_(r(e.user.nickname)+"@"+r(e.user.username),1)]),_:1})]),_:1})]),_:1}),a("div",M,[n(g,{type:"textarea",placeholder:"请输入真挚的问候语",autosize:{minRows:5,maxRows:10},value:o.value,"onUpdate:value":c[0]||(c[0]=x=>o.value=x),maxlength:"120","show-count":""},null,8,["value"])]),a("div",R,[n(v,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:m},{default:s(()=>[_(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const D=k(S,[["__scopeId","data-v-60be56a2"]]);export{D as W};

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />
<link rel="manifest" href="/manifest.json" /> <link rel="manifest" href="/manifest.json" />
<title></title> <title></title>
<script type="module" crossorigin src="/assets/index-537a241d.js"></script> <script type="module" crossorigin src="/assets/index-043b20da.js"></script>
<link rel="modulepreload" crossorigin href="/assets/@vue-a481fc63.js"> <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/vue-router-e5a2430e.js">
<link rel="modulepreload" crossorigin href="/assets/vuex-44de225f.js"> <link rel="modulepreload" crossorigin href="/assets/vuex-44de225f.js">

@ -158,7 +158,8 @@ const store = useStore();
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
post: Item.PostProps, post: Item.PostProps,
isOwner: boolean, isOwner: boolean,
addExtraAction: boolean, addFriendAction: boolean,
addFollowAction: boolean,
}>(), {}); }>(), {});
const emit = defineEmits<{ const emit = defineEmits<{
@ -177,20 +178,14 @@ const renderIcon = (icon: Component) => {
const tweetOptions = computed(() => { const tweetOptions = computed(() => {
let options: DropdownOption[] = []; let options: DropdownOption[] = [];
// TODO: f*k 为什么这里会卡? if (!props.isOwner) {
// if (store.state.userinfo.id > 0) {
// options.push({
// label: '私信',
// key: 'whisper',
// icon: renderIcon(PaperPlaneOutline)
// });
// }
options.push({ options.push({
label: '', label: '',
key: 'whisper', key: 'whisper',
icon: renderIcon(PaperPlaneOutline) icon: renderIcon(PaperPlaneOutline)
}); });
if (!props.isOwner && props.addExtraAction) { }
if (!props.isOwner && props.addFollowAction) {
if (props.post.user.is_following) { if (props.post.user.is_following) {
options.push({ options.push({
label: '', label: '',
@ -204,19 +199,21 @@ const tweetOptions = computed(() => {
icon: renderIcon(BodyOutline) icon: renderIcon(BodyOutline)
}) })
} }
// if (props.post.user.is_friend) { }
// options.push({ if (!props.isOwner && props.addFriendAction) {
// label: '删除好友', if (props.post.user.is_friend) {
// key: 'delete', options.push({
// icon: renderIcon(PersonRemoveOutline) label: '',
// }); key: 'delete',
// } else { icon: renderIcon(PersonRemoveOutline)
// options.push({ });
// label: '添加朋友', } else {
// key: 'requesting', options.push({
// icon: renderIcon(PersonAddOutline) label: '',
// }); key: 'requesting',
// } icon: renderIcon(PersonAddOutline)
});
}
} }
options.push({ options.push({
label: '', label: '',

@ -156,7 +156,8 @@ const store = useStore();
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
post: Item.PostProps, post: Item.PostProps,
isOwner: boolean, isOwner: boolean,
addExtraAction: boolean, addFriendAction: boolean,
addFollowAction: boolean,
}>(), {}); }>(), {});
const emit = defineEmits<{ const emit = defineEmits<{
@ -175,20 +176,14 @@ const renderIcon = (icon: Component) => {
const tweetOptions = computed(() => { const tweetOptions = computed(() => {
let options: DropdownOption[] = []; let options: DropdownOption[] = [];
// TODO: f*k 为什么这里会卡? if (!props.isOwner) {
// if (store.state.userinfo.id > 0) {
// options.push({
// label: '私信',
// key: 'whisper',
// icon: renderIcon(PaperPlaneOutline)
// });
// }
options.push({ options.push({
label: '', label: '',
key: 'whisper', key: 'whisper',
icon: renderIcon(PaperPlaneOutline) icon: renderIcon(PaperPlaneOutline)
}); });
if (!props.isOwner && props.addExtraAction) { }
if (!props.isOwner && props.addFollowAction) {
if (props.post.user.is_following) { if (props.post.user.is_following) {
options.push({ options.push({
label: '', label: '',
@ -202,19 +197,21 @@ const tweetOptions = computed(() => {
icon: renderIcon(BodyOutline) icon: renderIcon(BodyOutline)
}) })
} }
// if (props.post.user.is_friend) { }
// options.push({ if (!props.isOwner && props.addFriendAction) {
// label: '删除好友', if (props.post.user.is_friend) {
// key: 'delete', options.push({
// icon: renderIcon(PersonRemoveOutline) label: '',
// }); key: 'delete',
// } else { icon: renderIcon(PersonRemoveOutline)
// options.push({ });
// label: '添加朋友', } else {
// key: 'requesting', options.push({
// icon: renderIcon(PersonAddOutline) label: '',
// }); key: 'requesting',
// } icon: renderIcon(PersonAddOutline)
});
}
} }
options.push({ options.push({
label: '', label: '',

@ -13,12 +13,20 @@
<div v-if="store.state.desktopModelShow"> <div v-if="store.state.desktopModelShow">
<n-list-item v-for="post in list" :key="post.id"> <n-list-item v-for="post in list" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-else> <div v-else>
<n-list-item v-for="post in list" :key="post.id"> <n-list-item v-for="post in list" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
</div> </div>
@ -40,10 +48,12 @@
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { getCollections } from '@/api/user'; import { useDialog } from 'naive-ui';
import { getCollections, followUser, unfollowUser } from '@/api/user';
const store = useStore(); const store = useStore();
const route = useRoute(); const route = useRoute();
const dialog = useDialog();
const loading = ref(false); const loading = ref(false);
const list = ref<any[]>([]); const list = ref<any[]>([]);
@ -74,6 +84,35 @@ const whisperSuccess = () => {
showWhisper.value = false; showWhisper.value = false;
}; };
const onHandleFollowAction = (post: Item.PostProps) => {
dialog.success({
title: '',
content:
'' + (post.user.is_following ? '' : '') + '',
positiveText: '',
negativeText: '',
onPositiveClick: () => {
if (post.user.is_following) {
unfollowUser({
user_id: post.user.id,
}).then((_res) => {
window.$message.success('');
post.user.is_following = false;
})
.catch((_err) => {});
} else {
followUser({
user_id: post.user.id,
}).then((_res) => {
window.$message.success('');
post.user.is_following = true;
})
.catch((_err) => {});
}
},
});
};
const loadPosts = () => { const loadPosts = () => {
loading.value = true; loading.value = true;
getCollections({ getCollections({

@ -41,26 +41,28 @@
<div v-if="store.state.desktopModelShow"> <div v-if="store.state.desktopModelShow">
<n-list-item v-for="post in list" :key="post.id"> <n-list-item v-for="post in list" :key="post.id">
<post-item :post="post" <post-item :post="post"
:isOwner="store.state.userInfo.Id === post.user_id" :isOwner="store.state.userInfo.id == post.user_id"
:addExtraAction="true" :addFollowAction="true"
@send-whisper="onSendWhisper" @send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" /> @handle-follow-action="onHandleFollowAction"
@handle-friend-action="onHandleFriendAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-else> <div v-else>
<n-list-item v-for="post in list" :key="post.id"> <n-list-item v-for="post in list" :key="post.id">
<mobile-post-item :post="post" <mobile-post-item :post="post"
:isOwner="store.state.userInfo.Id === post.user_id" :isOwner="store.state.userInfo.id == post.user_id"
:addExtraAction="true" :addFollowAction="true"
@send-whisper="onSendWhisper" @send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" /> @handle-follow-action="onHandleFollowAction"
@handle-friend-action="onHandleFriendAction" />
</n-list-item> </n-list-item>
</div> </div>
</div> </div>
<!-- --> <!-- -->
<whisper :show="showWhisper" :user="whisperReceiver" @success="whisperSuccess" /> <whisper :show="showWhisper" :user="whisperReceiver" @success="whisperSuccess" />
<!-- --> <!-- -->
<!-- <whisper-add-friend :show="showAddFriendWhisper" :user="user" @success="addFriendWhisperSuccess" /> --> <whisper-add-friend :show="showAddFriendWhisper" :user="user" @success="addFriendWhisperSuccess" />
</n-list> </n-list>
<n-space v-if="totalPage > 0" justify="center"> <n-space v-if="totalPage > 0" justify="center">

@ -77,54 +77,94 @@
<div v-if="store.state.desktopModelShow"> <div v-if="store.state.desktopModelShow">
<div v-if="pageType === 'post'"> <div v-if="pageType === 'post'">
<n-list-item v-for="post in postList" :key="post.id"> <n-list-item v-for="post in postList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'comment'"> <div v-if="pageType === 'comment'">
<n-list-item v-for="post in commentList" :key="post.id"> <n-list-item v-for="post in commentList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'highlight'"> <div v-if="pageType === 'highlight'">
<n-list-item v-for="post in highlightList" :key="post.id"> <n-list-item v-for="post in highlightList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'media'"> <div v-if="pageType === 'media'">
<n-list-item v-for="post in mediaList" :key="post.id"> <n-list-item v-for="post in mediaList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'star'"> <div v-if="pageType === 'star'">
<n-list-item v-for="post in starList" :key="post.id"> <n-list-item v-for="post in starList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div v-if="pageType === 'post'"> <div v-if="pageType === 'post'">
<n-list-item v-for="post in postList" :key="post.id"> <n-list-item v-for="post in postList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'comment'"> <div v-if="pageType === 'comment'">
<n-list-item v-for="post in commentList" :key="post.id"> <n-list-item v-for="post in commentList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'highlight'"> <div v-if="pageType === 'highlight'">
<n-list-item v-for="post in highlightList" :key="post.id"> <n-list-item v-for="post in highlightList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'media'"> <div v-if="pageType === 'media'">
<n-list-item v-for="post in mediaList" :key="post.id"> <n-list-item v-for="post in mediaList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'star'"> <div v-if="pageType === 'star'">
<n-list-item v-for="post in starList" :key="post.id"> <n-list-item v-for="post in starList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
</div> </div>
@ -150,12 +190,14 @@
import { ref, onMounted, watch } from 'vue'; import { ref, onMounted, watch } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { getUserPosts } from '@/api/user'; import { useDialog } from 'naive-ui';
import { getUserPosts, followUser, unfollowUser } from '@/api/user';
import { formatDate } from '@/utils/formatTime'; import { formatDate } from '@/utils/formatTime';
import InfiniteLoading from "v3-infinite-loading"; import InfiniteLoading from "v3-infinite-loading";
const store = useStore(); const store = useStore();
const route = useRoute(); const route = useRoute();
const dialog = useDialog();
const loading = ref(false); const loading = ref(false);
const noMore = ref(false); const noMore = ref(false);
const list = ref<Item.PostProps[]>([]); const list = ref<Item.PostProps[]>([]);
@ -202,6 +244,35 @@ const whisperSuccess = () => {
showWhisper.value = false; showWhisper.value = false;
}; };
const onHandleFollowAction = (post: Item.PostProps) => {
dialog.success({
title: '',
content:
'' + (post.user.is_following ? '' : '') + '',
positiveText: '',
negativeText: '',
onPositiveClick: () => {
if (post.user.is_following) {
unfollowUser({
user_id: post.user.id,
}).then((_res) => {
window.$message.success('');
post.user.is_following = false;
})
.catch((_err) => {});
} else {
followUser({
user_id: post.user.id,
}).then((_res) => {
window.$message.success('');
post.user.is_following = true;
})
.catch((_err) => {});
}
},
});
};
const loadPage = () => { const loadPage = () => {
switch(pageType.value) { switch(pageType.value) {
case "post": case "post":

@ -104,54 +104,94 @@
<div v-if="store.state.desktopModelShow"> <div v-if="store.state.desktopModelShow">
<div v-if="pageType === 'post'"> <div v-if="pageType === 'post'">
<n-list-item v-for="post in postList" :key="post.id"> <n-list-item v-for="post in postList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'comment'"> <div v-if="pageType === 'comment'">
<n-list-item v-for="post in commentList" :key="post.id"> <n-list-item v-for="post in commentList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'highlight'"> <div v-if="pageType === 'highlight'">
<n-list-item v-for="post in highlightList" :key="post.id"> <n-list-item v-for="post in highlightList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'media'"> <div v-if="pageType === 'media'">
<n-list-item v-for="post in mediaList" :key="post.id"> <n-list-item v-for="post in mediaList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'star'"> <div v-if="pageType === 'star'">
<n-list-item v-for="post in starList" :key="post.id"> <n-list-item v-for="post in starList" :key="post.id">
<post-item :post="post" @send-whisper="onSendWhisper" /> <post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div v-if="pageType === 'post'"> <div v-if="pageType === 'post'">
<n-list-item v-for="post in postList" :key="post.id"> <n-list-item v-for="post in postList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'comment'"> <div v-if="pageType === 'comment'">
<n-list-item v-for="post in commentList" :key="post.id"> <n-list-item v-for="post in commentList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'highlight'"> <div v-if="pageType === 'highlight'">
<n-list-item v-for="post in highlightList" :key="post.id"> <n-list-item v-for="post in highlightList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'media'"> <div v-if="pageType === 'media'">
<n-list-item v-for="post in mediaList" :key="post.id"> <n-list-item v-for="post in mediaList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
<div v-if="pageType === 'star'"> <div v-if="pageType === 'star'">
<n-list-item v-for="post in starList" :key="post.id"> <n-list-item v-for="post in starList" :key="post.id">
<mobile-post-item :post="post" @send-whisper="onSendWhisper" /> <mobile-post-item :post="post"
:isOwner="store.state.userInfo.id == post.user_id"
:addFollowAction="true"
@send-whisper="onSendWhisper"
@handle-follow-action="onHandleFollowAction" />
</n-list-item> </n-list-item>
</div> </div>
</div> </div>
@ -246,6 +286,35 @@ const onSendWhisper = (receiver: Item.UserInfo) => {
showWhisper.value = true; showWhisper.value = true;
}; };
const onHandleFollowAction = (post: Item.PostProps) => {
dialog.success({
title: '',
content:
'' + (post.user.is_following ? '' : '') + '',
positiveText: '',
negativeText: '',
onPositiveClick: () => {
if (post.user.is_following) {
unfollowUser({
user_id: post.user.id,
}).then((_res) => {
window.$message.success('');
post.user.is_following = false;
})
.catch((_err) => {});
} else {
followUser({
user_id: post.user.id,
}).then((_res) => {
window.$message.success('');
post.user.is_following = true;
})
.catch((_err) => {});
}
},
});
};
const reset = () => { const reset = () => {
noMore.value = false; noMore.value = false;
list.value = []; list.value = [];

Loading…
Cancel
Save