diff --git a/.vscode/.gitignore b/.vscode/.gitignore index 681848e5..577ebbbe 100644 --- a/.vscode/.gitignore +++ b/.vscode/.gitignore @@ -1,4 +1,4 @@ .DS_Store *.log __debug_bin -settings.json \ No newline at end of file +settings.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b5eabd3..770574c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ All notable changes to paopao-ce are documented in this file. ### Changed - change man content width to 600px and optimize tweet/comment/replay text length. [#333](https://github.com/rocboss/paopao-ce/pull/333) +## 0.3.1 +### Fixed +- fixed: video player assets cdn error. [&caff8c0](https://github.com/rocboss/paopao-ce/commit/caff8c052be6c8d59576011192f830fd98e17ab3 'commit caff8c0') + ## 0.3.0 ### Added @@ -70,6 +74,10 @@ All notable changes to paopao-ce are documented in this file. - fixed user not list owner's collectioned private tweet error [#274](https://github.com/rocboss/paopao-ce/pull/274) - fixed comments thumbs up/down state incorrect error [#283](https://github.com/rocboss/paopao-ce/pull/283) +### Fixed + +- fixed sql ddl p_contact's column `is_delete` define error (change to `is_del`) in scripts/paopao-mysql.sql [&afd8fe1](https://github.com/rocboss/paopao-ce/commit/afd8fe18d2dce08a4af846c2f822379d99a3d3b3 'commit afd8fe1') + ### Changed - use [github.com/rueian/rueidis](https://github.com/rueian/rueidis) as Redis client [#249](https://github.com/rocboss/paopao-ce/pull/249) diff --git a/Makefile b/Makefile index 98abcc26..8b1d1dae 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ endif TARGET_BIN = $(basename $(TARGET)) ifeq (n$(CGO_ENABLED),n) -CGO_ENABLED := 0 +CGO_ENABLED := 1 endif RELEASE_ROOT = release diff --git a/auto/api/v1/priv.go b/auto/api/v1/priv.go index d0254345..f4adccfc 100644 --- a/auto/api/v1/priv.go +++ b/auto/api/v1/priv.go @@ -30,6 +30,7 @@ type Priv interface { DeleteComment(*web.DeleteCommentReq) mir.Error CreateComment(*web.CreateCommentReq) (*web.CreateCommentResp, mir.Error) VisibleTweet(*web.VisibleTweetReq) (*web.VisibleTweetResp, mir.Error) + HighlightTweet(*web.HighlightTweetReq) (*web.HighlightTweetResp, mir.Error) StickTweet(*web.StickTweetReq) (*web.StickTweetResp, mir.Error) LockTweet(*web.LockTweetReq) (*web.LockTweetResp, mir.Error) CollectionTweet(*web.CollectionTweetReq) (*web.CollectionTweetResp, mir.Error) @@ -213,6 +214,20 @@ func RegisterPrivServant(e *gin.Engine, s Priv) { resp, err := s.VisibleTweet(req) s.Render(c, resp, err) }) + router.Handle("POST", "/post/highlight", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + req := new(web.HighlightTweetReq) + if err := s.Bind(c, req); err != nil { + s.Render(c, nil, err) + return + } + resp, err := s.HighlightTweet(req) + s.Render(c, resp, err) + }) router.Handle("POST", "/post/stick", func(c *gin.Context) { select { case <-c.Request.Context().Done(): @@ -399,6 +414,10 @@ func (UnimplementedPrivServant) VisibleTweet(req *web.VisibleTweetReq) (*web.Vis return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } +func (UnimplementedPrivServant) HighlightTweet(req *web.HighlightTweetReq) (*web.HighlightTweetResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + func (UnimplementedPrivServant) StickTweet(req *web.StickTweetReq) (*web.StickTweetResp, mir.Error) { return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } diff --git a/docker-compose.yaml.backup b/docker-compose.yaml.backup index fa63f463..e71f266c 100644 --- a/docker-compose.yaml.backup +++ b/docker-compose.yaml.backup @@ -102,7 +102,7 @@ services: - paopao-network backend: - image: bitbus/paopao-ce:0.3.0 + image: bitbus/paopao-ce:0.3 restart: always depends_on: - db diff --git a/docs/proposal/010-关于Sqlx功能项的设计.md b/docs/proposal/010-关于Sqlx功能项的设计.md new file mode 100644 index 00000000..b808da0a --- /dev/null +++ b/docs/proposal/010-关于Sqlx功能项的设计.md @@ -0,0 +1,28 @@ +| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 | +| ----- | ----- | ----- | ----- | ----- | ----- | +| 010| 北野 | 2022-12-10 | 2022-12-10 | v0.0 | 提议 | + +### 关于Sqlx功能项的设计 + ---- 这里写简要介绍 ---- + +### 场景 + + ---- 这里描述在什么使用场景下会需要本提按 ---- + +### 需求 + +TODO-TL;DR... + +### 方案 + +TODO + +### 疑问 + +1. 如何开启这个功能? + +TODO + +### 更新记录 +#### v0.0(2022-12-10) - 北野 +* 初始文档, 先占个位置 diff --git a/go.mod b/go.mod index 7e201510..43339435 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/cockroachdb/errors v1.10.0 github.com/disintegration/imaging v1.6.2 github.com/fatih/color v1.15.0 - github.com/getsentry/sentry-go v0.22.0 + github.com/getsentry/sentry-go v0.23.0 github.com/gin-contrib/cors v1.4.0 github.com/gin-gonic/gin v1.9.1 github.com/go-resty/resty/v2 v2.7.0 @@ -29,7 +29,7 @@ require ( github.com/onsi/ginkgo/v2 v2.11.0 github.com/onsi/gomega v1.27.10 github.com/pyroscope-io/client v0.7.1 - github.com/redis/rueidis v1.0.13 + github.com/redis/rueidis v1.0.14 github.com/sirupsen/logrus v1.9.3 github.com/smartwalle/alipay/v3 v3.2.14 github.com/sourcegraph/conc v0.3.0 @@ -47,7 +47,7 @@ require ( gorm.io/gorm v1.25.2 gorm.io/plugin/dbresolver v1.4.1 gorm.io/plugin/soft_delete v1.2.1 - modernc.org/sqlite v1.24.0 + modernc.org/sqlite v1.25.0 ) require ( @@ -88,7 +88,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.2.4 // indirect - github.com/lib/pq v1.10.2 // indirect + github.com/lib/pq v1.10.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -99,7 +99,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mozillazg/go-httpheader v0.3.1 // indirect + github.com/mozillazg/go-httpheader v0.2.1 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pyroscope-io/godeltaprof v0.1.0 // indirect @@ -121,7 +121,7 @@ require ( go.uber.org/atomic v1.9.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/crypto v0.11.0 // indirect - golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect + golang.org/x/image v0.0.0-20210216034530-4410531fe030 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.10.0 // indirect @@ -134,9 +134,9 @@ require ( lukechampine.com/uint128 v1.2.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect - modernc.org/libc v1.22.5 // indirect + modernc.org/libc v1.24.1 // indirect modernc.org/mathutil v1.5.0 // indirect - modernc.org/memory v1.5.0 // indirect + modernc.org/memory v1.6.0 // indirect modernc.org/opt v0.1.3 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.0.1 // indirect diff --git a/go.sum b/go.sum index 20b14bd4..d669df84 100644 --- a/go.sum +++ b/go.sum @@ -451,8 +451,8 @@ github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/getsentry/sentry-go v0.22.0 h1:XNX9zKbv7baSEI65l+H1GEJgSeIC1c7EN5kluWaP6dM= -github.com/getsentry/sentry-go v0.22.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g= @@ -875,9 +875,8 @@ github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.0 h1:Zx5DJFEYQXio93kgXnQ09fXNiUKsqv4OUEu2UtGcB1E= github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -972,9 +971,8 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ= github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= -github.com/mozillazg/go-httpheader v0.3.1 h1:IRP+HFrMX2SlwY9riuio7raffXUpzAosHtZu25BSJok= -github.com/mozillazg/go-httpheader v0.3.1/go.mod h1:PuT8h0pw6efvp8ZeUec1Rs7dwjK08bt6gKSReGMqtdA= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -1111,8 +1109,8 @@ github.com/pyroscope-io/client v0.7.1 h1:yFRhj3vbgjBxehvxQmedmUWJQ4CAfCHhn+itPsu github.com/pyroscope-io/client v0.7.1/go.mod h1:4h21iOU4pUOq0prKyDlvYRL+SCKsBc5wKiEtV+rJGqU= github.com/pyroscope-io/godeltaprof v0.1.0 h1:UBqtjt0yZi4jTxqZmLAs34XG6ycS3vUTlhEUSq4NHLE= github.com/pyroscope-io/godeltaprof v0.1.0/go.mod h1:psMITXp90+8pFenXkKIpNhrfmI9saQnPbba27VIaiQE= -github.com/redis/rueidis v1.0.13 h1:wQFMLqXQQPCow05i3KZXMB0z/6n4P0/6UVfJ1qYnDW4= -github.com/redis/rueidis v1.0.13/go.mod h1:Z4/sLVfaxsAPKj0EF6q2P/gO6clKuQ3CE34/f/cPNkI= +github.com/redis/rueidis v1.0.14 h1:qdFZahk1F/2L+sZeOECx5E2N5J4Qc51b7ezSUpQXJfs= +github.com/redis/rueidis v1.0.14/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= @@ -1401,9 +1399,8 @@ golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+o golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210216034530-4410531fe030 h1:lP9pYkih3DUSC641giIXa2XqfTIbbbRr0w2EOTA7wHA= golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 h1:LRtI4W37N+KFebI/qV0OFiLUv4GLOWeEW5hn/KEJvxE= -golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -2085,8 +2082,8 @@ modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM= modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= -modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE= -modernc.org/libc v1.22.5/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= +modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= +modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= @@ -2094,16 +2091,16 @@ modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6 modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= -modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= -modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o= +modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= 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.24.0 h1:EsClRIWHGhLTCX44p+Ri/JLD+vFGo0QGjasg2/F9TlI= -modernc.org/sqlite v1.24.0/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk= +modernc.org/sqlite v1.25.0 h1:AFweiwPNd/b3BoKnBOfFm+Y260guGMF+0UFk0savqeA= +modernc.org/sqlite v1.25.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= 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= diff --git a/internal/conf/db.go b/internal/conf/db.go index b97b4c44..f04fc3fb 100644 --- a/internal/conf/db.go +++ b/internal/conf/db.go @@ -1,84 +1,68 @@ -// Copyright 2022 ROC. All rights reserved. +// 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 conf import ( + "database/sql" "sync" - "time" "github.com/alimy/cfg" "github.com/sirupsen/logrus" - "gorm.io/driver/mysql" - "gorm.io/driver/postgres" - "gorm.io/gorm" - "gorm.io/gorm/logger" - "gorm.io/gorm/schema" - "gorm.io/plugin/dbresolver" ) var ( - _gormDB *gorm.DB - _onceGorm sync.Once + _sqldb *sql.DB + _onceSql sync.Once ) -func MustGormDB() *gorm.DB { - _onceGorm.Do(func() { +const ( + TableAnouncement = "user" + TableAnouncementContent = "anouncement_content" + TableAttachment = "attachment" + TableCaptcha = "captcha" + TableComment = "comment" + TableCommentContent = "comment_content" + TableCommentReply = "comment_reply" + TableContact = "contact" + TableContactGroup = "contact_group" + TableMessage = "message" + TablePost = "post" + TablePostAttachmentBill = "post_attachment_bill" + TablePostCollection = "post_collection" + TablePostContent = "post_content" + TablePostStar = "post_star" + TableTag = "tag" + TableUser = "user" + TableWalletRecharge = "wallet_recharge" + TableWalletStatement = "wallet_statement" +) + +type TableNameMap map[string]string + +func MustSqlDB() *sql.DB { + _onceSql.Do(func() { var err error - if _gormDB, err = newGormDB(); err != nil { - logrus.Fatalf("new gorm db failed: %s", err) + if _, _sqldb, err = newSqlDB(); err != nil { + logrus.Fatalf("new sql db failed: %s", err) } }) - return _gormDB + return _sqldb } -func newGormDB() (*gorm.DB, error) { - newLogger := logger.New( - logrus.StandardLogger(), // io writer(日志输出的目标,前缀和日志包含的内容) - logger.Config{ - SlowThreshold: time.Second, // 慢 SQL 阈值 - LogLevel: DatabaseSetting.logLevel(), // 日志级别 - IgnoreRecordNotFoundError: true, // 忽略ErrRecordNotFound(记录未找到)错误 - Colorful: false, // 禁用彩色打印 - }, - ) - - config := &gorm.Config{ - Logger: newLogger, - NamingStrategy: schema.NamingStrategy{ - TablePrefix: DatabaseSetting.TablePrefix, - SingularTable: true, - }, - } - - plugin := dbresolver.Register(dbresolver.Config{}). - SetConnMaxIdleTime(time.Hour). - SetConnMaxLifetime(24 * time.Hour). - SetMaxIdleConns(MysqlSetting.MaxIdleConns). - SetMaxOpenConns(MysqlSetting.MaxOpenConns) - - var ( - db *gorm.DB - err error - ) +func newSqlDB() (driver string, db *sql.DB, err error) { if cfg.If("MySQL") { - logrus.Debugln("use MySQL as db") - if db, err = gorm.Open(mysql.Open(MysqlSetting.Dsn()), config); err == nil { - db.Use(plugin) - } - } else if cfg.If("Postgres") { - logrus.Debugln("use PostgreSQL as db") - db, err = gorm.Open(postgres.Open(PostgresSetting.Dsn()), config) + driver = "mysql" + db, err = sql.Open(driver, MysqlSetting.Dsn()) + } else if cfg.If("PostgreSQL") || cfg.If("Postgres") { + driver = "pgx" + db, err = sql.Open(driver, PostgresSetting.Dsn()) } else if cfg.If("Sqlite3") { - logrus.Debugf("use Sqlite3 as db path:%s sqlite3InCgoEnabled:%t", Sqlite3Setting.Path, sqlite3InCgoEnabled) - db, err = gormOpenSqlite3(config) + driver, db, err = OpenSqlite3() } else { - logrus.Debugln("use default of MySQL as db") - if db, err = gorm.Open(mysql.Open(MysqlSetting.Dsn()), config); err == nil { - db.Use(plugin) - } + driver = "mysql" + db, err = sql.Open(driver, MysqlSetting.Dsn()) } - - return db, err + return } diff --git a/internal/conf/db_cgo.go b/internal/conf/db_cgo.go index 218512a5..231dc16b 100644 --- a/internal/conf/db_cgo.go +++ b/internal/conf/db_cgo.go @@ -18,8 +18,9 @@ const ( sqlite3InCgoEnabled = true ) -func OpenSqlite3() (*sql.DB, error) { - return sql.Open("sqlite3", Sqlite3Setting.Dsn("sqlite3")) +func OpenSqlite3() (string, *sql.DB, error) { + db, err := sql.Open("sqlite3", Sqlite3Setting.Dsn("sqlite3")) + return "sqlite3", db, err } func gormOpenSqlite3(opts ...gorm.Option) (*gorm.DB, error) { diff --git a/internal/conf/db_gorm.go b/internal/conf/db_gorm.go new file mode 100644 index 00000000..f667ff61 --- /dev/null +++ b/internal/conf/db_gorm.go @@ -0,0 +1,84 @@ +// Copyright 2022 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 conf + +import ( + "sync" + "time" + + "github.com/alimy/cfg" + "github.com/sirupsen/logrus" + "gorm.io/driver/mysql" + "gorm.io/driver/postgres" + "gorm.io/gorm" + "gorm.io/gorm/logger" + "gorm.io/gorm/schema" + "gorm.io/plugin/dbresolver" +) + +var ( + _gormdb *gorm.DB + _onceGorm sync.Once +) + +func MustGormDB() *gorm.DB { + _onceGorm.Do(func() { + var err error + if _gormdb, err = newGormDB(); err != nil { + logrus.Fatalf("new gorm db failed: %s", err) + } + }) + return _gormdb +} + +func newGormDB() (*gorm.DB, error) { + newLogger := logger.New( + logrus.StandardLogger(), // io writer(日志输出的目标,前缀和日志包含的内容) + logger.Config{ + SlowThreshold: time.Second, // 慢 SQL 阈值 + LogLevel: DatabaseSetting.logLevel(), // 日志级别 + IgnoreRecordNotFoundError: true, // 忽略ErrRecordNotFound(记录未找到)错误 + Colorful: false, // 禁用彩色打印 + }, + ) + + config := &gorm.Config{ + Logger: newLogger, + NamingStrategy: schema.NamingStrategy{ + TablePrefix: DatabaseSetting.TablePrefix, + SingularTable: true, + }, + } + + plugin := dbresolver.Register(dbresolver.Config{}). + SetConnMaxIdleTime(time.Hour). + SetConnMaxLifetime(24 * time.Hour). + SetMaxIdleConns(MysqlSetting.MaxIdleConns). + SetMaxOpenConns(MysqlSetting.MaxOpenConns) + + var ( + db *gorm.DB + err error + ) + if cfg.If("MySQL") { + logrus.Debugln("use MySQL as db") + if db, err = gorm.Open(mysql.Open(MysqlSetting.Dsn()), config); err == nil { + db.Use(plugin) + } + } else if cfg.If("Postgres") { + logrus.Debugln("use PostgreSQL as db") + db, err = gorm.Open(postgres.Open(PostgresSetting.Dsn()), config) + } else if cfg.If("Sqlite3") { + logrus.Debugf("use Sqlite3 as db path:%s sqlite3InCgoEnabled:%t", Sqlite3Setting.Path, sqlite3InCgoEnabled) + db, err = gormOpenSqlite3(config) + } else { + logrus.Debugln("use default of MySQL as db") + if db, err = gorm.Open(mysql.Open(MysqlSetting.Dsn()), config); err == nil { + db.Use(plugin) + } + } + + return db, err +} diff --git a/internal/conf/db_nocgo.go b/internal/conf/db_nocgo.go index 977a6695..bbe79a50 100644 --- a/internal/conf/db_nocgo.go +++ b/internal/conf/db_nocgo.go @@ -19,8 +19,9 @@ const ( sqlite3InCgoEnabled = false ) -func OpenSqlite3() (*sql.DB, error) { - return sql.Open("sqlite", Sqlite3Setting.Dsn("sqlite")) +func OpenSqlite3() (string, *sql.DB, error) { + db, err := sql.Open("sqlite", Sqlite3Setting.Dsn("sqlite")) + return "sqlite", db, err } func gormOpenSqlite3(opts ...gorm.Option) (*gorm.DB, error) { diff --git a/internal/conf/setting.go b/internal/conf/setting.go index 204ca985..d7c7223b 100644 --- a/internal/conf/setting.go +++ b/internal/conf/setting.go @@ -296,6 +296,35 @@ func (s *databaseConf) logLevel() logger.LogLevel { } } +func (s *databaseConf) TableNames() (res TableNameMap) { + tableNames := []string{ + TableAnouncement, + TableAnouncementContent, + TableAttachment, + TableCaptcha, + TableComment, + TableCommentContent, + TableCommentReply, + TableContact, + TableContactGroup, + TableMessage, + TablePost, + TablePostAttachmentBill, + TablePostCollection, + TablePostContent, + TablePostStar, + TableTag, + TableUser, + TableWalletRecharge, + TableWalletStatement, + } + res = make(TableNameMap, len(tableNames)) + for _, name := range tableNames { + res[name] = s.TablePrefix + name + } + return +} + func (s *loggerConf) logLevel() logrus.Level { switch strings.ToLower(s.Level) { case "panic": diff --git a/internal/core/authority.go b/internal/core/authority.go index 05e3742a..31a43be4 100644 --- a/internal/core/authority.go +++ b/internal/core/authority.go @@ -5,119 +5,13 @@ package core import ( - "github.com/rocboss/paopao-ce/pkg/types" + "github.com/rocboss/paopao-ce/internal/core/ms" ) -const ( - ActRegisterUser act = iota - ActCreatePublicTweet - ActCreatePublicAttachment - ActCreatePublicPicture - ActCreatePublicVideo - ActCreatePrivateTweet - ActCreatePrivateAttachment - ActCreatePrivatePicture - ActCreatePrivateVideo - ActCreateFriendTweet - ActCreateFriendAttachment - ActCreateFriendPicture - ActCreateFriendVideo - ActCreatePublicComment - ActCreatePublicPicureComment - ActCreateFriendComment - ActCreateFriendPicureComment - ActCreatePrivateComment - ActCreatePrivatePicureComment - ActStickTweet - ActTopTweet - ActLockTweet - ActVisibleTweet - ActDeleteTweet - ActCreateActivationCode -) - -type ( - act uint8 - - FriendFilter map[int64]types.Empty - FriendSet map[string]types.Empty - - Action struct { - Act act - UserId int64 - } -) - -func (f FriendFilter) IsFriend(userId int64) bool { - _, yeah := f[userId] - return yeah -} - -// IsAllow default true if user is admin -func (a act) IsAllow(user *User, userId int64, isFriend bool, isActivation bool) bool { - if user.IsAdmin { - return true - } - if user.ID == userId && isActivation { - switch a { - case ActCreatePublicTweet, - ActCreatePublicAttachment, - ActCreatePublicPicture, - ActCreatePublicVideo, - ActCreatePrivateTweet, - ActCreatePrivateAttachment, - ActCreatePrivatePicture, - ActCreatePrivateVideo, - ActCreateFriendTweet, - ActCreateFriendAttachment, - ActCreateFriendPicture, - ActCreateFriendVideo, - ActCreatePrivateComment, - ActCreatePrivatePicureComment, - ActStickTweet, - ActLockTweet, - ActVisibleTweet, - ActDeleteTweet: - return true - } - } - - if user.ID == userId && !isActivation { - switch a { - case ActCreatePrivateTweet, - ActCreatePrivateComment, - ActStickTweet, - ActLockTweet, - ActDeleteTweet: - return true - } - } - - if isFriend && isActivation { - switch a { - case ActCreatePublicComment, - ActCreatePublicPicureComment, - ActCreateFriendComment, - ActCreateFriendPicureComment: - return true - } - } - - if !isFriend && isActivation { - switch a { - case ActCreatePublicComment, - ActCreatePublicPicureComment: - return true - } - } - - return false -} - // AuthorizationManageService 授权管理服务 type AuthorizationManageService interface { - IsAllow(user *User, action *Action) bool - BeFriendFilter(userId int64) FriendFilter + IsAllow(user *ms.User, action *ms.Action) bool + BeFriendFilter(userId int64) ms.FriendFilter BeFriendIds(userId int64) ([]int64, error) - MyFriendSet(userId int64) FriendSet + MyFriendSet(userId int64) ms.FriendSet } diff --git a/internal/core/cache.go b/internal/core/cache.go index bade6231..8d8c3b42 100644 --- a/internal/core/cache.go +++ b/internal/core/cache.go @@ -7,6 +7,8 @@ package core import ( "context" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" ) @@ -26,6 +28,11 @@ type IndexAction struct { Post *dbr.Post } +type IndexActionA struct { + Act IdxAct + Tweet *cs.TweetInfo +} + func (a IdxAct) String() string { switch a { case IdxActNop: @@ -45,13 +52,20 @@ func (a IdxAct) String() string { } } -func NewIndexAction(act IdxAct, post *dbr.Post) *IndexAction { +func NewIndexAction(act IdxAct, post *ms.Post) *IndexAction { return &IndexAction{ Act: act, Post: post, } } +func NewIndexActionA(act IdxAct, tweet *cs.TweetInfo) *IndexActionA { + return &IndexActionA{ + Act: act, + Tweet: tweet, + } +} + // CacheIndexService cache index service interface type CacheIndexService interface { IndexPostsService @@ -59,6 +73,13 @@ type CacheIndexService interface { SendAction(act IdxAct, post *dbr.Post) } +// CacheIndexServantA cache index service interface +type CacheIndexServantA interface { + IndexPostsServantA + + SendAction(act IdxAct, tweet *cs.TweetInfo) +} + // RedisCache memory cache by Redis type RedisCache interface { SetPushToSearchJob(ctx context.Context) error diff --git a/internal/core/comments.go b/internal/core/comments.go index 88dcf432..cf917a82 100644 --- a/internal/core/comments.go +++ b/internal/core/comments.go @@ -6,35 +6,27 @@ package core import ( "github.com/rocboss/paopao-ce/internal/core/cs" - "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" -) - -type ( - Comment = dbr.Comment - CommentFormated = dbr.CommentFormated - CommentReply = dbr.CommentReply - CommentContent = dbr.CommentContent - CommentReplyFormated = dbr.CommentReplyFormated + "github.com/rocboss/paopao-ce/internal/core/ms" ) // CommentService 评论检索服务 type CommentService interface { - GetComments(conditions *ConditionsT, offset, limit int) ([]*Comment, error) - GetCommentByID(id int64) (*Comment, error) - GetCommentCount(conditions *ConditionsT) (int64, error) - GetCommentReplyByID(id int64) (*CommentReply, error) - GetCommentContentsByIDs(ids []int64) ([]*CommentContent, error) - GetCommentRepliesByID(ids []int64) ([]*CommentReplyFormated, error) + GetComments(conditions *ms.ConditionsT, offset, limit int) ([]*ms.Comment, error) + GetCommentByID(id int64) (*ms.Comment, error) + GetCommentCount(conditions *ms.ConditionsT) (int64, error) + GetCommentReplyByID(id int64) (*ms.CommentReply, error) + GetCommentContentsByIDs(ids []int64) ([]*ms.CommentContent, error) + GetCommentRepliesByID(ids []int64) ([]*ms.CommentReplyFormated, error) GetCommentThumbsMap(userId int64, tweetId int64) (cs.CommentThumbsMap, cs.CommentThumbsMap, error) } // CommentManageService 评论管理服务 type CommentManageService interface { - DeleteComment(comment *Comment) error - CreateComment(comment *Comment) (*Comment, error) - CreateCommentReply(reply *CommentReply) (*CommentReply, error) - DeleteCommentReply(reply *CommentReply) error - CreateCommentContent(content *CommentContent) (*CommentContent, error) + DeleteComment(comment *ms.Comment) error + CreateComment(comment *ms.Comment) (*ms.Comment, error) + CreateCommentReply(reply *ms.CommentReply) (*ms.CommentReply, error) + DeleteCommentReply(reply *ms.CommentReply) error + CreateCommentContent(content *ms.CommentContent) (*ms.CommentContent, error) ThumbsUpComment(userId int64, tweetId, commentId int64) error ThumbsDownComment(userId int64, tweetId, commentId int64) error ThumbsUpReply(userId int64, tweetId, commentId, replyId int64) error diff --git a/internal/core/core.go b/internal/core/core.go index 6dde2d3e..1f51b02b 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -38,3 +38,14 @@ type DataService interface { // share_key服务 ShareKeyService } + +// WebDataServantA Web数据服务集成(版本A) +type WebDataServantA interface { + // 话题服务 + TopicServantA + + // 推文服务 + TweetServantA + TweetManageServantA + TweetHelpServantA +} diff --git a/internal/core/cs/contact.go b/internal/core/cs/contact.go new file mode 100644 index 00000000..ed774631 --- /dev/null +++ b/internal/core/cs/contact.go @@ -0,0 +1,26 @@ +// 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 + +const ( + ContactStatusRequesting int8 = iota + 1 + ContactStatusAgree + ContactStatusReject + ContactStatusDeleted +) + +type Contact struct { + ID int64 `db:"id" json:"id"` + UserId int64 `db:"user_id" json:"user_id"` + FriendId int64 `db:"friend_id" json:"friend_id"` + GroupId int64 `json:"group_id"` + Remark string `json:"remark"` + Status int8 `json:"status"` // 1请求好友, 2已同意好友, 3已拒绝好友, 4已删除好友 + IsTop int8 `json:"is_top"` + IsBlack int8 `json:"is_black"` + NoticeEnable int8 `json:"notice_enable"` + IsDel int8 `json:"-"` + DeletedOn int64 `db:"-" json:"-"` +} diff --git a/internal/core/cs/cs.go b/internal/core/cs/cs.go new file mode 100644 index 00000000..e482d664 --- /dev/null +++ b/internal/core/cs/cs.go @@ -0,0 +1,7 @@ +// 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 contain core data service interface type +// model define +package cs diff --git a/internal/core/cs/search.go b/internal/core/cs/search.go new file mode 100644 index 00000000..37c8fa9d --- /dev/null +++ b/internal/core/cs/search.go @@ -0,0 +1,38 @@ +// 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 + +const ( + // 搜索查询类型 + TsQueryTypeDefault TsQueryType = "search" + TsQueryTypeTag TsQueryType = "tag" +) + +type ( + // TsQueryType 搜索查询类型 + TsQueryType string + + // TsDocList 索引条陈列表 + TsDocList []TsDocItem +) + +// TsQueryReq 搜索查询请求 +type TsQueryReq struct { + Query string + Visibility []TweetVisibleType + Type TsQueryType +} + +// TsQueryResp 搜索查询响应 +type TsQueryResp struct { + Items TweetList + Total int64 +} + +// TsDocItem 索引条陈 +type TsDocItem struct { + Post *TweetInfo + Content string +} diff --git a/internal/core/cs/timeline.go b/internal/core/cs/timeline.go new file mode 100644 index 00000000..118f371c --- /dev/null +++ b/internal/core/cs/timeline.go @@ -0,0 +1,11 @@ +// 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 + +// TweetBox 推文列表盒子,包含其他一些关于推文列表的信息 +type TweetBox struct { + Tweets TweetList + Total int64 +} diff --git a/internal/core/cs/topics.go b/internal/core/cs/topics.go new file mode 100644 index 00000000..c7819fc6 --- /dev/null +++ b/internal/core/cs/topics.go @@ -0,0 +1,55 @@ +// 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 + +const ( + // 标签类型 + TagTypeHot TagType = "hot" + TagTypeNew TagType = "new" + TagTypeFollow TagType = "follow" + TagTypeHotExtral TagType = "hot_extral" +) + +type ( + // TagType 标签类型 + TagType string + + // TagInfoList 标签信息列表 + TagInfoList []*TagInfo + + // TagList 标签列表 + TagList []*TagItem +) + +// TagInfo 标签信息 +type TagInfo struct { + ID int64 `json:"id" db:"id"` + UserID int64 `json:"user_id" db:"user_id"` + Tag string `json:"tag"` + QuoteNum int64 `json:"quote_num" db:"quote_num"` +} + +// TagItem 标签信息条陈 +type TagItem struct { + ID int64 `json:"id"` + UserID int64 `json:"user_id"` + User *UserInfo `json:"user" db:"u"` + Tag string `json:"tag"` + QuoteNum int64 `json:"quote_num"` + IsFollowing int8 `json:"is_following"` + IsTop int8 `json:"is_top"` +} + +func (t *TagInfo) Format() *TagItem { + return &TagItem{ + ID: t.ID, + UserID: t.UserID, + User: &UserInfo{}, + Tag: t.Tag, + QuoteNum: t.QuoteNum, + IsFollowing: 0, + IsTop: 0, + } +} diff --git a/internal/core/cs/trading.go b/internal/core/cs/trading.go new file mode 100644 index 00000000..aebeb132 --- /dev/null +++ b/internal/core/cs/trading.go @@ -0,0 +1,12 @@ +// 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 AttachmentBill struct { + ID int64 `json:"id"` + PostID int64 `json:"post_id"` + UserID int64 `json:"user_id"` + PaidAmount int64 `json:"paid_amount"` +} diff --git a/internal/core/cs/tweets.go b/internal/core/cs/tweets.go new file mode 100644 index 00000000..34060030 --- /dev/null +++ b/internal/core/cs/tweets.go @@ -0,0 +1,141 @@ +// 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 + +const ( + // 推文内容分快类型 + TweetBlockTitle TweetBlockType = iota + 1 + TweetBlockText + TweetBlockImage + TweetBlockVideo + TweetBlockAudio + TweetBlockLink + TweetBlockAttachment + TweetBlockChargeAttachment + + // 推文可见性 + TweetVisitPublic TweetVisibleType = iota + TweetVisitPrivate + TweetVisitFriend + TweetVisitInvalid + + // 附件类型 + AttachmentTypeImage AttachmentType = iota + 1 + AttachmentTypeVideo + AttachmentTypeOther +) + +type ( + // TweetBlockType 推文内容分块类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 + // TODO: 优化一下类型为 uint8, 需要底层数据库同步修改 + TweetBlockType int + + // TweetVisibleType 推文可见性,0公开,1私密,2好友 + TweetVisibleType uint8 + + // AttachmentType 附件类型, 1图片, 2视频, 3其他 + // TODO: 优化一下类型为 uint8, 需要底层数据库同步修改 + AttachmentType int + + // TweetList 推文列表 + TweetList []*TweetItem + + // TweetInfoList 推文信息列表 + TweetInfoList []*TweetInfo + + // FavoriteList 收藏列表 + FavoriteList []*FavoriteItem + + // ReactionList 点赞列表 + ReactionList []*ReactionItem + + // TweetBlockList 推文分块列表 + TweetBlockList []*TweetBlock +) + +// TweetBlock 推文分块 +type TweetBlock struct { + ID int64 `json:"id" binding:"-"` + PostID int64 `json:"post_id" binding:"-"` + Content string `json:"content" binding:"required"` + Type TweetBlockType `json:"type" binding:"required"` + Sort int64 `json:"sort" binding:"required"` +} + +// TweetInfo 推文信息 +type TweetInfo struct { + ID int64 `json:"id"` + UserID int64 `json:"user_id"` + CommentCount int64 `json:"comment_count"` + CollectionCount int64 `json:"collection_count"` + UpvoteCount int64 `json:"upvote_count"` + Visibility TweetVisibleType `json:"visibility"` + IsTop int `json:"is_top"` + IsEssence int `json:"is_essence"` + IsLock int `json:"is_lock"` + LatestRepliedOn int64 `json:"latest_replied_on"` + Tags string `json:"tags"` + AttachmentPrice int64 `json:"attachment_price"` + IP string `json:"ip"` + IPLoc string `json:"ip_loc"` + CreatedOn int64 `json:"created_on"` + ModifiedOn int64 `json:"modified_on"` +} + +// TweetItem 一条推文信息 +type TweetItem struct { + ID int64 `json:"id"` + UserID int64 `json:"user_id"` + User *UserInfo `db:"user" json:"user"` + Contents []*TweetBlock `db:"-" json:"contents"` + CommentCount int64 `json:"comment_count"` + CollectionCount int64 `json:"collection_count"` + UpvoteCount int64 `json:"upvote_count"` + Visibility TweetVisibleType `json:"visibility"` + IsTop int `json:"is_top"` + IsEssence int `json:"is_essence"` + IsLock int `json:"is_lock"` + LatestRepliedOn int64 `json:"latest_replied_on"` + CreatedOn int64 `json:"created_on"` + ModifiedOn int64 `json:"modified_on"` + Tags map[string]int8 `json:"tags"` + AttachmentPrice int64 `json:"attachment_price"` + IPLoc string `json:"ip_loc"` +} + +type Attachment struct { + ID int64 `json:"id"` + UserID int64 `json:"user_id"` + FileSize int64 `json:"file_size"` + ImgWidth int `json:"img_width"` + ImgHeight int `json:"img_height"` + Type AttachmentType `json:"type"` + Content string `json:"content"` +} + +// Favorite 收藏 +type FavoriteItem struct { + ID int64 `json:"id"` + Tweet *TweetInfo `json:"-"` + TweetID int64 `json:"post_id"` + UserID int64 `json:"user_id"` +} + +// Reaction 反应、表情符号, 点赞、喜欢等 +type ReactionItem struct { + ID int64 `json:"id"` + Tweet *TweetInfo `json:"-"` + TweetID int64 `json:"post_id"` + UserID int64 `json:"user_id"` +} + +type NewTweetReq struct { + Contents TweetBlockList `json:"contents" binding:"required"` + Tags []string `json:"tags" binding:"required"` + Users []string `json:"users" binding:"required"` + AttachmentPrice int64 `json:"attachment_price"` + Visibility TweetVisibleType `json:"visibility"` + ClientIP string `json:"-" binding:"-"` +} diff --git a/internal/core/cs/user.go b/internal/core/cs/user.go new file mode 100644 index 00000000..d2331ff7 --- /dev/null +++ b/internal/core/cs/user.go @@ -0,0 +1,20 @@ +// 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 ( + // UserInfoList 用户信息列表 + UserInfoList []*UserInfo +) + +// UserInfo 用户基本信息 +type UserInfo struct { + ID int64 `json:"id"` + Nickname string `json:"nickname"` + Username string `json:"username"` + Status int `json:"status"` + Avatar string `json:"avatar"` + IsAdmin bool `json:"is_admin"` +} diff --git a/internal/core/messages.go b/internal/core/messages.go index 57816480..519e4e49 100644 --- a/internal/core/messages.go +++ b/internal/core/messages.go @@ -5,32 +5,15 @@ package core import ( - "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" -) - -const ( - MsgTypePost = dbr.MsgTypePost - MsgtypeComment = dbr.MsgtypeComment - MsgTypeReply = dbr.MsgTypeReply - MsgTypeWhisper = dbr.MsgTypeWhisper - MsgTypeRequestingFriend = dbr.MsgTypeRequestingFriend - MsgTypeSystem = dbr.MsgTypeSystem - - MsgStatusUnread = dbr.MsgStatusUnread - MsgStatusReaded = dbr.MsgStatusReaded -) - -type ( - Message = dbr.Message - MessageFormated = dbr.MessageFormated + "github.com/rocboss/paopao-ce/internal/core/ms" ) // MessageService 消息服务 type MessageService interface { - CreateMessage(msg *Message) (*Message, error) + CreateMessage(msg *ms.Message) (*ms.Message, error) GetUnreadCount(userID int64) (int64, error) - GetMessageByID(id int64) (*Message, error) - ReadMessage(message *Message) error - GetMessages(conditions *ConditionsT, offset, limit int) ([]*MessageFormated, error) - GetMessageCount(conditions *ConditionsT) (int64, error) + GetMessageByID(id int64) (*ms.Message, error) + ReadMessage(message *ms.Message) error + GetMessages(conditions *ms.ConditionsT, offset, limit int) ([]*ms.MessageFormated, error) + GetMessageCount(conditions *ms.ConditionsT) (int64, error) } diff --git a/internal/core/ms/authority.go b/internal/core/ms/authority.go new file mode 100644 index 00000000..d6378696 --- /dev/null +++ b/internal/core/ms/authority.go @@ -0,0 +1,115 @@ +// 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 ms + +import ( + "github.com/rocboss/paopao-ce/pkg/types" +) + +const ( + ActRegisterUser act = iota + ActCreatePublicTweet + ActCreatePublicAttachment + ActCreatePublicPicture + ActCreatePublicVideo + ActCreatePrivateTweet + ActCreatePrivateAttachment + ActCreatePrivatePicture + ActCreatePrivateVideo + ActCreateFriendTweet + ActCreateFriendAttachment + ActCreateFriendPicture + ActCreateFriendVideo + ActCreatePublicComment + ActCreatePublicPicureComment + ActCreateFriendComment + ActCreateFriendPicureComment + ActCreatePrivateComment + ActCreatePrivatePicureComment + ActStickTweet + ActTopTweet + ActLockTweet + ActVisibleTweet + ActDeleteTweet + ActCreateActivationCode +) + +type ( + act uint8 + + FriendFilter map[int64]types.Empty + FriendSet map[string]types.Empty + + Action struct { + Act act + UserId int64 + } +) + +func (f FriendFilter) IsFriend(userId int64) bool { + _, yeah := f[userId] + return yeah +} + +// IsAllow default true if user is admin +func (a act) IsAllow(user *User, userId int64, isFriend bool, isActivation bool) bool { + if user.IsAdmin { + return true + } + if user.ID == userId && isActivation { + switch a { + case ActCreatePublicTweet, + ActCreatePublicAttachment, + ActCreatePublicPicture, + ActCreatePublicVideo, + ActCreatePrivateTweet, + ActCreatePrivateAttachment, + ActCreatePrivatePicture, + ActCreatePrivateVideo, + ActCreateFriendTweet, + ActCreateFriendAttachment, + ActCreateFriendPicture, + ActCreateFriendVideo, + ActCreatePrivateComment, + ActCreatePrivatePicureComment, + ActStickTweet, + ActLockTweet, + ActVisibleTweet, + ActDeleteTweet: + return true + } + } + + if user.ID == userId && !isActivation { + switch a { + case ActCreatePrivateTweet, + ActCreatePrivateComment, + ActStickTweet, + ActLockTweet, + ActDeleteTweet: + return true + } + } + + if isFriend && isActivation { + switch a { + case ActCreatePublicComment, + ActCreatePublicPicureComment, + ActCreateFriendComment, + ActCreateFriendPicureComment: + return true + } + } + + if !isFriend && isActivation { + switch a { + case ActCreatePublicComment, + ActCreatePublicPicureComment: + return true + } + } + + return false +} diff --git a/internal/core/ms/comments.go b/internal/core/ms/comments.go new file mode 100644 index 00000000..87ef2473 --- /dev/null +++ b/internal/core/ms/comments.go @@ -0,0 +1,17 @@ +// 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 ms + +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + Comment = dbr.Comment + CommentFormated = dbr.CommentFormated + CommentReply = dbr.CommentReply + CommentContent = dbr.CommentContent + CommentReplyFormated = dbr.CommentReplyFormated +) diff --git a/internal/core/ms/messages.go b/internal/core/ms/messages.go new file mode 100644 index 00000000..adf793f8 --- /dev/null +++ b/internal/core/ms/messages.go @@ -0,0 +1,26 @@ +// 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 ms + +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +const ( + MsgTypePost = dbr.MsgTypePost + MsgtypeComment = dbr.MsgtypeComment + MsgTypeReply = dbr.MsgTypeReply + MsgTypeWhisper = dbr.MsgTypeWhisper + MsgTypeRequestingFriend = dbr.MsgTypeRequestingFriend + MsgTypeSystem = dbr.MsgTypeSystem + + MsgStatusUnread = dbr.MsgStatusUnread + MsgStatusReaded = dbr.MsgStatusReaded +) + +type ( + Message = dbr.Message + MessageFormated = dbr.MessageFormated +) diff --git a/internal/core/types.go b/internal/core/ms/ms.go similarity index 79% rename from internal/core/types.go rename to internal/core/ms/ms.go index 6ca95893..8993251f 100644 --- a/internal/core/types.go +++ b/internal/core/ms/ms.go @@ -1,8 +1,10 @@ -// Copyright 2022 ROC. All rights reserved. +// 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 core +// Package ms contain core data service interface type +// model define for gorm adapter +package ms import ( "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" diff --git a/internal/core/ms/security.go b/internal/core/ms/security.go new file mode 100644 index 00000000..a6610ca1 --- /dev/null +++ b/internal/core/ms/security.go @@ -0,0 +1,13 @@ +// 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 ms + +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + Captcha = dbr.Captcha +) diff --git a/internal/core/ms/timeline.go b/internal/core/ms/timeline.go new file mode 100644 index 00000000..eb1169f4 --- /dev/null +++ b/internal/core/ms/timeline.go @@ -0,0 +1,10 @@ +// 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 ms + +type IndexTweetList struct { + Tweets []*PostFormated + Total int64 +} diff --git a/internal/core/ms/tweets.go b/internal/core/ms/tweets.go new file mode 100644 index 00000000..eab6d85c --- /dev/null +++ b/internal/core/ms/tweets.go @@ -0,0 +1,43 @@ +// 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 ms + +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +const ( + AttachmentTypeImage = dbr.AttachmentTypeImage + AttachmentTypeVideo = dbr.AttachmentTypeVideo + AttachmentTypeOther = dbr.AttachmentTypeOther + + // 类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 + ContentTypeTitle = dbr.ContentTypeTitle + ContentTypeText = dbr.ContentTypeText + ContentTypeImage = dbr.ContentTypeImage + ContentTypeVideo = dbr.ContentTypeVideo + ContentTypeAudio = dbr.ContentTypeAudio + ContentTypeLink = dbr.ContentTypeLink + ContentTypeAttachment = dbr.ContentTypeAttachment + ContentTypeChargeAttachment = dbr.ContentTypeChargeAttachment +) + +const ( + PostVisitPublic PostVisibleT = iota + PostVisitPrivate + PostVisitFriend + PostVisitInvalid +) + +type ( + PostStar = dbr.PostStar + PostCollection = dbr.PostCollection + PostAttachmentBill = dbr.PostAttachmentBill + PostContent = dbr.PostContent + Attachment = dbr.Attachment + AttachmentType = dbr.AttachmentType + PostContentT = dbr.PostContentT + PostVisibleT = dbr.PostVisibleT +) diff --git a/internal/core/ms/user.go b/internal/core/ms/user.go new file mode 100644 index 00000000..88cc6e73 --- /dev/null +++ b/internal/core/ms/user.go @@ -0,0 +1,20 @@ +// 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 ms + +type ( + ContactItem struct { + UserId int64 `json:"user_id"` + UserName string `db:"username" json:"username"` + Nickname string `json:"nickname"` + Avatar string `json:"avatar"` + Phone string `json:"phone"` + } + + ContactList struct { + Contacts []ContactItem `json:"contacts"` + Total int64 `json:"total"` + } +) diff --git a/internal/core/ms/wallet.go b/internal/core/ms/wallet.go new file mode 100644 index 00000000..5786fcac --- /dev/null +++ b/internal/core/ms/wallet.go @@ -0,0 +1,14 @@ +// 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 ms + +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + WalletStatement = dbr.WalletStatement + WalletRecharge = dbr.WalletRecharge +) diff --git a/internal/core/search.go b/internal/core/search.go index 74d6e029..dc08e127 100644 --- a/internal/core/search.go +++ b/internal/core/search.go @@ -5,6 +5,7 @@ package core import ( + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" ) @@ -21,6 +22,7 @@ const ( ) type ( + // PostVisibleT 可访问类型,0公开,1私密,2好友 PostVisibleT = dbr.PostVisibleT SearchType string @@ -32,12 +34,12 @@ type ( } QueryResp struct { - Items []*PostFormated + Items []*ms.PostFormated Total int64 } TsDocItem struct { - Post *Post + Post *ms.Post Content string } ) @@ -47,5 +49,5 @@ type TweetSearchService interface { IndexName() string AddDocuments(data []TsDocItem, primaryKey ...string) (bool, error) DeleteDocuments(identifiers []string) error - Search(user *User, q *QueryReq, offset, limit int) (*QueryResp, error) + Search(user *ms.User, q *QueryReq, offset, limit int) (*QueryResp, error) } diff --git a/internal/core/security.go b/internal/core/security.go index ce313635..0643cc28 100644 --- a/internal/core/security.go +++ b/internal/core/security.go @@ -7,17 +7,13 @@ package core import ( "time" - "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" -) - -type ( - Captcha = dbr.Captcha + "github.com/rocboss/paopao-ce/internal/core/ms" ) // SecurityService 安全相关服务 type SecurityService interface { - GetLatestPhoneCaptcha(phone string) (*Captcha, error) - UsePhoneCaptcha(captcha *Captcha) error + GetLatestPhoneCaptcha(phone string) (*ms.Captcha, error) + UsePhoneCaptcha(captcha *ms.Captcha) error SendPhoneCaptcha(phone string) error } diff --git a/internal/core/timeline.go b/internal/core/timeline.go new file mode 100644 index 00000000..722e79f3 --- /dev/null +++ b/internal/core/timeline.go @@ -0,0 +1,20 @@ +// 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 core + +import ( + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" +) + +// IndexPostsService 广场首页推文列表服务 +type IndexPostsService interface { + IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) +} + +// IndexPostsServantA 广场首页推文列表服务(版本A) +type IndexPostsServantA interface { + IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error) +} diff --git a/internal/core/topics.go b/internal/core/topics.go index 813574c8..cc3f12cf 100644 --- a/internal/core/topics.go +++ b/internal/core/topics.go @@ -5,24 +5,27 @@ package core import ( - "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" -) - -type ( - Tag = dbr.Tag - TagFormated = dbr.TagFormated + "github.com/rocboss/paopao-ce/internal/core/cs" ) // TopicService 话题服务 type TopicService interface { - CreateTag(tag *Tag) (*Tag, error) - DeleteTag(tag *Tag) error - GetTags(conditions *ConditionsT, offset, limit int) ([]*Tag, error) - GetHotTags(userId int64, limit int, offset int) ([]*TagFormated, error) - GetNewestTags(userId int64, limit int, offset int) ([]*TagFormated, error) - GetFollowTags(userId int64, limit int, offset int) ([]*TagFormated, error) - GetTagsByKeyword(keyword string) ([]*Tag, error) + UpsertTags(userId int64, tags []string) (cs.TagInfoList, error) + DecrTagsById(ids []int64) error + ListTags(typ cs.TagType, limit int, offset int) (cs.TagList, error) + TagsByKeyword(keyword string) (cs.TagInfoList, error) + GetHotTags(userId int64, limit int, offset int) (cs.TagList, error) + GetNewestTags(userId int64, limit int, offset int) (cs.TagList, error) + GetFollowTags(userId int64, limit int, offset int) (cs.TagList, error) FollowTopic(userId int64, topicId int64) error UnfollowTopic(userId int64, topicId int64) error StickTopic(userId int64, topicId int64) (int8, error) } + +// TopicServantA 话题服务(版本A) +type TopicServantA interface { + UpsertTags(userId int64, tags []string) (cs.TagInfoList, error) + DecrTagsById(ids []int64) error + ListTags(typ cs.TagType, limit int, offset int) (cs.TagList, error) + TagsByKeyword(keyword string) (cs.TagInfoList, error) +} diff --git a/internal/core/tweets.go b/internal/core/tweets.go index 682cbd65..97fda8e3 100644 --- a/internal/core/tweets.go +++ b/internal/core/tweets.go @@ -5,79 +5,76 @@ package core import ( - "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" -) - -const ( - AttachmentTypeImage = dbr.AttachmentTypeImage - AttachmentTypeVideo = dbr.AttachmentTypeVideo - AttachmentTypeOther = dbr.AttachmentTypeOther - - // 类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 - ContentTypeTitle = dbr.ContentTypeTitle - ContentTypeText = dbr.ContentTypeText - ContentTypeImage = dbr.ContentTypeImage - ContentTypeVideo = dbr.ContentTypeVideo - ContentTypeAudio = dbr.ContentTypeAudio - ContentTypeLink = dbr.ContentTypeLink - ContentTypeAttachment = dbr.ContentTypeAttachment - ContentTypeChargeAttachment = dbr.ContentTypeChargeAttachment -) - -type ( - PostStar = dbr.PostStar - PostCollection = dbr.PostCollection - PostAttachmentBill = dbr.PostAttachmentBill - PostContent = dbr.PostContent - Attachment = dbr.Attachment - AttachmentType = dbr.AttachmentType - PostContentT = dbr.PostContentT - - IndexTweetList struct { - Tweets []*PostFormated - Total int64 - } + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" ) // TweetService 推文检索服务 type TweetService interface { - GetPostByID(id int64) (*Post, error) - GetPosts(conditions *ConditionsT, offset, limit int) ([]*Post, error) - GetPostCount(conditions *ConditionsT) (int64, error) - GetUserPostStar(postID, userID int64) (*PostStar, error) - GetUserPostStars(userID int64, offset, limit int) ([]*PostStar, error) + GetPostByID(id int64) (*ms.Post, error) + GetPosts(conditions ms.ConditionsT, offset, limit int) ([]*ms.Post, error) + GetPostCount(conditions ms.ConditionsT) (int64, error) + GetUserPostStar(postID, userID int64) (*ms.PostStar, error) + GetUserPostStars(userID int64, offset, limit int) ([]*ms.PostStar, error) GetUserPostStarCount(userID int64) (int64, error) - GetUserPostCollection(postID, userID int64) (*PostCollection, error) - GetUserPostCollections(userID int64, offset, limit int) ([]*PostCollection, error) + GetUserPostCollection(postID, userID int64) (*ms.PostCollection, error) + GetUserPostCollections(userID int64, offset, limit int) ([]*ms.PostCollection, error) GetUserPostCollectionCount(userID int64) (int64, error) - GetPostAttatchmentBill(postID, userID int64) (*PostAttachmentBill, error) - GetPostContentsByIDs(ids []int64) ([]*PostContent, error) - GetPostContentByID(id int64) (*PostContent, error) + GetPostAttatchmentBill(postID, userID int64) (*ms.PostAttachmentBill, error) + GetPostContentsByIDs(ids []int64) ([]*ms.PostContent, error) + GetPostContentByID(id int64) (*ms.PostContent, error) } // TweetManageService 推文管理服务,包括创建/删除/更新推文 type TweetManageService interface { - CreateAttachment(attachment *Attachment) (*Attachment, error) - CreatePost(post *Post) (*Post, error) - DeletePost(post *Post) ([]string, error) - LockPost(post *Post) error - StickPost(post *Post) error - VisiblePost(post *Post, visibility PostVisibleT) error - UpdatePost(post *Post) error - CreatePostStar(postID, userID int64) (*PostStar, error) - DeletePostStar(p *PostStar) error - CreatePostCollection(postID, userID int64) (*PostCollection, error) - DeletePostCollection(p *PostCollection) error - CreatePostContent(content *PostContent) (*PostContent, error) + CreatePost(post *ms.Post) (*ms.Post, error) + DeletePost(post *ms.Post) ([]string, error) + LockPost(post *ms.Post) error + StickPost(post *ms.Post) error + VisiblePost(post *ms.Post, visibility PostVisibleT) error + UpdatePost(post *ms.Post) error + CreatePostStar(postID, userID int64) (*ms.PostStar, error) + DeletePostStar(p *ms.PostStar) error + CreatePostCollection(postID, userID int64) (*ms.PostCollection, error) + DeletePostCollection(p *ms.PostCollection) error + CreatePostContent(content *ms.PostContent) (*ms.PostContent, error) + CreateAttachment(obj *ms.Attachment) (int64, error) } // TweetHelpService 推文辅助服务 type TweetHelpService interface { - RevampPosts(posts []*PostFormated) ([]*PostFormated, error) - MergePosts(posts []*Post) ([]*PostFormated, error) + RevampPosts(posts []*ms.PostFormated) ([]*ms.PostFormated, error) + MergePosts(posts []*ms.Post) ([]*ms.PostFormated, error) +} + +// TweetServantA 推文检索服务(版本A) +type TweetServantA interface { + TweetInfoById(id int64) (*cs.TweetInfo, error) + TweetItemById(id int64) (*cs.TweetItem, error) + UserTweets(visitorId, userId int64) (cs.TweetList, error) + ReactionByTweetId(userId int64, tweetId int64) (*cs.ReactionItem, error) + UserReactions(userId int64, limit int, offset int) (cs.ReactionList, error) + FavoriteByTweetId(userId int64, tweetId int64) (*cs.FavoriteItem, error) + UserFavorites(userId int64, limit int, offset int) (cs.FavoriteList, error) + AttachmentByTweetId(userId int64, tweetId int64) (*cs.AttachmentBill, error) +} + +// TweetManageServantA 推文管理服务,包括创建/删除/更新推文(版本A) +type TweetManageServantA interface { + CreateAttachment(obj *cs.Attachment) (int64, error) + CreateTweet(userId int64, req *cs.NewTweetReq) (*cs.TweetItem, error) + DeleteTweet(userId int64, tweetId int64) ([]string, error) + LockTweet(userId int64, tweetId int64) error + StickTweet(userId int64, tweetId int64) error + VisibleTweet(userId int64, visibility cs.TweetVisibleType) error + CreateReaction(userId int64, tweetId int64) error + DeleteReaction(userId int64, reactionId int64) error + CreateFavorite(userId int64, tweetId int64) error + DeleteFavorite(userId int64, favoriteId int64) error } -// IndexPostsService 广场首页推文列表服务 -type IndexPostsService interface { - IndexPosts(user *User, offset int, limit int) (*IndexTweetList, error) +// TweetHelpServantA 推文辅助服务(版本A) +type TweetHelpServantA interface { + RevampTweets(tweets cs.TweetList) (cs.TweetList, error) + MergeTweets(tweets cs.TweetInfo) (cs.TweetList, error) } diff --git a/internal/core/user.go b/internal/core/user.go index ed132dd3..04d30e23 100644 --- a/internal/core/user.go +++ b/internal/core/user.go @@ -4,30 +4,17 @@ package core -type ( - ContactItem struct { - UserId int64 `json:"user_id"` - UserName string `json:"username"` - Nickname string `json:"nickname"` - Avatar string `json:"avatar"` - Phone string `json:"phone"` - } - - ContactList struct { - Contacts []ContactItem `json:"contacts"` - Total int64 `json:"total"` - } -) +import "github.com/rocboss/paopao-ce/internal/core/ms" // UserManageService 用户管理服务 type UserManageService interface { - GetUserByID(id int64) (*User, error) - GetUserByUsername(username string) (*User, error) - GetUserByPhone(phone string) (*User, error) - GetUsersByIDs(ids []int64) ([]*User, error) - GetUsersByKeyword(keyword string) ([]*User, error) - CreateUser(user *User) (*User, error) - UpdateUser(user *User) error + GetUserByID(id int64) (*ms.User, error) + GetUserByUsername(username string) (*ms.User, error) + GetUserByPhone(phone string) (*ms.User, error) + GetUsersByIDs(ids []int64) ([]*ms.User, error) + GetUsersByKeyword(keyword string) ([]*ms.User, error) + CreateUser(user *ms.User) (*ms.User, error) + UpdateUser(user *ms.User) error } // ContactManageService 联系人管理服务 @@ -36,6 +23,6 @@ type ContactManageService interface { AddFriend(userId int64, friendId int64) error RejectFriend(userId int64, friendId int64) error DeleteFriend(userId int64, friendId int64) error - GetContacts(userId int64, offset int, limit int) (*ContactList, error) + GetContacts(userId int64, offset int, limit int) (*ms.ContactList, error) IsFriend(userID int64, friendID int64) bool } diff --git a/internal/core/wallet.go b/internal/core/wallet.go index c4792d3b..e452a3ad 100644 --- a/internal/core/wallet.go +++ b/internal/core/wallet.go @@ -5,20 +5,15 @@ package core import ( - "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" -) - -type ( - WalletStatement = dbr.WalletStatement - WalletRecharge = dbr.WalletRecharge + "github.com/rocboss/paopao-ce/internal/core/ms" ) // WalletService wallet service interface type WalletService interface { - GetUserWalletBills(userID int64, offset, limit int) ([]*WalletStatement, error) + GetUserWalletBills(userID int64, offset, limit int) ([]*ms.WalletStatement, error) GetUserWalletBillCount(userID int64) (int64, error) - GetRechargeByID(id int64) (*WalletRecharge, error) - CreateRecharge(userId, amount int64) (*WalletRecharge, error) - HandleRechargeSuccess(recharge *WalletRecharge, tradeNo string) error - HandlePostAttachmentBought(post *Post, user *User) error + GetRechargeByID(id int64) (*ms.WalletRecharge, error) + CreateRecharge(userId, amount int64) (*ms.WalletRecharge, error) + HandleRechargeSuccess(recharge *ms.WalletRecharge, tradeNo string) error + HandlePostAttachmentBought(post *ms.Post, user *ms.User) error } diff --git a/internal/dao/cache/base.go b/internal/dao/cache/base.go index f8f1e270..fe314683 100644 --- a/internal/dao/cache/base.go +++ b/internal/dao/cache/base.go @@ -15,6 +15,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/types" "github.com/sirupsen/logrus" ) @@ -30,7 +31,7 @@ var ( type postsEntry struct { key string - tweets *core.IndexTweetList + tweets *ms.IndexTweetList } type tweetsCache interface { @@ -54,7 +55,7 @@ type cacheIndexSrv struct { preventDuration time.Duration } -func (s *cacheIndexSrv) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { +func (s *cacheIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { key := s.keyFrom(user, offset, limit) posts, err := s.getPosts(key) if err == nil { @@ -70,7 +71,7 @@ func (s *cacheIndexSrv) IndexPosts(user *core.User, offset int, limit int) (*cor return posts, nil } -func (s *cacheIndexSrv) getPosts(key string) (*core.IndexTweetList, error) { +func (s *cacheIndexSrv) getPosts(key string) (*ms.IndexTweetList, error) { data, err := s.cache.getTweetsBytes(key) if err != nil { logrus.Debugf("cacheIndexSrv.getPosts get posts by key: %s from cache err: %v", key, err) @@ -78,7 +79,7 @@ func (s *cacheIndexSrv) getPosts(key string) (*core.IndexTweetList, error) { } buf := bytes.NewBuffer(data) dec := gob.NewDecoder(buf) - var resp core.IndexTweetList + var resp ms.IndexTweetList if err := dec.Decode(&resp); err != nil { logrus.Debugf("cacheIndexSrv.getPosts get posts from cache in decode err: %v", err) return nil, err @@ -86,7 +87,7 @@ func (s *cacheIndexSrv) getPosts(key string) (*core.IndexTweetList, error) { return &resp, nil } -func (s *cacheIndexSrv) cachePosts(key string, tweets *core.IndexTweetList) { +func (s *cacheIndexSrv) cachePosts(key string, tweets *ms.IndexTweetList) { entry := &postsEntry{key: key, tweets: tweets} select { case s.cachePostsCh <- entry: @@ -112,7 +113,7 @@ func (s *cacheIndexSrv) setPosts(entry *postsEntry) { logrus.Debugf("cacheIndexSrv.setPosts setPosts set cache by key: %s", entry.key) } -func (s *cacheIndexSrv) keyFrom(user *core.User, offset int, limit int) string { +func (s *cacheIndexSrv) keyFrom(user *ms.User, offset int, limit int) string { var userId int64 = -1 if user != nil { userId = user.ID @@ -120,7 +121,7 @@ func (s *cacheIndexSrv) keyFrom(user *core.User, offset int, limit int) string { return fmt.Sprintf("%s:%d:%d:%d", _cacheIndexKey, userId, offset, limit) } -func (s *cacheIndexSrv) SendAction(act core.IdxAct, post *core.Post) { +func (s *cacheIndexSrv) SendAction(act core.IdxAct, post *ms.Post) { action := core.NewIndexAction(act, post) select { case s.indexActionCh <- action: @@ -168,7 +169,7 @@ func (s *cacheIndexSrv) handleIndexAction(action *core.IndexAction) { func (s *cacheIndexSrv) deleteCacheByUserId(id int64, oneself bool) { var keys []string userId := strconv.FormatInt(id, 10) - friendSet := core.FriendSet{} + friendSet := ms.FriendSet{} if !oneself { friendSet = s.ams.MyFriendSet(id) } diff --git a/internal/dao/cache/none.go b/internal/dao/cache/none.go index ce6e1caf..079c453b 100644 --- a/internal/dao/cache/none.go +++ b/internal/dao/cache/none.go @@ -7,6 +7,9 @@ package cache import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" + "github.com/rocboss/paopao-ce/pkg/debug" ) var ( @@ -18,11 +21,16 @@ type noneCacheIndexServant struct { ips core.IndexPostsService } -func (s *noneCacheIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { +func (s *noneCacheIndexServant) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { return s.ips.IndexPosts(user, offset, limit) } -func (s *noneCacheIndexServant) SendAction(_act core.IdxAct, _post *core.Post) { +func (s *noneCacheIndexServant) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *noneCacheIndexServant) SendAction(_act core.IdxAct, _post *ms.Post) { // empty } diff --git a/internal/dao/cache/simple.go b/internal/dao/cache/simple.go index ba674d1b..a1c230d3 100644 --- a/internal/dao/cache/simple.go +++ b/internal/dao/cache/simple.go @@ -10,6 +10,9 @@ import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" + "github.com/rocboss/paopao-ce/pkg/debug" "github.com/sirupsen/logrus" ) @@ -22,21 +25,21 @@ type simpleCacheIndexServant struct { ips core.IndexPostsService indexActionCh chan core.IdxAct - indexPosts *core.IndexTweetList + indexPosts *ms.IndexTweetList atomicIndex atomic.Value maxIndexSize int checkTick *time.Ticker expireIndexTick *time.Ticker } -func (s *simpleCacheIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { - cacheResp := s.atomicIndex.Load().(*core.IndexTweetList) +func (s *simpleCacheIndexServant) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { + cacheResp := s.atomicIndex.Load().(*ms.IndexTweetList) end := offset + limit if cacheResp != nil { size := len(cacheResp.Tweets) logrus.Debugf("simpleCacheIndexServant.IndexPosts get index posts from cache posts: %d offset:%d limit:%d start:%d, end:%d", size, offset, limit, offset, end) if size >= end { - return &core.IndexTweetList{ + return &ms.IndexTweetList{ Tweets: cacheResp.Tweets[offset:end], Total: cacheResp.Total, }, nil @@ -47,7 +50,12 @@ func (s *simpleCacheIndexServant) IndexPosts(user *core.User, offset int, limit return s.ips.IndexPosts(user, offset, limit) } -func (s *simpleCacheIndexServant) SendAction(act core.IdxAct, _post *core.Post) { +func (s *simpleCacheIndexServant) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *simpleCacheIndexServant) SendAction(act core.IdxAct, _post *ms.Post) { select { case s.indexActionCh <- act: logrus.Debugf("simpleCacheIndexServant.SendAction send indexAction by chan: %s", act) diff --git a/internal/dao/dao.go b/internal/dao/dao.go index 2fcdd580..b1f7d9f2 100644 --- a/internal/dao/dao.go +++ b/internal/dao/dao.go @@ -18,87 +18,114 @@ import ( ) var ( - ts core.TweetSearchService - ds core.DataService - oss core.ObjectStorageService + ts core.TweetSearchService + ds core.DataService + oss core.ObjectStorageService + webDsa core.WebDataServantA - onceTs, onceDs, onceOss sync.Once + _onceInitial sync.Once ) func DataService() core.DataService { - onceDs.Do(func() { - var v core.VersionInfo - if cfg.If("Gorm") { - ds, v = jinzhu.NewDataService() - } else if cfg.All("Sqlx", "MySQL") { - ds, v = sakila.NewDataService() - } else if cfg.If("Sqlx") && cfg.Any("Postgres", "PostgreSQL") { - ds, v = slonik.NewDataService() - } else { - // default use gorm as orm for sql database - ds, v = jinzhu.NewDataService() - } - logrus.Infof("use %s as data service with version %s", v.Name(), v.Version()) - }) + lazyInitial() return ds } +func WebDataServantA() core.WebDataServantA { + lazyInitial() + return webDsa +} + func ObjectStorageService() core.ObjectStorageService { - onceOss.Do(func() { - var v core.VersionInfo - if cfg.If("AliOSS") { - oss, v = storage.MustAliossService() - } else if cfg.If("COS") { - oss, v = storage.NewCosService() - } else if cfg.If("HuaweiOBS") { - oss, v = storage.MustHuaweiobsService() - } else if cfg.If("MinIO") { - oss, v = storage.MustMinioService() - } else if cfg.If("S3") { - oss, v = storage.MustS3Service() - logrus.Infof("use S3 as object storage by version %s", v.Version()) - return - } else if cfg.If("LocalOSS") { - oss, v = storage.MustLocalossService() - } else { - // default use AliOSS as object storage service - oss, v = storage.MustAliossService() - logrus.Infof("use default AliOSS as object storage by version %s", v.Version()) - return - } - logrus.Infof("use %s as object storage by version %s", v.Name(), v.Version()) - }) + lazyInitial() return oss } func TweetSearchService() core.TweetSearchService { - onceTs.Do(func() { - var v core.VersionInfo - ams := newAuthorizationManageService() - if cfg.If("Zinc") { - ts, v = search.NewZincTweetSearchService(ams) - } else if cfg.If("Meili") { - ts, v = search.NewMeiliTweetSearchService(ams) - } else { - // default use Zinc as tweet search service - ts, v = search.NewZincTweetSearchService(ams) - } - logrus.Infof("use %s as tweet search serice by version %s", v.Name(), v.Version()) - - ts = search.NewBridgeTweetSearchService(ts) - }) + lazyInitial() return ts } -func newAuthorizationManageService() (s core.AuthorizationManageService) { +func newAuthorizationManageService() (ams core.AuthorizationManageService) { if cfg.If("Gorm") { - s = jinzhu.NewAuthorizationManageService() - } else if cfg.All("Sqlx", "MySQL") { - s = sakila.NewAuthorizationManageService() - } else if cfg.If("Sqlx") && cfg.Any("Postgres", "PostgreSQL") { - s = slonik.NewAuthorizationManageService() + ams = jinzhu.NewAuthorizationManageService() + } else if cfg.If("Sqlx") { + ams = sakila.NewAuthorizationManageService() + } else if cfg.If("Sqlc") && cfg.Any("Postgres", "PostgreSQL") { + ams = slonik.NewAuthorizationManageService() } else { - s = jinzhu.NewAuthorizationManageService() + ams = jinzhu.NewAuthorizationManageService() } return } + +// lazyInitial do some package lazy initialize for performance +func lazyInitial() { + _onceInitial.Do(func() { + initDsX() + initOSS() + initTsX() + }) +} + +func initDsX() { + var dsVer, dsaVer core.VersionInfo + if cfg.If("Gorm") { + ds, dsVer = jinzhu.NewDataService() + webDsa, dsaVer = jinzhu.NewWebDataServantA() + } else if cfg.If("Sqlx") { + ds, dsVer = sakila.NewDataService() + webDsa, dsaVer = sakila.NewWebDataServantA() + } else if cfg.If("Sqlc") && cfg.Any("Postgres", "PostgreSQL") { + ds, dsVer = slonik.NewDataService() + webDsa, dsaVer = slonik.NewWebDataServantA() + } else { + // default use gorm as orm for sql database + ds, dsVer = jinzhu.NewDataService() + webDsa, dsaVer = jinzhu.NewWebDataServantA() + } + logrus.Infof("use %s as core.DataService with version %s", dsVer.Name(), dsVer.Version()) + logrus.Infof("use %s as core.ServantA with version %s", dsaVer.Name(), dsaVer.Version()) +} + +func initOSS() { + var v core.VersionInfo + if cfg.If("AliOSS") { + oss, v = storage.MustAliossService() + } else if cfg.If("COS") { + oss, v = storage.NewCosService() + } else if cfg.If("HuaweiOBS") { + oss, v = storage.MustHuaweiobsService() + } else if cfg.If("MinIO") { + oss, v = storage.MustMinioService() + } else if cfg.If("S3") { + oss, v = storage.MustS3Service() + logrus.Infof("use S3 as object storage by version %s", v.Version()) + return + } else if cfg.If("LocalOSS") { + oss, v = storage.MustLocalossService() + } else { + // default use AliOSS as object storage service + oss, v = storage.MustAliossService() + logrus.Infof("use default AliOSS as object storage by version %s", v.Version()) + return + } + logrus.Infof("use %s as object storage by version %s", v.Name(), v.Version()) +} + +func initTsX() { + var v core.VersionInfo + ams := newAuthorizationManageService() + cfg.On(cfg.Actions{ + "Zinc": func() { + ts, v = search.NewZincTweetSearchService(ams) + }, + "Meili": func() { + ts, v = search.NewMeiliTweetSearchService(ams) + }, + }, func() { + ts, v = search.NewZincTweetSearchService(ams) + }) + logrus.Infof("use %s as tweet search serice by version %s", v.Name(), v.Version()) + ts = search.NewBridgeTweetSearchService(ts) +} diff --git a/internal/dao/jinzhu/authority.go b/internal/dao/jinzhu/authority.go index 5932fa24..9921f214 100644 --- a/internal/dao/jinzhu/authority.go +++ b/internal/dao/jinzhu/authority.go @@ -6,26 +6,27 @@ package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/rocboss/paopao-ce/pkg/types" "gorm.io/gorm" ) var ( - _ core.AuthorizationManageService = (*authorizationManageServant)(nil) + _ core.AuthorizationManageService = (*authorizationManageSrv)(nil) ) -type authorizationManageServant struct { +type authorizationManageSrv struct { db *gorm.DB } func newAuthorizationManageService(db *gorm.DB) core.AuthorizationManageService { - return &authorizationManageServant{ + return &authorizationManageSrv{ db: db, } } -func (s *authorizationManageServant) IsAllow(user *core.User, action *core.Action) bool { +func (s *authorizationManageSrv) IsAllow(user *ms.User, action *ms.Action) bool { // user is activation if had bind phone isActivation := (len(user.Phone) != 0) isFriend := s.isFriend(user.ID, action.UserId) @@ -33,37 +34,37 @@ func (s *authorizationManageServant) IsAllow(user *core.User, action *core.Actio return action.Act.IsAllow(user, action.UserId, isFriend, isActivation) } -func (s *authorizationManageServant) MyFriendSet(userId int64) core.FriendSet { +func (s *authorizationManageSrv) MyFriendSet(userId int64) ms.FriendSet { ids, err := (&dbr.Contact{UserId: userId}).MyFriendIds(s.db) if err != nil { - return core.FriendSet{} + return ms.FriendSet{} } - resp := make(core.FriendSet, len(ids)) + resp := make(ms.FriendSet, len(ids)) for _, id := range ids { resp[id] = types.Empty{} } return resp } -func (s *authorizationManageServant) BeFriendFilter(userId int64) core.FriendFilter { +func (s *authorizationManageSrv) BeFriendFilter(userId int64) ms.FriendFilter { ids, err := (&dbr.Contact{FriendId: userId}).BeFriendIds(s.db) if err != nil { - return core.FriendFilter{} + return ms.FriendFilter{} } - resp := make(core.FriendFilter, len(ids)) + resp := make(ms.FriendFilter, len(ids)) for _, id := range ids { resp[id] = types.Empty{} } return resp } -func (s *authorizationManageServant) BeFriendIds(userId int64) ([]int64, error) { +func (s *authorizationManageSrv) BeFriendIds(userId int64) ([]int64, error) { return (&dbr.Contact{FriendId: userId}).BeFriendIds(s.db) } -func (s *authorizationManageServant) isFriend(userId int64, friendId int64) bool { +func (s *authorizationManageSrv) isFriend(userId int64, friendId int64) bool { contact, err := (&dbr.Contact{UserId: friendId, FriendId: userId}).GetByUserFriend(s.db) if err == nil || contact.Status == dbr.ContactStatusAgree { return true diff --git a/internal/dao/jinzhu/comments.go b/internal/dao/jinzhu/comments.go index 93d56a11..4ac08e18 100644 --- a/internal/dao/jinzhu/comments.go +++ b/internal/dao/jinzhu/comments.go @@ -9,37 +9,38 @@ import ( "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/rocboss/paopao-ce/pkg/types" "gorm.io/gorm" ) var ( - _ core.CommentService = (*commentServant)(nil) - _ core.CommentManageService = (*commentManageServant)(nil) + _ core.CommentService = (*commentSrv)(nil) + _ core.CommentManageService = (*commentManageSrv)(nil) ) -type commentServant struct { +type commentSrv struct { db *gorm.DB } -type commentManageServant struct { +type commentManageSrv struct { db *gorm.DB } func newCommentService(db *gorm.DB) core.CommentService { - return &commentServant{ + return &commentSrv{ db: db, } } func newCommentManageService(db *gorm.DB) core.CommentManageService { - return &commentManageServant{ + return &commentManageSrv{ db: db, } } -func (s *commentServant) GetCommentThumbsMap(userId int64, tweetId int64) (cs.CommentThumbsMap, cs.CommentThumbsMap, error) { +func (s *commentSrv) GetCommentThumbsMap(userId int64, tweetId int64) (cs.CommentThumbsMap, cs.CommentThumbsMap, error) { if userId < 0 { return nil, nil, nil } @@ -59,11 +60,11 @@ func (s *commentServant) GetCommentThumbsMap(userId int64, tweetId int64) (cs.Co return commentThumbs, replyThumbs, nil } -func (s *commentServant) GetComments(conditions *core.ConditionsT, offset, limit int) ([]*core.Comment, error) { +func (s *commentSrv) GetComments(conditions *ms.ConditionsT, offset, limit int) ([]*ms.Comment, error) { return (&dbr.Comment{}).List(s.db, conditions, offset, limit) } -func (s *commentServant) GetCommentByID(id int64) (*core.Comment, error) { +func (s *commentSrv) GetCommentByID(id int64) (*ms.Comment, error) { comment := &dbr.Comment{ Model: &dbr.Model{ ID: id, @@ -72,7 +73,7 @@ func (s *commentServant) GetCommentByID(id int64) (*core.Comment, error) { return comment.Get(s.db) } -func (s *commentServant) GetCommentReplyByID(id int64) (*core.CommentReply, error) { +func (s *commentSrv) GetCommentReplyByID(id int64) (*ms.CommentReply, error) { reply := &dbr.CommentReply{ Model: &dbr.Model{ ID: id, @@ -81,18 +82,18 @@ func (s *commentServant) GetCommentReplyByID(id int64) (*core.CommentReply, erro return reply.Get(s.db) } -func (s *commentServant) GetCommentCount(conditions *core.ConditionsT) (int64, error) { +func (s *commentSrv) GetCommentCount(conditions *ms.ConditionsT) (int64, error) { return (&dbr.Comment{}).Count(s.db, conditions) } -func (s *commentServant) GetCommentContentsByIDs(ids []int64) ([]*core.CommentContent, error) { +func (s *commentSrv) GetCommentContentsByIDs(ids []int64) ([]*ms.CommentContent, error) { commentContent := &dbr.CommentContent{} return commentContent.List(s.db, &dbr.ConditionsT{ "comment_id IN ?": ids, }, 0, 0) } -func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*core.CommentReplyFormated, error) { +func (s *commentSrv) GetCommentRepliesByID(ids []int64) ([]*ms.CommentReplyFormated, error) { CommentReply := &dbr.CommentReply{} replies, err := CommentReply.List(s.db, &dbr.ConditionsT{ "comment_id IN ?": ids, @@ -112,7 +113,7 @@ func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*core.CommentRepl if err != nil { return nil, err } - repliesFormated := []*core.CommentReplyFormated{} + repliesFormated := []*ms.CommentReplyFormated{} for _, reply := range replies { replyFormated := reply.Format() for _, user := range users { @@ -130,7 +131,7 @@ func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*core.CommentRepl return repliesFormated, nil } -func (s *commentManageServant) DeleteComment(comment *core.Comment) error { +func (s *commentManageSrv) DeleteComment(comment *ms.Comment) error { db := s.db.Begin() defer db.Rollback() @@ -149,15 +150,15 @@ func (s *commentManageServant) DeleteComment(comment *core.Comment) error { return nil } -func (s *commentManageServant) CreateComment(comment *core.Comment) (*core.Comment, error) { +func (s *commentManageSrv) CreateComment(comment *ms.Comment) (*ms.Comment, error) { return comment.Create(s.db) } -func (s *commentManageServant) CreateCommentReply(reply *core.CommentReply) (*core.CommentReply, error) { +func (s *commentManageSrv) CreateCommentReply(reply *ms.CommentReply) (*ms.CommentReply, error) { return reply.Create(s.db) } -func (s *commentManageServant) DeleteCommentReply(reply *core.CommentReply) (err error) { +func (s *commentManageSrv) DeleteCommentReply(reply *ms.CommentReply) (err error) { db := s.db.Begin() defer db.Rollback() @@ -177,11 +178,11 @@ func (s *commentManageServant) DeleteCommentReply(reply *core.CommentReply) (err return } -func (s *commentManageServant) CreateCommentContent(content *core.CommentContent) (*core.CommentContent, error) { +func (s *commentManageSrv) CreateCommentContent(content *ms.CommentContent) (*ms.CommentContent, error) { return content.Create(s.db) } -func (s *commentManageServant) ThumbsUpComment(userId int64, tweetId, commentId int64) error { +func (s *commentManageSrv) ThumbsUpComment(userId int64, tweetId, commentId int64) error { db := s.db.Begin() defer db.Rollback() @@ -230,7 +231,7 @@ func (s *commentManageServant) ThumbsUpComment(userId int64, tweetId, commentId return nil } -func (s *commentManageServant) ThumbsDownComment(userId int64, tweetId, commentId int64) error { +func (s *commentManageSrv) ThumbsDownComment(userId int64, tweetId, commentId int64) error { db := s.db.Begin() defer db.Rollback() @@ -280,7 +281,7 @@ func (s *commentManageServant) ThumbsDownComment(userId int64, tweetId, commentI return nil } -func (s *commentManageServant) ThumbsUpReply(userId int64, tweetId, commentId, replyId int64) error { +func (s *commentManageSrv) ThumbsUpReply(userId int64, tweetId, commentId, replyId int64) error { db := s.db.Begin() defer db.Rollback() @@ -330,7 +331,7 @@ func (s *commentManageServant) ThumbsUpReply(userId int64, tweetId, commentId, r return nil } -func (s *commentManageServant) ThumbsDownReply(userId int64, tweetId, commentId, replyId int64) error { +func (s *commentManageSrv) ThumbsDownReply(userId int64, tweetId, commentId, replyId int64) error { db := s.db.Begin() defer db.Rollback() @@ -380,7 +381,7 @@ func (s *commentManageServant) ThumbsDownReply(userId int64, tweetId, commentId, return nil } -func (s *commentManageServant) updateCommentThumbsUpCount(obj any, id int64, thumbsUpCount, thumbsDownCount int32) error { +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") diff --git a/internal/dao/jinzhu/contacts.go b/internal/dao/jinzhu/contacts.go index c26ae4de..b44307fe 100644 --- a/internal/dao/jinzhu/contacts.go +++ b/internal/dao/jinzhu/contacts.go @@ -8,26 +8,27 @@ import ( "time" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/sirupsen/logrus" "gorm.io/gorm" ) var ( - _ core.ContactManageService = (*contactManageServant)(nil) + _ core.ContactManageService = (*contactManageSrv)(nil) ) -type contactManageServant struct { +type contactManageSrv struct { db *gorm.DB } func newContactManageService(db *gorm.DB) core.ContactManageService { - return &contactManageServant{ + return &contactManageSrv{ db: db, } } -func (s *contactManageServant) fetchOrNewContact(db *gorm.DB, userId int64, friendId int64, status int8) (*dbr.Contact, error) { +func (s *contactManageSrv) fetchOrNewContact(db *gorm.DB, userId int64, friendId int64, status int8) (*dbr.Contact, error) { contact := &dbr.Contact{ UserId: userId, FriendId: friendId, @@ -40,14 +41,14 @@ func (s *contactManageServant) fetchOrNewContact(db *gorm.DB, userId int64, frie Status: status, } if contact, err = contact.Create(db); err != nil { - logrus.Errorf("contactManageServant.fetchOrNewContact create new contact err:%s", err) + logrus.Errorf("contactManageSrv.fetchOrNewContact create new contact err:%s", err) return nil, err } } return contact, nil } -func (s *contactManageServant) RequestingFriend(userId int64, friendId int64, greetings string) (err error) { +func (s *contactManageSrv) RequestingFriend(userId int64, friendId int64, greetings string) (err error) { db := s.db.Begin() defer func() { if err == nil { @@ -70,7 +71,7 @@ func (s *contactManageServant) RequestingFriend(userId int64, friendId int64, gr contact.Status = dbr.ContactStatusRequesting contact.IsDel = 0 // remove deleted flag if needed if err = contact.UpdateInUnscoped(db); err != nil { - logrus.Errorf("contactManageServant.RequestingFriend update exsit contact err:%s", err) + logrus.Errorf("contactManageSrv.RequestingFriend update exsit contact err:%s", err) return } } @@ -84,13 +85,13 @@ func (s *contactManageServant) RequestingFriend(userId int64, friendId int64, gr ReplyID: int64(dbr.ContactStatusRequesting), } if _, err = msg.Create(db); err != nil { - logrus.Errorf("contactManageServant.RequestingFriend create message err:%s", err) + logrus.Errorf("contactManageSrv.RequestingFriend create message err:%s", err) return } return nil } -func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err error) { +func (s *contactManageSrv) AddFriend(userId int64, friendId int64) (err error) { db := s.db.Begin() defer func() { if err == nil { @@ -109,7 +110,7 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro } // 如果还不是请求好友,啥也不干 if contact.Status != dbr.ContactStatusRequesting { - logrus.Debugf("contactManageServant.AddFriend not reuesting status now so skip") + logrus.Debugf("contactManageSrv.AddFriend not reuesting status now so skip") return nil } contact.Status = dbr.ContactStatusAgree @@ -127,7 +128,7 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro contact.Status = dbr.ContactStatusAgree contact.IsDel = 0 // remove deleted flag if err = contact.UpdateInUnscoped(db); err != nil { - logrus.Errorf("contactManageServant.AddFriend update contact err:%s", err) + logrus.Errorf("contactManageSrv.AddFriend update contact err:%s", err) return } } @@ -149,7 +150,7 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro return nil } -func (s *contactManageServant) RejectFriend(userId int64, friendId int64) (err error) { +func (s *contactManageSrv) RejectFriend(userId int64, friendId int64) (err error) { db := s.db.Begin() defer func() { if err == nil { @@ -192,7 +193,7 @@ func (s *contactManageServant) RejectFriend(userId int64, friendId int64) (err e return nil } -func (s *contactManageServant) DeleteFriend(userId int64, friendId int64) (err error) { +func (s *contactManageSrv) DeleteFriend(userId int64, friendId int64) (err error) { db := s.db.Begin() defer func() { if err == nil { @@ -226,7 +227,7 @@ func (s *contactManageServant) DeleteFriend(userId int64, friendId int64) (err e return nil } -func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) (*core.ContactList, error) { +func (s *contactManageSrv) GetContacts(userId int64, offset int, limit int) (*ms.ContactList, error) { contact := &dbr.Contact{} condition := dbr.ConditionsT{ "user_id": userId, @@ -240,13 +241,13 @@ func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) if err != nil { return nil, err } - resp := &core.ContactList{ - Contacts: make([]core.ContactItem, 0, len(contacts)), + resp := &ms.ContactList{ + Contacts: make([]ms.ContactItem, 0, len(contacts)), Total: total, } for _, c := range contacts { if c.User != nil { - resp.Contacts = append(resp.Contacts, core.ContactItem{ + resp.Contacts = append(resp.Contacts, ms.ContactItem{ UserId: c.FriendId, UserName: c.User.Username, Nickname: c.User.Nickname, @@ -258,7 +259,7 @@ func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) return resp, nil } -func (s *contactManageServant) IsFriend(userId int64, friendId int64) bool { +func (s *contactManageSrv) IsFriend(userId int64, friendId int64) bool { contact := &dbr.Contact{ UserId: friendId, FriendId: userId, diff --git a/internal/dao/jinzhu/dbr/comment.go b/internal/dao/jinzhu/dbr/comment.go index 6f2f33c3..4f673336 100644 --- a/internal/dao/jinzhu/dbr/comment.go +++ b/internal/dao/jinzhu/dbr/comment.go @@ -79,7 +79,7 @@ func (c *Comment) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) db = db.Offset(offset).Limit(limit) } if c.PostID > 0 { - db = db.Where("id = ?", c.PostID) + db = db.Where("post_id = ?", c.PostID) } for k, v := range *conditions { diff --git a/internal/dao/jinzhu/dbr/comment_reply.go b/internal/dao/jinzhu/dbr/comment_reply.go index a1c562f6..dcdfde21 100644 --- a/internal/dao/jinzhu/dbr/comment_reply.go +++ b/internal/dao/jinzhu/dbr/comment_reply.go @@ -13,9 +13,9 @@ import ( type CommentReply struct { *Model - CommentID int64 `json:"comment_id"` - UserID int64 `json:"user_id"` - AtUserID int64 `json:"at_user_id"` + CommentID int64 `db:"comment_id" json:"comment_id"` + UserID int64 `db:"user_id" json:"user_id"` + AtUserID int64 `db:"at_user_id" json:"at_user_id"` Content string `json:"content"` IP string `json:"ip"` IPLoc string `json:"ip_loc"` @@ -25,10 +25,10 @@ type CommentReply struct { type CommentReplyFormated struct { ID int64 `json:"id"` - CommentID int64 `json:"comment_id"` - UserID int64 `json:"user_id"` + CommentID int64 `db:"comment_id" json:"comment_id"` + UserID int64 `db:"user_id" json:"user_id"` User *UserFormated `json:"user"` - AtUserID int64 `json:"at_user_id"` + AtUserID int64 `db:"at_user_id" json:"at_user_id"` AtUser *UserFormated `json:"at_user"` Content string `json:"content"` IPLoc string `json:"ip_loc"` diff --git a/internal/dao/jinzhu/dbr/post.go b/internal/dao/jinzhu/dbr/post.go index e206872b..be4582c6 100644 --- a/internal/dao/jinzhu/dbr/post.go +++ b/internal/dao/jinzhu/dbr/post.go @@ -120,7 +120,7 @@ func (p *Post) Get(db *gorm.DB) (*Post, error) { return &post, nil } -func (p *Post) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*Post, error) { +func (p *Post) List(db *gorm.DB, conditions ConditionsT, offset, limit int) ([]*Post, error) { var posts []*Post var err error if offset >= 0 && limit > 0 { @@ -129,7 +129,7 @@ func (p *Post) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([] if p.UserID > 0 { db = db.Where("user_id = ?", p.UserID) } - for k, v := range *conditions { + for k, v := range conditions { if k == "ORDER" { db = db.Order(v) } else { @@ -178,12 +178,12 @@ func (p *Post) CountBy(db *gorm.DB, predicates Predicates) (count int64, err err return } -func (p *Post) Count(db *gorm.DB, conditions *ConditionsT) (int64, error) { +func (p *Post) Count(db *gorm.DB, conditions ConditionsT) (int64, error) { var count int64 if p.UserID > 0 { db = db.Where("user_id = ?", p.UserID) } - for k, v := range *conditions { + for k, v := range conditions { if k != "ORDER" { db = db.Where(k, v) } diff --git a/internal/dao/jinzhu/dbr/post_collection.go b/internal/dao/jinzhu/dbr/post_collection.go index 8ac6c113..23604ff1 100644 --- a/internal/dao/jinzhu/dbr/post_collection.go +++ b/internal/dao/jinzhu/dbr/post_collection.go @@ -14,8 +14,8 @@ import ( type PostCollection struct { *Model Post *Post `json:"-"` - PostID int64 `json:"post_id"` - UserID int64 `json:"user_id"` + PostID int64 `db:"post_id" json:"post_id"` + UserID int64 `db:"user_id" json:"user_id"` } func (p *PostCollection) Get(db *gorm.DB) (*PostCollection, error) { diff --git a/internal/dao/jinzhu/dbr/post_content.go b/internal/dao/jinzhu/dbr/post_content.go index 672cc57e..5f257630 100644 --- a/internal/dao/jinzhu/dbr/post_content.go +++ b/internal/dao/jinzhu/dbr/post_content.go @@ -44,7 +44,7 @@ type PostContent struct { } type PostContentFormated struct { - ID int64 `json:"id"` + ID int64 `db:"id" json:"id"` PostID int64 `json:"post_id"` Content string `json:"content"` Type PostContentT `json:"type"` diff --git a/internal/dao/jinzhu/dbr/topic.go b/internal/dao/jinzhu/dbr/topic.go index 9881b1e4..45cabfef 100644 --- a/internal/dao/jinzhu/dbr/topic.go +++ b/internal/dao/jinzhu/dbr/topic.go @@ -88,9 +88,7 @@ func (t *Tag) Delete(db *gorm.DB) error { }).Error } -func (t *Tag) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*Tag, error) { - var tags []*Tag - var err error +func (t *Tag) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) (tags []*Tag, err error) { if offset >= 0 && limit > 0 { db = db.Offset(offset).Limit(limit) } @@ -104,12 +102,8 @@ func (t *Tag) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]* db = db.Where(k, v) } } - - if err = db.Where("is_del = 0 and quote_num > 0").Find(&tags).Error; err != nil { - return nil, err - } - - return tags, nil + err = db.Where("is_del = 0 and quote_num > 0").Find(&tags).Error + return } func (t *Tag) TagsFrom(db *gorm.DB, tags []string) (res []*Tag, err error) { diff --git a/internal/dao/jinzhu/dbr/user.go b/internal/dao/jinzhu/dbr/user.go index a10d5432..7297e39f 100644 --- a/internal/dao/jinzhu/dbr/user.go +++ b/internal/dao/jinzhu/dbr/user.go @@ -4,7 +4,10 @@ package dbr -import "gorm.io/gorm" +import ( + "github.com/rocboss/paopao-ce/internal/core/cs" + "gorm.io/gorm" +) const ( UserStatusNormal int = iota + 1 @@ -25,7 +28,7 @@ type User struct { } type UserFormated struct { - ID int64 `json:"id"` + ID int64 `db:"id" json:"id"` Nickname string `json:"nickname"` Username string `json:"username"` Status int `json:"status"` @@ -87,6 +90,11 @@ func (u *User) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([] return users, nil } +func (u *User) ListUserInfoById(db *gorm.DB, ids []int64) (res cs.UserInfoList, err error) { + err = db.Model(u).Where("id IN ?", ids).Find(&res).Error + return +} + func (u *User) Create(db *gorm.DB) (*User, error) { err := db.Create(&u).Error diff --git a/internal/dao/jinzhu/gorm.go b/internal/dao/jinzhu/gorm.go new file mode 100644 index 00000000..8cd44639 --- /dev/null +++ b/internal/dao/jinzhu/gorm.go @@ -0,0 +1,55 @@ +// 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 jinzhu + +import ( + "github.com/rocboss/paopao-ce/internal/conf" +) + +// 数据库表名,统一使用 __ 的形式命名, 比如tag表 => _tag_ +var ( + _anouncement_ string + _anouncementContent_ string + _attachment_ string + _captcha_ string + _comment_ string + _commentContent_ string + _commentReply_ string + _contact_ string + _contactGroup_ string + _message_ string + _post_ string + _postAttachmentBill_ string + _postCollection_ string + _postContent_ string + _postStar_ string + _tag_ string + _user_ string + _walletRecharge_ string + _walletStatement_ string +) + +func initTableName() { + m := conf.DatabaseSetting.TableNames() + _anouncement_ = m[conf.TableAnouncement] + _anouncementContent_ = m[conf.TableAnouncementContent] + _attachment_ = m[conf.TableAttachment] + _captcha_ = m[conf.TableCaptcha] + _comment_ = m[conf.TableComment] + _commentContent_ = m[conf.TableCommentContent] + _commentReply_ = m[conf.TableCommentReply] + _contact_ = m[conf.TableContact] + _contactGroup_ = m[conf.TableContactGroup] + _message_ = m[conf.TableMessage] + _post_ = m[conf.TablePost] + _postAttachmentBill_ = m[conf.TablePostAttachmentBill] + _postCollection_ = m[conf.TablePostCollection] + _postContent_ = m[conf.TablePostContent] + _postStar_ = m[conf.TablePostStar] + _tag_ = m[conf.TableTag] + _user_ = m[conf.TableUser] + _walletRecharge_ = m[conf.TableWalletRecharge] + _walletStatement_ = m[conf.TableWalletStatement] +} diff --git a/internal/dao/jinzhu/jinzhu.go b/internal/dao/jinzhu/jinzhu.go index 11415d90..55055f63 100644 --- a/internal/dao/jinzhu/jinzhu.go +++ b/internal/dao/jinzhu/jinzhu.go @@ -9,6 +9,8 @@ package jinzhu import ( + "sync" + "github.com/Masterminds/semver/v3" "github.com/alimy/cfg" "github.com/rocboss/paopao-ce/internal/conf" @@ -19,11 +21,16 @@ import ( ) var ( - _ core.DataService = (*dataServant)(nil) - _ core.VersionInfo = (*dataServant)(nil) + _ core.DataService = (*dataSrv)(nil) + _ core.VersionInfo = (*dataSrv)(nil) + + _ core.WebDataServantA = (*webDataSrvA)(nil) + _ core.VersionInfo = (*webDataSrvA)(nil) + + _onceInitial sync.Once ) -type dataServant struct { +type dataSrv struct { core.IndexPostsService core.WalletService core.MessageService @@ -40,7 +47,16 @@ type dataServant struct { core.ShareKeyService } +type webDataSrvA struct { + core.TopicServantA + core.TweetServantA + core.TweetManageServantA + core.TweetHelpServantA +} + func NewDataService() (core.DataService, core.VersionInfo) { + lazyInitial() + var ( v core.VersionInfo cis core.CacheIndexService @@ -50,7 +66,6 @@ func NewDataService() (core.DataService, core.VersionInfo) { pvs := security.NewPhoneVerifyService() ams := NewAuthorizationManageService() ths := newTweetHelpService(db) - ums := newUserManageService(db) // initialize core.IndexPostsService if cfg.If("Friendship") { @@ -84,11 +99,11 @@ func NewDataService() (core.DataService, core.VersionInfo) { }) logrus.Infof("use %s as cache index service by version: %s", v.Name(), v.Version()) - ds := &dataServant{ + ds := &dataSrv{ IndexPostsService: cis, WalletService: newWalletService(db), MessageService: newMessageService(db), - TopicService: newTopicService(db, ums), + TopicService: newTopicService(db), TweetService: newTweetService(db), TweetManageService: newTweetManageService(db, cis), TweetHelpService: newTweetHelpService(db), @@ -103,14 +118,41 @@ func NewDataService() (core.DataService, core.VersionInfo) { return ds, ds } +func NewWebDataServantA() (core.WebDataServantA, core.VersionInfo) { + lazyInitial() + db := conf.MustGormDB() + ds := &webDataSrvA{ + TopicServantA: newTopicServantA(db), + TweetServantA: newTweetServantA(db), + TweetManageServantA: newTweetManageServantA(db), + TweetHelpServantA: newTweetHelpServantA(db), + } + return ds, ds +} + func NewAuthorizationManageService() core.AuthorizationManageService { return newAuthorizationManageService(conf.MustGormDB()) } -func (s *dataServant) Name() string { +func (s *dataSrv) Name() string { return "Gorm" } -func (s *dataServant) Version() *semver.Version { +func (s *dataSrv) Version() *semver.Version { return semver.MustParse("v0.2.0") } + +func (s *webDataSrvA) Name() string { + return "Gorm" +} + +func (s *webDataSrvA) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +// lazyInitial do some package lazy initialize for performance +func lazyInitial() { + _onceInitial.Do(func() { + initTableName() + }) +} diff --git a/internal/dao/jinzhu/messages.go b/internal/dao/jinzhu/messages.go index 32edaac2..00df949f 100644 --- a/internal/dao/jinzhu/messages.go +++ b/internal/dao/jinzhu/messages.go @@ -6,50 +6,51 @@ package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) var ( - _ core.MessageService = (*messageServant)(nil) + _ core.MessageService = (*messageSrv)(nil) ) -type messageServant struct { +type messageSrv struct { db *gorm.DB } func newMessageService(db *gorm.DB) core.MessageService { - return &messageServant{ + return &messageSrv{ db: db, } } -func (d *messageServant) CreateMessage(msg *core.Message) (*core.Message, error) { - return msg.Create(d.db) +func (s *messageSrv) CreateMessage(msg *ms.Message) (*ms.Message, error) { + return msg.Create(s.db) } -func (d *messageServant) GetUnreadCount(userID int64) (int64, error) { - return (&dbr.Message{}).Count(d.db, &dbr.ConditionsT{ +func (s *messageSrv) GetUnreadCount(userID int64) (int64, error) { + return (&dbr.Message{}).Count(s.db, &dbr.ConditionsT{ "receiver_user_id": userID, "is_read": dbr.MsgStatusUnread, }) } -func (d *messageServant) GetMessageByID(id int64) (*core.Message, error) { +func (s *messageSrv) GetMessageByID(id int64) (*ms.Message, error) { return (&dbr.Message{ Model: &dbr.Model{ ID: id, }, - }).Get(d.db) + }).Get(s.db) } -func (d *messageServant) ReadMessage(message *core.Message) error { +func (s *messageSrv) ReadMessage(message *ms.Message) error { message.IsRead = 1 - return message.Update(d.db) + return message.Update(s.db) } -func (d *messageServant) GetMessages(conditions *core.ConditionsT, offset, limit int) ([]*core.MessageFormated, error) { - messages, err := (&dbr.Message{}).List(d.db, conditions, offset, limit) +func (s *messageSrv) GetMessages(conditions *ms.ConditionsT, offset, limit int) ([]*ms.MessageFormated, error) { + messages, err := (&dbr.Message{}).List(s.db, conditions, offset, limit) if err != nil { return nil, err } @@ -63,6 +64,6 @@ func (d *messageServant) GetMessages(conditions *core.ConditionsT, offset, limit return mfs, nil } -func (d *messageServant) GetMessageCount(conditions *core.ConditionsT) (int64, error) { - return (&dbr.Message{}).Count(d.db, conditions) +func (s *messageSrv) GetMessageCount(conditions *ms.ConditionsT) (int64, error) { + return (&dbr.Message{}).Count(s.db, conditions) } diff --git a/internal/dao/jinzhu/security.go b/internal/dao/jinzhu/security.go index 69fc57d4..18a8ccae 100644 --- a/internal/dao/jinzhu/security.go +++ b/internal/dao/jinzhu/security.go @@ -10,46 +10,48 @@ import ( "time" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) var ( - _ core.SecurityService = (*securityServant)(nil) + _ core.SecurityService = (*securitySrv)(nil) ) -type securityServant struct { +type securitySrv struct { db *gorm.DB + rand *rand.Rand phoneVerify core.PhoneVerifyService } func newSecurityService(db *gorm.DB, phoneVerify core.PhoneVerifyService) core.SecurityService { - return &securityServant{ + return &securitySrv{ db: db, + rand: rand.New(rand.NewSource(time.Now().UnixNano())), phoneVerify: phoneVerify, } } // GetLatestPhoneCaptcha 获取最新短信验证码 -func (s *securityServant) GetLatestPhoneCaptcha(phone string) (*core.Captcha, error) { +func (s *securitySrv) GetLatestPhoneCaptcha(phone string) (*ms.Captcha, error) { return (&dbr.Captcha{ Phone: phone, }).Get(s.db) } // UsePhoneCaptcha 更新短信验证码 -func (s *securityServant) UsePhoneCaptcha(captcha *core.Captcha) error { +func (s *securitySrv) UsePhoneCaptcha(captcha *ms.Captcha) error { captcha.UseTimes++ return captcha.Update(s.db) } // SendPhoneCaptcha 发送短信验证码 -func (s *securityServant) SendPhoneCaptcha(phone string) error { +func (s *securitySrv) SendPhoneCaptcha(phone string) error { expire := time.Duration(5) // 发送验证码 - rand.Seed(time.Now().UnixNano()) - captcha := strconv.Itoa(rand.Intn(900000) + 100000) + captcha := strconv.Itoa(s.rand.Intn(900000) + 100000) if err := s.phoneVerify.SendPhoneCaptcha(phone, captcha, expire); err != nil { return err } diff --git a/internal/dao/jinzhu/index.go b/internal/dao/jinzhu/timeline.go similarity index 65% rename from internal/dao/jinzhu/index.go rename to internal/dao/jinzhu/timeline.go index fc7e2007..f81e3619 100644 --- a/internal/dao/jinzhu/index.go +++ b/internal/dao/jinzhu/timeline.go @@ -6,6 +6,8 @@ package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/rocboss/paopao-ce/pkg/debug" "github.com/sirupsen/logrus" @@ -13,35 +15,35 @@ import ( ) var ( - _ core.IndexPostsService = (*friendIndexServant)(nil) - _ core.IndexPostsService = (*followIndexServant)(nil) - _ core.IndexPostsService = (*lightIndexServant)(nil) - _ core.IndexPostsService = (*simpleIndexPostsServant)(nil) + _ core.IndexPostsService = (*friendIndexSrv)(nil) + _ core.IndexPostsService = (*followIndexSrv)(nil) + _ core.IndexPostsService = (*lightIndexSrv)(nil) + _ core.IndexPostsService = (*simpleIndexPostsSrv)(nil) ) -type friendIndexServant struct { +type friendIndexSrv struct { ams core.AuthorizationManageService ths core.TweetHelpService db *gorm.DB } -type followIndexServant struct { +type followIndexSrv struct { ths core.TweetHelpService db *gorm.DB } -type lightIndexServant struct { +type lightIndexSrv struct { ths core.TweetHelpService db *gorm.DB } -type simpleIndexPostsServant struct { +type simpleIndexPostsSrv struct { ths core.TweetHelpService db *gorm.DB } // IndexPosts 根据userId查询广场推文列表,简单做到不同用户的主页都是不同的; -func (s *friendIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { +func (s *friendIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { predicates := dbr.Predicates{ "ORDER": []any{"is_top DESC, latest_replied_on DESC"}, } @@ -56,7 +58,7 @@ func (s *friendIndexServant) IndexPosts(user *core.User, offset int, limit int) posts, err := (&dbr.Post{}).Fetch(s.db, predicates, offset, limit) if err != nil { - logrus.Debugf("gormIndexPostsServant.IndexPosts err: %v", err) + logrus.Debugf("gormIndexPostsSrv.IndexPosts err: %v", err) return nil, err } formatPosts, err := s.ths.MergePosts(posts) @@ -69,20 +71,30 @@ func (s *friendIndexServant) IndexPosts(user *core.User, offset int, limit int) return nil, err } - return &core.IndexTweetList{ + return &ms.IndexTweetList{ Tweets: formatPosts, Total: total, }, nil } +func (s *friendIndexSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) { + // TODO + return nil, debug.ErrNotImplemented +} + // IndexPosts 根据userId查询广场推文列表 -func (s *followIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { +func (s *followIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *followIndexSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) { // TODO return nil, debug.ErrNotImplemented } // IndexPosts 根据userId查询广场推文列表,获取公开可见Tweet或者所属用户的私有Tweet -func (s *lightIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { +func (s *lightIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { predicates := dbr.Predicates{ "ORDER": []any{"is_top DESC, latest_replied_on DESC"}, } @@ -95,7 +107,7 @@ func (s *lightIndexServant) IndexPosts(user *core.User, offset int, limit int) ( posts, err := (&dbr.Post{}).Fetch(s.db, predicates, offset, limit) if err != nil { - logrus.Debugf("gormIndexPostsServant.IndexPosts err: %v", err) + logrus.Debugf("gormIndexPostsSrv.IndexPosts err: %v", err) return nil, err } formatPosts, err := s.ths.MergePosts(posts) @@ -108,14 +120,19 @@ func (s *lightIndexServant) IndexPosts(user *core.User, offset int, limit int) ( return nil, err } - return &core.IndexTweetList{ + return &ms.IndexTweetList{ Tweets: formatPosts, Total: total, }, nil } +func (s *lightIndexSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) { + // TODO + return nil, debug.ErrNotImplemented +} + // simpleCacheIndexGetPosts simpleCacheIndex 专属获取广场推文列表函数 -func (s *simpleIndexPostsServant) IndexPosts(_user *core.User, offset int, limit int) (*core.IndexTweetList, error) { +func (s *simpleIndexPostsSrv) IndexPosts(_user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) { predicates := dbr.Predicates{ "visibility = ?": []any{dbr.PostVisitPublic}, "ORDER": []any{"is_top DESC, latest_replied_on DESC"}, @@ -123,7 +140,7 @@ func (s *simpleIndexPostsServant) IndexPosts(_user *core.User, offset int, limit posts, err := (&dbr.Post{}).Fetch(s.db, predicates, offset, limit) if err != nil { - logrus.Debugf("gormSimpleIndexPostsServant.IndexPosts err: %v", err) + logrus.Debugf("gormSimpleIndexPostsSrv.IndexPosts err: %v", err) return nil, err } @@ -137,14 +154,19 @@ func (s *simpleIndexPostsServant) IndexPosts(_user *core.User, offset int, limit return nil, err } - return &core.IndexTweetList{ + return &ms.IndexTweetList{ Tweets: formatPosts, Total: total, }, nil } +func (s *simpleIndexPostsSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) { + // TODO + return nil, debug.ErrNotImplemented +} + func newFriendIndexService(db *gorm.DB, ams core.AuthorizationManageService, ths core.TweetHelpService) core.IndexPostsService { - return &friendIndexServant{ + return &friendIndexSrv{ ams: ams, ths: ths, db: db, @@ -152,21 +174,21 @@ func newFriendIndexService(db *gorm.DB, ams core.AuthorizationManageService, ths } func newFollowIndexService(db *gorm.DB, ths core.TweetHelpService) core.IndexPostsService { - return &followIndexServant{ + return &followIndexSrv{ ths: ths, db: db, } } func newLightIndexService(db *gorm.DB, ths core.TweetHelpService) core.IndexPostsService { - return &lightIndexServant{ + return &lightIndexSrv{ ths: ths, db: db, } } func newSimpleIndexPostsService(db *gorm.DB, ths core.TweetHelpService) core.IndexPostsService { - return &simpleIndexPostsServant{ + return &simpleIndexPostsSrv{ ths: ths, db: db, } diff --git a/internal/dao/jinzhu/topics.go b/internal/dao/jinzhu/topics.go index 314e5627..de317164 100644 --- a/internal/dao/jinzhu/topics.go +++ b/internal/dao/jinzhu/topics.go @@ -9,68 +9,108 @@ import ( "strings" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) var ( - _ core.TopicService = (*topicServant)(nil) + _ core.TopicService = (*topicSrv)(nil) + _ core.TopicServantA = (*topicSrvA)(nil) ) -type topicServant struct { +type topicSrv struct { db *gorm.DB - ums core.UserManageService tnTopicUser string tnDotTopicUser string } +type topicSrvA struct { + db *gorm.DB +} + type topicInfo struct { TopicId int64 IsTop int8 } -func newTopicService(db *gorm.DB, ums core.UserManageService) core.TopicService { - return &topicServant{ +func newTopicService(db *gorm.DB) core.TopicService { + return &topicSrv{ db: db, - ums: ums, tnTopicUser: db.NamingStrategy.TableName("TopicUser"), tnDotTopicUser: db.NamingStrategy.TableName("TopicUser") + ".", } } -func (s *topicServant) CreateTag(tag *core.Tag) (*core.Tag, error) { - return createTag(s.db, tag) +func newTopicServantA(db *gorm.DB) core.TopicServantA { + return &topicSrvA{ + db: db, + } +} + +func (s *topicSrv) UpsertTags(userId int64, tags []string) (_ cs.TagInfoList, err error) { + db := s.db.Begin() + defer func() { + if err == nil { + db.Commit() + } else { + db.Rollback() + } + }() + return createTags(db, userId, tags) } -func (s *topicServant) DeleteTag(tag *core.Tag) error { - return deleteTag(s.db, tag) +func (s *topicSrv) DecrTagsById(ids []int64) (err error) { + db := s.db.Begin() + defer func() { + if err == nil { + db.Commit() + } else { + db.Rollback() + } + }() + return decrTagsByIds(db, ids) } -func (s *topicServant) GetTags(conditions *core.ConditionsT, offset, limit int) ([]*core.Tag, error) { - return (&dbr.Tag{}).List(s.db, conditions, offset, limit) +func (s *topicSrv) ListTags(typ cs.TagType, offset, limit int) (res cs.TagList, err error) { + conditions := &ms.ConditionsT{} + switch typ { + case cs.TagTypeHot: + // 热门标签 + conditions = &ms.ConditionsT{ + "ORDER": "quote_num DESC", + } + case cs.TagTypeNew: + // 最新标签 + conditions = &ms.ConditionsT{ + "ORDER": "id DESC", + } + } + return s.listTags(conditions, limit, offset) } -func (s *topicServant) GetHotTags(userId int64, limit int, offset int) ([]*core.TagFormated, error) { - tags, err := (&dbr.Tag{}).List(s.db, &core.ConditionsT{ +func (s *topicSrv) GetHotTags(userId int64, limit int, offset int) (cs.TagList, error) { + tags, err := s.listTags(&ms.ConditionsT{ "ORDER": "quote_num DESC", - }, offset, limit) + }, limit, offset) if err != nil { return nil, err } - return s.tagsFormat(userId, nil, tags) + return s.tagsFormatA(userId, tags) } -func (s *topicServant) GetNewestTags(userId int64, limit int, offset int) ([]*core.TagFormated, error) { - tags, err := (&dbr.Tag{}).List(s.db, &core.ConditionsT{ +func (s *topicSrv) GetNewestTags(userId int64, limit int, offset int) (cs.TagList, error) { + tags, err := s.listTags(&ms.ConditionsT{ "ORDER": "id DESC", - }, offset, limit) + }, limit, offset) if err != nil { return nil, err } - return s.tagsFormat(userId, nil, tags) + return s.tagsFormatA(userId, tags) } -func (s *topicServant) GetFollowTags(userId int64, limit int, offset int) ([]*core.TagFormated, error) { +func (s *topicSrv) GetFollowTags(userId int64, limit int, offset int) (cs.TagList, error) { if userId < 0 { return nil, nil } @@ -92,25 +132,89 @@ func (s *topicServant) GetFollowTags(userId int64, limit int, offset int) ([]*co topicIds = append(topicIds, info.TopicId) topicIdsMap[info.TopicId] = idx } - var tags []*core.Tag + var tags cs.TagInfoList err = s.db.Model(&dbr.Tag{}).Where("quote_num > 0 and id in ?", topicIds).Order("quote_num DESC").Find(&tags).Error if err != nil { return nil, err } - formtedTags, err := s.tagsFormat(-1, userTopicsMap, tags) + formtedTags, err := s.tagsFormatB(userTopicsMap, tags) if err != nil { return nil, err } // 置顶排序后处理 // TODO: 垃圾办法,最好是topic_user join tag 一次查询,但是gorm的join真他喵的别扭,F*K - res := make([]*core.TagFormated, len(topicIds), len(topicIds)) + res := make(cs.TagList, len(topicIds), len(topicIds)) for _, tag := range formtedTags { res[topicIdsMap[tag.ID]] = tag } return res, nil } -func (s *topicServant) tagsFormat(userId int64, userTopicsMap map[int64]*topicInfo, tags []*core.Tag) ([]*core.TagFormated, error) { +func (s *topicSrv) listTags(conditions *ms.ConditionsT, limit int, offset int) (res cs.TagList, err error) { + // TODO: 优化查询方式,直接返回[]*core.Tag, 目前保持先转换一下 + var ( + tags []*dbr.Tag + item *cs.TagItem + ) + if tags, err = (&dbr.Tag{}).List(s.db, conditions, offset, limit); err == nil { + if len(tags) == 0 { + return + } + tagMap := make(map[int64][]*cs.TagItem, len(tags)) + for _, tag := range tags { + item = &cs.TagItem{ + ID: tag.ID, + UserID: tag.UserID, + Tag: tag.Tag, + QuoteNum: tag.QuoteNum, + } + tagMap[item.UserID] = append(tagMap[item.UserID], item) + res = append(res, item) + } + ids := make([]int64, len(tagMap)) + for userId := range tagMap { + ids = append(ids, userId) + } + userInfos, err := (&dbr.User{}).ListUserInfoById(s.db, ids) + if err != nil { + return nil, err + } + for _, userInfo := range userInfos { + for _, item = range tagMap[userInfo.ID] { + item.User = userInfo + } + } + } + return +} + +func (s *topicSrv) tagsFormatA(userId int64, tags cs.TagList) (cs.TagList, error) { + // 获取创建者User IDs + tagIds := []int64{} + for _, tag := range tags { + tagIds = append(tagIds, tag.ID) + } + // 填充话题follow信息 + if userId > -1 { + userTopics := []*topicInfo{} + err := s.db.Model(&dbr.TopicUser{}).Where("is_del=0 and user_id=? and topic_id in ?", userId, tagIds).Find(&userTopics).Error + if err != nil { + return nil, err + } + userTopicsMap := make(map[int64]*topicInfo, len(userTopics)) + for _, info := range userTopics { + userTopicsMap[info.TopicId] = info + } + for _, tag := range tags { + if info, exist := userTopicsMap[tag.ID]; exist { + tag.IsFollowing, tag.IsTop = 1, info.IsTop + } + } + } + return tags, nil +} + +func (s *topicSrv) tagsFormatB(userTopicsMap map[int64]*topicInfo, tags cs.TagInfoList) (cs.TagList, error) { // 获取创建者User IDs userIds := []int64{} tagIds := []int64{} @@ -118,59 +222,161 @@ func (s *topicServant) tagsFormat(userId int64, userTopicsMap map[int64]*topicIn userIds = append(userIds, tag.UserID) tagIds = append(tagIds, tag.ID) } - users, err := s.ums.GetUsersByIDs(userIds) + users, err := (&dbr.User{}).ListUserInfoById(s.db, userIds) if err != nil { return nil, err } - tagsFormated := []*core.TagFormated{} + tagList := cs.TagList{} for _, tag := range tags { tagFormated := tag.Format() for _, user := range users { if user.ID == tagFormated.UserID { - tagFormated.User = user.Format() + tagFormated.User = user } } - tagsFormated = append(tagsFormated, tagFormated) + tagList = append(tagList, tagFormated) } // 填充话题follow信息 - if userId > -1 && len(userTopicsMap) <= 0 { - userTopics := []*topicInfo{} - err = s.db.Model(&dbr.TopicUser{}).Where("is_del=0 and user_id=? and topic_id in ?", userId, tagIds).Find(&userTopics).Error - if err != nil { - return nil, err - } - userTopicsMap = make(map[int64]*topicInfo, len(userTopics)) - for _, info := range userTopics { - userTopicsMap[info.TopicId] = info - } - } if len(userTopicsMap) > 0 { - for _, tag := range tagsFormated { + for _, tag := range tagList { if info, exist := userTopicsMap[tag.ID]; exist { tag.IsFollowing, tag.IsTop = 1, info.IsTop } } } - return tagsFormated, nil + return tagList, nil } -func (s *topicServant) GetTagsByKeyword(keyword string) ([]*core.Tag, error) { +func (s *topicSrv) TagsByKeyword(keyword string) (res cs.TagInfoList, err error) { + keyword = "%" + strings.Trim(keyword, " ") + "%" tag := &dbr.Tag{} + var tags []*dbr.Tag + if keyword == "%%" { + tags, err = tag.List(s.db, &dbr.ConditionsT{ + "ORDER": "quote_num DESC", + }, 0, 6) + } else { + tags, err = tag.List(s.db, &dbr.ConditionsT{ + "tag LIKE ?": keyword, + "ORDER": "quote_num DESC", + }, 0, 6) + } + if err == nil { + for _, tag := range tags { + res = append(res, &cs.TagInfo{ + ID: tag.ID, + UserID: tag.UserID, + Tag: tag.Tag, + QuoteNum: tag.QuoteNum, + }) + } + } + return +} + +func (s *topicSrvA) UpsertTags(userId int64, tags []string) (_ cs.TagInfoList, err error) { + db := s.db.Begin() + defer func() { + if err == nil { + db.Commit() + } else { + db.Rollback() + } + }() + return createTags(db, userId, tags) +} + +func (s *topicSrvA) DecrTagsById(ids []int64) (err error) { + db := s.db.Begin() + defer func() { + if err == nil { + db.Commit() + } else { + db.Rollback() + } + }() + return decrTagsByIds(db, ids) +} + +func (s *topicSrvA) ListTags(typ cs.TagType, offset, limit int) (res cs.TagList, err error) { + conditions := &ms.ConditionsT{} + switch typ { + case cs.TagTypeHot: + // 热门标签 + conditions = &ms.ConditionsT{ + "ORDER": "quote_num DESC", + } + case cs.TagTypeNew: + // 最新标签 + conditions = &ms.ConditionsT{ + "ORDER": "id DESC", + } + } + // TODO: 优化查询方式,直接返回[]*core.Tag, 目前保持先转换一下 + var ( + tags []*dbr.Tag + item *cs.TagItem + ) + if tags, err = (&dbr.Tag{}).List(s.db, conditions, offset, limit); err == nil { + if len(tags) == 0 { + return + } + tagMap := make(map[int64][]*cs.TagItem, len(tags)) + for _, tag := range tags { + item = &cs.TagItem{ + ID: tag.ID, + UserID: tag.UserID, + Tag: tag.Tag, + QuoteNum: tag.QuoteNum, + } + tagMap[item.UserID] = append(tagMap[item.UserID], item) + res = append(res, item) + } + ids := make([]int64, len(tagMap)) + for userId := range tagMap { + ids = append(ids, userId) + } + userInfos, err := (&dbr.User{}).ListUserInfoById(s.db, ids) + if err != nil { + return nil, err + } + for _, userInfo := range userInfos { + for _, item = range tagMap[userInfo.ID] { + item.User = userInfo + } + } + } + return +} +func (s *topicSrvA) TagsByKeyword(keyword string) (res cs.TagInfoList, err error) { keyword = "%" + strings.Trim(keyword, " ") + "%" + tag := &dbr.Tag{} + var tags []*dbr.Tag if keyword == "%%" { - return tag.List(s.db, &dbr.ConditionsT{ + tags, err = tag.List(s.db, &dbr.ConditionsT{ "ORDER": "quote_num DESC", }, 0, 6) } else { - return tag.List(s.db, &dbr.ConditionsT{ + tags, err = tag.List(s.db, &dbr.ConditionsT{ "tag LIKE ?": keyword, "ORDER": "quote_num DESC", }, 0, 6) } + if err == nil { + for _, tag := range tags { + res = append(res, &cs.TagInfo{ + ID: tag.ID, + UserID: tag.UserID, + Tag: tag.Tag, + QuoteNum: tag.QuoteNum, + }) + } + } + return } -func (s *topicServant) FollowTopic(userId int64, topicId int64) (err error) { +func (s *topicSrv) FollowTopic(userId int64, topicId int64) (err error) { return s.db.Create(&dbr.TopicUser{ UserID: userId, TopicID: topicId, @@ -178,11 +384,11 @@ func (s *topicServant) FollowTopic(userId int64, topicId int64) (err error) { }).Error } -func (s *topicServant) UnfollowTopic(userId int64, topicId int64) error { +func (s *topicSrv) UnfollowTopic(userId int64, topicId int64) error { return s.db.Exec("DELETE FROM "+s.tnTopicUser+" WHERE user_id=? AND topic_id=?", userId, topicId).Error } -func (s *topicServant) StickTopic(userId int64, topicId int64) (status int8, err error) { +func (s *topicSrv) StickTopic(userId int64, topicId int64) (status int8, err error) { db := s.db.Begin() defer db.Rollback() diff --git a/internal/dao/jinzhu/tweets.go b/internal/dao/jinzhu/tweets.go index cf7e6b63..d661831d 100644 --- a/internal/dao/jinzhu/tweets.go +++ b/internal/dao/jinzhu/tweets.go @@ -9,50 +9,87 @@ import ( "time" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" + "github.com/rocboss/paopao-ce/pkg/debug" "gorm.io/gorm" ) var ( - _ core.TweetService = (*tweetServant)(nil) - _ core.TweetManageService = (*tweetManageServant)(nil) - _ core.TweetHelpService = (*tweetHelpServant)(nil) + _ core.TweetService = (*tweetSrv)(nil) + _ core.TweetManageService = (*tweetManageSrv)(nil) + _ core.TweetHelpService = (*tweetHelpSrv)(nil) + + _ core.TweetServantA = (*tweetSrvA)(nil) + _ core.TweetManageServantA = (*tweetManageSrvA)(nil) + _ core.TweetHelpServantA = (*tweetHelpSrvA)(nil) ) -type tweetServant struct { +type tweetSrv struct { db *gorm.DB } -type tweetManageServant struct { +type tweetManageSrv struct { cacheIndex core.CacheIndexService db *gorm.DB } -type tweetHelpServant struct { +type tweetHelpSrv struct { + db *gorm.DB +} + +type tweetSrvA struct { + db *gorm.DB +} + +type tweetManageSrvA struct { + db *gorm.DB +} + +type tweetHelpSrvA struct { db *gorm.DB } func newTweetService(db *gorm.DB) core.TweetService { - return &tweetServant{ + return &tweetSrv{ db: db, } } func newTweetManageService(db *gorm.DB, cacheIndex core.CacheIndexService) core.TweetManageService { - return &tweetManageServant{ + return &tweetManageSrv{ cacheIndex: cacheIndex, db: db, } } func newTweetHelpService(db *gorm.DB) core.TweetHelpService { - return &tweetHelpServant{ + return &tweetHelpSrv{ + db: db, + } +} + +func newTweetServantA(db *gorm.DB) core.TweetServantA { + return &tweetSrvA{ + db: db, + } +} + +func newTweetManageServantA(db *gorm.DB) core.TweetManageServantA { + return &tweetManageSrvA{ + db: db, + } +} + +func newTweetHelpServantA(db *gorm.DB) core.TweetHelpServantA { + return &tweetHelpSrvA{ db: db, } } // MergePosts post数据整合 -func (s *tweetHelpServant) MergePosts(posts []*core.Post) ([]*core.PostFormated, error) { +func (s *tweetHelpSrv) MergePosts(posts []*ms.Post) ([]*ms.PostFormated, error) { postIds := make([]int64, 0, len(posts)) userIds := make([]int64, 0, len(posts)) for _, post := range posts { @@ -92,7 +129,7 @@ func (s *tweetHelpServant) MergePosts(posts []*core.Post) ([]*core.PostFormated, } // RevampPosts post数据整形修复 -func (s *tweetHelpServant) RevampPosts(posts []*core.PostFormated) ([]*core.PostFormated, error) { +func (s *tweetHelpSrv) RevampPosts(posts []*ms.PostFormated) ([]*ms.PostFormated, error) { postIds := make([]int64, 0, len(posts)) userIds := make([]int64, 0, len(posts)) for _, post := range posts { @@ -128,14 +165,14 @@ func (s *tweetHelpServant) RevampPosts(posts []*core.PostFormated) ([]*core.Post return posts, nil } -func (s *tweetHelpServant) getPostContentsByIDs(ids []int64) ([]*dbr.PostContent, error) { +func (s *tweetHelpSrv) getPostContentsByIDs(ids []int64) ([]*dbr.PostContent, error) { return (&dbr.PostContent{}).List(s.db, &dbr.ConditionsT{ "post_id IN ?": ids, "ORDER": "sort ASC", }, 0, 0) } -func (s *tweetHelpServant) getUsersByIDs(ids []int64) ([]*dbr.User, error) { +func (s *tweetHelpSrv) getUsersByIDs(ids []int64) ([]*dbr.User, error) { user := &dbr.User{} return user.List(s.db, &dbr.ConditionsT{ @@ -143,7 +180,7 @@ func (s *tweetHelpServant) getUsersByIDs(ids []int64) ([]*dbr.User, error) { }, 0, 0) } -func (s *tweetManageServant) CreatePostCollection(postID, userID int64) (*core.PostCollection, error) { +func (s *tweetManageSrv) CreatePostCollection(postID, userID int64) (*ms.PostCollection, error) { collection := &dbr.PostCollection{ PostID: postID, UserID: userID, @@ -152,19 +189,20 @@ func (s *tweetManageServant) CreatePostCollection(postID, userID int64) (*core.P return collection.Create(s.db) } -func (s *tweetManageServant) DeletePostCollection(p *core.PostCollection) error { +func (s *tweetManageSrv) DeletePostCollection(p *ms.PostCollection) error { return p.Delete(s.db) } -func (s *tweetManageServant) CreatePostContent(content *core.PostContent) (*core.PostContent, error) { +func (s *tweetManageSrv) CreatePostContent(content *ms.PostContent) (*ms.PostContent, error) { return content.Create(s.db) } -func (s *tweetManageServant) CreateAttachment(attachment *core.Attachment) (*core.Attachment, error) { - return attachment.Create(s.db) +func (s *tweetManageSrv) CreateAttachment(obj *ms.Attachment) (int64, error) { + attachment, err := obj.Create(s.db) + return attachment.ID, err } -func (s *tweetManageServant) CreatePost(post *core.Post) (*core.Post, error) { +func (s *tweetManageSrv) CreatePost(post *ms.Post) (*ms.Post, error) { post.LatestRepliedOn = time.Now().Unix() p, err := post.Create(s.db) if err != nil { @@ -174,7 +212,7 @@ func (s *tweetManageServant) CreatePost(post *core.Post) (*core.Post, error) { return p, nil } -func (s *tweetManageServant) DeletePost(post *core.Post) ([]string, error) { +func (s *tweetManageSrv) DeletePost(post *ms.Post) ([]string, error) { var mediaContents []string postId := post.ID @@ -221,7 +259,7 @@ func (s *tweetManageServant) DeletePost(post *core.Post) ([]string, error) { return mediaContents, nil } -func (s *tweetManageServant) deleteCommentByPostId(db *gorm.DB, postId int64) ([]string, error) { +func (s *tweetManageSrv) deleteCommentByPostId(db *gorm.DB, postId int64) ([]string, error) { comment := &dbr.Comment{} commentContent := &dbr.CommentContent{} @@ -255,12 +293,12 @@ func (s *tweetManageServant) deleteCommentByPostId(db *gorm.DB, postId int64) ([ return mediaContents, nil } -func (s *tweetManageServant) LockPost(post *core.Post) error { +func (s *tweetManageSrv) LockPost(post *ms.Post) error { post.IsLock = 1 - post.IsLock return post.Update(s.db) } -func (s *tweetManageServant) StickPost(post *core.Post) error { +func (s *tweetManageSrv) StickPost(post *ms.Post) error { post.IsTop = 1 - post.IsTop if err := post.Update(s.db); err != nil { return err @@ -269,7 +307,7 @@ func (s *tweetManageServant) StickPost(post *core.Post) error { return nil } -func (s *tweetManageServant) VisiblePost(post *core.Post, visibility core.PostVisibleT) error { +func (s *tweetManageSrv) VisiblePost(post *ms.Post, visibility core.PostVisibleT) error { oldVisibility := post.Visibility post.Visibility = visibility // TODO: 这个判断是否可以不要呢 @@ -288,29 +326,22 @@ func (s *tweetManageServant) VisiblePost(post *core.Post, visibility core.PostVi db.Rollback() return err } - // tag处理 tags := strings.Split(post.Tags, ",") - for _, t := range tags { - tag := &dbr.Tag{ - UserID: post.UserID, - Tag: t, - } - // TODO: 暂时宽松不处理错误,这里或许可以有优化,后续完善 - if oldVisibility == dbr.PostVisitPrivate { - // 从私密转为非私密才需要重新创建tag - createTag(db, tag) - } else if visibility == dbr.PostVisitPrivate { - // 从非私密转为私密才需要删除tag - deleteTag(db, tag) - } + // TODO: 暂时宽松不处理错误,这里或许可以有优化,后续完善 + if oldVisibility == dbr.PostVisitPrivate { + // 从私密转为非私密才需要重新创建tag + createTags(db, post.UserID, tags) + } else if visibility == dbr.PostVisitPrivate { + // 从非私密转为私密才需要删除tag + deleteTags(db, tags) } db.Commit() s.cacheIndex.SendAction(core.IdxActVisiblePost, post) return nil } -func (s *tweetManageServant) UpdatePost(post *core.Post) error { +func (s *tweetManageSrv) UpdatePost(post *ms.Post) error { if err := post.Update(s.db); err != nil { return err } @@ -318,7 +349,7 @@ func (s *tweetManageServant) UpdatePost(post *core.Post) error { return nil } -func (s *tweetManageServant) CreatePostStar(postID, userID int64) (*core.PostStar, error) { +func (s *tweetManageSrv) CreatePostStar(postID, userID int64) (*ms.PostStar, error) { star := &dbr.PostStar{ PostID: postID, UserID: userID, @@ -326,11 +357,11 @@ func (s *tweetManageServant) CreatePostStar(postID, userID int64) (*core.PostSta return star.Create(s.db) } -func (s *tweetManageServant) DeletePostStar(p *core.PostStar) error { +func (s *tweetManageSrv) DeletePostStar(p *ms.PostStar) error { return p.Delete(s.db) } -func (s *tweetServant) GetPostByID(id int64) (*core.Post, error) { +func (s *tweetSrv) GetPostByID(id int64) (*ms.Post, error) { post := &dbr.Post{ Model: &dbr.Model{ ID: id, @@ -339,15 +370,15 @@ func (s *tweetServant) GetPostByID(id int64) (*core.Post, error) { return post.Get(s.db) } -func (s *tweetServant) GetPosts(conditions *core.ConditionsT, offset, limit int) ([]*core.Post, error) { +func (s *tweetSrv) GetPosts(conditions ms.ConditionsT, offset, limit int) ([]*ms.Post, error) { return (&dbr.Post{}).List(s.db, conditions, offset, limit) } -func (s *tweetServant) GetPostCount(conditions *core.ConditionsT) (int64, error) { +func (s *tweetSrv) GetPostCount(conditions ms.ConditionsT) (int64, error) { return (&dbr.Post{}).Count(s.db, conditions) } -func (s *tweetServant) GetUserPostStar(postID, userID int64) (*core.PostStar, error) { +func (s *tweetSrv) GetUserPostStar(postID, userID int64) (*ms.PostStar, error) { star := &dbr.PostStar{ PostID: postID, UserID: userID, @@ -355,7 +386,7 @@ func (s *tweetServant) GetUserPostStar(postID, userID int64) (*core.PostStar, er return star.Get(s.db) } -func (s *tweetServant) GetUserPostStars(userID int64, offset, limit int) ([]*core.PostStar, error) { +func (s *tweetSrv) GetUserPostStars(userID int64, offset, limit int) ([]*ms.PostStar, error) { star := &dbr.PostStar{ UserID: userID, } @@ -365,14 +396,14 @@ func (s *tweetServant) GetUserPostStars(userID int64, offset, limit int) ([]*cor }, offset, limit) } -func (s *tweetServant) GetUserPostStarCount(userID int64) (int64, error) { +func (s *tweetSrv) GetUserPostStarCount(userID int64) (int64, error) { star := &dbr.PostStar{ UserID: userID, } return star.Count(s.db, &dbr.ConditionsT{}) } -func (s *tweetServant) GetUserPostCollection(postID, userID int64) (*core.PostCollection, error) { +func (s *tweetSrv) GetUserPostCollection(postID, userID int64) (*ms.PostCollection, error) { star := &dbr.PostCollection{ PostID: postID, UserID: userID, @@ -380,7 +411,7 @@ func (s *tweetServant) GetUserPostCollection(postID, userID int64) (*core.PostCo return star.Get(s.db) } -func (s *tweetServant) GetUserPostCollections(userID int64, offset, limit int) ([]*core.PostCollection, error) { +func (s *tweetSrv) GetUserPostCollections(userID int64, offset, limit int) ([]*ms.PostCollection, error) { collection := &dbr.PostCollection{ UserID: userID, } @@ -390,14 +421,14 @@ func (s *tweetServant) GetUserPostCollections(userID int64, offset, limit int) ( }, offset, limit) } -func (s *tweetServant) GetUserPostCollectionCount(userID int64) (int64, error) { +func (s *tweetSrv) GetUserPostCollectionCount(userID int64) (int64, error) { collection := &dbr.PostCollection{ UserID: userID, } return collection.Count(s.db, &dbr.ConditionsT{}) } -func (s *tweetServant) GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, error) { +func (s *tweetSrv) GetUserWalletBills(userID int64, offset, limit int) ([]*ms.WalletStatement, error) { statement := &dbr.WalletStatement{ UserID: userID, } @@ -407,14 +438,14 @@ func (s *tweetServant) GetUserWalletBills(userID int64, offset, limit int) ([]*c }, offset, limit) } -func (s *tweetServant) GetUserWalletBillCount(userID int64) (int64, error) { +func (s *tweetSrv) GetUserWalletBillCount(userID int64) (int64, error) { statement := &dbr.WalletStatement{ UserID: userID, } return statement.Count(s.db, &dbr.ConditionsT{}) } -func (s *tweetServant) GetPostAttatchmentBill(postID, userID int64) (*core.PostAttachmentBill, error) { +func (s *tweetSrv) GetPostAttatchmentBill(postID, userID int64) (*ms.PostAttachmentBill, error) { bill := &dbr.PostAttachmentBill{ PostID: postID, UserID: userID, @@ -423,17 +454,117 @@ func (s *tweetServant) GetPostAttatchmentBill(postID, userID int64) (*core.PostA return bill.Get(s.db) } -func (s *tweetServant) GetPostContentsByIDs(ids []int64) ([]*core.PostContent, error) { +func (s *tweetSrv) GetPostContentsByIDs(ids []int64) ([]*ms.PostContent, error) { return (&dbr.PostContent{}).List(s.db, &dbr.ConditionsT{ "post_id IN ?": ids, "ORDER": "sort ASC", }, 0, 0) } -func (s *tweetServant) GetPostContentByID(id int64) (*core.PostContent, error) { +func (s *tweetSrv) GetPostContentByID(id int64) (*ms.PostContent, error) { return (&dbr.PostContent{ Model: &dbr.Model{ ID: id, }, }).Get(s.db) } + +func (s *tweetSrvA) TweetInfoById(id int64) (*cs.TweetInfo, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) TweetItemById(id int64) (*cs.TweetItem, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) UserTweets(visitorId, userId int64) (cs.TweetList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) ReactionByTweetId(userId int64, tweetId int64) (*cs.ReactionItem, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) UserReactions(userId int64, offset int, limit int) (cs.ReactionList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) FavoriteByTweetId(userId int64, tweetId int64) (*cs.FavoriteItem, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) UserFavorites(userId int64, offset int, limit int) (cs.FavoriteList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetSrvA) AttachmentByTweetId(userId int64, tweetId int64) (*cs.AttachmentBill, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) CreateAttachment(obj *cs.Attachment) (int64, error) { + // TODO + return 0, debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) CreateTweet(userId int64, req *cs.NewTweetReq) (*cs.TweetItem, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) DeleteTweet(userId int64, tweetId int64) ([]string, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) LockTweet(userId int64, tweetId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) StickTweet(userId int64, tweetId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) VisibleTweet(userId int64, visibility cs.TweetVisibleType) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) CreateReaction(userId int64, tweetId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) DeleteReaction(userId int64, reactionId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) CreateFavorite(userId int64, tweetId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetManageSrvA) DeleteFavorite(userId int64, favoriteId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *tweetHelpSrvA) RevampTweets(tweets cs.TweetList) (cs.TweetList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *tweetHelpSrvA) MergeTweets(tweets cs.TweetInfo) (cs.TweetList, error) { + // TODO + return nil, debug.ErrNotImplemented +} diff --git a/internal/dao/jinzhu/utils.go b/internal/dao/jinzhu/utils.go index 27766397..9d97b4b8 100644 --- a/internal/dao/jinzhu/utils.go +++ b/internal/dao/jinzhu/utils.go @@ -5,35 +5,52 @@ package jinzhu import ( + "github.com/rocboss/paopao-ce/internal/core/cs" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) -func createTag(db *gorm.DB, tag *dbr.Tag) (*dbr.Tag, error) { - t, err := tag.Get(db) - if err != nil { - tag.QuoteNum = 1 - return tag.Create(db) - } - - // 更新 - t.QuoteNum++ - err = t.Update(db) - - if err != nil { - return nil, err +func createTags(db *gorm.DB, userId int64, tags []string) (res cs.TagInfoList, err error) { + for _, name := range tags { + tag := &dbr.Tag{Tag: name} + if tag, err = tag.Get(db); err == nil { + // 更新 + tag.QuoteNum++ + if err = tag.Update(db); err != nil { + return + } + } else { + if tag, err = (&dbr.Tag{ + UserID: userId, + QuoteNum: 1, + Tag: name, + }).Create(db); err != nil { + return + } + } + res = append(res, &cs.TagInfo{ + ID: tag.ID, + UserID: tag.UserID, + Tag: tag.Tag, + QuoteNum: tag.QuoteNum, + }) } - - return t, nil + return } -func deleteTag(db *gorm.DB, tag *dbr.Tag) error { - tag, err := tag.Get(db) - if err != nil { - return err +func decrTagsByIds(db *gorm.DB, ids []int64) (err error) { + for _, id := range ids { + tag := &dbr.Tag{Model: &dbr.Model{ID: id}} + if tag, err = tag.Get(db); err == nil { + tag.QuoteNum-- + if err = tag.Update(db); err != nil { + return + } + } else { + continue + } } - tag.QuoteNum-- - return tag.Update(db) + return nil } func deleteTags(db *gorm.DB, tags []string) error { diff --git a/internal/dao/sakila/sakila.go b/internal/dao/sakila/sakila.go index d82a0d23..0a605bf8 100644 --- a/internal/dao/sakila/sakila.go +++ b/internal/dao/sakila/sakila.go @@ -17,6 +17,11 @@ func NewDataService() (core.DataService, core.VersionInfo) { return nil, nil } +func NewWebDataServantA() (core.WebDataServantA, core.VersionInfo) { + logrus.Fatal("not support now") + return nil, nil +} + func NewAuthorizationManageService() core.AuthorizationManageService { logrus.Fatal("not support now") return nil diff --git a/internal/dao/search/bridge.go b/internal/dao/search/bridge.go index f23aaa25..bc4eb039 100644 --- a/internal/dao/search/bridge.go +++ b/internal/dao/search/bridge.go @@ -8,6 +8,7 @@ import ( "time" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/sirupsen/logrus" ) @@ -46,7 +47,7 @@ func (s *bridgeTweetSearchServant) DeleteDocuments(identifiers []string) error { return nil } -func (s *bridgeTweetSearchServant) Search(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *bridgeTweetSearchServant) Search(user *ms.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { return s.ts.Search(user, q, offset, limit) } diff --git a/internal/dao/search/filter.go b/internal/dao/search/filter.go index 5840e189..a601c46f 100644 --- a/internal/dao/search/filter.go +++ b/internal/dao/search/filter.go @@ -6,6 +6,7 @@ package search import ( "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/types" ) @@ -13,13 +14,13 @@ type tweetSearchFilter struct { ams core.AuthorizationManageService } -func (s *tweetSearchFilter) filterResp(user *core.User, resp *core.QueryResp) { +func (s *tweetSearchFilter) filterResp(user *ms.User, resp *core.QueryResp) { // 管理员不过滤 if user != nil && user.IsAdmin { return } - var item *core.PostFormated + var item *ms.PostFormated items := resp.Items latestIndex := len(items) - 1 if user == nil { diff --git a/internal/dao/search/meili.go b/internal/dao/search/meili.go index 4b289fa5..401d8064 100644 --- a/internal/dao/search/meili.go +++ b/internal/dao/search/meili.go @@ -11,6 +11,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/meilisearch/meilisearch-go" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/json" "github.com/sirupsen/logrus" ) @@ -81,7 +82,7 @@ func (s *meiliTweetSearchServant) DeleteDocuments(identifiers []string) error { return nil } -func (s *meiliTweetSearchServant) Search(user *core.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { +func (s *meiliTweetSearchServant) Search(user *ms.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { if q.Type == core.SearchTypeDefault && q.Query != "" { resp, err = s.queryByContent(user, q, offset, limit) } else if q.Type == core.SearchTypeTag && q.Query != "" { @@ -99,7 +100,7 @@ func (s *meiliTweetSearchServant) Search(user *core.User, q *core.QueryReq, offs return } -func (s *meiliTweetSearchServant) queryByContent(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *meiliTweetSearchServant) queryByContent(user *ms.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { request := &meilisearch.SearchRequest{ Offset: int64(offset), Limit: int64(limit), @@ -121,7 +122,7 @@ func (s *meiliTweetSearchServant) queryByContent(user *core.User, q *core.QueryR return s.postsFrom(resp) } -func (s *meiliTweetSearchServant) queryByTag(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *meiliTweetSearchServant) queryByTag(user *ms.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { request := &meilisearch.SearchRequest{ Offset: int64(offset), Limit: int64(limit), @@ -145,7 +146,7 @@ func (s *meiliTweetSearchServant) queryByTag(user *core.User, q *core.QueryReq, return s.postsFrom(resp) } -func (s *meiliTweetSearchServant) queryAny(user *core.User, offset, limit int) (*core.QueryResp, error) { +func (s *meiliTweetSearchServant) queryAny(user *ms.User, offset, limit int) (*core.QueryResp, error) { request := &meilisearch.SearchRequest{ Offset: int64(offset), Limit: int64(limit), @@ -165,7 +166,7 @@ func (s *meiliTweetSearchServant) queryAny(user *core.User, offset, limit int) ( return s.postsFrom(resp) } -func (s *meiliTweetSearchServant) filterList(user *core.User) string { +func (s *meiliTweetSearchServant) filterList(user *ms.User) string { if user == nil { return s.publicFilter } @@ -178,7 +179,7 @@ func (s *meiliTweetSearchServant) filterList(user *core.User) string { } func (s *meiliTweetSearchServant) postsFrom(resp *meilisearch.SearchResponse) (*core.QueryResp, error) { - posts := make([]*core.PostFormated, 0, len(resp.Hits)) + posts := make([]*ms.PostFormated, 0, len(resp.Hits)) for _, hit := range resp.Hits { raw, err := json.Marshal(hit) if err != nil { @@ -188,7 +189,7 @@ func (s *meiliTweetSearchServant) postsFrom(resp *meilisearch.SearchResponse) (* if err = json.Unmarshal(raw, p); err != nil { return nil, err } - posts = append(posts, &core.PostFormated{ + posts = append(posts, &ms.PostFormated{ ID: p.ID, UserID: p.UserID, CommentCount: p.CommentCount, diff --git a/internal/dao/search/zinc.go b/internal/dao/search/zinc.go index 67b33a0b..70b4027e 100644 --- a/internal/dao/search/zinc.go +++ b/internal/dao/search/zinc.go @@ -9,6 +9,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/json" "github.com/rocboss/paopao-ce/pkg/zinc" "github.com/sirupsen/logrus" @@ -76,7 +77,7 @@ func (s *zincTweetSearchServant) DeleteDocuments(identifiers []string) error { return nil } -func (s *zincTweetSearchServant) Search(user *core.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { +func (s *zincTweetSearchServant) Search(user *ms.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { if q.Type == core.SearchTypeDefault && q.Query != "" { resp, err = s.queryByContent(user, q, offset, limit) } else if q.Type == core.SearchTypeTag && q.Query != "" { @@ -94,7 +95,7 @@ func (s *zincTweetSearchServant) Search(user *core.User, q *core.QueryReq, offse return } -func (s *zincTweetSearchServant) queryByContent(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *zincTweetSearchServant) queryByContent(user *ms.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { resp, err := s.client.EsQuery(s.indexName, map[string]any{ "query": map[string]any{ "match_phrase": map[string]any{ @@ -111,7 +112,7 @@ func (s *zincTweetSearchServant) queryByContent(user *core.User, q *core.QueryRe return s.postsFrom(resp) } -func (s *zincTweetSearchServant) queryByTag(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *zincTweetSearchServant) queryByTag(user *ms.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { resp, err := s.client.ApiQuery(s.indexName, map[string]any{ "search_type": "querystring", "query": map[string]any{ @@ -127,7 +128,7 @@ func (s *zincTweetSearchServant) queryByTag(user *core.User, q *core.QueryReq, o return s.postsFrom(resp) } -func (s *zincTweetSearchServant) queryAny(user *core.User, offset, limit int) (*core.QueryResp, error) { +func (s *zincTweetSearchServant) queryAny(user *ms.User, offset, limit int) (*core.QueryResp, error) { queryMap := map[string]any{ "query": map[string]any{ "match_all": map[string]string{}, @@ -144,9 +145,9 @@ func (s *zincTweetSearchServant) queryAny(user *core.User, offset, limit int) (* } func (s *zincTweetSearchServant) postsFrom(resp *zinc.QueryResultT) (*core.QueryResp, error) { - posts := make([]*core.PostFormated, 0, len(resp.Hits.Hits)) + posts := make([]*ms.PostFormated, 0, len(resp.Hits.Hits)) for _, hit := range resp.Hits.Hits { - item := &core.PostFormated{} + item := &ms.PostFormated{} raw, err := json.Marshal(hit.Source) if err != nil { return nil, err diff --git a/internal/dao/slonik/slonik.go b/internal/dao/slonik/slonik.go index bb8f82ad..705c5bbf 100644 --- a/internal/dao/slonik/slonik.go +++ b/internal/dao/slonik/slonik.go @@ -17,6 +17,11 @@ func NewDataService() (core.DataService, core.VersionInfo) { return nil, nil } +func NewWebDataServantA() (core.WebDataServantA, core.VersionInfo) { + logrus.Fatal("not support now") + return nil, nil +} + func NewAuthorizationManageService() core.AuthorizationManageService { logrus.Fatal("not support now") return nil diff --git a/internal/migration/migration_embed.go b/internal/migration/migration_embed.go index 02ede293..c2232d29 100644 --- a/internal/migration/migration_embed.go +++ b/internal/migration/migration_embed.go @@ -42,9 +42,9 @@ func Run() { db, err = sql.Open("mysql", conf.MysqlSetting.Dsn()+"&multiStatements=true") } else if cfg.If("PostgreSQL") || cfg.If("Postgres") { dbName = (*conf.PostgresSetting)["DBName"] - db, err = sql.Open("postgres", conf.PostgresSetting.Dsn()) + db, err = sql.Open("pgx", conf.PostgresSetting.Dsn()) } else if cfg.If("Sqlite3") { - db, err = conf.OpenSqlite3() + _, db, err = conf.OpenSqlite3() } else { dbName = conf.MysqlSetting.DBName db, err = sql.Open("mysql", conf.MysqlSetting.Dsn()) diff --git a/internal/model/web/loose.go b/internal/model/web/loose.go index 9682cf2a..0f6f863e 100644 --- a/internal/model/web/loose.go +++ b/internal/model/web/loose.go @@ -8,24 +8,28 @@ import ( "github.com/alimy/mir/v4" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" "github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/pkg/app" ) const ( - TagTypeHot TagType = "hot" - TagTypeNew TagType = "new" - TagTypeFollow TagType = "follow" - TagTypeHotExtral TagType = "hot_extral" + TagTypeHot = cs.TagTypeHot + TagTypeNew = cs.TagTypeNew + TagTypeFollow = cs.TagTypeFollow + TagTypeHotExtral = cs.TagTypeHotExtral ) const ( - UserPostsStylePost = "post" - UserPostsStyleComment = "comment" - UserPostsStyleMedia = "media" - UserPostsStyleStar = "star" + UserPostsStylePost = "post" + UserPostsStyleComment = "comment" + UserPostsStyleHighlight = "highlight" + UserPostsStyleMedia = "media" + UserPostsStyleStar = "star" ) +type TagType = cs.TagType + type TweetCommentsReq struct { SimpleInfo `form:"-" binding:"-"` TweetId int64 `form:"id" binding:"required"` @@ -36,8 +40,6 @@ type TweetCommentsReq struct { type TweetCommentsResp base.PageResp -type TagType string - type TimelineReq struct { BaseInfo `form:"-" binding:"-"` Query string `form:"query"` @@ -84,8 +86,8 @@ type TopicListReq struct { // TopicListResp 主题返回值 // TODO: 优化内容定义 type TopicListResp struct { - Topics []*core.TagFormated `json:"topics"` - ExtralTopics []*core.TagFormated `json:"extral_topics,omitempty"` + Topics cs.TagList `json:"topics"` + ExtralTopics cs.TagList `json:"extral_topics,omitempty"` } func (r *GetUserTweetsReq) SetPageInfo(page int, pageSize int) { diff --git a/internal/model/web/priv.go b/internal/model/web/priv.go index d226e158..7ce1aba0 100644 --- a/internal/model/web/priv.go +++ b/internal/model/web/priv.go @@ -12,6 +12,7 @@ import ( "github.com/alimy/mir/v4" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/xerror" @@ -31,9 +32,9 @@ type TweetReplyThumbsReq struct { } type PostContentItem struct { - Content string `json:"content" binding:"required"` - Type core.PostContentT `json:"type" binding:"required"` - Sort int64 `json:"sort" binding:"required"` + Content string `json:"content" binding:"required"` + Type ms.PostContentT `json:"type" binding:"required"` + Sort int64 `json:"sort" binding:"required"` } type CreateTweetReq struct { @@ -46,7 +47,7 @@ type CreateTweetReq struct { ClientIP string `json:"-" binding:"-"` } -type CreateTweetResp core.PostFormated +type CreateTweetResp ms.PostFormated type DeleteTweetReq struct { BaseInfo `json:"-" binding:"-"` @@ -85,10 +86,19 @@ type StickTweetReq struct { ID int64 `json:"id" binding:"required"` } +type HighlightTweetReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + type StickTweetResp struct { StickStatus int `json:"top_status"` } +type HighlightTweetResp struct { + HighlightStatus int `json:"highlight_status"` +} + type VisibleTweetReq struct { BaseInfo `json:"-" binding:"-"` ID int64 `json:"id"` @@ -107,7 +117,7 @@ type CreateCommentReq struct { ClientIP string `json:"-" binding:"-"` } -type CreateCommentResp core.Comment +type CreateCommentResp ms.Comment type CreateCommentReplyReq struct { SimpleInfo `json:"-" binding:"-"` @@ -117,7 +127,7 @@ type CreateCommentReplyReq struct { ClientIP string `json:"-" binding:"-"` } -type CreateCommentReplyResp core.CommentReply +type CreateCommentReplyResp ms.CommentReply type DeleteCommentReq struct { BaseInfo `json:"-" binding:"-"` @@ -138,12 +148,12 @@ type UploadAttachmentReq struct { } type UploadAttachmentResp struct { - UserID int64 `json:"user_id"` - FileSize int64 `json:"file_size"` - ImgWidth int `json:"img_width"` - ImgHeight int `json:"img_height"` - Type core.AttachmentType `json:"type"` - Content string `json:"content"` + UserID int64 `json:"user_id"` + FileSize int64 `json:"file_size"` + ImgWidth int `json:"img_width"` + ImgHeight int `json:"img_height"` + Type ms.AttachmentType `json:"type"` + Content string `json:"content"` } type DownloadAttachmentPrecheckReq struct { @@ -186,13 +196,13 @@ type UnfollowTopicReq struct { // Check 检查PostContentItem属性 func (p *PostContentItem) Check(acs core.AttachmentCheckService) error { // 检查附件是否是本站资源 - if p.Type == core.ContentTypeImage || p.Type == core.ContentTypeVideo || p.Type == core.ContentTypeAttachment { + if p.Type == ms.ContentTypeImage || p.Type == ms.ContentTypeVideo || p.Type == ms.ContentTypeAttachment { if err := acs.CheckAttachment(p.Content); err != nil { return err } } // 检查链接是否合法 - if p.Type == core.ContentTypeLink { + if p.Type == ms.ContentTypeLink { if strings.Index(p.Content, "http://") != 0 && strings.Index(p.Content, "https://") != 0 { return fmt.Errorf("链接不合法") } diff --git a/internal/model/web/pub.go b/internal/model/web/pub.go index 422249cf..058288e8 100644 --- a/internal/model/web/pub.go +++ b/internal/model/web/pub.go @@ -5,7 +5,7 @@ package web import ( - "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/version" ) @@ -13,7 +13,7 @@ type TweetDetailReq struct { TweetId int64 `form:"id"` } -type TweetDetailResp core.PostFormated +type TweetDetailResp ms.PostFormated type GetCaptchaResp struct { Id string `json:"id"` diff --git a/internal/model/web/web.go b/internal/model/web/web.go index d9c416bb..d197bb19 100644 --- a/internal/model/web/web.go +++ b/internal/model/web/web.go @@ -7,7 +7,7 @@ package web import ( "github.com/alimy/mir/v4" "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/xerror" @@ -18,7 +18,7 @@ var ( ) type BaseInfo struct { - User *core.User + User *ms.User } type SimpleInfo struct { @@ -31,7 +31,7 @@ type BasePageReq struct { PageSize int } -func (b *BaseInfo) SetUser(user *core.User) { +func (b *BaseInfo) SetUser(user *ms.User) { b.User = user } diff --git a/internal/servants/base/base.go b/internal/servants/base/base.go index 86e93064..1825fe98 100644 --- a/internal/servants/base/base.go +++ b/internal/servants/base/base.go @@ -17,6 +17,7 @@ import ( "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao" "github.com/rocboss/paopao-ce/internal/dao/cache" "github.com/rocboss/paopao-ce/pkg/app" @@ -31,6 +32,7 @@ type BaseServant struct { type DaoServant struct { *BaseServant + Dsa core.WebDataServantA Ds core.DataService Ts core.TweetSearchService Redis core.RedisCache @@ -47,7 +49,7 @@ type SentryHubSetter interface { } type UserSetter interface { - SetUser(*core.User) + SetUser(*ms.User) } type UserIdSetter interface { @@ -58,9 +60,9 @@ type PageInfoSetter interface { SetPageInfo(page, pageSize int) } -func UserFrom(c *gin.Context) (*core.User, bool) { +func UserFrom(c *gin.Context) (*ms.User, bool) { if u, exists := c.Get("USER"); exists { - user, ok := u.(*core.User) + user, ok := u.(*ms.User) return user, ok } return nil, false @@ -174,7 +176,7 @@ func (s *BaseServant) Render(c *gin.Context, data any, err mir.Error) { } } -func (s *DaoServant) GetTweetBy(id int64) (*core.PostFormated, error) { +func (s *DaoServant) GetTweetBy(id int64) (*ms.PostFormated, error) { post, err := s.Ds.GetPostByID(id) if err != nil { return nil, err @@ -205,20 +207,21 @@ func (s *DaoServant) PushPostsToSearch(c context.Context) { defer s.Redis.DelPushToSearchJob(c) splitNum := 1000 - totalRows, _ := s.Ds.GetPostCount(&core.ConditionsT{ + conditions := ms.ConditionsT{ "visibility IN ?": []core.PostVisibleT{core.PostVisitPublic, core.PostVisitFriend}, - }) + } + totalRows, _ := s.Ds.GetPostCount(conditions) pages := math.Ceil(float64(totalRows) / float64(splitNum)) nums := int(pages) for i := 0; i < nums; i++ { - posts, postsFormated, err := s.GetTweetList(&core.ConditionsT{}, i*splitNum, splitNum) + posts, postsFormated, err := s.GetTweetList(conditions, i*splitNum, splitNum) if err != nil || len(posts) != len(postsFormated) { continue } for i, pf := range postsFormated { contentFormated := "" for _, content := range pf.Contents { - if content.Type == core.ContentTypeText || content.Type == core.ContentTypeTitle { + if content.Type == ms.ContentTypeText || content.Type == ms.ContentTypeTitle { contentFormated = contentFormated + content.Content + "\n" } } @@ -234,9 +237,9 @@ func (s *DaoServant) PushPostsToSearch(c context.Context) { } } -func (s *DaoServant) PushPostToSearch(post *core.Post) { +func (s *DaoServant) PushPostToSearch(post *ms.Post) { postFormated := post.Format() - postFormated.User = &core.UserFormated{ + postFormated.User = &ms.UserFormated{ ID: post.UserID, } contents, _ := s.Ds.GetPostContentsByIDs([]int64{post.ID}) @@ -246,7 +249,7 @@ func (s *DaoServant) PushPostToSearch(post *core.Post) { contentFormated := "" for _, content := range postFormated.Contents { - if content.Type == core.ContentTypeText || content.Type == core.ContentTypeTitle { + if content.Type == ms.ContentTypeText || content.Type == ms.ContentTypeTitle { contentFormated = contentFormated + content.Content + "\n" } } @@ -258,11 +261,11 @@ func (s *DaoServant) PushPostToSearch(post *core.Post) { s.Ts.AddDocuments(docs, fmt.Sprintf("%d", post.ID)) } -func (s *DaoServant) DeleteSearchPost(post *core.Post) error { +func (s *DaoServant) DeleteSearchPost(post *ms.Post) error { return s.Ts.DeleteDocuments([]string{fmt.Sprintf("%d", post.ID)}) } -func (s *DaoServant) GetTweetList(conditions *core.ConditionsT, offset, limit int) ([]*core.Post, []*core.PostFormated, error) { +func (s *DaoServant) GetTweetList(conditions ms.ConditionsT, offset, limit int) ([]*ms.Post, []*ms.PostFormated, error) { posts, err := s.Ds.GetPosts(conditions, offset, limit) if err != nil { return nil, nil, err @@ -288,6 +291,7 @@ func NewDaoServant() *DaoServant { return &DaoServant{ BaseServant: NewBaseServant(), Redis: cache.NewRedisCache(), + Dsa: dao.WebDataServantA(), Ds: dao.DataService(), Ts: dao.TweetSearchService(), } diff --git a/internal/servants/chain/admin.go b/internal/servants/chain/admin.go index 4660baa8..37a6e4c7 100644 --- a/internal/servants/chain/admin.go +++ b/internal/servants/chain/admin.go @@ -6,15 +6,15 @@ package chain import ( "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/app" ) func Admin() gin.HandlerFunc { return func(c *gin.Context) { if user, exist := c.Get("USER"); exist { - if userModel, ok := user.(*core.User); ok { - if userModel.Status == core.UserStatusNormal && userModel.IsAdmin { + if userModel, ok := user.(*ms.User); ok { + if userModel.Status == ms.UserStatusNormal && userModel.IsAdmin { c.Next() return } diff --git a/internal/servants/chain/priv.go b/internal/servants/chain/priv.go index c2a017ca..420c3a9c 100644 --- a/internal/servants/chain/priv.go +++ b/internal/servants/chain/priv.go @@ -7,7 +7,7 @@ package chain import ( "github.com/alimy/cfg" "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/pkg/app" ) @@ -15,8 +15,8 @@ func Priv() gin.HandlerFunc { if cfg.If("PhoneBind") { return func(c *gin.Context) { if u, exist := c.Get("USER"); exist { - if user, ok := u.(*core.User); ok { - if user.Status == core.UserStatusNormal { + if user, ok := u.(*ms.User); ok { + if user.Status == ms.UserStatusNormal { if user.Phone == "" { response := app.NewResponse(c) response.ToErrorResponse(_errAccountNoPhoneBind) @@ -35,7 +35,7 @@ func Priv() gin.HandlerFunc { } else { return func(c *gin.Context) { if u, exist := c.Get("USER"); exist { - if user, ok := u.(*core.User); ok && user.Status == core.UserStatusNormal { + if user, ok := u.(*ms.User); ok && user.Status == ms.UserStatusNormal { c.Next() return } diff --git a/internal/servants/web/core.go b/internal/servants/web/core.go index 9bf791c1..923b0261 100644 --- a/internal/servants/web/core.go +++ b/internal/servants/web/core.go @@ -14,6 +14,7 @@ import ( "github.com/gin-gonic/gin" api "github.com/rocboss/paopao-ce/auto/api/v1" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/chain" @@ -85,7 +86,7 @@ func (s *coreSrv) GetUnreadMsgCount(req *web.GetUnreadMsgCountReq) (*web.GetUnre } func (s *coreSrv) GetMessages(req *web.GetMessagesReq) (*web.GetMessagesResp, mir.Error) { - conditions := &core.ConditionsT{ + conditions := &ms.ConditionsT{ "receiver_user_id": req.UserId, "ORDER": "id DESC", } @@ -98,7 +99,7 @@ func (s *coreSrv) GetMessages(req *web.GetMessagesReq) (*web.GetMessagesResp, mi } } // 好友申请消息不需要获取其他信息 - if mf.Type == core.MsgTypeRequestingFriend { + if mf.Type == ms.MsgTypeRequestingFriend { continue } if mf.PostID > 0 { @@ -157,10 +158,10 @@ func (s *coreSrv) SendUserWhisper(req *web.SendWhisperReq) mir.Error { } // 创建私信 - _, err := s.Ds.CreateMessage(&core.Message{ + _, err := s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.Uid, ReceiverUserID: req.UserID, - Type: core.MsgTypeWhisper, + Type: ms.MsgTypeWhisper, Brief: "给你发送新私信了", Content: req.Content, }) @@ -187,7 +188,7 @@ func (s *coreSrv) GetCollections(req *web.GetCollectionsReq) (*web.GetCollection return nil, web.ErrGetCollectionsFailed } - var posts []*core.Post + var posts []*ms.Post for _, collection := range collections { posts = append(posts, collection.Post) } @@ -250,7 +251,7 @@ func (s *coreSrv) GetStars(req *web.GetStarsReq) (*web.GetStarsResp, mir.Error) return nil, web.ErrGetStarsFailed } - var posts []*core.Post + var posts []*ms.Post for _, star := range stars { posts = append(posts, star.Post) } @@ -284,7 +285,7 @@ func (s *coreSrv) ChangePassword(req *web.ChangePasswordReq) mir.Error { } func (s *coreSrv) SuggestTags(req *web.SuggestTagsReq) (*web.SuggestTagsResp, mir.Error) { - tags, err := s.Ds.GetTagsByKeyword(req.Keyword) + tags, err := s.Ds.TagsByKeyword(req.Keyword) if err != nil { logrus.Errorf("Ds.GetTagsByKeyword err: %s", err) return nil, xerror.ServerError diff --git a/internal/servants/web/loose.go b/internal/servants/web/loose.go index b386b213..983c5108 100644 --- a/internal/servants/web/loose.go +++ b/internal/servants/web/loose.go @@ -10,6 +10,7 @@ import ( api "github.com/rocboss/paopao-ce/auto/api/v1" "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/internal/servants/base" @@ -65,6 +66,8 @@ func (s *looseSrv) GetUserTweets(req *web.GetUserTweetsReq) (res *web.GetUserTwe switch req.Style { case web.UserPostsStyleComment: res, err = s.getUserCommentTweets(req, isSelf) + case web.UserPostsStyleHighlight: + res, err = s.getUserHighlightTweets(req, isSelf) case web.UserPostsStyleMedia: res, err = s.getUserMediaTweets(req, isSelf) case web.UserPostsStyleStar: @@ -83,6 +86,12 @@ func (s *looseSrv) getUserCommentTweets(req *web.GetUserTweetsReq, isSelf bool) return (*web.GetUserTweetsResp)(resp), nil } +func (s *looseSrv) getUserHighlightTweets(req *web.GetUserTweetsReq, isSelf bool) (*web.GetUserTweetsResp, mir.Error) { + // TODO: add implement logic + resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0) + return (*web.GetUserTweetsResp)(resp), nil +} + func (s *looseSrv) getUserMediaTweets(req *web.GetUserTweetsReq, isSelf bool) (*web.GetUserTweetsResp, mir.Error) { // TODO: add implement logic resp := base.PageRespFrom(nil, req.Page, req.PageSize, 0) @@ -121,7 +130,7 @@ func (s *looseSrv) getSelfStarTweets(req *web.GetUserTweetsReq) (*web.GetUserTwe logrus.Errorf("Ds.GetUserPostStars err: %s", err) return nil, web.ErrGetStarsFailed } - var posts []*core.Post + var posts []*ms.Post for _, star := range stars { posts = append(posts, star.Post) } @@ -151,7 +160,7 @@ func (s *looseSrv) getUserPostTweets(req *web.GetUserTweetsReq) (*web.GetUserTwe visibilities = append(visibilities, core.PostVisitFriend) } } - conditions := &core.ConditionsT{ + conditions := ms.ConditionsT{ "user_id": other.ID, "visibility IN ?": visibilities, "ORDER": "latest_replied_on DESC", @@ -198,7 +207,7 @@ func (s *looseSrv) GetUserProfile(req *web.GetUserProfileReq) (*web.GetUserProfi func (s *looseSrv) TopicList(req *web.TopicListReq) (*web.TopicListResp, mir.Error) { var ( - tags, extralTags []*core.TagFormated + tags, extralTags cs.TagList err error ) num := req.Num @@ -236,7 +245,7 @@ func (s *looseSrv) TweetComments(req *web.TweetCommentsReq) (*web.TweetCommentsR if req.SortStrategy == "newest" { sort = "id DESC" } - conditions := &core.ConditionsT{ + conditions := &ms.ConditionsT{ "post_id": req.TweetId, "ORDER": sort, } @@ -290,7 +299,7 @@ func (s *looseSrv) TweetComments(req *web.TweetCommentsReq) (*web.TweetCommentsR } } - commentsFormated := []*core.CommentFormated{} + commentsFormated := []*ms.CommentFormated{} for _, comment := range comments { commentFormated := comment.Format() if thumbs, exist := commentThumbs[comment.ID]; exist { diff --git a/internal/servants/web/priv.go b/internal/servants/web/priv.go index 93f52f34..659ab8dd 100644 --- a/internal/servants/web/priv.go +++ b/internal/servants/web/priv.go @@ -16,6 +16,8 @@ import ( api "github.com/rocboss/paopao-ce/auto/api/v1" "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/cs" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/chain" @@ -27,11 +29,17 @@ import ( var ( _ api.Priv = (*privSrv)(nil) - _uploadAttachmentTypeMap = map[string]core.AttachmentType{ - "public/image": core.AttachmentTypeImage, - "public/avatar": core.AttachmentTypeImage, - "public/video": core.AttachmentTypeVideo, - "attachment": core.AttachmentTypeOther, + _uploadAttachmentTypeMap = map[string]ms.AttachmentType{ + "public/image": ms.AttachmentTypeImage, + "public/avatar": ms.AttachmentTypeImage, + "public/video": ms.AttachmentTypeVideo, + "attachment": ms.AttachmentTypeOther, + } + _uploadAttachmentTypes = map[string]cs.AttachmentType{ + "public/image": cs.AttachmentTypeImage, + "public/avatar": cs.AttachmentTypeImage, + "public/video": cs.AttachmentTypeVideo, + "attachment": cs.AttachmentTypeOther, } ) @@ -118,20 +126,20 @@ func (s *privSrv) UploadAttachment(req *web.UploadAttachmentReq) (*web.UploadAtt } // 构造附件Model - attachment := &core.Attachment{ + attachment := &ms.Attachment{ UserID: req.Uid, FileSize: req.FileSize, Content: objectUrl, Type: _uploadAttachmentTypeMap[req.UploadType], } - if attachment.Type == core.AttachmentTypeImage { + if attachment.Type == ms.AttachmentTypeImage { var src image.Image src, err = imaging.Decode(req.File) if err == nil { attachment.ImgWidth, attachment.ImgHeight = getImageSize(src.Bounds()) } } - attachment, err = s.Ds.CreateAttachment(attachment) + attachment.ID, err = s.Ds.CreateAttachment(attachment) if err != nil { logrus.Errorf("Ds.CreateAttachment err: %s", err) return nil, web.ErrFileUploadFailed @@ -154,7 +162,7 @@ func (s *privSrv) DownloadAttachmentPrecheck(req *web.DownloadAttachmentPrecheck return nil, web.ErrInvalidDownloadReq } resp := &web.DownloadAttachmentPrecheckResp{Paid: true} - if content.Type == core.ContentTypeChargeAttachment { + if content.Type == ms.ContentTypeChargeAttachment { tweet, err := s.GetTweetBy(content.PostID) if err != nil { logrus.Errorf("get tweet err: %v", err) @@ -177,7 +185,7 @@ func (s *privSrv) DownloadAttachment(req *web.DownloadAttachmentReq) (*web.Downl return nil, web.ErrInvalidDownloadReq } // 收费附件 - if content.Type == core.ContentTypeChargeAttachment { + if content.Type == ms.ContentTypeChargeAttachment { post, err := s.GetTweetBy(content.PostID) if err != nil { logrus.Errorf("s.GetTweetBy err: %v", err) @@ -190,8 +198,8 @@ func (s *privSrv) DownloadAttachment(req *web.DownloadAttachmentReq) (*web.Downl } // 未购买,则尝试购买 if !paidFlag { - err := s.buyPostAttachment(&core.Post{ - Model: &core.Model{ + err := s.buyPostAttachment(&ms.Post{ + Model: &ms.Model{ ID: post.ID, }, UserID: post.UserID, @@ -228,7 +236,7 @@ func (s *privSrv) CreateTweet(req *web.CreateTweetReq) (_ *web.CreateTweetResp, } mediaContents = contents tags := tagsFrom(req.Tags) - post := &core.Post{ + post := &ms.Post{ UserID: req.User.ID, Tags: strings.Join(tags, ","), IP: req.ClientIP, @@ -249,10 +257,10 @@ func (s *privSrv) CreateTweet(req *web.CreateTweetReq) (_ *web.CreateTweetResp, logrus.Infof("contents check err: %s", err) continue } - if item.Type == core.ContentTypeAttachment && req.AttachmentPrice > 0 { - item.Type = core.ContentTypeChargeAttachment + if item.Type == ms.ContentTypeAttachment && req.AttachmentPrice > 0 { + item.Type = ms.ContentTypeChargeAttachment } - postContent := &core.PostContent{ + postContent := &ms.PostContent{ PostID: post.ID, UserID: req.User.ID, Content: item.Content, @@ -268,13 +276,7 @@ func (s *privSrv) CreateTweet(req *web.CreateTweetReq) (_ *web.CreateTweetResp, // 私密推文不创建标签与用户提醒 if post.Visibility != core.PostVisitPrivate { // 创建标签 - for _, t := range tags { - tag := &core.Tag{ - UserID: req.User.ID, - Tag: t, - } - s.Ds.CreateTag(tag) - } + s.Ds.UpsertTags(req.User.ID, tags) // 创建用户消息提醒 for _, u := range req.Users { @@ -285,10 +287,10 @@ func (s *privSrv) CreateTweet(req *web.CreateTweetReq) (_ *web.CreateTweetResp, // 创建消息提醒 // TODO: 优化消息提醒处理机制 - go s.Ds.CreateMessage(&core.Message{ + go s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.User.ID, ReceiverUserID: user.ID, - Type: core.MsgTypePost, + Type: ms.MsgTypePost, Brief: "在新发布的泡泡动态中@了你", PostID: post.ID, }) @@ -296,7 +298,7 @@ func (s *privSrv) CreateTweet(req *web.CreateTweetReq) (_ *web.CreateTweetResp, } // 推送Search s.PushPostToSearch(post) - formatedPosts, err := s.Ds.RevampPosts([]*core.PostFormated{post.Format()}) + formatedPosts, err := s.Ds.RevampPosts([]*ms.PostFormated{post.Format()}) if err != nil { logrus.Infof("Ds.RevampPosts err: %s", err) return nil, web.ErrCreatePostFailed @@ -352,8 +354,8 @@ func (s *privSrv) DeleteCommentReply(req *web.DeleteCommentReplyReq) mir.Error { func (s *privSrv) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error) { var ( - post *core.Post - comment *core.Comment + post *ms.Post + comment *ms.Comment atUserID int64 err error ) @@ -363,7 +365,7 @@ func (s *privSrv) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.Creat } // 创建评论 - reply := &core.CommentReply{ + reply := &ms.CommentReply{ CommentID: req.CommentID, UserID: req.Uid, Content: req.Content, @@ -388,10 +390,10 @@ func (s *privSrv) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.Creat // 创建用户消息提醒 commentMaster, err := s.Ds.GetUserByID(comment.UserID) if err == nil && commentMaster.ID != req.Uid { - go s.Ds.CreateMessage(&core.Message{ + go s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.Uid, ReceiverUserID: commentMaster.ID, - Type: core.MsgTypeReply, + Type: ms.MsgTypeReply, Brief: "在泡泡评论下回复了你", PostID: post.ID, CommentID: comment.ID, @@ -400,10 +402,10 @@ func (s *privSrv) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.Creat } postMaster, err := s.Ds.GetUserByID(post.UserID) if err == nil && postMaster.ID != req.Uid && commentMaster.ID != postMaster.ID { - go s.Ds.CreateMessage(&core.Message{ + go s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.Uid, ReceiverUserID: postMaster.ID, - Type: core.MsgTypeReply, + Type: ms.MsgTypeReply, Brief: "在泡泡评论下发布了新回复", PostID: post.ID, CommentID: comment.ID, @@ -414,10 +416,10 @@ func (s *privSrv) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.Creat user, err := s.Ds.GetUserByID(atUserID) if err == nil && user.ID != req.Uid && commentMaster.ID != user.ID && postMaster.ID != user.ID { // 创建消息提醒 - go s.Ds.CreateMessage(&core.Message{ + go s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.Uid, ReceiverUserID: user.ID, - Type: core.MsgTypeReply, + Type: ms.MsgTypeReply, Brief: "在泡泡评论的回复中@了你", PostID: post.ID, CommentID: comment.ID, @@ -480,7 +482,7 @@ func (s *privSrv) CreateComment(req *web.CreateCommentReq) (_ *web.CreateComment if post.CommentCount >= conf.AppSetting.MaxCommentCount { return nil, web.ErrMaxCommentCount } - comment := &core.Comment{ + comment := &ms.Comment{ PostID: post.ID, UserID: req.Uid, IP: req.ClientIP, @@ -494,12 +496,12 @@ func (s *privSrv) CreateComment(req *web.CreateCommentReq) (_ *web.CreateComment for _, item := range req.Contents { // 检查附件是否是本站资源 - if item.Type == core.ContentTypeImage || item.Type == core.ContentTypeVideo || item.Type == core.ContentTypeAttachment { + if item.Type == ms.ContentTypeImage || item.Type == ms.ContentTypeVideo || item.Type == ms.ContentTypeAttachment { if err := s.Ds.CheckAttachment(item.Content); err != nil { continue } } - postContent := &core.CommentContent{ + postContent := &ms.CommentContent{ CommentID: comment.ID, UserID: req.Uid, Content: item.Content, @@ -520,10 +522,10 @@ func (s *privSrv) CreateComment(req *web.CreateCommentReq) (_ *web.CreateComment // 创建用户消息提醒 postMaster, err := s.Ds.GetUserByID(post.UserID) if err == nil && postMaster.ID != req.Uid { - go s.Ds.CreateMessage(&core.Message{ + go s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.Uid, ReceiverUserID: postMaster.ID, - Type: core.MsgtypeComment, + Type: ms.MsgtypeComment, Brief: "在泡泡中评论了你", PostID: post.ID, CommentID: comment.ID, @@ -536,10 +538,10 @@ func (s *privSrv) CreateComment(req *web.CreateCommentReq) (_ *web.CreateComment } // 创建消息提醒 - go s.Ds.CreateMessage(&core.Message{ + go s.Ds.CreateMessage(&ms.Message{ SenderUserID: req.Uid, ReceiverUserID: user.ID, - Type: core.MsgtypeComment, + Type: ms.MsgtypeComment, Brief: "在泡泡评论中@了你", PostID: post.ID, CommentID: comment.ID, @@ -632,6 +634,11 @@ func (s *privSrv) StickTweet(req *web.StickTweetReq) (*web.StickTweetResp, mir.E }, nil } +func (s *privSrv) HighlightTweet(req *web.HighlightTweetReq) (*web.HighlightTweetResp, mir.Error) { + // TODO + return nil, web.ErrNotImplemented +} + func (s *privSrv) LockTweet(req *web.LockTweetReq) (*web.LockTweetResp, mir.Error) { post, err := s.Ds.GetPostByID(req.ID) if err != nil { @@ -649,7 +656,7 @@ func (s *privSrv) LockTweet(req *web.LockTweetReq) (*web.LockTweetResp, mir.Erro }, nil } -func (s *privSrv) deletePostCommentReply(reply *core.CommentReply) error { +func (s *privSrv) deletePostCommentReply(reply *ms.CommentReply) error { err := s.Ds.DeleteCommentReply(reply) if err != nil { return err @@ -673,7 +680,7 @@ func (s *privSrv) deletePostCommentReply(reply *core.CommentReply) error { return nil } -func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) (*core.Post, *core.Comment, int64, +func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) (*ms.Post, *ms.Comment, int64, error) { // 加载Comment comment, err := s.Ds.GetCommentByID(commentID) @@ -706,7 +713,7 @@ func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) return post, comment, atUserID, nil } -func (s *privSrv) createPostStar(postID, userID int64) (*core.PostStar, mir.Error) { +func (s *privSrv) createPostStar(postID, userID int64) (*ms.PostStar, mir.Error) { post, err := s.Ds.GetPostByID(postID) if err != nil { return nil, xerror.ServerError @@ -732,7 +739,7 @@ func (s *privSrv) createPostStar(postID, userID int64) (*core.PostStar, mir.Erro return star, nil } -func (s *privSrv) deletePostStar(star *core.PostStar) mir.Error { +func (s *privSrv) deletePostStar(star *ms.PostStar) mir.Error { post, err := s.Ds.GetPostByID(star.PostID) if err != nil { return xerror.ServerError @@ -757,7 +764,7 @@ func (s *privSrv) deletePostStar(star *core.PostStar) mir.Error { return nil } -func (s *privSrv) createPostCollection(postID, userID int64) (*core.PostCollection, mir.Error) { +func (s *privSrv) createPostCollection(postID, userID int64) (*ms.PostCollection, mir.Error) { post, err := s.Ds.GetPostByID(postID) if err != nil { return nil, xerror.ServerError @@ -783,7 +790,7 @@ func (s *privSrv) createPostCollection(postID, userID int64) (*core.PostCollecti return collection, nil } -func (s *privSrv) deletePostCollection(collection *core.PostCollection) mir.Error { +func (s *privSrv) deletePostCollection(collection *ms.PostCollection) mir.Error { post, err := s.Ds.GetPostByID(collection.PostID) if err != nil { return xerror.ServerError @@ -812,7 +819,7 @@ func (s *privSrv) checkPostAttachmentIsPaid(postID, userID int64) bool { return err == nil && bill.Model != nil && bill.ID > 0 } -func (s *privSrv) buyPostAttachment(post *core.Post, user *core.User) mir.Error { +func (s *privSrv) buyPostAttachment(post *ms.Post, user *ms.User) mir.Error { if user.Balance < post.AttachmentPrice { return web.ErrInsuffientDownloadMoney } diff --git a/internal/servants/web/pub.go b/internal/servants/web/pub.go index 5314b9b0..f12f74ee 100644 --- a/internal/servants/web/pub.go +++ b/internal/servants/web/pub.go @@ -17,7 +17,7 @@ import ( "github.com/alimy/mir/v4" "github.com/gofrs/uuid/v5" api "github.com/rocboss/paopao-ce/auto/api/v1" - "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/web/assets" @@ -131,14 +131,13 @@ func (s *pubSrv) Register(req *web.RegisterReq) (*web.RegisterResp, mir.Error) { return nil, web.ErrUserRegisterFailed } password, salt := encryptPasswordAndSalt(req.Password) - //password, salt := encryptPasswordAndSalt(req.Password, req.Username) - user := &core.User{ + user := &ms.User{ Nickname: req.Username, Username: req.Username, Password: password, Avatar: getRandomAvatar(), Salt: salt, - Status: core.UserStatusNormal, + Status: ms.UserStatusNormal, } user, err := s.Ds.CreateUser(user) if err != nil { @@ -165,7 +164,7 @@ func (s *pubSrv) Login(req *web.LoginReq) (*web.LoginResp, mir.Error) { } // 对比密码是否正确 if validPassword(user.Password, req.Password, user.Salt) { - if user.Status == core.UserStatusClosed { + if user.Status == ms.UserStatusClosed { return nil, web.ErrUserHasBeenBanned } // 清空登录计数 diff --git a/internal/servants/web/utils.go b/internal/servants/web/utils.go index fb655b1a..86c99c5a 100644 --- a/internal/servants/web/utils.go +++ b/internal/servants/web/utils.go @@ -14,6 +14,7 @@ import ( "github.com/alimy/mir/v4" "github.com/gofrs/uuid/v5" "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" "github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/pkg/utils" "github.com/rocboss/paopao-ce/pkg/xerror" @@ -120,11 +121,11 @@ func persistMediaContents(oss core.ObjectStorageService, contents []*web.PostCon items = make([]string, 0, len(contents)) for _, item := range contents { switch item.Type { - case core.ContentTypeImage, - core.ContentTypeVideo, - core.ContentTypeAudio, - core.ContentTypeAttachment, - core.ContentTypeChargeAttachment: + case ms.ContentTypeImage, + ms.ContentTypeVideo, + ms.ContentTypeAudio, + ms.ContentTypeAttachment, + ms.ContentTypeChargeAttachment: items = append(items, item.Content) if err != nil { continue @@ -201,7 +202,7 @@ func tagsFrom(originTags []string) []string { } // checkPermision 检查是否拥有者或管理员 -func checkPermision(user *core.User, targetUserId int64) mir.Error { +func checkPermision(user *ms.User, targetUserId int64) mir.Error { if user == nil || (user.ID != targetUserId && !user.IsAdmin) { return web.ErrNoPermission } diff --git a/mirc/gen.go b/mirc/gen.go index b2ebe43d..dcd402ac 100644 --- a/mirc/gen.go +++ b/mirc/gen.go @@ -23,7 +23,7 @@ import ( //go:generate go run $GOFILE func main() { - log.Println("generate code start") + log.Println("[Mir] generate code start") opts := Options{ UseGin(), SinkPath("../auto"), @@ -34,5 +34,5 @@ func main() { if err := Generate(opts); err != nil { log.Fatal(err) } - log.Println("generate code finish") + log.Println("[Mir] generate code finish") } diff --git a/mirc/web/v1/priv.go b/mirc/web/v1/priv.go index 460c9d99..567de00d 100644 --- a/mirc/web/v1/priv.go +++ b/mirc/web/v1/priv.go @@ -42,6 +42,9 @@ type Priv struct { // StickTweet 置顶动态 StickTweet func(Post, web.StickTweetReq) web.StickTweetResp `mir:"/post/stick"` + // HighlightTweet 推文亮点设置 + HighlightTweet func(Post, web.HighlightTweetReq) web.HighlightTweetResp `mir:"/post/highlight"` + // VisibleTweet 修改动态可见度 VisibleTweet func(Post, web.VisibleTweetReq) web.VisibleTweetResp `mir:"/post/visibility"` diff --git a/pkg/app/jwt.go b/pkg/app/jwt.go index b9759e07..a861faa2 100644 --- a/pkg/app/jwt.go +++ b/pkg/app/jwt.go @@ -9,7 +9,7 @@ import ( "github.com/golang-jwt/jwt/v4" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/core/ms" ) type Claims struct { @@ -22,7 +22,7 @@ func GetJWTSecret() []byte { return []byte(conf.JWTSetting.Secret) } -func GenerateToken(User *core.User) (string, error) { +func GenerateToken(User *ms.User) (string, error) { expireTime := time.Now().Add(conf.JWTSetting.Expire) claims := Claims{ UID: User.ID, diff --git a/pkg/debug/annotation.go b/pkg/debug/annotation.go new file mode 100644 index 00000000..227399d0 --- /dev/null +++ b/pkg/debug/annotation.go @@ -0,0 +1,17 @@ +// 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 debug + +import ( + "github.com/sirupsen/logrus" +) + +func TODO() { + logrus.Fatalln("in todo progress") +} + +func NotImplemented() { + logrus.Fatalln("not implemented") +} diff --git a/pkg/naming/naming.go b/pkg/naming/naming.go new file mode 100644 index 00000000..abf10f1c --- /dev/null +++ b/pkg/naming/naming.go @@ -0,0 +1,10 @@ +// Copyright 2020 Michael Li . All rights reserved. +// Use of this source code is governed by Apache License 2.0 that +// can be found in the LICENSE file. + +package naming + +// NamingStrategy naming strategy interface +type NamingStrategy interface { + Naming(string) string +} diff --git a/pkg/naming/naming_test.go b/pkg/naming/naming_test.go new file mode 100644 index 00000000..fb89aa97 --- /dev/null +++ b/pkg/naming/naming_test.go @@ -0,0 +1,57 @@ +// Copyright 2020 Michael Li . All rights reserved. +// Use of this source code is governed by Apache License 2.0 that +// can be found in the LICENSE file. + +package naming + +import "testing" + +func TestSnakeNamingStrategy_Naming(t *testing.T) { + ns := NewSnakeNamingStrategy() + for _, cs := range []struct { + name string + expected string + }{ + {name: "abc", expected: "abc"}, + {name: "Abc", expected: "abc"}, + {name: "HostName", expected: "host_name"}, + {name: "Host_Name", expected: "host_name"}, + {name: "RESTfulAPI", expected: "res_tful_api"}, + {name: "HTTPS_API", expected: "https_api"}, + {name: "PKG_Name", expected: "pkg_name"}, + {name: "UserID", expected: "user_id"}, + {name: "UserId", expected: "user_id"}, + {name: "IPLoc", expected: "ip_loc"}, + {name: "API", expected: "api"}, + {name: "HTTP", expected: "http"}, + {name: "IP", expected: "ip"}, + } { + result := ns.Naming(cs.name) + if result != cs.expected { + t.Errorf("give:%s expected:%s result:%s", cs.name, cs.expected, result) + } + } +} + +func TestSimpleNamingStrategy_Naming(t *testing.T) { + ns := NewSimpleNamingStrategy() + for _, cs := range []struct { + name string + expected string + }{ + {name: "abc", expected: "abc"}, + {name: "Abc", expected: "abc"}, + {name: "HostName", expected: "host_name"}, + {name: "Host_Name", expected: "host__name"}, + {name: "RESTfulAPI", expected: "r_e_s_tful_a_p_i"}, + {name: "HTTPS_API", expected: "h_t_t_p_s__a_p_i"}, + {name: "PKG_Name", expected: "p_k_g__name"}, + {name: "API", expected: "a_p_i"}, + {name: "HTTP", expected: "h_t_t_p"}, + } { + result := ns.Naming(cs.name) + if result != cs.expected { + t.Errorf("give:%s expected:%s result:%s", cs.name, cs.expected, result) + } + } +} diff --git a/pkg/naming/simple_ns.go b/pkg/naming/simple_ns.go new file mode 100644 index 00000000..2b4dd733 --- /dev/null +++ b/pkg/naming/simple_ns.go @@ -0,0 +1,37 @@ +// Copyright 2020 Michael Li . All rights reserved. +// Use of this source code is governed by Apache License 2.0 that +// can be found in the LICENSE file. + +package naming + +import ( + "strings" + "unicode" +) + +type simpleNamingStrategy struct { + // just empty +} + +func (s *simpleNamingStrategy) Naming(name string) string { + b := &strings.Builder{} + notFirst := false + b.Grow(len(name) + 3) + for _, r := range name { + if unicode.IsUpper(r) { + if notFirst { + b.WriteRune('_') + } + b.WriteRune(unicode.ToLower(r)) + } else { + b.WriteRune(r) + } + notFirst = true + } + return b.String() +} + +// NewSimpleNamingStrategy return simple naming strategy instance +func NewSimpleNamingStrategy() NamingStrategy { + return &simpleNamingStrategy{} +} diff --git a/pkg/naming/snake_ns.go b/pkg/naming/snake_ns.go new file mode 100644 index 00000000..0c870931 --- /dev/null +++ b/pkg/naming/snake_ns.go @@ -0,0 +1,76 @@ +// Copyright 2020 Michael Li . All rights reserved. +// Use of this source code is governed by Apache License 2.0 that +// can be found in the LICENSE file. + +package naming + +import ( + "bytes" + "strings" +) + +// snakeNamingStrategy snake naming strategy implement +// This implement is inspiration from https://github.com/jingzhu/gorm's naming logic. +type snakeNamingStrategy struct { + initialismsReplacer *strings.Replacer +} + +func (s *snakeNamingStrategy) Naming(name string) string { + if name == "" { + return "" + } + + var lastCase, currCase, nextCase, nextNumber bool + value := s.initialismsReplacer.Replace(name) + buf := bytes.NewBufferString("") + lower, upper := false, true + for i, v := range value[:len(value)-1] { + nextCase = value[i+1] >= 'A' && value[i+1] <= 'Z' + nextNumber = value[i+1] >= '0' && value[i+1] <= '9' + if i > 0 { + if currCase == upper { + if lastCase == upper && (nextCase == upper || nextNumber == upper) { + buf.WriteRune(v) + } else { + if value[i-1] != '_' && value[i+1] != '_' { + buf.WriteRune('_') + } + buf.WriteRune(v) + } + } else { + buf.WriteRune(v) + if i == len(value)-2 && (nextCase == upper && nextNumber == lower) { + buf.WriteRune('_') + } + } + } else { + currCase = upper + buf.WriteRune(v) + } + lastCase, currCase = currCase, nextCase + } + + buf.WriteByte(value[len(value)-1]) + res := strings.ToLower(buf.String()) + return res +} + +// NewSnakeNamingStrategy return snake naming strategy instance +func NewSnakeNamingStrategy() NamingStrategy { + // Copied from golint + initialisms := []string{ + "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", + "HTTPS", "ID", "IP", "JSON", "LHS", "QPS", "RAM", "RHS", "RPC", "SLA", + "SMTP", "SSH", "TLS", "TTL", "UID", "UI", "UUID", "URI", "URL", "UTF8", + "VM", "XML", "XSRF", "XSS"} + + var oldnews []string + for _, initialism := range initialisms { + oldnews = append(oldnews, initialism, strings.Title(strings.ToLower(initialism))) + } + replacer := strings.NewReplacer(oldnews...) + + return &snakeNamingStrategy{ + initialismsReplacer: replacer, + } +} diff --git a/pkg/utils/md5_test.go b/pkg/utils/md5_test.go index d0cf02db..7fa71ed9 100644 --- a/pkg/utils/md5_test.go +++ b/pkg/utils/md5_test.go @@ -40,5 +40,4 @@ var _ = Describe("Md5", Ordered, func() { Expect(utils.EncodeMD5(t.value)).To(Equal(t.md5)) } }) - }) diff --git a/web/dist/assets/404-a99d6dcf.js b/web/dist/assets/404-b795bf4e.js similarity index 79% rename from web/dist/assets/404-a99d6dcf.js rename to web/dist/assets/404-b795bf4e.js index bb484f15..7ad8cfa6 100644 --- a/web/dist/assets/404-a99d6dcf.js +++ b/web/dist/assets/404-b795bf4e.js @@ -1 +1 @@ -import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-8b4e1776.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default}; +import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-08d8af97.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-6332ad63.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default}; diff --git a/web/dist/assets/@vicons-6332ad63.js b/web/dist/assets/@vicons-6332ad63.js new file mode 100644 index 00000000..ec29176c --- /dev/null +++ b/web/dist/assets/@vicons-6332ad63.js @@ -0,0 +1 @@ +import{d as n,o,c as e,a as t,b as i}from"./@vue-e0e89260.js";const c={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},h=t("path",{d:"M216.08 192v143.85a40.08 40.08 0 0 0 80.15 0l.13-188.55a67.94 67.94 0 1 0-135.87 0v189.82a95.51 95.51 0 1 0 191 0V159.74",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),d=[h],jn=n({name:"AttachOutline",render:function(s,l){return o(),e("svg",c,d)}}),a={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},w=t("path",{d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16z",fill:"currentColor"},null,-1),u=[w],Bn=n({name:"Bookmark",render:function(s,l){return o(),e("svg",a,u)}}),_={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},k=t("path",{d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),p=[k],Ln=n({name:"BookmarkOutline",render:function(s,l){return o(),e("svg",_,p)}}),x={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},g=t("path",{d:"M128 80V64a48.14 48.14 0 0 1 48-48h224a48.14 48.14 0 0 1 48 48v368l-80-64",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),m=t("path",{d:"M320 96H112a48.14 48.14 0 0 0-48 48v352l152-128l152 128V144a48.14 48.14 0 0 0-48-48z",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),v=[g,m],Hn=n({name:"BookmarksOutline",render:function(s,l){return o(),e("svg",x,v)}}),$={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},f=t("path",{d:"M408 64H104a56.16 56.16 0 0 0-56 56v192a56.16 56.16 0 0 0 56 56h40v80l93.72-78.14a8 8 0 0 1 5.13-1.86H408a56.16 56.16 0 0 0 56-56V120a56.16 56.16 0 0 0-56-56z",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),C=[f],Vn=n({name:"ChatboxOutline",render:function(s,l){return o(),e("svg",$,C)}}),M={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},O=t("path",{d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a33.68 33.68 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167c-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1c15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.44 26.44 0 0 1 9.3-1.7a26 26 0 0 1 10.1 2l56.7 20.1a13.52 13.52 0 0 0 3.9 1a8 8 0 0 0 8-8a12.85 12.85 0 0 0-.5-2.7z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),z=t("path",{d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.26 7.26 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.21 159.21 0 0 0 284 432.11",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),j=[O,z],An=n({name:"ChatbubblesOutline",render:function(s,l){return o(),e("svg",M,j)}}),B={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},L=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M464 128L240 384l-96-96"},null,-1),H=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M144 384l-96-96"},null,-1),V=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128L232 284"},null,-1),A=[L,H,V],yn=n({name:"CheckmarkDoneOutline",render:function(s,l){return o(),e("svg",B,A)}}),y={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},b=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1),T=[b],bn=n({name:"CheckmarkOutline",render:function(s,l){return o(),e("svg",y,T)}}),D={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},S=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144"},null,-1),E=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 144L144 368"},null,-1),F=[S,E],Tn=n({name:"CloseOutline",render:function(s,l){return o(),e("svg",D,F)}}),P={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},q=t("path",{d:"M320 336h76c55 0 100-21.21 100-75.6s-53-73.47-96-75.6C391.11 99.74 329 48 256 48c-69 0-113.44 45.79-128 91.2c-60 5.7-112 35.88-112 98.4S70 336 136 336h56",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),I=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 400.1l64 63.9l64-63.9"},null,-1),R=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 224v224.03"},null,-1),G=[q,I,R],Dn=n({name:"CloudDownloadOutline",render:function(s,l){return o(),e("svg",P,G)}}),U={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},J=t("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),K=t("path",{d:"M350.67 150.93l-117.2 46.88a64 64 0 0 0-35.66 35.66l-46.88 117.2a8 8 0 0 0 10.4 10.4l117.2-46.88a64 64 0 0 0 35.66-35.66l46.88-117.2a8 8 0 0 0-10.4-10.4zM256 280a24 24 0 1 1 24-24a24 24 0 0 1-24 24z",fill:"currentColor"},null,-1),N=[J,K],Sn=n({name:"CompassOutline",render:function(s,l){return o(),e("svg",U,N)}}),W={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Q=i('',5),X=[Q],En=n({name:"EyeOffOutline",render:function(s,l){return o(),e("svg",W,X)}}),Y={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Z=t("path",{d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t1=t("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),n1=[Z,t1],Fn=n({name:"EyeOutline",render:function(s,l){return o(),e("svg",Y,n1)}}),o1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},e1=t("path",{d:"M112 320c0-93 124-165 96-272c66 0 192 96 192 272a144 144 0 0 1-288 0z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),r1=t("path",{d:"M320 368c0 57.71-32 80-64 80s-64-22.29-64-80s40-86 32-128c42 0 96 70.29 96 128z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),s1=[e1,r1],Pn=n({name:"FlameOutline",render:function(s,l){return o(),e("svg",o1,s1)}}),l1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},i1=t("path",{d:"M256 448a32 32 0 0 1-18-5.57c-78.59-53.35-112.62-89.93-131.39-112.8c-40-48.75-59.15-98.8-58.61-153C48.63 114.52 98.46 64 159.08 64c44.08 0 74.61 24.83 92.39 45.51a6 6 0 0 0 9.06 0C278.31 88.81 308.84 64 352.92 64c60.62 0 110.45 50.52 111.08 112.64c.54 54.21-18.63 104.26-58.61 153c-18.77 22.87-52.8 59.45-131.39 112.8a32 32 0 0 1-18 5.56z",fill:"currentColor"},null,-1),c1=[i1],qn=n({name:"Heart",render:function(s,l){return o(),e("svg",l1,c1)}}),h1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},d1=t("path",{d:"M352.92 80C288 80 256 144 256 144s-32-64-96.92-64c-52.76 0-94.54 44.14-95.08 96.81c-1.1 109.33 86.73 187.08 183 252.42a16 16 0 0 0 18 0c96.26-65.34 184.09-143.09 183-252.42c-.54-52.67-42.32-96.81-95.08-96.81z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),a1=[d1],In=n({name:"HeartOutline",render:function(s,l){return o(),e("svg",h1,a1)}}),w1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},u1=t("path",{d:"M80 212v236a16 16 0 0 0 16 16h96V328a24 24 0 0 1 24-24h80a24 24 0 0 1 24 24v136h96a16 16 0 0 0 16-16V212",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),_1=t("path",{d:"M480 256L266.89 52c-5-5.28-16.69-5.34-21.78 0L32 256",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),k1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 179V64h-48v69"},null,-1),p1=[u1,_1,k1],Rn=n({name:"HomeOutline",render:function(s,l){return o(),e("svg",w1,p1)}}),x1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},g1=t("rect",{x:"48",y:"80",width:"416",height:"352",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),m1=t("circle",{cx:"336",cy:"176",r:"32",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),v1=t("path",{d:"M304 335.79l-90.66-90.49a32 32 0 0 0-43.87-1.3L48 352",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),$1=t("path",{d:"M224 432l123.34-123.34a32 32 0 0 1 43.11-2L464 368",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),f1=[g1,m1,v1,$1],Gn=n({name:"ImageOutline",render:function(s,l){return o(),e("svg",x1,f1)}}),C1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},M1=t("path",{d:"M321.89 171.42C233 114 141 155.22 56 65.22c-19.8-21-8.3 235.5 98.1 332.7c77.79 71 197.9 63.08 238.4-5.92s18.28-163.17-70.61-220.58z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),O1=t("path",{d:"M173 253c86 81 175 129 292 147",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),z1=[M1,O1],Un=n({name:"LeafOutline",render:function(s,l){return o(),e("svg",C1,z1)}}),j1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},B1=t("path",{d:"M208 352h-64a96 96 0 0 1 0-192h64",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36"},null,-1),L1=t("path",{d:"M304 160h64a96 96 0 0 1 0 192h-64",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36"},null,-1),H1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36",d:"M163.29 256h187.42"},null,-1),V1=[B1,L1,H1],Jn=n({name:"LinkOutline",render:function(s,l){return o(),e("svg",j1,V1)}}),A1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},y1=t("path",{d:"M336 208v-95a80 80 0 0 0-160 0v95",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),b1=t("rect",{x:"96",y:"208",width:"320",height:"272",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),T1=[y1,b1],Kn=n({name:"LockClosedOutline",render:function(s,l){return o(),e("svg",A1,T1)}}),D1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},S1=t("path",{d:"M336 112a80 80 0 0 0-160 0v96",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),E1=t("rect",{x:"96",y:"208",width:"320",height:"272",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),F1=[S1,E1],Nn=n({name:"LockOpenOutline",render:function(s,l){return o(),e("svg",D1,F1)}}),P1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},q1=t("path",{d:"M304 336v40a40 40 0 0 1-40 40H104a40 40 0 0 1-40-40V136a40 40 0 0 1 40-40h152c22.09 0 48 17.91 48 40v40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),I1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 336l80-80l-80-80"},null,-1),R1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M176 256h256"},null,-1),G1=[q1,I1,R1],Wn=n({name:"LogOutOutline",render:function(s,l){return o(),e("svg",P1,G1)}}),U1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},J1=t("path",{d:"M102.41 32C62.38 32 32 64.12 32 103.78v304.45C32 447.86 64.38 480 104.41 480h303.2c40 0 72.39-32.14 72.39-71.77v-3.11c-1.35-.56-115.47-48.57-174.5-76.7c-39.82 48.57-91.18 78-144.5 78c-90.18 0-120.8-78.22-78.1-129.72c9.31-11.22 25.15-21.94 49.73-28c38.45-9.36 99.64 5.85 157 24.61a309.41 309.41 0 0 0 25.46-61.67H138.34V194h91.13v-31.83H119.09v-17.75h110.38V99s0-7.65 7.82-7.65h44.55v53H391v17.75H281.84V194h89.08a359.41 359.41 0 0 1-37.72 94.43c27 9.69 49.31 18.88 67.39 24.89c60.32 20 77.23 22.45 79.41 22.7V103.78C480 64.12 447.6 32 407.61 32h-305.2zM152 274.73q-5.81.06-11.67.63c-11.3 1.13-32.5 6.07-44.09 16.23c-34.74 30-13.94 84.93 56.37 84.93c40.87 0 81.71-25.9 113.79-67.37c-41.36-20-77-34.85-114.4-34.42z",fill:"currentColor"},null,-1),K1=[J1],Qn=n({name:"LogoAlipay",render:function(s,l){return o(),e("svg",U1,K1)}}),N1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},W1=i('',6),Q1=[W1],Xn=n({name:"MegaphoneOutline",render:function(s,l){return o(),e("svg",N1,Q1)}}),X1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Y1=t("path",{d:"M402 168c-2.93 40.67-33.1 72-66 72s-63.12-31.32-66-72c-3-42.31 26.37-72 66-72s69 30.46 66 72z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Z1=t("path",{d:"M336 304c-65.17 0-127.84 32.37-143.54 95.41c-2.08 8.34 3.15 16.59 11.72 16.59h263.65c8.57 0 13.77-8.25 11.72-16.59C463.85 335.36 401.18 304 336 304z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),tt=t("path",{d:"M200 185.94c-2.34 32.48-26.72 58.06-53 58.06s-50.7-25.57-53-58.06C91.61 152.15 115.34 128 147 128s55.39 24.77 53 57.94z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),nt=t("path",{d:"M206 306c-18.05-8.27-37.93-11.45-59-11.45c-52 0-102.1 25.85-114.65 76.2c-1.65 6.66 2.53 13.25 9.37 13.25H154",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),ot=[Y1,Z1,tt,nt],Yn=n({name:"PeopleOutline",render:function(s,l){return o(),e("svg",X1,ot)}}),et={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},rt=t("path",{d:"M344 144c-3.92 52.87-44 96-88 96s-84.15-43.12-88-96c-4-55 35-96 88-96s92 42 88 96z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),st=t("path",{d:"M256 304c-87 0-175.3 48-191.64 138.6C62.39 453.52 68.57 464 80 464h352c11.44 0 17.62-10.48 15.65-21.4C431.3 352 343 304 256 304z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),lt=[rt,st],Zn=n({name:"PersonOutline",render:function(s,l){return o(),e("svg",et,lt)}}),it={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ct=t("path",{d:"M336 336h40a40 40 0 0 0 40-40V88a40 40 0 0 0-40-40H136a40 40 0 0 0-40 40v208a40 40 0 0 0 40 40h40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),ht=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M176 240l80-80l80 80"},null,-1),dt=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 464V176"},null,-1),at=[ct,ht,dt],to=n({name:"PushOutline",render:function(s,l){return o(),e("svg",it,at)}}),wt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ut=t("path",{d:"M456.69 421.39L362.6 327.3a173.81 173.81 0 0 0 34.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 0 0 327.3 362.6l94.09 94.09a25 25 0 0 0 35.3-35.3zM97.92 222.72a124.8 124.8 0 1 1 124.8 124.8a124.95 124.95 0 0 1-124.8-124.8z",fill:"currentColor"},null,-1),_t=[ut],no=n({name:"Search",render:function(s,l){return o(),e("svg",wt,_t)}}),kt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},pt=t("path",{d:"M262.29 192.31a64 64 0 1 0 57.4 57.4a64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22a155.3 155.3 0 0 1-21.46-12.57a16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22a155.3 155.3 0 0 1 21.46 12.57a16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),xt=[pt],oo=n({name:"SettingsOutline",render:function(s,l){return o(),e("svg",kt,xt)}}),gt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},mt=t("path",{d:"M336 192h40a40 40 0 0 1 40 40v192a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V232a40 40 0 0 1 40-40h40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),vt=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 128l-80-80l-80 80"},null,-1),$t=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 321V48"},null,-1),ft=[mt,vt,$t],eo=n({name:"ShareOutline",render:function(s,l){return o(),e("svg",gt,ft)}}),Ct={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Mt=i('',5),Ot=[Mt],ro=n({name:"ShareSocialOutline",render:function(s,l){return o(),e("svg",Ct,Ot)}}),zt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},jt=i('',6),Bt=[jt],so=n({name:"TrashOutline",render:function(s,l){return o(),e("svg",zt,Bt)}}),Lt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Ht=t("path",{d:"M374.79 308.78L457.5 367a16 16 0 0 0 22.5-14.62V159.62A16 16 0 0 0 457.5 145l-82.71 58.22A16 16 0 0 0 368 216.3v79.4a16 16 0 0 0 6.79 13.08z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Vt=t("path",{d:"M268 384H84a52.15 52.15 0 0 1-52-52V180a52.15 52.15 0 0 1 52-52h184.48A51.68 51.68 0 0 1 320 179.52V332a52.15 52.15 0 0 1-52 52z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),At=[Ht,Vt],lo=n({name:"VideocamOutline",render:function(s,l){return o(),e("svg",Lt,At)}}),yt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},bt=t("rect",{x:"48",y:"144",width:"416",height:"288",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),Tt=t("path",{d:"M411.36 144v-30A50 50 0 0 0 352 64.9L88.64 109.85A50 50 0 0 0 48 159v49",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),Dt=t("path",{d:"M368 320a32 32 0 1 1 32-32a32 32 0 0 1-32 32z",fill:"currentColor"},null,-1),St=[bt,Tt,Dt],io=n({name:"WalletOutline",render:function(s,l){return o(),e("svg",yt,St)}}),Et={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Ft=t("g",{fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("path",{d:"M9 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-3"}),t("path",{d:"M9 15h3l8.5-8.5a1.5 1.5 0 0 0-3-3L9 12v3"}),t("path",{d:"M16 5l3 3"})],-1),Pt=[Ft],co=n({name:"Edit",render:function(s,l){return o(),e("svg",Et,Pt)}}),qt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},It=i('',1),Rt=[It],ho=n({name:"Hash",render:function(s,l){return o(),e("svg",qt,Rt)}}),Gt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Ut=i('',1),Jt=[Ut],ao=n({name:"Trash",render:function(s,l){return o(),e("svg",Gt,Jt)}}),Kt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Nt=t("path",{d:"M14.71 6.71a.996.996 0 0 0-1.41 0L8.71 11.3a.996.996 0 0 0 0 1.41l4.59 4.59a.996.996 0 1 0 1.41-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z",fill:"currentColor"},null,-1),Wt=[Nt],wo=n({name:"ChevronLeftRound",render:function(s,l){return o(),e("svg",Kt,Wt)}}),Qt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Xt=t("path",{d:"M9.37 5.51A7.35 7.35 0 0 0 9.1 7.5c0 4.08 3.32 7.4 7.4 7.4c.68 0 1.35-.09 1.99-.27A7.014 7.014 0 0 1 12 19c-3.86 0-7-3.14-7-7c0-2.93 1.81-5.45 4.37-6.49zM12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26a5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z",fill:"currentColor"},null,-1),Yt=[Xt],uo=n({name:"DarkModeOutlined",render:function(s,l){return o(),e("svg",Qt,Yt)}}),Zt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},tn=t("path",{d:"M2 17c0 .55.45 1 1 1h18c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1zm0-5c0 .55.45 1 1 1h18c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1zm0-5c0 .55.45 1 1 1h18c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1z",fill:"currentColor"},null,-1),nn=[tn],_o=n({name:"DehazeRound",render:function(s,l){return o(),e("svg",Zt,nn)}}),on={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},en=t("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3s-3-1.35-3-3s1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5s5-2.24 5-5s-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0a.996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0a.996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41a.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41a.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z",fill:"currentColor"},null,-1),rn=[en],ko=n({name:"LightModeOutlined",render:function(s,l){return o(),e("svg",on,rn)}}),sn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},ln=t("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z",fill:"currentColor"},null,-1),cn=[ln],po=n({name:"MoreHorizFilled",render:function(s,l){return o(),e("svg",sn,cn)}}),hn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},dn=t("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2s-2 .9-2 2s.9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z",fill:"currentColor"},null,-1),an=[dn],xo=n({name:"MoreVertOutlined",render:function(s,l){return o(),e("svg",hn,an)}}),wn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},un=t("path",{d:"M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57l-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12l-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h4v12h-4z",fill:"currentColor"},null,-1),_n=[un],go=n({name:"ThumbDownOutlined",render:function(s,l){return o(),e("svg",wn,_n)}}),kn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},pn=t("path",{opacity:".3",d:"M3 12v2h9l-1.34 5.34L15 15V5H6z",fill:"currentColor"},null,-1),xn=t("path",{d:"M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57l-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12l-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h4v12h-4z",fill:"currentColor"},null,-1),gn=[pn,xn],mo=n({name:"ThumbDownTwotone",render:function(s,l){return o(),e("svg",kn,gn)}}),mn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},vn=t("path",{d:"M9 21h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2h-6.31l.95-4.57l.03-.32c0-.41-.17-.79-.44-1.06L14.17 1L7.58 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2zM9 9l4.34-4.34L12 10h9v2l-3 7H9V9zM1 9h4v12H1z",fill:"currentColor"},null,-1),$n=[vn],vo=n({name:"ThumbUpOutlined",render:function(s,l){return o(),e("svg",mn,$n)}}),fn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Cn=t("path",{opacity:".3",d:"M21 12v-2h-9l1.34-5.34L9 9v10h9z",fill:"currentColor"},null,-1),Mn=t("path",{d:"M9 21h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2h-6.31l.95-4.57l.03-.32c0-.41-.17-.79-.44-1.06L14.17 1L7.58 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2zM9 9l4.34-4.34L12 10h9v2l-3 7H9V9zM1 9h4v12H1z",fill:"currentColor"},null,-1),On=[Cn,Mn],$o=n({name:"ThumbUpTwotone",render:function(s,l){return o(),e("svg",fn,On)}});export{jn as A,Hn as B,An as C,Jn as D,Fn as E,Pn as F,Dn as G,Rn as H,Gn as I,Qn as J,co as K,Un as L,Xn as M,_o as N,wo as O,Yn as P,ko as Q,uo as R,no as S,ao as T,lo as V,io as W,oo as a,ho as b,Wn as c,Sn as d,vo as e,$o as f,go as g,mo as h,po as i,In as j,qn as k,Vn as l,Ln as m,Bn as n,ro as o,so as p,Kn as q,Nn as r,to as s,En as t,Zn as u,xo as v,eo as w,bn as x,Tn as y,yn as z}; diff --git a/web/dist/assets/@vicons-d502290a.js b/web/dist/assets/@vicons-d502290a.js deleted file mode 100644 index 48891a75..00000000 --- a/web/dist/assets/@vicons-d502290a.js +++ /dev/null @@ -1 +0,0 @@ -import{d as n,o,c as e,a as t,b as i}from"./@vue-e0e89260.js";const c={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},h=t("path",{d:"M216.08 192v143.85a40.08 40.08 0 0 0 80.15 0l.13-188.55a67.94 67.94 0 1 0-135.87 0v189.82a95.51 95.51 0 1 0 191 0V159.74",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),d=[h],Zt=n({name:"AttachOutline",render:function(s,l){return o(),e("svg",c,d)}}),a={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},w=t("path",{d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16z",fill:"currentColor"},null,-1),u=[w],tn=n({name:"Bookmark",render:function(s,l){return o(),e("svg",a,u)}}),_={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},k=t("path",{d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),x=[k],nn=n({name:"BookmarkOutline",render:function(s,l){return o(),e("svg",_,x)}}),p={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},m=t("path",{d:"M128 80V64a48.14 48.14 0 0 1 48-48h224a48.14 48.14 0 0 1 48 48v368l-80-64",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),g=t("path",{d:"M320 96H112a48.14 48.14 0 0 0-48 48v352l152-128l152 128V144a48.14 48.14 0 0 0-48-48z",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),v=[m,g],on=n({name:"BookmarksOutline",render:function(s,l){return o(),e("svg",p,v)}}),$={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},f=t("path",{d:"M408 64H104a56.16 56.16 0 0 0-56 56v192a56.16 56.16 0 0 0 56 56h40v80l93.72-78.14a8 8 0 0 1 5.13-1.86H408a56.16 56.16 0 0 0 56-56V120a56.16 56.16 0 0 0-56-56z",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),C=[f],en=n({name:"ChatboxOutline",render:function(s,l){return o(),e("svg",$,C)}}),M={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},z=t("path",{d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a33.68 33.68 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167c-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1c15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.44 26.44 0 0 1 9.3-1.7a26 26 0 0 1 10.1 2l56.7 20.1a13.52 13.52 0 0 0 3.9 1a8 8 0 0 0 8-8a12.85 12.85 0 0 0-.5-2.7z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),O=t("path",{d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.26 7.26 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.21 159.21 0 0 0 284 432.11",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),j=[z,O],rn=n({name:"ChatbubblesOutline",render:function(s,l){return o(),e("svg",M,j)}}),B={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},L=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M464 128L240 384l-96-96"},null,-1),H=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M144 384l-96-96"},null,-1),V=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128L232 284"},null,-1),A=[L,H,V],sn=n({name:"CheckmarkDoneOutline",render:function(s,l){return o(),e("svg",B,A)}}),b={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},y=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1),S=[y],ln=n({name:"CheckmarkOutline",render:function(s,l){return o(),e("svg",b,S)}}),D={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},T=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144"},null,-1),E=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 144L144 368"},null,-1),q=[T,E],cn=n({name:"CloseOutline",render:function(s,l){return o(),e("svg",D,q)}}),R={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},U=t("path",{d:"M320 336h76c55 0 100-21.21 100-75.6s-53-73.47-96-75.6C391.11 99.74 329 48 256 48c-69 0-113.44 45.79-128 91.2c-60 5.7-112 35.88-112 98.4S70 336 136 336h56",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),F=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 400.1l64 63.9l64-63.9"},null,-1),I=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 224v224.03"},null,-1),P=[U,F,I],hn=n({name:"CloudDownloadOutline",render:function(s,l){return o(),e("svg",R,P)}}),W={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},N=t("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),G=t("path",{d:"M350.67 150.93l-117.2 46.88a64 64 0 0 0-35.66 35.66l-46.88 117.2a8 8 0 0 0 10.4 10.4l117.2-46.88a64 64 0 0 0 35.66-35.66l46.88-117.2a8 8 0 0 0-10.4-10.4zM256 280a24 24 0 1 1 24-24a24 24 0 0 1-24 24z",fill:"currentColor"},null,-1),J=[N,G],dn=n({name:"CompassOutline",render:function(s,l){return o(),e("svg",W,J)}}),K={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Q=t("path",{d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),X=t("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Y=[Q,X],an=n({name:"EyeOutline",render:function(s,l){return o(),e("svg",K,Y)}}),Z={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},t1=t("path",{d:"M256 448a32 32 0 0 1-18-5.57c-78.59-53.35-112.62-89.93-131.39-112.8c-40-48.75-59.15-98.8-58.61-153C48.63 114.52 98.46 64 159.08 64c44.08 0 74.61 24.83 92.39 45.51a6 6 0 0 0 9.06 0C278.31 88.81 308.84 64 352.92 64c60.62 0 110.45 50.52 111.08 112.64c.54 54.21-18.63 104.26-58.61 153c-18.77 22.87-52.8 59.45-131.39 112.8a32 32 0 0 1-18 5.56z",fill:"currentColor"},null,-1),n1=[t1],wn=n({name:"Heart",render:function(s,l){return o(),e("svg",Z,n1)}}),o1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},e1=t("path",{d:"M352.92 80C288 80 256 144 256 144s-32-64-96.92-64c-52.76 0-94.54 44.14-95.08 96.81c-1.1 109.33 86.73 187.08 183 252.42a16 16 0 0 0 18 0c96.26-65.34 184.09-143.09 183-252.42c-.54-52.67-42.32-96.81-95.08-96.81z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),r1=[e1],un=n({name:"HeartOutline",render:function(s,l){return o(),e("svg",o1,r1)}}),s1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},l1=t("path",{d:"M80 212v236a16 16 0 0 0 16 16h96V328a24 24 0 0 1 24-24h80a24 24 0 0 1 24 24v136h96a16 16 0 0 0 16-16V212",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i1=t("path",{d:"M480 256L266.89 52c-5-5.28-16.69-5.34-21.78 0L32 256",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),c1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 179V64h-48v69"},null,-1),h1=[l1,i1,c1],_n=n({name:"HomeOutline",render:function(s,l){return o(),e("svg",s1,h1)}}),d1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},a1=t("rect",{x:"48",y:"80",width:"416",height:"352",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),w1=t("circle",{cx:"336",cy:"176",r:"32",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),u1=t("path",{d:"M304 335.79l-90.66-90.49a32 32 0 0 0-43.87-1.3L48 352",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),_1=t("path",{d:"M224 432l123.34-123.34a32 32 0 0 1 43.11-2L464 368",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),k1=[a1,w1,u1,_1],kn=n({name:"ImageOutline",render:function(s,l){return o(),e("svg",d1,k1)}}),x1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},p1=t("path",{d:"M321.89 171.42C233 114 141 155.22 56 65.22c-19.8-21-8.3 235.5 98.1 332.7c77.79 71 197.9 63.08 238.4-5.92s18.28-163.17-70.61-220.58z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),m1=t("path",{d:"M173 253c86 81 175 129 292 147",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),g1=[p1,m1],xn=n({name:"LeafOutline",render:function(s,l){return o(),e("svg",x1,g1)}}),v1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},$1=t("path",{d:"M208 352h-64a96 96 0 0 1 0-192h64",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36"},null,-1),f1=t("path",{d:"M304 160h64a96 96 0 0 1 0 192h-64",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36"},null,-1),C1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36",d:"M163.29 256h187.42"},null,-1),M1=[$1,f1,C1],pn=n({name:"LinkOutline",render:function(s,l){return o(),e("svg",v1,M1)}}),z1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},O1=t("path",{d:"M304 336v40a40 40 0 0 1-40 40H104a40 40 0 0 1-40-40V136a40 40 0 0 1 40-40h152c22.09 0 48 17.91 48 40v40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),j1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 336l80-80l-80-80"},null,-1),B1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M176 256h256"},null,-1),L1=[O1,j1,B1],mn=n({name:"LogOutOutline",render:function(s,l){return o(),e("svg",z1,L1)}}),H1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},V1=t("path",{d:"M102.41 32C62.38 32 32 64.12 32 103.78v304.45C32 447.86 64.38 480 104.41 480h303.2c40 0 72.39-32.14 72.39-71.77v-3.11c-1.35-.56-115.47-48.57-174.5-76.7c-39.82 48.57-91.18 78-144.5 78c-90.18 0-120.8-78.22-78.1-129.72c9.31-11.22 25.15-21.94 49.73-28c38.45-9.36 99.64 5.85 157 24.61a309.41 309.41 0 0 0 25.46-61.67H138.34V194h91.13v-31.83H119.09v-17.75h110.38V99s0-7.65 7.82-7.65h44.55v53H391v17.75H281.84V194h89.08a359.41 359.41 0 0 1-37.72 94.43c27 9.69 49.31 18.88 67.39 24.89c60.32 20 77.23 22.45 79.41 22.7V103.78C480 64.12 447.6 32 407.61 32h-305.2zM152 274.73q-5.81.06-11.67.63c-11.3 1.13-32.5 6.07-44.09 16.23c-34.74 30-13.94 84.93 56.37 84.93c40.87 0 81.71-25.9 113.79-67.37c-41.36-20-77-34.85-114.4-34.42z",fill:"currentColor"},null,-1),A1=[V1],gn=n({name:"LogoAlipay",render:function(s,l){return o(),e("svg",H1,A1)}}),b1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},y1=i('',6),S1=[y1],vn=n({name:"MegaphoneOutline",render:function(s,l){return o(),e("svg",b1,S1)}}),D1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},T1=t("path",{d:"M402 168c-2.93 40.67-33.1 72-66 72s-63.12-31.32-66-72c-3-42.31 26.37-72 66-72s69 30.46 66 72z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),E1=t("path",{d:"M336 304c-65.17 0-127.84 32.37-143.54 95.41c-2.08 8.34 3.15 16.59 11.72 16.59h263.65c8.57 0 13.77-8.25 11.72-16.59C463.85 335.36 401.18 304 336 304z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),q1=t("path",{d:"M200 185.94c-2.34 32.48-26.72 58.06-53 58.06s-50.7-25.57-53-58.06C91.61 152.15 115.34 128 147 128s55.39 24.77 53 57.94z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),R1=t("path",{d:"M206 306c-18.05-8.27-37.93-11.45-59-11.45c-52 0-102.1 25.85-114.65 76.2c-1.65 6.66 2.53 13.25 9.37 13.25H154",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),U1=[T1,E1,q1,R1],$n=n({name:"PeopleOutline",render:function(s,l){return o(),e("svg",D1,U1)}}),F1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},I1=t("path",{d:"M456.69 421.39L362.6 327.3a173.81 173.81 0 0 0 34.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 0 0 327.3 362.6l94.09 94.09a25 25 0 0 0 35.3-35.3zM97.92 222.72a124.8 124.8 0 1 1 124.8 124.8a124.95 124.95 0 0 1-124.8-124.8z",fill:"currentColor"},null,-1),P1=[I1],fn=n({name:"Search",render:function(s,l){return o(),e("svg",F1,P1)}}),W1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},N1=t("path",{d:"M262.29 192.31a64 64 0 1 0 57.4 57.4a64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22a155.3 155.3 0 0 1-21.46-12.57a16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22a155.3 155.3 0 0 1 21.46 12.57a16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),G1=[N1],Cn=n({name:"SettingsOutline",render:function(s,l){return o(),e("svg",W1,G1)}}),J1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},K1=t("path",{d:"M336 192h40a40 40 0 0 1 40 40v192a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V232a40 40 0 0 1 40-40h40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Q1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 128l-80-80l-80 80"},null,-1),X1=t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 321V48"},null,-1),Y1=[K1,Q1,X1],Mn=n({name:"ShareOutline",render:function(s,l){return o(),e("svg",J1,Y1)}}),Z1={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},tt=i('',5),nt=[tt],zn=n({name:"ShareSocialOutline",render:function(s,l){return o(),e("svg",Z1,nt)}}),ot={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},et=t("path",{d:"M374.79 308.78L457.5 367a16 16 0 0 0 22.5-14.62V159.62A16 16 0 0 0 457.5 145l-82.71 58.22A16 16 0 0 0 368 216.3v79.4a16 16 0 0 0 6.79 13.08z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),rt=t("path",{d:"M268 384H84a52.15 52.15 0 0 1-52-52V180a52.15 52.15 0 0 1 52-52h184.48A51.68 51.68 0 0 1 320 179.52V332a52.15 52.15 0 0 1-52 52z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),st=[et,rt],On=n({name:"VideocamOutline",render:function(s,l){return o(),e("svg",ot,st)}}),lt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},it=t("rect",{x:"48",y:"144",width:"416",height:"288",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),ct=t("path",{d:"M411.36 144v-30A50 50 0 0 0 352 64.9L88.64 109.85A50 50 0 0 0 48 159v49",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),ht=t("path",{d:"M368 320a32 32 0 1 1 32-32a32 32 0 0 1-32 32z",fill:"currentColor"},null,-1),dt=[it,ct,ht],jn=n({name:"WalletOutline",render:function(s,l){return o(),e("svg",lt,dt)}}),at={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},wt=t("g",{fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("path",{d:"M9 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-3"}),t("path",{d:"M9 15h3l8.5-8.5a1.5 1.5 0 0 0-3-3L9 12v3"}),t("path",{d:"M16 5l3 3"})],-1),ut=[wt],Bn=n({name:"Edit",render:function(s,l){return o(),e("svg",at,ut)}}),_t={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},kt=i('',1),xt=[kt],Ln=n({name:"Hash",render:function(s,l){return o(),e("svg",_t,xt)}}),pt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},mt=i('',1),gt=[mt],Hn=n({name:"Trash",render:function(s,l){return o(),e("svg",pt,gt)}}),vt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},$t=t("path",{d:"M14.71 6.71a.996.996 0 0 0-1.41 0L8.71 11.3a.996.996 0 0 0 0 1.41l4.59 4.59a.996.996 0 1 0 1.41-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z",fill:"currentColor"},null,-1),ft=[$t],Vn=n({name:"ChevronLeftRound",render:function(s,l){return o(),e("svg",vt,ft)}}),Ct={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Mt=t("path",{d:"M9.37 5.51A7.35 7.35 0 0 0 9.1 7.5c0 4.08 3.32 7.4 7.4 7.4c.68 0 1.35-.09 1.99-.27A7.014 7.014 0 0 1 12 19c-3.86 0-7-3.14-7-7c0-2.93 1.81-5.45 4.37-6.49zM12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26a5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z",fill:"currentColor"},null,-1),zt=[Mt],An=n({name:"DarkModeOutlined",render:function(s,l){return o(),e("svg",Ct,zt)}}),Ot={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},jt=t("path",{d:"M2 17c0 .55.45 1 1 1h18c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1zm0-5c0 .55.45 1 1 1h18c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1zm0-5c0 .55.45 1 1 1h18c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1z",fill:"currentColor"},null,-1),Bt=[jt],bn=n({name:"DehazeRound",render:function(s,l){return o(),e("svg",Ot,Bt)}}),Lt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Ht=t("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3s-3-1.35-3-3s1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5s5-2.24 5-5s-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0a.996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0a.996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41a.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41a.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z",fill:"currentColor"},null,-1),Vt=[Ht],yn=n({name:"LightModeOutlined",render:function(s,l){return o(),e("svg",Lt,Vt)}}),At={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},bt=t("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z",fill:"currentColor"},null,-1),yt=[bt],Sn=n({name:"MoreHorizFilled",render:function(s,l){return o(),e("svg",At,yt)}}),St={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Dt=t("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2s-2 .9-2 2s.9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z",fill:"currentColor"},null,-1),Tt=[Dt],Dn=n({name:"MoreVertOutlined",render:function(s,l){return o(),e("svg",St,Tt)}}),Et={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},qt=t("path",{d:"M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57l-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12l-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h4v12h-4z",fill:"currentColor"},null,-1),Rt=[qt],Tn=n({name:"ThumbDownOutlined",render:function(s,l){return o(),e("svg",Et,Rt)}}),Ut={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Ft=t("path",{opacity:".3",d:"M3 12v2h9l-1.34 5.34L15 15V5H6z",fill:"currentColor"},null,-1),It=t("path",{d:"M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57l-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12l-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h4v12h-4z",fill:"currentColor"},null,-1),Pt=[Ft,It],En=n({name:"ThumbDownTwotone",render:function(s,l){return o(),e("svg",Ut,Pt)}}),Wt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Nt=t("path",{d:"M9 21h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2h-6.31l.95-4.57l.03-.32c0-.41-.17-.79-.44-1.06L14.17 1L7.58 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2zM9 9l4.34-4.34L12 10h9v2l-3 7H9V9zM1 9h4v12H1z",fill:"currentColor"},null,-1),Gt=[Nt],qn=n({name:"ThumbUpOutlined",render:function(s,l){return o(),e("svg",Wt,Gt)}}),Jt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Kt=t("path",{opacity:".3",d:"M21 12v-2h-9l1.34-5.34L9 9v10h9z",fill:"currentColor"},null,-1),Qt=t("path",{d:"M9 21h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2h-6.31l.95-4.57l.03-.32c0-.41-.17-.79-.44-1.06L14.17 1L7.58 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2zM9 9l4.34-4.34L12 10h9v2l-3 7H9V9zM1 9h4v12H1z",fill:"currentColor"},null,-1),Xt=[Kt,Qt],Rn=n({name:"ThumbUpTwotone",render:function(s,l){return o(),e("svg",Jt,Xt)}});export{Zt as A,on as B,rn as C,bn as D,an as E,An as F,_n as H,kn as I,xn as L,vn as M,$n as P,fn as S,Hn as T,On as V,jn as W,Cn as a,Ln as b,mn as c,dn as d,qn as e,Rn as f,Tn as g,En as h,Sn as i,un as j,wn as k,en as l,nn as m,tn as n,zn as o,Dn as p,Mn as q,ln as r,cn as s,sn as t,pn as u,hn as v,gn as w,Bn as x,Vn as y,yn as z}; diff --git a/web/dist/assets/Anouncement-70463bac.js b/web/dist/assets/Anouncement-f0afd211.js similarity index 88% rename from web/dist/assets/Anouncement-70463bac.js rename to web/dist/assets/Anouncement-f0afd211.js index 476a4cb0..fd2ff56c 100644 --- a/web/dist/assets/Anouncement-70463bac.js +++ b/web/dist/assets/Anouncement-f0afd211.js @@ -1 +1 @@ -import{_ as F}from"./post-skeleton-627d3fc3.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-8b4e1776.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",H,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default}; +import{_ as F}from"./post-skeleton-41befd31.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-08d8af97.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-6332ad63.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",H,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default}; diff --git a/web/dist/assets/Collection-c6d4e201.js b/web/dist/assets/Collection-c6d4e201.js deleted file mode 100644 index 914852e4..00000000 --- a/web/dist/assets/Collection-c6d4e201.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-cf654b7f.js";import{_ as V}from"./post-skeleton-627d3fc3.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as I}from"./vuex-473b3783.js";import{b as N}from"./vue-router-b8e3382f.js";import{K as R,_ as j}from"./index-8b4e1776.js";import{d as q,r as s,j as E,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as G,G as H,I as K,H as L}from"./naive-ui-62663ad7.js";import"./content-c0ce69b7.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const O={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={key:1},A={key:2},D={key:0,class:"pagination-wrap"},J=q({__name:"Collection",setup(W){const m=I(),y=N(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,R({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return E(()=>{u()}),(n,X)=>{const C=$,b=V,x=K,z=P,d=L,B=S,F=G,M=H;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",O,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",Q,[i.value.length===0?(t(),o("div",T,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",U,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",D,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Mt=j(J,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default}; diff --git a/web/dist/assets/Collection-d33c7999.js b/web/dist/assets/Collection-d33c7999.js new file mode 100644 index 00000000..58fc147c --- /dev/null +++ b/web/dist/assets/Collection-d33c7999.js @@ -0,0 +1 @@ +import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js";import{_ as V}from"./post-skeleton-41befd31.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as I}from"./vuex-473b3783.js";import{b as L}from"./vue-router-b8e3382f.js";import{L as N,_ as R}from"./index-08d8af97.js";import{d as j,r as s,j as q,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as E,G,I as H,H as O}from"./naive-ui-62663ad7.js";import"./content-91ba374b.js";import"./@vicons-6332ad63.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Q={key:0,class:"skeleton-wrap"},T={key:1},U={key:0,class:"empty-wrap"},A={key:1},D={key:2},J={key:0,class:"pagination-wrap"},K=j({__name:"Collection",setup(W){const m=I(),y=L(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,N({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return q(()=>{u()}),(n,X)=>{const C=$,b=V,x=H,z=P,d=O,B=S,F=E,M=G;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",Q,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",T,[i.value.length===0?(t(),o("div",U,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",D,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",J,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Mt=R(K,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default}; diff --git a/web/dist/assets/Contacts-89899ea7.js b/web/dist/assets/Contacts-86a6f430.js similarity index 67% rename from web/dist/assets/Contacts-89899ea7.js rename to web/dist/assets/Contacts-86a6f430.js index dfa5b31d..01db5c75 100644 --- a/web/dist/assets/Contacts-89899ea7.js +++ b/web/dist/assets/Contacts-86a6f430.js @@ -1 +1 @@ -import{u as M,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as T,I as j,H as E}from"./naive-ui-62663ad7.js";import{_ as b,N as G}from"./index-8b4e1776.js";import{_ as H}from"./post-skeleton-627d3fc3.js";import{_ as L}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as O}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-d502290a.js";/* empty css */const Q={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=M(),u=t=>{l.push({name:"user",query:{username:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",Q,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-08ee9b2e"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=O(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),G({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=L,I=H,z=j,B=X,N=E,V=D,F=T;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(V,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(N,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(F,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default}; +import{u as N,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as O,I as T,H as j}from"./naive-ui-62663ad7.js";import{_ as b,O as E}from"./index-08d8af97.js";import{_ as G}from"./post-skeleton-41befd31.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as L}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-6332ad63.js";/* empty css */const Q={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=N(),u=t=>{l.push({name:"user",query:{username:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",Q,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-08ee9b2e"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=L(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),E({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=H,I=G,z=T,B=X,V=j,F=D,M=O;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(V,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(M,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default}; diff --git a/web/dist/assets/Home-369fedb9.js b/web/dist/assets/Home-ab2e462e.js similarity index 97% rename from web/dist/assets/Home-369fedb9.js rename to web/dist/assets/Home-ab2e462e.js index 8e9ac1fe..8eb86715 100644 --- a/web/dist/assets/Home-369fedb9.js +++ b/web/dist/assets/Home-ab2e462e.js @@ -1 +1 @@ -import{_ as Te,a as qe}from"./post-item.vue_vue_type_style_index_0_lang-cf654b7f.js";import{_ as xe}from"./post-skeleton-627d3fc3.js";import{d as Y,r as i,j as ee,o as c,c as v,_ as $,a as x,V as a,a1 as s,Q as L,O as T,a2 as Z,e as S,M as X,F as K,a4 as J,n as Ie,w as ze}from"./@vue-e0e89260.js";import{u as te}from"./vuex-473b3783.js";import{l as W}from"./lodash-94eb5868.js";import{g as Ue,a as Re,c as Ae,b as Ee,_ as Pe}from"./index-8b4e1776.js";import{p as Se}from"./content-c0ce69b7.js";import{V as z,P as N}from"./IEnum-a180d93e.js";import{I as Le,V as Ve,A as Ne,d as Fe,E as Be}from"./@vicons-d502290a.js";import{o as Me,v as Oe,j as je,e as De,w as He,x as Ge,y as Ke,z as Je,A as Qe,B as Ze,C as Xe,a as We,D as Ye,E as et,F as tt,G as at,H as ot,I as nt}from"./naive-ui-62663ad7.js";import{_ as st}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{b as lt,u as it}from"./vue-router-b8e3382f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./paopao-video-player-aa5e8b3f.js";const rt=F=>{const q=new FileReader,r=_=>["application/zip","application/x-zip","application/octet-stream","application/x-zip-compressed"].includes(_),I=()=>{const _=new Uint8Array(q.result).subarray(0,4);let d="";for(let p=0;p<_.length;p++)d+=_[p].toString(16);switch(d){case"504b0304":case"504b0506":case"504b0708":return r("application/zip");case"504b030414":return r("application/x-zip-compressed");case"504b0508":return r("application/x-zip");case"504b5370":return r("application/octet-stream");default:return!1}};return new Promise((_,d)=>{q.onloadend=()=>{const p=F.type;_(p===""||p==="application/octet-stream"?I():r(p))},q.readAsArrayBuffer(F.slice(0,4))})},ut={key:0,class:"compose-wrap"},ct={class:"compose-line"},pt={class:"compose-user"},_t={class:"compose-line compose-options"},dt={class:"attachment"},mt={class:"submit-wrap"},vt={class:"attachment-list-wrap"},gt={key:0,class:"attachment-price-wrap"},ft=x("span",null," 附件价格¥",-1),yt={key:0,class:"eye-wrap"},ht={key:1,class:"link-wrap"},wt={key:1,class:"compose-wrap"},bt=x("div",{class:"login-wrap"},[x("span",{class:"login-banner"}," 登录后,精彩更多")],-1),kt={key:0,class:"login-only-wrap"},Ct={key:1,class:"login-wrap"},$t=Y({__name:"compose",emits:["post-success"],setup(F,{emit:q}){const r=te(),I=i([]),_=i(!1),d=i(!1),p=i(!1),b=i(!1),w=i(""),U=i([]),E=i(),V=i(0),f=i("public/image"),u=i([]),h=i([]),k=i([]),y=i([]),C=i(z.FRIEND),R=i(z.FRIEND),M=[{value:z.PUBLIC,label:"公开"},{value:z.PRIVATE,label:"私密"},{value:z.FRIEND,label:"好友可见"}],P=+"400",B=i("true".toLowerCase()==="true"),O=i("true".toLowerCase()==="true"),j=i("true".toLowerCase()==="true"),A=i("false".toLowerCase()==="true"),ae=i("true".toLowerCase()==="true"),oe="/v1/attachment",Q=i(),ne=()=>{p.value=!p.value,p.value&&b.value&&(b.value=!1)},se=()=>{b.value=!b.value,b.value&&p.value&&(p.value=!1)},le=W.debounce(t=>{Ue({k:t}).then(e=>{let n=[];e.suggest.map(o=>{n.push({label:o,value:o})}),I.value=n,_.value=!1}).catch(e=>{_.value=!1})},200),ie=W.debounce(t=>{Re({k:t}).then(e=>{let n=[];e.suggest.map(o=>{n.push({label:o,value:o})}),I.value=n,_.value=!1}).catch(e=>{_.value=!1})},200),re=(t,e)=>{_.value||(_.value=!0,e==="@"?le(t):ie(t))},ue=t=>{t.length>P?w.value=t.substring(0,P):w.value=t},D=t=>{f.value=t},ce=t=>{for(let l=0;l30&&(t[l].name=n.substring(0,18)+"..."+n.substring(n.length-9)+"."+o)}u.value=t},pe=async t=>{var e,n,o,l,g;return f.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((e=t.file.file)==null?void 0:e.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):f.value==="image"&&((n=t.file.file)==null?void 0:n.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):f.value==="public/video"&&!["video/mp4","video/quicktime"].includes((o=t.file.file)==null?void 0:o.type)?(window.$message.warning("视频仅允许 mp4/mov 格式"),!1):f.value==="public/video"&&((l=t.file.file)==null?void 0:l.size)>104857600?(window.$message.warning("视频大小不能超过100MB"),!1):f.value==="attachment"&&!await rt(t.file.file)?(window.$message.warning("附件仅允许 zip 格式"),!1):f.value==="attachment"&&((g=t.file.file)==null?void 0:g.size)>104857600?(window.$message.warning("附件大小不能超过100MB"),!1):!0},_e=({file:t,event:e})=>{var n;try{let o=JSON.parse((n=e.target)==null?void 0:n.response);o.code===0&&(f.value==="public/image"&&h.value.push({id:t.id,content:o.data.content}),f.value==="public/video"&&k.value.push({id:t.id,content:o.data.content}),f.value==="attachment"&&y.value.push({id:t.id,content:o.data.content}))}catch{window.$message.error("上传失败")}},de=({file:t,event:e})=>{var n;try{let o=JSON.parse((n=e.target)==null?void 0:n.response);if(o.code!==0){let l=o.msg||"上传失败";o.details&&o.details.length>0&&o.details.map(g=>{l+=":"+g}),window.$message.error(l)}}catch{window.$message.error("上传失败")}},me=({file:t})=>{let e=h.value.findIndex(n=>n.id===t.id);e>-1&&h.value.splice(e,1),e=k.value.findIndex(n=>n.id===t.id),e>-1&&k.value.splice(e,1),e=y.value.findIndex(n=>n.id===t.id),e>-1&&y.value.splice(e,1)},ve=()=>{if(w.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{tags:t,users:e}=Se(w.value);const n=[];let o=100;n.push({content:w.value,type:N.TEXT,sort:o}),h.value.map(l=>{o++,n.push({content:l.content,type:N.IMAGEURL,sort:o})}),k.value.map(l=>{o++,n.push({content:l.content,type:N.VIDEOURL,sort:o})}),y.value.map(l=>{o++,n.push({content:l.content,type:N.ATTACHMENT,sort:o})}),U.value.length>0&&U.value.map(l=>{o++,n.push({content:l,type:N.LINKURL,sort:o})}),d.value=!0,Ae({contents:n,tags:Array.from(new Set(t)),users:Array.from(new Set(e)),attachment_price:+V.value*100,visibility:C.value}).then(l=>{var g;window.$message.success("发布成功"),d.value=!1,q("post-success",l),p.value=!1,b.value=!1,(g=E.value)==null||g.clear(),u.value=[],w.value="",U.value=[],h.value=[],k.value=[],y.value=[],C.value=R.value}).catch(l=>{d.value=!1})},H=t=>{r.commit("triggerAuth",!0),r.commit("triggerAuthKey",t)};return ee(()=>{"friend".toLowerCase()==="friend"?R.value=z.FRIEND:"friend".toLowerCase()==="public"?R.value=z.PUBLIC:R.value=z.PRIVATE,C.value=R.value,Q.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(t,e)=>{const n=Me,o=Oe,l=je,g=De,G=He,ge=Ge,fe=Ke,ye=Je,he=Qe,we=Ze,be=Xe,ke=We,Ce=Ye,$e=et;return c(),v("div",null,[$(r).state.userInfo.id>0?(c(),v("div",ut,[x("div",ct,[x("div",pt,[a(n,{round:"",size:30,src:$(r).state.userInfo.avatar},null,8,["src"])]),a(o,{type:"textarea",size:"large",autosize:"",bordered:!1,loading:_.value,value:w.value,prefix:["@","#"],options:I.value,onSearch:re,"onUpdate:value":ue,placeholder:"说说您的新鲜事..."},null,8,["loading","value","options"])]),a(we,{ref_key:"uploadRef",ref:E,abstract:"","list-type":"image",multiple:!0,max:9,action:oe,headers:{Authorization:Q.value},data:{type:f.value},"file-list":u.value,onBeforeUpload:pe,onFinish:_e,onError:de,onRemove:me,"onUpdate:fileList":ce},{default:s(()=>[x("div",_t,[x("div",dt,[a(G,{abstract:""},{default:s(({handleClick:m})=>[a(g,{disabled:u.value.length>0&&f.value==="public/video"||u.value.length===9,onClick:()=>{D("public/image"),m()},quaternary:"",circle:"",type:"primary"},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Le))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),O.value?(c(),L(G,{key:0,abstract:""},{default:s(({handleClick:m})=>[a(g,{disabled:u.value.length>0&&f.value!=="public/video"||u.value.length===9,onClick:()=>{D("public/video"),m()},quaternary:"",circle:"",type:"primary"},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Ve))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):T("",!0),j.value?(c(),L(G,{key:1,abstract:""},{default:s(({handleClick:m})=>[a(g,{disabled:u.value.length>0&&f.value==="public/video"||u.value.length===9,onClick:()=>{D("attachment"),m()},quaternary:"",circle:"",type:"primary"},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Ne))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):T("",!0),a(g,{quaternary:"",circle:"",type:"primary",onClick:Z(ne,["stop"])},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Fe))]),_:1})]),_:1},8,["onClick"]),ae.value?(c(),L(g,{key:2,quaternary:"",circle:"",type:"primary",onClick:Z(se,["stop"])},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Be))]),_:1})]),_:1},8,["onClick"])):T("",!0)]),x("div",mt,[a(fe,{trigger:"hover",placement:"bottom"},{trigger:s(()=>[a(ge,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:w.value.length/$(P)*100},null,8,["percentage"])]),default:s(()=>[S(" "+X(w.value.length)+" / "+X($(P)),1)]),_:1}),a(g,{loading:d.value,onClick:ve,type:"primary",secondary:"",round:""},{default:s(()=>[S(" 发布 ")]),_:1},8,["loading"])])]),x("div",vt,[a(ye),y.value.length>0?(c(),v("div",gt,[A.value?(c(),L(he,{key:0,value:V.value,"onUpdate:value":e[0]||(e[0]=m=>V.value=m),min:0,max:1e5,placeholder:"请输入附件价格,0为免费附件"},{prefix:s(()=>[ft]),_:1},8,["value"])):T("",!0)])):T("",!0)])]),_:1},8,["headers","data","file-list"]),b.value?(c(),v("div",yt,[a(Ce,{value:C.value,"onUpdate:value":e[1]||(e[1]=m=>C.value=m),name:"radiogroup"},{default:s(()=>[a(ke,null,{default:s(()=>[(c(),v(K,null,J(M,m=>a(be,{key:m.value,value:m.value,label:m.label},null,8,["value","label"])),64))]),_:1})]),_:1},8,["value"])])):T("",!0),p.value?(c(),v("div",ht,[a($e,{value:U.value,"onUpdate:value":e[2]||(e[2]=m=>U.value=m),placeholder:"请输入以http(s)://开头的链接",min:0,max:3},{"create-button-default":s(()=>[S(" 创建链接 ")]),_:1},8,["value"])])):T("",!0)])):(c(),v("div",wt,[bt,B.value?T("",!0):(c(),v("div",kt,[a(g,{strong:"",secondary:"",round:"",type:"primary",onClick:e[3]||(e[3]=m=>H("signin"))},{default:s(()=>[S(" 登录 ")]),_:1})])),B.value?(c(),v("div",Ct,[a(g,{strong:"",secondary:"",round:"",type:"primary",onClick:e[4]||(e[4]=m=>H("signin"))},{default:s(()=>[S(" 登录 ")]),_:1}),a(g,{strong:"",secondary:"",round:"",type:"info",onClick:e[5]||(e[5]=m=>H("signup"))},{default:s(()=>[S(" 注册 ")]),_:1})])):T("",!0)]))])}}});const Tt={key:0,class:"skeleton-wrap"},qt={key:1},xt={key:0,class:"empty-wrap"},It={key:1},zt={key:2},Ut={key:0,class:"pagination-wrap"},Rt=Y({__name:"Home",setup(F){const q=te(),r=lt(),I=it(),_=i(!1),d=i([]),p=i(+r.query.p||1),b=i(20),w=i(0),U=Ie(()=>{let u="泡泡广场";return r.query&&r.query.q&&(r.query.t&&r.query.t==="tag"?u="#"+decodeURIComponent(r.query.q):u="搜索: "+decodeURIComponent(r.query.q)),u}),E=()=>{_.value=!0,Ee({query:r.query.q?decodeURIComponent(r.query.q):null,type:r.query.t,page:p.value,page_size:b.value}).then(u=>{_.value=!1,d.value=u.list,w.value=Math.ceil(u.pager.total_rows/b.value),window.scrollTo(0,0)}).catch(u=>{_.value=!1})},V=u=>{if(p.value!=1){I.push({name:"post",query:{id:u.id}});return}let h=[],k=d.value.length;k==b.value&&k--;for(var y=0;y{I.push({name:"home",query:{...r.query,p:u}})};return ee(()=>{E()}),ze(()=>({path:r.path,query:r.query,refresh:q.state.refresh}),(u,h)=>{if(u.refresh!==h.refresh){p.value=+r.query.p||1,setTimeout(()=>{E()},0);return}h.path!=="/post"&&u.path==="/"&&(p.value=+r.query.p||1,setTimeout(()=>{E()},0))}),(u,h)=>{const k=st,y=$t,C=ot,R=xe,M=nt,P=Te,B=qe,O=tt,j=at;return c(),v("div",null,[a(k,{title:U.value},null,8,["title"]),a(O,{class:"main-content-wrap",bordered:""},{default:s(()=>[a(C,null,{default:s(()=>[a(y,{onPostSuccess:V})]),_:1}),_.value?(c(),v("div",Tt,[a(R,{num:b.value},null,8,["num"])])):(c(),v("div",qt,[d.value.length===0?(c(),v("div",xt,[a(M,{size:"large",description:"暂无数据"})])):T("",!0),$(q).state.desktopModelShow?(c(),v("div",It,[(c(!0),v(K,null,J(d.value,A=>(c(),L(C,{key:A.id},{default:s(()=>[a(P,{post:A},null,8,["post"])]),_:2},1024))),128))])):(c(),v("div",zt,[(c(!0),v(K,null,J(d.value,A=>(c(),L(C,{key:A.id},{default:s(()=>[a(B,{post:A},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),w.value>0?(c(),v("div",Ut,[a(j,{page:p.value,"onUpdate:page":f,"page-slot":$(q).state.collapsedRight?5:8,"page-count":w.value},null,8,["page","page-slot","page-count"])])):T("",!0)])}}});const ca=Pe(Rt,[["__scopeId","data-v-f42b0645"]]);export{ca as default}; +import{_ as Te,a as qe}from"./post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js";import{_ as xe}from"./post-skeleton-41befd31.js";import{d as Y,r as i,j as ee,o as c,c as v,_ as $,a as x,V as a,a1 as s,Q as L,O as T,a2 as Z,e as S,M as X,F as K,a4 as J,n as Ie,w as ze}from"./@vue-e0e89260.js";import{u as te}from"./vuex-473b3783.js";import{l as W}from"./lodash-94eb5868.js";import{g as Ue,a as Re,c as Ae,b as Ee,_ as Pe}from"./index-08d8af97.js";import{p as Se}from"./content-91ba374b.js";import{V as z,P as N}from"./IEnum-a180d93e.js";import{I as Le,V as Ve,A as Ne,d as Fe,E as Be}from"./@vicons-6332ad63.js";import{o as Me,v as Oe,j as je,e as De,w as He,x as Ge,y as Ke,z as Je,A as Qe,B as Ze,C as Xe,a as We,D as Ye,E as et,F as tt,G as at,H as ot,I as nt}from"./naive-ui-62663ad7.js";import{_ as st}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{b as lt,u as it}from"./vue-router-b8e3382f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./paopao-video-player-aa5e8b3f.js";const rt=F=>{const q=new FileReader,r=_=>["application/zip","application/x-zip","application/octet-stream","application/x-zip-compressed"].includes(_),I=()=>{const _=new Uint8Array(q.result).subarray(0,4);let d="";for(let p=0;p<_.length;p++)d+=_[p].toString(16);switch(d){case"504b0304":case"504b0506":case"504b0708":return r("application/zip");case"504b030414":return r("application/x-zip-compressed");case"504b0508":return r("application/x-zip");case"504b5370":return r("application/octet-stream");default:return!1}};return new Promise((_,d)=>{q.onloadend=()=>{const p=F.type;_(p===""||p==="application/octet-stream"?I():r(p))},q.readAsArrayBuffer(F.slice(0,4))})},ut={key:0,class:"compose-wrap"},ct={class:"compose-line"},pt={class:"compose-user"},_t={class:"compose-line compose-options"},dt={class:"attachment"},mt={class:"submit-wrap"},vt={class:"attachment-list-wrap"},gt={key:0,class:"attachment-price-wrap"},ft=x("span",null," 附件价格¥",-1),yt={key:0,class:"eye-wrap"},ht={key:1,class:"link-wrap"},wt={key:1,class:"compose-wrap"},bt=x("div",{class:"login-wrap"},[x("span",{class:"login-banner"}," 登录后,精彩更多")],-1),kt={key:0,class:"login-only-wrap"},Ct={key:1,class:"login-wrap"},$t=Y({__name:"compose",emits:["post-success"],setup(F,{emit:q}){const r=te(),I=i([]),_=i(!1),d=i(!1),p=i(!1),b=i(!1),w=i(""),U=i([]),E=i(),V=i(0),f=i("public/image"),u=i([]),h=i([]),k=i([]),y=i([]),C=i(z.FRIEND),R=i(z.FRIEND),M=[{value:z.PUBLIC,label:"公开"},{value:z.PRIVATE,label:"私密"},{value:z.FRIEND,label:"好友可见"}],P=+"400",B=i("true".toLowerCase()==="true"),O=i("true".toLowerCase()==="true"),j=i("true".toLowerCase()==="true"),A=i("false".toLowerCase()==="true"),ae=i("true".toLowerCase()==="true"),oe="/v1/attachment",Q=i(),ne=()=>{p.value=!p.value,p.value&&b.value&&(b.value=!1)},se=()=>{b.value=!b.value,b.value&&p.value&&(p.value=!1)},le=W.debounce(t=>{Ue({k:t}).then(e=>{let n=[];e.suggest.map(o=>{n.push({label:o,value:o})}),I.value=n,_.value=!1}).catch(e=>{_.value=!1})},200),ie=W.debounce(t=>{Re({k:t}).then(e=>{let n=[];e.suggest.map(o=>{n.push({label:o,value:o})}),I.value=n,_.value=!1}).catch(e=>{_.value=!1})},200),re=(t,e)=>{_.value||(_.value=!0,e==="@"?le(t):ie(t))},ue=t=>{t.length>P?w.value=t.substring(0,P):w.value=t},D=t=>{f.value=t},ce=t=>{for(let l=0;l30&&(t[l].name=n.substring(0,18)+"..."+n.substring(n.length-9)+"."+o)}u.value=t},pe=async t=>{var e,n,o,l,g;return f.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((e=t.file.file)==null?void 0:e.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):f.value==="image"&&((n=t.file.file)==null?void 0:n.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):f.value==="public/video"&&!["video/mp4","video/quicktime"].includes((o=t.file.file)==null?void 0:o.type)?(window.$message.warning("视频仅允许 mp4/mov 格式"),!1):f.value==="public/video"&&((l=t.file.file)==null?void 0:l.size)>104857600?(window.$message.warning("视频大小不能超过100MB"),!1):f.value==="attachment"&&!await rt(t.file.file)?(window.$message.warning("附件仅允许 zip 格式"),!1):f.value==="attachment"&&((g=t.file.file)==null?void 0:g.size)>104857600?(window.$message.warning("附件大小不能超过100MB"),!1):!0},_e=({file:t,event:e})=>{var n;try{let o=JSON.parse((n=e.target)==null?void 0:n.response);o.code===0&&(f.value==="public/image"&&h.value.push({id:t.id,content:o.data.content}),f.value==="public/video"&&k.value.push({id:t.id,content:o.data.content}),f.value==="attachment"&&y.value.push({id:t.id,content:o.data.content}))}catch{window.$message.error("上传失败")}},de=({file:t,event:e})=>{var n;try{let o=JSON.parse((n=e.target)==null?void 0:n.response);if(o.code!==0){let l=o.msg||"上传失败";o.details&&o.details.length>0&&o.details.map(g=>{l+=":"+g}),window.$message.error(l)}}catch{window.$message.error("上传失败")}},me=({file:t})=>{let e=h.value.findIndex(n=>n.id===t.id);e>-1&&h.value.splice(e,1),e=k.value.findIndex(n=>n.id===t.id),e>-1&&k.value.splice(e,1),e=y.value.findIndex(n=>n.id===t.id),e>-1&&y.value.splice(e,1)},ve=()=>{if(w.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{tags:t,users:e}=Se(w.value);const n=[];let o=100;n.push({content:w.value,type:N.TEXT,sort:o}),h.value.map(l=>{o++,n.push({content:l.content,type:N.IMAGEURL,sort:o})}),k.value.map(l=>{o++,n.push({content:l.content,type:N.VIDEOURL,sort:o})}),y.value.map(l=>{o++,n.push({content:l.content,type:N.ATTACHMENT,sort:o})}),U.value.length>0&&U.value.map(l=>{o++,n.push({content:l,type:N.LINKURL,sort:o})}),d.value=!0,Ae({contents:n,tags:Array.from(new Set(t)),users:Array.from(new Set(e)),attachment_price:+V.value*100,visibility:C.value}).then(l=>{var g;window.$message.success("发布成功"),d.value=!1,q("post-success",l),p.value=!1,b.value=!1,(g=E.value)==null||g.clear(),u.value=[],w.value="",U.value=[],h.value=[],k.value=[],y.value=[],C.value=R.value}).catch(l=>{d.value=!1})},H=t=>{r.commit("triggerAuth",!0),r.commit("triggerAuthKey",t)};return ee(()=>{"friend".toLowerCase()==="friend"?R.value=z.FRIEND:"friend".toLowerCase()==="public"?R.value=z.PUBLIC:R.value=z.PRIVATE,C.value=R.value,Q.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(t,e)=>{const n=Me,o=Oe,l=je,g=De,G=He,ge=Ge,fe=Ke,ye=Je,he=Qe,we=Ze,be=Xe,ke=We,Ce=Ye,$e=et;return c(),v("div",null,[$(r).state.userInfo.id>0?(c(),v("div",ut,[x("div",ct,[x("div",pt,[a(n,{round:"",size:30,src:$(r).state.userInfo.avatar},null,8,["src"])]),a(o,{type:"textarea",size:"large",autosize:"",bordered:!1,loading:_.value,value:w.value,prefix:["@","#"],options:I.value,onSearch:re,"onUpdate:value":ue,placeholder:"说说您的新鲜事..."},null,8,["loading","value","options"])]),a(we,{ref_key:"uploadRef",ref:E,abstract:"","list-type":"image",multiple:!0,max:9,action:oe,headers:{Authorization:Q.value},data:{type:f.value},"file-list":u.value,onBeforeUpload:pe,onFinish:_e,onError:de,onRemove:me,"onUpdate:fileList":ce},{default:s(()=>[x("div",_t,[x("div",dt,[a(G,{abstract:""},{default:s(({handleClick:m})=>[a(g,{disabled:u.value.length>0&&f.value==="public/video"||u.value.length===9,onClick:()=>{D("public/image"),m()},quaternary:"",circle:"",type:"primary"},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Le))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),O.value?(c(),L(G,{key:0,abstract:""},{default:s(({handleClick:m})=>[a(g,{disabled:u.value.length>0&&f.value!=="public/video"||u.value.length===9,onClick:()=>{D("public/video"),m()},quaternary:"",circle:"",type:"primary"},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Ve))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):T("",!0),j.value?(c(),L(G,{key:1,abstract:""},{default:s(({handleClick:m})=>[a(g,{disabled:u.value.length>0&&f.value==="public/video"||u.value.length===9,onClick:()=>{D("attachment"),m()},quaternary:"",circle:"",type:"primary"},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Ne))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):T("",!0),a(g,{quaternary:"",circle:"",type:"primary",onClick:Z(ne,["stop"])},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Fe))]),_:1})]),_:1},8,["onClick"]),ae.value?(c(),L(g,{key:2,quaternary:"",circle:"",type:"primary",onClick:Z(se,["stop"])},{icon:s(()=>[a(l,{size:"20",color:"var(--primary-color)"},{default:s(()=>[a($(Be))]),_:1})]),_:1},8,["onClick"])):T("",!0)]),x("div",mt,[a(fe,{trigger:"hover",placement:"bottom"},{trigger:s(()=>[a(ge,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:w.value.length/$(P)*100},null,8,["percentage"])]),default:s(()=>[S(" "+X(w.value.length)+" / "+X($(P)),1)]),_:1}),a(g,{loading:d.value,onClick:ve,type:"primary",secondary:"",round:""},{default:s(()=>[S(" 发布 ")]),_:1},8,["loading"])])]),x("div",vt,[a(ye),y.value.length>0?(c(),v("div",gt,[A.value?(c(),L(he,{key:0,value:V.value,"onUpdate:value":e[0]||(e[0]=m=>V.value=m),min:0,max:1e5,placeholder:"请输入附件价格,0为免费附件"},{prefix:s(()=>[ft]),_:1},8,["value"])):T("",!0)])):T("",!0)])]),_:1},8,["headers","data","file-list"]),b.value?(c(),v("div",yt,[a(Ce,{value:C.value,"onUpdate:value":e[1]||(e[1]=m=>C.value=m),name:"radiogroup"},{default:s(()=>[a(ke,null,{default:s(()=>[(c(),v(K,null,J(M,m=>a(be,{key:m.value,value:m.value,label:m.label},null,8,["value","label"])),64))]),_:1})]),_:1},8,["value"])])):T("",!0),p.value?(c(),v("div",ht,[a($e,{value:U.value,"onUpdate:value":e[2]||(e[2]=m=>U.value=m),placeholder:"请输入以http(s)://开头的链接",min:0,max:3},{"create-button-default":s(()=>[S(" 创建链接 ")]),_:1},8,["value"])])):T("",!0)])):(c(),v("div",wt,[bt,B.value?T("",!0):(c(),v("div",kt,[a(g,{strong:"",secondary:"",round:"",type:"primary",onClick:e[3]||(e[3]=m=>H("signin"))},{default:s(()=>[S(" 登录 ")]),_:1})])),B.value?(c(),v("div",Ct,[a(g,{strong:"",secondary:"",round:"",type:"primary",onClick:e[4]||(e[4]=m=>H("signin"))},{default:s(()=>[S(" 登录 ")]),_:1}),a(g,{strong:"",secondary:"",round:"",type:"info",onClick:e[5]||(e[5]=m=>H("signup"))},{default:s(()=>[S(" 注册 ")]),_:1})])):T("",!0)]))])}}});const Tt={key:0,class:"skeleton-wrap"},qt={key:1},xt={key:0,class:"empty-wrap"},It={key:1},zt={key:2},Ut={key:0,class:"pagination-wrap"},Rt=Y({__name:"Home",setup(F){const q=te(),r=lt(),I=it(),_=i(!1),d=i([]),p=i(+r.query.p||1),b=i(20),w=i(0),U=Ie(()=>{let u="泡泡广场";return r.query&&r.query.q&&(r.query.t&&r.query.t==="tag"?u="#"+decodeURIComponent(r.query.q):u="搜索: "+decodeURIComponent(r.query.q)),u}),E=()=>{_.value=!0,Ee({query:r.query.q?decodeURIComponent(r.query.q):null,type:r.query.t,page:p.value,page_size:b.value}).then(u=>{_.value=!1,d.value=u.list,w.value=Math.ceil(u.pager.total_rows/b.value),window.scrollTo(0,0)}).catch(u=>{_.value=!1})},V=u=>{if(p.value!=1){I.push({name:"post",query:{id:u.id}});return}let h=[],k=d.value.length;k==b.value&&k--;for(var y=0;y{I.push({name:"home",query:{...r.query,p:u}})};return ee(()=>{E()}),ze(()=>({path:r.path,query:r.query,refresh:q.state.refresh}),(u,h)=>{if(u.refresh!==h.refresh){p.value=+r.query.p||1,setTimeout(()=>{E()},0);return}h.path!=="/post"&&u.path==="/"&&(p.value=+r.query.p||1,setTimeout(()=>{E()},0))}),(u,h)=>{const k=st,y=$t,C=ot,R=xe,M=nt,P=Te,B=qe,O=tt,j=at;return c(),v("div",null,[a(k,{title:U.value},null,8,["title"]),a(O,{class:"main-content-wrap",bordered:""},{default:s(()=>[a(C,null,{default:s(()=>[a(y,{onPostSuccess:V})]),_:1}),_.value?(c(),v("div",Tt,[a(R,{num:b.value},null,8,["num"])])):(c(),v("div",qt,[d.value.length===0?(c(),v("div",xt,[a(M,{size:"large",description:"暂无数据"})])):T("",!0),$(q).state.desktopModelShow?(c(),v("div",It,[(c(!0),v(K,null,J(d.value,A=>(c(),L(C,{key:A.id},{default:s(()=>[a(P,{post:A},null,8,["post"])]),_:2},1024))),128))])):(c(),v("div",zt,[(c(!0),v(K,null,J(d.value,A=>(c(),L(C,{key:A.id},{default:s(()=>[a(B,{post:A},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),w.value>0?(c(),v("div",Ut,[a(j,{page:p.value,"onUpdate:page":f,"page-slot":$(q).state.collapsedRight?5:8,"page-count":w.value},null,8,["page","page-slot","page-count"])])):T("",!0)])}}});const ca=Pe(Rt,[["__scopeId","data-v-f42b0645"]]);export{ca as default}; diff --git a/web/dist/assets/Messages-5c7f33a8.js b/web/dist/assets/Messages-c1d4e5e6.js similarity index 59% rename from web/dist/assets/Messages-5c7f33a8.js rename to web/dist/assets/Messages-c1d4e5e6.js index 9a2c807c..d9934e37 100644 --- a/web/dist/assets/Messages-5c7f33a8.js +++ b/web/dist/assets/Messages-c1d4e5e6.js @@ -1 +1 @@ -import{d as b,a3 as A,o as t,c as a,V as n,a1 as o,a as y,a2 as w,e as p,M as m,Q as z,O as r,_ as c,L as D,a4 as N,F as O,r as f,j as G}from"./@vue-e0e89260.js";import{u as H,b as L}from"./vue-router-b8e3382f.js";import{G as P,H as T,I as U,_ as F,J as E}from"./index-8b4e1776.js";import{a as J}from"./formatTime-cdf4e6f1.js";import{q as Q,r as K,s as q,t as W}from"./@vicons-d502290a.js";import{o as X,l as Y,j as Z,S as x,M as ee,U as se,F as ne,G as te,I as ae,H as oe}from"./naive-ui-62663ad7.js";import{_ as re}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as ie}from"./vuex-473b3783.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./moment-2ab8298d.js";const _e={class:"sender-wrap"},le={key:0,class:"nickname"},pe={class:"username"},ue={key:1,class:"nickname"},ce={class:"timestamp"},de={class:"timestamp-txt"},me={key:0,class:"brief-content"},ge={key:1,class:"whisper-content-wrap"},ve={key:2,class:"requesting-friend-wrap"},fe={key:2,class:"status-info"},ye={key:3,class:"status-info"},ke="https://assets.paopao.info/public/avatar/default/admin.png",he=b({__name:"message-item",props:{message:{}},setup(I){const g=H(),k=e=>{_(e),(e.type===1||e.type===2||e.type===3)&&(e.post&&e.post.id>0?g.push({name:"post",query:{id:e.post_id}}):window.$message.error("该动态已被删除"))},i=e=>{_(e),P({user_id:e.sender_user_id}).then(s=>{e.reply_id=2,window.$message.success("已同意添加好友")}).catch(s=>{console.log(s)})},u=e=>{_(e),T({user_id:e.sender_user_id}).then(s=>{e.reply_id=3,window.$message.success("已拒绝添加好友")}).catch(s=>{console.log(s)})},_=e=>{e.is_read===0&&U({id:e.id}).then(s=>{e.is_read=1}).catch(s=>{console.log(s)})};return(e,s)=>{const h=X,$=A("router-link"),l=Y,d=Z,C=x,M=ee;return t(),a("div",{class:D(["message-item",{unread:e.message.is_read===0}]),onClick:s[4]||(s[4]=v=>_(e.message))},[n(M,{"content-indented":""},{avatar:o(()=>[n(h,{round:"",size:30,src:e.message.sender_user.id>0?e.message.sender_user.avatar:ke},null,8,["src"])]),header:o(()=>[y("div",_e,[e.message.sender_user.id>0?(t(),a("span",le,[n($,{onClick:s[0]||(s[0]=w(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.message.sender_user.username}}},{default:o(()=>[p(m(e.message.sender_user.nickname),1)]),_:1},8,["to"]),y("span",pe," @"+m(e.message.sender_user.username),1)])):(t(),a("span",ue," 系统 "))])]),"header-extra":o(()=>[y("span",ce,[e.message.is_read===0?(t(),z(l,{key:0,dot:"",processing:""})):r("",!0),y("span",de,m(c(J)(e.message.created_on)),1)])]),description:o(()=>[n(C,{"show-icon":!1,class:"brief-wrap",type:e.message.is_read>0?"default":"success"},{default:o(()=>[e.message.type!=4?(t(),a("div",me,[p(m(e.message.brief)+" ",1),e.message.type===1||e.message.type===2||e.message.type===3?(t(),a("span",{key:0,onClick:s[1]||(s[1]=w(v=>k(e.message),["stop"])),class:"hash-link view-link"},[n(d,null,{default:o(()=>[n(c(Q))]),_:1}),p(" 查看详情 ")])):r("",!0)])):r("",!0),e.message.type===4?(t(),a("div",ge,m(e.message.content),1)):r("",!0),e.message.type===5?(t(),a("div",ve,[p(m(e.message.content)+" ",1),e.message.reply_id===1?(t(),a("span",{key:0,onClick:s[2]||(s[2]=w(v=>i(e.message),["stop"])),class:"hash-link view-link"},[n(d,null,{default:o(()=>[n(c(K))]),_:1}),p(" 同意 ")])):r("",!0),e.message.reply_id===1?(t(),a("span",{key:1,onClick:s[3]||(s[3]=w(v=>u(e.message),["stop"])),class:"hash-link view-link"},[n(d,null,{default:o(()=>[n(c(q))]),_:1}),p(" 拒绝 ")])):r("",!0),e.message.reply_id===2?(t(),a("span",fe,[n(d,null,{default:o(()=>[n(c(W))]),_:1}),p(" 已同意 ")])):r("",!0),e.message.reply_id===3?(t(),a("span",ye,[n(d,null,{default:o(()=>[n(c(q))]),_:1}),p(" 已拒绝 ")])):r("",!0)])):r("",!0)]),_:1},8,["type"])]),_:1})],2)}}});const we=F(he,[["__scopeId","data-v-4a0e27fa"]]),$e={class:"content"},Ce=b({__name:"message-skeleton",props:{num:{default:1}},setup(I){return(g,k)=>{const i=se;return t(!0),a(O,null,N(new Array(g.num),u=>(t(),a("div",{class:"skeleton-item",key:u},[y("div",$e,[n(i,{text:"",repeat:2}),n(i,{text:"",style:{width:"60%"}})])]))),128)}}});const Me=F(Ce,[["__scopeId","data-v-01d2e871"]]),be={key:0,class:"skeleton-wrap"},Fe={key:1},Ie={key:0,class:"empty-wrap"},Se={key:0,class:"pagination-wrap"},qe=b({__name:"Messages",setup(I){const g=L(),k=ie(),i=f(!1),u=f(+g.query.p||1),_=f(10),e=f(0),s=f([]),h=()=>{i.value=!0,E({page:u.value,page_size:_.value}).then(l=>{i.value=!1,s.value=l.list,e.value=Math.ceil(l.pager.total_rows/_.value)}).catch(l=>{i.value=!1})},$=l=>{u.value=l,h()};return G(()=>{h()}),(l,d)=>{const C=re,M=Me,v=ae,R=we,V=oe,j=ne,B=te;return t(),a("div",null,[n(C,{title:"消息"}),n(j,{class:"main-content-wrap messages-wrap",bordered:""},{default:o(()=>[i.value?(t(),a("div",be,[n(M,{num:_.value},null,8,["num"])])):(t(),a("div",Fe,[s.value.length===0?(t(),a("div",Ie,[n(v,{size:"large",description:"暂无数据"})])):r("",!0),(t(!0),a(O,null,N(s.value,S=>(t(),z(V,{key:S.id},{default:o(()=>[n(R,{message:S},null,8,["message"])]),_:2},1024))),128))]))]),_:1}),e.value>0?(t(),a("div",Se,[n(B,{page:u.value,"onUpdate:page":$,"page-slot":c(k).state.collapsedRight?5:8,"page-count":e.value},null,8,["page","page-slot","page-count"])])):r("",!0)])}}});const es=F(qe,[["__scopeId","data-v-4e7b1342"]]);export{es as default}; +import{d as b,a3 as A,o as t,c as a,V as n,a1 as o,a as f,a2 as w,e as p,M as m,Q as N,O as r,_ as c,L as D,a4 as O,F as R,r as y,j as H}from"./@vue-e0e89260.js";import{u as L,b as P}from"./vue-router-b8e3382f.js";import{H as T,I as U,J as E,_ as F,K as G}from"./index-08d8af97.js";import{a as J}from"./formatTime-cdf4e6f1.js";import{w as K,x as Q,y as S,z as W}from"./@vicons-6332ad63.js";import{o as X,l as Y,j as Z,S as x,M as ee,U as se,F as ne,G as te,I as ae,H as oe}from"./naive-ui-62663ad7.js";import{_ as re}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as ie}from"./vuex-473b3783.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./moment-2ab8298d.js";const _e={class:"sender-wrap"},le={key:0,class:"nickname"},pe={class:"username"},ue={key:1,class:"nickname"},ce={class:"timestamp"},de={class:"timestamp-txt"},me={key:0,class:"brief-content"},ge={key:1,class:"whisper-content-wrap"},ve={key:2,class:"requesting-friend-wrap"},ye={key:2,class:"status-info"},fe={key:3,class:"status-info"},ke="https://assets.paopao.info/public/avatar/default/admin.png",he=b({__name:"message-item",props:{message:{}},setup(I){const g=L(),k=e=>{_(e),(e.type===1||e.type===2||e.type===3)&&(e.post&&e.post.id>0?g.push({name:"post",query:{id:e.post_id}}):window.$message.error("该动态已被删除"))},i=e=>{_(e),T({user_id:e.sender_user_id}).then(s=>{e.reply_id=2,window.$message.success("已同意添加好友")}).catch(s=>{console.log(s)})},u=e=>{_(e),U({user_id:e.sender_user_id}).then(s=>{e.reply_id=3,window.$message.success("已拒绝添加好友")}).catch(s=>{console.log(s)})},_=e=>{e.is_read===0&&E({id:e.id}).then(s=>{e.is_read=1}).catch(s=>{console.log(s)})};return(e,s)=>{const h=X,$=A("router-link"),l=Y,d=Z,C=x,M=ee;return t(),a("div",{class:D(["message-item",{unread:e.message.is_read===0}]),onClick:s[4]||(s[4]=v=>_(e.message))},[n(M,{"content-indented":""},{avatar:o(()=>[n(h,{round:"",size:30,src:e.message.sender_user.id>0?e.message.sender_user.avatar:ke},null,8,["src"])]),header:o(()=>[f("div",_e,[e.message.sender_user.id>0?(t(),a("span",le,[n($,{onClick:s[0]||(s[0]=w(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.message.sender_user.username}}},{default:o(()=>[p(m(e.message.sender_user.nickname),1)]),_:1},8,["to"]),f("span",pe," @"+m(e.message.sender_user.username),1)])):(t(),a("span",ue," 系统 "))])]),"header-extra":o(()=>[f("span",ce,[e.message.is_read===0?(t(),N(l,{key:0,dot:"",processing:""})):r("",!0),f("span",de,m(c(J)(e.message.created_on)),1)])]),description:o(()=>[n(C,{"show-icon":!1,class:"brief-wrap",type:e.message.is_read>0?"default":"success"},{default:o(()=>[e.message.type!=4?(t(),a("div",me,[p(m(e.message.brief)+" ",1),e.message.type===1||e.message.type===2||e.message.type===3?(t(),a("span",{key:0,onClick:s[1]||(s[1]=w(v=>k(e.message),["stop"])),class:"hash-link view-link"},[n(d,null,{default:o(()=>[n(c(K))]),_:1}),p(" 查看详情 ")])):r("",!0)])):r("",!0),e.message.type===4?(t(),a("div",ge,m(e.message.content),1)):r("",!0),e.message.type===5?(t(),a("div",ve,[p(m(e.message.content)+" ",1),e.message.reply_id===1?(t(),a("span",{key:0,onClick:s[2]||(s[2]=w(v=>i(e.message),["stop"])),class:"hash-link view-link"},[n(d,null,{default:o(()=>[n(c(Q))]),_:1}),p(" 同意 ")])):r("",!0),e.message.reply_id===1?(t(),a("span",{key:1,onClick:s[3]||(s[3]=w(v=>u(e.message),["stop"])),class:"hash-link view-link"},[n(d,null,{default:o(()=>[n(c(S))]),_:1}),p(" 拒绝 ")])):r("",!0),e.message.reply_id===2?(t(),a("span",ye,[n(d,null,{default:o(()=>[n(c(W))]),_:1}),p(" 已同意 ")])):r("",!0),e.message.reply_id===3?(t(),a("span",fe,[n(d,null,{default:o(()=>[n(c(S))]),_:1}),p(" 已拒绝 ")])):r("",!0)])):r("",!0)]),_:1},8,["type"])]),_:1})],2)}}});const we=F(he,[["__scopeId","data-v-4a0e27fa"]]),$e={class:"content"},Ce=b({__name:"message-skeleton",props:{num:{default:1}},setup(I){return(g,k)=>{const i=se;return t(!0),a(R,null,O(new Array(g.num),u=>(t(),a("div",{class:"skeleton-item",key:u},[f("div",$e,[n(i,{text:"",repeat:2}),n(i,{text:"",style:{width:"60%"}})])]))),128)}}});const Me=F(Ce,[["__scopeId","data-v-01d2e871"]]),be={key:0,class:"skeleton-wrap"},Fe={key:1},Ie={key:0,class:"empty-wrap"},ze={key:0,class:"pagination-wrap"},Se=b({__name:"Messages",setup(I){const g=P(),k=ie(),i=y(!1),u=y(+g.query.p||1),_=y(10),e=y(0),s=y([]),h=()=>{i.value=!0,G({page:u.value,page_size:_.value}).then(l=>{i.value=!1,s.value=l.list,e.value=Math.ceil(l.pager.total_rows/_.value)}).catch(l=>{i.value=!1})},$=l=>{u.value=l,h()};return H(()=>{h()}),(l,d)=>{const C=re,M=Me,v=ae,V=we,j=oe,q=ne,B=te;return t(),a("div",null,[n(C,{title:"消息"}),n(q,{class:"main-content-wrap messages-wrap",bordered:""},{default:o(()=>[i.value?(t(),a("div",be,[n(M,{num:_.value},null,8,["num"])])):(t(),a("div",Fe,[s.value.length===0?(t(),a("div",Ie,[n(v,{size:"large",description:"暂无数据"})])):r("",!0),(t(!0),a(R,null,O(s.value,z=>(t(),N(j,{key:z.id},{default:o(()=>[n(V,{message:z},null,8,["message"])]),_:2},1024))),128))]))]),_:1}),e.value>0?(t(),a("div",ze,[n(B,{page:u.value,"onUpdate:page":$,"page-slot":c(k).state.collapsedRight?5:8,"page-count":e.value},null,8,["page","page-slot","page-count"])])):r("",!0)])}}});const es=F(Se,[["__scopeId","data-v-4e7b1342"]]);export{es as default}; diff --git a/web/dist/assets/Post-45820327.js b/web/dist/assets/Post-45820327.js new file mode 100644 index 00000000..7e19a35d --- /dev/null +++ b/web/dist/assets/Post-45820327.js @@ -0,0 +1 @@ +import{d as X,r as c,a3 as ge,o,c as u,a as v,V as t,a1 as n,e as x,M as I,Q as P,O as i,_ as a,a2 as H,n as ae,a7 as qe,F as le,a4 as ie,j as ye,W as Ie,X as Te,s as be,w as Ee}from"./@vue-e0e89260.js";import{u as te}from"./vuex-473b3783.js";import{f as ue}from"./formatTime-cdf4e6f1.js";import{t as Ne,d as je,e as Be,_ as se,f as He,h as Fe,i as Ve,j as Ye,g as Je,k as Ke,l as Qe,m as We,n as Ge,o as Xe,s as Ze,p as et,v as tt,q as st,r as ot,u as nt,w as $e}from"./index-08d8af97.js";import{Y as ce,V as Z}from"./IEnum-a180d93e.js";import{T as Pe,e as re,f as ze,g as _e,h as Ue,I as at,i as lt,j as it,k as ut,l as ct,m as rt,n as _t,o as pt,p as dt,q as mt,r as vt,s as Ce,F as xe,E as ve,t as he,u as fe}from"./@vicons-6332ad63.js";import{j as Y,e as oe,J as Re,K as ht,b as ft,L as gt,o as ke,M as Se,v as yt,w as kt,x as wt,y as bt,z as $t,B as Ct,O as xt,P as It,i as Tt,Q as Pt,a as Le,F as zt,I as Ut,k as Rt,H as St,f as Lt,g as Ot}from"./naive-ui-62663ad7.js";import{p as we,_ as Oe,a as Mt,b as At,c as Dt}from"./content-91ba374b.js";import{u as Me,b as qt}from"./vue-router-b8e3382f.js";import{_ as Et}from"./post-skeleton-41befd31.js";import{l as Nt}from"./lodash-94eb5868.js";import{a as jt}from"./copy-to-clipboard-1dd3075d.js";import{_ as Bt}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{W as Ht}from"./v3-infinite-loading-e5c2e8bf.js";import"./moment-2ab8298d.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./paopao-video-player-aa5e8b3f.js";import"./toggle-selection-93f4ad84.js";const Ft={class:"reply-item"},Vt={class:"header-wrap"},Yt={class:"username"},Jt={class:"reply-name"},Kt={class:"timestamp"},Qt={class:"base-wrap"},Wt={class:"content"},Gt={class:"reply-switch"},Xt={class:"time-item"},Zt={class:"actions"},es={class:"upvote-count"},ts=["onClick"],ss={class:"upvote-count"},os={key:2,class:"action-item"},ns=["onClick"],as=X({__name:"reply-item",props:{tweetId:{},reply:{}},emits:["focusReply","reload"],setup(A,{emit:D}){const l=A,p=te(),f=c(l.reply.is_thumbs_up==ce.YES),y=c(l.reply.is_thumbs_down==ce.YES),k=c(l.reply.thumbs_up_count),L=()=>{Ne({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(h=>{f.value=!f.value,f.value?(k.value++,y.value=!1):k.value--}).catch(h=>{console.log(h)})},r=()=>{je({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(h=>{y.value=!y.value,y.value&&f.value&&(k.value--,f.value=!1)}).catch(h=>{console.log(h)})},U=()=>{D("focusReply",l.reply)},T=()=>{Be({id:l.reply.id}).then(h=>{window.$message.success("删除成功"),setTimeout(()=>{D("reload")},50)}).catch(h=>{console.log(h)})};return(h,$)=>{const R=ge("router-link"),e=Y,_=oe,O=Re,w=ht;return o(),u("div",Ft,[v("div",Vt,[v("div",Yt,[t(R,{class:"user-link",to:{name:"user",query:{username:l.reply.user.username}}},{default:n(()=>[x(I(l.reply.user.username),1)]),_:1},8,["to"]),v("span",Jt,I(l.reply.at_user_id>0?"回复":":"),1),l.reply.at_user_id>0?(o(),P(R,{key:0,class:"user-link",to:{name:"user",query:{username:l.reply.at_user.username}}},{default:n(()=>[x(I(l.reply.at_user.username),1)]),_:1},8,["to"])):i("",!0)]),v("div",Kt,[x(I(l.reply.ip_loc)+" ",1),a(p).state.userInfo.is_admin||a(p).state.userInfo.id===l.reply.user.id?(o(),P(O,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:T},{trigger:n(()=>[t(_,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:n(()=>[t(e,null,{default:n(()=>[t(a(Pe))]),_:1})]),_:1})]),default:n(()=>[x(" 是否确认删除? ")]),_:1})):i("",!0)])]),v("div",Qt,[v("div",Wt,[t(w,{"expand-trigger":"click","line-clamp":"5",tooltip:!1},{default:n(()=>[x(I(l.reply.content),1)]),_:1})]),v("div",Gt,[v("span",Xt,I(a(ue)(l.reply.created_on)),1),v("div",Zt,[a(p).state.userLogined?i("",!0):(o(),u("div",{key:0,class:"action-item",onClick:$[0]||($[0]=H(()=>{},["stop"]))},[t(e,{size:"medium"},{default:n(()=>[t(a(re))]),_:1}),v("span",es,I(k.value),1)])),a(p).state.userLogined?(o(),u("div",{key:1,class:"action-item hover",onClick:H(L,["stop"])},[t(e,{size:"medium"},{default:n(()=>[f.value?i("",!0):(o(),P(a(re),{key:0})),f.value?(o(),P(a(ze),{key:1,class:"show"})):i("",!0)]),_:1}),v("span",ss,I(k.value>0?k.value:"赞"),1)],8,ts)):i("",!0),a(p).state.userLogined?i("",!0):(o(),u("div",os,[t(e,{size:"medium"},{default:n(()=>[t(a(_e))]),_:1})])),a(p).state.userLogined?(o(),u("div",{key:3,class:"action-item hover",onClick:H(r,["stop"])},[t(e,{size:"medium"},{default:n(()=>[y.value?i("",!0):(o(),P(a(_e),{key:0})),y.value?(o(),P(a(Ue),{key:1,class:"show"})):i("",!0)]),_:1})],8,ns)):i("",!0),a(p).state.userLogined?(o(),u("span",{key:4,class:"show opacity-item reply-btn",onClick:U}," 回复 ")):i("",!0)])])])])}}});const ls=se(as,[["__scopeId","data-v-0fa8b923"]]),is={class:"reply-compose-wrap"},us={class:"reply-switch"},cs={class:"time-item"},rs={class:"actions"},_s={key:0,class:"action-item"},ps={class:"upvote-count"},ds=["onClick"],ms={class:"upvote-count"},vs={key:2,class:"action-item"},hs=["onClick"],fs={key:0,class:"reply-input-wrap"},gs=X({__name:"compose-reply",props:{comment:{},atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(A,{expose:D,emit:l}){const p=A,f=te(),y=c(),k=c(!1),L=c(""),r=c(!1),U=+"300",T=c(p.comment.is_thumbs_up==ce.YES),h=c(p.comment.is_thumbs_down==ce.YES),$=c(p.comment.thumbs_up_count),R=()=>{He({tweet_id:p.comment.post_id,comment_id:p.comment.id}).then(w=>{T.value=!T.value,T.value?($.value++,h.value=!1):$.value--}).catch(w=>{console.log(w)})},e=()=>{Fe({tweet_id:p.comment.post_id,comment_id:p.comment.id}).then(w=>{h.value=!h.value,h.value&&T.value&&($.value--,T.value=!1)}).catch(w=>{console.log(w)})},_=w=>{k.value=w,w?setTimeout(()=>{var M;(M=y.value)==null||M.focus()},10):(r.value=!1,L.value="",l("reset"))},O=()=>{r.value=!0,Ve({comment_id:p.comment.id,at_user_id:p.atUserid,content:L.value}).then(w=>{_(!1),window.$message.success("评论成功"),l("reload")}).catch(w=>{r.value=!1})};return D({switchReply:_}),(w,M)=>{const j=Y,B=ft,V=oe,z=gt;return o(),u("div",is,[v("div",us,[v("span",cs,I(a(ue)(w.comment.created_on)),1),v("div",rs,[a(f).state.userLogined?i("",!0):(o(),u("div",_s,[t(j,{size:"medium"},{default:n(()=>[t(a(re))]),_:1}),v("span",ps,I($.value),1)])),a(f).state.userLogined?(o(),u("div",{key:1,class:"action-item hover",onClick:H(R,["stop"])},[t(j,{size:"medium"},{default:n(()=>[T.value?i("",!0):(o(),P(a(re),{key:0})),T.value?(o(),P(a(ze),{key:1,class:"show"})):i("",!0)]),_:1}),v("span",ms,I($.value>0?$.value:"赞"),1)],8,ds)):i("",!0),a(f).state.userLogined?i("",!0):(o(),u("div",vs,[t(j,{size:"medium"},{default:n(()=>[t(a(_e))]),_:1})])),a(f).state.userLogined?(o(),u("div",{key:3,class:"action-item hover",onClick:H(e,["stop"])},[t(j,{size:"medium"},{default:n(()=>[h.value?i("",!0):(o(),P(a(_e),{key:0})),h.value?(o(),P(a(Ue),{key:1,class:"show"})):i("",!0)]),_:1})],8,hs)):i("",!0),a(f).state.userLogined&&!k.value?(o(),u("span",{key:4,class:"show reply-btn",onClick:M[0]||(M[0]=S=>_(!0))}," 回复 ")):i("",!0),a(f).state.userLogined&&k.value?(o(),u("span",{key:5,class:"hide reply-btn",onClick:M[1]||(M[1]=S=>_(!1))}," 取消 ")):i("",!0)])]),k.value?(o(),u("div",fs,[t(z,null,{default:n(()=>[t(B,{ref_key:"inputInstRef",ref:y,size:"small",placeholder:p.atUsername?"@"+p.atUsername:"请输入回复内容..",maxlength:a(U),value:L.value,"onUpdate:value":M[2]||(M[2]=S=>L.value=S),"show-count":"",clearable:""},null,8,["placeholder","maxlength","value"]),t(V,{type:"primary",size:"small",ghost:"",loading:r.value,onClick:O},{default:n(()=>[x(" 回复 ")]),_:1},8,["loading"])]),_:1})])):i("",!0)])}}});const ys=se(gs,[["__scopeId","data-v-f9af7a93"]]),ks={class:"comment-item"},ws={class:"nickname-wrap"},bs={class:"username-wrap"},$s={class:"opt-wrap"},Cs={class:"timestamp"},xs=["innerHTML"],Is={class:"reply-wrap"},Ts=X({__name:"comment-item",props:{comment:{}},emits:["reload"],setup(A,{emit:D}){const l=A,p=te(),f=Me(),y=c(0),k=c(""),L=c(),r=ae(()=>{let e=Object.assign({texts:[],imgs:[]},l.comment);return e.contents.map(_=>{(+_.type==1||+_.type==2)&&e.texts.push(_),+_.type==3&&e.imgs.push(_)}),e}),U=(e,_)=>{let O=e.target;if(O.dataset.detail){const w=O.dataset.detail.split(":");w.length===2&&(p.commit("refresh"),w[0]==="tag"?window.$message.warning("评论内的无效话题"):f.push({name:"user",query:{username:w[1]}}))}},T=e=>{var _,O;y.value=e.user_id,k.value=((_=e.user)==null?void 0:_.username)||"",(O=L.value)==null||O.switchReply(!0)},h=()=>{D("reload")},$=()=>{y.value=0,k.value=""},R=()=>{Ye({id:r.value.id}).then(e=>{window.$message.success("删除成功"),setTimeout(()=>{h()},50)}).catch(e=>{})};return(e,_)=>{const O=ke,w=ge("router-link"),M=Y,j=oe,B=Re,V=Oe,z=ys,S=ls,K=Se;return o(),u("div",ks,[t(K,{"content-indented":""},qe({avatar:n(()=>[t(O,{round:"",size:30,src:r.value.user.avatar},null,8,["src"])]),header:n(()=>[v("span",ws,[t(w,{onClick:_[0]||(_[0]=H(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:r.value.user.username}}},{default:n(()=>[x(I(r.value.user.nickname),1)]),_:1},8,["to"])]),v("span",bs," @"+I(r.value.user.username),1)]),"header-extra":n(()=>[v("div",$s,[v("span",Cs,I(r.value.ip_loc),1),a(p).state.userInfo.is_admin||a(p).state.userInfo.id===r.value.user.id?(o(),P(B,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:R},{trigger:n(()=>[t(j,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:n(()=>[t(M,null,{default:n(()=>[t(a(Pe))]),_:1})]),_:1})]),default:n(()=>[x(" 是否确认删除? ")]),_:1})):i("",!0)])]),footer:n(()=>[r.value.imgs.length>0?(o(),P(V,{key:0,imgs:r.value.imgs},null,8,["imgs"])):i("",!0),t(z,{ref_key:"replyComposeRef",ref:L,comment:r.value,"at-userid":y.value,"at-username":k.value,onReload:h,onReset:$},null,8,["comment","at-userid","at-username"]),v("div",Is,[(o(!0),u(le,null,ie(r.value.replies,F=>(o(),P(S,{key:F.id,reply:F,"tweet-id":r.value.post_id,onFocusReply:T,onReload:h},null,8,["reply","tweet-id"]))),128))])]),_:2},[r.value.texts.length>0?{name:"description",fn:n(()=>[(o(!0),u(le,null,ie(r.value.texts,F=>(o(),u("span",{key:F.id,class:"comment-text",onClick:_[1]||(_[1]=H(J=>U(J,r.value.id),["stop"])),innerHTML:a(we)(F.content).content},null,8,xs))),128))]),key:"0"}:void 0]),1024)])}}});const Ps=se(Ts,[["__scopeId","data-v-e5cb084f"]]),zs=A=>(Ie("data-v-634e6bfd"),A=A(),Te(),A),Us={key:0,class:"compose-wrap"},Rs={class:"compose-line"},Ss={class:"compose-user"},Ls={class:"compose-line compose-options"},Os={class:"attachment"},Ms={class:"submit-wrap"},As={class:"attachment-list-wrap"},Ds={key:1,class:"compose-wrap"},qs=zs(()=>v("div",{class:"login-wrap"},[v("span",{class:"login-banner"}," 登录后,精彩更多")],-1)),Es={key:0,class:"login-only-wrap"},Ns={key:1,class:"login-wrap"},js=X({__name:"compose-comment",props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(A,{emit:D}){const l=A,p=te(),f=c([]),y=c(!1),k=c(!1),L=c(!1),r=c(""),U=c(),T=c("public/image"),h=c([]),$=c([]),R=c("true".toLowerCase()==="true"),e=+"300",_="/v1/attachment",O=c(),w=Nt.debounce(m=>{Je({k:m}).then(g=>{let b=[];g.suggest.map(C=>{b.push({label:C,value:C})}),f.value=b,k.value=!1}).catch(g=>{k.value=!1})},200),M=(m,g)=>{k.value||(k.value=!0,g==="@"&&w(m))},j=m=>{m.length>e?r.value=m.substring(0,e):r.value=m},B=m=>{T.value=m},V=m=>{for(let E=0;E30&&(m[E].name=b.substring(0,18)+"..."+b.substring(b.length-9)+"."+C)}h.value=m},z=async m=>{var g,b;return T.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((g=m.file.file)==null?void 0:g.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):T.value==="image"&&((b=m.file.file)==null?void 0:b.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):!0},S=({file:m,event:g})=>{var b;try{let C=JSON.parse((b=g.target)==null?void 0:b.response);C.code===0&&T.value==="public/image"&&$.value.push({id:m.id,content:C.data.content})}catch{window.$message.error("上传失败")}},K=({file:m,event:g})=>{var b;try{let C=JSON.parse((b=g.target)==null?void 0:b.response);if(C.code!==0){let E=C.msg||"上传失败";C.details&&C.details.length>0&&C.details.map(q=>{E+=":"+q}),window.$message.error(E)}}catch{window.$message.error("上传失败")}},F=({file:m})=>{let g=$.value.findIndex(b=>b.id===m.id);g>-1&&$.value.splice(g,1)},J=()=>{y.value=!0},W=()=>{var m;y.value=!1,(m=U.value)==null||m.clear(),h.value=[],r.value="",$.value=[]},s=()=>{if(r.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{users:m}=we(r.value);const g=[];let b=100;g.push({content:r.value,type:2,sort:b}),$.value.map(C=>{b++,g.push({content:C.content,type:3,sort:b})}),L.value=!0,Ke({contents:g,post_id:l.postId,users:Array.from(new Set(m))}).then(C=>{window.$message.success("发布成功"),L.value=!1,D("post-success"),W()}).catch(C=>{L.value=!1})},d=m=>{p.commit("triggerAuth",!0),p.commit("triggerAuthKey",m)};return ye(()=>{O.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(m,g)=>{const b=ke,C=yt,E=Y,q=oe,Q=kt,pe=wt,de=bt,me=$t,ne=Ct;return o(),u("div",null,[a(p).state.userInfo.id>0?(o(),u("div",Us,[v("div",Rs,[v("div",Ss,[t(b,{round:"",size:30,src:a(p).state.userInfo.avatar},null,8,["src"])]),t(C,{type:"textarea",size:"large",autosize:"",bordered:!1,options:f.value,prefix:["@"],loading:k.value,value:r.value,disabled:l.lock===1,"onUpdate:value":j,onSearch:M,onFocus:J,placeholder:l.lock===1?"泡泡已被锁定,回复功能已关闭":"快来评论两句吧..."},null,8,["options","loading","value","disabled","placeholder"])]),y.value?(o(),P(ne,{key:0,ref_key:"uploadRef",ref:U,abstract:"","list-type":"image",multiple:!0,max:9,action:_,headers:{Authorization:O.value},data:{type:T.value},"file-list":h.value,onBeforeUpload:z,onFinish:S,onError:K,onRemove:F,"onUpdate:fileList":V},{default:n(()=>[v("div",Ls,[v("div",Os,[t(Q,{abstract:""},{default:n(({handleClick:G})=>[t(q,{disabled:h.value.length>0&&T.value==="public/video"||h.value.length===9,onClick:()=>{B("public/image"),G()},quaternary:"",circle:"",type:"primary"},{icon:n(()=>[t(E,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(a(at))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),t(de,{trigger:"hover",placement:"bottom"},{trigger:n(()=>[t(pe,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:r.value.length/a(e)*100},null,8,["percentage"])]),default:n(()=>[x(" "+I(r.value.length)+" / "+I(a(e)),1)]),_:1})]),v("div",Ms,[t(q,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:W},{default:n(()=>[x(" 取消 ")]),_:1}),t(q,{loading:L.value,onClick:s,type:"primary",secondary:"",size:"small",round:""},{default:n(()=>[x(" 发布 ")]),_:1},8,["loading"])])]),v("div",As,[t(me)])]),_:1},8,["headers","data","file-list"])):i("",!0)])):(o(),u("div",Ds,[qs,R.value?i("",!0):(o(),u("div",Es,[t(q,{strong:"",secondary:"",round:"",type:"primary",onClick:g[0]||(g[0]=G=>d("signin"))},{default:n(()=>[x(" 登录 ")]),_:1})])),R.value?(o(),u("div",Ns,[t(q,{strong:"",secondary:"",round:"",type:"primary",onClick:g[1]||(g[1]=G=>d("signin"))},{default:n(()=>[x(" 登录 ")]),_:1}),t(q,{strong:"",secondary:"",round:"",type:"info",onClick:g[2]||(g[2]=G=>d("signup"))},{default:n(()=>[x(" 注册 ")]),_:1})])):i("",!0)]))])}}});const Bs=se(js,[["__scopeId","data-v-634e6bfd"]]),Hs={class:"username-wrap"},Fs={key:0,class:"options"},Vs={key:0},Ys=["innerHTML"],Js={class:"timestamp"},Ks={key:0},Qs={key:1},Ws={class:"opts-wrap"},Gs=["onClick"],Xs={class:"opt-item"},Zs=["onClick"],eo=["onClick"],to=X({__name:"post-detail",props:{post:{}},emits:["reload"],setup(A,{emit:D}){const l=A,p=te(),f=Me(),y=c(!1),k=c(!1),L=c(!1),r=c(!1),U=c(!1),T=c(!1),h=c(!1),$=c(!1),R=c(Z.PUBLIC),e=ae({get:()=>{let s=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},l.post);return s.contents.map(d=>{(+d.type==1||+d.type==2)&&s.texts.push(d),+d.type==3&&s.imgs.push(d),+d.type==4&&s.videos.push(d),+d.type==6&&s.links.push(d),+d.type==7&&s.attachments.push(d),+d.type==8&&s.charge_attachments.push(d)}),s},set:s=>{l.post.upvote_count=s.upvote_count,l.post.comment_count=s.comment_count,l.post.collection_count=s.collection_count}}),_=s=>()=>be(Y,null,{default:()=>be(s)}),O=ae(()=>{let s=[{label:"删除",key:"delete",icon:_(dt)}];return e.value.is_lock===0?s.push({label:"锁定",key:"lock",icon:_(mt)}):s.push({label:"解锁",key:"unlock",icon:_(vt)}),p.state.userInfo.is_admin&&(e.value.is_top===0?s.push({label:"置顶",key:"stick",icon:_(Ce)}):s.push({label:"取消置顶",key:"unstick",icon:_(Ce)})),e.value.is_essence===0?s.push({label:"设为亮点",key:"highlight",icon:_(xe)}):s.push({label:"取消亮点",key:"unhighlight",icon:_(xe)}),e.value.visibility===Z.PUBLIC?s.push({label:"公开",key:"vpublic",icon:_(ve),children:[{label:"私密",key:"vprivate",icon:_(he)},{label:"好友可见",key:"vfriend",icon:_(fe)}]}):e.value.visibility===Z.PRIVATE?s.push({label:"私密",key:"vprivate",icon:_(he),children:[{label:"公开",key:"vpublic",icon:_(ve)},{label:"好友可见",key:"vfriend",icon:_(fe)}]}):s.push({label:"好友可见",key:"vfriend",icon:_(fe),children:[{label:"公开",key:"vpublic",icon:_(ve)},{label:"私密",key:"vprivate",icon:_(he)}]}),s}),w=s=>{f.push({name:"post",query:{id:s}})},M=(s,d)=>{if(s.target.dataset.detail){const m=s.target.dataset.detail.split(":");if(m.length===2){p.commit("refresh"),m[0]==="tag"?f.push({name:"home",query:{q:m[1],t:"tag"}}):f.push({name:"user",query:{username:m[1]}});return}}w(d)},j=s=>{switch(s){case"delete":L.value=!0;break;case"lock":case"unlock":r.value=!0;break;case"stick":case"unstick":U.value=!0;break;case"highlight":case"unhighlight":T.value=!0;break;case"vpublic":R.value=0,h.value=!0;break;case"vprivate":R.value=1,h.value=!0;break;case"vfriend":R.value=2,h.value=!0;break}},B=()=>{Ge({id:e.value.id}).then(s=>{window.$message.success("删除成功"),f.replace("/"),setTimeout(()=>{p.commit("refresh")},50)}).catch(s=>{$.value=!1})},V=()=>{Xe({id:e.value.id}).then(s=>{D("reload"),s.lock_status===1?window.$message.success("锁定成功"):window.$message.success("解锁成功")}).catch(s=>{$.value=!1})},z=()=>{Ze({id:e.value.id}).then(s=>{D("reload"),s.top_status===1?window.$message.success("置顶成功"):window.$message.success("取消置顶成功")}).catch(s=>{$.value=!1})},S=()=>{et({id:e.value.id}).then(s=>{D("reload"),s.highlight_status===1?window.$message.success("设为亮点成功"):window.$message.success("取消亮点成功")}).catch(s=>{$.value=!1})},K=()=>{tt({id:e.value.id,visibility:R.value}).then(s=>{D("reload"),window.$message.success("修改可见性成功")}).catch(s=>{$.value=!1})},F=()=>{st({id:e.value.id}).then(s=>{y.value=s.status,s.status?e.value={...e.value,upvote_count:e.value.upvote_count+1}:e.value={...e.value,upvote_count:e.value.upvote_count-1}}).catch(s=>{console.log(s)})},J=()=>{ot({id:e.value.id}).then(s=>{k.value=s.status,s.status?e.value={...e.value,collection_count:e.value.collection_count+1}:e.value={...e.value,collection_count:e.value.collection_count-1}}).catch(s=>{console.log(s)})},W=()=>{jt(`${window.location.origin}/#/post?id=${e.value.id}`),window.$message.success("链接已复制到剪贴板")};return ye(()=>{p.state.userInfo.id>0&&(Qe({id:e.value.id}).then(s=>{y.value=s.status}).catch(s=>{console.log(s)}),We({id:e.value.id}).then(s=>{k.value=s.status}).catch(s=>{console.log(s)}))}),(s,d)=>{const m=ke,g=ge("router-link"),b=xt,C=oe,E=It,q=Tt,Q=Mt,pe=Oe,de=At,me=Dt,ne=Pt,G=Le,Ae=Se;return o(),u("div",{class:"detail-item",onClick:d[7]||(d[7]=N=>w(e.value.id))},[t(Ae,null,{avatar:n(()=>[t(m,{round:"",size:30,src:e.value.user.avatar},null,8,["src"])]),header:n(()=>[t(g,{onClick:d[0]||(d[0]=H(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.value.user.username}}},{default:n(()=>[x(I(e.value.user.nickname),1)]),_:1},8,["to"]),v("span",Hs," @"+I(e.value.user.username),1),e.value.is_top?(o(),P(b,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[x(" 置顶 ")]),_:1})):i("",!0),e.value.visibility==a(Z).PRIVATE?(o(),P(b,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[x(" 私密 ")]),_:1})):i("",!0),e.value.visibility==a(Z).FRIEND?(o(),P(b,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[x(" 好友可见 ")]),_:1})):i("",!0)]),"header-extra":n(()=>[a(p).state.userInfo.is_admin||a(p).state.userInfo.id===e.value.user.id?(o(),u("div",Fs,[t(E,{placement:"bottom-end",trigger:"click",size:"small",options:O.value,onSelect:j},{default:n(()=>[t(C,{quaternary:"",circle:""},{icon:n(()=>[t(a(Y),null,{default:n(()=>[t(a(lt))]),_:1})]),_:1})]),_:1},8,["options"])])):i("",!0),t(q,{show:L.value,"onUpdate:show":d[1]||(d[1]=N=>L.value=N),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定删除该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:B},null,8,["show"]),t(q,{show:r.value,"onUpdate:show":d[2]||(d[2]=N=>r.value=N),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e.value.is_lock?"解锁":"锁定")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:V},null,8,["show","content"]),t(q,{show:U.value,"onUpdate:show":d[3]||(d[3]=N=>U.value=N),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(e.value.is_top?"取消置顶":"置顶")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:z},null,8,["show","content"]),t(q,{show:T.value,"onUpdate:show":d[4]||(d[4]=N=>T.value=N),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态"+(e.value.is_essence?"取消亮点":"设为亮点")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:S},null,8,["show","content"]),t(q,{show:h.value,"onUpdate:show":d[5]||(d[5]=N=>h.value=N),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态可见度修改为"+(R.value==0?"公开":R.value==1?"私密":"好友可见")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:K},null,8,["show","content"])]),footer:n(()=>[t(Q,{attachments:e.value.attachments},null,8,["attachments"]),t(Q,{attachments:e.value.charge_attachments,price:e.value.attachment_price},null,8,["attachments","price"]),t(pe,{imgs:e.value.imgs},null,8,["imgs"]),t(de,{videos:e.value.videos,full:!0},null,8,["videos"]),t(me,{links:e.value.links},null,8,["links"]),v("div",Js,[x(" 发布于 "+I(a(ue)(e.value.created_on))+" ",1),e.value.ip_loc?(o(),u("span",Ks,[t(ne,{vertical:""}),x(" "+I(e.value.ip_loc),1)])):i("",!0),!a(p).state.collapsedLeft&&e.value.created_on!=e.value.latest_replied_on?(o(),u("span",Qs,[t(ne,{vertical:""}),x(" 最后回复 "+I(a(ue)(e.value.latest_replied_on)),1)])):i("",!0)])]),action:n(()=>[v("div",Ws,[t(G,{justify:"space-between"},{default:n(()=>[v("div",{class:"opt-item hover",onClick:H(F,["stop"])},[t(a(Y),{size:"20",class:"opt-item-icon"},{default:n(()=>[y.value?i("",!0):(o(),P(a(it),{key:0})),y.value?(o(),P(a(ut),{key:1,color:"red"})):i("",!0)]),_:1}),x(" "+I(e.value.upvote_count),1)],8,Gs),v("div",Xs,[t(a(Y),{size:"20",class:"opt-item-icon"},{default:n(()=>[t(a(ct))]),_:1}),x(" "+I(e.value.comment_count),1)]),v("div",{class:"opt-item hover",onClick:H(J,["stop"])},[t(a(Y),{size:"20",class:"opt-item-icon"},{default:n(()=>[k.value?i("",!0):(o(),P(a(rt),{key:0})),k.value?(o(),P(a(_t),{key:1,color:"#ff7600"})):i("",!0)]),_:1}),x(" "+I(e.value.collection_count),1)],8,Zs),v("div",{class:"opt-item hover",onClick:H(W,["stop"])},[t(a(Y),{size:"20",class:"opt-item-icon"},{default:n(()=>[t(a(pt))]),_:1}),x(" "+I(e.value.share_count),1)],8,eo)]),_:1})])]),default:n(()=>[e.value.texts.length>0?(o(),u("div",Vs,[(o(!0),u(le,null,ie(e.value.texts,N=>(o(),u("span",{key:N.id,class:"post-text",onClick:d[6]||(d[6]=H(De=>M(De,e.value.id),["stop"])),innerHTML:a(we)(N.content).content},null,8,Ys))),128))])):i("",!0)]),_:1})])}}});const so=A=>(Ie("data-v-0d01659f"),A=A(),Te(),A),oo={key:0,class:"detail-wrap"},no={key:1,class:"empty-wrap"},ao={key:0,class:"comment-opts-wrap"},lo=so(()=>v("span",{class:"comment-title-item"},"评论",-1)),io={key:2},uo={key:0,class:"skeleton-wrap"},co={key:1},ro={key:0,class:"empty-wrap"},_o={key:0,class:"load-more-spinner"},po={key:1,class:"load-more-spinner"},mo={key:2,class:"load-more-spinner"},vo={key:3,class:"load-more-spinner"},ee=20,ho=X({__name:"Post",setup(A){const D=qt(),l=c({}),p=c(!1),f=c(!1),y=c([]),k=ae(()=>+D.query.id),L=c("default"),r=c(!0);let U={loading(){},loaded(){},complete(){},error(){}};const T=z=>{L.value=z,z==="default"&&(r.value=!0),B(U)},h=()=>{l.value={id:0},p.value=!0,nt({id:k.value}).then(z=>{p.value=!1,l.value=z,B(U)}).catch(z=>{p.value=!1})};let $=1;const R=c(!1),e=c([]),_=z=>{R.value||$e({id:l.value.id,sort_strategy:"default",page:$,page_size:ee}).then(S=>{z!==null&&(U=z),S.list.length0&&($===1?e.value=S.list:e.value.push(...S.list),y.value=e.value),U.loaded(),f.value=!1}).catch(S=>{f.value=!1,U.error()})};let O=1,w=c(!1);const M=c([]),j=z=>{w.value||$e({id:l.value.id,sort_strategy:"newest",page:O,page_size:ee}).then(S=>{z!==null&&(U=z),S.list.length0&&(O===1?M.value=S.list:M.value.push(...S.list),y.value=M.value),U.loaded(),f.value=!1}).catch(S=>{f.value=!1,U.error()})},B=z=>{k.value<1||(y.value.length===0&&(f.value=!0),L.value==="default"?(y.value=e.value,_(z)):(y.value=M.value,j(z)),f.value=!1)},V=()=>{$=1,R.value=!1,e.value=[],O=1,w.value=!1,M.value=[],B(U)};return ye(()=>{h()}),Ee(k,()=>{k.value>0&&D.name==="post"&&h()}),(z,S)=>{const K=Bt,F=to,J=Ut,W=Rt,s=St,d=Lt,m=Ot,g=Bs,b=Et,C=Ps,E=Le,q=zt;return o(),u("div",null,[t(K,{title:"泡泡详情",back:!0}),t(q,{class:"main-content-wrap",bordered:""},{default:n(()=>[t(s,null,{default:n(()=>[t(W,{show:p.value},{default:n(()=>[l.value.id>1?(o(),u("div",oo,[t(F,{post:l.value,onReload:h},null,8,["post"])])):(o(),u("div",no,[t(J,{size:"large",description:"暂无数据"})]))]),_:1},8,["show"])]),_:1}),l.value.id>0?(o(),u("div",ao,[t(m,{type:"bar","justify-content":"end",size:"small",animated:"","onUpdate:value":T},{prefix:n(()=>[lo]),default:n(()=>[t(d,{name:"default",tab:"默认"}),t(d,{name:"newest",tab:"最新"})]),_:1})])):i("",!0),l.value.id>0?(o(),P(s,{key:1},{default:n(()=>[t(g,{lock:l.value.is_lock,"post-id":l.value.id,onPostSuccess:V},null,8,["lock","post-id"])]),_:1})):i("",!0),l.value.id>0?(o(),u("div",io,[f.value?(o(),u("div",uo,[t(b,{num:5})])):(o(),u("div",co,[y.value.length===0?(o(),u("div",ro,[t(J,{size:"large",description:"暂无评论,快来抢沙发"})])):i("",!0),(o(!0),u(le,null,ie(y.value,Q=>(o(),P(s,{key:Q.id},{default:n(()=>[t(C,{comment:Q,onReload:V},null,8,["comment"])]),_:2},1024))),128))]))])):i("",!0),y.value.length>=ee?(o(),P(E,{key:3,justify:"center"},{default:n(()=>[t(a(Ht),{class:"load-more",slots:{complete:"没有更多数据了",error:"加载出错"},onInfinite:B},{spinner:n(()=>[r.value&&R.value?(o(),u("span",_o)):i("",!0),!r.value&&a(w)?(o(),u("span",po)):i("",!0),r.value&&!R.value?(o(),u("span",mo,"加载评论")):i("",!0),!r.value&&!a(w)?(o(),u("span",vo,"加载评论")):i("",!0)]),_:1})]),_:1})):i("",!0)]),_:1})])}}});const Qo=se(ho,[["__scopeId","data-v-0d01659f"]]);export{Qo as default}; diff --git a/web/dist/assets/Post-7248c732.js b/web/dist/assets/Post-7248c732.js deleted file mode 100644 index b9e7d9c6..00000000 --- a/web/dist/assets/Post-7248c732.js +++ /dev/null @@ -1 +0,0 @@ -import{d as W,r,a3 as me,o,c as u,a as m,V as e,a1 as n,e as T,M as z,Q as U,O as i,_ as a,a2 as V,n as ne,a7 as Pe,F as ae,a4 as le,j as ve,W as ye,X as ke,w as Re}from"./@vue-e0e89260.js";import{u as Z}from"./vuex-473b3783.js";import{f as ie}from"./formatTime-cdf4e6f1.js";import{t as Se,d as Le,e as Me,_ as ee,f as Ae,h as De,i as Oe,j as qe,g as Ne,k as je,l as Be,m as Ee,n as Ve,o as He,s as Fe,v as Ye,p as Je,q as Ke,r as Qe,u as ge}from"./index-8b4e1776.js";import{Y as ue,V as G}from"./IEnum-a180d93e.js";import{T as we,e as ce,f as be,g as re,h as $e,I as We,i as Ge,j as Xe,k as Ze,l as et,m as tt,n as st,o as ot}from"./@vicons-d502290a.js";import{j as te,e as se,J as Ce,K as nt,b as at,L as lt,o as fe,M as xe,v as it,w as ut,x as ct,y as rt,z as _t,B as pt,O as dt,P as mt,i as vt,Q as ft,a as Ie,F as ht,I as gt,k as yt,H as kt,f as wt,g as bt}from"./naive-ui-62663ad7.js";import{p as he,_ as Te,a as $t,b as Ct,c as xt}from"./content-c0ce69b7.js";import{u as ze,b as It}from"./vue-router-b8e3382f.js";import{_ as Tt}from"./post-skeleton-627d3fc3.js";import{l as zt}from"./lodash-94eb5868.js";import{a as Ut}from"./copy-to-clipboard-1dd3075d.js";import{_ as Pt}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{W as Rt}from"./v3-infinite-loading-e5c2e8bf.js";import"./moment-2ab8298d.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./paopao-video-player-aa5e8b3f.js";import"./toggle-selection-93f4ad84.js";const St={class:"reply-item"},Lt={class:"header-wrap"},Mt={class:"username"},At={class:"reply-name"},Dt={class:"timestamp"},Ot={class:"base-wrap"},qt={class:"content"},Nt={class:"reply-switch"},jt={class:"time-item"},Bt={class:"actions"},Et={class:"upvote-count"},Vt=["onClick"],Ht={class:"upvote-count"},Ft={key:2,class:"action-item"},Yt=["onClick"],Jt=W({__name:"reply-item",props:{tweetId:{},reply:{}},emits:["focusReply","reload"],setup(D,{emit:q}){const l=D,_=Z(),h=r(l.reply.is_thumbs_up==ue.YES),y=r(l.reply.is_thumbs_down==ue.YES),k=r(l.reply.thumbs_up_count),L=()=>{Se({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(v=>{h.value=!h.value,h.value?(k.value++,y.value=!1):k.value--}).catch(v=>{console.log(v)})},c=()=>{Le({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(v=>{y.value=!y.value,y.value&&h.value&&(k.value--,h.value=!1)}).catch(v=>{console.log(v)})},R=()=>{q("focusReply",l.reply)},I=()=>{Me({id:l.reply.id}).then(v=>{window.$message.success("删除成功"),setTimeout(()=>{q("reload")},50)}).catch(v=>{console.log(v)})};return(v,b)=>{const t=me("router-link"),f=te,$=se,M=Ce,w=nt;return o(),u("div",St,[m("div",Lt,[m("div",Mt,[e(t,{class:"user-link",to:{name:"user",query:{username:l.reply.user.username}}},{default:n(()=>[T(z(l.reply.user.username),1)]),_:1},8,["to"]),m("span",At,z(l.reply.at_user_id>0?"回复":":"),1),l.reply.at_user_id>0?(o(),U(t,{key:0,class:"user-link",to:{name:"user",query:{username:l.reply.at_user.username}}},{default:n(()=>[T(z(l.reply.at_user.username),1)]),_:1},8,["to"])):i("",!0)]),m("div",Dt,[T(z(l.reply.ip_loc)+" ",1),a(_).state.userInfo.is_admin||a(_).state.userInfo.id===l.reply.user.id?(o(),U(M,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:I},{trigger:n(()=>[e($,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:n(()=>[e(f,null,{default:n(()=>[e(a(we))]),_:1})]),_:1})]),default:n(()=>[T(" 是否确认删除? ")]),_:1})):i("",!0)])]),m("div",Ot,[m("div",qt,[e(w,{"expand-trigger":"click","line-clamp":"5",tooltip:!1},{default:n(()=>[T(z(l.reply.content),1)]),_:1})]),m("div",Nt,[m("span",jt,z(a(ie)(l.reply.created_on)),1),m("div",Bt,[a(_).state.userLogined?i("",!0):(o(),u("div",{key:0,class:"action-item",onClick:b[0]||(b[0]=V(()=>{},["stop"]))},[e(f,{size:"medium"},{default:n(()=>[e(a(ce))]),_:1}),m("span",Et,z(k.value),1)])),a(_).state.userLogined?(o(),u("div",{key:1,class:"action-item hover",onClick:V(L,["stop"])},[e(f,{size:"medium"},{default:n(()=>[h.value?i("",!0):(o(),U(a(ce),{key:0})),h.value?(o(),U(a(be),{key:1,class:"show"})):i("",!0)]),_:1}),m("span",Ht,z(k.value>0?k.value:"赞"),1)],8,Vt)):i("",!0),a(_).state.userLogined?i("",!0):(o(),u("div",Ft,[e(f,{size:"medium"},{default:n(()=>[e(a(re))]),_:1})])),a(_).state.userLogined?(o(),u("div",{key:3,class:"action-item hover",onClick:V(c,["stop"])},[e(f,{size:"medium"},{default:n(()=>[y.value?i("",!0):(o(),U(a(re),{key:0})),y.value?(o(),U(a($e),{key:1,class:"show"})):i("",!0)]),_:1})],8,Yt)):i("",!0),a(_).state.userLogined?(o(),u("span",{key:4,class:"show opacity-item reply-btn",onClick:R}," 回复 ")):i("",!0)])])])])}}});const Kt=ee(Jt,[["__scopeId","data-v-0fa8b923"]]),Qt={class:"reply-compose-wrap"},Wt={class:"reply-switch"},Gt={class:"time-item"},Xt={class:"actions"},Zt={key:0,class:"action-item"},es={class:"upvote-count"},ts=["onClick"],ss={class:"upvote-count"},os={key:2,class:"action-item"},ns=["onClick"],as={key:0,class:"reply-input-wrap"},ls=W({__name:"compose-reply",props:{comment:{},atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(D,{expose:q,emit:l}){const _=D,h=Z(),y=r(),k=r(!1),L=r(""),c=r(!1),R=+"300",I=r(_.comment.is_thumbs_up==ue.YES),v=r(_.comment.is_thumbs_down==ue.YES),b=r(_.comment.thumbs_up_count),t=()=>{Ae({tweet_id:_.comment.post_id,comment_id:_.comment.id}).then(w=>{I.value=!I.value,I.value?(b.value++,v.value=!1):b.value--}).catch(w=>{console.log(w)})},f=()=>{De({tweet_id:_.comment.post_id,comment_id:_.comment.id}).then(w=>{v.value=!v.value,v.value&&I.value&&(b.value--,I.value=!1)}).catch(w=>{console.log(w)})},$=w=>{k.value=w,w?setTimeout(()=>{var A;(A=y.value)==null||A.focus()},10):(c.value=!1,L.value="",l("reset"))},M=()=>{c.value=!0,Oe({comment_id:_.comment.id,at_user_id:_.atUserid,content:L.value}).then(w=>{$(!1),window.$message.success("评论成功"),l("reload")}).catch(w=>{c.value=!1})};return q({switchReply:$}),(w,A)=>{const j=te,B=at,F=se,P=lt;return o(),u("div",Qt,[m("div",Wt,[m("span",Gt,z(a(ie)(w.comment.created_on)),1),m("div",Xt,[a(h).state.userLogined?i("",!0):(o(),u("div",Zt,[e(j,{size:"medium"},{default:n(()=>[e(a(ce))]),_:1}),m("span",es,z(b.value),1)])),a(h).state.userLogined?(o(),u("div",{key:1,class:"action-item hover",onClick:V(t,["stop"])},[e(j,{size:"medium"},{default:n(()=>[I.value?i("",!0):(o(),U(a(ce),{key:0})),I.value?(o(),U(a(be),{key:1,class:"show"})):i("",!0)]),_:1}),m("span",ss,z(b.value>0?b.value:"赞"),1)],8,ts)):i("",!0),a(h).state.userLogined?i("",!0):(o(),u("div",os,[e(j,{size:"medium"},{default:n(()=>[e(a(re))]),_:1})])),a(h).state.userLogined?(o(),u("div",{key:3,class:"action-item hover",onClick:V(f,["stop"])},[e(j,{size:"medium"},{default:n(()=>[v.value?i("",!0):(o(),U(a(re),{key:0})),v.value?(o(),U(a($e),{key:1,class:"show"})):i("",!0)]),_:1})],8,ns)):i("",!0),a(h).state.userLogined&&!k.value?(o(),u("span",{key:4,class:"show reply-btn",onClick:A[0]||(A[0]=S=>$(!0))}," 回复 ")):i("",!0),a(h).state.userLogined&&k.value?(o(),u("span",{key:5,class:"hide reply-btn",onClick:A[1]||(A[1]=S=>$(!1))}," 取消 ")):i("",!0)])]),k.value?(o(),u("div",as,[e(P,null,{default:n(()=>[e(B,{ref_key:"inputInstRef",ref:y,size:"small",placeholder:_.atUsername?"@"+_.atUsername:"请输入回复内容..",maxlength:a(R),value:L.value,"onUpdate:value":A[2]||(A[2]=S=>L.value=S),"show-count":"",clearable:""},null,8,["placeholder","maxlength","value"]),e(F,{type:"primary",size:"small",ghost:"",loading:c.value,onClick:M},{default:n(()=>[T(" 回复 ")]),_:1},8,["loading"])]),_:1})])):i("",!0)])}}});const is=ee(ls,[["__scopeId","data-v-f9af7a93"]]),us={class:"comment-item"},cs={class:"nickname-wrap"},rs={class:"username-wrap"},_s={class:"opt-wrap"},ps={class:"timestamp"},ds=["innerHTML"],ms={class:"reply-wrap"},vs=W({__name:"comment-item",props:{comment:{}},emits:["reload"],setup(D,{emit:q}){const l=D,_=Z(),h=ze(),y=r(0),k=r(""),L=r(),c=ne(()=>{let f=Object.assign({texts:[],imgs:[]},l.comment);return f.contents.map($=>{(+$.type==1||+$.type==2)&&f.texts.push($),+$.type==3&&f.imgs.push($)}),f}),R=(f,$)=>{let M=f.target;if(M.dataset.detail){const w=M.dataset.detail.split(":");w.length===2&&(_.commit("refresh"),w[0]==="tag"?window.$message.warning("评论内的无效话题"):h.push({name:"user",query:{username:w[1]}}))}},I=f=>{var $,M;y.value=f.user_id,k.value=(($=f.user)==null?void 0:$.username)||"",(M=L.value)==null||M.switchReply(!0)},v=()=>{q("reload")},b=()=>{y.value=0,k.value=""},t=()=>{qe({id:c.value.id}).then(f=>{window.$message.success("删除成功"),setTimeout(()=>{v()},50)}).catch(f=>{})};return(f,$)=>{const M=fe,w=me("router-link"),A=te,j=se,B=Ce,F=Te,P=is,S=Kt,J=xe;return o(),u("div",us,[e(J,{"content-indented":""},Pe({avatar:n(()=>[e(M,{round:"",size:30,src:c.value.user.avatar},null,8,["src"])]),header:n(()=>[m("span",cs,[e(w,{onClick:$[0]||($[0]=V(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:c.value.user.username}}},{default:n(()=>[T(z(c.value.user.nickname),1)]),_:1},8,["to"])]),m("span",rs," @"+z(c.value.user.username),1)]),"header-extra":n(()=>[m("div",_s,[m("span",ps,z(c.value.ip_loc),1),a(_).state.userInfo.is_admin||a(_).state.userInfo.id===c.value.user.id?(o(),U(B,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:t},{trigger:n(()=>[e(j,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:n(()=>[e(A,null,{default:n(()=>[e(a(we))]),_:1})]),_:1})]),default:n(()=>[T(" 是否确认删除? ")]),_:1})):i("",!0)])]),footer:n(()=>[c.value.imgs.length>0?(o(),U(F,{key:0,imgs:c.value.imgs},null,8,["imgs"])):i("",!0),e(P,{ref_key:"replyComposeRef",ref:L,comment:c.value,"at-userid":y.value,"at-username":k.value,onReload:v,onReset:b},null,8,["comment","at-userid","at-username"]),m("div",ms,[(o(!0),u(ae,null,le(c.value.replies,s=>(o(),U(S,{key:s.id,reply:s,"tweet-id":c.value.post_id,onFocusReply:I,onReload:v},null,8,["reply","tweet-id"]))),128))])]),_:2},[c.value.texts.length>0?{name:"description",fn:n(()=>[(o(!0),u(ae,null,le(c.value.texts,s=>(o(),u("span",{key:s.id,class:"comment-text",onClick:$[1]||($[1]=V(d=>R(d,c.value.id),["stop"])),innerHTML:a(he)(s.content).content},null,8,ds))),128))]),key:"0"}:void 0]),1024)])}}});const fs=ee(vs,[["__scopeId","data-v-e5cb084f"]]),hs=D=>(ye("data-v-634e6bfd"),D=D(),ke(),D),gs={key:0,class:"compose-wrap"},ys={class:"compose-line"},ks={class:"compose-user"},ws={class:"compose-line compose-options"},bs={class:"attachment"},$s={class:"submit-wrap"},Cs={class:"attachment-list-wrap"},xs={key:1,class:"compose-wrap"},Is=hs(()=>m("div",{class:"login-wrap"},[m("span",{class:"login-banner"}," 登录后,精彩更多")],-1)),Ts={key:0,class:"login-only-wrap"},zs={key:1,class:"login-wrap"},Us=W({__name:"compose-comment",props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(D,{emit:q}){const l=D,_=Z(),h=r([]),y=r(!1),k=r(!1),L=r(!1),c=r(""),R=r(),I=r("public/image"),v=r([]),b=r([]),t=r("true".toLowerCase()==="true"),f=+"300",$="/v1/attachment",M=r(),w=zt.debounce(p=>{Ne({k:p}).then(g=>{let C=[];g.suggest.map(x=>{C.push({label:x,value:x})}),h.value=C,k.value=!1}).catch(g=>{k.value=!1})},200),A=(p,g)=>{k.value||(k.value=!0,g==="@"&&w(p))},j=p=>{p.length>f?c.value=p.substring(0,f):c.value=p},B=p=>{I.value=p},F=p=>{for(let N=0;N30&&(p[N].name=C.substring(0,18)+"..."+C.substring(C.length-9)+"."+x)}v.value=p},P=async p=>{var g,C;return I.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((g=p.file.file)==null?void 0:g.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):I.value==="image"&&((C=p.file.file)==null?void 0:C.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):!0},S=({file:p,event:g})=>{var C;try{let x=JSON.parse((C=g.target)==null?void 0:C.response);x.code===0&&I.value==="public/image"&&b.value.push({id:p.id,content:x.data.content})}catch{window.$message.error("上传失败")}},J=({file:p,event:g})=>{var C;try{let x=JSON.parse((C=g.target)==null?void 0:C.response);if(x.code!==0){let N=x.msg||"上传失败";x.details&&x.details.length>0&&x.details.map(E=>{N+=":"+E}),window.$message.error(N)}}catch{window.$message.error("上传失败")}},s=({file:p})=>{let g=b.value.findIndex(C=>C.id===p.id);g>-1&&b.value.splice(g,1)},d=()=>{y.value=!0},H=()=>{var p;y.value=!1,(p=R.value)==null||p.clear(),v.value=[],c.value="",b.value=[]},K=()=>{if(c.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{users:p}=he(c.value);const g=[];let C=100;g.push({content:c.value,type:2,sort:C}),b.value.map(x=>{C++,g.push({content:x.content,type:3,sort:C})}),L.value=!0,je({contents:g,post_id:l.postId,users:Array.from(new Set(p))}).then(x=>{window.$message.success("发布成功"),L.value=!1,q("post-success"),H()}).catch(x=>{L.value=!1})},Y=p=>{_.commit("triggerAuth",!0),_.commit("triggerAuthKey",p)};return ve(()=>{M.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(p,g)=>{const C=fe,x=it,N=te,E=se,Q=ut,_e=ct,oe=rt,pe=_t,de=pt;return o(),u("div",null,[a(_).state.userInfo.id>0?(o(),u("div",gs,[m("div",ys,[m("div",ks,[e(C,{round:"",size:30,src:a(_).state.userInfo.avatar},null,8,["src"])]),e(x,{type:"textarea",size:"large",autosize:"",bordered:!1,options:h.value,prefix:["@"],loading:k.value,value:c.value,disabled:l.lock===1,"onUpdate:value":j,onSearch:A,onFocus:d,placeholder:l.lock===1?"泡泡已被锁定,回复功能已关闭":"快来评论两句吧..."},null,8,["options","loading","value","disabled","placeholder"])]),y.value?(o(),U(de,{key:0,ref_key:"uploadRef",ref:R,abstract:"","list-type":"image",multiple:!0,max:9,action:$,headers:{Authorization:M.value},data:{type:I.value},"file-list":v.value,onBeforeUpload:P,onFinish:S,onError:J,onRemove:s,"onUpdate:fileList":F},{default:n(()=>[m("div",ws,[m("div",bs,[e(Q,{abstract:""},{default:n(({handleClick:O})=>[e(E,{disabled:v.value.length>0&&I.value==="public/video"||v.value.length===9,onClick:()=>{B("public/image"),O()},quaternary:"",circle:"",type:"primary"},{icon:n(()=>[e(N,{size:"20",color:"var(--primary-color)"},{default:n(()=>[e(a(We))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),e(oe,{trigger:"hover",placement:"bottom"},{trigger:n(()=>[e(_e,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:c.value.length/a(f)*100},null,8,["percentage"])]),default:n(()=>[T(" "+z(c.value.length)+" / "+z(a(f)),1)]),_:1})]),m("div",$s,[e(E,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:H},{default:n(()=>[T(" 取消 ")]),_:1}),e(E,{loading:L.value,onClick:K,type:"primary",secondary:"",size:"small",round:""},{default:n(()=>[T(" 发布 ")]),_:1},8,["loading"])])]),m("div",Cs,[e(pe)])]),_:1},8,["headers","data","file-list"])):i("",!0)])):(o(),u("div",xs,[Is,t.value?i("",!0):(o(),u("div",Ts,[e(E,{strong:"",secondary:"",round:"",type:"primary",onClick:g[0]||(g[0]=O=>Y("signin"))},{default:n(()=>[T(" 登录 ")]),_:1})])),t.value?(o(),u("div",zs,[e(E,{strong:"",secondary:"",round:"",type:"primary",onClick:g[1]||(g[1]=O=>Y("signin"))},{default:n(()=>[T(" 登录 ")]),_:1}),e(E,{strong:"",secondary:"",round:"",type:"info",onClick:g[2]||(g[2]=O=>Y("signup"))},{default:n(()=>[T(" 注册 ")]),_:1})])):i("",!0)]))])}}});const Ps=ee(Us,[["__scopeId","data-v-634e6bfd"]]),Rs={class:"username-wrap"},Ss={key:0,class:"options"},Ls={key:0},Ms=["innerHTML"],As={class:"timestamp"},Ds={key:0},Os={key:1},qs={class:"opts-wrap"},Ns=["onClick"],js={class:"opt-item"},Bs=["onClick"],Es=["onClick"],Vs=W({__name:"post-detail",props:{post:{}},emits:["reload"],setup(D,{emit:q}){const l=D,_=Z(),h=ze(),y=r(!1),k=r(!1),L=r(!1),c=r(!1),R=r(!1),I=r(!1),v=r(!1),b=r(G.PUBLIC),t=ne({get:()=>{let s=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},l.post);return s.contents.map(d=>{(+d.type==1||+d.type==2)&&s.texts.push(d),+d.type==3&&s.imgs.push(d),+d.type==4&&s.videos.push(d),+d.type==6&&s.links.push(d),+d.type==7&&s.attachments.push(d),+d.type==8&&s.charge_attachments.push(d)}),s},set:s=>{l.post.upvote_count=s.upvote_count,l.post.comment_count=s.comment_count,l.post.collection_count=s.collection_count}}),f=ne(()=>{let s=[{label:"删除",key:"delete"}];return t.value.is_lock===0?s.push({label:"锁定",key:"lock"}):s.push({label:"解锁",key:"unlock"}),_.state.userInfo.is_admin&&(t.value.is_top===0?s.push({label:"置顶",key:"stick"}):s.push({label:"取消置顶",key:"unstick"})),t.value.visibility===G.PUBLIC?s.push({label:"公开",key:"vpublic",children:[{label:"私密",key:"vprivate"},{label:"好友可见",key:"vfriend"}]}):t.value.visibility===G.PRIVATE?s.push({label:"私密",key:"vprivate",children:[{label:"公开",key:"vpublic"},{label:"好友可见",key:"vfriend"}]}):s.push({label:"好友可见",key:"vfriend",children:[{label:"公开",key:"vpublic"},{label:"私密",key:"vprivate"}]}),s}),$=s=>{h.push({name:"post",query:{id:s}})},M=(s,d)=>{if(s.target.dataset.detail){const H=s.target.dataset.detail.split(":");if(H.length===2){_.commit("refresh"),H[0]==="tag"?h.push({name:"home",query:{q:H[1],t:"tag"}}):h.push({name:"user",query:{username:H[1]}});return}}$(d)},w=s=>{switch(s){case"delete":L.value=!0;break;case"lock":case"unlock":c.value=!0;break;case"stick":case"unstick":R.value=!0;break;case"vpublic":b.value=0,I.value=!0;break;case"vprivate":b.value=1,I.value=!0;break;case"vfriend":b.value=2,I.value=!0;break}},A=()=>{Ve({id:t.value.id}).then(s=>{window.$message.success("删除成功"),h.replace("/"),setTimeout(()=>{_.commit("refresh")},50)}).catch(s=>{v.value=!1})},j=()=>{He({id:t.value.id}).then(s=>{q("reload"),s.lock_status===1?window.$message.success("锁定成功"):window.$message.success("解锁成功")}).catch(s=>{v.value=!1})},B=()=>{Fe({id:t.value.id}).then(s=>{q("reload"),s.top_status===1?window.$message.success("置顶成功"):window.$message.success("取消置顶成功")}).catch(s=>{v.value=!1})},F=()=>{Ye({id:t.value.id,visibility:b.value}).then(s=>{q("reload"),window.$message.success("修改可见性成功")}).catch(s=>{v.value=!1})},P=()=>{Je({id:t.value.id}).then(s=>{y.value=s.status,s.status?t.value={...t.value,upvote_count:t.value.upvote_count+1}:t.value={...t.value,upvote_count:t.value.upvote_count-1}}).catch(s=>{console.log(s)})},S=()=>{Ke({id:t.value.id}).then(s=>{k.value=s.status,s.status?t.value={...t.value,collection_count:t.value.collection_count+1}:t.value={...t.value,collection_count:t.value.collection_count-1}}).catch(s=>{console.log(s)})},J=()=>{Ut(`${window.location.origin}/#/post?id=${t.value.id}`),window.$message.success("链接已复制到剪贴板")};return ve(()=>{_.state.userInfo.id>0&&(Be({id:t.value.id}).then(s=>{y.value=s.status}).catch(s=>{console.log(s)}),Ee({id:t.value.id}).then(s=>{k.value=s.status}).catch(s=>{console.log(s)}))}),(s,d)=>{const H=fe,K=me("router-link"),Y=dt,p=te,g=se,C=mt,x=vt,N=$t,E=Te,Q=Ct,_e=xt,oe=ft,pe=Ie,de=xe;return o(),u("div",{class:"detail-item",onClick:d[6]||(d[6]=O=>$(t.value.id))},[e(de,null,{avatar:n(()=>[e(H,{round:"",size:30,src:t.value.user.avatar},null,8,["src"])]),header:n(()=>[e(K,{onClick:d[0]||(d[0]=V(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t.value.user.username}}},{default:n(()=>[T(z(t.value.user.nickname),1)]),_:1},8,["to"]),m("span",Rs," @"+z(t.value.user.username),1),t.value.is_top?(o(),U(Y,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[T(" 置顶 ")]),_:1})):i("",!0),t.value.visibility==a(G).PRIVATE?(o(),U(Y,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[T(" 私密 ")]),_:1})):i("",!0),t.value.visibility==a(G).FRIEND?(o(),U(Y,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[T(" 好友可见 ")]),_:1})):i("",!0)]),"header-extra":n(()=>[a(_).state.userInfo.is_admin||a(_).state.userInfo.id===t.value.user.id?(o(),u("div",Ss,[e(C,{placement:"bottom-end",trigger:"click",size:"small",options:f.value,onSelect:w},{default:n(()=>[e(g,{quaternary:"",circle:""},{icon:n(()=>[e(p,null,{default:n(()=>[e(a(Ge))]),_:1})]),_:1})]),_:1},8,["options"])])):i("",!0),e(x,{show:L.value,"onUpdate:show":d[1]||(d[1]=O=>L.value=O),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定删除该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:A},null,8,["show"]),e(x,{show:c.value,"onUpdate:show":d[2]||(d[2]=O=>c.value=O),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(t.value.is_lock?"解锁":"锁定")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:j},null,8,["show","content"]),e(x,{show:R.value,"onUpdate:show":d[3]||(d[3]=O=>R.value=O),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(t.value.is_top?"取消置顶":"置顶")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:B},null,8,["show","content"]),e(x,{show:I.value,"onUpdate:show":d[4]||(d[4]=O=>I.value=O),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态可见度修改为"+(b.value==0?"公开":b.value==1?"私密":"好友可见")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:F},null,8,["show","content"])]),footer:n(()=>[e(N,{attachments:t.value.attachments},null,8,["attachments"]),e(N,{attachments:t.value.charge_attachments,price:t.value.attachment_price},null,8,["attachments","price"]),e(E,{imgs:t.value.imgs},null,8,["imgs"]),e(Q,{videos:t.value.videos,full:!0},null,8,["videos"]),e(_e,{links:t.value.links},null,8,["links"]),m("div",As,[T(" 发布于 "+z(a(ie)(t.value.created_on))+" ",1),t.value.ip_loc?(o(),u("span",Ds,[e(oe,{vertical:""}),T(" "+z(t.value.ip_loc),1)])):i("",!0),!a(_).state.collapsedLeft&&t.value.created_on!=t.value.latest_replied_on?(o(),u("span",Os,[e(oe,{vertical:""}),T(" 最后回复 "+z(a(ie)(t.value.latest_replied_on)),1)])):i("",!0)])]),action:n(()=>[m("div",qs,[e(pe,{justify:"space-between"},{default:n(()=>[m("div",{class:"opt-item hover",onClick:V(P,["stop"])},[e(p,{size:"20",class:"opt-item-icon"},{default:n(()=>[y.value?i("",!0):(o(),U(a(Xe),{key:0})),y.value?(o(),U(a(Ze),{key:1,color:"red"})):i("",!0)]),_:1}),T(" "+z(t.value.upvote_count),1)],8,Ns),m("div",js,[e(p,{size:"20",class:"opt-item-icon"},{default:n(()=>[e(a(et))]),_:1}),T(" "+z(t.value.comment_count),1)]),m("div",{class:"opt-item hover",onClick:V(S,["stop"])},[e(p,{size:"20",class:"opt-item-icon"},{default:n(()=>[k.value?i("",!0):(o(),U(a(tt),{key:0})),k.value?(o(),U(a(st),{key:1,color:"#ff7600"})):i("",!0)]),_:1}),T(" "+z(t.value.collection_count),1)],8,Bs),m("div",{class:"opt-item hover",onClick:V(J,["stop"])},[e(p,{size:"20",class:"opt-item-icon"},{default:n(()=>[e(a(ot))]),_:1}),T(" "+z(t.value.share_count),1)],8,Es)]),_:1})])]),default:n(()=>[t.value.texts.length>0?(o(),u("div",Ls,[(o(!0),u(ae,null,le(t.value.texts,O=>(o(),u("span",{key:O.id,class:"post-text",onClick:d[5]||(d[5]=V(Ue=>M(Ue,t.value.id),["stop"])),innerHTML:a(he)(O.content).content},null,8,Ms))),128))])):i("",!0)]),_:1})])}}});const Hs=D=>(ye("data-v-0d01659f"),D=D(),ke(),D),Fs={key:0,class:"detail-wrap"},Ys={key:1,class:"empty-wrap"},Js={key:0,class:"comment-opts-wrap"},Ks=Hs(()=>m("span",{class:"comment-title-item"},"评论",-1)),Qs={key:2},Ws={key:0,class:"skeleton-wrap"},Gs={key:1},Xs={key:0,class:"empty-wrap"},Zs={key:0,class:"load-more-spinner"},eo={key:1,class:"load-more-spinner"},to={key:2,class:"load-more-spinner"},so={key:3,class:"load-more-spinner"},X=20,oo=W({__name:"Post",setup(D){const q=It(),l=r({}),_=r(!1),h=r(!1),y=r([]),k=ne(()=>+q.query.id),L=r("default"),c=r(!0);let R={loading(){},loaded(){},complete(){},error(){}};const I=P=>{L.value=P,P==="default"&&(c.value=!0),B(R)},v=()=>{l.value={id:0},_.value=!0,Qe({id:k.value}).then(P=>{_.value=!1,l.value=P,B(R)}).catch(P=>{_.value=!1})};let b=1;const t=r(!1),f=r([]),$=P=>{t.value||ge({id:l.value.id,sort_strategy:"default",page:b,page_size:X}).then(S=>{P!==null&&(R=P),S.list.length0&&(b===1?f.value=S.list:f.value.push(...S.list),y.value=f.value),R.loaded(),h.value=!1}).catch(S=>{h.value=!1,R.error()})};let M=1,w=r(!1);const A=r([]),j=P=>{w.value||ge({id:l.value.id,sort_strategy:"newest",page:M,page_size:X}).then(S=>{P!==null&&(R=P),S.list.length0&&(M===1?A.value=S.list:A.value.push(...S.list),y.value=A.value),R.loaded(),h.value=!1}).catch(S=>{h.value=!1,R.error()})},B=P=>{k.value<1||(y.value.length===0&&(h.value=!0),L.value==="default"?(y.value=f.value,$(P)):(y.value=A.value,j(P)),h.value=!1)},F=()=>{b=1,t.value=!1,f.value=[],M=1,w.value=!1,A.value=[],B(R)};return ve(()=>{v()}),Re(k,()=>{k.value>0&&q.name==="post"&&v()}),(P,S)=>{const J=Pt,s=Vs,d=gt,H=yt,K=kt,Y=wt,p=bt,g=Ps,C=Tt,x=fs,N=Ie,E=ht;return o(),u("div",null,[e(J,{title:"泡泡详情",back:!0}),e(E,{class:"main-content-wrap",bordered:""},{default:n(()=>[e(K,null,{default:n(()=>[e(H,{show:_.value},{default:n(()=>[l.value.id>1?(o(),u("div",Fs,[e(s,{post:l.value,onReload:v},null,8,["post"])])):(o(),u("div",Ys,[e(d,{size:"large",description:"暂无数据"})]))]),_:1},8,["show"])]),_:1}),l.value.id>0?(o(),u("div",Js,[e(p,{type:"bar","justify-content":"end",size:"small",animated:"","onUpdate:value":I},{prefix:n(()=>[Ks]),default:n(()=>[e(Y,{name:"default",tab:"默认"}),e(Y,{name:"newest",tab:"最新"})]),_:1})])):i("",!0),l.value.id>0?(o(),U(K,{key:1},{default:n(()=>[e(g,{lock:l.value.is_lock,"post-id":l.value.id,onPostSuccess:F},null,8,["lock","post-id"])]),_:1})):i("",!0),l.value.id>0?(o(),u("div",Qs,[h.value?(o(),u("div",Ws,[e(C,{num:5})])):(o(),u("div",Gs,[y.value.length===0?(o(),u("div",Xs,[e(d,{size:"large",description:"暂无评论,快来抢沙发"})])):i("",!0),(o(!0),u(ae,null,le(y.value,Q=>(o(),U(K,{key:Q.id},{default:n(()=>[e(x,{comment:Q,onReload:F},null,8,["comment"])]),_:2},1024))),128))]))])):i("",!0),y.value.length>=X?(o(),U(N,{key:3,justify:"center"},{default:n(()=>[e(a(Rt),{class:"load-more",slots:{complete:"没有更多数据了",error:"加载出错"},onInfinite:B},{spinner:n(()=>[c.value&&t.value?(o(),u("span",Zs)):i("",!0),!c.value&&a(w)?(o(),u("span",eo)):i("",!0),c.value&&!t.value?(o(),u("span",to,"加载评论")):i("",!0),!c.value&&!a(w)?(o(),u("span",so,"加载评论")):i("",!0)]),_:1})]),_:1})):i("",!0)]),_:1})])}}});const Oo=ee(oo,[["__scopeId","data-v-0d01659f"]]);export{Oo as default}; diff --git a/web/dist/assets/Profile-24e6724a.css b/web/dist/assets/Profile-24e6724a.css deleted file mode 100644 index d16f3444..00000000 --- a/web/dist/assets/Profile-24e6724a.css +++ /dev/null @@ -1 +0,0 @@ -.profile-baseinfo[data-v-834be275]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-834be275]{width:55px}.profile-baseinfo .base-info[data-v-834be275]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-834be275]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-834be275]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-tabs-wrap[data-v-834be275]{padding:0 16px}.pagination-wrap[data-v-834be275]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-834be275]{background-color:#18181c}.dark .profile-wrap[data-v-834be275],.dark .pagination-wrap[data-v-834be275]{background-color:#101014bf} diff --git a/web/dist/assets/Profile-3af47c12.js b/web/dist/assets/Profile-3af47c12.js new file mode 100644 index 00000000..4eba280c --- /dev/null +++ b/web/dist/assets/Profile-3af47c12.js @@ -0,0 +1 @@ +import{_ as J,a as K}from"./post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js";import{_ as W}from"./post-skeleton-41befd31.js";import{_ as X}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as Y}from"./vuex-473b3783.js";import{b as Z}from"./vue-router-b8e3382f.js";import{B as g,_ as ee}from"./index-08d8af97.js";import{d as ae,r as u,j as te,w as se,c as i,V as n,_,Q as T,a1 as f,O as z,o as l,a as p,M as q,F as $,a4 as F}from"./@vue-e0e89260.js";import{F as oe,G as ne,o as le,f as re,g as ue,I as ie,H as ce}from"./naive-ui-62663ad7.js";import"./content-91ba374b.js";import"./@vicons-6332ad63.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const _e={class:"profile-baseinfo"},pe={class:"avatar"},me={class:"base-info"},ve={class:"username"},de={class:"uid"},ge={key:0,class:"skeleton-wrap"},he={key:1},fe={key:0,class:"empty-wrap"},ke={key:1},be={key:2},we={key:1,class:"pagination-wrap"},ye=ae({__name:"Profile",setup(Pe){const s=Y(),m=Z(),t=u(!1),o=u([]),h=u("post"),x=u(+m.query.p||1),B=u(1),S=u(1),C=u(1),U=u(1),a=u(+m.query.p||1),r=u(20),c=u(0),k=()=>{switch(h.value){case"post":b();break;case"comment":w();break;case"highlight":y();break;case"media":P();break;case"star":I();break}},b=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"post",page:a.value,page_size:r.value}).then(e=>{t.value=!1,o.value=e.list||[],c.value=Math.ceil(e.pager.total_rows/r.value),window.scrollTo(0,0)}).catch(e=>{o.value=[],t.value=!1})},w=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"comment",page:a.value,page_size:r.value}).then(e=>{t.value=!1,o.value=e.list||[],c.value=Math.ceil(e.pager.total_rows/r.value),window.scrollTo(0,0)}).catch(e=>{o.value=[],t.value=!1})},y=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"highlight",page:a.value,page_size:r.value}).then(e=>{t.value=!1,o.value=e.list||[],c.value=Math.ceil(e.pager.total_rows/r.value),window.scrollTo(0,0)}).catch(e=>{o.value=[],t.value=!1})},P=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"media",page:a.value,page_size:r.value}).then(e=>{t.value=!1,o.value=e.list||[],c.value=Math.ceil(e.pager.total_rows/r.value),window.scrollTo(0,0)}).catch(e=>{o.value=[],t.value=!1})},I=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"star",page:a.value,page_size:r.value}).then(e=>{t.value=!1,o.value=e.list||[],c.value=Math.ceil(e.pager.total_rows/r.value),window.scrollTo(0,0)}).catch(e=>{o.value=[],t.value=!1})},N=e=>{switch(h.value=e,h.value){case"post":a.value=x.value,b();break;case"comment":a.value=B.value,w();break;case"highlight":a.value=S.value,y();break;case"media":a.value=C.value,P();break;case"star":a.value=U.value,I();break}},D=e=>{switch(a.value=e,h.value){case"post":x.value=e,b();break;case"comment":B.value=a.value,w();break;case"highlight":S.value=a.value,y();break;case"media":C.value=a.value,P();break;case"star":U.value=a.value,I();break}};return te(()=>{k()}),se(()=>({path:m.path,query:m.query,refresh:s.state.refresh}),(e,M)=>{if(e.refresh!==M.refresh){a.value=+m.query.p||1,setTimeout(()=>{k()},0);return}M.path!=="/post"&&e.path==="/profile"&&(a.value=+m.query.p||1,setTimeout(()=>{k()},0))}),(e,M)=>{const H=X,R=le,v=re,j=ue,E=W,G=ie,L=J,V=ce,O=K,Q=oe,A=ne;return l(),i("div",null,[n(H,{title:"主页"}),_(s).state.userInfo.id>0?(l(),T(Q,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:f(()=>[p("div",_e,[p("div",pe,[n(R,{size:"large",src:_(s).state.userInfo.avatar},null,8,["src"])]),p("div",me,[p("div",ve,[p("strong",null,q(_(s).state.userInfo.nickname),1),p("span",null," @"+q(_(s).state.userInfo.username),1)]),p("div",de,"UID. "+q(_(s).state.userInfo.id),1)])]),n(j,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":N},{default:f(()=>[n(v,{name:"post",tab:"泡泡"}),n(v,{name:"comment",tab:"评论"}),n(v,{name:"highlight",tab:"亮点"}),n(v,{name:"media",tab:"图文"}),n(v,{name:"star",tab:"喜欢"})]),_:1}),t.value?(l(),i("div",ge,[n(E,{num:r.value},null,8,["num"])])):(l(),i("div",he,[o.value.length===0?(l(),i("div",fe,[n(G,{size:"large",description:"暂无数据"})])):z("",!0),_(s).state.desktopModelShow?(l(),i("div",ke,[(l(!0),i($,null,F(o.value,d=>(l(),T(V,{key:d.id},{default:f(()=>[n(L,{post:d},null,8,["post"])]),_:2},1024))),128))])):(l(),i("div",be,[(l(!0),i($,null,F(o.value,d=>(l(),T(V,{key:d.id},{default:f(()=>[n(O,{post:d},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1})):z("",!0),c.value>0?(l(),i("div",we,[n(A,{page:a.value,"onUpdate:page":D,"page-slot":_(s).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):z("",!0)])}}});const ea=ee(ye,[["__scopeId","data-v-08661398"]]);export{ea as default}; diff --git a/web/dist/assets/Profile-67eeb9ca.js b/web/dist/assets/Profile-67eeb9ca.js deleted file mode 100644 index 4b78d106..00000000 --- a/web/dist/assets/Profile-67eeb9ca.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as O,a as Q}from"./post-item.vue_vue_type_style_index_0_lang-cf654b7f.js";import{_ as J}from"./post-skeleton-627d3fc3.js";import{_ as K}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as W}from"./vuex-473b3783.js";import{b as X}from"./vue-router-b8e3382f.js";import{A as g,_ as Y}from"./index-8b4e1776.js";import{d as Z,r,j as ee,w as ae,c,V as o,_ as i,Q as M,a1 as h,O as T,o as n,a as _,M as z,F as U,a4 as V}from"./@vue-e0e89260.js";import{F as te,G as se,o as oe,f as ne,g as le,I as re,H as ue}from"./naive-ui-62663ad7.js";import"./content-c0ce69b7.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const ce={class:"profile-baseinfo"},ie={class:"avatar"},_e={class:"base-info"},pe={class:"username"},me={class:"uid"},ve={key:0,class:"skeleton-wrap"},de={key:1},fe={key:0,class:"empty-wrap"},ge={key:1},he={key:2},ke={key:1,class:"pagination-wrap"},be=Z({__name:"Profile",setup(ye){const s=W(),p=X(),t=r(!1),l=r([]),d=r("post"),q=r(+p.query.p||1),x=r(1),S=r(1),B=r(1),a=r(+p.query.p||1),u=r(20),m=r(0),k=()=>{switch(d.value){case"post":b();break;case"comment":y();break;case"media":w();break;case"star":P();break}},b=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"post",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},y=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"comment",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},w=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"media",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},P=()=>{t.value=!0,g({username:s.state.userInfo.username,style:"star",page:a.value,page_size:u.value}).then(e=>{t.value=!1,l.value=e.list||[],m.value=Math.ceil(e.pager.total_rows/u.value),window.scrollTo(0,0)}).catch(e=>{l.value=[],t.value=!1})},$=e=>{switch(d.value=e,d.value){case"post":a.value=q.value,b();break;case"comment":a.value=x.value,y();break;case"media":a.value=S.value,w();break;case"star":a.value=B.value,P();break}},F=e=>{switch(a.value=e,d.value){case"post":q.value=e,b();break;case"comment":x.value=a.value,y();break;case"media":S.value=a.value,w();break;case"star":B.value=a.value,P();break}};return ee(()=>{k()}),ae(()=>({path:p.path,query:p.query,refresh:s.state.refresh}),(e,I)=>{if(e.refresh!==I.refresh){a.value=+p.query.p||1,setTimeout(()=>{k()},0);return}I.path!=="/post"&&e.path==="/profile"&&(a.value=+p.query.p||1,setTimeout(()=>{k()},0))}),(e,I)=>{const N=K,D=oe,f=ne,R=le,j=J,A=re,E=O,C=ue,G=Q,H=te,L=se;return n(),c("div",null,[o(N,{title:"主页"}),i(s).state.userInfo.id>0?(n(),M(H,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:h(()=>[_("div",ce,[_("div",ie,[o(D,{size:"large",src:i(s).state.userInfo.avatar},null,8,["src"])]),_("div",_e,[_("div",pe,[_("strong",null,z(i(s).state.userInfo.nickname),1),_("span",null," @"+z(i(s).state.userInfo.username),1)]),_("div",me,"UID. "+z(i(s).state.userInfo.id),1)])]),o(R,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":$},{default:h(()=>[o(f,{name:"post",tab:"泡泡"}),o(f,{name:"comment",tab:"评论"}),o(f,{name:"media",tab:"图文"}),o(f,{name:"star",tab:"喜欢"})]),_:1}),t.value?(n(),c("div",ve,[o(j,{num:u.value},null,8,["num"])])):(n(),c("div",de,[l.value.length===0?(n(),c("div",fe,[o(A,{size:"large",description:"暂无数据"})])):T("",!0),i(s).state.desktopModelShow?(n(),c("div",ge,[(n(!0),c(U,null,V(l.value,v=>(n(),M(C,{key:v.id},{default:h(()=>[o(E,{post:v},null,8,["post"])]),_:2},1024))),128))])):(n(),c("div",he,[(n(!0),c(U,null,V(l.value,v=>(n(),M(C,{key:v.id},{default:h(()=>[o(G,{post:v},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1})):T("",!0),m.value>0?(n(),c("div",ke,[o(L,{page:a.value,"onUpdate:page":F,"page-slot":i(s).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):T("",!0)])}}});const Ye=Y(be,[["__scopeId","data-v-834be275"]]);export{Ye as default}; diff --git a/web/dist/assets/Profile-cc270bed.css b/web/dist/assets/Profile-cc270bed.css new file mode 100644 index 00000000..5ed80845 --- /dev/null +++ b/web/dist/assets/Profile-cc270bed.css @@ -0,0 +1 @@ +.profile-baseinfo[data-v-08661398]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-08661398]{width:55px}.profile-baseinfo .base-info[data-v-08661398]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-08661398]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-08661398]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-tabs-wrap[data-v-08661398]{padding:0 16px}.pagination-wrap[data-v-08661398]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-08661398]{background-color:#18181c}.dark .profile-wrap[data-v-08661398],.dark .pagination-wrap[data-v-08661398]{background-color:#101014bf} diff --git a/web/dist/assets/Setting-062eeb8c.js b/web/dist/assets/Setting-c94ce292.js similarity index 82% rename from web/dist/assets/Setting-062eeb8c.js rename to web/dist/assets/Setting-c94ce292.js index b4790a46..bfbe52a6 100644 --- a/web/dist/assets/Setting-062eeb8c.js +++ b/web/dist/assets/Setting-c94ce292.js @@ -1 +1 @@ -import{_ as we}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{d as ye,r as d,E as H,j as ke,c as g,V as t,a1 as s,Q as b,O as _,o as r,a as m,_ as u,e as c,M as R,z as be,v as Ce,P as q,a2 as B,W as Ie,X as $e}from"./@vue-e0e89260.js";import{u as Pe}from"./vuex-473b3783.js";import{S as Z,T as Se,U as Ue,V as Re,W as qe,X as Be,Y as Ae,_ as ze}from"./index-8b4e1776.js";import{x as Ne}from"./@vicons-d502290a.js";import{h as xe,o as Ke,e as De,B as Fe,b as Ve,j as Te,S as je,$ as Ee,L as Oe,a0 as Le,a1 as Me,d as We}from"./naive-ui-62663ad7.js";import"./vue-router-b8e3382f.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const V=A=>(Ie("data-v-a681720e"),A=A(),$e(),A),Xe={class:"base-line avatar"},Ge={class:"base-line"},Je=V(()=>m("span",{class:"base-label"},"昵称",-1)),Qe={key:0},Ye={class:"base-line"},He=V(()=>m("span",{class:"base-label"},"用户名",-1)),Ze={key:0},et={key:1},tt=V(()=>m("br",null,null,-1)),at={key:2,class:"phone-bind-wrap"},st={class:"captcha-img-wrap"},nt={class:"captcha-img"},ot=["src"],lt={class:"form-submit-wrap"},rt={key:0},it={key:1},ut=V(()=>m("br",null,null,-1)),dt={key:2,class:"phone-bind-wrap"},ct={class:"captcha-img-wrap"},pt={class:"captcha-img"},_t=["src"],mt={class:"form-submit-wrap"},vt={key:1,class:"phone-bind-wrap"},ft={class:"form-submit-wrap"},gt=ye({__name:"Setting",setup(A){const ee="/v1/attachment",te="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),z=d("public/avatar"),$="true".toLowerCase()==="true",ae="false".toLowerCase()==="true",o=Pe(),P=d(!1),N=d(!1),x=d(!1),M=d(),W=d(),C=d(!1),K=d(!1),S=d(!1),U=d(!1),I=d(60),y=d(!1),k=d(!1),X=d(),G=d(),J=d(),Q=d(),a=H({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),i=H({id:"",b64s:"",imgCaptcha:"",activate_code:""}),se=async n=>{var e,v;return z.value==="public/avatar"&&!["image/png","image/jpg","image/jpeg"].includes((e=n.file.file)==null?void 0:e.type)?(window.$message.warning("头像仅允许 png/jpg 格式"),!1):z.value==="image"&&((v=n.file.file)==null?void 0:v.size)>1048576?(window.$message.warning("头像大小不能超过1MB"),!1):!0},ne=({file:n,event:e})=>{var v;try{let f=JSON.parse((v=e.target)==null?void 0:v.response);f.code===0&&z.value==="public/avatar"&&Se({avatar:f.data.content}).then(p=>{var D;window.$message.success("头像更新成功"),(D=M.value)==null||D.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:f.data.content})}).catch(p=>{console.log(p)})}catch{window.$message.error("上传失败")}},oe=(n,e)=>!!a.password&&a.password.startsWith(e)&&a.password.length>=e.length,le=(n,e)=>e===a.password,re=()=>{var n;a.reenteredPassword&&((n=Q.value)==null||n.validate({trigger:"password-input"}))},ie=n=>{var e;n.preventDefault(),(e=J.value)==null||e.validate(v=>{v||(K.value=!0,Ue({password:a.password,old_password:a.old_password}).then(f=>{K.value=!1,S.value=!1,window.$message.success("密码重置成功"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(f=>{K.value=!1}))})},ue=n=>{var e;n.preventDefault(),(e=X.value)==null||e.validate(v=>{v||(N.value=!0,Re({phone:a.phone,captcha:a.phone_captcha}).then(f=>{N.value=!1,y.value=!1,window.$message.success("绑定成功"),o.commit("updateUserinfo",{...o.state.userInfo,phone:a.phone}),a.id="",a.b64s="",a.imgCaptcha="",a.phone="",a.phone_captcha=""}).catch(f=>{N.value=!1}))})},de=n=>{var e;n.preventDefault(),(e=G.value)==null||e.validate(v=>{if(i.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,v||(x.value=!0,qe({activate_code:i.activate_code,captcha_id:i.id,imgCaptcha:i.imgCaptcha}).then(f=>{x.value=!1,k.value=!1,window.$message.success("激活成功"),o.commit("updateUserinfo",{...o.state.userInfo,activation:i.activate_code}),i.id="",i.b64s="",i.imgCaptcha="",i.activate_code=""}).catch(f=>{x.value=!1,f.code===20012&&j()}))})},T=()=>{Z().then(n=>{a.id=n.id,a.b64s=n.b64s}).catch(n=>{console.log(n)})},j=()=>{Z().then(n=>{i.id=n.id,i.b64s=n.b64s}).catch(n=>{console.log(n)})},ce=()=>{Be({nickname:o.state.userInfo.nickname||""}).then(n=>{C.value=!1,window.$message.success("昵称修改成功")}).catch(n=>{C.value=!0})},pe=()=>{if(!(I.value>0&&U.value)){if(a.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,Ae({phone:a.phone,img_captcha:a.imgCaptcha,img_captcha_id:a.id}).then(n=>{U.value=!0,P.value=!1,window.$message.success("发送成功");let e=setInterval(()=>{I.value--,I.value===0&&(clearInterval(e),I.value=60,U.value=!1)},1e3)}).catch(n=>{P.value=!1,n.code===20012&&T(),console.log(n)})}},_e={phone:[{required:!0,message:"请输入手机号",trigger:["input"],validator:(n,e)=>/^[1]+[3-9]{1}\d{9}$/.test(e)}],phone_captcha:[{required:!0,message:"请输入手机验证码"}]},me={activate_code:[{required:!0,message:"请输入激活码",trigger:["input"],validator:(n,e)=>/\d{6}$/.test(e)}]},ve={password:[{required:!0,message:"请输入新密码"}],old_password:[{required:!0,message:"请输入旧密码"}],reenteredPassword:[{required:!0,message:"请再次输入密码",trigger:["input","blur"]},{validator:oe,message:"两次密码输入不一致",trigger:"input"},{validator:le,message:"两次密码输入不一致",trigger:["blur","password-input"]}]},fe=()=>{C.value=!0,setTimeout(()=>{var n;(n=W.value)==null||n.focus()},30)};return ke(()=>{o.state.userInfo.id===0&&(o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")),T(),j()}),(n,e)=>{const v=we,f=Ke,p=De,D=Fe,h=Ve,ge=Te,F=xe,Y=je,w=Ee,he=Oe,E=Le,O=Me,L=We;return r(),g("div",null,[t(v,{title:"设置",theme:""}),t(F,{title:"基本信息",size:"small",class:"setting-card"},{default:s(()=>[m("div",Xe,[t(f,{class:"avatar-img",size:80,src:u(o).state.userInfo.avatar},null,8,["src"]),!$||$&&u(o).state.userInfo.phone&&u(o).state.userInfo.phone.length>0?(r(),b(D,{key:0,ref_key:"avatarRef",ref:M,action:ee,headers:{Authorization:te},data:{type:z.value},onBeforeUpload:se,onFinish:ne},{default:s(()=>[t(p,{size:"small"},{default:s(()=>[c("更改头像")]),_:1})]),_:1},8,["headers","data"])):_("",!0)]),m("div",Ge,[Je,C.value?_("",!0):(r(),g("div",Qe,R(u(o).state.userInfo.nickname),1)),be(t(h,{ref_key:"inputInstRef",ref:W,class:"nickname-input",value:u(o).state.userInfo.nickname,"onUpdate:value":e[0]||(e[0]=l=>u(o).state.userInfo.nickname=l),type:"text",size:"small",placeholder:"请输入昵称",onBlur:ce,maxlength:16},null,8,["value"]),[[Ce,C.value]]),!C.value&&(!$||$&&u(o).state.userInfo.phone&&u(o).state.userInfo.phone.length>0&&u(o).state.userInfo.status==1)?(r(),b(p,{key:1,quaternary:"",round:"",type:"success",size:"small",onClick:fe},{icon:s(()=>[t(ge,null,{default:s(()=>[t(u(Ne))]),_:1})]),_:1})):_("",!0)]),m("div",Ye,[He,c(" @"+R(u(o).state.userInfo.username),1)])]),_:1}),$?(r(),b(F,{key:0,title:"手机号",size:"small",class:"setting-card"},{default:s(()=>[u(o).state.userInfo.phone&&u(o).state.userInfo.phone.length>0?(r(),g("div",Ze,[c(R(u(o).state.userInfo.phone)+" ",1),!y.value&&u(o).state.userInfo.status==1?(r(),b(p,{key:0,quaternary:"",round:"",type:"success",onClick:e[1]||(e[1]=l=>y.value=!0)},{default:s(()=>[c(" 换绑手机 ")]),_:1})):_("",!0)])):(r(),g("div",et,[t(Y,{title:"手机绑定提示",type:"warning"},{default:s(()=>[c(" 成功绑定手机后,才能进行换头像、发动态、回复等交互~"),tt,y.value?_("",!0):(r(),g("a",{key:0,class:"hash-link",onClick:e[2]||(e[2]=l=>y.value=!0)}," 立即绑定 "))]),_:1})])),y.value?(r(),g("div",at,[t(L,{ref_key:"phoneFormRef",ref:X,model:a,rules:_e},{default:s(()=>[t(w,{path:"phone",label:"手机号"},{default:s(()=>[t(h,{value:a.phone,"onUpdate:value":e[3]||(e[3]=l=>a.phone=l.trim()),placeholder:"请输入中国大陆手机号",onKeydown:e[4]||(e[4]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{path:"img_captcha",label:"图形验证码"},{default:s(()=>[m("div",st,[t(h,{value:a.imgCaptcha,"onUpdate:value":e[5]||(e[5]=l=>a.imgCaptcha=l),placeholder:"请输入图形验证码后获取验证码"},null,8,["value"]),m("div",nt,[a.b64s?(r(),g("img",{key:0,src:a.b64s,onClick:T},null,8,ot)):_("",!0)])])]),_:1}),t(w,{path:"phone_captcha",label:"短信验证码"},{default:s(()=>[t(he,null,{default:s(()=>[t(h,{value:a.phone_captcha,"onUpdate:value":e[6]||(e[6]=l=>a.phone_captcha=l),placeholder:"请输入收到的短信验证码"},null,8,["value"]),t(p,{type:"primary",ghost:"",disabled:U.value,loading:P.value,onClick:pe},{default:s(()=>[c(R(I.value>0&&U.value?I.value+"s后重新发送":"发送验证码"),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1}),t(O,{gutter:[0,24]},{default:s(()=>[t(E,{span:24},{default:s(()=>[m("div",lt,[t(p,{quaternary:"",round:"",onClick:e[7]||(e[7]=l=>y.value=!1)},{default:s(()=>[c(" 取消 ")]),_:1}),t(p,{secondary:"",round:"",type:"primary",loading:N.value,onClick:ue},{default:s(()=>[c(" 绑定 ")]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):_("",!0)]),_:1})):_("",!0),ae?(r(),b(F,{key:1,title:"激活码",size:"small",class:"setting-card"},{default:s(()=>[u(o).state.userInfo.activation&&u(o).state.userInfo.activation.length>0?(r(),g("div",rt,[c(R(u(o).state.userInfo.activation)+" ",1),k.value?_("",!0):(r(),b(p,{key:0,quaternary:"",round:"",type:"success",onClick:e[8]||(e[8]=l=>k.value=!0)},{default:s(()=>[c(" 重新激活 ")]),_:1}))])):(r(),g("div",it,[t(Y,{title:"激活码激活提示",type:"warning"},{default:s(()=>[c(" 成功激活后后,才能发(公开/好友可见)动态、回复~"),ut,k.value?_("",!0):(r(),g("a",{key:0,class:"hash-link",onClick:e[9]||(e[9]=l=>k.value=!0)}," 立即激活 "))]),_:1})])),k.value?(r(),g("div",dt,[t(L,{ref_key:"activateFormRef",ref:G,model:i,rules:me},{default:s(()=>[t(w,{path:"activate_code",label:"激活码"},{default:s(()=>[t(h,{value:i.activate_code,"onUpdate:value":e[10]||(e[10]=l=>i.activate_code=l.trim()),placeholder:"请输入激活码",onKeydown:e[11]||(e[11]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{path:"img_captcha",label:"图形验证码"},{default:s(()=>[m("div",ct,[t(h,{value:i.imgCaptcha,"onUpdate:value":e[12]||(e[12]=l=>i.imgCaptcha=l),placeholder:"请输入图形验证码后获取验证码"},null,8,["value"]),m("div",pt,[i.b64s?(r(),g("img",{key:0,src:i.b64s,onClick:j},null,8,_t)):_("",!0)])])]),_:1}),t(O,{gutter:[0,24]},{default:s(()=>[t(E,{span:24},{default:s(()=>[m("div",mt,[t(p,{quaternary:"",round:"",onClick:e[13]||(e[13]=l=>k.value=!1)},{default:s(()=>[c(" 取消 ")]),_:1}),t(p,{secondary:"",round:"",type:"primary",loading:x.value,onClick:de},{default:s(()=>[c(" 激活 ")]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):_("",!0)]),_:1})):_("",!0),t(F,{title:"账户安全",size:"small",class:"setting-card"},{default:s(()=>[c(" 您已设置密码 "),S.value?_("",!0):(r(),b(p,{key:0,quaternary:"",round:"",type:"success",onClick:e[14]||(e[14]=l=>S.value=!0)},{default:s(()=>[c(" 重置密码 ")]),_:1})),S.value?(r(),g("div",vt,[t(L,{ref_key:"formRef",ref:J,model:a,rules:ve},{default:s(()=>[t(w,{path:"old_password",label:"旧密码"},{default:s(()=>[t(h,{value:a.old_password,"onUpdate:value":e[15]||(e[15]=l=>a.old_password=l),type:"password",placeholder:"请输入当前密码",onKeydown:e[16]||(e[16]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{path:"password",label:"新密码"},{default:s(()=>[t(h,{value:a.password,"onUpdate:value":e[17]||(e[17]=l=>a.password=l),type:"password",placeholder:"请输入新密码",onInput:re,onKeydown:e[18]||(e[18]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{ref_key:"rPasswordFormItemRef",ref:Q,first:"",path:"reenteredPassword",label:"重复密码"},{default:s(()=>[t(h,{value:a.reenteredPassword,"onUpdate:value":e[19]||(e[19]=l=>a.reenteredPassword=l),disabled:!a.password,type:"password",placeholder:"请再次输入密码",onKeydown:e[20]||(e[20]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value","disabled"])]),_:1},512),t(O,{gutter:[0,24]},{default:s(()=>[t(E,{span:24},{default:s(()=>[m("div",ft,[t(p,{quaternary:"",round:"",onClick:e[21]||(e[21]=l=>S.value=!1)},{default:s(()=>[c(" 取消 ")]),_:1}),t(p,{secondary:"",round:"",type:"primary",loading:K.value,onClick:ie},{default:s(()=>[c(" 更新 ")]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):_("",!0)]),_:1})])}}});const Tt=ze(gt,[["__scopeId","data-v-a681720e"]]);export{Tt as default}; +import{_ as we}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{d as ye,r as d,E as Z,j as ke,c as g,V as t,a1 as s,Q as b,O as _,o as r,a as m,_ as u,e as c,M as R,z as be,v as Ce,P as q,a2 as B,W as Ie,X as $e}from"./@vue-e0e89260.js";import{u as Pe}from"./vuex-473b3783.js";import{T as H,U as Ue,V as Se,W as Re,X as qe,Y as Be,Z as Ae,_ as ze}from"./index-08d8af97.js";import{K as Ne}from"./@vicons-6332ad63.js";import{h as Ke,o as xe,e as De,B as Fe,b as Ve,j as Te,S as je,$ as Ee,L as Oe,a0 as Le,a1 as Me,d as We}from"./naive-ui-62663ad7.js";import"./vue-router-b8e3382f.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const V=A=>(Ie("data-v-a681720e"),A=A(),$e(),A),Xe={class:"base-line avatar"},Ge={class:"base-line"},Je=V(()=>m("span",{class:"base-label"},"昵称",-1)),Qe={key:0},Ye={class:"base-line"},Ze=V(()=>m("span",{class:"base-label"},"用户名",-1)),He={key:0},et={key:1},tt=V(()=>m("br",null,null,-1)),at={key:2,class:"phone-bind-wrap"},st={class:"captcha-img-wrap"},nt={class:"captcha-img"},ot=["src"],lt={class:"form-submit-wrap"},rt={key:0},it={key:1},ut=V(()=>m("br",null,null,-1)),dt={key:2,class:"phone-bind-wrap"},ct={class:"captcha-img-wrap"},pt={class:"captcha-img"},_t=["src"],mt={class:"form-submit-wrap"},vt={key:1,class:"phone-bind-wrap"},ft={class:"form-submit-wrap"},gt=ye({__name:"Setting",setup(A){const ee="/v1/attachment",te="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),z=d("public/avatar"),$="true".toLowerCase()==="true",ae="false".toLowerCase()==="true",o=Pe(),P=d(!1),N=d(!1),K=d(!1),M=d(),W=d(),C=d(!1),x=d(!1),U=d(!1),S=d(!1),I=d(60),y=d(!1),k=d(!1),X=d(),G=d(),J=d(),Q=d(),a=Z({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),i=Z({id:"",b64s:"",imgCaptcha:"",activate_code:""}),se=async n=>{var e,v;return z.value==="public/avatar"&&!["image/png","image/jpg","image/jpeg"].includes((e=n.file.file)==null?void 0:e.type)?(window.$message.warning("头像仅允许 png/jpg 格式"),!1):z.value==="image"&&((v=n.file.file)==null?void 0:v.size)>1048576?(window.$message.warning("头像大小不能超过1MB"),!1):!0},ne=({file:n,event:e})=>{var v;try{let f=JSON.parse((v=e.target)==null?void 0:v.response);f.code===0&&z.value==="public/avatar"&&Ue({avatar:f.data.content}).then(p=>{var D;window.$message.success("头像更新成功"),(D=M.value)==null||D.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:f.data.content})}).catch(p=>{console.log(p)})}catch{window.$message.error("上传失败")}},oe=(n,e)=>!!a.password&&a.password.startsWith(e)&&a.password.length>=e.length,le=(n,e)=>e===a.password,re=()=>{var n;a.reenteredPassword&&((n=Q.value)==null||n.validate({trigger:"password-input"}))},ie=n=>{var e;n.preventDefault(),(e=J.value)==null||e.validate(v=>{v||(x.value=!0,Se({password:a.password,old_password:a.old_password}).then(f=>{x.value=!1,U.value=!1,window.$message.success("密码重置成功"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(f=>{x.value=!1}))})},ue=n=>{var e;n.preventDefault(),(e=X.value)==null||e.validate(v=>{v||(N.value=!0,Re({phone:a.phone,captcha:a.phone_captcha}).then(f=>{N.value=!1,y.value=!1,window.$message.success("绑定成功"),o.commit("updateUserinfo",{...o.state.userInfo,phone:a.phone}),a.id="",a.b64s="",a.imgCaptcha="",a.phone="",a.phone_captcha=""}).catch(f=>{N.value=!1}))})},de=n=>{var e;n.preventDefault(),(e=G.value)==null||e.validate(v=>{if(i.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,v||(K.value=!0,qe({activate_code:i.activate_code,captcha_id:i.id,imgCaptcha:i.imgCaptcha}).then(f=>{K.value=!1,k.value=!1,window.$message.success("激活成功"),o.commit("updateUserinfo",{...o.state.userInfo,activation:i.activate_code}),i.id="",i.b64s="",i.imgCaptcha="",i.activate_code=""}).catch(f=>{K.value=!1,f.code===20012&&j()}))})},T=()=>{H().then(n=>{a.id=n.id,a.b64s=n.b64s}).catch(n=>{console.log(n)})},j=()=>{H().then(n=>{i.id=n.id,i.b64s=n.b64s}).catch(n=>{console.log(n)})},ce=()=>{Be({nickname:o.state.userInfo.nickname||""}).then(n=>{C.value=!1,window.$message.success("昵称修改成功")}).catch(n=>{C.value=!0})},pe=()=>{if(!(I.value>0&&S.value)){if(a.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,Ae({phone:a.phone,img_captcha:a.imgCaptcha,img_captcha_id:a.id}).then(n=>{S.value=!0,P.value=!1,window.$message.success("发送成功");let e=setInterval(()=>{I.value--,I.value===0&&(clearInterval(e),I.value=60,S.value=!1)},1e3)}).catch(n=>{P.value=!1,n.code===20012&&T(),console.log(n)})}},_e={phone:[{required:!0,message:"请输入手机号",trigger:["input"],validator:(n,e)=>/^[1]+[3-9]{1}\d{9}$/.test(e)}],phone_captcha:[{required:!0,message:"请输入手机验证码"}]},me={activate_code:[{required:!0,message:"请输入激活码",trigger:["input"],validator:(n,e)=>/\d{6}$/.test(e)}]},ve={password:[{required:!0,message:"请输入新密码"}],old_password:[{required:!0,message:"请输入旧密码"}],reenteredPassword:[{required:!0,message:"请再次输入密码",trigger:["input","blur"]},{validator:oe,message:"两次密码输入不一致",trigger:"input"},{validator:le,message:"两次密码输入不一致",trigger:["blur","password-input"]}]},fe=()=>{C.value=!0,setTimeout(()=>{var n;(n=W.value)==null||n.focus()},30)};return ke(()=>{o.state.userInfo.id===0&&(o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")),T(),j()}),(n,e)=>{const v=we,f=xe,p=De,D=Fe,h=Ve,ge=Te,F=Ke,Y=je,w=Ee,he=Oe,E=Le,O=Me,L=We;return r(),g("div",null,[t(v,{title:"设置",theme:""}),t(F,{title:"基本信息",size:"small",class:"setting-card"},{default:s(()=>[m("div",Xe,[t(f,{class:"avatar-img",size:80,src:u(o).state.userInfo.avatar},null,8,["src"]),!$||$&&u(o).state.userInfo.phone&&u(o).state.userInfo.phone.length>0?(r(),b(D,{key:0,ref_key:"avatarRef",ref:M,action:ee,headers:{Authorization:te},data:{type:z.value},onBeforeUpload:se,onFinish:ne},{default:s(()=>[t(p,{size:"small"},{default:s(()=>[c("更改头像")]),_:1})]),_:1},8,["headers","data"])):_("",!0)]),m("div",Ge,[Je,C.value?_("",!0):(r(),g("div",Qe,R(u(o).state.userInfo.nickname),1)),be(t(h,{ref_key:"inputInstRef",ref:W,class:"nickname-input",value:u(o).state.userInfo.nickname,"onUpdate:value":e[0]||(e[0]=l=>u(o).state.userInfo.nickname=l),type:"text",size:"small",placeholder:"请输入昵称",onBlur:ce,maxlength:16},null,8,["value"]),[[Ce,C.value]]),!C.value&&(!$||$&&u(o).state.userInfo.phone&&u(o).state.userInfo.phone.length>0&&u(o).state.userInfo.status==1)?(r(),b(p,{key:1,quaternary:"",round:"",type:"success",size:"small",onClick:fe},{icon:s(()=>[t(ge,null,{default:s(()=>[t(u(Ne))]),_:1})]),_:1})):_("",!0)]),m("div",Ye,[Ze,c(" @"+R(u(o).state.userInfo.username),1)])]),_:1}),$?(r(),b(F,{key:0,title:"手机号",size:"small",class:"setting-card"},{default:s(()=>[u(o).state.userInfo.phone&&u(o).state.userInfo.phone.length>0?(r(),g("div",He,[c(R(u(o).state.userInfo.phone)+" ",1),!y.value&&u(o).state.userInfo.status==1?(r(),b(p,{key:0,quaternary:"",round:"",type:"success",onClick:e[1]||(e[1]=l=>y.value=!0)},{default:s(()=>[c(" 换绑手机 ")]),_:1})):_("",!0)])):(r(),g("div",et,[t(Y,{title:"手机绑定提示",type:"warning"},{default:s(()=>[c(" 成功绑定手机后,才能进行换头像、发动态、回复等交互~"),tt,y.value?_("",!0):(r(),g("a",{key:0,class:"hash-link",onClick:e[2]||(e[2]=l=>y.value=!0)}," 立即绑定 "))]),_:1})])),y.value?(r(),g("div",at,[t(L,{ref_key:"phoneFormRef",ref:X,model:a,rules:_e},{default:s(()=>[t(w,{path:"phone",label:"手机号"},{default:s(()=>[t(h,{value:a.phone,"onUpdate:value":e[3]||(e[3]=l=>a.phone=l.trim()),placeholder:"请输入中国大陆手机号",onKeydown:e[4]||(e[4]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{path:"img_captcha",label:"图形验证码"},{default:s(()=>[m("div",st,[t(h,{value:a.imgCaptcha,"onUpdate:value":e[5]||(e[5]=l=>a.imgCaptcha=l),placeholder:"请输入图形验证码后获取验证码"},null,8,["value"]),m("div",nt,[a.b64s?(r(),g("img",{key:0,src:a.b64s,onClick:T},null,8,ot)):_("",!0)])])]),_:1}),t(w,{path:"phone_captcha",label:"短信验证码"},{default:s(()=>[t(he,null,{default:s(()=>[t(h,{value:a.phone_captcha,"onUpdate:value":e[6]||(e[6]=l=>a.phone_captcha=l),placeholder:"请输入收到的短信验证码"},null,8,["value"]),t(p,{type:"primary",ghost:"",disabled:S.value,loading:P.value,onClick:pe},{default:s(()=>[c(R(I.value>0&&S.value?I.value+"s后重新发送":"发送验证码"),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1}),t(O,{gutter:[0,24]},{default:s(()=>[t(E,{span:24},{default:s(()=>[m("div",lt,[t(p,{quaternary:"",round:"",onClick:e[7]||(e[7]=l=>y.value=!1)},{default:s(()=>[c(" 取消 ")]),_:1}),t(p,{secondary:"",round:"",type:"primary",loading:N.value,onClick:ue},{default:s(()=>[c(" 绑定 ")]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):_("",!0)]),_:1})):_("",!0),ae?(r(),b(F,{key:1,title:"激活码",size:"small",class:"setting-card"},{default:s(()=>[u(o).state.userInfo.activation&&u(o).state.userInfo.activation.length>0?(r(),g("div",rt,[c(R(u(o).state.userInfo.activation)+" ",1),k.value?_("",!0):(r(),b(p,{key:0,quaternary:"",round:"",type:"success",onClick:e[8]||(e[8]=l=>k.value=!0)},{default:s(()=>[c(" 重新激活 ")]),_:1}))])):(r(),g("div",it,[t(Y,{title:"激活码激活提示",type:"warning"},{default:s(()=>[c(" 成功激活后后,才能发(公开/好友可见)动态、回复~"),ut,k.value?_("",!0):(r(),g("a",{key:0,class:"hash-link",onClick:e[9]||(e[9]=l=>k.value=!0)}," 立即激活 "))]),_:1})])),k.value?(r(),g("div",dt,[t(L,{ref_key:"activateFormRef",ref:G,model:i,rules:me},{default:s(()=>[t(w,{path:"activate_code",label:"激活码"},{default:s(()=>[t(h,{value:i.activate_code,"onUpdate:value":e[10]||(e[10]=l=>i.activate_code=l.trim()),placeholder:"请输入激活码",onKeydown:e[11]||(e[11]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{path:"img_captcha",label:"图形验证码"},{default:s(()=>[m("div",ct,[t(h,{value:i.imgCaptcha,"onUpdate:value":e[12]||(e[12]=l=>i.imgCaptcha=l),placeholder:"请输入图形验证码后获取验证码"},null,8,["value"]),m("div",pt,[i.b64s?(r(),g("img",{key:0,src:i.b64s,onClick:j},null,8,_t)):_("",!0)])])]),_:1}),t(O,{gutter:[0,24]},{default:s(()=>[t(E,{span:24},{default:s(()=>[m("div",mt,[t(p,{quaternary:"",round:"",onClick:e[13]||(e[13]=l=>k.value=!1)},{default:s(()=>[c(" 取消 ")]),_:1}),t(p,{secondary:"",round:"",type:"primary",loading:K.value,onClick:de},{default:s(()=>[c(" 激活 ")]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):_("",!0)]),_:1})):_("",!0),t(F,{title:"账户安全",size:"small",class:"setting-card"},{default:s(()=>[c(" 您已设置密码 "),U.value?_("",!0):(r(),b(p,{key:0,quaternary:"",round:"",type:"success",onClick:e[14]||(e[14]=l=>U.value=!0)},{default:s(()=>[c(" 重置密码 ")]),_:1})),U.value?(r(),g("div",vt,[t(L,{ref_key:"formRef",ref:J,model:a,rules:ve},{default:s(()=>[t(w,{path:"old_password",label:"旧密码"},{default:s(()=>[t(h,{value:a.old_password,"onUpdate:value":e[15]||(e[15]=l=>a.old_password=l),type:"password",placeholder:"请输入当前密码",onKeydown:e[16]||(e[16]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{path:"password",label:"新密码"},{default:s(()=>[t(h,{value:a.password,"onUpdate:value":e[17]||(e[17]=l=>a.password=l),type:"password",placeholder:"请输入新密码",onInput:re,onKeydown:e[18]||(e[18]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),t(w,{ref_key:"rPasswordFormItemRef",ref:Q,first:"",path:"reenteredPassword",label:"重复密码"},{default:s(()=>[t(h,{value:a.reenteredPassword,"onUpdate:value":e[19]||(e[19]=l=>a.reenteredPassword=l),disabled:!a.password,type:"password",placeholder:"请再次输入密码",onKeydown:e[20]||(e[20]=q(B(()=>{},["prevent"]),["enter"]))},null,8,["value","disabled"])]),_:1},512),t(O,{gutter:[0,24]},{default:s(()=>[t(E,{span:24},{default:s(()=>[m("div",ft,[t(p,{quaternary:"",round:"",onClick:e[21]||(e[21]=l=>U.value=!1)},{default:s(()=>[c(" 取消 ")]),_:1}),t(p,{secondary:"",round:"",type:"primary",loading:x.value,onClick:ie},{default:s(()=>[c(" 更新 ")]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):_("",!0)]),_:1})])}}});const Tt=ze(gt,[["__scopeId","data-v-a681720e"]]);export{Tt as default}; diff --git a/web/dist/assets/Topic-501554b1.js b/web/dist/assets/Topic-e935df69.js similarity index 88% rename from web/dist/assets/Topic-501554b1.js rename to web/dist/assets/Topic-e935df69.js index f0da3484..50ffc48b 100644 --- a/web/dist/assets/Topic-501554b1.js +++ b/web/dist/assets/Topic-e935df69.js @@ -1 +1 @@ -import{w as F,x as z,y as I,z as j,_ as E}from"./index-8b4e1776.js";import{p as U}from"./@vicons-d502290a.js";import{d as $,r as i,n as q,j as A,a3 as x,o as c,c as _,V as n,a1 as s,Q as b,e as V,M as f,O as u,_ as h,w as D,a7 as P,F as Q,a4 as G}from"./@vue-e0e89260.js";import{o as H,O as B,j as J,e as K,P as R,M as W,F as X,f as Y,g as Z,a as ee,k as oe}from"./naive-ui-62663ad7.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as ne}from"./vuex-473b3783.js";import"./vue-router-b8e3382f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const se={key:0,class:"tag-item"},ae={key:0,class:"tag-quote"},ce={key:1,class:"tag-quote tag-follow"},le={key:0,class:"options"},ie=$({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(T){const t=T,r=i(!1),m=q(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=e=>{switch(e){case"follow":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":z({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":F({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":F({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return A(()=>{r.value=!1}),(e,o)=>{const w=x("router-link"),g=H,k=B,a=J,d=K,v=R,p=W;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(p,null,{header:s(()=>[(c(),b(k,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(g,{src:e.tag.user.avatar},null,8,["src"])]),default:s(()=>[n(w,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[V(" #"+f(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?u("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):u("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),_("div",le,[n(v,{placement:"bottom-end",trigger:"click",size:"small",options:m.value,onSelect:l},{default:s(()=>[n(d,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(a,null,{default:s(()=>[n(h(U))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}});const _e=$({__name:"Topic",setup(T){const t=ne(),r=i([]),m=i("hot"),l=i(!1),e=i(!1),o=i(!1);D(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=q({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,j({type:m.value,num:50}).then(a=>{r.value=a.topics,l.value=!1}).catch(a=>{console.log(a),l.value=!1})},k=a=>{m.value=a,a=="follow"?o.value=!0:o.value=!1,g()};return A(()=>{g()}),(a,d)=>{const v=te,p=Y,C=B,L=Z,M=ie,N=ee,O=oe,S=X;return c(),_("div",null,[n(v,{title:"话题"}),n(S,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(L,{type:"line",animated:"","onUpdate:value":k},P({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(p,{key:0,name:"follow",tab:"关注"})):u("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(C,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[V(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(O,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(Q,null,G(r.value,y=>(c(),b(M,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Me=E(_e,[["__scopeId","data-v-15794a53"]]);export{Me as default}; +import{x as F,y as z,z as I,A as j,_ as E}from"./index-08d8af97.js";import{v as U}from"./@vicons-6332ad63.js";import{d as $,r as i,n as A,j as q,a3 as x,o as c,c as _,V as n,a1 as s,Q as b,e as V,M as f,O as u,_ as h,w as D,a7 as P,F as Q,a4 as G}from"./@vue-e0e89260.js";import{o as H,O as B,j as J,e as K,P as R,M as W,F as X,f as Y,g as Z,a as ee,k as oe}from"./naive-ui-62663ad7.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as ne}from"./vuex-473b3783.js";import"./vue-router-b8e3382f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const se={key:0,class:"tag-item"},ae={key:0,class:"tag-quote"},ce={key:1,class:"tag-quote tag-follow"},le={key:0,class:"options"},ie=$({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(T){const t=T,r=i(!1),m=A(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=e=>{switch(e){case"follow":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":z({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":F({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":F({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return q(()=>{r.value=!1}),(e,o)=>{const w=x("router-link"),g=H,k=B,a=J,d=K,v=R,p=W;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(p,null,{header:s(()=>[(c(),b(k,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(g,{src:e.tag.user.avatar},null,8,["src"])]),default:s(()=>[n(w,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[V(" #"+f(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?u("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):u("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),_("div",le,[n(v,{placement:"bottom-end",trigger:"click",size:"small",options:m.value,onSelect:l},{default:s(()=>[n(d,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(a,null,{default:s(()=>[n(h(U))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}});const _e=$({__name:"Topic",setup(T){const t=ne(),r=i([]),m=i("hot"),l=i(!1),e=i(!1),o=i(!1);D(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=A({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,j({type:m.value,num:50}).then(a=>{r.value=a.topics,l.value=!1}).catch(a=>{console.log(a),l.value=!1})},k=a=>{m.value=a,a=="follow"?o.value=!0:o.value=!1,g()};return q(()=>{g()}),(a,d)=>{const v=te,p=Y,C=B,L=Z,M=ie,N=ee,O=oe,S=X;return c(),_("div",null,[n(v,{title:"话题"}),n(S,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(L,{type:"line",animated:"","onUpdate:value":k},P({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(p,{key:0,name:"follow",tab:"关注"})):u("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(C,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[V(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(O,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(Q,null,G(r.value,y=>(c(),b(M,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Me=E(_e,[["__scopeId","data-v-15794a53"]]);export{Me as default}; diff --git a/web/dist/assets/User-01d95431.js b/web/dist/assets/User-01d95431.js deleted file mode 100644 index 58e536f4..00000000 --- a/web/dist/assets/User-01d95431.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as xe,a as $e}from"./post-item.vue_vue_type_style_index_0_lang-cf654b7f.js";import{_ as Ue}from"./post-skeleton-627d3fc3.js";import{B as Pe,_ as A,C as ze,D as Fe,A as q,E as Se,F as Te}from"./index-8b4e1776.js";import{R as G,K,S as Q,b as J,e as D,i as X,T as Ie,F as Me,G as qe,o as Ce,O as We,j as Be,P as Re,k as Ae,f as De,g as Ne,I as Ve,H as Ee}from"./naive-ui-62663ad7.js";import{d as N,r as o,o as c,Q as F,a1 as n,a as p,V as a,e as w,M as k,E as Oe,n as je,w as He,j as Le,c as m,_ as y,O as z,F as H,a4 as L}from"./@vue-e0e89260.js";import{_ as Ge}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as Ke}from"./vuex-473b3783.js";import{b as Qe}from"./vue-router-b8e3382f.js";import{i as Je}from"./@vicons-d502290a.js";import"./content-c0ce69b7.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Xe={class:"whisper-wrap"},Ye={class:"whisper-line"},Ze={class:"whisper-line send-wrap"},es=N({__name:"whisper",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(T,{emit:b}){const d=T,i=o(""),t=o(!1),s=()=>{b("success")},_=()=>{t.value=!0,Pe({user_id:d.user.id,content:i.value}).then(u=>{window.$message.success("发送成功"),t.value=!1,i.value="",s()}).catch(u=>{t.value=!1})};return(u,h)=>{const r=G,v=K,l=Q,g=J,x=D,$=X;return c(),F($,{show:u.show,"onUpdate:show":s,class:"whisper-card",preset:"card",size:"small",title:"私信","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:n(()=>[p("div",Xe,[a(l,{"show-icon":!1},{default:n(()=>[w(" 即将发送私信给: "),a(v,{style:{"max-width":"100%"}},{default:n(()=>[a(r,{type:"success"},{default:n(()=>[w(k(u.user.nickname)+"@"+k(u.user.username),1)]),_:1})]),_:1})]),_:1}),p("div",Ye,[a(g,{type:"textarea",placeholder:"请输入私信内容(请勿发送不和谐内容,否则将会被封号)",autosize:{minRows:5,maxRows:10},value:i.value,"onUpdate:value":h[0]||(h[0]=U=>i.value=U),maxlength:"200","show-count":""},null,8,["value"])]),p("div",Ze,[a(x,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:_},{default:n(()=>[w(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const ss=A(es,[["__scopeId","data-v-0cbfe47c"]]),as={class:"whisper-wrap"},ts={class:"whisper-line"},ns={class:"whisper-line send-wrap"},os=N({__name:"whisper-add-friend",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(T,{emit:b}){const d=T,i=o(""),t=o(!1),s=()=>{b("success")},_=()=>{t.value=!0,ze({user_id:d.user.id,greetings:i.value}).then(u=>{window.$message.success("发送成功"),t.value=!1,i.value="",s()}).catch(u=>{t.value=!1})};return(u,h)=>{const r=G,v=K,l=Q,g=J,x=D,$=X;return c(),F($,{show:u.show,"onUpdate:show":s,class:"whisper-card",preset:"card",size:"small",title:"申请添加朋友","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:n(()=>[p("div",as,[a(l,{"show-icon":!1},{default:n(()=>[w(" 发送添加朋友申请给: "),a(v,{style:{"max-width":"100%"}},{default:n(()=>[a(r,{type:"success"},{default:n(()=>[w(k(u.user.nickname)+"@"+k(u.user.username),1)]),_:1})]),_:1})]),_:1}),p("div",ts,[a(g,{type:"textarea",placeholder:"请输入真挚的问候语",autosize:{minRows:5,maxRows:10},value:i.value,"onUpdate:value":h[0]||(h[0]=U=>i.value=U),maxlength:"120","show-count":""},null,8,["value"])]),p("div",ns,[a(x,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:_},{default:n(()=>[w(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const ls=A(os,[["__scopeId","data-v-60be56a2"]]),cs={key:0,class:"profile-baseinfo"},is={class:"avatar"},us={class:"base-info"},rs={class:"username"},_s={class:"uid"},ps={key:0,class:"user-opts"},ds={key:0,class:"skeleton-wrap"},ms={key:1},vs={key:0,class:"empty-wrap"},hs={key:1},fs={key:2},gs={key:0,class:"pagination-wrap"},ws=N({__name:"User",setup(T){const b=Ie(),d=Ke(),i=Qe(),t=o(!1),s=Oe({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,status:1}),_=o(!1),u=o(!1),h=o(!1),r=o([]),v=o(i.query.username||""),l=o(+i.query.p||1),g=o("post"),x=o(+i.query.p||1),$=o(1),U=o(1),V=o(1),f=o(20),P=o(0),Y=()=>{switch(g.value){case"post":I();break;case"comment":C();break;case"media":W();break;case"star":B();break}},I=()=>{t.value=!0,q({username:v.value,style:"post",page:l.value,page_size:f.value}).then(e=>{t.value=!1,r.value=e.list||[],P.value=Math.ceil(e.pager.total_rows/f.value),window.scrollTo(0,0)}).catch(e=>{r.value=[],t.value=!1})},C=()=>{t.value=!0,q({username:v.value,style:"comment",page:l.value,page_size:f.value}).then(e=>{t.value=!1,r.value=e.list||[],P.value=Math.ceil(e.pager.total_rows/f.value),window.scrollTo(0,0)}).catch(e=>{r.value=[],t.value=!1})},W=()=>{t.value=!0,q({username:v.value,style:"media",page:l.value,page_size:f.value}).then(e=>{t.value=!1,r.value=e.list||[],P.value=Math.ceil(e.pager.total_rows/f.value),window.scrollTo(0,0)}).catch(e=>{r.value=[],t.value=!1})},B=()=>{t.value=!0,q({username:v.value,style:"star",page:l.value,page_size:f.value}).then(e=>{t.value=!1,r.value=e.list||[],P.value=Math.ceil(e.pager.total_rows/f.value),window.scrollTo(0,0)}).catch(e=>{r.value=[],t.value=!1})},Z=e=>{switch(g.value=e,g.value){case"post":l.value=x.value,I();break;case"comment":l.value=$.value,C();break;case"media":l.value=U.value,W();break;case"star":l.value=V.value,B();break}},R=()=>{_.value=!0,Fe({username:v.value}).then(e=>{_.value=!1,s.id=e.id,s.avatar=e.avatar,s.username=e.username,s.nickname=e.nickname,s.is_admin=e.is_admin,s.is_friend=e.is_friend,s.status=e.status,Y()}).catch(e=>{_.value=!1,console.log(e)})},ee=e=>{switch(l.value=e,g.value){case"post":x.value=e,I();break;case"comment":$.value=l.value,C();break;case"media":U.value=l.value,W();break;case"star":V.value=l.value,B();break}},se=()=>{u.value=!0},ae=()=>{h.value=!0},te=()=>{u.value=!1},ne=()=>{h.value=!1},oe=je(()=>{let e=[{label:"私信",key:"whisper"}];return d.state.userInfo.is_admin&&(s.status===1?e.push({label:"禁言",key:"banned"}):e.push({label:"解封",key:"deblocking"})),s.is_friend?e.push({label:"删除好友",key:"delete"}):e.push({label:"添加朋友",key:"requesting"}),e}),le=e=>{switch(e){case"whisper":se();break;case"delete":ce();break;case"requesting":ae();break;case"banned":case"deblocking":ie();break}},ce=()=>{b.warning({title:"删除好友",content:"将好友 “"+s.nickname+"” 删除,将同时删除 点赞/收藏 列表中关于该朋友的 “好友可见” 推文",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{_.value=!0,Se({user_id:s.id}).then(e=>{_.value=!1,s.is_friend=!1,I()}).catch(e=>{_.value=!1,console.log(e)})}})},ie=()=>{b.warning({title:"警告",content:"确定对该用户进行"+(s.status===1?"禁言":"解封")+"处理吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{_.value=!0,Te({id:s.id,status:s.status===1?2:1}).then(e=>{_.value=!1,R()}).catch(e=>{_.value=!1,console.log(e)})}})};return He(()=>({path:i.path,query:i.query}),(e,E)=>{E.path==="/user"&&e.path==="/user"&&(v.value=i.query.username||"",R())}),Le(()=>{R()}),(e,E)=>{const ue=Ge,re=Ce,O=We,_e=Be,pe=D,de=Re,me=ss,ve=Ae,M=De,he=Ne,fe=Ue,ge=Ve,we=xe,j=Ee,ye=$e,ke=Me,be=qe;return c(),m("div",null,[a(ue,{title:"用户详情"}),a(ke,{class:"main-content-wrap profile-wrap",bordered:""},{default:n(()=>[a(ve,{show:_.value},{default:n(()=>[s.id>0?(c(),m("div",cs,[p("div",is,[a(re,{size:"large",src:s.avatar},null,8,["src"])]),p("div",us,[p("div",rs,[p("strong",null,k(s.nickname),1),p("span",null," @"+k(s.username),1),y(d).state.userInfo.id>0&&y(d).state.userInfo.username!=s.username&&s.is_friend?(c(),F(O,{key:0,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[w(" 好友 ")]),_:1})):z("",!0),s.is_admin?(c(),F(O,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[w(" 管理员 ")]),_:1})):z("",!0)]),p("div",_s,"UID. "+k(s.id),1)]),y(d).state.userInfo.id>0&&y(d).state.userInfo.username!=s.username?(c(),m("div",ps,[a(de,{placement:"bottom-end",trigger:"click",size:"small",options:oe.value,onSelect:le},{default:n(()=>[a(pe,{quaternary:"",circle:""},{icon:n(()=>[a(_e,null,{default:n(()=>[a(y(Je))]),_:1})]),_:1})]),_:1},8,["options"])])):z("",!0)])):z("",!0),a(me,{show:u.value,user:s,onSuccess:te},null,8,["show","user"]),a(ls,{show:h.value,user:s,onSuccess:ne},null,8,["show","user"])]),_:1},8,["show"]),a(he,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":Z},{default:n(()=>[a(M,{name:"post",tab:"泡泡"}),a(M,{name:"comment",tab:"评论"}),a(M,{name:"media",tab:"图文"}),a(M,{name:"star",tab:"喜欢"})]),_:1}),t.value?(c(),m("div",ds,[a(fe,{num:f.value},null,8,["num"])])):(c(),m("div",ms,[r.value.length===0?(c(),m("div",vs,[a(ge,{size:"large",description:"暂无数据"})])):z("",!0),y(d).state.desktopModelShow?(c(),m("div",hs,[(c(!0),m(H,null,L(r.value,S=>(c(),F(j,{key:S.id},{default:n(()=>[a(we,{post:S},null,8,["post"])]),_:2},1024))),128))])):(c(),m("div",fs,[(c(!0),m(H,null,L(r.value,S=>(c(),F(j,{key:S.id},{default:n(()=>[a(ye,{post:S},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),P.value>0?(c(),m("div",gs,[a(be,{page:l.value,"onUpdate:page":ee,"page-slot":y(d).state.collapsedRight?5:8,"page-count":P.value},null,8,["page","page-slot","page-count"])])):z("",!0)])}}});const Js=A(ws,[["__scopeId","data-v-fd0defa8"]]);export{Js as default}; diff --git a/web/dist/assets/User-3e4ab8ff.css b/web/dist/assets/User-3e4ab8ff.css deleted file mode 100644 index 82d32ffa..00000000 --- a/web/dist/assets/User-3e4ab8ff.css +++ /dev/null @@ -1 +0,0 @@ -.whisper-wrap .whisper-line[data-v-0cbfe47c]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-0cbfe47c]{width:100%}.dark .whisper-wrap[data-v-0cbfe47c]{background-color:#101014bf}.whisper-wrap .whisper-line[data-v-60be56a2]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-60be56a2]{width:100%}.dark .whisper-wrap[data-v-60be56a2]{background-color:#101014bf}.profile-tabs-wrap[data-v-fd0defa8]{padding:0 16px}.profile-baseinfo[data-v-fd0defa8]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-fd0defa8]{width:55px}.profile-baseinfo .base-info[data-v-fd0defa8]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-fd0defa8]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-fd0defa8]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .top-tag[data-v-fd0defa8]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-fd0defa8]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-fd0defa8]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-fd0defa8]{background-color:#18181c}.dark .profile-wrap[data-v-fd0defa8],.dark .pagination-wrap[data-v-fd0defa8]{background-color:#101014bf} diff --git a/web/dist/assets/User-a79da2ba.css b/web/dist/assets/User-a79da2ba.css new file mode 100644 index 00000000..93630eb8 --- /dev/null +++ b/web/dist/assets/User-a79da2ba.css @@ -0,0 +1 @@ +.whisper-wrap .whisper-line[data-v-0cbfe47c]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-0cbfe47c]{width:100%}.dark .whisper-wrap[data-v-0cbfe47c]{background-color:#101014bf}.whisper-wrap .whisper-line[data-v-60be56a2]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-60be56a2]{width:100%}.dark .whisper-wrap[data-v-60be56a2]{background-color:#101014bf}.profile-tabs-wrap[data-v-b67c9295]{padding:0 16px}.profile-baseinfo[data-v-b67c9295]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-b67c9295]{width:55px}.profile-baseinfo .base-info[data-v-b67c9295]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-b67c9295]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-b67c9295]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .top-tag[data-v-b67c9295]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-b67c9295]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-b67c9295]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-b67c9295]{background-color:#18181c}.dark .profile-wrap[data-v-b67c9295],.dark .pagination-wrap[data-v-b67c9295]{background-color:#101014bf} diff --git a/web/dist/assets/User-fd7a65dc.js b/web/dist/assets/User-fd7a65dc.js new file mode 100644 index 00000000..e9042f8d --- /dev/null +++ b/web/dist/assets/User-fd7a65dc.js @@ -0,0 +1 @@ +import{_ as Pe,a as Ue}from"./post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js";import{_ as ze}from"./post-skeleton-41befd31.js";import{C as Fe,_ as D,D as Te,E as Me,B as S,F as Se,G as Ie}from"./index-08d8af97.js";import{R as Q,K as J,S as X,b as Y,e as N,i as Z,T as qe,F as Ce,G as We,o as Be,O as Re,j as Ae,P as De,k as Ne,f as Ve,g as Ee,I as He,H as Oe}from"./naive-ui-62663ad7.js";import{d as V,r as l,o as u,Q as F,a1 as o,a as p,V as a,e as w,M as y,E as je,n as Ge,w as Le,j as Ke,c as h,_ as b,O as z,F as L,a4 as K}from"./@vue-e0e89260.js";import{_ as Qe}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as Je}from"./vuex-473b3783.js";import{b as Xe}from"./vue-router-b8e3382f.js";import{i as Ye}from"./@vicons-6332ad63.js";import"./content-91ba374b.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Ze={class:"whisper-wrap"},es={class:"whisper-line"},ss={class:"whisper-line send-wrap"},as=V({__name:"whisper",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(I,{emit:x}){const d=I,c=l(""),t=l(!1),s=()=>{x("success")},_=()=>{t.value=!0,Fe({user_id:d.user.id,content:c.value}).then(r=>{window.$message.success("发送成功"),t.value=!1,c.value="",s()}).catch(r=>{t.value=!1})};return(r,g)=>{const i=Q,m=J,n=X,f=Y,$=N,P=Z;return u(),F(P,{show:r.show,"onUpdate:show":s,class:"whisper-card",preset:"card",size:"small",title:"私信","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:o(()=>[p("div",Ze,[a(n,{"show-icon":!1},{default:o(()=>[w(" 即将发送私信给: "),a(m,{style:{"max-width":"100%"}},{default:o(()=>[a(i,{type:"success"},{default:o(()=>[w(y(r.user.nickname)+"@"+y(r.user.username),1)]),_:1})]),_:1})]),_:1}),p("div",es,[a(f,{type:"textarea",placeholder:"请输入私信内容(请勿发送不和谐内容,否则将会被封号)",autosize:{minRows:5,maxRows:10},value:c.value,"onUpdate:value":g[0]||(g[0]=U=>c.value=U),maxlength:"200","show-count":""},null,8,["value"])]),p("div",ss,[a($,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:_},{default:o(()=>[w(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const ts=D(as,[["__scopeId","data-v-0cbfe47c"]]),ns={class:"whisper-wrap"},os={class:"whisper-line"},ls={class:"whisper-line send-wrap"},is=V({__name:"whisper-add-friend",props:{show:{type:Boolean,default:!1},user:{}},emits:["success"],setup(I,{emit:x}){const d=I,c=l(""),t=l(!1),s=()=>{x("success")},_=()=>{t.value=!0,Te({user_id:d.user.id,greetings:c.value}).then(r=>{window.$message.success("发送成功"),t.value=!1,c.value="",s()}).catch(r=>{t.value=!1})};return(r,g)=>{const i=Q,m=J,n=X,f=Y,$=N,P=Z;return u(),F(P,{show:r.show,"onUpdate:show":s,class:"whisper-card",preset:"card",size:"small",title:"申请添加朋友","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:o(()=>[p("div",ns,[a(n,{"show-icon":!1},{default:o(()=>[w(" 发送添加朋友申请给: "),a(m,{style:{"max-width":"100%"}},{default:o(()=>[a(i,{type:"success"},{default:o(()=>[w(y(r.user.nickname)+"@"+y(r.user.username),1)]),_:1})]),_:1})]),_:1}),p("div",os,[a(f,{type:"textarea",placeholder:"请输入真挚的问候语",autosize:{minRows:5,maxRows:10},value:c.value,"onUpdate:value":g[0]||(g[0]=U=>c.value=U),maxlength:"120","show-count":""},null,8,["value"])]),p("div",ls,[a($,{strong:"",secondary:"",type:"primary",loading:t.value,onClick:_},{default:o(()=>[w(" 发送 ")]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});const us=D(is,[["__scopeId","data-v-60be56a2"]]),cs={key:0,class:"profile-baseinfo"},rs={class:"avatar"},_s={class:"base-info"},ps={class:"username"},ds={class:"uid"},ms={key:0,class:"user-opts"},vs={key:0,class:"skeleton-wrap"},hs={key:1},gs={key:0,class:"empty-wrap"},fs={key:1},ws={key:2},ks={key:0,class:"pagination-wrap"},bs=V({__name:"User",setup(I){const x=qe(),d=Je(),c=Xe(),t=l(!1),s=je({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,status:1}),_=l(!1),r=l(!1),g=l(!1),i=l([]),m=l(c.query.username||""),n=l(+c.query.p||1),f=l("post"),$=l(+c.query.p||1),P=l(1),U=l(1),E=l(1),H=l(1),v=l(20),k=l(0),ee=()=>{switch(f.value){case"post":q();break;case"comment":C();break;case"highlight":W();break;case"media":B();break;case"star":R();break}},q=()=>{t.value=!0,S({username:m.value,style:"post",page:n.value,page_size:v.value}).then(e=>{t.value=!1,i.value=e.list||[],k.value=Math.ceil(e.pager.total_rows/v.value),window.scrollTo(0,0)}).catch(e=>{i.value=[],t.value=!1})},C=()=>{t.value=!0,S({username:m.value,style:"comment",page:n.value,page_size:v.value}).then(e=>{t.value=!1,i.value=e.list||[],k.value=Math.ceil(e.pager.total_rows/v.value),window.scrollTo(0,0)}).catch(e=>{i.value=[],t.value=!1})},W=()=>{t.value=!0,S({username:m.value,style:"highlight",page:n.value,page_size:v.value}).then(e=>{t.value=!1,i.value=e.list||[],k.value=Math.ceil(e.pager.total_rows/v.value),window.scrollTo(0,0)}).catch(e=>{i.value=[],t.value=!1})},B=()=>{t.value=!0,S({username:m.value,style:"media",page:n.value,page_size:v.value}).then(e=>{t.value=!1,i.value=e.list||[],k.value=Math.ceil(e.pager.total_rows/v.value),window.scrollTo(0,0)}).catch(e=>{i.value=[],t.value=!1})},R=()=>{t.value=!0,S({username:m.value,style:"star",page:n.value,page_size:v.value}).then(e=>{t.value=!1,i.value=e.list||[],k.value=Math.ceil(e.pager.total_rows/v.value),window.scrollTo(0,0)}).catch(e=>{i.value=[],t.value=!1})},se=e=>{switch(f.value=e,f.value){case"post":n.value=$.value,q();break;case"comment":n.value=P.value,C();break;case"highlight":n.value=U.value,W();break;case"media":n.value=E.value,B();break;case"star":n.value=H.value,R();break}},A=()=>{_.value=!0,Me({username:m.value}).then(e=>{_.value=!1,s.id=e.id,s.avatar=e.avatar,s.username=e.username,s.nickname=e.nickname,s.is_admin=e.is_admin,s.is_friend=e.is_friend,s.status=e.status,ee()}).catch(e=>{_.value=!1,console.log(e)})},ae=e=>{switch(n.value=e,f.value){case"post":$.value=e,q();break;case"comment":P.value=n.value,C();break;case"highlight":U.value=n.value,W();break;case"media":E.value=n.value,B();break;case"star":H.value=n.value,R();break}},te=()=>{r.value=!0},ne=()=>{g.value=!0},oe=()=>{r.value=!1},le=()=>{g.value=!1},ie=Ge(()=>{let e=[{label:"私信",key:"whisper"}];return d.state.userInfo.is_admin&&(s.status===1?e.push({label:"禁言",key:"banned"}):e.push({label:"解封",key:"deblocking"})),s.is_friend?e.push({label:"删除好友",key:"delete"}):e.push({label:"添加朋友",key:"requesting"}),e}),ue=e=>{switch(e){case"whisper":te();break;case"delete":ce();break;case"requesting":ne();break;case"banned":case"deblocking":re();break}},ce=()=>{x.warning({title:"删除好友",content:"将好友 “"+s.nickname+"” 删除,将同时删除 点赞/收藏 列表中关于该朋友的 “好友可见” 推文",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{_.value=!0,Se({user_id:s.id}).then(e=>{_.value=!1,s.is_friend=!1,q()}).catch(e=>{_.value=!1,console.log(e)})}})},re=()=>{x.warning({title:"警告",content:"确定对该用户进行"+(s.status===1?"禁言":"解封")+"处理吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{_.value=!0,Ie({id:s.id,status:s.status===1?2:1}).then(e=>{_.value=!1,A()}).catch(e=>{_.value=!1,console.log(e)})}})};return Le(()=>({path:c.path,query:c.query}),(e,O)=>{O.path==="/user"&&e.path==="/user"&&(m.value=c.query.username||"",A())}),Ke(()=>{A()}),(e,O)=>{const _e=Qe,pe=Be,j=Re,de=Ae,me=N,ve=De,he=ts,ge=Ne,T=Ve,fe=Ee,we=ze,ke=He,be=Pe,G=Oe,ye=Ue,xe=Ce,$e=We;return u(),h("div",null,[a(_e,{title:"用户详情"}),a(xe,{class:"main-content-wrap profile-wrap",bordered:""},{default:o(()=>[a(ge,{show:_.value},{default:o(()=>[s.id>0?(u(),h("div",cs,[p("div",rs,[a(pe,{size:"large",src:s.avatar},null,8,["src"])]),p("div",_s,[p("div",ps,[p("strong",null,y(s.nickname),1),p("span",null," @"+y(s.username),1),b(d).state.userInfo.id>0&&b(d).state.userInfo.username!=s.username&&s.is_friend?(u(),F(j,{key:0,class:"top-tag",type:"info",size:"small",round:""},{default:o(()=>[w(" 好友 ")]),_:1})):z("",!0),s.is_admin?(u(),F(j,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:o(()=>[w(" 管理员 ")]),_:1})):z("",!0)]),p("div",ds,"UID. "+y(s.id),1)]),b(d).state.userInfo.id>0&&b(d).state.userInfo.username!=s.username?(u(),h("div",ms,[a(ve,{placement:"bottom-end",trigger:"click",size:"small",options:ie.value,onSelect:ue},{default:o(()=>[a(me,{quaternary:"",circle:""},{icon:o(()=>[a(de,null,{default:o(()=>[a(b(Ye))]),_:1})]),_:1})]),_:1},8,["options"])])):z("",!0)])):z("",!0),a(he,{show:r.value,user:s,onSuccess:oe},null,8,["show","user"]),a(us,{show:g.value,user:s,onSuccess:le},null,8,["show","user"])]),_:1},8,["show"]),a(fe,{class:"profile-tabs-wrap",type:"line",animated:"","onUpdate:value":se},{default:o(()=>[a(T,{name:"post",tab:"泡泡"}),a(T,{name:"comment",tab:"评论"}),a(T,{name:"highlight",tab:"亮点"}),a(T,{name:"media",tab:"图文"}),a(T,{name:"star",tab:"喜欢"})]),_:1}),t.value?(u(),h("div",vs,[a(we,{num:v.value},null,8,["num"])])):(u(),h("div",hs,[i.value.length===0?(u(),h("div",gs,[a(ke,{size:"large",description:"暂无数据"})])):z("",!0),b(d).state.desktopModelShow?(u(),h("div",fs,[(u(!0),h(L,null,K(i.value,M=>(u(),F(G,{key:M.id},{default:o(()=>[a(be,{post:M},null,8,["post"])]),_:2},1024))),128))])):(u(),h("div",ws,[(u(!0),h(L,null,K(i.value,M=>(u(),F(G,{key:M.id},{default:o(()=>[a(ye,{post:M},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),k.value>0?(u(),h("div",ks,[a($e,{page:n.value,"onUpdate:page":ae,"page-slot":b(d).state.collapsedRight?5:8,"page-count":k.value},null,8,["page","page-slot","page-count"])])):z("",!0)])}}});const Ys=D(bs,[["__scopeId","data-v-b67c9295"]]);export{Ys as default}; diff --git a/web/dist/assets/Wallet-4af86e57.js b/web/dist/assets/Wallet-a970081d.js similarity index 55% rename from web/dist/assets/Wallet-4af86e57.js rename to web/dist/assets/Wallet-a970081d.js index c2341c1d..d367e280 100644 --- a/web/dist/assets/Wallet-4af86e57.js +++ b/web/dist/assets/Wallet-a970081d.js @@ -1 +1 @@ -import{_ as X}from"./post-skeleton-627d3fc3.js";import{_ as Y}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{d as Z,r as c,j as J,c as _,V as e,a1 as o,o as n,_ as y,O as w,a,e as k,F as N,a4 as $,z as ee,v as te,M as r,Q as q,L as oe,a2 as ae,W as ne,X as se}from"./@vue-e0e89260.js";import{u as le}from"./vuex-473b3783.js";import{b as ce}from"./vue-router-b8e3382f.js";import{b as ie}from"./qrcode-9719fc56.js";import{O as _e,P as re,Q as ue,R as pe,_ as de}from"./index-8b4e1776.js";import{a as me}from"./formatTime-cdf4e6f1.js";import{w as ge}from"./@vicons-d502290a.js";import{F as ve,i as he,Y as fe,Z as ye,e as we,a as ke,G as be,I as xe,j as Ce,l as Ie,h as Se,H as Re}from"./naive-ui-62663ad7.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./encode-utf8-f813de00.js";import"./dijkstrajs-f906a09e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./moment-2ab8298d.js";const O=m=>(ne("data-v-870bd246"),m=m(),se(),m),Ae={class:"balance-wrap"},ze={class:"balance-line"},Ne={class:"balance-opts"},$e={key:0,class:"pagination-wrap"},qe={key:0,class:"skeleton-wrap"},Oe={key:1},Pe={key:0,class:"empty-wrap"},We={class:"bill-line"},Be={key:0,class:"amount-options"},Fe={key:1,style:{"margin-top":"10px"}},Le={class:"qrcode-wrap"},Te=O(()=>a("canvas",{id:"qrcode-container"},null,-1)),Ve={class:"pay-tips"},Ee={class:"pay-sub-tips"},Me=O(()=>a("span",{style:{"margin-left":"6px"}}," 支付结果实时同步中... ",-1)),Ue=Z({__name:"Wallet",setup(m){const i=le(),P=ce(),g=c(!1),u=c(100),v=c(!1),p=c(""),h=c(!1),b=c([]),x=c(+P.query.p||1),C=c(20),I=c(0),W=c([100,200,300,500,1e3,3e3,5e3,1e4,5e4]),R=()=>{h.value=!0,re({page:x.value,page_size:C.value}).then(s=>{h.value=!1,b.value=s.list,I.value=Math.ceil(s.pager.total_rows/C.value),window.scrollTo(0,0)}).catch(s=>{h.value=!1})},B=s=>{x.value=s,R()},A=()=>{const s=localStorage.getItem("PAOPAO_TOKEN")||"";s?_e(s).then(l=>{i.commit("updateUserinfo",l),i.commit("triggerAuth",!1),R()}).catch(l=>{i.commit("triggerAuth",!0),i.commit("userLogout")}):(i.commit("triggerAuth",!0),i.commit("userLogout"))},F=()=>{g.value=!0},L=s=>{v.value=!0,ue({amount:u.value}).then(l=>{v.value=!1,p.value=l.pay,ie.toCanvas(document.querySelector("#qrcode-container"),l.pay,{width:150,margin:2});const S=setInterval(()=>{pe({id:l.id}).then(d=>{d.status==="TRADE_SUCCESS"&&(clearInterval(S),window.$message.success("充值成功"),g.value=!1,p.value="",A())}).catch(d=>{console.log(d)})},2e3)}).catch(l=>{v.value=!1})},T=()=>{i.state.userInfo.balance==0?window.$message.warning("您暂无可提现资金"):window.$message.warning("该功能即将开放")};return J(()=>{A()}),(s,l)=>{const S=Y,d=fe,V=ye,f=we,z=ke,E=be,M=X,U=xe,D=Re,Q=ve,j=Ce,G=Ie,H=Se,K=he;return n(),_("div",null,[e(S,{title:"钱包"}),e(Q,{class:"main-content-wrap",bordered:""},{footer:o(()=>[I.value>1?(n(),_("div",$e,[e(E,{page:x.value,"onUpdate:page":B,"page-slot":y(i).state.collapsedRight?5:8,"page-count":I.value},null,8,["page","page-slot","page-count"])])):w("",!0)]),default:o(()=>[a("div",Ae,[a("div",ze,[e(V,{label:"账户余额 (元)"},{default:o(()=>[e(d,{from:0,to:(y(i).state.userInfo.balance||0)/100,duration:500,precision:2},null,8,["to"])]),_:1}),a("div",Ne,[e(z,{vertical:""},{default:o(()=>[e(f,{size:"small",secondary:"",type:"primary",onClick:F},{default:o(()=>[k(" 充值 ")]),_:1}),e(f,{size:"small",secondary:"",type:"tertiary",onClick:T},{default:o(()=>[k(" 提现 ")]),_:1})]),_:1})])])]),h.value?(n(),_("div",qe,[e(M,{num:C.value},null,8,["num"])])):(n(),_("div",Oe,[b.value.length===0?(n(),_("div",Pe,[e(U,{size:"large",description:"暂无数据"})])):w("",!0),(n(!0),_(N,null,$(b.value,t=>(n(),q(D,{key:t.id},{default:o(()=>[a("div",We,[a("div",null,"NO."+r(t.id),1),a("div",null,r(t.reason),1),a("div",{class:oe({income:t.change_amount>=0,out:t.change_amount<0})},r((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),a("div",null,r(y(me)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1}),e(K,{show:g.value,"onUpdate:show":l[0]||(l[0]=t=>g.value=t)},{default:o(()=>[e(H,{bordered:!1,title:"请选择充值金额",role:"dialog","aria-modal":"true",style:{width:"100%","max-width":"330px"}},{default:o(()=>[p.value.length===0?(n(),_("div",Be,[e(z,{align:"baseline"},{default:o(()=>[(n(!0),_(N,null,$(W.value,t=>(n(),q(f,{key:t,size:"small",secondary:"",type:u.value===t?"info":"default",onClick:ae(De=>u.value=t,["stop"])},{default:o(()=>[k(r(t/100)+"元 ",1)]),_:2},1032,["type","onClick"]))),128))]),_:1})])):w("",!0),u.value>0&&p.value.length===0?(n(),_("div",Fe,[e(f,{loading:v.value,strong:"",secondary:"",type:"info",style:{width:"100%"},onClick:L},{icon:o(()=>[e(j,null,{default:o(()=>[e(y(ge))]),_:1})]),default:o(()=>[k(" 前往支付 ")]),_:1},8,["loading"])])):w("",!0),ee(a("div",Le,[Te,a("div",Ve," 请使用支付宝扫码支付"+r((u.value/100).toFixed(2))+"元 ",1),a("div",Ee,[e(G,{value:100,type:"info",dot:"",processing:""}),Me])],512),[[te,p.value.length>0]])]),_:1})]),_:1},8,["show"])])}}});const yt=de(Ue,[["__scopeId","data-v-870bd246"]]);export{yt as default}; +import{_ as K}from"./post-skeleton-41befd31.js";import{_ as X}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{d as Y,r as c,j as Z,c as _,V as e,a1 as o,o as n,_ as y,O as w,a,e as k,F as N,a4 as $,z as ee,v as te,M as r,Q as q,L as oe,a2 as ae,W as ne,X as se}from"./@vue-e0e89260.js";import{u as le}from"./vuex-473b3783.js";import{b as ce}from"./vue-router-b8e3382f.js";import{b as ie}from"./qrcode-9719fc56.js";import{P as _e,Q as re,R as ue,S as pe,_ as de}from"./index-08d8af97.js";import{a as me}from"./formatTime-cdf4e6f1.js";import{J as ge}from"./@vicons-6332ad63.js";import{F as ve,i as he,Y as fe,Z as ye,e as we,a as ke,G as be,I as Se,j as xe,l as Ce,h as Ie,H as Re}from"./naive-ui-62663ad7.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./encode-utf8-f813de00.js";import"./dijkstrajs-f906a09e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./moment-2ab8298d.js";const P=m=>(ne("data-v-870bd246"),m=m(),se(),m),Ae={class:"balance-wrap"},ze={class:"balance-line"},Ne={class:"balance-opts"},$e={key:0,class:"pagination-wrap"},qe={key:0,class:"skeleton-wrap"},Pe={key:1},We={key:0,class:"empty-wrap"},Be={class:"bill-line"},Fe={key:0,class:"amount-options"},Le={key:1,style:{"margin-top":"10px"}},Oe={class:"qrcode-wrap"},Te=P(()=>a("canvas",{id:"qrcode-container"},null,-1)),Ve={class:"pay-tips"},Ee={class:"pay-sub-tips"},Me=P(()=>a("span",{style:{"margin-left":"6px"}}," 支付结果实时同步中... ",-1)),Ue=Y({__name:"Wallet",setup(m){const i=le(),W=ce(),g=c(!1),u=c(100),v=c(!1),p=c(""),h=c(!1),b=c([]),S=c(+W.query.p||1),x=c(20),C=c(0),B=c([100,200,300,500,1e3,3e3,5e3,1e4,5e4]),R=()=>{h.value=!0,re({page:S.value,page_size:x.value}).then(s=>{h.value=!1,b.value=s.list,C.value=Math.ceil(s.pager.total_rows/x.value),window.scrollTo(0,0)}).catch(s=>{h.value=!1})},F=s=>{S.value=s,R()},A=()=>{const s=localStorage.getItem("PAOPAO_TOKEN")||"";s?_e(s).then(l=>{i.commit("updateUserinfo",l),i.commit("triggerAuth",!1),R()}).catch(l=>{i.commit("triggerAuth",!0),i.commit("userLogout")}):(i.commit("triggerAuth",!0),i.commit("userLogout"))},L=()=>{g.value=!0},O=s=>{v.value=!0,ue({amount:u.value}).then(l=>{v.value=!1,p.value=l.pay,ie.toCanvas(document.querySelector("#qrcode-container"),l.pay,{width:150,margin:2});const I=setInterval(()=>{pe({id:l.id}).then(d=>{d.status==="TRADE_SUCCESS"&&(clearInterval(I),window.$message.success("充值成功"),g.value=!1,p.value="",A())}).catch(d=>{console.log(d)})},2e3)}).catch(l=>{v.value=!1})},T=()=>{i.state.userInfo.balance==0?window.$message.warning("您暂无可提现资金"):window.$message.warning("该功能即将开放")};return Z(()=>{A()}),(s,l)=>{const I=X,d=fe,V=ye,f=we,z=ke,E=be,M=K,U=Se,D=Re,Q=ve,j=xe,G=Ce,H=Ie,J=he;return n(),_("div",null,[e(I,{title:"钱包"}),e(Q,{class:"main-content-wrap",bordered:""},{footer:o(()=>[C.value>1?(n(),_("div",$e,[e(E,{page:S.value,"onUpdate:page":F,"page-slot":y(i).state.collapsedRight?5:8,"page-count":C.value},null,8,["page","page-slot","page-count"])])):w("",!0)]),default:o(()=>[a("div",Ae,[a("div",ze,[e(V,{label:"账户余额 (元)"},{default:o(()=>[e(d,{from:0,to:(y(i).state.userInfo.balance||0)/100,duration:500,precision:2},null,8,["to"])]),_:1}),a("div",Ne,[e(z,{vertical:""},{default:o(()=>[e(f,{size:"small",secondary:"",type:"primary",onClick:L},{default:o(()=>[k(" 充值 ")]),_:1}),e(f,{size:"small",secondary:"",type:"tertiary",onClick:T},{default:o(()=>[k(" 提现 ")]),_:1})]),_:1})])])]),h.value?(n(),_("div",qe,[e(M,{num:x.value},null,8,["num"])])):(n(),_("div",Pe,[b.value.length===0?(n(),_("div",We,[e(U,{size:"large",description:"暂无数据"})])):w("",!0),(n(!0),_(N,null,$(b.value,t=>(n(),q(D,{key:t.id},{default:o(()=>[a("div",Be,[a("div",null,"NO."+r(t.id),1),a("div",null,r(t.reason),1),a("div",{class:oe({income:t.change_amount>=0,out:t.change_amount<0})},r((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),a("div",null,r(y(me)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1}),e(J,{show:g.value,"onUpdate:show":l[0]||(l[0]=t=>g.value=t)},{default:o(()=>[e(H,{bordered:!1,title:"请选择充值金额",role:"dialog","aria-modal":"true",style:{width:"100%","max-width":"330px"}},{default:o(()=>[p.value.length===0?(n(),_("div",Fe,[e(z,{align:"baseline"},{default:o(()=>[(n(!0),_(N,null,$(B.value,t=>(n(),q(f,{key:t,size:"small",secondary:"",type:u.value===t?"info":"default",onClick:ae(De=>u.value=t,["stop"])},{default:o(()=>[k(r(t/100)+"元 ",1)]),_:2},1032,["type","onClick"]))),128))]),_:1})])):w("",!0),u.value>0&&p.value.length===0?(n(),_("div",Le,[e(f,{loading:v.value,strong:"",secondary:"",type:"info",style:{width:"100%"},onClick:O},{icon:o(()=>[e(j,null,{default:o(()=>[e(y(ge))]),_:1})]),default:o(()=>[k(" 前往支付 ")]),_:1},8,["loading"])])):w("",!0),ee(a("div",Oe,[Te,a("div",Ve," 请使用支付宝扫码支付"+r((u.value/100).toFixed(2))+"元 ",1),a("div",Ee,[e(G,{value:100,type:"info",dot:"",processing:""}),Me])],512),[[te,p.value.length>0]])]),_:1})]),_:1},8,["show"])])}}});const yt=de(Ue,[["__scopeId","data-v-870bd246"]]);export{yt as default}; diff --git a/web/dist/assets/content-91ba374b.js b/web/dist/assets/content-91ba374b.js new file mode 100644 index 00000000..3d9af0b3 --- /dev/null +++ b/web/dist/assets/content-91ba374b.js @@ -0,0 +1 @@ +import{d as h,o as e,c as r,F as a,a4 as m,V as s,a1 as o,_ as c,a as C,a2 as k,M as I,Q as d,O as g,r as j,e as A,s as b}from"./@vue-e0e89260.js";import{D as B,G as M}from"./@vicons-6332ad63.js";import{j as $,V as D,W as N,m as z,X as F,e as L,i as O}from"./naive-ui-62663ad7.js";import{_ as V,M as T,N as U}from"./index-08d8af97.js";import{e as P}from"./paopao-video-player-aa5e8b3f.js";const R={class:"link-wrap"},G={class:"link-txt-wrap"},Q=["href"],S={class:"link-txt"},W=h({__name:"post-link",props:{links:{default:()=>[]}},setup(y){const l=y;return(p,u)=>{const x=$;return e(),r("div",R,[(e(!0),r(a,null,m(l.links,n=>(e(),r("div",{class:"link-item",key:n.id},[s(x,{class:"hash-link"},{default:o(()=>[s(c(B))]),_:1}),C("div",G,[C("a",{href:n.content,class:"hash-link",target:"_blank",onClick:u[0]||(u[0]=k(()=>{},["stop"]))},[C("span",S,I(n.content),1)],8,Q)])]))),128))])}}});const ot=V(W,[["__scopeId","data-v-36eef76b"]]),X={key:0},st=h({__name:"post-video",props:{videos:{default:()=>[]},full:{type:Boolean,default:!1}},setup(y){const l=y;return(p,u)=>{const x=D,n=N;return l.videos.length>0?(e(),r("div",X,[s(n,{"x-gap":4,"y-gap":4,cols:p.full?1:5},{default:o(()=>[s(x,{span:p.full?1:3},{default:o(()=>[(e(!0),r(a,null,m(l.videos,v=>(e(),d(c(P),{onClick:u[0]||(u[0]=k(()=>{},["stop"])),key:v.id,src:v.content,colors:["#18a058","#2aca75"],hoverable:!0,theme:"gradient"},null,8,["src"]))),128))]),_:1},8,["span"])]),_:1},8,["cols"])])):g("",!0)}}}),Z={class:"images-wrap"},rt=h({__name:"post-image",props:{imgs:{default:()=>[]}},setup(y){const l=y,p="https://paopao-assets.oss-cn-shanghai.aliyuncs.com/public/404.png",u="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,png";return(x,n)=>{const v=z,_=D,f=N,w=F;return e(),r("div",Z,[[1].includes(l.imgs.length)?(e(),d(w,{key:0},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:2},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,t=>(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[0]||(n[0]=k(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[2,3].includes(l.imgs.length)?(e(),d(w,{key:1},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,t=>(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[1]||(n[1]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[4].includes(l.imgs.length)?(e(),d(w,{key:2},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:4},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,t=>(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[2]||(n[2]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[5].includes(l.imgs.length)?(e(),d(w,{key:3},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i<3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[3]||(n[3]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:2,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i>=3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[4]||(n[4]=k(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1})]),_:1})):g("",!0),[6].includes(l.imgs.length)?(e(),d(w,{key:4},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i<3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[5]||(n[5]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i>=3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[6]||(n[6]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1})]),_:1})):g("",!0),l.imgs.length===7?(e(),d(w,{key:5},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:4},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i<4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[7]||(n[7]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[8]||(n[8]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0),l.imgs.length===8?(e(),d(w,{key:6},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:4},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i<4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[9]||(n[9]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:4,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[10]||(n[10]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0),l.imgs.length===9?(e(),d(w,{key:7},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i<3?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[11]||(n[11]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=3&&i<6?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[12]||(n[12]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=6?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[13]||(n[13]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0)])}}});const q={class:"attachment-wrap"},H=h({__name:"post-attachment",props:{attachments:{default:()=>[]},price:{default:0}},setup(y){const l=y,p=j(!1),u=j(""),x=j(0),n=_=>{p.value=!0,x.value=_.id,u.value="这是一个免费附件,您可以直接下载?",_.type===8&&(u.value=()=>b("div",{},[b("p",{},"这是一个收费附件,下载将收取"+(l.price/100).toFixed(2)+"元")]),T({id:x.value}).then(f=>{f.paid&&(u.value=()=>b("div",{},[b("p",{},"此次下载您已支付或无需付费,请确认下载")]))}).catch(f=>{p.value=!1}))},v=()=>{U({id:x.value}).then(_=>{window.open(_.signed_url.replace("http://","https://"),"_blank")}).catch(_=>{console.log(_)})};return(_,f)=>{const w=$,t=L,i=O;return e(),r("div",q,[(e(!0),r(a,null,m(_.attachments,E=>(e(),r("div",{class:"attach-item",key:E.id},[s(t,{onClick:k(J=>n(E),["stop"]),type:"primary",size:"tiny",dashed:""},{icon:o(()=>[s(w,null,{default:o(()=>[s(c(M))]),_:1})]),default:o(()=>[A(" "+I(E.type===8?"收费":"免费")+"附件 ",1)]),_:2},1032,["onClick"])]))),128)),s(i,{show:p.value,"onUpdate:show":f[0]||(f[0]=E=>p.value=E),"mask-closable":!1,preset:"dialog",title:"下载提示",content:u.value,"positive-text":"确认下载","negative-text":"取消","icon-placement":"top",onPositiveClick:v},null,8,["show","content"])])}}});const lt=V(H,[["__scopeId","data-v-22563084"]]),ct=y=>{const l=[],p=[];var u=/(#|#)([^#@\s])+?\s+?/g,x=/@([a-zA-Z0-9])+?\s+?/g;return y=y.replace(/<[^>]*?>/gi,"").replace(/(.*?)<\/[^>]*?>/gi,"").replace(u,n=>(l.push(n.substr(1).trim()),''+n.trim()+" ")).replace(x,n=>(p.push(n.substr(1).trim()),''+n.trim()+" ")),{content:y,tags:l,users:p}};export{rt as _,lt as a,st as b,ot as c,ct as p}; diff --git a/web/dist/assets/content-c0ce69b7.js b/web/dist/assets/content-c0ce69b7.js deleted file mode 100644 index 38242c56..00000000 --- a/web/dist/assets/content-c0ce69b7.js +++ /dev/null @@ -1 +0,0 @@ -import{d as h,o as e,c as r,F as a,a4 as m,V as s,a1 as o,_ as c,a as C,a2 as k,M as I,Q as d,O as g,r as j,e as D,s as b}from"./@vue-e0e89260.js";import{u as N,v as L}from"./@vicons-d502290a.js";import{j as $,V,W as A,m as M,X as z,e as F,i as O}from"./naive-ui-62663ad7.js";import{_ as B,L as T,M as U}from"./index-8b4e1776.js";import{e as P}from"./paopao-video-player-aa5e8b3f.js";const R={class:"link-wrap"},Q={class:"link-txt-wrap"},S=["href"],W={class:"link-txt"},X=h({__name:"post-link",props:{links:{default:()=>[]}},setup(y){const l=y;return(p,u)=>{const x=$;return e(),r("div",R,[(e(!0),r(a,null,m(l.links,n=>(e(),r("div",{class:"link-item",key:n.id},[s(x,{class:"hash-link"},{default:o(()=>[s(c(N))]),_:1}),C("div",Q,[C("a",{href:n.content,class:"hash-link",target:"_blank",onClick:u[0]||(u[0]=k(()=>{},["stop"]))},[C("span",W,I(n.content),1)],8,S)])]))),128))])}}});const ot=B(X,[["__scopeId","data-v-36eef76b"]]),Z={key:0},st=h({__name:"post-video",props:{videos:{default:()=>[]},full:{type:Boolean,default:!1}},setup(y){const l=y;return(p,u)=>{const x=V,n=A;return l.videos.length>0?(e(),r("div",Z,[s(n,{"x-gap":4,"y-gap":4,cols:p.full?1:5},{default:o(()=>[s(x,{span:p.full?1:3},{default:o(()=>[(e(!0),r(a,null,m(l.videos,v=>(e(),d(c(P),{onClick:u[0]||(u[0]=k(()=>{},["stop"])),key:v.id,src:v.content,colors:["#18a058","#2aca75"],hoverable:!0,theme:"gradient"},null,8,["src"]))),128))]),_:1},8,["span"])]),_:1},8,["cols"])])):g("",!0)}}}),q={class:"images-wrap"},rt=h({__name:"post-image",props:{imgs:{default:()=>[]}},setup(y){const l=y,p="https://paopao-assets.oss-cn-shanghai.aliyuncs.com/public/404.png",u="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,png";return(x,n)=>{const v=M,_=V,f=A,w=z;return e(),r("div",q,[[1].includes(l.imgs.length)?(e(),d(w,{key:0},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:2},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,t=>(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[0]||(n[0]=k(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[2,3].includes(l.imgs.length)?(e(),d(w,{key:1},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,t=>(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[1]||(n[1]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[4].includes(l.imgs.length)?(e(),d(w,{key:2},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:4},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,t=>(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[2]||(n[2]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[5].includes(l.imgs.length)?(e(),d(w,{key:3},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i<3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[3]||(n[3]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:2,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i>=3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[4]||(n[4]=k(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1})]),_:1})):g("",!0),[6].includes(l.imgs.length)?(e(),d(w,{key:4},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i<3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[5]||(n[5]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,{key:t.id},[i>=3?(e(),d(_,{key:0},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[6]||(n[6]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1})]),_:1})):g("",!0),l.imgs.length===7?(e(),d(w,{key:5},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:4},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i<4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[7]||(n[7]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[8]||(n[8]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0),l.imgs.length===8?(e(),d(w,{key:6},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:4},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i<4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[9]||(n[9]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:4,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=4?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[10]||(n[10]=k(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0),l.imgs.length===9?(e(),d(w,{key:7},{default:o(()=>[s(f,{"x-gap":4,"y-gap":4,cols:3},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i<3?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[11]||(n[11]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=3&&i<6?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[12]||(n[12]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),s(f,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:o(()=>[(e(!0),r(a,null,m(l.imgs,(t,i)=>(e(),r(a,null,[i>=6?(e(),d(_,{key:t.id},{default:o(()=>[s(v,{onError:()=>t.content=c(p),onClick:n[13]||(n[13]=k(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:t.content+c(u),"preview-src":t.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0)])}}});const G={class:"attachment-wrap"},H=h({__name:"post-attachment",props:{attachments:{default:()=>[]},price:{default:0}},setup(y){const l=y,p=j(!1),u=j(""),x=j(0),n=_=>{p.value=!0,x.value=_.id,u.value="这是一个免费附件,您可以直接下载?",_.type===8&&(u.value=()=>b("div",{},[b("p",{},"这是一个收费附件,下载将收取"+(l.price/100).toFixed(2)+"元")]),T({id:x.value}).then(f=>{f.paid&&(u.value=()=>b("div",{},[b("p",{},"此次下载您已支付或无需付费,请确认下载")]))}).catch(f=>{p.value=!1}))},v=()=>{U({id:x.value}).then(_=>{window.open(_.signed_url.replace("http://","https://"),"_blank")}).catch(_=>{console.log(_)})};return(_,f)=>{const w=$,t=F,i=O;return e(),r("div",G,[(e(!0),r(a,null,m(_.attachments,E=>(e(),r("div",{class:"attach-item",key:E.id},[s(t,{onClick:k(J=>n(E),["stop"]),type:"primary",size:"tiny",dashed:""},{icon:o(()=>[s(w,null,{default:o(()=>[s(c(L))]),_:1})]),default:o(()=>[D(" "+I(E.type===8?"收费":"免费")+"附件 ",1)]),_:2},1032,["onClick"])]))),128)),s(i,{show:p.value,"onUpdate:show":f[0]||(f[0]=E=>p.value=E),"mask-closable":!1,preset:"dialog",title:"下载提示",content:u.value,"positive-text":"确认下载","negative-text":"取消","icon-placement":"top",onPositiveClick:v},null,8,["show","content"])])}}});const lt=B(H,[["__scopeId","data-v-22563084"]]),ct=y=>{const l=[],p=[];var u=/(#|#)([^#@\s])+?\s+?/g,x=/@([a-zA-Z0-9])+?\s+?/g;return y=y.replace(/<[^>]*?>/gi,"").replace(/(.*?)<\/[^>]*?>/gi,"").replace(u,n=>(l.push(n.substr(1).trim()),''+n.trim()+" ")).replace(x,n=>(p.push(n.substr(1).trim()),''+n.trim()+" ")),{content:y,tags:l,users:p}};export{rt as _,lt as a,st as b,ot as c,ct as p}; diff --git a/web/dist/assets/index-8b4e1776.js b/web/dist/assets/index-08d8af97.js similarity index 52% rename from web/dist/assets/index-8b4e1776.js rename to web/dist/assets/index-08d8af97.js index 99b53324..10bff11e 100644 --- a/web/dist/assets/index-8b4e1776.js +++ b/web/dist/assets/index-08d8af97.js @@ -1 +1 @@ -import{d as z,r as R,E as J,j,o as v,Q as D,a1 as a,a as k,V as o,c as T,e as S,P as q,a2 as N,O as M,_ as h,n as Q,w as H,a3 as ae,F as X,a4 as Y,M as $,s as P,a5 as he,R as Z,L as ge,a6 as fe}from"./@vue-e0e89260.js";import{c as ve,a as we,u as le,b as ye}from"./vue-router-b8e3382f.js";import{c as ke,u as B}from"./vuex-473b3783.js";import{a as be}from"./axios-4a70c6fc.js";import{_ as Pe,N as Le,a as ue,b as ce,c as Oe,d as Ae,e as ie,f as Te,g as Re,h as de,i as Ee,j as F,k as Ce,u as Ie,l as $e,m as Se,n as Me,o as Ue,p as Ke,q as qe,r as Ne,s as De,t as xe}from"./naive-ui-62663ad7.js";import{S as Fe,M as Ve,L as ze,C as Be,B as We,P as He,W as je,a as Qe,H as ee,b as te,c as oe}from"./@vicons-d502290a.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const n of c)if(n.type==="childList")for(const m of n.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function l(c){const n={};return c.integrity&&(n.integrity=c.integrity),c.referrerPolicy&&(n.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?n.credentials="include":c.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(c){if(c.ep)return;c.ep=!0;const n=l(c);fetch(c.href,n)}})();const Ge="modulepreload",Je=function(e){return"/"+e},se={},A=function(t,l,i){if(!l||l.length===0)return t();const c=document.getElementsByTagName("link");return Promise.all(l.map(n=>{if(n=Je(n),n in se)return;se[n]=!0;const m=n.endsWith(".css"),d=m?'[rel="stylesheet"]':"";if(!!i)for(let b=c.length-1;b>=0;b--){const _=c[b];if(_.href===n&&(!m||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${d}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":Ge,m||(g.as="script",g.crossOrigin=""),g.href=n,document.head.appendChild(g),m)return new Promise((b,_)=>{g.addEventListener("load",b),g.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>t()).catch(n=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=n,window.dispatchEvent(m),!m.defaultPrevented)throw n})},Xe=[{path:"/",name:"home",meta:{title:"广场",keepAlive:!0},component:()=>A(()=>import("./Home-369fedb9.js"),["assets/Home-369fedb9.js","assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js","assets/content-c0ce69b7.js","assets/@vue-e0e89260.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-627d3fc3.js","assets/post-skeleton-f1900002.css","assets/lodash-94eb5868.js","assets/IEnum-a180d93e.js","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Home-c075a37e.css","assets/vfonts-7afd136d.css"])},{path:"/post",name:"post",meta:{title:"话题详情"},component:()=>A(()=>import("./Post-7248c732.js"),["assets/Post-7248c732.js","assets/@vue-e0e89260.js","assets/vuex-473b3783.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/IEnum-a180d93e.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/content-c0ce69b7.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vue-router-b8e3382f.js","assets/post-skeleton-627d3fc3.js","assets/post-skeleton-f1900002.css","assets/lodash-94eb5868.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/main-nav-569a7b0c.css","assets/v3-infinite-loading-e5c2e8bf.js","assets/v3-infinite-loading-1ff9ffe7.css","assets/axios-4a70c6fc.js","assets/Post-00695942.css","assets/vfonts-7afd136d.css"])},{path:"/topic",name:"topic",meta:{title:"话题"},component:()=>A(()=>import("./Topic-501554b1.js"),["assets/Topic-501554b1.js","assets/@vicons-d502290a.js","assets/@vue-e0e89260.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Topic-8dbcebb5.css","assets/vfonts-7afd136d.css"])},{path:"/anouncement",name:"anouncement",meta:{title:"公告"},component:()=>A(()=>import("./Anouncement-70463bac.js"),["assets/Anouncement-70463bac.js","assets/post-skeleton-627d3fc3.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/@vue-e0e89260.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/@vicons-d502290a.js","assets/main-nav-569a7b0c.css","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/axios-4a70c6fc.js","assets/Anouncement-662e2d95.css","assets/vfonts-7afd136d.css"])},{path:"/profile",name:"profile",meta:{title:"主页"},component:()=>A(()=>import("./Profile-67eeb9ca.js"),["assets/Profile-67eeb9ca.js","assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js","assets/content-c0ce69b7.js","assets/@vue-e0e89260.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-627d3fc3.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Profile-24e6724a.css","assets/vfonts-7afd136d.css"])},{path:"/user",name:"user",meta:{title:"用户详情"},component:()=>A(()=>import("./User-01d95431.js"),["assets/User-01d95431.js","assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js","assets/content-c0ce69b7.js","assets/@vue-e0e89260.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-627d3fc3.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/User-3e4ab8ff.css","assets/vfonts-7afd136d.css"])},{path:"/messages",name:"messages",meta:{title:"消息"},component:()=>A(()=>import("./Messages-5c7f33a8.js"),["assets/Messages-5c7f33a8.js","assets/@vue-e0e89260.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Messages-7ed31ecd.css","assets/vfonts-7afd136d.css"])},{path:"/collection",name:"collection",meta:{title:"收藏"},component:()=>A(()=>import("./Collection-c6d4e201.js"),["assets/Collection-c6d4e201.js","assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js","assets/content-c0ce69b7.js","assets/@vue-e0e89260.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-627d3fc3.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Collection-b97b3cf7.css","assets/vfonts-7afd136d.css"])},{path:"/contacts",name:"contacts",meta:{title:"好友"},component:()=>A(()=>import("./Contacts-89899ea7.js"),["assets/Contacts-89899ea7.js","assets/vue-router-b8e3382f.js","assets/@vue-e0e89260.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/post-skeleton-627d3fc3.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/@vicons-d502290a.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Contacts-b60e5e0d.css","assets/vfonts-7afd136d.css"])},{path:"/wallet",name:"wallet",meta:{title:"钱包"},component:()=>A(()=>import("./Wallet-4af86e57.js"),["assets/Wallet-4af86e57.js","assets/post-skeleton-627d3fc3.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/@vue-e0e89260.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/@vicons-d502290a.js","assets/main-nav-569a7b0c.css","assets/qrcode-9719fc56.js","assets/encode-utf8-f813de00.js","assets/dijkstrajs-f906a09e.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/axios-4a70c6fc.js","assets/Wallet-77044929.css","assets/vfonts-7afd136d.css"])},{path:"/setting",name:"setting",meta:{title:"设置"},component:()=>A(()=>import("./Setting-062eeb8c.js"),["assets/Setting-062eeb8c.js","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/@vue-e0e89260.js","assets/vue-router-b8e3382f.js","assets/vooks-a50491fd.js","assets/evtd-b614532e.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/@css-render-580d83ec.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Setting-bfd24152.css","assets/vfonts-7afd136d.css"])},{path:"/404",name:"404",meta:{title:"404"},component:()=>A(()=>import("./404-a99d6dcf.js"),["assets/404-a99d6dcf.js","assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js","assets/vuex-473b3783.js","assets/@vue-e0e89260.js","assets/vue-router-b8e3382f.js","assets/vooks-a50491fd.js","assets/evtd-b614532e.js","assets/@vicons-d502290a.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/@css-render-580d83ec.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/404-020b2afd.css","assets/vfonts-7afd136d.css"])},{path:"/:pathMatch(.*)",redirect:"/404"}],pe=ve({history:we(),routes:Xe});pe.beforeEach((e,t,l)=>{document.title=`${e.meta.title} | 泡泡 - 一个清新文艺的微社区`,l()});const Ye=ke({state:{refresh:Date.now(),refreshTopicFollow:Date.now(),theme:localStorage.getItem("PAOPAO_THEME"),collapsedLeft:document.body.clientWidth<=821,collapsedRight:document.body.clientWidth<=821,drawerModelShow:document.body.clientWidth<=821,desktopModelShow:document.body.clientWidth>821,authModalShow:!1,authModelTab:"signin",userLogined:!1,userInfo:{id:0,username:"",nickname:""}},mutations:{refresh(e,t){e.refresh=t||Date.now()},refreshTopicFollow(e){e.refreshTopicFollow=Date.now()},triggerTheme(e,t){e.theme=t},triggerAuth(e,t){e.authModalShow=t},triggerAuthKey(e,t){e.authModelTab=t},triggerCollapsedLeft(e,t){e.collapsedLeft=t,e.drawerModelShow=t,e.desktopModelShow=!t},triggerCollapsedRight(e,t){e.collapsedRight=t},updateUserinfo(e,t){e.userInfo=t,e.userInfo.id>0&&(e.userLogined=!0)},userLogout(e){localStorage.removeItem("PAOPAO_TOKEN"),e.userInfo={id:0,nickname:"",username:""},e.userLogined=!1}},actions:{},modules:{}}),G=be.create({baseURL:"",timeout:3e4});G.interceptors.request.use(e=>(localStorage.getItem("PAOPAO_TOKEN")&&(e.headers.Authorization="Bearer "+localStorage.getItem("PAOPAO_TOKEN")),e),e=>Promise.reject(e));G.interceptors.response.use(e=>{const{data:t={},code:l=0}=(e==null?void 0:e.data)||{};if(+l==0)return t||{};Promise.reject((e==null?void 0:e.data)||{})},(e={})=>{var l;const{response:t={}}=e||{};return+(t==null?void 0:t.status)==401?(localStorage.removeItem("PAOPAO_TOKEN"),(t==null?void 0:t.data.code)!==10005?window.$message.warning((t==null?void 0:t.data.msg)||"鉴权失败"):window.$store.commit("triggerAuth",!0)):window.$message.error(((l=t==null?void 0:t.data)==null?void 0:l.msg)||"请求失败"),Promise.reject((t==null?void 0:t.data)||{})});function s(e){return G(e)}const ne=e=>s({method:"post",url:"/v1/auth/login",data:e}),Ze=e=>s({method:"post",url:"/v1/auth/register",data:e}),W=(e="")=>s({method:"get",url:"/v1/user/info",headers:{Authorization:`Bearer ${e}`}}),et={class:"auth-wrap"},tt={key:0},ot=z({__name:"auth",setup(e){const t=R("true".toLowerCase()==="true"),l=B(),i=R(!1),c=R(),n=J({username:"",password:""}),m=R(),d=J({username:"",password:"",repassword:""}),U={username:{required:!0,message:"请输入账户名"},password:{required:!0,message:"请输入密码"},repassword:[{required:!0,message:"请输入密码"},{validator:(_,u)=>!!d.password&&d.password.startsWith(u)&&d.password.length>=u.length,message:"两次密码输入不一致",trigger:"input"}]},g=_=>{var u;_.preventDefault(),_.stopPropagation(),(u=c.value)==null||u.validate(L=>{L||(i.value=!0,ne({username:n.username,password:n.password}).then(p=>{const O=(p==null?void 0:p.token)||"";return localStorage.setItem("PAOPAO_TOKEN",O),W(O)}).then(p=>{window.$message.success("登录成功"),i.value=!1,l.commit("updateUserinfo",p),l.commit("triggerAuth",!1),l.commit("refresh"),n.username="",n.password=""}).catch(p=>{i.value=!1}))})},b=_=>{var u;_.preventDefault(),_.stopPropagation(),(u=m.value)==null||u.validate(L=>{L||(i.value=!0,Ze({username:d.username,password:d.password}).then(p=>ne({username:d.username,password:d.password})).then(p=>{const O=(p==null?void 0:p.token)||"";return localStorage.setItem("PAOPAO_TOKEN",O),W(O)}).then(p=>{window.$message.success("注册成功"),i.value=!1,l.commit("updateUserinfo",p),l.commit("triggerAuth",!1),d.username="",d.password="",d.repassword=""}).catch(p=>{i.value=!1}))})};return j(()=>{const _=localStorage.getItem("PAOPAO_TOKEN")||"";_?W(_).then(u=>{l.commit("updateUserinfo",u),l.commit("triggerAuth",!1)}).catch(u=>{l.commit("userLogout")}):l.commit("userLogout")}),(_,u)=>{const L=Pe,p=Le,O=ue,r=ce,w=Oe,y=Ae,C=ie,x=Te,I=Re,K=de,V=Ee;return v(),D(V,{show:h(l).state.authModalShow,"onUpdate:show":u[7]||(u[7]=f=>h(l).state.authModalShow=f),class:"auth-card",preset:"card",size:"small","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:a(()=>[k("div",et,[o(K,{bordered:!1},{default:a(()=>[t.value?M("",!0):(v(),T("div",tt,[o(O,{justify:"center"},{default:a(()=>[o(p,null,{default:a(()=>[o(L,{type:"success"},{default:a(()=>[S("账号登录")]),_:1})]),_:1})]),_:1}),o(y,{ref_key:"loginRef",ref:c,model:n,rules:{username:{required:!0,message:"请输入账户名"},password:{required:!0,message:"请输入密码"}}},{default:a(()=>[o(w,{label:"账户",path:"username"},{default:a(()=>[o(r,{value:n.username,"onUpdate:value":u[0]||(u[0]=f=>n.username=f),placeholder:"请输入用户名",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),o(w,{label:"密码",path:"password"},{default:a(()=>[o(r,{type:"password","show-password-on":"mousedown",value:n.password,"onUpdate:value":u[1]||(u[1]=f=>n.password=f),placeholder:"请输入账户密码",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),o(C,{type:"primary",block:"",secondary:"",strong:"",loading:i.value,onClick:g},{default:a(()=>[S(" 登录 ")]),_:1},8,["loading"])])),t.value?(v(),D(I,{key:1,"default-value":h(l).state.authModelTab,size:"large","justify-content":"space-evenly"},{default:a(()=>[o(x,{name:"signin",tab:"登录"},{default:a(()=>[o(y,{ref_key:"loginRef",ref:c,model:n,rules:{username:{required:!0,message:"请输入账户名"},password:{required:!0,message:"请输入密码"}}},{default:a(()=>[o(w,{label:"账户",path:"username"},{default:a(()=>[o(r,{value:n.username,"onUpdate:value":u[2]||(u[2]=f=>n.username=f),placeholder:"请输入用户名",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),o(w,{label:"密码",path:"password"},{default:a(()=>[o(r,{type:"password","show-password-on":"mousedown",value:n.password,"onUpdate:value":u[3]||(u[3]=f=>n.password=f),placeholder:"请输入账户密码",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),o(C,{type:"primary",block:"",secondary:"",strong:"",loading:i.value,onClick:g},{default:a(()=>[S(" 登录 ")]),_:1},8,["loading"])]),_:1}),o(x,{name:"signup",tab:"注册"},{default:a(()=>[o(y,{ref_key:"registerRef",ref:m,model:d,rules:U},{default:a(()=>[o(w,{label:"用户名",path:"username"},{default:a(()=>[o(r,{value:d.username,"onUpdate:value":u[4]||(u[4]=f=>d.username=f),placeholder:"用户名注册后无法修改"},null,8,["value"])]),_:1}),o(w,{label:"密码",path:"password"},{default:a(()=>[o(r,{type:"password","show-password-on":"mousedown",placeholder:"密码不少于6位",value:d.password,"onUpdate:value":u[5]||(u[5]=f=>d.password=f),onKeyup:q(N(b,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),o(w,{label:"重复密码",path:"repassword"},{default:a(()=>[o(r,{type:"password","show-password-on":"mousedown",placeholder:"请再次输入密码",value:d.repassword,"onUpdate:value":u[6]||(u[6]=f=>d.repassword=f),onKeyup:q(N(b,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),o(C,{type:"primary",block:"",secondary:"",strong:"",loading:i.value,onClick:b},{default:a(()=>[S(" 注册 ")]),_:1},8,["loading"])]),_:1})]),_:1},8,["default-value"])):M("",!0)]),_:1})])]),_:1},8,["show"])}}});const me=(e,t)=>{const l=e.__vccOpts||e;for(const[i,c]of t)l[i]=c;return l},st=me(ot,[["__scopeId","data-v-053dfa44"]]),Xt=e=>s({method:"get",url:"/v1/posts",params:e}),nt=e=>s({method:"get",url:"/v1/tags",params:e}),Yt=e=>s({method:"get",url:"/v1/post",params:e}),Zt=e=>s({method:"get",url:"/v1/post/star",params:e}),eo=e=>s({method:"post",url:"/v1/post/star",data:e}),to=e=>s({method:"get",url:"/v1/post/collection",params:e}),oo=e=>s({method:"post",url:"/v1/post/collection",data:e}),so=e=>s({method:"get",url:"/v1/post/comments",params:e}),no=e=>s({method:"get",url:"/v1/user/contacts",params:e}),ro=e=>s({method:"post",url:"/v1/post",data:e}),ao=e=>s({method:"delete",url:"/v1/post",data:e}),lo=e=>s({method:"post",url:"/v1/post/lock",data:e}),uo=e=>s({method:"post",url:"/v1/post/stick",data:e}),co=e=>s({method:"post",url:"/v1/post/visibility",data:e}),io=e=>s({method:"post",url:"/v1/tweet/comment/thumbsup",data:e}),po=e=>s({method:"post",url:"/v1/tweet/comment/thumbsdown",data:e}),mo=e=>s({method:"post",url:"/v1/tweet/reply/thumbsup",data:e}),_o=e=>s({method:"post",url:"/v1/tweet/reply/thumbsdown",data:e}),ho=e=>s({method:"post",url:"/v1/post/comment",data:e}),go=e=>s({method:"delete",url:"/v1/post/comment",data:e}),fo=e=>s({method:"post",url:"/v1/post/comment/reply",data:e}),vo=e=>s({method:"delete",url:"/v1/post/comment/reply",data:e}),wo=e=>s({method:"post",url:"/v1/topic/stick",data:e}),yo=e=>s({method:"post",url:"/v1/topic/follow",data:e}),ko=e=>s({method:"post",url:"/v1/topic/unfollow",data:e}),rt={key:0,class:"rightbar-wrap"},at={class:"search-wrap"},lt={class:"post-num"},ut={class:"post-num"},ct={class:"copyright"},it=["href"],dt=["href"],pt=z({__name:"rightbar",setup(e){const t=R([]),l=R([]),i=R(!1),c=R(""),n=B(),m=le(),d="2023 paopao.info",U="Roc's Me",g="",b="泡泡(PaoPao)开源社区",_="https://www.paopao.info",u=+"6",L=+"12",p=()=>{i.value=!0,nt({type:"hot_extral",num:L,extral_num:u}).then(y=>{t.value=y.topics,l.value=y.extral_topics??[],w.value=!0,i.value=!1}).catch(y=>{i.value=!1})},O=y=>y>=1e3?(y/1e3).toFixed(1)+"k":y,r=()=>{m.push({name:"home",query:{q:c.value}})},w=Q({get:()=>n.state.userLogined&&l.value.length!==0,set:y=>{}});return H(()=>({refreshTopicFollow:n.state.refreshTopicFollow,userLogined:n.state.userLogined}),(y,C)=>{(y.refreshTopicFollow!==C.refreshTopicFollow||y.userLogined)&&p()}),j(()=>{p()}),(y,C)=>{const x=F,I=ce,K=ae("router-link"),V=Ce,f=de,_e=ue;return h(n).state.collapsedRight?M("",!0):(v(),T("div",rt,[k("div",at,[o(I,{round:"",clearable:"",placeholder:"搜一搜...",value:c.value,"onUpdate:value":C[0]||(C[0]=E=>c.value=E),onKeyup:q(N(r,["prevent"]),["enter"])},{prefix:a(()=>[o(x,{component:h(Fe)},null,8,["component"])]),_:1},8,["value","onKeyup"])]),w.value?(v(),D(f,{key:0,class:"hottopic-wrap",title:"关注话题",embedded:"",bordered:!1,size:"small"},{default:a(()=>[o(V,{show:i.value},{default:a(()=>[(v(!0),T(X,null,Y(l.value,E=>(v(),T("div",{class:"hot-tag-item",key:E.id},[o(K,{class:"hash-link",to:{name:"home",query:{q:E.tag,t:"tag"}}},{default:a(()=>[S(" #"+$(E.tag),1)]),_:2},1032,["to"]),k("div",lt,$(O(E.quote_num)),1)]))),128))]),_:1},8,["show"])]),_:1})):M("",!0),o(f,{class:"hottopic-wrap",title:"热门话题",embedded:"",bordered:!1,size:"small"},{default:a(()=>[o(V,{show:i.value},{default:a(()=>[(v(!0),T(X,null,Y(t.value,E=>(v(),T("div",{class:"hot-tag-item",key:E.id},[o(K,{class:"hash-link",to:{name:"home",query:{q:E.tag,t:"tag"}}},{default:a(()=>[S(" #"+$(E.tag),1)]),_:2},1032,["to"]),k("div",ut,$(O(E.quote_num)),1)]))),128))]),_:1},8,["show"])]),_:1}),o(f,{class:"copyright-wrap",embedded:"",bordered:!1,size:"small"},{default:a(()=>[k("div",ct,"© "+$(h(d)),1),k("div",null,[o(_e,null,{default:a(()=>[k("a",{href:h(g),target:"_blank",class:"hash-link"},$(h(U)),9,it),k("a",{href:h(_),target:"_blank",class:"hash-link"},$(h(b)),9,dt)]),_:1})])]),_:1})]))}}});const mt=me(pt,[["__scopeId","data-v-f4a84024"]]),bo=(e={})=>s({method:"get",url:"/v1/captcha",params:e}),Po=e=>s({method:"post",url:"/v1/captcha",data:e}),Lo=e=>s({method:"post",url:"/v1/user/whisper",data:e}),Oo=e=>s({method:"post",url:"/v1/friend/requesting",data:e}),Ao=e=>s({method:"post",url:"/v1/friend/add",data:e}),To=e=>s({method:"post",url:"/v1/friend/reject",data:e}),Ro=e=>s({method:"post",url:"/v1/friend/delete",data:e}),Eo=e=>s({method:"post",url:"/v1/user/phone",data:e}),Co=e=>s({method:"post",url:"/v1/user/activate",data:e}),Io=e=>s({method:"post",url:"/v1/user/password",data:e}),$o=e=>s({method:"post",url:"/v1/user/nickname",data:e}),So=e=>s({method:"post",url:"/v1/user/avatar",data:e}),re=(e={})=>s({method:"get",url:"/v1/user/msgcount/unread",params:e}),Mo=e=>s({method:"get",url:"/v1/user/messages",params:e}),Uo=e=>s({method:"post",url:"/v1/user/message/read",data:e}),Ko=e=>s({method:"get",url:"/v1/user/collections",params:e}),qo=e=>s({method:"get",url:"/v1/user/profile",params:e}),No=e=>s({method:"get",url:"/v1/user/posts",params:e}),Do=e=>s({method:"get",url:"/v1/user/wallet/bills",params:e}),xo=e=>s({method:"post",url:"/v1/user/recharge",data:e}),Fo=e=>s({method:"get",url:"/v1/user/recharge",params:e}),Vo=e=>s({method:"get",url:"/v1/suggest/users",params:e}),zo=e=>s({method:"get",url:"/v1/suggest/tags",params:e}),Bo=e=>s({method:"get",url:"/v1/attachment/precheck",params:e}),Wo=e=>s({method:"get",url:"/v1/attachment",params:e}),Ho=e=>s({method:"post",url:"/v1/admin/user/status",data:e}),_t="/assets/logo-52afee68.png",ht={class:"sidebar-wrap"},gt={class:"logo-wrap"},ft={key:0,class:"user-wrap"},vt={class:"user-info"},wt={class:"nickname"},yt={class:"nickname-txt"},kt={class:"username"},bt={class:"user-mini-wrap"},Pt={key:1,class:"user-wrap"},Lt={key:0,class:"login-only-wrap"},Ot={key:1,class:"login-wrap"},At=z({__name:"sidebar",setup(e){const t=B(),l=ye(),i=le(),c=R(!1),n=R(l.name||""),m=R(),d=R("true".toLowerCase()==="true"),U=+"5000";H(l,()=>{n.value=l.name}),H(t.state,()=>{t.state.userInfo.id>0?m.value||(re().then(r=>{c.value=r.count>0}).catch(r=>{console.log(r)}),m.value=setInterval(()=>{re().then(r=>{c.value=r.count>0}).catch(r=>{console.log(r)})},U)):m.value&&clearInterval(m.value)}),j(()=>{window.onresize=()=>{t.commit("triggerCollapsedLeft",document.body.clientWidth<=821),t.commit("triggerCollapsedRight",document.body.clientWidth<=821)}});const g=Q(()=>{const r=[{label:"广场",key:"home",icon:()=>P(ee),href:"/"},{label:"话题",key:"topic",icon:()=>P(te),href:"/topic"}];return"false".toLowerCase()==="true"&&r.push({label:"公告",key:"anouncement",icon:()=>P(Ve),href:"/anouncement"}),r.push({label:"主页",key:"profile",icon:()=>P(ze),href:"/profile"}),r.push({label:"消息",key:"messages",icon:()=>P(Be),href:"/messages"}),r.push({label:"收藏",key:"collection",icon:()=>P(We),href:"/collection"}),r.push({label:"好友",key:"contacts",icon:()=>P(He),href:"/contacts"}),"false".toLocaleLowerCase()==="true"&&r.push({label:"钱包",key:"wallet",icon:()=>P(je),href:"/wallet"}),r.push({label:"设置",key:"setting",icon:()=>P(Qe),href:"/setting"}),t.state.userInfo.id>0?r:[{label:"广场",key:"home",icon:()=>P(ee),href:"/"},{label:"话题",key:"topic",icon:()=>P(te),href:"/topic"}]}),b=r=>"href"in r?P("div",{},r.label):r.label,_=r=>r.key==="messages"?P($e,{dot:!0,show:c.value,processing:!0},{default:()=>P(F,{color:r.key===n.value?"var(--n-item-icon-color-active)":"var(--n-item-icon-color)"},{default:r.icon})}):P(F,null,{default:r.icon}),u=(r,w={})=>{n.value=r,i.push({name:r})},L=()=>{l.path==="/"&&t.commit("refresh"),u("home")},p=r=>{t.commit("triggerAuth",!0),t.commit("triggerAuthKey",r)},O=()=>{t.commit("userLogout"),t.commit("refresh"),L()};return window.$store=t,window.$message=Ie(),(r,w)=>{const y=Se,C=Me,x=Ue,I=ie;return v(),T("div",ht,[k("div",gt,[o(y,{class:"logo-img",width:"36",src:h(_t),"preview-disabled":!0,onClick:L},null,8,["src"])]),o(C,{accordion:!0,"icon-size":24,options:g.value,"render-label":b,"render-icon":_,value:n.value,"onUpdate:value":u},null,8,["options","value"]),h(t).state.userInfo.id>0?(v(),T("div",ft,[o(x,{class:"user-avatar",round:"",size:34,src:h(t).state.userInfo.avatar},null,8,["src"]),k("div",vt,[k("div",wt,[k("span",yt,$(h(t).state.userInfo.nickname),1),o(I,{class:"logout",quaternary:"",circle:"",size:"tiny",onClick:O},{icon:a(()=>[o(h(F),null,{default:a(()=>[o(h(oe))]),_:1})]),_:1})]),k("div",kt,"@"+$(h(t).state.userInfo.username),1)]),k("div",bt,[o(I,{class:"logout",quaternary:"",circle:"",onClick:O},{icon:a(()=>[o(h(F),{size:24},{default:a(()=>[o(h(oe))]),_:1})]),_:1})])])):(v(),T("div",Pt,[d.value?M("",!0):(v(),T("div",Lt,[o(I,{strong:"",secondary:"",round:"",type:"primary",onClick:w[0]||(w[0]=K=>p("signin"))},{default:a(()=>[S(" 登录 ")]),_:1})])),d.value?(v(),T("div",Ot,[o(I,{strong:"",secondary:"",round:"",type:"primary",onClick:w[1]||(w[1]=K=>p("signin"))},{default:a(()=>[S(" 登录 ")]),_:1}),o(I,{strong:"",secondary:"",round:"",type:"info",onClick:w[2]||(w[2]=K=>p("signup"))},{default:a(()=>[S(" 注册 ")]),_:1})])):M("",!0)]))])}}});const Tt={"has-sider":"",class:"main-wrap",position:"static"},Rt={key:0},Et={class:"content-wrap"},Ct=z({__name:"App",setup(e){const t=B(),l=Q(()=>t.state.theme==="dark"?qe:null);return(i,c)=>{const n=At,m=ae("router-view"),d=mt,U=st,g=Ne,b=De,_=xe,u=Ke;return v(),D(u,{theme:l.value},{default:a(()=>[o(b,null,{default:a(()=>[o(g,null,{default:a(()=>{var L;return[k("div",{class:ge(["app-container",{dark:((L=l.value)==null?void 0:L.name)==="dark",mobile:!h(t).state.desktopModelShow}])},[k("div",Tt,[h(t).state.desktopModelShow?(v(),T("div",Rt,[o(n)])):M("",!0),k("div",Et,[o(m,{class:"app-wrap"},{default:a(({Component:p})=>[(v(),D(he,null,[i.$route.meta.keepAlive?(v(),D(Z(p),{key:0})):M("",!0)],1024)),i.$route.meta.keepAlive?M("",!0):(v(),D(Z(p),{key:0}))]),_:1})]),o(d)]),o(U)],2)]}),_:1})]),_:1}),o(_)]),_:1},8,["theme"])}}});fe(Ct).use(pe).use(Ye).mount("#app");export{No as A,Lo as B,Oo as C,qo as D,Ro as E,Ho as F,Ao as G,To as H,Uo as I,Mo as J,Ko as K,Bo as L,Wo as M,no as N,W as O,Do as P,xo as Q,Fo as R,bo as S,So as T,Io as U,Eo as V,Co as W,$o as X,Po as Y,At as Z,me as _,zo as a,Xt as b,ro as c,_o as d,vo as e,io as f,Vo as g,po as h,fo as i,go as j,ho as k,Zt as l,to as m,ao as n,lo as o,eo as p,oo as q,Yt as r,uo as s,mo as t,so as u,co as v,wo as w,ko as x,yo as y,nt as z}; +import{d as z,r as R,E as J,j,o as v,Q as D,a1 as a,a as k,V as s,c as T,e as S,P as q,a2 as N,O as M,_ as h,n as Q,w as H,a3 as ae,F as X,a4 as Y,M as I,s as P,a5 as he,R as Z,L as ge,a6 as fe}from"./@vue-e0e89260.js";import{c as ve,a as we,u as le,b as ye}from"./vue-router-b8e3382f.js";import{c as ke,u as B}from"./vuex-473b3783.js";import{a as be}from"./axios-4a70c6fc.js";import{_ as Pe,N as Le,a as ue,b as ce,c as Oe,d as Ae,e as ie,f as Te,g as Re,h as de,i as Ee,j as F,k as Ce,u as $e,l as Ie,m as Se,n as Me,o as Ue,p as Ke,q as qe,r as Ne,s as De,t as xe}from"./naive-ui-62663ad7.js";import{S as Fe,M as Ve,L as ze,C as Be,B as We,P as He,W as je,a as Qe,H as ee,b as te,c as oe}from"./@vicons-6332ad63.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const n of c)if(n.type==="childList")for(const m of n.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function l(c){const n={};return c.integrity&&(n.integrity=c.integrity),c.referrerPolicy&&(n.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?n.credentials="include":c.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(c){if(c.ep)return;c.ep=!0;const n=l(c);fetch(c.href,n)}})();const Ge="modulepreload",Je=function(e){return"/"+e},se={},A=function(t,l,i){if(!l||l.length===0)return t();const c=document.getElementsByTagName("link");return Promise.all(l.map(n=>{if(n=Je(n),n in se)return;se[n]=!0;const m=n.endsWith(".css"),d=m?'[rel="stylesheet"]':"";if(!!i)for(let b=c.length-1;b>=0;b--){const _=c[b];if(_.href===n&&(!m||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${d}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":Ge,m||(g.as="script",g.crossOrigin=""),g.href=n,document.head.appendChild(g),m)return new Promise((b,_)=>{g.addEventListener("load",b),g.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>t()).catch(n=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=n,window.dispatchEvent(m),!m.defaultPrevented)throw n})},Xe=[{path:"/",name:"home",meta:{title:"广场",keepAlive:!0},component:()=>A(()=>import("./Home-ab2e462e.js"),["assets/Home-ab2e462e.js","assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js","assets/content-91ba374b.js","assets/@vue-e0e89260.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-41befd31.js","assets/post-skeleton-f1900002.css","assets/lodash-94eb5868.js","assets/IEnum-a180d93e.js","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Home-c075a37e.css","assets/vfonts-7afd136d.css"])},{path:"/post",name:"post",meta:{title:"话题详情"},component:()=>A(()=>import("./Post-45820327.js"),["assets/Post-45820327.js","assets/@vue-e0e89260.js","assets/vuex-473b3783.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/IEnum-a180d93e.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/content-91ba374b.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vue-router-b8e3382f.js","assets/post-skeleton-41befd31.js","assets/post-skeleton-f1900002.css","assets/lodash-94eb5868.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/main-nav-569a7b0c.css","assets/v3-infinite-loading-e5c2e8bf.js","assets/v3-infinite-loading-1ff9ffe7.css","assets/axios-4a70c6fc.js","assets/Post-00695942.css","assets/vfonts-7afd136d.css"])},{path:"/topic",name:"topic",meta:{title:"话题"},component:()=>A(()=>import("./Topic-e935df69.js"),["assets/Topic-e935df69.js","assets/@vicons-6332ad63.js","assets/@vue-e0e89260.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Topic-8dbcebb5.css","assets/vfonts-7afd136d.css"])},{path:"/anouncement",name:"anouncement",meta:{title:"公告"},component:()=>A(()=>import("./Anouncement-f0afd211.js"),["assets/Anouncement-f0afd211.js","assets/post-skeleton-41befd31.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/@vue-e0e89260.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/@vicons-6332ad63.js","assets/main-nav-569a7b0c.css","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/axios-4a70c6fc.js","assets/Anouncement-662e2d95.css","assets/vfonts-7afd136d.css"])},{path:"/profile",name:"profile",meta:{title:"主页"},component:()=>A(()=>import("./Profile-3af47c12.js"),["assets/Profile-3af47c12.js","assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js","assets/content-91ba374b.js","assets/@vue-e0e89260.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-41befd31.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Profile-cc270bed.css","assets/vfonts-7afd136d.css"])},{path:"/user",name:"user",meta:{title:"用户详情"},component:()=>A(()=>import("./User-fd7a65dc.js"),["assets/User-fd7a65dc.js","assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js","assets/content-91ba374b.js","assets/@vue-e0e89260.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-41befd31.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/User-a79da2ba.css","assets/vfonts-7afd136d.css"])},{path:"/messages",name:"messages",meta:{title:"消息"},component:()=>A(()=>import("./Messages-c1d4e5e6.js"),["assets/Messages-c1d4e5e6.js","assets/@vue-e0e89260.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Messages-7ed31ecd.css","assets/vfonts-7afd136d.css"])},{path:"/collection",name:"collection",meta:{title:"收藏"},component:()=>A(()=>import("./Collection-d33c7999.js"),["assets/Collection-d33c7999.js","assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js","assets/content-91ba374b.js","assets/@vue-e0e89260.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/paopao-video-player-aa5e8b3f.js","assets/content-2fda112b.css","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/copy-to-clipboard-1dd3075d.js","assets/toggle-selection-93f4ad84.js","assets/post-item-593ff254.css","assets/post-skeleton-41befd31.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Collection-b97b3cf7.css","assets/vfonts-7afd136d.css"])},{path:"/contacts",name:"contacts",meta:{title:"好友"},component:()=>A(()=>import("./Contacts-86a6f430.js"),["assets/Contacts-86a6f430.js","assets/vue-router-b8e3382f.js","assets/@vue-e0e89260.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/post-skeleton-41befd31.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/@vicons-6332ad63.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Contacts-b60e5e0d.css","assets/vfonts-7afd136d.css"])},{path:"/wallet",name:"wallet",meta:{title:"钱包"},component:()=>A(()=>import("./Wallet-a970081d.js"),["assets/Wallet-a970081d.js","assets/post-skeleton-41befd31.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/@vue-e0e89260.js","assets/vueuc-59ca65c3.js","assets/evtd-b614532e.js","assets/@css-render-580d83ec.js","assets/vooks-a50491fd.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/post-skeleton-f1900002.css","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/vue-router-b8e3382f.js","assets/@vicons-6332ad63.js","assets/main-nav-569a7b0c.css","assets/qrcode-9719fc56.js","assets/encode-utf8-f813de00.js","assets/dijkstrajs-f906a09e.js","assets/formatTime-cdf4e6f1.js","assets/moment-2ab8298d.js","assets/axios-4a70c6fc.js","assets/Wallet-77044929.css","assets/vfonts-7afd136d.css"])},{path:"/setting",name:"setting",meta:{title:"设置"},component:()=>A(()=>import("./Setting-c94ce292.js"),["assets/Setting-c94ce292.js","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/@vue-e0e89260.js","assets/vue-router-b8e3382f.js","assets/vooks-a50491fd.js","assets/evtd-b614532e.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/@css-render-580d83ec.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/Setting-bfd24152.css","assets/vfonts-7afd136d.css"])},{path:"/404",name:"404",meta:{title:"404"},component:()=>A(()=>import("./404-b795bf4e.js"),["assets/404-b795bf4e.js","assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js","assets/vuex-473b3783.js","assets/@vue-e0e89260.js","assets/vue-router-b8e3382f.js","assets/vooks-a50491fd.js","assets/evtd-b614532e.js","assets/@vicons-6332ad63.js","assets/naive-ui-62663ad7.js","assets/seemly-76b7b838.js","assets/vueuc-59ca65c3.js","assets/@css-render-580d83ec.js","assets/vdirs-b0483831.js","assets/@juggle-41516555.js","assets/css-render-6a5c5852.js","assets/@emotion-8a8e73f6.js","assets/lodash-es-8412e618.js","assets/treemate-25c27bff.js","assets/async-validator-dee29e8b.js","assets/date-fns-975a2d8f.js","assets/main-nav-569a7b0c.css","assets/axios-4a70c6fc.js","assets/404-020b2afd.css","assets/vfonts-7afd136d.css"])},{path:"/:pathMatch(.*)",redirect:"/404"}],pe=ve({history:we(),routes:Xe});pe.beforeEach((e,t,l)=>{document.title=`${e.meta.title} | 泡泡 - 一个清新文艺的微社区`,l()});const Ye=ke({state:{refresh:Date.now(),refreshTopicFollow:Date.now(),theme:localStorage.getItem("PAOPAO_THEME"),collapsedLeft:document.body.clientWidth<=821,collapsedRight:document.body.clientWidth<=821,drawerModelShow:document.body.clientWidth<=821,desktopModelShow:document.body.clientWidth>821,authModalShow:!1,authModelTab:"signin",userLogined:!1,userInfo:{id:0,username:"",nickname:""}},mutations:{refresh(e,t){e.refresh=t||Date.now()},refreshTopicFollow(e){e.refreshTopicFollow=Date.now()},triggerTheme(e,t){e.theme=t},triggerAuth(e,t){e.authModalShow=t},triggerAuthKey(e,t){e.authModelTab=t},triggerCollapsedLeft(e,t){e.collapsedLeft=t,e.drawerModelShow=t,e.desktopModelShow=!t},triggerCollapsedRight(e,t){e.collapsedRight=t},updateUserinfo(e,t){e.userInfo=t,e.userInfo.id>0&&(e.userLogined=!0)},userLogout(e){localStorage.removeItem("PAOPAO_TOKEN"),e.userInfo={id:0,nickname:"",username:""},e.userLogined=!1}},actions:{},modules:{}}),G=be.create({baseURL:"",timeout:3e4});G.interceptors.request.use(e=>(localStorage.getItem("PAOPAO_TOKEN")&&(e.headers.Authorization="Bearer "+localStorage.getItem("PAOPAO_TOKEN")),e),e=>Promise.reject(e));G.interceptors.response.use(e=>{const{data:t={},code:l=0}=(e==null?void 0:e.data)||{};if(+l==0)return t||{};Promise.reject((e==null?void 0:e.data)||{})},(e={})=>{var l;const{response:t={}}=e||{};return+(t==null?void 0:t.status)==401?(localStorage.removeItem("PAOPAO_TOKEN"),(t==null?void 0:t.data.code)!==10005?window.$message.warning((t==null?void 0:t.data.msg)||"鉴权失败"):window.$store.commit("triggerAuth",!0)):window.$message.error(((l=t==null?void 0:t.data)==null?void 0:l.msg)||"请求失败"),Promise.reject((t==null?void 0:t.data)||{})});function o(e){return G(e)}const ne=e=>o({method:"post",url:"/v1/auth/login",data:e}),Ze=e=>o({method:"post",url:"/v1/auth/register",data:e}),W=(e="")=>o({method:"get",url:"/v1/user/info",headers:{Authorization:`Bearer ${e}`}}),et={class:"auth-wrap"},tt={key:0},ot=z({__name:"auth",setup(e){const t=R("true".toLowerCase()==="true"),l=B(),i=R(!1),c=R(),n=J({username:"",password:""}),m=R(),d=J({username:"",password:"",repassword:""}),U={username:{required:!0,message:"请输入账户名"},password:{required:!0,message:"请输入密码"},repassword:[{required:!0,message:"请输入密码"},{validator:(_,u)=>!!d.password&&d.password.startsWith(u)&&d.password.length>=u.length,message:"两次密码输入不一致",trigger:"input"}]},g=_=>{var u;_.preventDefault(),_.stopPropagation(),(u=c.value)==null||u.validate(L=>{L||(i.value=!0,ne({username:n.username,password:n.password}).then(p=>{const O=(p==null?void 0:p.token)||"";return localStorage.setItem("PAOPAO_TOKEN",O),W(O)}).then(p=>{window.$message.success("登录成功"),i.value=!1,l.commit("updateUserinfo",p),l.commit("triggerAuth",!1),l.commit("refresh"),n.username="",n.password=""}).catch(p=>{i.value=!1}))})},b=_=>{var u;_.preventDefault(),_.stopPropagation(),(u=m.value)==null||u.validate(L=>{L||(i.value=!0,Ze({username:d.username,password:d.password}).then(p=>ne({username:d.username,password:d.password})).then(p=>{const O=(p==null?void 0:p.token)||"";return localStorage.setItem("PAOPAO_TOKEN",O),W(O)}).then(p=>{window.$message.success("注册成功"),i.value=!1,l.commit("updateUserinfo",p),l.commit("triggerAuth",!1),d.username="",d.password="",d.repassword=""}).catch(p=>{i.value=!1}))})};return j(()=>{const _=localStorage.getItem("PAOPAO_TOKEN")||"";_?W(_).then(u=>{l.commit("updateUserinfo",u),l.commit("triggerAuth",!1)}).catch(u=>{l.commit("userLogout")}):l.commit("userLogout")}),(_,u)=>{const L=Pe,p=Le,O=ue,r=ce,w=Oe,y=Ae,C=ie,x=Te,$=Re,K=de,V=Ee;return v(),D(V,{show:h(l).state.authModalShow,"onUpdate:show":u[7]||(u[7]=f=>h(l).state.authModalShow=f),class:"auth-card",preset:"card",size:"small","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:a(()=>[k("div",et,[s(K,{bordered:!1},{default:a(()=>[t.value?M("",!0):(v(),T("div",tt,[s(O,{justify:"center"},{default:a(()=>[s(p,null,{default:a(()=>[s(L,{type:"success"},{default:a(()=>[S("账号登录")]),_:1})]),_:1})]),_:1}),s(y,{ref_key:"loginRef",ref:c,model:n,rules:{username:{required:!0,message:"请输入账户名"},password:{required:!0,message:"请输入密码"}}},{default:a(()=>[s(w,{label:"账户",path:"username"},{default:a(()=>[s(r,{value:n.username,"onUpdate:value":u[0]||(u[0]=f=>n.username=f),placeholder:"请输入用户名",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),s(w,{label:"密码",path:"password"},{default:a(()=>[s(r,{type:"password","show-password-on":"mousedown",value:n.password,"onUpdate:value":u[1]||(u[1]=f=>n.password=f),placeholder:"请输入账户密码",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),s(C,{type:"primary",block:"",secondary:"",strong:"",loading:i.value,onClick:g},{default:a(()=>[S(" 登录 ")]),_:1},8,["loading"])])),t.value?(v(),D($,{key:1,"default-value":h(l).state.authModelTab,size:"large","justify-content":"space-evenly"},{default:a(()=>[s(x,{name:"signin",tab:"登录"},{default:a(()=>[s(y,{ref_key:"loginRef",ref:c,model:n,rules:{username:{required:!0,message:"请输入账户名"},password:{required:!0,message:"请输入密码"}}},{default:a(()=>[s(w,{label:"账户",path:"username"},{default:a(()=>[s(r,{value:n.username,"onUpdate:value":u[2]||(u[2]=f=>n.username=f),placeholder:"请输入用户名",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),s(w,{label:"密码",path:"password"},{default:a(()=>[s(r,{type:"password","show-password-on":"mousedown",value:n.password,"onUpdate:value":u[3]||(u[3]=f=>n.password=f),placeholder:"请输入账户密码",onKeyup:q(N(g,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),s(C,{type:"primary",block:"",secondary:"",strong:"",loading:i.value,onClick:g},{default:a(()=>[S(" 登录 ")]),_:1},8,["loading"])]),_:1}),s(x,{name:"signup",tab:"注册"},{default:a(()=>[s(y,{ref_key:"registerRef",ref:m,model:d,rules:U},{default:a(()=>[s(w,{label:"用户名",path:"username"},{default:a(()=>[s(r,{value:d.username,"onUpdate:value":u[4]||(u[4]=f=>d.username=f),placeholder:"用户名注册后无法修改"},null,8,["value"])]),_:1}),s(w,{label:"密码",path:"password"},{default:a(()=>[s(r,{type:"password","show-password-on":"mousedown",placeholder:"密码不少于6位",value:d.password,"onUpdate:value":u[5]||(u[5]=f=>d.password=f),onKeyup:q(N(b,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),s(w,{label:"重复密码",path:"repassword"},{default:a(()=>[s(r,{type:"password","show-password-on":"mousedown",placeholder:"请再次输入密码",value:d.repassword,"onUpdate:value":u[6]||(u[6]=f=>d.repassword=f),onKeyup:q(N(b,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),s(C,{type:"primary",block:"",secondary:"",strong:"",loading:i.value,onClick:b},{default:a(()=>[S(" 注册 ")]),_:1},8,["loading"])]),_:1})]),_:1},8,["default-value"])):M("",!0)]),_:1})])]),_:1},8,["show"])}}});const me=(e,t)=>{const l=e.__vccOpts||e;for(const[i,c]of t)l[i]=c;return l},st=me(ot,[["__scopeId","data-v-053dfa44"]]),Xt=e=>o({method:"get",url:"/v1/posts",params:e}),nt=e=>o({method:"get",url:"/v1/tags",params:e}),Yt=e=>o({method:"get",url:"/v1/post",params:e}),Zt=e=>o({method:"get",url:"/v1/post/star",params:e}),eo=e=>o({method:"post",url:"/v1/post/star",data:e}),to=e=>o({method:"get",url:"/v1/post/collection",params:e}),oo=e=>o({method:"post",url:"/v1/post/collection",data:e}),so=e=>o({method:"get",url:"/v1/post/comments",params:e}),no=e=>o({method:"get",url:"/v1/user/contacts",params:e}),ro=e=>o({method:"post",url:"/v1/post",data:e}),ao=e=>o({method:"delete",url:"/v1/post",data:e}),lo=e=>o({method:"post",url:"/v1/post/lock",data:e}),uo=e=>o({method:"post",url:"/v1/post/stick",data:e}),co=e=>o({method:"post",url:"/v1/post/highlight",data:e}),io=e=>o({method:"post",url:"/v1/post/visibility",data:e}),po=e=>o({method:"post",url:"/v1/tweet/comment/thumbsup",data:e}),mo=e=>o({method:"post",url:"/v1/tweet/comment/thumbsdown",data:e}),_o=e=>o({method:"post",url:"/v1/tweet/reply/thumbsup",data:e}),ho=e=>o({method:"post",url:"/v1/tweet/reply/thumbsdown",data:e}),go=e=>o({method:"post",url:"/v1/post/comment",data:e}),fo=e=>o({method:"delete",url:"/v1/post/comment",data:e}),vo=e=>o({method:"post",url:"/v1/post/comment/reply",data:e}),wo=e=>o({method:"delete",url:"/v1/post/comment/reply",data:e}),yo=e=>o({method:"post",url:"/v1/topic/stick",data:e}),ko=e=>o({method:"post",url:"/v1/topic/follow",data:e}),bo=e=>o({method:"post",url:"/v1/topic/unfollow",data:e}),rt={key:0,class:"rightbar-wrap"},at={class:"search-wrap"},lt={class:"post-num"},ut={class:"post-num"},ct={class:"copyright"},it=["href"],dt=["href"],pt=z({__name:"rightbar",setup(e){const t=R([]),l=R([]),i=R(!1),c=R(""),n=B(),m=le(),d="2023 paopao.info",U="Roc's Me",g="",b="泡泡(PaoPao)开源社区",_="https://www.paopao.info",u=+"6",L=+"12",p=()=>{i.value=!0,nt({type:"hot_extral",num:L,extral_num:u}).then(y=>{t.value=y.topics,l.value=y.extral_topics??[],w.value=!0,i.value=!1}).catch(y=>{i.value=!1})},O=y=>y>=1e3?(y/1e3).toFixed(1)+"k":y,r=()=>{m.push({name:"home",query:{q:c.value}})},w=Q({get:()=>n.state.userLogined&&l.value.length!==0,set:y=>{}});return H(()=>({refreshTopicFollow:n.state.refreshTopicFollow,userLogined:n.state.userLogined}),(y,C)=>{(y.refreshTopicFollow!==C.refreshTopicFollow||y.userLogined)&&p()}),j(()=>{p()}),(y,C)=>{const x=F,$=ce,K=ae("router-link"),V=Ce,f=de,_e=ue;return h(n).state.collapsedRight?M("",!0):(v(),T("div",rt,[k("div",at,[s($,{round:"",clearable:"",placeholder:"搜一搜...",value:c.value,"onUpdate:value":C[0]||(C[0]=E=>c.value=E),onKeyup:q(N(r,["prevent"]),["enter"])},{prefix:a(()=>[s(x,{component:h(Fe)},null,8,["component"])]),_:1},8,["value","onKeyup"])]),w.value?(v(),D(f,{key:0,class:"hottopic-wrap",title:"关注话题",embedded:"",bordered:!1,size:"small"},{default:a(()=>[s(V,{show:i.value},{default:a(()=>[(v(!0),T(X,null,Y(l.value,E=>(v(),T("div",{class:"hot-tag-item",key:E.id},[s(K,{class:"hash-link",to:{name:"home",query:{q:E.tag,t:"tag"}}},{default:a(()=>[S(" #"+I(E.tag),1)]),_:2},1032,["to"]),k("div",lt,I(O(E.quote_num)),1)]))),128))]),_:1},8,["show"])]),_:1})):M("",!0),s(f,{class:"hottopic-wrap",title:"热门话题",embedded:"",bordered:!1,size:"small"},{default:a(()=>[s(V,{show:i.value},{default:a(()=>[(v(!0),T(X,null,Y(t.value,E=>(v(),T("div",{class:"hot-tag-item",key:E.id},[s(K,{class:"hash-link",to:{name:"home",query:{q:E.tag,t:"tag"}}},{default:a(()=>[S(" #"+I(E.tag),1)]),_:2},1032,["to"]),k("div",ut,I(O(E.quote_num)),1)]))),128))]),_:1},8,["show"])]),_:1}),s(f,{class:"copyright-wrap",embedded:"",bordered:!1,size:"small"},{default:a(()=>[k("div",ct,"© "+I(h(d)),1),k("div",null,[s(_e,null,{default:a(()=>[k("a",{href:h(g),target:"_blank",class:"hash-link"},I(h(U)),9,it),k("a",{href:h(_),target:"_blank",class:"hash-link"},I(h(b)),9,dt)]),_:1})])]),_:1})]))}}});const mt=me(pt,[["__scopeId","data-v-f4a84024"]]),Po=(e={})=>o({method:"get",url:"/v1/captcha",params:e}),Lo=e=>o({method:"post",url:"/v1/captcha",data:e}),Oo=e=>o({method:"post",url:"/v1/user/whisper",data:e}),Ao=e=>o({method:"post",url:"/v1/friend/requesting",data:e}),To=e=>o({method:"post",url:"/v1/friend/add",data:e}),Ro=e=>o({method:"post",url:"/v1/friend/reject",data:e}),Eo=e=>o({method:"post",url:"/v1/friend/delete",data:e}),Co=e=>o({method:"post",url:"/v1/user/phone",data:e}),$o=e=>o({method:"post",url:"/v1/user/activate",data:e}),Io=e=>o({method:"post",url:"/v1/user/password",data:e}),So=e=>o({method:"post",url:"/v1/user/nickname",data:e}),Mo=e=>o({method:"post",url:"/v1/user/avatar",data:e}),re=(e={})=>o({method:"get",url:"/v1/user/msgcount/unread",params:e}),Uo=e=>o({method:"get",url:"/v1/user/messages",params:e}),Ko=e=>o({method:"post",url:"/v1/user/message/read",data:e}),qo=e=>o({method:"get",url:"/v1/user/collections",params:e}),No=e=>o({method:"get",url:"/v1/user/profile",params:e}),Do=e=>o({method:"get",url:"/v1/user/posts",params:e}),xo=e=>o({method:"get",url:"/v1/user/wallet/bills",params:e}),Fo=e=>o({method:"post",url:"/v1/user/recharge",data:e}),Vo=e=>o({method:"get",url:"/v1/user/recharge",params:e}),zo=e=>o({method:"get",url:"/v1/suggest/users",params:e}),Bo=e=>o({method:"get",url:"/v1/suggest/tags",params:e}),Wo=e=>o({method:"get",url:"/v1/attachment/precheck",params:e}),Ho=e=>o({method:"get",url:"/v1/attachment",params:e}),jo=e=>o({method:"post",url:"/v1/admin/user/status",data:e}),_t="/assets/logo-52afee68.png",ht={class:"sidebar-wrap"},gt={class:"logo-wrap"},ft={key:0,class:"user-wrap"},vt={class:"user-info"},wt={class:"nickname"},yt={class:"nickname-txt"},kt={class:"username"},bt={class:"user-mini-wrap"},Pt={key:1,class:"user-wrap"},Lt={key:0,class:"login-only-wrap"},Ot={key:1,class:"login-wrap"},At=z({__name:"sidebar",setup(e){const t=B(),l=ye(),i=le(),c=R(!1),n=R(l.name||""),m=R(),d=R("true".toLowerCase()==="true"),U=+"5000";H(l,()=>{n.value=l.name}),H(t.state,()=>{t.state.userInfo.id>0?m.value||(re().then(r=>{c.value=r.count>0}).catch(r=>{console.log(r)}),m.value=setInterval(()=>{re().then(r=>{c.value=r.count>0}).catch(r=>{console.log(r)})},U)):m.value&&clearInterval(m.value)}),j(()=>{window.onresize=()=>{t.commit("triggerCollapsedLeft",document.body.clientWidth<=821),t.commit("triggerCollapsedRight",document.body.clientWidth<=821)}});const g=Q(()=>{const r=[{label:"广场",key:"home",icon:()=>P(ee),href:"/"},{label:"话题",key:"topic",icon:()=>P(te),href:"/topic"}];return"false".toLowerCase()==="true"&&r.push({label:"公告",key:"anouncement",icon:()=>P(Ve),href:"/anouncement"}),r.push({label:"主页",key:"profile",icon:()=>P(ze),href:"/profile"}),r.push({label:"消息",key:"messages",icon:()=>P(Be),href:"/messages"}),r.push({label:"收藏",key:"collection",icon:()=>P(We),href:"/collection"}),r.push({label:"好友",key:"contacts",icon:()=>P(He),href:"/contacts"}),"false".toLocaleLowerCase()==="true"&&r.push({label:"钱包",key:"wallet",icon:()=>P(je),href:"/wallet"}),r.push({label:"设置",key:"setting",icon:()=>P(Qe),href:"/setting"}),t.state.userInfo.id>0?r:[{label:"广场",key:"home",icon:()=>P(ee),href:"/"},{label:"话题",key:"topic",icon:()=>P(te),href:"/topic"}]}),b=r=>"href"in r?P("div",{},r.label):r.label,_=r=>r.key==="messages"?P(Ie,{dot:!0,show:c.value,processing:!0},{default:()=>P(F,{color:r.key===n.value?"var(--n-item-icon-color-active)":"var(--n-item-icon-color)"},{default:r.icon})}):P(F,null,{default:r.icon}),u=(r,w={})=>{n.value=r,i.push({name:r})},L=()=>{l.path==="/"&&t.commit("refresh"),u("home")},p=r=>{t.commit("triggerAuth",!0),t.commit("triggerAuthKey",r)},O=()=>{t.commit("userLogout"),t.commit("refresh"),L()};return window.$store=t,window.$message=$e(),(r,w)=>{const y=Se,C=Me,x=Ue,$=ie;return v(),T("div",ht,[k("div",gt,[s(y,{class:"logo-img",width:"36",src:h(_t),"preview-disabled":!0,onClick:L},null,8,["src"])]),s(C,{accordion:!0,"icon-size":24,options:g.value,"render-label":b,"render-icon":_,value:n.value,"onUpdate:value":u},null,8,["options","value"]),h(t).state.userInfo.id>0?(v(),T("div",ft,[s(x,{class:"user-avatar",round:"",size:34,src:h(t).state.userInfo.avatar},null,8,["src"]),k("div",vt,[k("div",wt,[k("span",yt,I(h(t).state.userInfo.nickname),1),s($,{class:"logout",quaternary:"",circle:"",size:"tiny",onClick:O},{icon:a(()=>[s(h(F),null,{default:a(()=>[s(h(oe))]),_:1})]),_:1})]),k("div",kt,"@"+I(h(t).state.userInfo.username),1)]),k("div",bt,[s($,{class:"logout",quaternary:"",circle:"",onClick:O},{icon:a(()=>[s(h(F),{size:24},{default:a(()=>[s(h(oe))]),_:1})]),_:1})])])):(v(),T("div",Pt,[d.value?M("",!0):(v(),T("div",Lt,[s($,{strong:"",secondary:"",round:"",type:"primary",onClick:w[0]||(w[0]=K=>p("signin"))},{default:a(()=>[S(" 登录 ")]),_:1})])),d.value?(v(),T("div",Ot,[s($,{strong:"",secondary:"",round:"",type:"primary",onClick:w[1]||(w[1]=K=>p("signin"))},{default:a(()=>[S(" 登录 ")]),_:1}),s($,{strong:"",secondary:"",round:"",type:"info",onClick:w[2]||(w[2]=K=>p("signup"))},{default:a(()=>[S(" 注册 ")]),_:1})])):M("",!0)]))])}}});const Tt={"has-sider":"",class:"main-wrap",position:"static"},Rt={key:0},Et={class:"content-wrap"},Ct=z({__name:"App",setup(e){const t=B(),l=Q(()=>t.state.theme==="dark"?qe:null);return(i,c)=>{const n=At,m=ae("router-view"),d=mt,U=st,g=Ne,b=De,_=xe,u=Ke;return v(),D(u,{theme:l.value},{default:a(()=>[s(b,null,{default:a(()=>[s(g,null,{default:a(()=>{var L;return[k("div",{class:ge(["app-container",{dark:((L=l.value)==null?void 0:L.name)==="dark",mobile:!h(t).state.desktopModelShow}])},[k("div",Tt,[h(t).state.desktopModelShow?(v(),T("div",Rt,[s(n)])):M("",!0),k("div",Et,[s(m,{class:"app-wrap"},{default:a(({Component:p})=>[(v(),D(he,null,[i.$route.meta.keepAlive?(v(),D(Z(p),{key:0})):M("",!0)],1024)),i.$route.meta.keepAlive?M("",!0):(v(),D(Z(p),{key:0}))]),_:1})]),s(d)]),s(U)],2)]}),_:1})]),_:1}),s(_)]),_:1},8,["theme"])}}});fe(Ct).use(pe).use(Ye).mount("#app");export{At as $,nt as A,Do as B,Oo as C,Ao as D,No as E,Eo as F,jo as G,To as H,Ro as I,Ko as J,Uo as K,qo as L,Wo as M,Ho as N,no as O,W as P,xo as Q,Fo as R,Vo as S,Po as T,Mo as U,Io as V,Co as W,$o as X,So as Y,Lo as Z,me as _,Bo as a,Xt as b,ro as c,ho as d,wo as e,po as f,zo as g,mo as h,vo as i,fo as j,go as k,Zt as l,to as m,ao as n,lo as o,co as p,eo as q,oo as r,uo as s,_o as t,Yt as u,io as v,so as w,yo as x,bo as y,ko as z}; diff --git a/web/dist/assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js b/web/dist/assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js new file mode 100644 index 00000000..012e861f --- /dev/null +++ b/web/dist/assets/main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js @@ -0,0 +1 @@ +import{$ as E}from"./index-08d8af97.js";import{u as N}from"./vuex-473b3783.js";import{u as S}from"./vue-router-b8e3382f.js";import{j as z}from"./vooks-a50491fd.js";import{N as A,O as C,Q as P,R}from"./@vicons-6332ad63.js";import{a3 as D,a4 as V,j as I,e as j,a5 as x,h as H}from"./naive-ui-62663ad7.js";import{d as $,r as h,j as q,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as F,Q as _,e as L,M as Q,F as U}from"./@vue-e0e89260.js";const G={key:0},J={class:"navbar"},oe=$({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(g){const i=g,n=N(),m=S(),l=h(!1),k=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return q(()=>{localStorage.getItem("PAOPAO_THEME")||u(z()==="dark")}),(s,d)=>{const y=E,b=D,O=V,r=I,p=j,M=x,T=H;return a(),f(U,null,[o(n).state.drawerModelShow?(a(),f("div",G,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[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(()=>[F("div",J,[o(n).state.drawerModelShow&&!s.back?(a(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(A))]),_:1})]),_:1})):c("",!0),s.back?(a(),_(p,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),L(" "+Q(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(R)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _}; diff --git a/web/dist/assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js b/web/dist/assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js deleted file mode 100644 index dee5fa05..00000000 --- a/web/dist/assets/main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js +++ /dev/null @@ -1 +0,0 @@ -import{Z as B}from"./index-8b4e1776.js";import{u as E}from"./vuex-473b3783.js";import{u as S}from"./vue-router-b8e3382f.js";import{j as A}from"./vooks-a50491fd.js";import{D as C,y as D,z as N,F as P}from"./@vicons-d502290a.js";import{a3 as R,a4 as V,j as I,e as j,a5 as x,h as F}from"./naive-ui-62663ad7.js";import{d as H,r as h,j as q,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as L,Q as _,e as U,M as $,F as Q}from"./@vue-e0e89260.js";const Z={key:0},G={class:"navbar"},oe=H({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(g){const i=g,n=E(),m=S(),l=h(!1),k=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return q(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(s,d)=>{const y=B,b=R,O=V,r=I,p=j,M=x,T=F;return a(),f(Q,null,[o(n).state.drawerModelShow?(a(),f("div",Z,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=z=>l.value=z),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[L("div",G,[o(n).state.drawerModelShow&&!s.back?(a(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),s.back?(a(),_(p,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(D))]),_:1})]),_:1})):c("",!0),U(" "+$(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:o(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _}; diff --git a/web/dist/assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js b/web/dist/assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js similarity index 97% rename from web/dist/assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js rename to web/dist/assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js index d16976ca..1bc21f5e 100644 --- a/web/dist/assets/post-item.vue_vue_type_style_index_0_lang-cf654b7f.js +++ b/web/dist/assets/post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js @@ -1 +1 @@ -import{p as P,a as B,_ as N,b as V,c as D}from"./content-c0ce69b7.js";import{d as S,n as H,a3 as F,o as l,c as k,V as i,a7 as I,a1 as s,a as r,F as A,a4 as E,a2 as f,_ as d,e as _,M as m,Q as c,O as p}from"./@vue-e0e89260.js";import{u as Q}from"./vuex-473b3783.js";import{u as R}from"./vue-router-b8e3382f.js";import{b as G}from"./formatTime-cdf4e6f1.js";import{a as ne}from"./copy-to-clipboard-1dd3075d.js";import{i as oe,j as J,l as K,m as U}from"./@vicons-d502290a.js";import{o as W,O as X,j as Y,e as ie,P as le,a as Z,M as ee}from"./naive-ui-62663ad7.js";const ue={class:"post-item"},re={class:"nickname-wrap"},ce={class:"username-wrap"},pe={class:"timestamp-mobile"},_e={class:"item-header-extra"},me=["innerHTML"],de={class:"opt-item"},ve={class:"opt-item"},Le=S({__name:"mobile-post-item",props:{post:{}},setup(q){const T=q,h=R(),M=Q(),e=H(()=>[{label:"复制链接",key:"copyTweetLink"}]),x=async o=>{switch(o){case"copyTweetLink":ne(`${window.location.origin}/#/post?id=${t.value.id}`),window.$message.success("链接已复制到剪贴板");break}},t=H(()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},T.post);return o.contents.map(n=>{(+n.type==1||+n.type==2)&&o.texts.push(n),+n.type==3&&o.imgs.push(n),+n.type==4&&o.videos.push(n),+n.type==6&&o.links.push(n),+n.type==7&&o.attachments.push(n),+n.type==8&&o.charge_attachments.push(n)}),o}),u=o=>{h.push({name:"post",query:{id:o}})},a=(o,n)=>{if(o.target.dataset.detail){const v=o.target.dataset.detail.split(":");if(v.length===2){M.commit("refresh"),v[0]==="tag"?h.push({name:"home",query:{q:v[1],t:"tag"}}):h.push({name:"user",query:{username:v[1]}});return}}u(n)};return(o,n)=>{const v=W,b=F("router-link"),w=X,g=Y,O=ie,$=le,z=B,L=N,y=V,j=D,te=Z,se=ee;return l(),k("div",ue,[i(se,{"content-indented":""},I({avatar:s(()=>[i(v,{round:"",size:30,src:t.value.user.avatar},null,8,["src"])]),header:s(()=>[r("span",re,[i(b,{onClick:n[0]||(n[0]=f(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t.value.user.username}}},{default:s(()=>[_(m(t.value.user.nickname),1)]),_:1},8,["to"])]),r("span",ce," @"+m(t.value.user.username),1),t.value.is_top?(l(),c(w,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:s(()=>[_(" 置顶 ")]),_:1})):p("",!0),t.value.visibility==1?(l(),c(w,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:s(()=>[_(" 私密 ")]),_:1})):p("",!0),t.value.visibility==2?(l(),c(w,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:s(()=>[_(" 好友可见 ")]),_:1})):p("",!0),r("div",null,[r("span",pe,m(d(G)(t.value.created_on))+" "+m(t.value.ip_loc),1)])]),"header-extra":s(()=>[r("div",_e,[i($,{placement:"bottom-end",trigger:"click",size:"small",options:e.value,onSelect:x},{default:s(()=>[i(O,{quaternary:"",circle:""},{icon:s(()=>[i(g,null,{default:s(()=>[i(d(oe))]),_:1})]),_:1})]),_:1},8,["options"])])]),footer:s(()=>[t.value.attachments.length>0?(l(),c(z,{key:0,attachments:t.value.attachments},null,8,["attachments"])):p("",!0),t.value.charge_attachments.length>0?(l(),c(z,{key:1,attachments:t.value.charge_attachments,price:t.value.attachment_price},null,8,["attachments","price"])):p("",!0),t.value.imgs.length>0?(l(),c(L,{key:2,imgs:t.value.imgs},null,8,["imgs"])):p("",!0),t.value.videos.length>0?(l(),c(y,{key:3,videos:t.value.videos},null,8,["videos"])):p("",!0),t.value.links.length>0?(l(),c(j,{key:4,links:t.value.links},null,8,["links"])):p("",!0)]),action:s(()=>[i(te,{justify:"space-between"},{default:s(()=>[r("div",de,[i(g,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(J))]),_:1}),_(" "+m(t.value.upvote_count),1)]),r("div",{class:"opt-item",onClick:n[3]||(n[3]=f(C=>u(t.value.id),["stop"]))},[i(g,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(K))]),_:1}),_(" "+m(t.value.comment_count),1)]),r("div",ve,[i(g,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(U))]),_:1}),_(" "+m(t.value.collection_count),1)])]),_:1})]),_:2},[t.value.texts.length>0?{name:"description",fn:s(()=>[r("div",{onClick:n[2]||(n[2]=C=>u(t.value.id))},[(l(!0),k(A,null,E(t.value.texts,C=>(l(),k("span",{key:C.id,class:"post-text",onClick:n[1]||(n[1]=f(ae=>a(ae,t.value.id),["stop"])),innerHTML:d(P)(C.content).content},null,8,me))),128))])]),key:"0"}:void 0]),1024)])}}});const he={class:"nickname-wrap"},ge={class:"username-wrap"},ye={class:"item-header-extra"},ke={class:"timestamp"},fe=["innerHTML"],xe={class:"opt-item"},we={class:"opt-item"},je=S({__name:"post-item",props:{post:{}},setup(q){const T=q,h=R(),M=Q(),e=H(()=>{let u=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},T.post);return u.contents.map(a=>{(+a.type==1||+a.type==2)&&u.texts.push(a),+a.type==3&&u.imgs.push(a),+a.type==4&&u.videos.push(a),+a.type==6&&u.links.push(a),+a.type==7&&u.attachments.push(a),+a.type==8&&u.charge_attachments.push(a)}),u}),x=u=>{h.push({name:"post",query:{id:u}})},t=(u,a)=>{if(u.target.dataset.detail){const o=u.target.dataset.detail.split(":");if(o.length===2){M.commit("refresh"),o[0]==="tag"?h.push({name:"home",query:{q:o[1],t:"tag"}}):h.push({name:"user",query:{username:o[1]}});return}}x(a)};return(u,a)=>{const o=W,n=F("router-link"),v=X,b=B,w=N,g=V,O=D,$=Y,z=Z,L=ee;return l(),k("div",{class:"post-item",onClick:a[3]||(a[3]=y=>x(e.value.id))},[i(L,{"content-indented":""},I({avatar:s(()=>[i(o,{round:"",size:30,src:e.value.user.avatar},null,8,["src"])]),header:s(()=>[r("span",he,[i(n,{onClick:a[0]||(a[0]=f(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.value.user.username}}},{default:s(()=>[_(m(e.value.user.nickname),1)]),_:1},8,["to"])]),r("span",ge," @"+m(e.value.user.username),1),e.value.is_top?(l(),c(v,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:s(()=>[_(" 置顶 ")]),_:1})):p("",!0),e.value.visibility==1?(l(),c(v,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:s(()=>[_(" 私密 ")]),_:1})):p("",!0),e.value.visibility==2?(l(),c(v,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:s(()=>[_(" 好友可见 ")]),_:1})):p("",!0)]),"header-extra":s(()=>[r("div",ye,[r("span",ke,m(e.value.ip_loc?e.value.ip_loc+" · ":e.value.ip_loc)+" "+m(d(G)(e.value.created_on)),1)])]),footer:s(()=>[e.value.attachments.length>0?(l(),c(b,{key:0,attachments:e.value.attachments},null,8,["attachments"])):p("",!0),e.value.charge_attachments.length>0?(l(),c(b,{key:1,attachments:e.value.charge_attachments,price:e.value.attachment_price},null,8,["attachments","price"])):p("",!0),e.value.imgs.length>0?(l(),c(w,{key:2,imgs:e.value.imgs},null,8,["imgs"])):p("",!0),e.value.videos.length>0?(l(),c(g,{key:3,videos:e.value.videos},null,8,["videos"])):p("",!0),e.value.links.length>0?(l(),c(O,{key:4,links:e.value.links},null,8,["links"])):p("",!0)]),action:s(()=>[i(z,{justify:"space-between"},{default:s(()=>[r("div",xe,[i($,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(J))]),_:1}),_(" "+m(e.value.upvote_count),1)]),r("div",{class:"opt-item",onClick:a[2]||(a[2]=f(y=>x(e.value.id),["stop"]))},[i($,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(K))]),_:1}),_(" "+m(e.value.comment_count),1)]),r("div",we,[i($,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(U))]),_:1}),_(" "+m(e.value.collection_count),1)])]),_:1})]),_:2},[e.value.texts.length>0?{name:"description",fn:s(()=>[(l(!0),k(A,null,E(e.value.texts,y=>(l(),k("span",{key:y.id,class:"post-text",onClick:a[1]||(a[1]=f(j=>t(j,e.value.id),["stop"])),innerHTML:d(P)(y.content).content},null,8,fe))),128))]),key:"0"}:void 0]),1024)])}}});export{je as _,Le as a}; +import{p as P,a as B,_ as N,b as V,c as D}from"./content-91ba374b.js";import{d as S,n as H,a3 as F,o as l,c as k,V as i,a7 as I,a1 as s,a as r,F as A,a4 as E,a2 as f,_ as d,e as _,M as m,Q as c,O as p}from"./@vue-e0e89260.js";import{u as Q}from"./vuex-473b3783.js";import{u as R}from"./vue-router-b8e3382f.js";import{b as G}from"./formatTime-cdf4e6f1.js";import{a as ne}from"./copy-to-clipboard-1dd3075d.js";import{i as oe,j as J,l as K,m as U}from"./@vicons-6332ad63.js";import{o as W,O as X,j as Y,e as ie,P as le,a as Z,M as ee}from"./naive-ui-62663ad7.js";const ue={class:"post-item"},re={class:"nickname-wrap"},ce={class:"username-wrap"},pe={class:"timestamp-mobile"},_e={class:"item-header-extra"},me=["innerHTML"],de={class:"opt-item"},ve={class:"opt-item"},Le=S({__name:"mobile-post-item",props:{post:{}},setup(q){const T=q,h=R(),M=Q(),e=H(()=>[{label:"复制链接",key:"copyTweetLink"}]),x=async o=>{switch(o){case"copyTweetLink":ne(`${window.location.origin}/#/post?id=${t.value.id}`),window.$message.success("链接已复制到剪贴板");break}},t=H(()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},T.post);return o.contents.map(n=>{(+n.type==1||+n.type==2)&&o.texts.push(n),+n.type==3&&o.imgs.push(n),+n.type==4&&o.videos.push(n),+n.type==6&&o.links.push(n),+n.type==7&&o.attachments.push(n),+n.type==8&&o.charge_attachments.push(n)}),o}),u=o=>{h.push({name:"post",query:{id:o}})},a=(o,n)=>{if(o.target.dataset.detail){const v=o.target.dataset.detail.split(":");if(v.length===2){M.commit("refresh"),v[0]==="tag"?h.push({name:"home",query:{q:v[1],t:"tag"}}):h.push({name:"user",query:{username:v[1]}});return}}u(n)};return(o,n)=>{const v=W,b=F("router-link"),w=X,g=Y,O=ie,$=le,z=B,L=N,y=V,j=D,te=Z,se=ee;return l(),k("div",ue,[i(se,{"content-indented":""},I({avatar:s(()=>[i(v,{round:"",size:30,src:t.value.user.avatar},null,8,["src"])]),header:s(()=>[r("span",re,[i(b,{onClick:n[0]||(n[0]=f(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t.value.user.username}}},{default:s(()=>[_(m(t.value.user.nickname),1)]),_:1},8,["to"])]),r("span",ce," @"+m(t.value.user.username),1),t.value.is_top?(l(),c(w,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:s(()=>[_(" 置顶 ")]),_:1})):p("",!0),t.value.visibility==1?(l(),c(w,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:s(()=>[_(" 私密 ")]),_:1})):p("",!0),t.value.visibility==2?(l(),c(w,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:s(()=>[_(" 好友可见 ")]),_:1})):p("",!0),r("div",null,[r("span",pe,m(d(G)(t.value.created_on))+" "+m(t.value.ip_loc),1)])]),"header-extra":s(()=>[r("div",_e,[i($,{placement:"bottom-end",trigger:"click",size:"small",options:e.value,onSelect:x},{default:s(()=>[i(O,{quaternary:"",circle:""},{icon:s(()=>[i(g,null,{default:s(()=>[i(d(oe))]),_:1})]),_:1})]),_:1},8,["options"])])]),footer:s(()=>[t.value.attachments.length>0?(l(),c(z,{key:0,attachments:t.value.attachments},null,8,["attachments"])):p("",!0),t.value.charge_attachments.length>0?(l(),c(z,{key:1,attachments:t.value.charge_attachments,price:t.value.attachment_price},null,8,["attachments","price"])):p("",!0),t.value.imgs.length>0?(l(),c(L,{key:2,imgs:t.value.imgs},null,8,["imgs"])):p("",!0),t.value.videos.length>0?(l(),c(y,{key:3,videos:t.value.videos},null,8,["videos"])):p("",!0),t.value.links.length>0?(l(),c(j,{key:4,links:t.value.links},null,8,["links"])):p("",!0)]),action:s(()=>[i(te,{justify:"space-between"},{default:s(()=>[r("div",de,[i(g,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(J))]),_:1}),_(" "+m(t.value.upvote_count),1)]),r("div",{class:"opt-item",onClick:n[3]||(n[3]=f(C=>u(t.value.id),["stop"]))},[i(g,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(K))]),_:1}),_(" "+m(t.value.comment_count),1)]),r("div",ve,[i(g,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(U))]),_:1}),_(" "+m(t.value.collection_count),1)])]),_:1})]),_:2},[t.value.texts.length>0?{name:"description",fn:s(()=>[r("div",{onClick:n[2]||(n[2]=C=>u(t.value.id))},[(l(!0),k(A,null,E(t.value.texts,C=>(l(),k("span",{key:C.id,class:"post-text",onClick:n[1]||(n[1]=f(ae=>a(ae,t.value.id),["stop"])),innerHTML:d(P)(C.content).content},null,8,me))),128))])]),key:"0"}:void 0]),1024)])}}});const he={class:"nickname-wrap"},ge={class:"username-wrap"},ye={class:"item-header-extra"},ke={class:"timestamp"},fe=["innerHTML"],xe={class:"opt-item"},we={class:"opt-item"},je=S({__name:"post-item",props:{post:{}},setup(q){const T=q,h=R(),M=Q(),e=H(()=>{let u=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},T.post);return u.contents.map(a=>{(+a.type==1||+a.type==2)&&u.texts.push(a),+a.type==3&&u.imgs.push(a),+a.type==4&&u.videos.push(a),+a.type==6&&u.links.push(a),+a.type==7&&u.attachments.push(a),+a.type==8&&u.charge_attachments.push(a)}),u}),x=u=>{h.push({name:"post",query:{id:u}})},t=(u,a)=>{if(u.target.dataset.detail){const o=u.target.dataset.detail.split(":");if(o.length===2){M.commit("refresh"),o[0]==="tag"?h.push({name:"home",query:{q:o[1],t:"tag"}}):h.push({name:"user",query:{username:o[1]}});return}}x(a)};return(u,a)=>{const o=W,n=F("router-link"),v=X,b=B,w=N,g=V,O=D,$=Y,z=Z,L=ee;return l(),k("div",{class:"post-item",onClick:a[3]||(a[3]=y=>x(e.value.id))},[i(L,{"content-indented":""},I({avatar:s(()=>[i(o,{round:"",size:30,src:e.value.user.avatar},null,8,["src"])]),header:s(()=>[r("span",he,[i(n,{onClick:a[0]||(a[0]=f(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.value.user.username}}},{default:s(()=>[_(m(e.value.user.nickname),1)]),_:1},8,["to"])]),r("span",ge," @"+m(e.value.user.username),1),e.value.is_top?(l(),c(v,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:s(()=>[_(" 置顶 ")]),_:1})):p("",!0),e.value.visibility==1?(l(),c(v,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:s(()=>[_(" 私密 ")]),_:1})):p("",!0),e.value.visibility==2?(l(),c(v,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:s(()=>[_(" 好友可见 ")]),_:1})):p("",!0)]),"header-extra":s(()=>[r("div",ye,[r("span",ke,m(e.value.ip_loc?e.value.ip_loc+" · ":e.value.ip_loc)+" "+m(d(G)(e.value.created_on)),1)])]),footer:s(()=>[e.value.attachments.length>0?(l(),c(b,{key:0,attachments:e.value.attachments},null,8,["attachments"])):p("",!0),e.value.charge_attachments.length>0?(l(),c(b,{key:1,attachments:e.value.charge_attachments,price:e.value.attachment_price},null,8,["attachments","price"])):p("",!0),e.value.imgs.length>0?(l(),c(w,{key:2,imgs:e.value.imgs},null,8,["imgs"])):p("",!0),e.value.videos.length>0?(l(),c(g,{key:3,videos:e.value.videos},null,8,["videos"])):p("",!0),e.value.links.length>0?(l(),c(O,{key:4,links:e.value.links},null,8,["links"])):p("",!0)]),action:s(()=>[i(z,{justify:"space-between"},{default:s(()=>[r("div",xe,[i($,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(J))]),_:1}),_(" "+m(e.value.upvote_count),1)]),r("div",{class:"opt-item",onClick:a[2]||(a[2]=f(y=>x(e.value.id),["stop"]))},[i($,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(K))]),_:1}),_(" "+m(e.value.comment_count),1)]),r("div",we,[i($,{size:"18",class:"opt-item-icon"},{default:s(()=>[i(d(U))]),_:1}),_(" "+m(e.value.collection_count),1)])]),_:1})]),_:2},[e.value.texts.length>0?{name:"description",fn:s(()=>[(l(!0),k(A,null,E(e.value.texts,y=>(l(),k("span",{key:y.id,class:"post-text",onClick:a[1]||(a[1]=f(j=>t(j,e.value.id),["stop"])),innerHTML:d(P)(y.content).content},null,8,fe))),128))]),key:"0"}:void 0]),1024)])}}});export{je as _,Le as a}; diff --git a/web/dist/assets/post-skeleton-627d3fc3.js b/web/dist/assets/post-skeleton-41befd31.js similarity index 88% rename from web/dist/assets/post-skeleton-627d3fc3.js rename to web/dist/assets/post-skeleton-41befd31.js index 62070677..c1ce9d98 100644 --- a/web/dist/assets/post-skeleton-627d3fc3.js +++ b/web/dist/assets/post-skeleton-41befd31.js @@ -1 +1 @@ -import{U as r}from"./naive-ui-62663ad7.js";import{d as c,o as s,c as n,a4 as p,a as o,V as t,F as l}from"./@vue-e0e89260.js";import{_ as i}from"./index-8b4e1776.js";const m={class:"user"},d={class:"content"},u=c({__name:"post-skeleton",props:{num:{default:1}},setup(f){return(_,k)=>{const e=r;return s(!0),n(l,null,p(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _}; +import{U as r}from"./naive-ui-62663ad7.js";import{d as c,o as s,c as n,a4 as p,a as o,V as t,F as l}from"./@vue-e0e89260.js";import{_ as i}from"./index-08d8af97.js";const m={class:"user"},d={class:"content"},u=c({__name:"post-skeleton",props:{num:{default:1}},setup(f){return(_,k)=>{const e=r;return s(!0),n(l,null,p(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _}; diff --git a/web/dist/index.html b/web/dist/index.html index e6ed6f55..695114a4 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -8,7 +8,7 @@ 泡泡 - + @@ -27,7 +27,7 @@ - + diff --git a/web/src/api/post.ts b/web/src/api/post.ts index a21ba397..a4df3979 100644 --- a/web/src/api/post.ts +++ b/web/src/api/post.ts @@ -143,6 +143,17 @@ export const stickPost = ( }); }; +/** 设为亮点/取消亮点动态 */ +export const highlightPost = ( + data: NetParams.PostHighlightPost +): Promise => { + return request({ + method: "post", + url: "/v1/post/highlight", + data, + }); +}; + /** 置顶/取消置顶动态 */ export const visibilityPost = ( data: NetParams.PostVisibilityPost diff --git a/web/src/components/post-detail.vue b/web/src/components/post-detail.vue index aeda39d0..aa1aa7b6 100644 --- a/web/src/components/post-detail.vue +++ b/web/src/components/post-detail.vue @@ -110,6 +110,21 @@ negative-text="取消" @positive-click="execStickAction" /> + +