Merge branch 'x/gorm' into x/sqlx

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

@ -6,6 +6,7 @@ All notable changes to paopao-ce are documented in this file.
- add `pprof` feature support [#327](https://github.com/rocboss/paopao-ce/pull/327)
- use compiler profile-guided optimization (PGO) to further optimize builds. [#327](https://github.com/rocboss/paopao-ce/pull/327)
- frontend: re-add stars page embed to profile page. [#339](https://github.com/rocboss/paopao-ce/pull/339)
- simple support for user posts filter by style(post/comment/media/star). [#345](https://github.com/rocboss/paopao-ce/pull/345)
### Changed
- change man content width to 600px and optimize tweet/comment/replay text length. [#333](https://github.com/rocboss/paopao-ce/pull/333)

@ -20,6 +20,13 @@ const (
TagTypeHotExtral = cs.TagTypeHotExtral
)
const (
UserPostsStylePost = "post"
UserPostsStyleComment = "comment"
UserPostsStyleMedia = "media"
UserPostsStyleStar = "star"
)
type TagType = cs.TagType
type TweetCommentsReq struct {
@ -46,6 +53,7 @@ type TimelineResp base.PageResp
type GetUserTweetsReq struct {
BaseInfo `form:"-" binding:"-"`
Username string `form:"username" binding:"required"`
Style string `form:"style"`
Page int `form:"-" binding:"-"`
PageSize int `form:"-" binding:"-"`
}

@ -61,7 +61,81 @@ func (s *looseSrv) Timeline(req *web.TimelineReq) (*web.TimelineResp, mir.Error)
return (*web.TimelineResp)(resp), nil
}
func (s *looseSrv) GetUserTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) {
func (s *looseSrv) GetUserTweets(req *web.GetUserTweetsReq) (res *web.GetUserTweetsResp, err mir.Error) {
isSelf := (req.User != nil && req.User.Username == req.Username)
switch req.Style {
case web.UserPostsStyleComment:
res, err = s.getUserCommentTweets(req, isSelf)
case web.UserPostsStyleMedia:
res, err = s.getUserMediaTweets(req, isSelf)
case web.UserPostsStyleStar:
res, err = s.getUserStarTweets(req, isSelf)
case web.UserPostsStylePost:
fallthrough
default:
res, err = s.getUserPostTweets(req)
}
return
}
func (s *looseSrv) getUserCommentTweets(req *web.GetUserTweetsReq, isSelf bool) (*web.GetUserTweetsResp, mir.Error) {
// TODO: add implement logic
resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0)
return (*web.GetUserTweetsResp)(resp), nil
}
func (s *looseSrv) getUserMediaTweets(req *web.GetUserTweetsReq, isSelf bool) (*web.GetUserTweetsResp, mir.Error) {
// TODO: add implement logic
resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0)
return (*web.GetUserTweetsResp)(resp), nil
}
func (s *looseSrv) getUserStarTweets(req *web.GetUserTweetsReq, isSelf bool) (*web.GetUserTweetsResp, mir.Error) {
if isSelf {
return s.getSelfStarTweets(req)
}
// TODO: add implement logic for not self star tweets
resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0)
return (*web.GetUserTweetsResp)(resp), nil
}
func (s *looseSrv) getSelfCommentTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) {
// TODO: add implement logic
resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0)
return (*web.GetUserTweetsResp)(resp), nil
}
func (s *looseSrv) getSelfMediaTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) {
// TODO: add implement logic
resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0)
return (*web.GetUserTweetsResp)(resp), nil
}
func (s *looseSrv) getSelfStarTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) {
stars, err := s.Ds.GetUserPostStars(req.User.ID, (req.Page-1)*req.PageSize, req.PageSize)
if err != nil {
logrus.Errorf("Ds.GetUserPostStars err: %s", err)
return nil, web.ErrGetStarsFailed
}
totalRows, err := s.Ds.GetUserPostStarCount(req.User.ID)
if err != nil {
logrus.Errorf("Ds.GetUserPostStars err: %s", err)
return nil, web.ErrGetStarsFailed
}
var posts []*core.Post
for _, star := range stars {
posts = append(posts, star.Post)
}
postsFormated, err := s.Ds.MergePosts(posts)
if err != nil {
logrus.Errorf("Ds.MergePosts err: %s", err)
return nil, web.ErrGetStarsFailed
}
resp := base.PageRespFrom(postsFormated, req.Page, req.PageSize, totalRows)
return (*web.GetUserTweetsResp)(resp), nil
}
func (s *looseSrv) getUserPostTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) {
other, xerr := s.GetUserProfile(&web.GetUserProfileReq{
BaseInfo: req.BaseInfo,
Username: req.Username,

@ -21,9 +21,6 @@ type Loose struct {
// GetUserTweets 获取用户动态列表
GetUserTweets func(Get, web.GetUserTweetsReq) web.GetUserTweetsResp `mir:"/user/posts"`
// GetUserProfile 获取用户基本信息
GetUserProfile func(Get, web.GetUserProfileReq) web.GetUserProfileResp `mir:"/user/profile"`
// TopicList 获取话题列表
TopicList func(Get, web.TopicListReq) web.TopicListResp `mir:"/tags"`

@ -1 +1 @@
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-9bd717cc.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-4ee34f7b.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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-6cf23d92.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-3c28566e.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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};

@ -1 +1 @@
import{_ as F}from"./post-skeleton-852fbfbe.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-9bd717cc.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-4ee34f7b.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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 G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.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?(e(),o("div",H,[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(I,null,L(r.value,t=>(e(),M(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:O({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(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default};
import{_ as F}from"./post-skeleton-e5dbbb21.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-6cf23d92.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-3c28566e.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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 G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.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?(e(),o("div",H,[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(I,null,L(r.value,t=>(e(),M(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:O({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(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default};

@ -0,0 +1 @@
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-de434903.js";import{_ as V}from"./post-skeleton-e5dbbb21.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-6cf23d92.js";import{u as I}from"./vuex-473b3783.js";import{b as N}from"./vue-router-b8e3382f.js";import{K as R,_ as j}from"./index-3c28566e.js";import{d as q,r as s,j as E,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as G,G as H,I as K,H as L}from"./naive-ui-62663ad7.js";import"./content-42ac00bc.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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 O={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={key:1},A={key:2},D={key:0,class:"pagination-wrap"},J=q({__name:"Collection",setup(W){const m=I(),y=N(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(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 E(()=>{u()}),(n,X)=>{const C=$,b=V,x=K,z=P,d=L,B=S,F=G,M=H;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",O,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",Q,[i.value.length===0?(t(),o("div",T,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",U,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},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 Mt=j(J,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};

@ -1 +0,0 @@
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-2a15a53c.js";import{_ as V}from"./post-skeleton-852fbfbe.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-9bd717cc.js";import{u as I}from"./vuex-473b3783.js";import{b as L}from"./vue-router-b8e3382f.js";import{L as N,_ as R}from"./index-4ee34f7b.js";import{d as j,r as s,j as q,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as E,G,I as H,H as O}from"./naive-ui-62663ad7.js";import"./content-9a833cfa.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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 Q={key:0,class:"skeleton-wrap"},T={key:1},U={key:0,class:"empty-wrap"},A={key:1},D={key:2},J={key:0,class:"pagination-wrap"},K=j({__name:"Collection",setup(W){const m=I(),y=L(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,N({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 q(()=>{u()}),(n,X)=>{const C=$,b=V,x=H,z=P,d=O,B=S,F=E,M=G;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",Q,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",T,[i.value.length===0?(t(),o("div",U,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",D,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",J,[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 Mt=R(K,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};

@ -1 +1 @@
import{u as N,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as O,I as T,H as j}from"./naive-ui-62663ad7.js";import{_ as b,O as E}from"./index-4ee34f7b.js";import{_ as G}from"./post-skeleton-852fbfbe.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-9bd717cc.js";import{u as L}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.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-d502290a.js";/* empty css */const Q={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=N(),u=t=>{l.push({name:"user",query:{username:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",Q,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-08ee9b2e"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=L(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),E({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=H,I=G,z=T,B=X,V=j,F=D,M=O;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(V,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(M,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default};
import{u as M,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as T,I as j,H as E}from"./naive-ui-62663ad7.js";import{_ as b,N as G}from"./index-3c28566e.js";import{_ as H}from"./post-skeleton-e5dbbb21.js";import{_ as L}from"./main-nav.vue_vue_type_style_index_0_lang-6cf23d92.js";import{u as O}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.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-d502290a.js";/* empty css */const Q={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=M(),u=t=>{l.push({name:"user",query:{username:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",Q,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-08ee9b2e"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=O(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),G({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=L,I=H,z=j,B=X,N=E,V=D,F=T;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(V,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(N,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(F,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt 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

@ -0,0 +1 @@
import{_ as O,a as Q}from"./post-item.vue_vue_type_style_index_0_lang-de434903.js";import{_ as J}from"./post-skeleton-e5dbbb21.js";import{_ as K}from"./main-nav.vue_vue_type_style_index_0_lang-6cf23d92.js";import{u as W}from"./vuex-473b3783.js";import{b as X}from"./vue-router-b8e3382f.js";import{A as g,_ as Y}from"./index-3c28566e.js";import{d as Z,r,j as ee,w as ae,c,V as o,_ as i,Q as M,a1 as h,O as T,o as n,a as _,M as z,F as U,a4 as V}from"./@vue-e0e89260.js";import{F as te,G as se,o as oe,f as ne,g as le,I as re,H as ue}from"./naive-ui-62663ad7.js";import"./content-42ac00bc.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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 ce={class:"profile-baseinfo"},ie={class:"avatar"},_e={class:"base-info"},pe={class:"username"},me={class:"uid"},ve={key:0,class:"skeleton-wrap"},de={key:1},fe={key:0,class:"empty-wrap"},ge={key:1},he={key:2},be={key:1,class:"pagination-wrap"},ke=Z({__name:"Profile",setup(ye){const s=W(),p=X(),t=r(!1),l=r([]),d=r("post"),q=r(+p.query.p||1),x=r(1),S=r(1),B=r(1),a=r(+p.query.p||1),u=r(20),m=r(0),b=()=>{switch(d.value){case"post":k();break;case"comment":y();break;case"media":w();break;case"star":P();break}},k=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"post",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},y=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"comment",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},w=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"media",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},P=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"star",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},$=e=>{switch(d.value=e,d.value){case"post":a.value=q.value,k();break;case"comment":a.value=x.value,y();break;case"media":a.value=S.value,w();break;case"star":a.value=B.value,P();break}},F=e=>{switch(a.value=e,d.value){case"post":q.value=e,k();break;case"comment":x.value=a.value,y();break;case"media":S.value=a.value,w();break;case"star":B.value=a.value,P();break}};return ee(()=>{b()}),ae(()=>({path:p.path,query:p.query,refresh:s.state.refresh}),(e,I)=>{if(e.refresh!==I.refresh){a.value=+p.query.p||1,setTimeout(()=>{b()},0);return}I.path!=="/post"&&e.path==="/profile"&&(a.value=+p.query.p||1,setTimeout(()=>{b()},0))}),(e,I)=>{const N=K,D=oe,f=ne,R=le,j=J,A=re,E=O,C=ue,G=Q,H=te,L=se;return n(),c("div",null,[o(N,{title:"主页"}),i(s).state.userInfo.id>0?(n(),M(H,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:h(()=>[_("div",ce,[_("div",ie,[o(D,{size:"large",src:i(s).state.userInfo.avatar},null,8,["src"])]),_("div",_e,[_("div",pe,[_("strong",null,z(i(s).state.userInfo.nickname),1),_("span",null," @"+z(i(s).state.userInfo.username),1)]),_("div",me,"UID. "+z(i(s).state.userInfo.id),1)])]),o(R,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":$},{default:h(()=>[o(f,{name:"post",tab:"泡泡"}),o(f,{name:"comment",tab:"评论"}),o(f,{name:"media",tab:"媒体"}),o(f,{name:"star",tab:"喜欢"})]),_:1}),t.value?(n(),c("div",ve,[o(j,{num:u.value},null,8,["num"])])):(n(),c("div",de,[l.value.length===0?(n(),c("div",fe,[o(A,{size:"large",description:"暂无数据"})])):T("",!0),i(s).state.desktopModelShow?(n(),c("div",ge,[(n(!0),c(U,null,V(l.value,v=>(n(),M(C,{key:v.id},{default:h(()=>[o(E,{post:v},null,8,["post"])]),_:2},1024))),128))])):(n(),c("div",he,[(n(!0),c(U,null,V(l.value,v=>(n(),M(C,{key:v.id},{default:h(()=>[o(G,{post:v},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1})):T("",!0),m.value>0?(n(),c("div",be,[o(L,{page:a.value,"onUpdate:page":F,"page-slot":i(s).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):T("",!0)])}}});const Ye=Y(ke,[["__scopeId","data-v-b9a7b9d3"]]);export{Ye as default};

@ -1 +0,0 @@
.profile-baseinfo[data-v-d6cf5ae7]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-d6cf5ae7]{width:55px}.profile-baseinfo .base-info[data-v-d6cf5ae7]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-d6cf5ae7]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-d6cf5ae7]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-tabs-wrap[data-v-d6cf5ae7]{padding:0 16px}.pagination-wrap[data-v-d6cf5ae7]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-d6cf5ae7]{background-color:#18181c}.dark .profile-wrap[data-v-d6cf5ae7],.dark .pagination-wrap[data-v-d6cf5ae7]{background-color:#101014bf}

@ -0,0 +1 @@
.profile-baseinfo[data-v-b9a7b9d3]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-b9a7b9d3]{width:55px}.profile-baseinfo .base-info[data-v-b9a7b9d3]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-b9a7b9d3]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-b9a7b9d3]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-tabs-wrap[data-v-b9a7b9d3]{padding:0 16px}.pagination-wrap[data-v-b9a7b9d3]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-b9a7b9d3]{background-color:#18181c}.dark .profile-wrap[data-v-b9a7b9d3],.dark .pagination-wrap[data-v-b9a7b9d3]{background-color:#101014bf}

@ -1 +0,0 @@
import{_ as A,a as E}from"./post-item.vue_vue_type_style_index_0_lang-2a15a53c.js";import{_ as G}from"./post-skeleton-852fbfbe.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-9bd717cc.js";import{u as L}from"./vuex-473b3783.js";import{b as O}from"./vue-router-b8e3382f.js";import{A as Q,B as J,_ as K}from"./index-4ee34f7b.js";import{d as W,r as l,j as X,w as Y,c as n,V as a,_,Q as w,a1 as f,O as P,o as t,a as i,M as b,F as x,a4 as z}from"./@vue-e0e89260.js";import{F as Z,G as ee,o as te,f as ae,g as oe,I as se,H as ne}from"./naive-ui-62663ad7.js";import"./content-9a833cfa.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.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 le={class:"profile-baseinfo"},re={class:"avatar"},_e={class:"base-info"},ie={class:"username"},pe={class:"uid"},ue={key:0,class:"skeleton-wrap"},ce={key:1},me={key:0,class:"empty-wrap"},de={key:1},ve={key:2},fe={key:1,class:"pagination-wrap"},ge=W({__name:"Profile",setup(he){const o=L(),p=O(),r=l(!1),u=l([]),c=l("post"),I=l(+p.query.p||1),q=l(1),s=l(+p.query.p||1),m=l(20),v=l(0),g=()=>{c.value=="post"?h():(c.value="star")&&y()},h=()=>{r.value=!0,Q({username:o.state.userInfo.username,page:s.value,page_size:m.value}).then(e=>{r.value=!1,u.value=e.list,v.value=Math.ceil(e.pager.total_rows/m.value),window.scrollTo(0,0)}).catch(e=>{r.value=!1})},y=()=>{r.value=!0,J({page:s.value,page_size:m.value}).then(e=>{r.value=!1,u.value=e.list,v.value=Math.ceil(e.pager.total_rows/m.value),window.scrollTo(0,0)}).catch(e=>{r.value=!1})},B=e=>{c.value=e,e=="post"?(s.value=I.value,h()):e=="star"&&(s.value=q.value,y())},M=e=>{s.value=e,c.value=="post"?(I.value=e,h()):c.value=="star"&&(q.value=s.value,y())};return X(()=>{g()}),Y(()=>({path:p.path,query:p.query,refresh:o.state.refresh}),(e,k)=>{if(e.refresh!==k.refresh){s.value=+p.query.p||1,setTimeout(()=>{g()},0);return}k.path!=="/post"&&e.path==="/profile"&&(s.value=+p.query.p||1,setTimeout(()=>{g()},0))}),(e,k)=>{const U=H,V=te,S=ae,$=oe,C=G,F=se,N=A,T=ne,D=E,R=Z,j=ee;return t(),n("div",null,[a(U,{title:"主页"}),_(o).state.userInfo.id>0?(t(),w(R,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:f(()=>[i("div",le,[i("div",re,[a(V,{size:"large",src:_(o).state.userInfo.avatar},null,8,["src"])]),i("div",_e,[i("div",ie,[i("strong",null,b(_(o).state.userInfo.nickname),1),i("span",null," @"+b(_(o).state.userInfo.username),1)]),i("div",pe,"UID. "+b(_(o).state.userInfo.id),1)])]),a($,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":B},{default:f(()=>[a(S,{name:"post",tab:"泡泡"}),a(S,{name:"star",tab:"点赞"})]),_:1}),r.value?(t(),n("div",ue,[a(C,{num:m.value},null,8,["num"])])):(t(),n("div",ce,[u.value.length===0?(t(),n("div",me,[a(F,{size:"large",description:"暂无数据"})])):P("",!0),_(o).state.desktopModelShow?(t(),n("div",de,[(t(!0),n(x,null,z(u.value,d=>(t(),w(T,{key:d.id},{default:f(()=>[a(N,{post:d},null,8,["post"])]),_:2},1024))),128))])):(t(),n("div",ve,[(t(!0),n(x,null,z(u.value,d=>(t(),w(T,{key:d.id},{default:f(()=>[a(D,{post:d},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1})):P("",!0),v.value>0?(t(),n("div",fe,[a(j,{page:s.value,"onUpdate:page":M,"page-slot":_(o).state.collapsedRight?5:8,"page-count":v.value},null,8,["page","page-slot","page-count"])])):P("",!0)])}}});const Ke=K(ge,[["__scopeId","data-v-d6cf5ae7"]]);export{Ke as default};

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{w as F,x as z,y as I,z as j,_ as E}from"./index-4ee34f7b.js";import{p as U}from"./@vicons-d502290a.js";import{d as $,r as i,n as q,j as A,a3 as x,o as c,c as _,V as n,a1 as s,Q as b,e as V,M as f,O as u,_ as h,w as D,a7 as P,F as Q,a4 as G}from"./@vue-e0e89260.js";import{o as H,O as B,j as J,e as K,P as R,M as W,F as X,f as Y,g as Z,a as ee,k as oe}from"./naive-ui-62663ad7.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-9bd717cc.js";import{u as ne}from"./vuex-473b3783.js";import"./vue-router-b8e3382f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.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=$({__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":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":z({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":F({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":F({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=x("router-link"),g=H,k=B,a=J,d=K,v=R,p=W;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(()=>[V(" #"+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(U))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}});const _e=$({__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=q({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,j({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=Y,C=B,L=Z,M=ie,N=ee,O=oe,S=X;return c(),_("div",null,[n(v,{title:"话题"}),n(S,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(L,{type:"line",animated:"","onUpdate:value":k},P({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(C,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[V(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(O,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(Q,null,G(r.value,y=>(c(),b(M,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Me=E(_e,[["__scopeId","data-v-15794a53"]]);export{Me as default};
import{w as F,x as z,y as I,z as j,_ as E}from"./index-3c28566e.js";import{p as U}from"./@vicons-d502290a.js";import{d as $,r as i,n as q,j as A,a3 as x,o as c,c as _,V as n,a1 as s,Q as b,e as V,M as f,O as u,_ as h,w as D,a7 as P,F as Q,a4 as G}from"./@vue-e0e89260.js";import{o as H,O as B,j as J,e as K,P as R,M as W,F as X,f as Y,g as Z,a as ee,k as oe}from"./naive-ui-62663ad7.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-6cf23d92.js";import{u as ne}from"./vuex-473b3783.js";import"./vue-router-b8e3382f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.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=$({__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":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":z({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":F({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":F({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=x("router-link"),g=H,k=B,a=J,d=K,v=R,p=W;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(()=>[V(" #"+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(U))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}});const _e=$({__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=q({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,j({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=Y,C=B,L=Z,M=ie,N=ee,O=oe,S=X;return c(),_("div",null,[n(v,{title:"话题"}),n(S,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(L,{type:"line",animated:"","onUpdate:value":k},P({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(C,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[V(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(O,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(Q,null,G(r.value,y=>(c(),b(M,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Me=E(_e,[["__scopeId","data-v-15794a53"]]);export{Me as default};

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.whisper-wrap .whisper-line[data-v-0cbfe47c]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-0cbfe47c]{width:100%}.dark .whisper-wrap[data-v-0cbfe47c]{background-color:#101014bf}.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-4aadb856]{padding:0 16px}.profile-baseinfo[data-v-4aadb856]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-4aadb856]{width:55px}.profile-baseinfo .base-info[data-v-4aadb856]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-4aadb856]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-4aadb856]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .top-tag[data-v-4aadb856]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-4aadb856]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-4aadb856]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-4aadb856]{background-color:#18181c}.dark .profile-wrap[data-v-4aadb856],.dark .pagination-wrap[data-v-4aadb856]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
.whisper-wrap .whisper-line[data-v-0cbfe47c]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-0cbfe47c]{width:100%}.dark .whisper-wrap[data-v-0cbfe47c]{background-color:#101014bf}.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-31cfec9c]{padding:0 16px}.profile-baseinfo[data-v-31cfec9c]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-31cfec9c]{width:55px}.profile-baseinfo .base-info[data-v-31cfec9c]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-31cfec9c]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-31cfec9c]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .top-tag[data-v-31cfec9c]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-31cfec9c]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-31cfec9c]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-31cfec9c]{background-color:#18181c}.dark .profile-wrap[data-v-31cfec9c],.dark .pagination-wrap[data-v-31cfec9c]{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{$ as B}from"./index-4ee34f7b.js";import{u as E}from"./vuex-473b3783.js";import{u as S}from"./vue-router-b8e3382f.js";import{j as A}from"./vooks-a50491fd.js";import{D as C,y as D,z as N,F as P}from"./@vicons-d502290a.js";import{a3 as R,a4 as V,j as I,e as j,a5 as x,h as F}from"./naive-ui-62663ad7.js";import{d as H,r as h,j as $,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as q,Q as _,e as L,M as U,F as Q}from"./@vue-e0e89260.js";const G={key:0},J={class:"navbar"},oe=H({__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(A()==="dark")}),(s,d)=>{const y=B,b=R,O=V,r=I,p=j,M=x,T=F;return a(),f(Q,null,[o(n).state.drawerModelShow?(a(),f("div",G,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=z=>l.value=z),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[q("div",J,[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(D))]),_: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(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};
import{Z as B}from"./index-3c28566e.js";import{u as E}from"./vuex-473b3783.js";import{u as S}from"./vue-router-b8e3382f.js";import{j as A}from"./vooks-a50491fd.js";import{D as C,y as D,z as N,F as P}from"./@vicons-d502290a.js";import{a3 as R,a4 as V,j as I,e as j,a5 as x,h as F}from"./naive-ui-62663ad7.js";import{d as H,r as h,j as q,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as L,Q as _,e as U,M as $,F as Q}from"./@vue-e0e89260.js";const Z={key:0},G={class:"navbar"},oe=H({__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 q(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(s,d)=>{const y=B,b=R,O=V,r=I,p=j,M=x,T=F;return a(),f(Q,null,[o(n).state.drawerModelShow?(a(),f("div",Z,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=z=>l.value=z),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[L("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(D))]),_:1})]),_:1})):c("",!0),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(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};

@ -1 +1 @@
import{U as r}from"./naive-ui-62663ad7.js";import{d as c,o as s,c as n,a4 as p,a as o,V as t,F as l}from"./@vue-e0e89260.js";import{_ as i}from"./index-4ee34f7b.js";const m={class:"user"},d={class:"content"},u=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",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _};
import{U as r}from"./naive-ui-62663ad7.js";import{d as c,o as s,c as n,a4 as p,a as o,V as t,F as l}from"./@vue-e0e89260.js";import{_ as i}from"./index-3c28566e.js";const m={class:"user"},d={class:"content"},u=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",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__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-4ee34f7b.js"></script>
<script type="module" crossorigin src="/assets/index-3c28566e.js"></script>
<link rel="modulepreload" crossorigin href="/assets/@vue-e0e89260.js">
<link rel="modulepreload" crossorigin href="/assets/vue-router-b8e3382f.js">
<link rel="modulepreload" crossorigin href="/assets/vuex-473b3783.js">

@ -225,17 +225,6 @@ export const getCollections = (
});
};
/** 获取点赞列表 */
export const getStars = (
params: NetParams.UserGetStars
): Promise<NetReq.UserGetStars> => {
return request({
method: "get",
url: "/v1/user/stars",
params,
});
};
/** 获取用户基础信息 */
export const getUserProfile = (
params: NetParams.UserGetUserProfile

@ -27,11 +27,6 @@ declare module NetParams {
page_size: number;
}
interface UserGetStars {
page: number,
page_size: number
}
interface UserPrecheckAttachment {
id: number;
}
@ -40,7 +35,7 @@ declare module NetParams {
id: number;
}
interface UserGetUnreadMsgCount { }
interface UserGetUnreadMsgCount {}
interface UserGetMessages {
page: number;
@ -48,8 +43,8 @@ declare module NetParams {
}
interface UserGetUserPosts {
/** 用户名 */
username: string;
style: string;
page: number;
page_size: number;
}
@ -87,7 +82,7 @@ declare module NetParams {
imgCaptcha: string;
}
interface UserGetCaptcha { }
interface UserGetCaptcha {}
interface UserWhisper {
user_id: number;
@ -182,7 +177,7 @@ declare module NetParams {
page_size?: number;
}
interface GetContacts { }
interface GetContacts {}
interface PostCreatePost {
/** 帖子内容列表 */

@ -55,13 +55,6 @@ declare module NetReq {
pager: Item.PagerProps;
}
interface UserGetStars {
/** 帖子列表 */
list: Item.PostProps[];
/** 页码信息 */
pager: Item.PagerProps;
}
type UserGetUserProfile = Item.UserInfo;
interface UserGetBills {

@ -22,7 +22,9 @@
</div>
<n-tabs class="profile-tabs-wrap" type="line" animated @update:value="changeTab">
<n-tab-pane name="post" tab="泡泡"> </n-tab-pane>
<n-tab-pane name="star" tab="点赞"> </n-tab-pane>
<n-tab-pane name="comment" tab="评论"> </n-tab-pane>
<n-tab-pane name="media" tab="媒体"> </n-tab-pane>
<n-tab-pane name="star" tab="喜欢"> </n-tab-pane>
</n-tabs>
<div v-if="loading" class="skeleton-wrap">
<post-skeleton :num="pageSize" />
@ -60,80 +62,154 @@
import { ref, onMounted, watch } from 'vue';
import { useStore } from 'vuex';
import { useRoute } from 'vue-router';
import { getUserPosts, getStars } from '@/api/user';
import { getUserPosts } from '@/api/user';
const store = useStore();
const route = useRoute();
const loading = ref(false);
const list = ref<Item.PostProps[]>([]);
const pageType = ref<"post" | "star">('post');
const pageType = ref<"post" | "comment" | "media" | "star">('post');
const postPage = ref(+(route.query.p as string) || 1);
const commentPage = ref(1)
const mediaPage = ref(1)
const starPage = ref(1);
const page = ref(+(route.query.p as string) || 1);
const pageSize = ref(20);
const totalPage = ref(0);
const loadPage = () => {
if (pageType.value == "post") {
loadPosts()
} else if (pageType.value = "star") {
loadStars()
}
switch(pageType.value) {
case "post":
loadPosts();
break;
case "comment":
loadCommentPosts();
break;
case "media":
loadMediaPosts();
break;
case "star":
loadStarPosts();
break;
}
};
const loadPosts = () => {
loading.value = true;
getUserPosts({
username: store.state.userInfo.username,
style: "post",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const loadStars = () => {
const loadCommentPosts = () => {
loading.value = true;
getStars({
getUserPosts({
username: store.state.userInfo.username,
style: "comment",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const loadMediaPosts = () => {
loading.value = true;
getUserPosts({
username: store.state.userInfo.username,
style: "media",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const loadStarPosts = () => {
loading.value = true;
getUserPosts({
username: store.state.userInfo.username,
style: "star",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const changeTab = (tab: "post" | "star") => {
const changeTab = (tab: "post" | "comment" | "media" | "star") => {
pageType.value = tab;
if (tab == "post") {
page.value = postPage.value
loadPosts();
} else if (tab == "star") {
page.value = starPage.value
loadStars();
switch(pageType.value) {
case "post":
page.value = postPage.value
loadPosts();
break;
case "comment":
page.value = commentPage.value
loadCommentPosts();
break;
case "media":
page.value = mediaPage.value
loadMediaPosts();
break;
case "star":
page.value = starPage.value
loadStarPosts();
break;
}
};
const updatePage = (p: number) => {
page.value = p;
if (pageType.value == "post") {
postPage.value = p
loadPosts();
} else if (pageType.value == "star") {
starPage.value = page.value
loadStars();
switch(pageType.value) {
case "post":
postPage.value = p
loadPosts();
break;
case "comment":
commentPage.value = page.value
loadCommentPosts();
break;
case "media":
mediaPage.value = page.value
loadMediaPosts();
break;
case "star":
starPage.value = page.value
loadStarPosts();
break;
}
};
onMounted(() => {

@ -46,9 +46,11 @@
<!-- -->
<whisper-add-friend :show="showAddFriendWhisper" :user="user" @success="addFriendWhisperSuccess" />
</n-spin>
<n-tabs class="profile-tabs-wrap" animated>
<n-tab-pane name="post" tab="泡泡" />
<!-- <n-tab-pane name="comment" tab="评论"> </n-tab-pane> -->
<n-tabs class="profile-tabs-wrap" type="line" animated @update:value="changeTab">
<n-tab-pane name="post" tab="泡泡"> </n-tab-pane>
<n-tab-pane name="comment" tab="评论"> </n-tab-pane>
<n-tab-pane name="media" tab="媒体"> </n-tab-pane>
<n-tab-pane name="star" tab="喜欢"> </n-tab-pane>
</n-tabs>
<div v-if="loading" class="skeleton-wrap">
<post-skeleton :num="pageSize" />
@ -85,12 +87,10 @@ import { ref, reactive, watch, onMounted, computed } from 'vue';
import { useStore } from 'vuex';
import { useRoute } from 'vue-router';
import { getUserProfile, getUserPosts, changeUserStatus, deleteFriend } from '@/api/user';
import { useDialog, useMessage, DropdownOption } from 'naive-ui';
import { useDialog, DropdownOption } from 'naive-ui';
import WhisperAddFriend from '../components/whisper-add-friend.vue';
import { MoreHorizFilled } from '@vicons/material';
import { VisibilityEnum } from '@/utils/IEnum';
const message = useMessage();
const dialog = useDialog();
const store = useStore();
const route = useRoute();
@ -111,27 +111,127 @@ const showAddFriendWhisper = ref(false);
const list = ref<Item.PostProps[]>([]);
const username = ref(route.query.username || '');
const page = ref(+(route.query.p as string) || 1);
const pageType = ref<"post" | "comment" | "media" | "star">('post');
const postPage = ref(+(route.query.p as string) || 1);
const commentPage = ref(1)
const mediaPage = ref(1)
const starPage = ref(1);
const pageSize = ref(20);
const totalPage = ref(0);
const loadPage = () => {
switch(pageType.value) {
case "post":
loadPosts();
break;
case "comment":
loadCommentPosts();
break;
case "media":
loadMediaPosts();
break;
case "star":
loadStarPosts();
break;
}
};
const loadPosts = () => {
loading.value = true;
getUserPosts({
username: username.value as string,
style: "post",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const loadCommentPosts = () => {
loading.value = true;
getUserPosts({
username: username.value as string,
style: "comment",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const loadMediaPosts = () => {
loading.value = true;
getUserPosts({
username: username.value as string,
style: "media",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const loadStarPosts = () => {
loading.value = true;
getUserPosts({
username: username.value as string,
style: "star",
page: page.value,
page_size: pageSize.value,
})
.then((rsp) => {
loading.value = false;
list.value = rsp.list || [];
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
list.value = []
loading.value = false;
});
};
const changeTab = (tab: "post" | "comment" | "media" | "star") => {
pageType.value = tab;
switch(pageType.value) {
case "post":
page.value = postPage.value
loadPosts();
break;
case "comment":
page.value = commentPage.value
loadCommentPosts();
break;
case "media":
page.value = mediaPage.value
loadMediaPosts();
break;
case "star":
page.value = starPage.value
loadStarPosts();
break;
}
};
const loadUser = () => {
userLoading.value = true;
getUserProfile({
@ -146,19 +246,34 @@ const loadUser = () => {
user.is_admin = res.is_admin;
user.is_friend = res.is_friend;
user.status = res.status;
loadPosts();
loadPage();
})
.catch((err) => {
userLoading.value = false;
console.log(err);
});
};
const updatePage = (p: number) => {
page.value = p;
loadPosts();
switch(pageType.value) {
case "post":
postPage.value = p
loadPosts();
break;
case "comment":
commentPage.value = page.value
loadCommentPosts();
break;
case "media":
mediaPage.value = page.value
loadMediaPosts();
break;
case "star":
starPage.value = page.value
loadStarPosts();
break;
}
};
const openWhisper = () => {
showWhisper.value = true;
};

Loading…
Cancel
Save