Merge branch 'x/gorm' into x/sqlx

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

@ -50,6 +50,9 @@ All notable changes to paopao-ce are documented in this file.
UNIQUE KEY `idx_topic_user_uid_tid` ( `topic_id`, `user_id` ) USING BTREE
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户话题';
```
- add tweet comment thumbs up/down feature support [#275](https://github.com/rocboss/paopao-ce/pull/275)
mirgration database first(sql ddl file in `scripts/migration/**/*_comment_thumbs.up.sql`):
- add load more comments feature support [&60b217b](https://github.com/rocboss/paopao-ce/commit/60b217bcd950c69ba45cebcaa17efdf8048d5a4f 'commit 60b217b')
### Fixed
@ -87,12 +90,26 @@ All notable changes to paopao-ce are documented in this file.
- optimize web frontend dark theme [&b082a8f](https://github.com/rocboss/paopao-ce/commit/b082a8fa5e43dd6dacf459df93fa7e243dd901ea 'commit b082a8f')
- change web frontend main content layout default size to 544px [&b082a8f](https://github.com/rocboss/paopao-ce/commit/b082a8fa5e43dd6dacf459df93fa7e243dd901ea 'commit b082a8f')
- optimize web frontend in mobile environment use Drawer to display menu [#265](https://github.com/rocboss/paopao-ce/pull/265)
- optimize Dockerfile use pre-build builder/runner image to prevent network latency problem (`bitbus/paopao-ce-backend-builder` `bitbus/paopao-ce-backend-runner`) [#265](https://github.com/rocboss/paopao-ce/pull/265)
- optimize Dockerfile use pre-build builder/runner image to prevent network latency problem (`bitbus/paopao-ce-backend-builder` `bitbus/paopao-ce-backend-runner`) [#265](https://github.com/rocboss/paopao-ce/pull/265)
- optimize web ui in mobile environment [#280](https://github.com/rocboss/paopao-ce/pull/280)
### Removed
- remove `Deprecated:OldWeb` feature [#256](https://github.com/rocboss/paopao-ce/pull/256)
## 0.2.5
### Changed
- fixed sql ddl error for contact table [#281](https://github.com/rocboss/paopao-ce/pull/281)
## 0.2.4
### Added
- add PWA support for web frontend [#242](https://github.com/rocboss/paopao-ce/pull/242)
## 0.2.3
### Added

@ -1,3 +1,5 @@
# syntax=docker/dockerfile:experimental
# build frontend
FROM node:19-alpine as frontend
ARG API_HOST

@ -17,7 +17,7 @@ RELEASE_DARWIN_AMD64 = $(RELEASE_ROOT)/darwin-amd64/$(TARGET)
RELEASE_DARWIN_ARM64 = $(RELEASE_ROOT)/darwin-arm64/$(TARGET)
RELEASE_WINDOWS_AMD64 = $(RELEASE_ROOT)/windows-amd64/$(TARGET)
BUILD_VERSION := $(shell git describe --tags | cut -f 1 -d "-")
BUILD_VERSION := $(shell git describe --tags --always | cut -f1 -f2 -d "-")
BUILD_DATE := $(shell date +'%Y-%m-%d %H:%M:%S')
SHA_SHORT := $(shell git rev-parse --short HEAD)
@ -51,22 +51,22 @@ release: linux-amd64 darwin-amd64 darwin-arm64 windows-x64
.PHONY: linux-amd64
linux-amd64:
@echo Build paopao-ce [linux-amd64] CGO_ENABLED=$(CGO_ENABLED)
@echo Build paopao-ce [linux-amd64] CGO_ENABLED=$(CGO_ENABLED) TAGS="'$(TAGS)'"
@CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_LINUX_AMD64)/$(TARGET_BIN)
.PHONY: darwin-amd64
darwin-amd64:
@echo Build paopao-ce [darwin-amd64] CGO_ENABLED=$(CGO_ENABLED)
@echo Build paopao-ce [darwin-amd64] CGO_ENABLED=$(CGO_ENABLED) TAGS="'$(TAGS)'"
@CGO_ENABLED=$(CGO_ENABLED) GOOS=darwin GOARCH=amd64 go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_DARWIN_AMD64)/$(TARGET_BIN)
.PHONY: darwin-arm64
darwin-arm64:
@echo Build paopao-ce [darwin-arm64] CGO_ENABLED=$(CGO_ENABLED)
@echo Build paopao-ce [darwin-arm64] CGO_ENABLED=$(CGO_ENABLED) TAGS="'$(TAGS)'"
@CGO_ENABLED=$(CGO_ENABLED) GOOS=darwin GOARCH=arm64 go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_DARWIN_ARM64)/$(TARGET_BIN)
.PHONY: windows-x64
windows-x64:
@echo Build paopao-ce [windows-x64] CGO_ENABLED=$(CGO_ENABLED)
@echo Build paopao-ce [windows-x64] CGO_ENABLED=$(CGO_ENABLED) TAGS="'$(TAGS)'"
@CGO_ENABLED=$(CGO_ENABLED) GOOS=windows GOARCH=amd64 go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_WINDOWS_AMD64)/$(TARGET_BIN).exe
.PHONY: generate

@ -544,8 +544,9 @@ x/sqlx
| 名称 | 说明 | 备注|
| ----- | ----- | ----- |
| [`main`](https://github.com/rocboss/paopao-ce) | 主分支 |分支`main`是主分支也是paopao-ce的稳定版本发布分支只有经过内部测试没有重大bug出现的稳定代码才会推进到这个分支该分支主要由`beta`分支代码演进而来,原则上**只接受bug修复PR**。`rc版本/稳定版本` 发布都应该在`main`主分支中进行。|
| [`beta`](https://github.com/rocboss/paopao-ce/tree/beta) | 公测分支 |分支`beta`是公测分支,代码推进到`main`主分支的候选分支;该分支主要由`dev`分支代码演进而来,**接受bug修复以及新功能优化的PR**原则上不接受新功能PR。`alpha/beta版本` 发布都应该在`beta`公测分支下进行。|
| [`dev`](https://github.com/rocboss/paopao-ce/tree/dev) | 开发分支 | 分支`dev`是开发分支,**不定期频繁更新**,接受 *新功能PR、代码优化PR、bug修复PR***新功能PR** 都应该首先提交给`dev`分支进行合并bug修复/代码优化 后 **冻结新功能** 将代码演进合并到`beta`分支。|
| [`beta`](https://github.com/rocboss/paopao-ce/tree/beta) | 公测分支 |分支`beta`是公测分支,代码推进到`main`主分支的候选分支;该分支主要由`alpha`分支代码演进而来,**接受bug修复以及新功能优化的PR**原则上不接受新功能PR。`beta版本` 发布都应该在`beta`公测分支下进行。|
| [`alpha`](https://github.com/rocboss/paopao-ce/tree/alpha) | 内测分支 |分支`alpha`是内测分支,代码推进到`beta`分支的候选分支;该分支主要由`dev`分支代码演进而来,**接受bug修复以及新功能相关的PR**接受新功能PR。分支代码演进到一个里程碑式的阶段后**冻结所有新功能**,合并代码到`beta`公测分支进行下一阶段的持续演进。`alpha版本` 发布都应该在`alpha`内测分支下进行。|
| [`dev`](https://github.com/rocboss/paopao-ce/tree/dev) | 开发分支 | 分支`dev`是开发分支,**不定期频繁更新**,接受 *新功能PR、代码优化PR、bug修复PR***新功能PR** 都应该首先提交给`dev`分支进行合并bug修复/新功能开发/代码优化 **阶段性冻结** 后将代码演进合并到`alpha`分支。|
| `feature/*` | 子功能分支 |`feature/*`是新功能子分支,一般新功能子分支都是 *从`dev`开发分支fork出来的*;子功能分支 **只专注于该新功能** 代码的开发/优化,待开发接近内测阶段 *提交新功能PR给`dev`分支进行review/merge*,待新功能代码演进到`beta`分支后,原则上是可以删除该分支,但也可以保留到稳定版本发布。**该分支专注于新功能的开发只接受新功能的bug修复/优化PR**。|
| `jc/*` |维护者的开发分支|`jc/*`是代码库维护者的开发分支一般包含一些局部优化或者bug修复代码有时可以直接将代码merge到`dev/beta`分支原则上不允许直接merge代码到`main`主分支。|
| `x/*` |实验分支|`x/*`是技术实验分支某些技术的引入需要经过具体的代码实现与真实场景的测评考量评估后如果某项技术适合引入到paopao-ce就fork出一个`feature/*`分支作为新功能引入到paopao-ce。一般一些比较激进的技术从`dev`分支fork出一个新的`x/*`分支各种尝试、考量、评估后或丢弃、或引入到paopao-ce。|
@ -556,9 +557,10 @@ x/sqlx
| 名称 | 说明 | 维护者 | 备注 |
| ----- | ----- | ----- | ----- |
|[`paopao-ce`](https://github.com/rocboss/paopao-ce/tree/dev)|paopao-ce 主发行版本|[ROC](https://github.com/rocboss 'ROC')|该分支 [数据逻辑层](https://github.com/rocboss/paopao-ce/tree/dev/internal/dao/jinzhu) 使用[gorm](https://github.com/go-gorm/gorm)作为数据逻辑层的ORM框架适配MySQL/PostgreSQL/Sqlite3数据库。|
|[`r/paopao-ce`](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce)|paopao-ce 主分支预览版本|[ROC](https://github.com/rocboss 'ROC')<br/>[北野](https://github.com/alimy 'Michael Li')|该分支 [数据逻辑层](https://github.com/rocboss/paopao-ce/tree/dev/internal/dao/jinzhu) 使用[gorm](https://github.com/go-gorm/gorm)作为数据逻辑层的ORM框架适配MySQL/PostgreSQL/Sqlite3数据库。代码较`main`分支新,是主发行版本的前瞻预览版本。|
|[`r/paopao-ce-plus`](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus)|paopao-ce-plus 发行版本|[北野](https://github.com/alimy 'Michael Li')|该分支 [数据逻辑层](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus/internal/dao/sakila) 使用[sqlx](https://github.com/jmoiron/sqlx)作为数据逻辑层的ORM框架专注于为MySQL/PostgreSQL/Sqlite3使用更优化的查询语句以提升数据检索效率。建议熟悉[sqlx](https://github.com/jmoiron/sqlx)的开发人员可以基于此版本来做 二次开发。|
|[`r/paopao-ce-pro`](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-pro)|paopao-ce-pro 发行版本|[北野](https://github.com/alimy 'Michael Li')|该分支 [数据逻辑层](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-pro/internal/dao/slonik) 使用[sqlc](https://github.com/kyleconroy/sqlc)作为sql语句生成器自动生成ORM代码专门针对特定数据库MySQL/PostgreSQL进行查询优化熟悉[sqlc](https://github.com/kyleconroy/sqlc)的开发人员可以基于此版本来做 二次开发。(另:分支目前只使用[pgx-v5](https://github.com/jackc/pgx)适配了PostgreSQL数据库后续或许会适配MySQL/TiDB数据库。)|
|[`r/paopao-ce-xtra`](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-xtra)|paopao-ce-xtra 发行版本|[北野](https://github.com/alimy 'Michael Li')|该分支 是paopao-ce、r/paopao-ce-plus、r/paopao-ce-pro的合集|
|[`r/paopao-ce-xtra`](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-xtra)|paopao-ce-xtra 发行版本|[北野](https://github.com/alimy 'Michael Li')|该分支 是r/paopao-ce、r/paopao-ce-plus、r/paopao-ce-pro的合集|
**代码分支演进图**
![](docs/proposal/.assets/000-01.png)

@ -2,16 +2,21 @@
[paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev)/[paopao-ce-plus](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus)/[paopao-ce-pro](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-pro) features develop or optimize and bug fix roadmap.
## paopao-ce roadmap
#### v0.3.0
#### dev+
* [ ] add `Followship` feature
* [ ] add `Auth:Bcrypt` feature
* [ ] add `Auth:MD5` feature (just for compatible)
* [x] add `RedisCacheIndex` feature
* [x] add `Sentry` feature
* [x] add extend base ORM code for implement data logic base sqlx/sqlc
* [ ] optimize media tweet submit logic
* [ ] optimize search logic service
#### v0.3.0
* [x] remove `Deprecated:OldWeb` feature
* [x] add user topic follow feature support
* [x] add tweet link share support
* [ ] add comment thumbsUp/thumbsDown support
* [x] add `RedisCacheIndex` feature
* [x] add `Sentry` feature
#### v0.2.0
* [x] add `Friendship` feature
@ -40,11 +45,14 @@
* [ ] add reactions support
* [ ] add tweet thread like twitter support
* [ ] add short link support
* [ ] optimize current message push logic service use `ims` module
* [ ] optimize topics service
* [ ] optimize current message push logic service use `ims` module
* [ ] optimize backend data logic service(optimize database CRUD operate)
## paopao-ce-plus roadmap
#### paopao-ce-plus/v0.4.0
* [ ] adapt for paopao-ce v0.4.0
#### paopao-ce-plus/v0.3.0
* [ ] adapt for paopao-ce v0.3.0
@ -52,6 +60,9 @@
* [ ] adapt for paopao-ce v0.2.0
## paopao-ce-pro roadmap
#### paopao-ce-pro/v0.4.0
* [ ] adapt for paopao-ce v0.4.0
#### paopao-ce-pro/v0.3.0
* [ ] adapt for paopao-ce v0.3.0

@ -19,6 +19,10 @@ type Priv interface {
UnfollowTopic(*web.UnfollowTopicReq) mir.Error
FollowTopic(*web.FollowTopicReq) mir.Error
StickTopic(*web.StickTopicReq) (*web.StickTopicResp, mir.Error)
ThumbsDownTweetReply(*web.TweetReplyThumbsReq) mir.Error
ThumbsUpTweetReply(*web.TweetReplyThumbsReq) mir.Error
ThumbsDownTweetComment(*web.TweetCommentThumbsReq) mir.Error
ThumbsUpTweetComment(*web.TweetCommentThumbsReq) mir.Error
DeleteCommentReply(*web.DeleteCommentReplyReq) mir.Error
CreateCommentReply(*web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error)
DeleteComment(*web.DeleteCommentReq) mir.Error
@ -41,6 +45,10 @@ type PrivBinding interface {
BindUnfollowTopic(*gin.Context) (*web.UnfollowTopicReq, mir.Error)
BindFollowTopic(*gin.Context) (*web.FollowTopicReq, mir.Error)
BindStickTopic(*gin.Context) (*web.StickTopicReq, mir.Error)
BindThumbsDownTweetReply(*gin.Context) (*web.TweetReplyThumbsReq, mir.Error)
BindThumbsUpTweetReply(*gin.Context) (*web.TweetReplyThumbsReq, mir.Error)
BindThumbsDownTweetComment(*gin.Context) (*web.TweetCommentThumbsReq, mir.Error)
BindThumbsUpTweetComment(*gin.Context) (*web.TweetCommentThumbsReq, mir.Error)
BindDeleteCommentReply(*gin.Context) (*web.DeleteCommentReplyReq, mir.Error)
BindCreateCommentReply(*gin.Context) (*web.CreateCommentReplyReq, mir.Error)
BindDeleteComment(*gin.Context) (*web.DeleteCommentReq, mir.Error)
@ -63,6 +71,10 @@ type PrivRender interface {
RenderUnfollowTopic(*gin.Context, mir.Error)
RenderFollowTopic(*gin.Context, mir.Error)
RenderStickTopic(*gin.Context, *web.StickTopicResp, mir.Error)
RenderThumbsDownTweetReply(*gin.Context, mir.Error)
RenderThumbsUpTweetReply(*gin.Context, mir.Error)
RenderThumbsDownTweetComment(*gin.Context, mir.Error)
RenderThumbsUpTweetComment(*gin.Context, mir.Error)
RenderDeleteCommentReply(*gin.Context, mir.Error)
RenderCreateCommentReply(*gin.Context, *web.CreateCommentReplyResp, mir.Error)
RenderDeleteComment(*gin.Context, mir.Error)
@ -135,6 +147,66 @@ func RegisterPrivServant(e *gin.Engine, s Priv, b PrivBinding, r PrivRender) {
r.RenderStickTopic(c, resp, err)
})
router.Handle("POST", "/tweet/reply/thumbsdown", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req, err := b.BindThumbsDownTweetReply(c)
if err != nil {
r.RenderThumbsDownTweetReply(c, err)
return
}
r.RenderThumbsDownTweetReply(c, s.ThumbsDownTweetReply(req))
})
router.Handle("POST", "/tweet/reply/thumbsup", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req, err := b.BindThumbsUpTweetReply(c)
if err != nil {
r.RenderThumbsUpTweetReply(c, err)
return
}
r.RenderThumbsUpTweetReply(c, s.ThumbsUpTweetReply(req))
})
router.Handle("POST", "/tweet/comment/thumbsdown", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req, err := b.BindThumbsDownTweetComment(c)
if err != nil {
r.RenderThumbsDownTweetComment(c, err)
return
}
r.RenderThumbsDownTweetComment(c, s.ThumbsDownTweetComment(req))
})
router.Handle("POST", "/tweet/comment/thumbsup", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req, err := b.BindThumbsUpTweetComment(c)
if err != nil {
r.RenderThumbsUpTweetComment(c, err)
return
}
r.RenderThumbsUpTweetComment(c, s.ThumbsUpTweetComment(req))
})
router.Handle("DELETE", "/post/comment/reply", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
@ -378,6 +450,22 @@ func (UnimplementedPrivServant) StickTopic(req *web.StickTopicReq) (*web.StickTo
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedPrivServant) ThumbsDownTweetReply(req *web.TweetReplyThumbsReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedPrivServant) ThumbsUpTweetReply(req *web.TweetReplyThumbsReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedPrivServant) ThumbsDownTweetComment(req *web.TweetCommentThumbsReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedPrivServant) ThumbsUpTweetComment(req *web.TweetCommentThumbsReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedPrivServant) DeleteCommentReply(req *web.DeleteCommentReplyReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
@ -453,6 +541,22 @@ func (r *UnimplementedPrivRender) RenderStickTopic(c *gin.Context, data *web.Sti
r.RenderAny(c, data, err)
}
func (r *UnimplementedPrivRender) RenderThumbsDownTweetReply(c *gin.Context, err mir.Error) {
r.RenderAny(c, nil, err)
}
func (r *UnimplementedPrivRender) RenderThumbsUpTweetReply(c *gin.Context, err mir.Error) {
r.RenderAny(c, nil, err)
}
func (r *UnimplementedPrivRender) RenderThumbsDownTweetComment(c *gin.Context, err mir.Error) {
r.RenderAny(c, nil, err)
}
func (r *UnimplementedPrivRender) RenderThumbsUpTweetComment(c *gin.Context, err mir.Error) {
r.RenderAny(c, nil, err)
}
func (r *UnimplementedPrivRender) RenderDeleteCommentReply(c *gin.Context, err mir.Error) {
r.RenderAny(c, nil, err)
}
@ -534,6 +638,30 @@ func (b *UnimplementedPrivBinding) BindStickTopic(c *gin.Context) (*web.StickTop
return obj, err
}
func (b *UnimplementedPrivBinding) BindThumbsDownTweetReply(c *gin.Context) (*web.TweetReplyThumbsReq, mir.Error) {
obj := new(web.TweetReplyThumbsReq)
err := b.BindAny(c, obj)
return obj, err
}
func (b *UnimplementedPrivBinding) BindThumbsUpTweetReply(c *gin.Context) (*web.TweetReplyThumbsReq, mir.Error) {
obj := new(web.TweetReplyThumbsReq)
err := b.BindAny(c, obj)
return obj, err
}
func (b *UnimplementedPrivBinding) BindThumbsDownTweetComment(c *gin.Context) (*web.TweetCommentThumbsReq, mir.Error) {
obj := new(web.TweetCommentThumbsReq)
err := b.BindAny(c, obj)
return obj, err
}
func (b *UnimplementedPrivBinding) BindThumbsUpTweetComment(c *gin.Context) (*web.TweetCommentThumbsReq, mir.Error) {
obj := new(web.TweetCommentThumbsReq)
err := b.BindAny(c, obj)
return obj, err
}
func (b *UnimplementedPrivBinding) BindDeleteCommentReply(c *gin.Context) (*web.DeleteCommentReplyReq, mir.Error) {
obj := new(web.DeleteCommentReplyReq)
err := b.BindAny(c, obj)

@ -0,0 +1,26 @@
#!/bin/sh
# eg.1 : sh build-image.sh
# eg.2, set image: sh build-image.sh bitbus/paopao-ce
VERSION=`git describe --tags --always | cut -f1 -f2 -d "-"` # eg.: 0.2.5
IMAGE="bitbus/paopao-ce"
if [ -n "$1" ]; then
IMAGE="$1"
fi
if [ -n "$2" ]; then
VERSION="$2"
fi
# build image
docker buildx build \
--build-arg USE_DIST="yes" \
--tag "$IMAGE:${VERSION}" \
--tag "$IMAGE:latest" \
. -f Dockerfile
# push to image rep
# if [ -n "$1" ]; then
# docker push "$IMAGE:${VERSION}"
# docker push "$IMAGE:latest"
# fi

@ -0,0 +1,11 @@
#!/bin/sh
# eg.1 : sh build-image.sh
# eg.2, set tags: sh build-image.sh 'embed go_json'
TAGS='embed go_json'
if [ -n "$1" ]; then
TAGS="$1"
fi
make release CGO_ENABLED=0 TAGS="$TAGS"

@ -111,7 +111,7 @@ services:
- paopao-network
backend:
image: bitbus/paopao-ce:latest
image: bitbus/paopao-ce:nightly
restart: always
depends_on:
- db

@ -42,13 +42,13 @@ require (
google.golang.org/protobuf v1.30.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/resty.v1 v1.12.0
gorm.io/driver/mysql v1.4.7
gorm.io/driver/mysql v1.5.0
gorm.io/driver/postgres v1.5.0
gorm.io/driver/sqlite v1.4.4
gorm.io/gorm v1.25.0
gorm.io/plugin/dbresolver v1.4.1
gorm.io/plugin/soft_delete v1.2.0
modernc.org/sqlite v1.21.2
gorm.io/plugin/soft_delete v1.2.1
modernc.org/sqlite v1.22.0
)
require (

@ -2101,8 +2101,8 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.4.3/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c=
gorm.io/driver/mysql v1.4.7 h1:rY46lkCspzGHn7+IYsNpSfEv9tA+SU4SkkB+GFX125Y=
gorm.io/driver/mysql v1.4.7/go.mod h1:SxzItlnT1cb6e1e4ZRpgJN2VYtcqJgqnHxWr4wsP8oc=
gorm.io/driver/mysql v1.5.0 h1:6hSAT5QcyIaty0jfnff0z0CLDjyRgZ8mlMHLqSt7uXM=
gorm.io/driver/mysql v1.5.0/go.mod h1:FFla/fJuCvyTi7rJQd27qlNX2v3L6deTR1GgTjSOLPo=
gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg=
gorm.io/driver/postgres v1.5.0 h1:u2FXTy14l45qc3UeCJ7QaAXZmZfDDv0YrthvmRq1l0U=
gorm.io/driver/postgres v1.5.0/go.mod h1:FUZXzO+5Uqg5zzwzv4KK49R8lvGIyscBOqYrtI1Ce9A=
@ -2121,8 +2121,8 @@ gorm.io/gorm v1.25.0 h1:+KtYtb2roDz14EQe4bla8CbQlmb9dN3VejSai3lprfU=
gorm.io/gorm v1.25.0/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/plugin/dbresolver v1.4.1 h1:Ug4LcoPhrvqq71UhxtF346f+skTYoCa/nEsdjvHwEzk=
gorm.io/plugin/dbresolver v1.4.1/go.mod h1:CTbCtMWhsjXSiJqiW2R8POvJ2cq18RVOl4WGyT5nhNc=
gorm.io/plugin/soft_delete v1.2.0 h1:txWHRMqLPqfXUFytXCdxb/jthRe3CrG4R5XOdagut6Q=
gorm.io/plugin/soft_delete v1.2.0/go.mod h1:Zv7vQctOJTGOsJ/bWgrN1n3od0GBAZgnLjEx+cApLGk=
gorm.io/plugin/soft_delete v1.2.1 h1:qx9D/c4Xu6w5KT8LviX8DgLcB9hkKl6JC9f44Tj7cGU=
gorm.io/plugin/soft_delete v1.2.1/go.mod h1:Zv7vQctOJTGOsJ/bWgrN1n3od0GBAZgnLjEx+cApLGk=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
@ -2213,8 +2213,8 @@ modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY=
modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k=
modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs=
modernc.org/sqlite v1.21.2 h1:ixuUG0QS413Vfzyx6FWx6PYTmHaOegTY+hjzhn7L+a0=
modernc.org/sqlite v1.21.2/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0=
modernc.org/sqlite v1.22.0 h1:Uo+wEWePCspy4SAu0w2VbzUHEftOs7yoaWX/cYjsq84=
modernc.org/sqlite v1.22.0/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0=
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=

@ -1,7 +1,7 @@
App: # APP基础设置项
RunMode: debug
AttachmentIncomeRate: 0.8
MaxCommentCount: 10
MaxCommentCount: 1000
DefaultContextTimeout: 60
DefaultPageSize: 10
MaxPageSize: 100

@ -5,6 +5,7 @@
package core
import (
"github.com/rocboss/paopao-ce/internal/core/cs"
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
)
@ -24,6 +25,7 @@ type CommentService interface {
GetCommentReplyByID(id int64) (*CommentReply, error)
GetCommentContentsByIDs(ids []int64) ([]*CommentContent, error)
GetCommentRepliesByID(ids []int64) ([]*CommentReplyFormated, error)
GetCommentThumbsMap(tweetId int64) (cs.CommentThumbsMap, cs.CommentThumbsMap, error)
}
// CommentManageService 评论管理服务
@ -33,4 +35,8 @@ type CommentManageService interface {
CreateCommentReply(reply *CommentReply) (*CommentReply, error)
DeleteCommentReply(reply *CommentReply) error
CreateCommentContent(content *CommentContent) (*CommentContent, error)
ThumbsUpComment(userId int64, tweetId, commentId int64) error
ThumbsDownComment(userId int64, tweetId, commentId int64) error
ThumbsUpReply(userId int64, tweetId, commentId, replyId int64) error
ThumbsDownReply(userId int64, tweetId, commentId, replyId int64) error
}

@ -0,0 +1,19 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package cs
type CommentThumbs struct {
UserID int64 `json:"user_id"`
TweetID int64 `json:"tweet_id"`
CommentID int64 `json:"comment_id"`
ReplyID int64 `json:"reply_id"`
CommentType int8 `json:"comment_type"`
IsThumbsUp int8 `json:"is_thumbs_up"`
IsThumbsDown int8 `json:"is_thumbs_down"`
}
type CommentThumbsList []*CommentThumbs
type CommentThumbsMap map[int64]*CommentThumbs

@ -5,8 +5,12 @@
package jinzhu
import (
"time"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/core/cs"
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
"github.com/rocboss/paopao-ce/pkg/types"
"gorm.io/gorm"
)
@ -35,6 +39,23 @@ func newCommentManageService(db *gorm.DB) core.CommentManageService {
}
}
func (s *commentSrv) GetCommentThumbsMap(tweetId int64) (cs.CommentThumbsMap, cs.CommentThumbsMap, error) {
commentThumbsList := cs.CommentThumbsList{}
err := s.db.Model(&dbr.TweetCommentThumbs{}).Where("tweet_id=?", tweetId).Find(&commentThumbsList).Error
if err != nil {
return nil, nil, err
}
commentThumbs, replyThumbs := make(cs.CommentThumbsMap), make(cs.CommentThumbsMap)
for _, thumbs := range commentThumbsList {
if thumbs.CommentType == 0 {
commentThumbs[thumbs.CommentID] = thumbs
} else {
replyThumbs[thumbs.ReplyID] = thumbs
}
}
return commentThumbs, replyThumbs, nil
}
func (s *commentSrv) GetComments(conditions *core.ConditionsT, offset, limit int) ([]*core.Comment, error) {
return (&dbr.Comment{}).List(s.db, conditions, offset, limit)
}
@ -106,7 +127,22 @@ func (s *commentSrv) GetCommentRepliesByID(ids []int64) ([]*core.CommentReplyFor
}
func (s *commentManageSrv) DeleteComment(comment *core.Comment) error {
return comment.Delete(s.db)
db := s.db.Begin()
defer db.Rollback()
err := comment.Delete(s.db)
if err != nil {
return err
}
err = db.Model(&dbr.TweetCommentThumbs{}).Where("user_id=? AND tweet_id=? AND comment_id=?", comment.UserID, comment.PostID, comment.ID).Updates(map[string]any{
"deleted_on": time.Now().Unix(),
"is_del": 1,
}).Error
if err != nil {
return err
}
db.Commit()
return nil
}
func (s *commentManageSrv) CreateComment(comment *core.Comment) (*core.Comment, error) {
@ -117,10 +153,244 @@ func (s *commentManageSrv) CreateCommentReply(reply *core.CommentReply) (*core.C
return reply.Create(s.db)
}
func (s *commentManageSrv) DeleteCommentReply(reply *core.CommentReply) error {
return reply.Delete(s.db)
func (s *commentManageSrv) DeleteCommentReply(reply *core.CommentReply) (err error) {
db := s.db.Begin()
defer db.Rollback()
err = reply.Delete(s.db)
if err != nil {
return
}
err = db.Model(&dbr.TweetCommentThumbs{}).
Where("user_id=? AND comment_id=? AND reply_id=?", reply.UserID, reply.CommentID, reply.ID).Updates(map[string]any{
"deleted_on": time.Now().Unix(),
"is_del": 1,
}).Error
if err != nil {
return
}
db.Commit()
return
}
func (s *commentManageSrv) CreateCommentContent(content *core.CommentContent) (*core.CommentContent, error) {
return content.Create(s.db)
}
func (s *commentManageSrv) ThumbsUpComment(userId int64, tweetId, commentId int64) error {
db := s.db.Begin()
defer db.Rollback()
var (
thumbsUpCount int32 = 0
thumbsDownCount int32 = 0
)
commentThumbs := &dbr.TweetCommentThumbs{}
// 检查thumbs状态
err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0", userId, tweetId, commentId).Take(commentThumbs).Error
if err == nil {
switch {
case commentThumbs.IsThumbsUp == types.Yes && commentThumbs.IsThumbsDown == types.No:
thumbsUpCount, thumbsDownCount = -1, 0
case commentThumbs.IsThumbsUp == types.No && commentThumbs.IsThumbsDown == types.No:
thumbsUpCount, thumbsDownCount = 1, 0
default:
thumbsUpCount, thumbsDownCount = 1, -1
commentThumbs.IsThumbsDown = types.No
}
commentThumbs.IsThumbsUp = 1 - commentThumbs.IsThumbsUp
commentThumbs.ModifiedOn = time.Now().Unix()
} else {
commentThumbs = &dbr.TweetCommentThumbs{
UserID: userId,
TweetID: tweetId,
CommentID: commentId,
IsThumbsUp: types.Yes,
IsThumbsDown: types.No,
CommentType: 0,
Model: &dbr.Model{
CreatedOn: time.Now().Unix(),
},
}
thumbsUpCount, thumbsDownCount = 1, 0
}
// 更新thumbs状态
if err = s.db.Save(commentThumbs).Error; err != nil {
return err
}
// 更新thumbsUpCount
if err = s.updateCommentThumbsUpCount(&dbr.Comment{}, commentId, thumbsUpCount, thumbsDownCount); err != nil {
return err
}
db.Commit()
return nil
}
func (s *commentManageSrv) ThumbsDownComment(userId int64, tweetId, commentId int64) error {
db := s.db.Begin()
defer db.Rollback()
var (
thumbsUpCount int32 = 0
thumbsDownCount int32 = 0
)
commentThumbs := &dbr.TweetCommentThumbs{}
// 检查thumbs状态
err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0", userId, tweetId, commentId).Take(commentThumbs).Error
if err == nil {
switch {
case commentThumbs.IsThumbsDown == types.Yes:
thumbsUpCount, thumbsDownCount = 0, -1
case commentThumbs.IsThumbsDown == types.No && commentThumbs.IsThumbsUp == types.No:
thumbsUpCount, thumbsDownCount = 0, 1
default:
thumbsUpCount, thumbsDownCount = -1, 1
commentThumbs.IsThumbsUp = types.No
}
commentThumbs.IsThumbsDown = 1 - commentThumbs.IsThumbsDown
commentThumbs.ModifiedOn = time.Now().Unix()
} else {
commentThumbs = &dbr.TweetCommentThumbs{
UserID: userId,
TweetID: tweetId,
CommentID: commentId,
IsThumbsUp: types.No,
IsThumbsDown: types.Yes,
CommentType: 0,
Model: &dbr.Model{
CreatedOn: time.Now().Unix(),
},
}
thumbsUpCount, thumbsDownCount = 0, 1
}
// 更新thumbs状态
if err = s.db.Save(commentThumbs).Error; err != nil {
return err
}
// 更新thumbsUpCount
if err = s.updateCommentThumbsUpCount(&dbr.Comment{}, commentId, thumbsUpCount, thumbsDownCount); err != nil {
return err
}
db.Commit()
return nil
}
func (s *commentManageSrv) ThumbsUpReply(userId int64, tweetId, commentId, replyId int64) error {
db := s.db.Begin()
defer db.Rollback()
var (
thumbsUpCount int32 = 0
thumbsDownCount int32 = 0
)
commentThumbs := &dbr.TweetCommentThumbs{}
// 检查thumbs状态
err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1", userId, tweetId, commentId, replyId).Take(commentThumbs).Error
if err == nil {
switch {
case commentThumbs.IsThumbsUp == types.Yes:
thumbsUpCount, thumbsDownCount = -1, 0
case commentThumbs.IsThumbsUp == types.No && commentThumbs.IsThumbsDown == types.No:
thumbsUpCount, thumbsDownCount = 1, 0
default:
thumbsUpCount, thumbsDownCount = 1, -1
commentThumbs.IsThumbsDown = types.No
}
commentThumbs.IsThumbsUp = 1 - commentThumbs.IsThumbsUp
commentThumbs.ModifiedOn = time.Now().Unix()
} else {
commentThumbs = &dbr.TweetCommentThumbs{
UserID: userId,
TweetID: tweetId,
CommentID: commentId,
ReplyID: replyId,
IsThumbsUp: types.Yes,
IsThumbsDown: types.No,
CommentType: 1,
Model: &dbr.Model{
CreatedOn: time.Now().Unix(),
},
}
thumbsUpCount, thumbsDownCount = 1, 0
}
// 更新thumbs状态
if err = s.db.Save(commentThumbs).Error; err != nil {
return err
}
// 更新thumbsUpCount
if err = s.updateCommentThumbsUpCount(&dbr.CommentReply{}, replyId, thumbsUpCount, thumbsDownCount); err != nil {
return err
}
db.Commit()
return nil
}
func (s *commentManageSrv) ThumbsDownReply(userId int64, tweetId, commentId, replyId int64) error {
db := s.db.Begin()
defer db.Rollback()
var (
thumbsUpCount int32 = 0
thumbsDownCount int32 = 0
)
commentThumbs := &dbr.TweetCommentThumbs{}
// 检查thumbs状态
err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1", userId, tweetId, commentId, replyId).Take(commentThumbs).Error
if err == nil {
switch {
case commentThumbs.IsThumbsDown == types.Yes:
thumbsUpCount, thumbsDownCount = 0, -1
case commentThumbs.IsThumbsUp == types.No && commentThumbs.IsThumbsDown == types.No:
thumbsUpCount, thumbsDownCount = 0, 1
default:
thumbsUpCount, thumbsDownCount = -1, 1
commentThumbs.IsThumbsUp = types.No
}
commentThumbs.IsThumbsDown = 1 - commentThumbs.IsThumbsDown
commentThumbs.ModifiedOn = time.Now().Unix()
} else {
commentThumbs = &dbr.TweetCommentThumbs{
UserID: userId,
TweetID: tweetId,
CommentID: commentId,
ReplyID: replyId,
IsThumbsUp: types.No,
IsThumbsDown: types.Yes,
CommentType: 1,
Model: &dbr.Model{
CreatedOn: time.Now().Unix(),
},
}
thumbsUpCount, thumbsDownCount = 0, 1
}
// 更新thumbs状态
if err = s.db.Save(commentThumbs).Error; err != nil {
return err
}
// 更新thumbsUpCount
if err = s.updateCommentThumbsUpCount(&dbr.CommentReply{}, replyId, thumbsUpCount, thumbsDownCount); err != nil {
return err
}
db.Commit()
return nil
}
func (s *commentManageSrv) updateCommentThumbsUpCount(obj any, id int64, thumbsUpCount, thumbsDownCount int32) error {
updateColumns := make(map[string]any, 2)
if thumbsUpCount == 1 {
updateColumns["thumbs_up_count"] = gorm.Expr("thumbs_up_count + 1")
} else if thumbsUpCount == -1 {
updateColumns["thumbs_up_count"] = gorm.Expr("thumbs_up_count - 1")
}
if thumbsDownCount == 1 {
updateColumns["thumbs_down_count"] = gorm.Expr("thumbs_down_count + 1")
} else if thumbsDownCount == -1 {
updateColumns["thumbs_down_count"] = gorm.Expr("thumbs_down_count - 1")
}
if len(updateColumns) > 0 {
updateColumns["modified_on"] = time.Now().Unix()
return s.db.Model(obj).Where("id=?", id).UpdateColumns(updateColumns).Error
}
return nil
}

@ -7,27 +7,33 @@ package dbr
import (
"time"
"github.com/rocboss/paopao-ce/pkg/types"
"gorm.io/gorm"
)
type Comment struct {
*Model
PostID int64 `json:"post_id"`
UserID int64 `json:"user_id"`
IP string `json:"ip"`
IPLoc string `json:"ip_loc"`
PostID int64 `json:"post_id"`
UserID int64 `json:"user_id"`
IP string `json:"ip"`
IPLoc string `json:"ip_loc"`
ThumbsUpCount int32 `json:"thumbs_up_count"`
ThumbsDownCount int32 `json:"-"`
}
type CommentFormated struct {
ID int64 `json:"id"`
PostID int64 `json:"post_id"`
UserID int64 `json:"user_id"`
User *UserFormated `json:"user"`
Contents []*CommentContent `json:"contents"`
Replies []*CommentReplyFormated `json:"replies"`
IPLoc string `json:"ip_loc"`
CreatedOn int64 `json:"created_on"`
ModifiedOn int64 `json:"modified_on"`
ID int64 `json:"id"`
PostID int64 `json:"post_id"`
UserID int64 `json:"user_id"`
User *UserFormated `json:"user"`
Contents []*CommentContent `json:"contents"`
Replies []*CommentReplyFormated `json:"replies"`
IPLoc string `json:"ip_loc"`
ThumbsUpCount int32 `json:"thumbs_up_count"`
IsThumbsUp int8 `json:"is_thumbs_up"`
IsThumbsDown int8 `json:"is_thumbs_down"`
CreatedOn int64 `json:"created_on"`
ModifiedOn int64 `json:"modified_on"`
}
func (c *Comment) Format() *CommentFormated {
@ -35,15 +41,18 @@ func (c *Comment) Format() *CommentFormated {
return &CommentFormated{}
}
return &CommentFormated{
ID: c.Model.ID,
PostID: c.PostID,
UserID: c.UserID,
User: &UserFormated{},
Contents: []*CommentContent{},
Replies: []*CommentReplyFormated{},
IPLoc: c.IPLoc,
CreatedOn: c.CreatedOn,
ModifiedOn: c.ModifiedOn,
ID: c.Model.ID,
PostID: c.PostID,
UserID: c.UserID,
User: &UserFormated{},
Contents: []*CommentContent{},
Replies: []*CommentReplyFormated{},
IPLoc: c.IPLoc,
ThumbsUpCount: c.ThumbsUpCount,
IsThumbsUp: types.No,
IsThumbsDown: types.No,
CreatedOn: c.CreatedOn,
ModifiedOn: c.ModifiedOn,
}
}

@ -7,30 +7,36 @@ package dbr
import (
"time"
"github.com/rocboss/paopao-ce/pkg/types"
"gorm.io/gorm"
)
type CommentReply struct {
*Model
CommentID int64 `json:"comment_id"`
UserID int64 `json:"user_id"`
AtUserID int64 `json:"at_user_id"`
Content string `json:"content"`
IP string `json:"ip"`
IPLoc string `json:"ip_loc"`
CommentID int64 `json:"comment_id"`
UserID int64 `json:"user_id"`
AtUserID int64 `json:"at_user_id"`
Content string `json:"content"`
IP string `json:"ip"`
IPLoc string `json:"ip_loc"`
ThumbsUpCount int32 `json:"thumbs_up_count"`
ThumbsDownCount int32 `json:"-"`
}
type CommentReplyFormated struct {
ID int64 `json:"id"`
CommentID int64 `json:"comment_id"`
UserID int64 `json:"user_id"`
User *UserFormated `json:"user"`
AtUserID int64 `json:"at_user_id"`
AtUser *UserFormated `json:"at_user"`
Content string `json:"content"`
IPLoc string `json:"ip_loc"`
CreatedOn int64 `json:"created_on"`
ModifiedOn int64 `json:"modified_on"`
ID int64 `json:"id"`
CommentID int64 `json:"comment_id"`
UserID int64 `json:"user_id"`
User *UserFormated `json:"user"`
AtUserID int64 `json:"at_user_id"`
AtUser *UserFormated `json:"at_user"`
Content string `json:"content"`
IPLoc string `json:"ip_loc"`
ThumbsUpCount int32 `json:"thumbs_up_count"`
IsThumbsUp int8 `json:"is_thumbs_up"`
IsThumbsDown int8 `json:"is_thumbs_down"`
CreatedOn int64 `json:"created_on"`
ModifiedOn int64 `json:"modified_on"`
}
func (c *CommentReply) Format() *CommentReplyFormated {
@ -39,16 +45,19 @@ func (c *CommentReply) Format() *CommentReplyFormated {
}
return &CommentReplyFormated{
ID: c.ID,
CommentID: c.CommentID,
UserID: c.UserID,
User: &UserFormated{},
AtUserID: c.AtUserID,
AtUser: &UserFormated{},
Content: c.Content,
IPLoc: c.IPLoc,
CreatedOn: c.CreatedOn,
ModifiedOn: c.ModifiedOn,
ID: c.ID,
CommentID: c.CommentID,
UserID: c.UserID,
User: &UserFormated{},
AtUserID: c.AtUserID,
AtUser: &UserFormated{},
Content: c.Content,
IPLoc: c.IPLoc,
ThumbsUpCount: c.ThumbsUpCount,
IsThumbsUp: types.No,
IsThumbsDown: types.No,
CreatedOn: c.CreatedOn,
ModifiedOn: c.ModifiedOn,
}
}

@ -0,0 +1,16 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package dbr
type TweetCommentThumbs struct {
*Model
UserID int64 `json:"user_id"`
TweetID int64 `json:"tweet_id"`
CommentID int64 `json:"comment_id"`
ReplyID int64 `json:"reply_id"`
CommentType int8 `json:"comment_type"`
IsThumbsUp int8 `json:"is_thumbs_up"`
IsThumbsDown int8 `json:"is_thumbs_down"`
}

@ -13,6 +13,19 @@ import (
"github.com/rocboss/paopao-ce/internal/core/cs"
)
type TweetCommentThumbsReq struct {
SimpleInfo `json:"-" binding:"-"`
TweetId int64 `json:"tweet_id" binding:"required"`
CommentId int64 `json:"comment_id" binding:"required"`
}
type TweetReplyThumbsReq struct {
SimpleInfo `json:"-" binding:"-"`
TweetId int64 `json:"tweet_id" binding:"required"`
CommentId int64 `json:"comment_id" binding:"required"`
ReplyId int64 `json:"reply_id" binding:"required"`
}
type PostContentItem struct {
Content string `json:"content" binding:"required"`
Type core.PostContentT `json:"type" binding:"required"`

@ -144,6 +144,38 @@ func (s *privSrv) Chain() gin.HandlersChain {
return gin.HandlersChain{chain.JWT(), chain.Priv()}
}
func (s *privSrv) ThumbsDownTweetReply(req *web.TweetReplyThumbsReq) mir.Error {
if err := s.Ds.ThumbsDownReply(req.Uid, req.TweetId, req.CommentId, req.ReplyId); err != nil {
logrus.Errorf("thumbs down tweet reply error: %s req:%v", err, req)
return _errThumbsDownTweetReply
}
return nil
}
func (s *privSrv) ThumbsUpTweetReply(req *web.TweetReplyThumbsReq) mir.Error {
if err := s.Ds.ThumbsUpReply(req.Uid, req.TweetId, req.CommentId, req.ReplyId); err != nil {
logrus.Errorf("thumbs up tweet reply error: %s req:%v", err, req)
return _errThumbsUpTweetReply
}
return nil
}
func (s *privSrv) ThumbsDownTweetComment(req *web.TweetCommentThumbsReq) mir.Error {
if err := s.Ds.ThumbsDownComment(req.Uid, req.TweetId, req.CommentId); err != nil {
logrus.Errorf("thumbs down tweet comment error: %s req:%v", err, req)
return _errThumbsDownTweetComment
}
return nil
}
func (s *privSrv) ThumbsUpTweetComment(req *web.TweetCommentThumbsReq) mir.Error {
if err := s.Ds.ThumbsUpComment(req.Uid, req.TweetId, req.CommentId); err != nil {
logrus.Errorf("thumbs up tweet comment error: %s req:%v", err, req)
return _errThumbsUpTweetComment
}
return nil
}
func (s *privSrv) UnfollowTopic(req *web.UnfollowTopicReq) mir.Error {
if err := s.Ds.UnfollowTopic(req.Uid, req.TopicId); err != nil {
logrus.Errorf("user(%d) unfollow topic(%d) failed: %s", req.Uid, req.TopicId, err)

@ -102,15 +102,26 @@ func (s *pubSrv) TweetComments(req *web.TweetCommentsReq) (*web.TweetCommentsRes
return nil, _errGetCommentsFailed
}
commentThumbs, replyThumbs, err := s.Ds.GetCommentThumbsMap(req.TweetId)
if err != nil {
return nil, _errGetCommentsFailed
}
commentsFormated := []*core.CommentFormated{}
for _, comment := range comments {
commentFormated := comment.Format()
if thumbs, exist := commentThumbs[comment.ID]; exist {
commentFormated.IsThumbsUp, commentFormated.IsThumbsDown = thumbs.IsThumbsUp, thumbs.IsThumbsDown
}
for _, content := range contents {
if content.CommentID == comment.ID {
commentFormated.Contents = append(commentFormated.Contents, content)
}
}
for _, reply := range replies {
if thumbs, exist := replyThumbs[reply.ID]; exist {
reply.IsThumbsUp, reply.IsThumbsDown = thumbs.IsThumbsUp, thumbs.IsThumbsDown
}
if reply.CommentID == commentFormated.ID {
commentFormated.Replies = append(commentFormated.Replies, reply)
}

@ -54,6 +54,7 @@ var (
_errCreateReplyFailed = xerror.NewError(40005, "评论回复失败")
_errGetReplyFailed = xerror.NewError(40006, "获取评论详情失败")
_errMaxCommentCount = xerror.NewError(40007, "评论数已达最大限制")
_errGetCommentThumbs = xerror.NewError(40008, "获取评论点赞信息失败")
_errGetMessagesFailed = xerror.NewError(50001, "获取消息列表失败")
_errReadMessageFailed = xerror.NewError(50002, "标记消息已读失败")
@ -78,9 +79,13 @@ var (
_errGetContactsFailed = xerror.NewError(80007, "获取联系人列表失败")
_errNoActionToSelf = xerror.NewError(80008, "不允许对自己操作")
_errFollowTopicFailed = xerror.NewError(90001, "关注话题失败")
_errUnfollowTopicFailed = xerror.NewError(90002, "取消关注话题失败")
_errStickTopicFailed = xerror.NewError(90003, "更行话题置顶状态失败")
_errFollowTopicFailed = xerror.NewError(90001, "关注话题失败")
_errUnfollowTopicFailed = xerror.NewError(90002, "取消关注话题失败")
_errStickTopicFailed = xerror.NewError(90003, "更行话题置顶状态失败")
_errThumbsUpTweetComment = xerror.NewError(90101, "评论点赞失败")
_errThumbsDownTweetComment = xerror.NewError(90102, "评论点踩失败")
_errThumbsUpTweetReply = xerror.NewError(90103, "评论回复点赞失败")
_errThumbsDownTweetReply = xerror.NewError(90104, "评论回复点踩失败")
_errFileUploadFailed = xerror.NewError(10200, "文件上传失败")
_errFileInvalidExt = xerror.NewError(10201, "文件类型不合法")

@ -57,6 +57,18 @@ type Priv struct {
// DeleteCommentReply 删除评论回复
DeleteCommentReply func(Delete, web.DeleteCommentReplyReq) `mir:"/post/comment/reply"`
// ThumbsUpTweetComment 点赞评论
ThumbsUpTweetComment func(Post, web.TweetCommentThumbsReq) `mir:"/tweet/comment/thumbsup"`
// ThumbsDownTweetComment 点踩评论
ThumbsDownTweetComment func(Post, web.TweetCommentThumbsReq) `mir:"/tweet/comment/thumbsdown"`
// ThumbsUpTweetReply 点赞评论回复
ThumbsUpTweetReply func(Post, web.TweetReplyThumbsReq) `mir:"/tweet/reply/thumbsup"`
// ThumbsDownTweetReply 点踩评论回复
ThumbsDownTweetReply func(Post, web.TweetReplyThumbsReq) `mir:"/tweet/reply/thumbsdown"`
// StickTopic 置顶动态
StickTopic func(Post, web.StickTopicReq) web.StickTopicResp `mir:"/topic/stick"`

@ -4,6 +4,14 @@
package types
const (
// No 二态值 否
No int8 = 0
// Yes 二态值 是
Yes int8 = 1
)
// Empty empty alias type
type Empty = struct{}

@ -0,0 +1,6 @@
ALTER TABLE `p_comment` DROP COLUMN `thumbs_up_count`;
ALTER TABLE `p_comment` DROP COLUMN `thumbs_down_count`;
ALTER TABLE `p_comment_reply` DROP COLUMN `thumbs_up_count`;
ALTER TABLE `p_comment_reply` DROP COLUMN `thumbs_down_count`;
DROP TABLE IF EXISTS `p_tweet_comment_thumbs`;

@ -0,0 +1,21 @@
ALTER TABLE `p_comment` ADD COLUMN `thumbs_up_count` INT unsigned NOT NULL DEFAULT '0' COMMENT '点赞数';
ALTER TABLE `p_comment` ADD COLUMN `thumbs_down_count` INT unsigned NOT NULL DEFAULT '0' COMMENT '点踩数';
ALTER TABLE `p_comment_reply` ADD COLUMN `thumbs_up_count` INT unsigned NOT NULL DEFAULT '0' COMMENT '点赞数';
ALTER TABLE `p_comment_reply` ADD COLUMN `thumbs_down_count` INT unsigned NOT NULL DEFAULT '0' COMMENT '点踩数';
CREATE TABLE `p_tweet_comment_thumbs` (
`id` BIGINT unsigned NOT NULL AUTO_INCREMENT COMMENT 'thumbs ID',
`user_id` BIGINT unsigned NOT NULL,
`tweet_id` BIGINT unsigned NOT NULL COMMENT '推文ID',
`comment_id` BIGINT unsigned NOT NULL COMMENT '评论ID',
`reply_id` BIGINT unsigned COMMENT '评论回复ID',
`comment_type` TINYINT NOT NULL DEFAULT '0' COMMENT '评论类型 0为推文评论、1为评论回复',
`is_thumbs_up` TINYINT unsigned NOT NULL DEFAULT '0' COMMENT '是否点赞',
`is_thumbs_down` TINYINT unsigned NOT NULL DEFAULT '0' COMMENT '是否点踩',
`created_on` BIGINT unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`modified_on` BIGINT unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
`deleted_on` BIGINT unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
`is_del` TINYINT unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0 为未删除、1 为已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_tweet_comment_thumbs_uid_tid` (`user_id`, `tweet_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='推文评论点赞';

@ -0,0 +1,6 @@
ALTER TABLE p_comment DROP COLUMN thumbs_up_count;
ALTER TABLE p_comment DROP COLUMN thumbs_down_count;
ALTER TABLE p_comment_reply DROP COLUMN thumbs_up_count;
ALTER TABLE p_comment_reply DROP COLUMN thumbs_down_count;
DROP TABLE IF EXISTS p_tweet_comment_thumbs;

@ -0,0 +1,20 @@
ALTER TABLE p_comment ADD COLUMN thumbs_up_count INT NOT NULL DEFAULT 0;
ALTER TABLE p_comment ADD COLUMN thumbs_down_count INT NOT NULL DEFAULT 0;
ALTER TABLE p_comment_reply ADD COLUMN thumbs_up_count INT NOT NULL DEFAULT 0;
ALTER TABLE p_comment_reply ADD COLUMN thumbs_down_count INT NOT NULL DEFAULT 0;
CREATE TABLE p_tweet_comment_thumbs (
ID BIGSERIAL PRIMARY KEY,
user_id BIGINT NOT NULL,
tweet_id BIGINT NOT NULL,
comment_id BIGINT NOT NULL,
reply_id BIGINT,
comment_type SMALLINT NOT NULL DEFAULT 0,-- 评论类型 0为推文评论、1为评论回复
is_thumbs_up SMALLINT NOT NULL DEFAULT 0,-- 是否点赞 0 为否 1为是
is_thumbs_down SMALLINT NOT NULL DEFAULT 0,-- 是否点踩 0 为否 1为是
created_on BIGINT NOT NULL DEFAULT 0,
modified_on BIGINT NOT NULL DEFAULT 0,
deleted_on BIGINT NOT NULL DEFAULT 0,
is_del SMALLINT NOT NULL DEFAULT 0 -- 是否删除 0 为未删除、1 为已删除
);
CREATE INDEX idx_tweet_comment_thumbs_uid_tid ON p_tweet_comment_thumbs USING btree ( user_id, tweet_id );

@ -0,0 +1,6 @@
ALTER TABLE "p_comment" DROP COLUMN "thumbs_up_count";
ALTER TABLE "p_comment" DROP COLUMN "thumbs_down_count";
ALTER TABLE "p_comment_reply" DROP COLUMN "thumbs_up_count";
ALTER TABLE "p_comment_reply" DROP COLUMN "thumbs_down_count";
DROP TABLE IF EXISTS "p_tweet_comment_thumbs";

@ -0,0 +1,19 @@
ALTER TABLE "p_comment" ADD COLUMN "thumbs_up_count" integer NOT NULL DEFAULT 0;
ALTER TABLE "p_comment" ADD COLUMN "thumbs_down_count" integer NOT NULL DEFAULT 0;
ALTER TABLE "p_comment_reply" ADD COLUMN "thumbs_up_count" integer NOT NULL DEFAULT 0;
ALTER TABLE "p_comment_reply" ADD COLUMN "thumbs_down_count" integer NOT NULL DEFAULT 0;
CREATE TABLE "p_tweet_comment_thumbs" (
"id" integer PRIMARY KEY,
"user_id" integer NOT NULL,
"tweet_id" integer NOT NULL,
"comment_id" integer NOT NULL,
"reply_id" integer,
"comment_type" integer NOT NULL DEFAULT 0, -- 评论类型 0为推文评论、1为评论回复
"is_thumbs_up" integer NOT NULL DEFAULT 0, -- 是否点赞 0 为否 1为是
"is_thumbs_down" integer NOT NULL DEFAULT 0, -- 是否点踩 0 为否 1为是
"created_on" integer NOT NULL DEFAULT 0,
"modified_on" integer NOT NULL DEFAULT 0,
"deleted_on" integer NOT NULL DEFAULT 0,
"is_del" integer NOT NULL DEFAULT 0 -- 是否删除 0 为未删除、1 为已删除
);

@ -51,6 +51,8 @@ CREATE TABLE `p_comment` (
`user_id` bigint unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
`ip` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'IP地址',
`ip_loc` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'IP城市地址',
`thumbs_up_count` int unsigned NOT NULL DEFAULT '0' COMMENT '点赞数',
`thumbs_down_count` int unsigned NOT NULL DEFAULT '0' COMMENT '点踩数',
`created_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`modified_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
`deleted_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
@ -94,6 +96,8 @@ CREATE TABLE `p_comment_reply` (
`content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容',
`ip` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'IP地址',
`ip_loc` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'IP城市地址',
`thumbs_up_count` int unsigned NOT NULL DEFAULT '0' COMMENT '点赞数',
`thumbs_down_count` int unsigned NOT NULL DEFAULT '0' COMMENT '点踩数',
`created_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`modified_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
`deleted_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
@ -102,6 +106,27 @@ CREATE TABLE `p_comment_reply` (
KEY `idx_comment_reply_comment_id` (`comment_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12000015 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='评论回复';
-- ----------------------------
-- Table structure for p_tweet_comment_thumbs
-- ----------------------------
DROP TABLE IF EXISTS `p_tweet_comment_thumbs`;
CREATE TABLE `p_tweet_comment_thumbs` (
`id` BIGINT unsigned NOT NULL AUTO_INCREMENT COMMENT 'thumbs ID',
`user_id` BIGINT unsigned NOT NULL,
`tweet_id` BIGINT unsigned NOT NULL COMMENT '推文ID',
`comment_id` BIGINT unsigned NOT NULL COMMENT '评论ID',
`reply_id` BIGINT unsigned COMMENT '评论回复ID',
`comment_type` TINYINT NOT NULL DEFAULT '0' COMMENT '评论类型 0为推文评论、1为评论回复',
`is_thumbs_up` TINYINT unsigned NOT NULL DEFAULT '0' COMMENT '是否点赞',
`is_thumbs_down` TINYINT unsigned NOT NULL DEFAULT '0' COMMENT '是否点踩',
`created_on` BIGINT unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`modified_on` BIGINT unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
`deleted_on` BIGINT unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
`is_del` TINYINT unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0 为未删除、1 为已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_tweet_comment_thumbs_uid_tid` (`user_id`, `tweet_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='推文评论点赞';
-- ----------------------------
-- Table structure for p_message
-- ----------------------------
@ -324,7 +349,7 @@ CREATE TABLE `p_contact_group` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '联系人ID',
`user_id` int NOT NULL DEFAULT '0' COMMENT '用户id',
`name` varchar(32) NOT NULL DEFAULT '' COMMENT '分组名称',
`is_delete` tinyint NOT NULL DEFAULT '1' COMMENT '是否删除, 0否, 1是',
`is_del` tinyint NOT NULL DEFAULT '1' COMMENT '是否删除, 0否, 1是',
`created_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`modified_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
`deleted_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',

@ -43,6 +43,8 @@ CREATE TABLE p_comment (
user_id BIGINT NOT NULL DEFAULT 0,
ip VARCHAR(64) NOT NULL DEFAULT '',
ip_loc VARCHAR(64) NOT NULL DEFAULT '',
thumbs_up_count int NOT NULL DEFAULT 0, -- 点赞数
thumbs_down_count int NOT NULL DEFAULT 0, -- 点踩数
created_on BIGINT NOT NULL DEFAULT 0,
modified_on BIGINT NOT NULL DEFAULT 0,
deleted_on BIGINT NOT NULL DEFAULT 0,
@ -78,6 +80,8 @@ CREATE TABLE p_comment_reply (
content VARCHAR(255) NOT NULL DEFAULT '',
ip VARCHAR(64) NOT NULL DEFAULT '',
ip_loc VARCHAR(64) NOT NULL DEFAULT '',
thumbs_up_count int NOT NULL DEFAULT 0, -- 点赞数
thumbs_down_count int NOT NULL DEFAULT 0, -- 点踩数
created_on BIGINT NOT NULL DEFAULT 0,
modified_on BIGINT NOT NULL DEFAULT 0,
deleted_on BIGINT NOT NULL DEFAULT 0,
@ -85,12 +89,29 @@ CREATE TABLE p_comment_reply (
);
CREATE INDEX idx_comment_reply_comment_id ON p_comment_reply USING btree (comment_id);
DROP TABLE IF EXISTS p_tweet_comment_thumbs;
CREATE TABLE p_tweet_comment_thumbs (
id BIGSERIAL PRIMARY KEY,
user_id BIGINT NOT NULL,
tweet_id BIGINT NOT NULL,
comment_id BIGINT NOT NULL,
reply_id BIGINT,
comment_type SMALLINT NOT NULL DEFAULT 0, -- 评论类型 0为推文评论、1为评论回复
is_thumbs_up SMALLINT NOT NULL DEFAULT 0, -- 是否点赞 0 为否 1为是
is_thumbs_down SMALLINT NOT NULL DEFAULT 0, -- 是否点踩 0 为否 1为是
created_on BIGINT NOT NULL DEFAULT 0,
modified_on BIGINT NOT NULL DEFAULT 0,
deleted_on BIGINT NOT NULL DEFAULT 0,
is_del SMALLINT NOT NULL DEFAULT 0 -- 是否删除 0 为未删除、1 为已删除
);
CREATE INDEX idx_tweet_comment_thumbs_uid_tid ON p_tweet_comment_thumbs USING btree (user_id, tweet_id);
DROP TABLE IF EXISTS p_message;
CREATE TABLE p_message (
id BIGSERIAL PRIMARY KEY,
sender_user_id BIGINT NOT NULL DEFAULT 0,
receiver_user_id BIGINT NOT NULL DEFAULT 0,
type SMALLINT NOT NULL DEFAULT 1,
"type" SMALLINT NOT NULL DEFAULT 1,
brief VARCHAR(255) NOT NULL DEFAULT '',
content VARCHAR(255) NOT NULL DEFAULT '',
post_id BIGINT NOT NULL DEFAULT 0,

@ -46,6 +46,8 @@ CREATE TABLE "p_comment" (
"user_id" integer NOT NULL,
"ip" text(64) NOT NULL,
"ip_loc" text(64) NOT NULL,
"thumbs_up_count" integer NOT NULL DEFAULT 0, -- 点赞数
"thumbs_down_count" integer NOT NULL DEFAULT 0, -- 点踩数
"created_on" integer NOT NULL,
"modified_on" integer NOT NULL,
"deleted_on" integer NOT NULL,
@ -83,6 +85,8 @@ CREATE TABLE "p_comment_reply" (
"content" text(255) NOT NULL,
"ip" text(64) NOT NULL,
"ip_loc" text(64) NOT NULL,
"thumbs_up_count" integer NOT NULL DEFAULT 0, -- 点赞数
"thumbs_down_count" integer NOT NULL DEFAULT 0, -- 点踩数
"created_on" integer NOT NULL,
"modified_on" integer NOT NULL,
"deleted_on" integer NOT NULL,
@ -90,6 +94,25 @@ CREATE TABLE "p_comment_reply" (
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for p_tweet_comment_thumbs
-- ----------------------------
DROP TABLE IF EXISTS p_tweet_comment_thumbs;
CREATE TABLE "p_tweet_comment_thumbs" (
"id" integer PRIMARY KEY,
"user_id" integer NOT NULL,
"tweet_id" integer NOT NULL,
"comment_id" integer NOT NULL,
"reply_id" integer,
"comment_type" integer NOT NULL DEFAULT 0, -- 评论类型 0为推文评论、1为评论回复
"is_thumbs_up" integer NOT NULL DEFAULT 0, -- 是否点赞 0 为否 1为是
"is_thumbs_down" integer NOT NULL DEFAULT 0, -- 是否点踩 0 为否 1为是
"created_on" integer NOT NULL DEFAULT 0,
"modified_on" integer NOT NULL DEFAULT 0,
"deleted_on" integer NOT NULL DEFAULT 0,
"is_del" integer NOT NULL DEFAULT 0 -- 是否删除 0 为未删除、1 为已删除
);
-- ----------------------------
-- Table structure for p_contact
-- ----------------------------
@ -397,6 +420,15 @@ ON "p_comment_reply" (
"comment_id" ASC
);
-- ----------------------------
-- Indexes structure for table idx_tweet_comment_thumbs_uid_tid
-- ----------------------------
CREATE INDEX "idx_tweet_comment_thumbs_uid_tid"
ON "p_tweet_comment_thumbs"(
"user_id" ASC,
"tweet_id" ASC
);
-- ----------------------------
-- Indexes structure for table p_contact
-- ----------------------------

@ -1 +1 @@
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-427305f4.js";import{u as a}from"./vue-router-29025daf.js";import{F as i,e as c,a2 as u}from"./naive-ui-ddb574dd.js";import{d as l,c as d,L as t,Y as o,o as f,e as x}from"./@vue-f70ab1bd.js";import{_ as g}from"./index-2c67ab1f.js";import"./vuex-cc1858c6.js";import"./vooks-dfdd6eef.js";import"./evtd-b614532e.js";import"./@vicons-2f3cb6b9.js";import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./@css-render-66126308.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-707ed124.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 K=g(v,[["__scopeId","data-v-e62daa85"]]);export{K as default};
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-bd108629.js";import{u as a}from"./vue-router-88cc84d1.js";import{F as i,e as c,a2 as u}from"./naive-ui-2035804c.js";import{d as l,c as d,L as t,$ as o,o as f,e as x}from"./@vue-ca177dbe.js";import{_ as g}from"./index-f67b4cc5.js";import"./vuex-d28e9067.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./@vicons-6d35273b.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.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-707ed124.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,3 +1,3 @@
import{i as d}from"./@vue-f70ab1bd.js";function C(i){let r=".",s="__",m="--",f;if(i){let e=i.blockPrefix;e&&(r=e),e=i.elementPrefix,e&&(s=e),e=i.modifierPrefix,e&&(m=e)}const b={install(e){f=e.c;const l=e.context;l.bem={},l.bem.b=null,l.bem.els=null}};function y(e){let l,n;return{before(t){l=t.bem.b,n=t.bem.els,t.bem.els=null},after(t){t.bem.b=l,t.bem.els=n},$({context:t,props:u}){return e=typeof e=="string"?e:e({context:t,props:u}),t.bem.b=e,`${(u==null?void 0:u.bPrefix)||r}${t.bem.b}`}}}function v(e){let l;return{before(n){l=n.bem.els},after(n){n.bem.els=l},$({context:n,props:t}){return e=typeof e=="string"?e:e({context:n,props:t}),n.bem.els=e.split(",").map(u=>u.trim()),n.bem.els.map(u=>`${(t==null?void 0:t.bPrefix)||r}${n.bem.b}${s}${u}`).join(", ")}}}function P(e){return{$({context:l,props:n}){e=typeof e=="string"?e:e({context:l,props:n});const t=e.split(",").map(o=>o.trim());function u(o){return t.map(x=>`&${(n==null?void 0:n.bPrefix)||r}${l.bem.b}${o!==void 0?`${s}${o}`:""}${m}${x}`).join(", ")}const c=l.bem.els;return c!==null?u(c[0]):u()}}}function _(e){return{$({context:l,props:n}){e=typeof e=="string"?e:e({context:l,props:n});const t=l.bem.els;return`&:not(${(n==null?void 0:n.bPrefix)||r}${l.bem.b}${t!==null&&t.length>0?`${s}${t[0]}`:""}${m}${e})`}}}return Object.assign(b,{cB:(...e)=>f(y(e[0]),e[1],e[2]),cE:(...e)=>f(v(e[0]),e[1],e[2]),cM:(...e)=>f(P(e[0]),e[1],e[2]),cNotM:(...e)=>f(_(e[0]),e[1],e[2])}),b}const $=Symbol("@css-render/vue3-ssr");function M(i,r){return`<style cssr-id="${i}">
import{i as d}from"./@vue-ca177dbe.js";function C(i){let r=".",s="__",m="--",f;if(i){let e=i.blockPrefix;e&&(r=e),e=i.elementPrefix,e&&(s=e),e=i.modifierPrefix,e&&(m=e)}const b={install(e){f=e.c;const l=e.context;l.bem={},l.bem.b=null,l.bem.els=null}};function y(e){let l,n;return{before(t){l=t.bem.b,n=t.bem.els,t.bem.els=null},after(t){t.bem.b=l,t.bem.els=n},$({context:t,props:u}){return e=typeof e=="string"?e:e({context:t,props:u}),t.bem.b=e,`${(u==null?void 0:u.bPrefix)||r}${t.bem.b}`}}}function v(e){let l;return{before(n){l=n.bem.els},after(n){n.bem.els=l},$({context:n,props:t}){return e=typeof e=="string"?e:e({context:n,props:t}),n.bem.els=e.split(",").map(u=>u.trim()),n.bem.els.map(u=>`${(t==null?void 0:t.bPrefix)||r}${n.bem.b}${s}${u}`).join(", ")}}}function P(e){return{$({context:l,props:n}){e=typeof e=="string"?e:e({context:l,props:n});const t=e.split(",").map(o=>o.trim());function u(o){return t.map(x=>`&${(n==null?void 0:n.bPrefix)||r}${l.bem.b}${o!==void 0?`${s}${o}`:""}${m}${x}`).join(", ")}const c=l.bem.els;return c!==null?u(c[0]):u()}}}function _(e){return{$({context:l,props:n}){e=typeof e=="string"?e:e({context:l,props:n});const t=l.bem.els;return`&:not(${(n==null?void 0:n.bPrefix)||r}${l.bem.b}${t!==null&&t.length>0?`${s}${t[0]}`:""}${m}${e})`}}}return Object.assign(b,{cB:(...e)=>f(y(e[0]),e[1],e[2]),cE:(...e)=>f(v(e[0]),e[1],e[2]),cM:(...e)=>f(P(e[0]),e[1],e[2]),cNotM:(...e)=>f(_(e[0]),e[1],e[2])}),b}const $=Symbol("@css-render/vue3-ssr");function M(i,r){return`<style cssr-id="${i}">
${r}
</style>`}function S(i,r){const s=d($,null);if(s===null){console.error("[css-render/vue3-ssr]: no ssr context found.");return}const{styles:m,ids:f}=s;f.has(i)||m!==null&&(f.add(i),m.push(M(i,r)))}const j=typeof document<"u";function N(){if(j)return;const i=d($,null);if(i!==null)return{adapter:S,context:i}}export{C as p,N as u};

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 @@
import{_ as F}from"./post-skeleton-3f57d9d8.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-427305f4.js";import{u as z}from"./vuex-cc1858c6.js";import{b as A}from"./vue-router-29025daf.js";import{a as R}from"./formatTime-b37c8e0f.js";import{d as S,r as n,j as V,c as o,L as a,Y as p,o as e,U as u,O as l,F as I,$ as L,K as M,a as s,M as _,a1 as O}from"./@vue-f70ab1bd.js";import{F as P,G as U,I as $,H as j}from"./naive-ui-ddb574dd.js";import{_ as q}from"./index-2c67ab1f.js";import"./vooks-dfdd6eef.js";import"./evtd-b614532e.js";import"./@vicons-2f3cb6b9.js";import"./moment-b7869f98.js";import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./@css-render-66126308.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-707ed124.js";/* empty css */const D={key:0,class:"pagination-wrap"},E={key:0,class:"skeleton-wrap"},G={key:1},H={key:0,class:"empty-wrap"},K={class:"bill-line"},T=S({__name:"Anouncement",setup(Y){const d=z(),g=A(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return V(()=>{}),(m,J)=>{const y=N,k=U,x=F,w=$,B=j,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",D,[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",E,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",G,[r.value.length===0?(e(),o("div",H,[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",K,[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(R)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=q(T,[["__scopeId","data-v-d4d04859"]]);export{kt as default};

@ -0,0 +1 @@
import{_ as F}from"./post-skeleton-a514cb09.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-bd108629.js";import{u as z}from"./vuex-d28e9067.js";import{b as A}from"./vue-router-88cc84d1.js";import{a as R}from"./formatTime-000dbebb.js";import{d as S,r as n,j as V,c as o,L as a,$ as p,o as e,Y as u,O as l,F as I,a2 as L,K as M,a as s,M as _,a4 as O}from"./@vue-ca177dbe.js";import{F as P,G as $,I as j,H as q}from"./naive-ui-2035804c.js";import{_ as D}from"./index-f67b4cc5.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./@vicons-6d35273b.js";import"./moment-b7869f98.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.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-707ed124.js";/* empty css */const E={key:0,class:"pagination-wrap"},G={key:0,class:"skeleton-wrap"},H={key:1},K={key:0,class:"empty-wrap"},T={class:"bill-line"},U=S({__name:"Anouncement",setup(Y){const d=z(),g=A(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return V(()=>{}),(m,J)=>{const y=N,k=$,x=F,w=j,B=q,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",E,[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",G,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",H,[r.value.length===0?(e(),o("div",K,[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",T,[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(R)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=D(U,[["__scopeId","data-v-d4d04859"]]);export{kt as default};

@ -1 +0,0 @@
import{_ as z}from"./post-item.vue_vue_type_style_index_0_lang-d2304aff.js";import{_ as B}from"./post-skeleton-3f57d9d8.js";import{_ as F}from"./main-nav.vue_vue_type_style_index_0_lang-427305f4.js";import{u as P}from"./vuex-cc1858c6.js";import{b as R,u as $}from"./vue-router-29025daf.js";import{G as b,_ as G}from"./index-2c67ab1f.js";import{d as I,r as s,j as L,c as e,L as n,Y as m,U as M,O as u,o as t,F as N,$ as S,K as U}from"./@vue-f70ab1bd.js";import{F as V,G as j,I as q,H as E}from"./naive-ui-ddb574dd.js";import"./content-8a1c5cf4.js";import"./@vicons-2f3cb6b9.js";import"./nonesir-video-29a967e9.js";import"./formatTime-b37c8e0f.js";import"./moment-b7869f98.js";import"./vooks-dfdd6eef.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./@css-render-66126308.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 H={key:0,class:"skeleton-wrap"},K={key:1},O={key:0,class:"empty-wrap"},T={key:0,class:"pagination-wrap"},Y=I({__name:"Collection",setup(A){const d=P(),g=R();$();const a=s(!1),_=s([]),p=s(+g.query.p||1),i=s(20),r=s(0),l=()=>{a.value=!0,b({page:p.value,page_size:i.value}).then(o=>{a.value=!1,_.value=o.list,r.value=Math.ceil(o.pager.total_rows/i.value),window.scrollTo(0,0)}).catch(o=>{a.value=!1})},v=o=>{p.value=o,l()};return L(()=>{l()}),(o,D)=>{const f=F,h=B,k=q,y=z,w=E,C=V,x=j;return t(),e("div",null,[n(f,{title:"收藏"}),n(C,{class:"main-content-wrap",bordered:""},{default:m(()=>[a.value?(t(),e("div",H,[n(h,{num:i.value},null,8,["num"])])):(t(),e("div",K,[_.value.length===0?(t(),e("div",O,[n(k,{size:"large",description:"暂无数据"})])):u("",!0),(t(!0),e(N,null,S(_.value,c=>(t(),U(w,{key:c.id},{default:m(()=>[n(y,{post:c},null,8,["post"])]),_:2},1024))),128))]))]),_:1}),r.value>0?(t(),e("div",T,[n(x,{page:p.value,"onUpdate:page":v,"page-slot":M(d).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):u("",!0)])}}});const xt=G(Y,[["__scopeId","data-v-1e709369"]]);export{xt as default};

@ -0,0 +1 @@
import{_ as z}from"./post-item.vue_vue_type_style_index_0_lang-1c980697.js";import{_ as B}from"./post-skeleton-a514cb09.js";import{_ as F}from"./main-nav.vue_vue_type_style_index_0_lang-bd108629.js";import{u as P}from"./vuex-d28e9067.js";import{b as R,u as $}from"./vue-router-88cc84d1.js";import{K as b,_ as I}from"./index-f67b4cc5.js";import{d as K,r as a,j as L,c as e,L as n,$ as m,Y as M,O as u,o as t,F as N,a2 as S,K as V}from"./@vue-ca177dbe.js";import{F as j,G as q,I as E,H as G}from"./naive-ui-2035804c.js";import"./content-71c02e20.js";import"./@vicons-6d35273b.js";import"./nonesir-video-db921567.js";import"./formatTime-000dbebb.js";import"./moment-b7869f98.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.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 H={key:0,class:"skeleton-wrap"},O={key:1},T={key:0,class:"empty-wrap"},U={key:0,class:"pagination-wrap"},Y=K({__name:"Collection",setup(A){const d=P(),g=R();$();const s=a(!1),_=a([]),p=a(+g.query.p||1),i=a(20),r=a(0),l=()=>{s.value=!0,b({page:p.value,page_size:i.value}).then(o=>{s.value=!1,_.value=o.list,r.value=Math.ceil(o.pager.total_rows/i.value),window.scrollTo(0,0)}).catch(o=>{s.value=!1})},v=o=>{p.value=o,l()};return L(()=>{l()}),(o,D)=>{const f=F,h=B,k=E,y=z,w=G,C=j,x=q;return t(),e("div",null,[n(f,{title:"收藏"}),n(C,{class:"main-content-wrap",bordered:""},{default:m(()=>[s.value?(t(),e("div",H,[n(h,{num:i.value},null,8,["num"])])):(t(),e("div",O,[_.value.length===0?(t(),e("div",T,[n(k,{size:"large",description:"暂无数据"})])):u("",!0),(t(!0),e(N,null,S(_.value,c=>(t(),V(w,{key:c.id},{default:m(()=>[n(y,{post:c},null,8,["post"])]),_:2},1024))),128))]))]),_:1}),r.value>0?(t(),e("div",U,[n(x,{page:p.value,"onUpdate:page":v,"page-slot":M(d).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):u("",!0)])}}});const xt=I(Y,[["__scopeId","data-v-1e709369"]]);export{xt as default};

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

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
var L=(A=>(A[A.TITLE=1]="TITLE",A[A.TEXT=2]="TEXT",A[A.IMAGEURL=3]="IMAGEURL",A[A.VIDEOURL=4]="VIDEOURL",A[A.AUDIOURL=5]="AUDIOURL",A[A.LINKURL=6]="LINKURL",A[A.ATTACHMENT=7]="ATTACHMENT",A[A.CHARGEATTACHMENT=8]="CHARGEATTACHMENT",A))(L||{}),R=(A=>(A[A.PUBLIC=0]="PUBLIC",A[A.PRIVATE=1]="PRIVATE",A[A.FRIEND=2]="FRIEND",A))(R||{});export{L as P,R as V};
var L=(A=>(A[A.TITLE=1]="TITLE",A[A.TEXT=2]="TEXT",A[A.IMAGEURL=3]="IMAGEURL",A[A.VIDEOURL=4]="VIDEOURL",A[A.AUDIOURL=5]="AUDIOURL",A[A.LINKURL=6]="LINKURL",A[A.ATTACHMENT=7]="ATTACHMENT",A[A.CHARGEATTACHMENT=8]="CHARGEATTACHMENT",A))(L||{}),R=(A=>(A[A.PUBLIC=0]="PUBLIC",A[A.PRIVATE=1]="PRIVATE",A[A.FRIEND=2]="FRIEND",A))(R||{}),U=(A=>(A[A.NO=0]="NO",A[A.YES=1]="YES",A))(U||{});export{L as P,R as V,U as Y};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{_ as M}from"./post-item.vue_vue_type_style_index_0_lang-1c980697.js";import{_ as N}from"./post-skeleton-a514cb09.js";import{_ as S}from"./main-nav.vue_vue_type_style_index_0_lang-bd108629.js";import{u as U}from"./vuex-d28e9067.js";import{b as V}from"./vue-router-88cc84d1.js";import{A as D,_ as L}from"./index-f67b4cc5.js";import{d as R,r,j,c as a,L as e,Y as _,K as h,$ as m,O as d,o as t,a as s,M as f,F as q,a2 as A}from"./@vue-ca177dbe.js";import{F as E,G,o as H,f as K,g as O,I as T,H as Y}from"./naive-ui-2035804c.js";import"./content-71c02e20.js";import"./@vicons-6d35273b.js";import"./nonesir-video-db921567.js";import"./formatTime-000dbebb.js";import"./moment-b7869f98.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.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 J={class:"profile-baseinfo"},Q={class:"avatar"},W={class:"base-info"},X={class:"username"},Z={class:"uid"},ee={key:0,class:"skeleton-wrap"},te={key:1},oe={key:0,class:"empty-wrap"},se={key:1,class:"pagination-wrap"},ne=R({__name:"Profile",setup(ae){const o=U(),k=V(),i=r(!1),p=r([]),l=r(+k.query.p||1),c=r(20),u=r(0),g=()=>{i.value=!0,D({username:o.state.userInfo.username,page:l.value,page_size:c.value}).then(n=>{i.value=!1,p.value=n.list,u.value=Math.ceil(n.pager.total_rows/c.value),window.scrollTo(0,0)}).catch(n=>{i.value=!1})},y=n=>{l.value=n,g()};return j(()=>{g()}),(n,_e)=>{const w=S,I=H,b=K,P=O,x=N,z=T,B=M,$=Y,C=E,F=G;return t(),a("div",null,[e(w,{title:"主页"}),_(o).state.userInfo.id>0?(t(),h(C,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:m(()=>[s("div",J,[s("div",Q,[e(I,{size:"large",src:_(o).state.userInfo.avatar},null,8,["src"])]),s("div",W,[s("div",X,[s("strong",null,f(_(o).state.userInfo.nickname),1),s("span",null," @"+f(_(o).state.userInfo.username),1)]),s("div",Z,"UID. "+f(_(o).state.userInfo.id),1)])]),e(P,{class:"profile-tabs-wrap",animated:""},{default:m(()=>[e(b,{name:"post",tab:"泡泡"})]),_:1}),i.value?(t(),a("div",ee,[e(x,{num:c.value},null,8,["num"])])):(t(),a("div",te,[p.value.length===0?(t(),a("div",oe,[e(z,{size:"large",description:"暂无数据"})])):d("",!0),(t(!0),a(q,null,A(p.value,v=>(t(),h($,{key:v.id},{default:m(()=>[e(B,{post:v},null,8,["post"])]),_:2},1024))),128))]))]),_:1})):d("",!0),u.value>0?(t(),a("div",se,[e(F,{page:l.value,"onUpdate:page":y,"page-slot":_(o).state.collapsedRight?5:8,"page-count":u.value},null,8,["page","page-slot","page-count"])])):d("",!0)])}}});const Ve=L(ne,[["__scopeId","data-v-1d87d974"]]);export{Ve as default};

@ -1 +0,0 @@
import{_ as F}from"./post-item.vue_vue_type_style_index_0_lang-d2304aff.js";import{_ as M}from"./post-skeleton-3f57d9d8.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-427305f4.js";import{u as S}from"./vuex-cc1858c6.js";import{b as V}from"./vue-router-29025daf.js";import{w as D,_ as L}from"./index-2c67ab1f.js";import{d as R,r,j,c as a,L as e,U as _,K as h,Y as m,O as d,o as t,a as s,M as f,F as q,$ as E}from"./@vue-f70ab1bd.js";import{F as G,G as H,o as K,f as O,g as T,I as Y,H as A}from"./naive-ui-ddb574dd.js";import"./content-8a1c5cf4.js";import"./@vicons-2f3cb6b9.js";import"./nonesir-video-29a967e9.js";import"./formatTime-b37c8e0f.js";import"./moment-b7869f98.js";import"./vooks-dfdd6eef.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./@css-render-66126308.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 J={class:"profile-baseinfo"},Q={class:"avatar"},W={class:"base-info"},X={class:"username"},Z={class:"uid"},ee={key:0,class:"skeleton-wrap"},te={key:1},oe={key:0,class:"empty-wrap"},se={key:1,class:"pagination-wrap"},ne=R({__name:"Profile",setup(ae){const o=S(),k=V(),i=r(!1),p=r([]),l=r(+k.query.p||1),c=r(20),u=r(0),g=()=>{i.value=!0,D({username:o.state.userInfo.username,page:l.value,page_size:c.value}).then(n=>{i.value=!1,p.value=n.list,u.value=Math.ceil(n.pager.total_rows/c.value),window.scrollTo(0,0)}).catch(n=>{i.value=!1})},y=n=>{l.value=n,g()};return j(()=>{g()}),(n,_e)=>{const w=N,I=K,b=O,P=T,x=M,z=Y,B=F,U=A,$=G,C=H;return t(),a("div",null,[e(w,{title:"主页"}),_(o).state.userInfo.id>0?(t(),h($,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:m(()=>[s("div",J,[s("div",Q,[e(I,{size:"large",src:_(o).state.userInfo.avatar},null,8,["src"])]),s("div",W,[s("div",X,[s("strong",null,f(_(o).state.userInfo.nickname),1),s("span",null," @"+f(_(o).state.userInfo.username),1)]),s("div",Z,"UID. "+f(_(o).state.userInfo.id),1)])]),e(P,{class:"profile-tabs-wrap",animated:""},{default:m(()=>[e(b,{name:"post",tab:"泡泡"})]),_:1}),i.value?(t(),a("div",ee,[e(x,{num:c.value},null,8,["num"])])):(t(),a("div",te,[p.value.length===0?(t(),a("div",oe,[e(z,{size:"large",description:"暂无数据"})])):d("",!0),(t(!0),a(q,null,E(p.value,v=>(t(),h(U,{key:v.id},{default:m(()=>[e(B,{post:v},null,8,["post"])]),_:2},1024))),128))]))]),_:1})):d("",!0),u.value>0?(t(),a("div",se,[e(C,{page:l.value,"onUpdate:page":y,"page-slot":_(o).state.collapsedRight?5:8,"page-count":u.value},null,8,["page","page-slot","page-count"])])):d("",!0)])}}});const Ve=L(ne,[["__scopeId","data-v-1d87d974"]]);export{Ve as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
import{q as x,u as S,r as I,t as U,_ as j}from"./index-2c67ab1f.js";import{l as z}from"./@vicons-2f3cb6b9.js";import{d as F,r as _,n as $,j as q,_ as E,o as l,c as u,L as n,Y as a,K as T,e as A,M as w,O as m,U as r,w as D,a3 as K,F as Y,$ as G}from"./@vue-f70ab1bd.js";import{o as H,M as L,j as J,e as P,O as Q,L as R,F as W,f as X,g as Z,a as tt,k as et}from"./naive-ui-ddb574dd.js";import{_ as ot}from"./main-nav.vue_vue_type_style_index_0_lang-427305f4.js";import{u as nt}from"./vuex-cc1858c6.js";import"./vue-router-29025daf.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./evtd-b614532e.js";import"./@css-render-66126308.js";import"./vooks-dfdd6eef.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 st={key:0,class:"tag-item"},at={key:0,class:"tag-quote"},ct={key:1,class:"tag-quote tag-follow"},lt={key:0,class:"options"},it=F({__name:"tag-item",props:{tag:null,showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(s){const e=s,g=_(!1),d=$(()=>{let o=[];return e.tag.is_following===0?o.push({label:"关注",key:"follow"}):(e.tag.is_top===0?o.push({label:"置顶",key:"stick"}):o.push({label:"取消置顶",key:"unstick"}),o.push({label:"取消关注",key:"unfollow"})),o}),i=o=>{switch(o){case"follow":I({topic_id:e.tag.id}).then(t=>{e.tag.is_following=1,window.$message.success("关注成功")}).catch(t=>{console.log(t)});break;case"unfollow":S({topic_id:e.tag.id}).then(t=>{e.tag.is_following=0,window.$message.success("取消关注")}).catch(t=>{console.log(t)});break;case"stick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("置顶成功")}).catch(t=>{console.log(t)});break;case"unstick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("取消置顶")}).catch(t=>{console.log(t)});break}};return q(()=>{g.value=!1}),(o,t)=>{const k=E("router-link"),f=H,v=L,c=J,h=P,y=Q,p=R;return!s.checkFollowing||s.checkFollowing&&s.tag.is_following===1?(l(),u("div",st,[n(p,null,{header:a(()=>[(l(),T(v,{type:"success",size:"large",round:"",key:s.tag.id},{avatar:a(()=>[n(f,{src:s.tag.user.avatar},null,8,["src"])]),default:a(()=>[n(k,{class:"hash-link",to:{name:"home",query:{q:s.tag.tag,t:"tag"}}},{default:a(()=>[A(" #"+w(s.tag.tag),1)]),_:1},8,["to"]),s.showAction?m("",!0):(l(),u("span",at,"("+w(s.tag.quote_num)+")",1)),s.showAction?(l(),u("span",ct,"("+w(s.tag.quote_num)+")",1)):m("",!0)]),_:1}))]),"header-extra":a(()=>[s.showAction?(l(),u("div",lt,[n(y,{placement:"bottom-end",trigger:"click",size:"small",options:r(d),onSelect:i},{default:a(()=>[n(h,{type:"success",quaternary:"",circle:"",block:""},{icon:a(()=>[n(c,null,{default:a(()=>[n(r(z))]),_:1})]),_:1})]),_:1},8,["options"])])):m("",!0)]),_:1})])):m("",!0)}}});const _t=F({__name:"Topic",setup(s){const e=nt(),g=_([]),d=_("hot"),i=_(!1),o=_(!1),t=_(!1);D(o,()=>{o.value||(window.$message.success("保存成功"),e.commit("refreshTopicFollow"))});const k=$({get:()=>{let c="编辑";return o.value&&(c="保存"),c},set:c=>{}}),f=()=>{i.value=!0,U({type:d.value,num:50}).then(c=>{g.value=c.topics,i.value=!1}).catch(c=>{console.log(c),i.value=!1})},v=c=>{d.value=c,c=="follow"?t.value=!0:t.value=!1,f()};return q(()=>{f()}),(c,h)=>{const y=ot,p=X,B=L,C=Z,V=it,M=tt,N=et,O=W;return l(),u("div",null,[n(y,{title:"话题"}),n(O,{class:"main-content-wrap tags-wrap",bordered:""},{default:a(()=>[n(C,{type:"line",animated:"","onUpdate:value":v},K({default:a(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),r(e).state.userLogined?(l(),T(p,{key:0,name:"follow",tab:"关注"})):m("",!0)]),_:2},[r(e).state.userLogined?{name:"suffix",fn:a(()=>[n(B,{checked:o.value,"onUpdate:checked":h[0]||(h[0]=b=>o.value=b),checkable:""},{default:a(()=>[A(w(r(k)),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(N,{show:i.value},{default:a(()=>[n(M,null,{default:a(()=>[(l(!0),u(Y,null,G(g.value,b=>(l(),T(V,{tag:b,showAction:r(e).state.userLogined&&o.value,checkFollowing:t.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Vt=j(_t,[["__scopeId","data-v-15794a53"]]);export{Vt as default};

@ -0,0 +1 @@
import{w as x,x as S,y as z,z as I,_ as j}from"./index-f67b4cc5.js";import{p as E}from"./@vicons-6d35273b.js";import{d as F,r as _,n as $,j as q,a1 as U,o as l,c as u,L as n,$ as a,K as T,e as A,M as w,O as m,Y as r,w as D,a6 as K,F as Y,a2 as G}from"./@vue-ca177dbe.js";import{o as H,M as L,j as J,e as P,O as Q,L as R,F as W,f as X,g as Z,a as tt,k as et}from"./naive-ui-2035804c.js";import{_ as ot}from"./main-nav.vue_vue_type_style_index_0_lang-bd108629.js";import{u as nt}from"./vuex-d28e9067.js";import"./vue-router-88cc84d1.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./evtd-b614532e.js";import"./@css-render-480a363d.js";import"./vooks-2c48c2b5.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 st={key:0,class:"tag-item"},at={key:0,class:"tag-quote"},ct={key:1,class:"tag-quote tag-follow"},lt={key:0,class:"options"},it=F({__name:"tag-item",props:{tag:null,showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(s){const e=s,g=_(!1),d=$(()=>{let o=[];return e.tag.is_following===0?o.push({label:"关注",key:"follow"}):(e.tag.is_top===0?o.push({label:"置顶",key:"stick"}):o.push({label:"取消置顶",key:"unstick"}),o.push({label:"取消关注",key:"unfollow"})),o}),i=o=>{switch(o){case"follow":z({topic_id:e.tag.id}).then(t=>{e.tag.is_following=1,window.$message.success("关注成功")}).catch(t=>{console.log(t)});break;case"unfollow":S({topic_id:e.tag.id}).then(t=>{e.tag.is_following=0,window.$message.success("取消关注")}).catch(t=>{console.log(t)});break;case"stick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("置顶成功")}).catch(t=>{console.log(t)});break;case"unstick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("取消置顶")}).catch(t=>{console.log(t)});break}};return q(()=>{g.value=!1}),(o,t)=>{const k=U("router-link"),f=H,v=L,c=J,h=P,y=Q,p=R;return!s.checkFollowing||s.checkFollowing&&s.tag.is_following===1?(l(),u("div",st,[n(p,null,{header:a(()=>[(l(),T(v,{type:"success",size:"large",round:"",key:s.tag.id},{avatar:a(()=>[n(f,{src:s.tag.user.avatar},null,8,["src"])]),default:a(()=>[n(k,{class:"hash-link",to:{name:"home",query:{q:s.tag.tag,t:"tag"}}},{default:a(()=>[A(" #"+w(s.tag.tag),1)]),_:1},8,["to"]),s.showAction?m("",!0):(l(),u("span",at,"("+w(s.tag.quote_num)+")",1)),s.showAction?(l(),u("span",ct,"("+w(s.tag.quote_num)+")",1)):m("",!0)]),_:1}))]),"header-extra":a(()=>[s.showAction?(l(),u("div",lt,[n(y,{placement:"bottom-end",trigger:"click",size:"small",options:r(d),onSelect:i},{default:a(()=>[n(h,{type:"success",quaternary:"",circle:"",block:""},{icon:a(()=>[n(c,null,{default:a(()=>[n(r(E))]),_:1})]),_:1})]),_:1},8,["options"])])):m("",!0)]),_:1})])):m("",!0)}}});const _t=F({__name:"Topic",setup(s){const e=nt(),g=_([]),d=_("hot"),i=_(!1),o=_(!1),t=_(!1);D(o,()=>{o.value||(window.$message.success("保存成功"),e.commit("refreshTopicFollow"))});const k=$({get:()=>{let c="编辑";return o.value&&(c="保存"),c},set:c=>{}}),f=()=>{i.value=!0,I({type:d.value,num:50}).then(c=>{g.value=c.topics,i.value=!1}).catch(c=>{console.log(c),i.value=!1})},v=c=>{d.value=c,c=="follow"?t.value=!0:t.value=!1,f()};return q(()=>{f()}),(c,h)=>{const y=ot,p=X,B=L,C=Z,V=it,M=tt,N=et,O=W;return l(),u("div",null,[n(y,{title:"话题"}),n(O,{class:"main-content-wrap tags-wrap",bordered:""},{default:a(()=>[n(C,{type:"line",animated:"","onUpdate:value":v},K({default:a(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),r(e).state.userLogined?(l(),T(p,{key:0,name:"follow",tab:"关注"})):m("",!0)]),_:2},[r(e).state.userLogined?{name:"suffix",fn:a(()=>[n(B,{checked:o.value,"onUpdate:checked":h[0]||(h[0]=b=>o.value=b),checkable:""},{default:a(()=>[A(w(r(k)),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(N,{show:i.value},{default:a(()=>[n(M,null,{default:a(()=>[(l(!0),u(Y,null,G(g.value,b=>(l(),T(V,{tag:b,showAction:r(e).state.userLogined&&o.value,checkFollowing:t.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Vt=j(_t,[["__scopeId","data-v-15794a53"]]);export{Vt as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{h as r}from"./moment-b7869f98.js";r.locale("zh-cn");const f=e=>r.unix(e).fromNow(),a=e=>{let t=r.unix(e),o=r();return t.year()!=o.year()?t.utc(!0).format("YYYY-MM-DD HH:mm"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD HH:mm"):t.fromNow()},n=e=>{let t=r.unix(e),o=r();return t.year()!=o.year()?t.utc(!0).format("YYYY-MM-DD"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD"):t.fromNow()};export{f as a,n as b,a as f};

@ -1 +0,0 @@
import{h as r}from"./moment-b7869f98.js";r.locale("zh-cn");const n=o=>r.unix(o).fromNow(),a=(o,e)=>{if(e)return r.unix(o).fromNow();let t=r.unix(o),m=r();return t.year()!=m.year()?t.utc(!0).format("YYYY-MM-DD HH:mm"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD HH:mm"):t.fromNow()};export{n as a,a as f};

File diff suppressed because one or more lines are too long

@ -1 +1 @@
.auth-wrap[data-v-52205ad0]{margin-top:-30px}.dark .auth-wrap[data-v-52205ad0]{background-color:#101014bf}.rightbar-wrap[data-v-54a02510]{width:240px;position:fixed;left:calc(50% + var(--content-main) / 2 + 10px)}.rightbar-wrap .search-wrap[data-v-54a02510]{margin:12px 0}.rightbar-wrap .hot-tag-item[data-v-54a02510]{line-height:2;position:relative}.rightbar-wrap .hot-tag-item .hash-link[data-v-54a02510]{width:calc(100% - 60px);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.rightbar-wrap .hot-tag-item .post-num[data-v-54a02510]{position:absolute;right:0;top:0;width:60px;text-align:right;line-height:2;opacity:.5}.rightbar-wrap .hottopic-wrap[data-v-54a02510]{margin-bottom:10px}.rightbar-wrap .copyright-wrap .copyright[data-v-54a02510]{font-size:12px;opacity:.75}.rightbar-wrap .copyright-wrap .hash-link[data-v-54a02510]{font-size:12px}.dark .hottopic-wrap[data-v-54a02510],.dark .copyright-wrap[data-v-54a02510]{background-color:#18181c}.sidebar-wrap{z-index:99;width:200px;height:100vh;position:fixed;right:calc(50% + var(--content-main) / 2 + 10px);padding:12px 0;box-sizing:border-box}.sidebar-wrap .n-menu .n-menu-item-content:before{border-radius:21px}.logo-wrap{display:flex;justify-content:flex-start;margin-bottom:12px}.logo-wrap .logo-img{margin-left:24px}.logo-wrap .logo-img:hover{cursor:pointer}.user-wrap{display:flex;align-items:center;position:absolute;bottom:12px;left:12px;right:12px}.user-wrap .user-mini-wrap{display:none}.user-wrap .user-avatar{margin-right:8px}.user-wrap .user-info{display:flex;flex-direction:column}.user-wrap .user-info .nickname{font-size:16px;font-weight:700;line-height:16px;height:16px;margin-bottom:2px;display:flex;align-items:center}.user-wrap .user-info .nickname .nickname-txt{max-width:90px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.user-wrap .user-info .nickname .logout{margin-left:6px}.user-wrap .user-info .username{font-size:14px;line-height:16px;height:16px;width:120px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;opacity:.75}.user-wrap .login-only-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-only-wrap button{margin:0 4px;width:80%}.user-wrap .login-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-wrap button{margin:0 4px}.auth-card .n-card-header{z-index:999}@media screen and (max-width: 821px){.sidebar-wrap{width:200px;right:calc(100% - 200px)}.logo-wrap .logo-img{margin-left:12px!important}.user-wrap .user-avatar,.user-wrap .user-info,.user-wrap .login-only-wrap,.user-wrap .login-wrap{margin-bottom:32px}}:root{--content-main: 544px}.app-container{margin:0}.app-container .app-wrap{width:100%;margin:0 auto}.main-wrap{min-height:100vh;display:flex;flex-direction:row;justify-content:center}.main-wrap .content-wrap{width:100%;max-width:var(--content-main);position:relative}.main-wrap .main-content-wrap{margin:0;border-top:none;border-radius:0}.main-wrap .main-content-wrap .n-list-item{padding:0}.empty-wrap{min-height:300px;display:flex;align-items:center;justify-content:center}.hash-link,.user-link{color:#18a058;text-decoration:none;cursor:pointer}.hash-link:hover,.user-link:hover{opacity:.8}.beian-link{color:#333;text-decoration:none}.beian-link:hover{opacity:.75}.username-link{color:#000;color:none;text-decoration:none;cursor:pointer}.username-link:hover{text-decoration:underline}.dark .hash-link,.dark .user-link{color:#63e2b7}.dark .username-link{color:#eee}.dark .beian-link{color:#ddd}@media screen and (max-width: 821px){.content-wrap{top:0;position:absolute!important}}
.auth-wrap[data-v-053dfa44]{margin-top:-30px}.dark .auth-wrap[data-v-053dfa44]{background-color:#101014bf}.rightbar-wrap[data-v-f4a84024]{width:240px;position:fixed;left:calc(50% + var(--content-main) / 2 + 10px)}.rightbar-wrap .search-wrap[data-v-f4a84024]{margin:12px 0}.rightbar-wrap .hot-tag-item[data-v-f4a84024]{line-height:2;position:relative}.rightbar-wrap .hot-tag-item .hash-link[data-v-f4a84024]{width:calc(100% - 60px);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.rightbar-wrap .hot-tag-item .post-num[data-v-f4a84024]{position:absolute;right:0;top:0;width:60px;text-align:right;line-height:2;opacity:.5}.rightbar-wrap .hottopic-wrap[data-v-f4a84024]{margin-bottom:10px}.rightbar-wrap .copyright-wrap .copyright[data-v-f4a84024]{font-size:12px;opacity:.75}.rightbar-wrap .copyright-wrap .hash-link[data-v-f4a84024]{font-size:12px}.dark .hottopic-wrap[data-v-f4a84024],.dark .copyright-wrap[data-v-f4a84024]{background-color:#18181c}.sidebar-wrap{z-index:99;width:200px;height:100vh;position:fixed;right:calc(50% + var(--content-main) / 2 + 10px);padding:12px 0;box-sizing:border-box}.sidebar-wrap .n-menu .n-menu-item-content:before{border-radius:21px}.logo-wrap{display:flex;justify-content:flex-start;margin-bottom:12px}.logo-wrap .logo-img{margin-left:24px}.logo-wrap .logo-img:hover{cursor:pointer}.user-wrap{display:flex;align-items:center;position:absolute;bottom:12px;left:12px;right:12px}.user-wrap .user-mini-wrap{display:none}.user-wrap .user-avatar{margin-right:8px}.user-wrap .user-info{display:flex;flex-direction:column}.user-wrap .user-info .nickname{font-size:16px;font-weight:700;line-height:16px;height:16px;margin-bottom:2px;display:flex;align-items:center}.user-wrap .user-info .nickname .nickname-txt{max-width:90px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.user-wrap .user-info .nickname .logout{margin-left:6px}.user-wrap .user-info .username{font-size:14px;line-height:16px;height:16px;width:120px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;opacity:.75}.user-wrap .login-only-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-only-wrap button{margin:0 4px;width:80%}.user-wrap .login-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-wrap button{margin:0 4px}.auth-card .n-card-header{z-index:999}@media screen and (max-width: 821px){.sidebar-wrap{width:200px;right:calc(100% - 200px)}.logo-wrap .logo-img{margin-left:12px!important}.user-wrap .user-avatar,.user-wrap .user-info,.user-wrap .login-only-wrap,.user-wrap .login-wrap{margin-bottom:32px}}:root{--content-main: 544px}.app-container{margin:0}.app-container .app-wrap{width:100%;margin:0 auto}.main-wrap{min-height:100vh;display:flex;flex-direction:row;justify-content:center}.main-wrap .content-wrap{width:100%;max-width:var(--content-main);position:relative}.main-wrap .main-content-wrap{margin:0;border-top:none;border-radius:0}.main-wrap .main-content-wrap .n-list-item{padding:0}.empty-wrap{min-height:300px;display:flex;align-items:center;justify-content:center}.hash-link,.user-link{color:#18a058;text-decoration:none;cursor:pointer}.hash-link:hover,.user-link:hover{opacity:.8}.beian-link{color:#333;text-decoration:none}.beian-link:hover{opacity:.75}.username-link{color:#000;color:none;text-decoration:none;cursor:pointer}.username-link:hover{text-decoration:underline}.dark .hash-link,.dark .user-link{color:#63e2b7}.dark .username-link{color:#eee}.dark .beian-link{color:#ddd}@media screen and (max-width: 821px){.content-wrap{top:0;position:absolute!important}}

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{V as E}from"./index-2c67ab1f.js";import{u as S}from"./vuex-cc1858c6.js";import{u as z}from"./vue-router-29025daf.js";import{j as A}from"./vooks-dfdd6eef.js";import{D as C,u as D,v as N,w as P}from"./@vicons-2f3cb6b9.js";import{a3 as x,a4 as R,j as V,e as I,a5 as j,h as H}from"./naive-ui-ddb574dd.js";import{d as L,r as f,j as U,o as a,c as g,U as o,L as e,Y as t,O as c,a as q,K as _,e as F,M as $,F as K}from"./@vue-f70ab1bd.js";const Y={key:0},G={class:"navbar"},oe=L({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(r){const i=r,n=S(),m=z(),l=f(!1),k=f("left"),u=d=>{d?(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 U(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(d,p)=>{const y=E,b=x,O=R,s=V,h=I,M=j,T=H;return a(),g(K,null,[o(n).state.drawerModelShow?(a(),g("div",Y,[e(O,{show:l.value,"onUpdate:show":p[0]||(p[0]=B=>l.value=B),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",G,[o(n).state.drawerModelShow&&!r.back?(a(),_(h,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),r.back?(a(),_(h,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(D))]),_:1})]),_:1})):c("",!0),F(" "+$(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(s,{component:o(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(s,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};
import{Z as B}from"./index-f67b4cc5.js";import{u as E}from"./vuex-d28e9067.js";import{u as S}from"./vue-router-88cc84d1.js";import{j as A}from"./vooks-2c48c2b5.js";import{D as C,y as D,z as N,F as P}from"./@vicons-6d35273b.js";import{a3 as x,a4 as R,j as I,e as V,a5 as j,h as F}from"./naive-ui-2035804c.js";import{d as H,r as f,j as L,o as a,c as g,Y as o,L as e,$ as t,O as c,a as $,K as _,e as q,M as U,F as K}from"./@vue-ca177dbe.js";const Y={key:0},Z={class:"navbar"},oe=H({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(r){const i=r,n=E(),m=S(),l=f(!1),k=f("left"),u=d=>{d?(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 L(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(d,p)=>{const y=B,b=x,O=R,s=I,h=V,M=j,T=F;return a(),g(K,null,[o(n).state.drawerModelShow?(a(),g("div",Y,[e(O,{show:l.value,"onUpdate:show":p[0]||(p[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(()=>[$("div",Z,[o(n).state.drawerModelShow&&!r.back?(a(),_(h,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),r.back?(a(),_(h,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(D))]),_:1})]),_:1})):c("",!0),q(" "+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(s,{component:o(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(s,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};

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 @@
.post-item{width:100%;padding:16px;box-sizing:border-box}.post-item .nickname-wrap{font-size:14px}.post-item .username-wrap{font-size:14px;opacity:.75}.post-item .top-tag{transform:scale(.75)}.post-item .timestamp-mobile{margin-top:2px;opacity:.75;font-size:11px}.post-item .timestamp{opacity:.75;font-size:12px}.post-item .post-text{text-align:justify;overflow:hidden;white-space:pre-wrap;word-break:break-all}.post-item .opt-item{display:flex;align-items:center;opacity:.7}.post-item .opt-item .opt-item-icon{margin-right:10px}.post-item:hover{background:#f7f9f9;cursor:pointer}.post-item .n-thing-avatar{margin-top:0}.post-item .n-thing-header{line-height:16px;margin-bottom:8px!important}.dark .post-item{background-color:#101014bf}.dark .post-item:hover{background:#18181c}

@ -1 +0,0 @@
.post-item{width:100%;padding:16px;box-sizing:border-box}.post-item .nickname-wrap{font-size:14px}.post-item .username-wrap{font-size:14px;opacity:.75}.post-item .top-tag{transform:scale(.75)}.post-item .timestamp{opacity:.75;font-size:12px}.post-item .post-text{text-align:justify;overflow:hidden;white-space:pre-wrap;word-break:break-all}.post-item .opt-item{display:flex;align-items:center;opacity:.7}.post-item .opt-item .opt-item-icon{margin-right:10px}.post-item:hover{background:#f7f9f9;cursor:pointer}.post-item .n-thing-avatar{margin-top:0}.post-item .n-thing-header{line-height:16px;margin-bottom:8px!important}.dark .post-item{background-color:#101014bf}.dark .post-item:hover{background:#18181c}

@ -0,0 +1 @@
import{p as T,a as $,_ as j,b as V,c as D}from"./content-71c02e20.js";import{d as H,n as P,a1 as F,o as a,c as d,L as i,a6 as I,Y as t,$ as o,a as p,M as r,F as R,a2 as E,a0 as x,e as _,K as l,O as c}from"./@vue-ca177dbe.js";import{u as K}from"./vuex-d28e9067.js";import{b as Y,u as A}from"./vue-router-88cc84d1.js";import{b}from"./formatTime-000dbebb.js";import{j as G,l as J,m as Q,o as U}from"./@vicons-6d35273b.js";import{o as W,M as X,j as Z,a as tt,L as et}from"./naive-ui-2035804c.js";const st={class:"nickname-wrap"},ot={class:"username-wrap"},nt={key:3},at={class:"timestamp-mobile"},it={class:"timestamp"},rt=["innerHTML"],ct={class:"opt-item"},pt={class:"opt-item"},_t={class:"opt-item"},lt={class:"opt-item"},yt=H({__name:"post-item",props:{post:null},setup(C){const w=C;Y();const h=A(),g=K(),e=P(()=>{let n=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},w.post);return n.contents.map(s=>{(+s.type==1||+s.type==2)&&n.texts.push(s),+s.type==3&&n.imgs.push(s),+s.type==4&&n.videos.push(s),+s.type==6&&n.links.push(s),+s.type==7&&n.attachments.push(s),+s.type==8&&n.charge_attachments.push(s)}),n}),y=n=>{h.push({name:"post",query:{id:n}})},z=(n,s)=>{if(n.target.dataset.detail){const m=n.target.dataset.detail.split(":");if(m.length===2){g.commit("refresh"),m[0]==="tag"?h.push({name:"home",query:{q:m[1],t:"tag"}}):h.push({name:"user",query:{username:m[1]}});return}}y(s)};return(n,s)=>{const m=W,M=F("router-link"),f=X,v=$,S=j,O=V,q=D,u=Z,B=tt,L=et;return a(),d("div",{class:"post-item",onClick:s[2]||(s[2]=k=>y(t(e).id))},[i(L,{"content-indented":""},I({avatar:o(()=>[i(m,{round:"",size:30,src:t(e).user.avatar},null,8,["src"])]),header:o(()=>[p("span",st,[i(M,{onClick:s[0]||(s[0]=x(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t(e).user.username}}},{default:o(()=>[_(r(t(e).user.nickname),1)]),_:1},8,["to"])]),p("span",ot," @"+r(t(e).user.username),1),t(e).is_top?(a(),l(f,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:o(()=>[_(" 置顶 ")]),_:1})):c("",!0),t(e).visibility==1?(a(),l(f,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:o(()=>[_(" 私密 ")]),_:1})):c("",!0),t(e).visibility==2?(a(),l(f,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:o(()=>[_(" 好友可见 ")]),_:1})):c("",!0),t(g).state.desktopModelShow?c("",!0):(a(),d("div",nt,[p("span",at,r(t(b)(t(e).created_on))+" "+r(t(e).ip_loc),1)]))]),footer:o(()=>[t(e).attachments.length>0?(a(),l(v,{key:0,attachments:t(e).attachments},null,8,["attachments"])):c("",!0),t(e).charge_attachments.length>0?(a(),l(v,{key:1,attachments:t(e).charge_attachments,price:t(e).attachment_price},null,8,["attachments","price"])):c("",!0),t(e).imgs.length>0?(a(),l(S,{key:2,imgs:t(e).imgs},null,8,["imgs"])):c("",!0),t(e).videos.length>0?(a(),l(O,{key:3,videos:t(e).videos},null,8,["videos"])):c("",!0),t(e).links.length>0?(a(),l(q,{key:4,links:t(e).links},null,8,["links"])):c("",!0)]),action:o(()=>[i(B,{justify:"space-between"},{default:o(()=>[p("div",ct,[i(u,{size:"18",class:"opt-item-icon"},{default:o(()=>[i(t(G))]),_:1}),_(" "+r(t(e).upvote_count),1)]),p("div",pt,[i(u,{size:"18",class:"opt-item-icon"},{default:o(()=>[i(t(J))]),_:1}),_(" "+r(t(e).comment_count),1)]),p("div",_t,[i(u,{size:"18",class:"opt-item-icon"},{default:o(()=>[i(t(Q))]),_:1}),_(" "+r(t(e).collection_count),1)]),p("div",lt,[i(u,{size:"18",class:"opt-item-icon"},{default:o(()=>[i(t(U))]),_:1}),_(" "+r(t(e).share_count),1)])]),_:1})]),_:2},[t(g).state.desktopModelShow?{name:"header-extra",fn:o(()=>[p("span",it,r(t(e).ip_loc?t(e).ip_loc+" · ":t(e).ip_loc)+" "+r(t(b)(t(e).created_on)),1)]),key:"0"}:void 0,t(e).texts.length>0?{name:"description",fn:o(()=>[(a(!0),d(R,null,E(t(e).texts,k=>(a(),d("span",{key:k.id,class:"post-text",onClick:s[1]||(s[1]=x(N=>z(N,t(e).id),["stop"])),innerHTML:t(T)(k.content).content},null,8,rt))),128))]),key:"1"}:void 0]),1024)])}}});export{yt as _};

@ -1 +0,0 @@
import{p as N,a as S,_ as $,b as V,c as j}from"./content-8a1c5cf4.js";import{d as H,n as R,_ as D,o as i,c as f,L as a,a3 as F,U as t,Y as n,F as I,$ as P,Z as v,a as l,e as r,M as c,K as p,O as _}from"./@vue-f70ab1bd.js";import{u as E}from"./vuex-cc1858c6.js";import{b as K,u as U}from"./vue-router-29025daf.js";import{a as Y}from"./formatTime-b37c8e0f.js";import{f as Z,h as A,i as G,k as J}from"./@vicons-2f3cb6b9.js";import{o as Q,M as W,j as X,a as tt,L as et}from"./naive-ui-ddb574dd.js";const st={class:"nickname-wrap"},nt={class:"username-wrap"},ot={class:"timestamp"},at=["innerHTML"],it={class:"opt-item"},rt={class:"opt-item"},ct={class:"opt-item"},pt={class:"opt-item"},ft=H({__name:"post-item",props:{post:null},setup(x){const C=x;K();const d=U(),z=E(),e=R(()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},C.post);return o.contents.map(s=>{(+s.type==1||+s.type==2)&&o.texts.push(s),+s.type==3&&o.imgs.push(s),+s.type==4&&o.videos.push(s),+s.type==6&&o.links.push(s),+s.type==7&&o.attachments.push(s),+s.type==8&&o.charge_attachments.push(s)}),o}),k=o=>{d.push({name:"post",query:{id:o}})},b=(o,s)=>{if(o.target.dataset.detail){const m=o.target.dataset.detail.split(":");if(m.length===2){z.commit("refresh"),m[0]==="tag"?d.push({name:"home",query:{q:m[1],t:"tag"}}):d.push({name:"user",query:{username:m[1]}});return}}k(s)};return(o,s)=>{const m=Q,w=D("router-link"),h=W,y=S,O=$,T=V,q=j,u=X,B=tt,L=et;return i(),f("div",{class:"post-item",onClick:s[2]||(s[2]=g=>k(t(e).id))},[a(L,{"content-indented":""},F({avatar:n(()=>[a(m,{round:"",size:30,src:t(e).user.avatar},null,8,["src"])]),header:n(()=>[l("span",st,[a(w,{onClick:s[0]||(s[0]=v(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t(e).user.username}}},{default:n(()=>[r(c(t(e).user.nickname),1)]),_:1},8,["to"])]),l("span",nt," @"+c(t(e).user.username),1),t(e).is_top?(i(),p(h,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[r(" 置顶 ")]),_:1})):_("",!0),t(e).visibility==1?(i(),p(h,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[r(" 私密 ")]),_:1})):_("",!0),t(e).visibility==2?(i(),p(h,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[r(" 好友可见 ")]),_:1})):_("",!0)]),"header-extra":n(()=>[l("span",ot,c(t(e).ip_loc?t(e).ip_loc+" · ":t(e).ip_loc)+" "+c(t(Y)(t(e).created_on)),1)]),footer:n(()=>[t(e).attachments.length>0?(i(),p(y,{key:0,attachments:t(e).attachments},null,8,["attachments"])):_("",!0),t(e).charge_attachments.length>0?(i(),p(y,{key:1,attachments:t(e).charge_attachments,price:t(e).attachment_price},null,8,["attachments","price"])):_("",!0),t(e).imgs.length>0?(i(),p(O,{key:2,imgs:t(e).imgs},null,8,["imgs"])):_("",!0),t(e).videos.length>0?(i(),p(T,{key:3,videos:t(e).videos},null,8,["videos"])):_("",!0),t(e).links.length>0?(i(),p(q,{key:4,links:t(e).links},null,8,["links"])):_("",!0)]),action:n(()=>[a(B,{justify:"space-between"},{default:n(()=>[l("div",it,[a(u,{size:"18",class:"opt-item-icon"},{default:n(()=>[a(t(Z))]),_:1}),r(" "+c(t(e).upvote_count),1)]),l("div",rt,[a(u,{size:"18",class:"opt-item-icon"},{default:n(()=>[a(t(A))]),_:1}),r(" "+c(t(e).comment_count),1)]),l("div",ct,[a(u,{size:"18",class:"opt-item-icon"},{default:n(()=>[a(t(G))]),_:1}),r(" "+c(t(e).collection_count),1)]),l("div",pt,[a(u,{size:"18",class:"opt-item-icon"},{default:n(()=>[a(t(J))]),_:1}),r(" "+c(t(e).share_count),1)])]),_:1})]),_:2},[t(e).texts.length>0?{name:"description",fn:n(()=>[(i(!0),f(I,null,P(t(e).texts,g=>(i(),f("span",{key:g.id,class:"post-text",onClick:s[1]||(s[1]=v(M=>b(M,t(e).id),["stop"])),innerHTML:t(N)(g.content).content},null,8,at))),128))]),key:"0"}:void 0]),1024)])}}});export{ft as _};

@ -1 +0,0 @@
import{U as c}from"./naive-ui-ddb574dd.js";import{d as r,o as s,c as n,$ as l,a as o,L as t,F as p}from"./@vue-f70ab1bd.js";import{_ as i}from"./index-2c67ab1f.js";const m={class:"user"},d={class:"content"},u=r({__name:"post-skeleton",props:{num:{default:1}},setup(_){return(f,k)=>{const e=c;return s(!0),n(p,null,l(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 _};

@ -0,0 +1 @@
import{U as c}from"./naive-ui-2035804c.js";import{d as r,o as s,c as n,a2 as l,a as o,L as t,F as p}from"./@vue-ca177dbe.js";import{_ as i}from"./index-f67b4cc5.js";const m={class:"user"},d={class:"content"},u=r({__name:"post-skeleton",props:{num:{default:1}},setup(_){return(f,k)=>{const e=c;return s(!0),n(p,null,l(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 _};

@ -0,0 +1 @@
.container[data-v-259be2b2]{box-sizing:initial;display:inline-block;text-align:center;border-radius:50%;overflow:hidden}.spinner[data-v-259be2b2]{box-sizing:initial;border:2px solid #a1a1a1;border-right-color:transparent;width:23px;height:23px;border-radius:50%;animation:spin-259be2b2 .9s linear infinite}@keyframes spin-259be2b2{to{transform:rotate(360deg)}}.state-error[data-v-9d82030b]{display:flex;flex-direction:column;align-items:center}.retry[data-v-9d82030b]{margin-top:8px;padding:2px 6px 4px;width:60px;color:inherit;font-size:14px;font-family:inherit;background:transparent;border:2px solid currentColor;border-radius:5px;outline:none;cursor:pointer}.retry[data-v-9d82030b]:hover{opacity:.8}

@ -0,0 +1 @@
import{r as v,R as B,j as H,H as L,o as b,c as h,S as p,L as j,O as u,a as d,M as g,w as y,y as C,U as N,V as O}from"./@vue-ca177dbe.js";const x=(e,o)=>{const t=e.__vccOpts||e;for(const[n,a]of o)t[n]=a;return t},V={},$=e=>(N("data-v-259be2b2"),e=e(),O(),e),M={class:"container"},R=$(()=>d("div",{class:"spinner"},null,-1)),T=[R];function U(e,o){return b(),h("div",M,T)}const D=x(V,[["render",U],["__scopeId","data-v-259be2b2"],["__file","/home/oumoussa/side-projects/infinite/src/components/Spinner.vue"]]),z=e=>({loading(){e.value="loading"},loaded(){e.value="loaded"},complete(){e.value="complete"},error(){e.value="error"}}),A=(e,o,t)=>()=>{const n=t.parentEl||document.documentElement;t.prevHeight=n.scrollHeight,o.loading(),e("infinite",o)},F=(e,o)=>{const t=e.getBoundingClientRect();if(!o)return t.top>=0&&t.bottom<=window.innerHeight;const n=o.getBoundingClientRect();return t.top>=n.top&&t.bottom<=n.bottom},_=e=>{e.parentEl=document.querySelector(e.target)||null;let o=`0px 0px ${e.distance}px 0px`;e.top&&(o=`${e.distance}px 0px 0px 0px`);const t=new IntersectionObserver(n=>{n[0].isIntersecting&&(e.firstload&&e.emit(),e.firstload=!0)},{root:e.parentEl,rootMargin:o});return t.observe(e.infiniteLoading.value),t},G={class:"state-error"},K={__name:"InfiniteLoading",props:{top:{type:Boolean,required:!1},target:{type:[String,Boolean],required:!1},distance:{type:Number,required:!1,default:0},identifier:{required:!1},firstload:{type:Boolean,required:!1,default:!0},slots:{type:Object,required:!1}},emits:["infinite"],setup(e,{emit:o}){const t=e;let n=null;const a=v(null),s=v("ready"),{top:m,firstload:E,target:k,distance:I}=t,{identifier:f}=B(t),r={infiniteLoading:a,target:k,top:m,firstload:E,distance:I,prevHeight:0,parentEl:null};r.emit=A(o,z(s),r);const S=()=>y(s,async i=>{const l=r.parentEl||document.documentElement;await C(),i=="loaded"&&m&&(l.scrollTop=l.scrollHeight-r.prevHeight),i=="loaded"&&F(a.value,r.parentEl)&&r.emit(),i=="complete"&&n.disconnect()}),q=()=>y(f,()=>{s.value="ready",n.disconnect(),n=_(r)});return H(()=>{n=_(r),S(),f&&q()}),L(()=>{n.disconnect()}),(i,l)=>(b(),h("div",{ref_key:"infiniteLoading",ref:a},[s.value=="loading"?p(i.$slots,"spinner",{key:0},()=>[j(D)],!0):u("v-if",!0),s.value=="complete"?p(i.$slots,"complete",{key:1},()=>{var c;return[d("span",null,g(((c=e.slots)==null?void 0:c.complete)||"No more results!"),1)]},!0):u("v-if",!0),s.value=="error"?p(i.$slots,"error",{key:2,retry:r.emit},()=>{var c;return[d("span",G,[d("span",null,g(((c=e.slots)==null?void 0:c.error)||"Oops something went wrong!"),1),d("button",{class:"retry",onClick:l[0]||(l[0]=(...w)=>r.emit&&r.emit(...w))}," retry ")])]},!0):u("v-if",!0)],512))}},J=x(K,[["__scopeId","data-v-9d82030b"],["__file","/home/oumoussa/side-projects/infinite/src/components/InfiniteLoading.vue"]]);export{J as K};

@ -1 +1 @@
import{r as f,R as c,w as q,n as k,g as V,j as U,h as g,k as B,D as X}from"./@vue-f70ab1bd.js";import{o as h,a as v}from"./evtd-b614532e.js";function N(e){const n=f(!!e.value);if(n.value)return c(n);const t=q(e,o=>{o&&(n.value=!0,t())});return c(n)}function ee(e){const n=k(e),t=f(n.value);return q(n,o=>{t.value=o}),typeof e=="function"?t:{__v_isRef:!0,get value(){return t.value},set value(o){e.set(o)}}}function I(){return V()!==null}const $=typeof window<"u";let y,L;const Y=()=>{var e,n;y=$?(n=(e=document)===null||e===void 0?void 0:e.fonts)===null||n===void 0?void 0:n.ready:void 0,L=!1,y!==void 0?y.then(()=>{L=!0}):L=!0};Y();function ne(e){if(L)return;let n=!1;U(()=>{L||y==null||y.then(()=>{n||e()})}),g(()=>{n=!0})}const M=f(null);function _(e){if(e.clientX>0||e.clientY>0)M.value={x:e.clientX,y:e.clientY};else{const{target:n}=e;if(n instanceof Element){const{left:t,top:o,width:u,height:i}=n.getBoundingClientRect();t>0||o>0?M.value={x:t+u/2,y:o+i/2}:M.value={x:0,y:0}}else M.value=null}}let E=0,H=!0;function te(){if(!$)return c(f(null));E===0&&h("click",document,_,!0);const e=()=>{E+=1};return H&&(H=I())?(B(e),g(()=>{E-=1,E===0&&v("click",document,_,!0)})):e(),c(M)}const K=f(void 0);let C=0;function R(){K.value=Date.now()}let S=!0;function ie(e){if(!$)return c(f(!1));const n=f(!1);let t=null;function o(){t!==null&&window.clearTimeout(t)}function u(){o(),n.value=!0,t=window.setTimeout(()=>{n.value=!1},e)}C===0&&h("click",window,R,!0);const i=()=>{C+=1,h("click",window,u,!0)};return S&&(S=I())?(B(i),g(()=>{C-=1,C===0&&v("click",window,R,!0),v("click",window,u,!0),o()})):i(),c(n)}let T=0;const O=typeof window<"u"&&window.matchMedia!==void 0,p=f(null);let r,w;function x(e){e.matches&&(p.value="dark")}function P(e){e.matches&&(p.value="light")}function Q(){r=window.matchMedia("(prefers-color-scheme: dark)"),w=window.matchMedia("(prefers-color-scheme: light)"),r.matches?p.value="dark":w.matches?p.value="light":p.value=null,r.addEventListener?(r.addEventListener("change",x),w.addEventListener("change",P)):r.addListener&&(r.addListener(x),w.addListener(P))}function z(){"removeEventListener"in r?(r.removeEventListener("change",x),w.removeEventListener("change",P)):"removeListener"in r&&(r.removeListener(x),w.removeListener(P)),r=void 0,w=void 0}let F=!0;function ae(){return O?(T===0&&Q(),F&&(F=I())&&(B(()=>{T+=1}),g(()=>{T-=1,T===0&&z()})),c(p)):c(p)}function oe(e,n){return q(e,t=>{t!==void 0&&(n.value=t)}),k(()=>e.value===void 0?n.value:e.value)}function ue(){const e=f(!1);return U(()=>{e.value=!0}),c(e)}function se(e,n){return k(()=>{for(const t of n)if(e[t]!==void 0)return e[t];return e[n[n.length-1]]})}const A=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function re(){return A}const G={xs:0,s:640,m:1024,l:1280,xl:1536,"2xl":1920};function J(e){return`(min-width: ${e}px)`}const b={};function le(e=G){if(!$)return k(()=>[]);if(typeof window.matchMedia!="function")return k(()=>[]);const n=f({}),t=Object.keys(e),o=(u,i)=>{u.matches?n.value[i]=!0:n.value[i]=!1};return t.forEach(u=>{const i=e[u];let s,l;b[i]===void 0?(s=window.matchMedia(J(i)),s.addEventListener?s.addEventListener("change",a=>{l.forEach(d=>{d(a,u)})}):s.addListener&&s.addListener(a=>{l.forEach(d=>{d(a,u)})}),l=new Set,b[i]={mql:s,cbs:l}):(s=b[i].mql,l=b[i].cbs),l.add(o),s.matches&&l.forEach(a=>{a(s,u)})}),g(()=>{t.forEach(u=>{const{cbs:i}=b[e[u]];i.has(o)&&i.delete(o)})}),k(()=>{const{value:u}=n;return t.filter(i=>u[i])})}function fe(e={},n){const t=X({ctrl:!1,command:!1,win:!1,shift:!1,tab:!1}),{keydown:o,keyup:u}=e,i=a=>{switch(a.key){case"Control":t.ctrl=!0;break;case"Meta":t.command=!0,t.win=!0;break;case"Shift":t.shift=!0;break;case"Tab":t.tab=!0;break}o!==void 0&&Object.keys(o).forEach(d=>{if(d!==a.key)return;const m=o[d];if(typeof m=="function")m(a);else{const{stop:j=!1,prevent:D=!1}=m;j&&a.stopPropagation(),D&&a.preventDefault(),m.handler(a)}})},s=a=>{switch(a.key){case"Control":t.ctrl=!1;break;case"Meta":t.command=!1,t.win=!1;break;case"Shift":t.shift=!1;break;case"Tab":t.tab=!1;break}u!==void 0&&Object.keys(u).forEach(d=>{if(d!==a.key)return;const m=u[d];if(typeof m=="function")m(a);else{const{stop:j=!1,prevent:D=!1}=m;j&&a.stopPropagation(),D&&a.preventDefault(),m.handler(a)}})},l=()=>{(n===void 0||n.value)&&(h("keydown",document,i),h("keyup",document,s)),n!==void 0&&q(n,a=>{a?(h("keydown",document,i),h("keyup",document,s)):(v("keydown",document,i),v("keyup",document,s))})};return I()?(B(l),g(()=>{(n===void 0||n.value)&&(v("keydown",document,i),v("keyup",document,s))})):l(),c(t)}export{re as a,oe as b,se as c,fe as d,ie as e,te as f,le as g,N as h,ue as i,ae as j,ne as o,ee as u};
import{r as f,W as c,w as q,n as k,g as V,j as U,h as g,k as B,D as X}from"./@vue-ca177dbe.js";import{o as h,a as v}from"./evtd-b614532e.js";function N(e){const n=f(!!e.value);if(n.value)return c(n);const t=q(e,o=>{o&&(n.value=!0,t())});return c(n)}function ee(e){const n=k(e),t=f(n.value);return q(n,o=>{t.value=o}),typeof e=="function"?t:{__v_isRef:!0,get value(){return t.value},set value(o){e.set(o)}}}function I(){return V()!==null}const $=typeof window<"u";let y,L;const Y=()=>{var e,n;y=$?(n=(e=document)===null||e===void 0?void 0:e.fonts)===null||n===void 0?void 0:n.ready:void 0,L=!1,y!==void 0?y.then(()=>{L=!0}):L=!0};Y();function ne(e){if(L)return;let n=!1;U(()=>{L||y==null||y.then(()=>{n||e()})}),g(()=>{n=!0})}const M=f(null);function _(e){if(e.clientX>0||e.clientY>0)M.value={x:e.clientX,y:e.clientY};else{const{target:n}=e;if(n instanceof Element){const{left:t,top:o,width:u,height:i}=n.getBoundingClientRect();t>0||o>0?M.value={x:t+u/2,y:o+i/2}:M.value={x:0,y:0}}else M.value=null}}let E=0,H=!0;function te(){if(!$)return c(f(null));E===0&&h("click",document,_,!0);const e=()=>{E+=1};return H&&(H=I())?(B(e),g(()=>{E-=1,E===0&&v("click",document,_,!0)})):e(),c(M)}const K=f(void 0);let C=0;function S(){K.value=Date.now()}let F=!0;function ie(e){if(!$)return c(f(!1));const n=f(!1);let t=null;function o(){t!==null&&window.clearTimeout(t)}function u(){o(),n.value=!0,t=window.setTimeout(()=>{n.value=!1},e)}C===0&&h("click",window,S,!0);const i=()=>{C+=1,h("click",window,u,!0)};return F&&(F=I())?(B(i),g(()=>{C-=1,C===0&&v("click",window,S,!0),v("click",window,u,!0),o()})):i(),c(n)}let T=0;const O=typeof window<"u"&&window.matchMedia!==void 0,p=f(null);let r,w;function x(e){e.matches&&(p.value="dark")}function P(e){e.matches&&(p.value="light")}function Q(){r=window.matchMedia("(prefers-color-scheme: dark)"),w=window.matchMedia("(prefers-color-scheme: light)"),r.matches?p.value="dark":w.matches?p.value="light":p.value=null,r.addEventListener?(r.addEventListener("change",x),w.addEventListener("change",P)):r.addListener&&(r.addListener(x),w.addListener(P))}function W(){"removeEventListener"in r?(r.removeEventListener("change",x),w.removeEventListener("change",P)):"removeListener"in r&&(r.removeListener(x),w.removeListener(P)),r=void 0,w=void 0}let R=!0;function ae(){return O?(T===0&&Q(),R&&(R=I())&&(B(()=>{T+=1}),g(()=>{T-=1,T===0&&W()})),c(p)):c(p)}function oe(e,n){return q(e,t=>{t!==void 0&&(n.value=t)}),k(()=>e.value===void 0?n.value:e.value)}function ue(){const e=f(!1);return U(()=>{e.value=!0}),c(e)}function se(e,n){return k(()=>{for(const t of n)if(e[t]!==void 0)return e[t];return e[n[n.length-1]]})}const z=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function re(){return z}const A={xs:0,s:640,m:1024,l:1280,xl:1536,"2xl":1920};function G(e){return`(min-width: ${e}px)`}const b={};function le(e=A){if(!$)return k(()=>[]);if(typeof window.matchMedia!="function")return k(()=>[]);const n=f({}),t=Object.keys(e),o=(u,i)=>{u.matches?n.value[i]=!0:n.value[i]=!1};return t.forEach(u=>{const i=e[u];let s,l;b[i]===void 0?(s=window.matchMedia(G(i)),s.addEventListener?s.addEventListener("change",a=>{l.forEach(d=>{d(a,u)})}):s.addListener&&s.addListener(a=>{l.forEach(d=>{d(a,u)})}),l=new Set,b[i]={mql:s,cbs:l}):(s=b[i].mql,l=b[i].cbs),l.add(o),s.matches&&l.forEach(a=>{a(s,u)})}),g(()=>{t.forEach(u=>{const{cbs:i}=b[e[u]];i.has(o)&&i.delete(o)})}),k(()=>{const{value:u}=n;return t.filter(i=>u[i])})}function fe(e={},n){const t=X({ctrl:!1,command:!1,win:!1,shift:!1,tab:!1}),{keydown:o,keyup:u}=e,i=a=>{switch(a.key){case"Control":t.ctrl=!0;break;case"Meta":t.command=!0,t.win=!0;break;case"Shift":t.shift=!0;break;case"Tab":t.tab=!0;break}o!==void 0&&Object.keys(o).forEach(d=>{if(d!==a.key)return;const m=o[d];if(typeof m=="function")m(a);else{const{stop:j=!1,prevent:D=!1}=m;j&&a.stopPropagation(),D&&a.preventDefault(),m.handler(a)}})},s=a=>{switch(a.key){case"Control":t.ctrl=!1;break;case"Meta":t.command=!1,t.win=!1;break;case"Shift":t.shift=!1;break;case"Tab":t.tab=!1;break}u!==void 0&&Object.keys(u).forEach(d=>{if(d!==a.key)return;const m=u[d];if(typeof m=="function")m(a);else{const{stop:j=!1,prevent:D=!1}=m;j&&a.stopPropagation(),D&&a.preventDefault(),m.handler(a)}})},l=()=>{(n===void 0||n.value)&&(h("keydown",document,i),h("keyup",document,s)),n!==void 0&&q(n,a=>{a?(h("keydown",document,i),h("keyup",document,s)):(v("keydown",document,i),v("keyup",document,s))})};return I()?(B(l),g(()=>{(n===void 0||n.value)&&(v("keydown",document,i),v("keyup",document,s))})):l(),c(t)}export{re as a,oe as b,se as c,fe as d,ie as e,te as f,le as g,N as h,ue as i,ae as j,ne as o,ee as u};

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

@ -8,27 +8,27 @@
<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-2c67ab1f.js"></script>
<link rel="modulepreload" crossorigin href="/assets/@vue-f70ab1bd.js">
<link rel="modulepreload" crossorigin href="/assets/vue-router-29025daf.js">
<link rel="modulepreload" crossorigin href="/assets/vuex-cc1858c6.js">
<script type="module" crossorigin src="/assets/index-f67b4cc5.js"></script>
<link rel="modulepreload" crossorigin href="/assets/@vue-ca177dbe.js">
<link rel="modulepreload" crossorigin href="/assets/vue-router-88cc84d1.js">
<link rel="modulepreload" crossorigin href="/assets/vuex-d28e9067.js">
<link rel="modulepreload" crossorigin href="/assets/axios-707ed124.js">
<link rel="modulepreload" crossorigin href="/assets/seemly-76b7b838.js">
<link rel="modulepreload" crossorigin href="/assets/evtd-b614532e.js">
<link rel="modulepreload" crossorigin href="/assets/@css-render-66126308.js">
<link rel="modulepreload" crossorigin href="/assets/vooks-dfdd6eef.js">
<link rel="modulepreload" crossorigin href="/assets/@css-render-480a363d.js">
<link rel="modulepreload" crossorigin href="/assets/vooks-2c48c2b5.js">
<link rel="modulepreload" crossorigin href="/assets/vdirs-b0483831.js">
<link rel="modulepreload" crossorigin href="/assets/@juggle-41516555.js">
<link rel="modulepreload" crossorigin href="/assets/@emotion-8a8e73f6.js">
<link rel="modulepreload" crossorigin href="/assets/css-render-6a5c5852.js">
<link rel="modulepreload" crossorigin href="/assets/vueuc-804c4158.js">
<link rel="modulepreload" crossorigin href="/assets/vueuc-973e5707.js">
<link rel="modulepreload" crossorigin href="/assets/lodash-es-8412e618.js">
<link rel="modulepreload" crossorigin href="/assets/treemate-25c27bff.js">
<link rel="modulepreload" crossorigin href="/assets/async-validator-dee29e8b.js">
<link rel="modulepreload" crossorigin href="/assets/date-fns-975a2d8f.js">
<link rel="modulepreload" crossorigin href="/assets/naive-ui-ddb574dd.js">
<link rel="modulepreload" crossorigin href="/assets/@vicons-2f3cb6b9.js">
<link rel="stylesheet" href="/assets/index-91393603.css">
<link rel="modulepreload" crossorigin href="/assets/naive-ui-2035804c.js">
<link rel="modulepreload" crossorigin href="/assets/@vicons-6d35273b.js">
<link rel="stylesheet" href="/assets/index-df729f44.css">
<link rel="stylesheet" href="/assets/vfonts-7afd136d.css">
</head>

@ -24,6 +24,7 @@
"qrcanvas-vue": "^3.0.0",
"qrcode": "^1.5.1",
"unplugin-vue-components": "^0.24.1",
"v3-infinite-loading": "^1.2.2",
"vfonts": "^0.0.3",
"vue": "^3.2.47",
"vue-router": "4",

@ -4,9 +4,9 @@
<n-dialog-provider>
<div
class="app-container"
:class="{ dark: theme?.name === 'dark' }"
:class="{ dark: theme?.name === 'dark', mobile: !store.state.desktopModelShow }"
>
<div has-sider class="main-wrap" position="static">
<div has-sider class="main-wrap" position="static" >
<!-- -->
<div v-if="store.state.desktopModelShow">
<sidebar />

@ -154,6 +154,50 @@ export const visibilityPost = (
});
};
/** 点赞评论 */
export const thumbsUpTweetComment = (
data: NetParams.PostTweetCommentThumbs
): Promise<NetReq.PostTweetCommentThumbs> => {
return request({
method: "post",
url: "/v1/tweet/comment/thumbsup",
data,
});
};
/** 点踩评论 */
export const thumbsDownTweetComment = (
data: NetParams.PostTweetCommentThumbs
): Promise<NetReq.PostTweetCommentThumbs> => {
return request({
method: "post",
url: "/v1/tweet/comment/thumbsdown",
data,
});
};
/** 点赞评论回复 */
export const thumbsUpTweetReply = (
data: NetParams.PostTweetReplyThumbs
): Promise<NetReq.PostTweetReplyThumbs> => {
return request({
method: "post",
url: "/v1/tweet/reply/thumbsup",
data,
});
};
/** 点踩评论回复 */
export const thumbsDownTweetReply = (
data: NetParams.PostTweetReplyThumbs
): Promise<NetReq.PostTweetReplyThumbs> => {
return request({
method: "post",
url: "/v1/tweet/reply/thumbsdown",
data,
});
};
/** 发布动态评论 */
export const createComment = (
data: NetParams.PostCreateComment

@ -93,8 +93,6 @@
@media screen and (max-width: 821px) {
.content-wrap {
top: 0;
// left: 60px;
position: absolute !important;
// width: calc(100% - 60px) !important;
}
}

@ -226,6 +226,7 @@ const handleLogin = (e: Event) => {
store.commit('updateUserinfo', res);
store.commit('triggerAuth', false);
store.commit('refresh')
loginForm.username = '';
loginForm.password = '';
})

@ -24,12 +24,7 @@
<template #header-extra>
<div class="opt-wrap">
<span class="timestamp">
{{
comment.ip_loc
? comment.ip_loc + ' · '
: comment.ip_loc
}}
{{ formatPrettyTime(comment.created_on, store.state.collapsedLeft) }}
{{ comment.ip_loc}}
</span>
<n-popconfirm
@ -74,26 +69,26 @@
<post-image
v-if="comment.imgs.length > 0"
:imgs="comment.imgs" />
<!-- -->
<compose-reply
ref="replyComposeRef"
:comment="comment"
:at-userid="replyAtUserID"
:at-username="replyAtUsername"
@reload="reload"
@reset="resetReply"
/>
<!-- -->
<div class="reply-wrap">
<reply-item
v-for="reply in comment.replies"
:key="reply.id"
:reply="reply"
:tweet-id="comment.post_id"
@focusReply="focusReply"
@reload="reload"
/>
</div>
<!-- -->
<compose-reply
ref="replyComposeRef"
v-if="store.state.userInfo.id > 0"
:comment-id="comment.id"
:at-userid="replyAtUserID"
:at-username="replyAtUsername"
@reload="reload"
@reset="resetReply"
/>
</template>
</n-thing>
</div>
@ -103,7 +98,6 @@
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';
import { formatPrettyTime } from '@/utils/formatTime';
import { parsePostTag } from '@/utils/content';
import { Trash } from '@vicons/tabler';
import { deleteComment } from '@/api/post';

@ -1,36 +1,51 @@
<template>
<div class="reply-compose-wrap">
<div class="reply-switch">
<span class="show" v-if="!showReply" @click="switchReply(true)">
</span>
<span class="hide" v-if="showReply" @click="switchReply(false)">
<span class="time-item">
{{ formatPrettyTime(comment.created_on) }}
</span>
<div class="actions">
<div v-if="!store.state.userLogined" class="action-item">
<n-icon size="medium">
<thumb-up-outlined />
</n-icon>
<span class="upvote-count">{{ thumbsUpCount }}</span>
</div>
<div v-if="store.state.userLogined" class="action-item hover" @click.stop="handleThumbsUp">
<n-icon size="medium">
<thumb-up-outlined v-if="!hasThumbsUp" />
<thumb-up-twotone v-if="hasThumbsUp" class="show" />
</n-icon>
<span class="upvote-count">{{ thumbsUpCount }}</span>
</div>
<div v-if="!store.state.userLogined" class="action-item">
<n-icon size="medium">
<thumb-down-outlined />
</n-icon>
</div>
<div v-if="store.state.userLogined" class="action-item hover" @click.stop="handleThumbsDown">
<n-icon size="medium">
<thumb-down-outlined v-if="!hasThumbsDown" />
<thumb-down-twotone v-if="hasThumbsDown" class="show" />
</n-icon>
</div>
<span class="show reply-btn" v-if="store.state.userLogined && !showReply" @click="switchReply(true)">
</span>
<span class="hide reply-btn" v-if="store.state.userLogined && showReply" @click="switchReply(false)">
</span>
</div>
</div>
<div class="reply-input-wrap" v-if="showReply">
<n-input-group>
<n-input
ref="inputInstRef"
size="small"
:placeholder="
props.atUsername
? '@' + props.atUsername
: '..'
"
maxlength="100"
v-model:value="replyContent"
show-count
clearable
/>
<n-button
type="primary"
size="small"
ghost
:loading="submitting"
@click="submitReply"
>
<n-input ref="inputInstRef" size="small" :placeholder="
props.atUsername
? '@' + props.atUsername
: '..'
" maxlength="100" v-model:value="replyContent" show-count clearable />
<n-button type="primary" size="small" ghost :loading="submitting" @click="submitReply">
</n-button>
</n-input-group>
@ -40,18 +55,27 @@
<script setup lang="ts">
import { ref } from 'vue';
import { createCommentReply } from '@/api/post';
import { useStore } from 'vuex';
import { formatPrettyTime } from '@/utils/formatTime';
import { createCommentReply, thumbsUpTweetComment, thumbsDownTweetComment } from '@/api/post';
import { InputInst } from 'naive-ui';
import {
ThumbUpTwotone,
ThumbUpOutlined,
ThumbDownTwotone,
ThumbDownOutlined,
} from '@vicons/material';
import { YesNoEnum } from '@/utils/IEnum';
const props = withDefaults(defineProps<{
commentId: number,
comment: Item.CommentProps,
atUserid: number,
atUsername: string,
}>(), {
commentId: 0,
atUserid: 0,
atUsername: ''
});
const store = useStore();
const emit = defineEmits<{
(e: 'reload'): void,
(e: 'reset'): void
@ -60,6 +84,47 @@ const inputInstRef = ref<InputInst>();
const showReply = ref(false);
const replyContent = ref('');
const submitting = ref(false);
const hasThumbsUp = ref(props.comment.is_thumbs_up == YesNoEnum.YES)
const hasThumbsDown = ref(props.comment.is_thumbs_down == YesNoEnum.YES)
const thumbsUpCount = ref(props.comment.thumbs_up_count)
const handleThumbsUp = () => {
thumbsUpTweetComment({
tweet_id: props.comment.post_id,
comment_id: props.comment.id,
})
.then((_res) => {
hasThumbsUp.value = !hasThumbsUp.value
if (hasThumbsUp.value) {
thumbsUpCount.value++
hasThumbsDown.value = false
} else {
thumbsUpCount.value--
}
})
.catch((err) => {
console.log(err);
});
};
const handleThumbsDown = () => {
thumbsDownTweetComment({
tweet_id: props.comment.post_id,
comment_id: props.comment.id,
})
.then((_res) => {
hasThumbsDown.value = !hasThumbsDown.value
if (hasThumbsDown.value) {
if (hasThumbsUp.value) {
thumbsUpCount.value--
hasThumbsUp.value = false
}
}
})
.catch((err) => {
console.log(err);
});
};
const switchReply = (status: boolean) => {
showReply.value = status;
@ -76,7 +141,7 @@ const switchReply = (status: boolean) => {
const submitReply = () => {
submitting.value = true;
createCommentReply({
comment_id: props.commentId,
comment_id: props.comment.id,
at_user_id: props.atUserid,
content: replyContent.value,
})
@ -95,23 +160,68 @@ defineExpose({ switchReply });
<style lang="less" scoped>
.reply-compose-wrap {
.reply-switch {
display: flex;
align-items: center;
justify-content: space-between;
text-align: right;
font-size: 12px;
margin: 10px 0;
.actions {
display: flex;
align-items: center;
text-align: right;
font-size: 12px;
margin: 10px 0;
}
.time-item {
font-size: 12px;
opacity: 0.65;
margin-right: 18px;
}
.action-item {
display: flex;
align-items: center;
margin-left: 18px;
opacity: 0.65;
.upvote-count {
margin-left: 4px;
font-size: 12px;
}
&.hover {
cursor: pointer;
}
}
.reply-btn {
margin-left: 18px;
}
.show {
color: #18a058;
cursor: pointer;
opacity: 0.75;
}
.hide {
opacity: 0.75;
cursor: pointer;
}
}
}
.dark {
.reply-compose-wrap {
background-color: rgba(16, 16, 20, 0.75);
.reply-switch {
.show {
color: #63e2b7;
}
}
}
}
</style>

@ -147,14 +147,14 @@
<post-video :videos="post.videos" :full="true" />
<post-link :links="post.links" />
<div class="timestamp">
{{ formatPrettyTime(post.created_on, store.state.collapsedLeft) }}
{{ formatPrettyTime(post.created_on) }}
<span v-if="post.ip_loc">
<n-divider vertical />
{{ post.ip_loc }}
</span>
<span v-if="!store.state.collapsedLeft && post.created_on != post.latest_replied_on">
<n-divider vertical />
{{ formatPrettyTime(post.latest_replied_on, store.state.collapsedLeft) }}
{{ formatPrettyTime(post.latest_replied_on) }}
</span>
</div>
</template>

@ -5,51 +5,56 @@
<n-avatar round :size="30" :src="post.user.avatar" />
</template>
<template #header>
<span class="nickname-wrap">
<router-link
@click.stop
class="username-link"
:to="{
name: 'user',
query: { username: post.user.username },
}"
<span class="nickname-wrap">
<router-link
@click.stop
class="username-link"
:to="{
name: 'user',
query: { username: post.user.username },
}"
>
{{ post.user.nickname }}
</router-link>
</span>
<span class="username-wrap"> @{{ post.user.username }} </span>
<n-tag
v-if="post.is_top"
class="top-tag"
type="warning"
size="small"
round
>
{{ post.user.nickname }}
</router-link>
</span>
<span class="username-wrap"> @{{ post.user.username }} </span>
<n-tag
v-if="post.is_top"
class="top-tag"
type="warning"
size="small"
round
>
</n-tag>
<n-tag
v-if="post.visibility == 1"
class="top-tag"
type="error"
size="small"
round
>
</n-tag>
<n-tag
v-if="post.visibility == 2"
class="top-tag"
type="info"
size="small"
round
>
</n-tag>
</n-tag>
<n-tag
v-if="post.visibility == 1"
class="top-tag"
type="error"
size="small"
round
>
</n-tag>
<n-tag
v-if="post.visibility == 2"
class="top-tag"
type="info"
size="small"
round
>
</n-tag>
<div v-if="!store.state.desktopModelShow">
<span class="timestamp-mobile">
{{ formatPrettyDate(post.created_on) }} {{ post.ip_loc }}
</span>
</div>
</template>
<template #header-extra>
<template v-if="store.state.desktopModelShow" #header-extra>
<span class="timestamp">
{{ post.ip_loc ? post.ip_loc + ' · ' : post.ip_loc }}
{{ formatRelativeTime(post.created_on) }}
{{ formatPrettyDate(post.created_on) }}
</span>
</template>
<template #description v-if="post.texts.length > 0">
@ -118,7 +123,7 @@
import { computed } from 'vue';
import { useStore } from 'vuex';
import { useRoute, useRouter } from 'vue-router';
import { formatRelativeTime } from '@/utils/formatTime';
import { formatPrettyDate } from '@/utils/formatTime';
import { parsePostTag } from '@/utils/content';
import {
HeartOutline,
@ -221,6 +226,11 @@ const doClickText = (e: MouseEvent, id: number) => {
.top-tag {
transform: scale(0.75);
}
.timestamp-mobile {
margin-top: 2px;
opacity: 0.75;
font-size: 11px;
}
.timestamp {
opacity: 0.75;
font-size: 12px;

@ -2,46 +2,29 @@
<div class="reply-item">
<div class="header-wrap">
<div class="username">
<router-link
class="user-link"
:to="{
name: 'user',
query: { username: props.reply.user.username },
}"
>
<router-link class="user-link" :to="{
name: 'user',
query: { username: props.reply.user.username },
}">
{{ props.reply.user.username }}
</router-link>
<span class="reply-name">
{{ props.reply.at_user_id > 0 ? '' : ':' }}
</span>
<router-link
class="user-link"
:to="{
name: 'user',
query: { username: props.reply.at_user.username },
}"
v-if="props.reply.at_user_id > 0"
>
<router-link class="user-link" :to="{
name: 'user',
query: { username: props.reply.at_user.username },
}" v-if="props.reply.at_user_id > 0">
{{ props.reply.at_user.username }}
</router-link>
</div>
<div class="timestamp">
{{
props.reply.ip_loc
? props.reply.ip_loc + ' · '
: props.reply.ip_loc
}}
{{ formatPrettyTime(props.reply.created_on, store.state.collapsedLeft) }}
<n-popconfirm
v-if="
store.state.userInfo.is_admin ||
store.state.userInfo.id === props.reply.user.id
"
negative-text="取消"
positive-text="确认"
@positive-click="execDelAction"
>
{{ props.reply.ip_loc }}
<n-popconfirm v-if="
store.state.userInfo.is_admin ||
store.state.userInfo.id === props.reply.user.id
" negative-text="" positive-text="" @positive-click="execDelAction">
<template #trigger>
<n-button quaternary circle size="tiny" class="del-btn">
<template #icon>
@ -58,20 +41,59 @@
<div class="base-wrap">
<div class="content">{{ props.reply.content }}</div>
<div class="reply-switch" v-if="store.state.userInfo.id > 0">
<span class="show" @click="focusReply"> </span>
<div class="reply-switch">
<span class="time-item">
{{ formatPrettyTime(props.reply.created_on) }}
</span>
<div class="actions">
<div v-if="!store.state.userLogined" class="action-item" @click.stop="">
<n-icon size="medium">
<thumb-up-outlined />
</n-icon>
<span class="upvote-count">{{ thumbsUpCount }}</span>
</div>
<div v-if="store.state.userLogined" class="action-item hover" @click.stop="handleThumbsUp">
<n-icon size="medium">
<thumb-up-outlined v-if="!hasThumbsUp" />
<thumb-up-twotone v-if="hasThumbsUp" class="show" />
</n-icon>
<span class="upvote-count">{{ thumbsUpCount }}</span>
</div>
<div v-if="!store.state.userLogined" class="action-item">
<n-icon size="medium">
<thumb-down-outlined />
</n-icon>
</div>
<div v-if="store.state.userLogined" class="action-item hover" @click.stop="handleThumbsDown">
<n-icon size="medium">
<thumb-down-outlined v-if="!hasThumbsDown" />
<thumb-down-twotone v-if="hasThumbsDown" class="show" />
</n-icon>
</div>
<span v-if="store.state.userLogined" class="show opacity-item reply-btn" @click="focusReply"> </span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { useStore } from 'vuex';
import { Trash } from '@vicons/tabler';
import { formatPrettyTime } from '@/utils/formatTime';
import { deleteCommentReply } from '@/api/post';
import { deleteCommentReply, thumbsUpTweetReply, thumbsDownTweetReply } from '@/api/post';
import {
ThumbUpTwotone,
ThumbUpOutlined,
ThumbDownTwotone,
ThumbDownOutlined,
} from '@vicons/material';
import { YesNoEnum } from '@/utils/IEnum';
const props = withDefaults(defineProps<{
tweetId: number,
reply: Item.ReplyProps,
}>(), {});
const store = useStore();
@ -80,6 +102,48 @@ const emit = defineEmits<{
(e: 'reload'): void
}>();
const hasThumbsUp = ref(props.reply.is_thumbs_up == YesNoEnum.YES)
const hasThumbsDown = ref(props.reply.is_thumbs_down == YesNoEnum.YES)
const thumbsUpCount = ref(props.reply.thumbs_up_count)
const handleThumbsUp = () => {
thumbsUpTweetReply({
tweet_id: props.tweetId,
comment_id: props.reply.comment_id,
reply_id: props.reply.id,
})
.then((_res) => {
hasThumbsUp.value = !hasThumbsUp.value
if (hasThumbsUp.value) {
thumbsUpCount.value++
hasThumbsDown.value = false
} else {
thumbsUpCount.value--
}
})
.catch((err) => {
console.log(err);
});
};
const handleThumbsDown = () => {
thumbsDownTweetReply({
tweet_id: props.tweetId,
comment_id: props.reply.comment_id,
reply_id: props.reply.id,
})
.then((_res) => {
hasThumbsDown.value = !hasThumbsDown.value
if (hasThumbsDown.value) {
if (hasThumbsUp.value) {
thumbsUpCount.value--
hasThumbsUp.value = false
}
}
})
.catch((err) => {
console.log(err);
});
};
const focusReply = () => {
emit('focusReply', props.reply);
};
@ -113,29 +177,32 @@ const execDelAction = () => {
display: flex;
align-items: center;
justify-content: space-between;
.username {
max-width: 50%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.reply-name {
margin: 0 3px;
opacity: 0.75;
}
}
.timestamp {
opacity: 0.75;
text-align: right;
display: flex;
align-items: center;
max-width: 50%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.base-wrap {
display: flex;
display: block;
.content {
width: calc(100% - 40px);
margin-top: 4px;
@ -143,16 +210,56 @@ const execDelAction = () => {
text-align: justify;
line-height: 2;
}
.reply-switch {
width: 40px;
text-align: right;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
margin: 10px 0 0;
.actions {
display: flex;
align-items: center;
text-align: right;
font-size: 12px;
margin: 10px 0;
}
.time-item {
font-size: 12px;
opacity: 0.75;
margin-right: 18px;
}
.action-item {
display: flex;
align-items: center;
margin-left: 18px;
opacity: 0.65;
.upvote-count {
margin-left: 4px;
font-size: 12px;
}
&.hover {
cursor: pointer;
}
}
.opacity-item {
opacity: 0.75;
}
.reply-btn {
margin-left: 18px;
}
.show {
color: #18a058;
cursor: pointer;
}
.hide {
opacity: 0.75;
cursor: pointer;
@ -160,10 +267,19 @@ const execDelAction = () => {
}
}
}
.dark {
.reply-item {
border-bottom: 1px solid #262628;
background-color: rgba(16, 16, 20, 0.75);
.base-wrap {
.reply-switch {
.show {
color: #63e2b7;
}
}
}
}
}
</style>

@ -145,9 +145,10 @@ const showFollowTopics = computed({
watch(
() => ({
refreshTopicFollow: store.state.refreshTopicFollow,
userLogined: store.state.userLogined
}),
(to, from) => {
if (to.refreshTopicFollow !== from.refreshTopicFollow) {
if (to.refreshTopicFollow !== from.refreshTopicFollow || to.userLogined) {
loadHotTags();
}
}

@ -247,6 +247,7 @@ const triggerAuth = (key: string) => {
};
const handleLogout = () => {
store.commit('userLogout');
store.commit('refresh')
goHome()
};
window.$store = store;

@ -62,6 +62,12 @@ declare module Item {
ip?: string;
/** 评论者城市地址 */
ip_loc: string;
/** 点赞数 */
thumbs_up_count: number;
/** 是否点赞0为未点赞1为已点赞 */
is_thumbs_up: import("@/utils/IEnum").YesNoEnum;
/** 是否反对0为未反对1为已反对 */
is_thumbs_down: import("@/utils/IEnum").YesNoEnum;
/** 创建时间 */
created_on: number;
/** 修改时间 */
@ -99,6 +105,12 @@ declare module Item {
ip?: string;
/** 回复人城市地址 */
ip_loc: string;
/** 点赞数 */
thumbs_up_count: number;
/** 是否点赞0为未点赞1为已点赞 */
is_thumbs_up: import("@/utils/IEnum").YesNoEnum;
/** 是否反对0为未反对1为已反对 */
is_thumbs_down: import("@/utils/IEnum").YesNoEnum;
/** 创建时间 */
created_on: number;
/** 修改时间 */

@ -35,7 +35,7 @@ declare module NetParams {
id: number;
}
interface UserGetUnreadMsgCount {}
interface UserGetUnreadMsgCount { }
interface UserGetMessages {
page: number;
@ -82,7 +82,7 @@ declare module NetParams {
imgCaptcha: string;
}
interface UserGetCaptcha {}
interface UserGetCaptcha { }
interface UserWhisper {
user_id: number;
@ -173,9 +173,11 @@ declare module NetParams {
interface PostGetPostComments {
id: number;
sort_strategy: "default" | "newest";
page?: number;
page_size?: number;
}
interface GetContacts {}
interface GetContacts { }
interface PostCreatePost {
/** 帖子内容列表 */
@ -194,6 +196,17 @@ declare module NetParams {
id: number;
}
interface PostTweetCommentThumbs {
tweet_id: number;
comment_id: number;
}
interface PostTweetReplyThumbs {
tweet_id: number;
comment_id: number;
reply_id: number;
}
interface PostCreateComment {
/** 内容ID */
post_id: number;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save