Merge pull request #18 from yuhan-feng/hxy-dev

Hxy dev
pull/361/head
overBaker 2 years ago committed by GitHub
commit b726612aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,9 +7,9 @@ require (
github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868
github.com/alimy/cfg v0.4.0
github.com/alimy/mir/v4 v4.0.0
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/allegro/bigcache/v3 v3.1.0
github.com/bufbuild/connect-go v1.10.0
github.com/bufbuild/connect-go v1.9.0
github.com/bytedance/sonic v1.9.2
github.com/cockroachdb/errors v1.10.0
github.com/disintegration/imaging v1.6.2
@ -31,13 +31,13 @@ require (
github.com/pyroscope-io/client v0.7.1
github.com/redis/rueidis v1.0.13
github.com/sirupsen/logrus v1.9.3
github.com/smartwalle/alipay/v3 v3.2.15
github.com/smartwalle/alipay/v3 v3.2.14
github.com/sourcegraph/conc v0.3.0
github.com/spf13/viper v1.16.0
github.com/tencentyun/cos-go-sdk-v5 v0.7.42
github.com/yinheli/mahonia v0.0.0-20131226213531-0eef680515cc
go.uber.org/automaxprocs v1.5.3
google.golang.org/grpc v1.57.0
google.golang.org/grpc v1.56.2
google.golang.org/protobuf v1.31.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/resty.v1 v1.12.0
@ -45,7 +45,7 @@ require (
gorm.io/driver/postgres v1.5.2
gorm.io/driver/sqlite v1.5.2
gorm.io/gorm v1.25.2
gorm.io/plugin/dbresolver v1.4.2
gorm.io/plugin/dbresolver v1.4.1
gorm.io/plugin/soft_delete v1.2.1
modernc.org/sqlite v1.24.0
)
@ -128,7 +128,7 @@ require (
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect

@ -127,8 +127,8 @@ github.com/alimy/cfg v0.4.0 h1:SslKPndmxRViT1ePWLmNsEq7okYP0GVeuowQlRWZPkw=
github.com/alimy/cfg v0.4.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c=
github.com/alimy/mir/v4 v4.0.0 h1:MzGfmoLjjvR69jbZEmpKJO3tUuqB0RGRv1UWPbtukBg=
github.com/alimy/mir/v4 v4.0.0/go.mod h1:d58dBvw2KImcVbAUANrciEV/of0arMNsI9c/5UNCMMc=
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible h1:6JF1bjhT0WN2srEmijfOFtVWwV91KZ6dJY1/JbdtGrI=
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible h1:KpbJFXwhVeuxNtBJ74MCGbIoaBok2uZvkD7QXp2+Wis=
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk=
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
@ -186,8 +186,8 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg=
github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8=
github.com/bufbuild/connect-go v1.9.0 h1:JIgAeNuFpo+SUPfU19Yt5TcWlznsN5Bv10/gI/6Pjoc=
github.com/bufbuild/connect-go v1.9.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8=
github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
@ -1157,8 +1157,8 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartwalle/alipay/v3 v3.2.15 h1:3fvFJnINKKAOXHR/Iv20k1Z7KJ+nOh3oK214lELPqG8=
gitub.com/smartwalle/alipay/v3 v3.2.15/go.mod h1:niTNB609KyUYuAx9Bex/MawEjv2yPx4XOjxSAkqmGjE=
github.com/smartwalle/alipay/v3 v3.2.14 h1:X7IPMzweYXjxO+30G9amEjCogzpoA/K1GZpVjM1keps=
github.com/smartwalle/alipay/v3 v3.2.14/go.mod h1:niTNB609KyUYuAx9Bex/MawEjv2yPx4XOjxSAkqmGjE=
github.com/smartwalle/ncrypto v1.0.2 h1:pTAhCqtPCMhpOwFXX+EcMdR6PNzruBNoGQrN2S1GbGI=
github.com/smartwalle/ncrypto v1.0.2/go.mod h1:Dwlp6sfeNaPMnOxMNayMTacvC5JGEVln3CVdiVDgbBk=
github.com/smartwalle/ngx v1.0.6 h1:JPNqNOIj+2nxxFtrSkJO+vKJfeNUSEQueck/Wworjps=
@ -1894,8 +1894,8 @@ google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ6
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
@ -1929,8 +1929,8 @@ google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@ -2004,11 +2004,12 @@ gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.23.0/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.24.3/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.2 h1:gs1o6Vsa+oVKG/a9ElL3XgyGfghFfkKA2SInQaCyMho=
gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/plugin/dbresolver v1.4.2 h1:IeLSH20ayxbo4rN6HMIQ0ccdsh/fkLK23pp6ivZrqBI=
gorm.io/plugin/dbresolver v1.4.2/go.mod h1:l4Cn87EHLEYuqUncpEeTC2tTJQkjngPSD+lo8hIvcT0=
gorm.io/plugin/dbresolver v1.4.1 h1:Ug4LcoPhrvqq71UhxtF346f+skTYoCa/nEsdjvHwEzk=
gorm.io/plugin/dbresolver v1.4.1/go.mod h1:CTbCtMWhsjXSiJqiW2R8POvJ2cq18RVOl4WGyT5nhNc=
gorm.io/plugin/soft_delete v1.2.1 h1:qx9D/c4Xu6w5KT8LviX8DgLcB9hkKl6JC9f44Tj7cGU=
gorm.io/plugin/soft_delete v1.2.1/go.mod h1:Zv7vQctOJTGOsJ/bWgrN1n3od0GBAZgnLjEx+cApLGk=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=

@ -9,6 +9,7 @@ type (
// share_key服务
type ShareKeyService interface {
GetUserKeys(UserName string) ([]*ShareKey, error)
GetUserKeys(UserName string, offset, limit int) ([]*ShareKey, error)
DeleteUserKey(UserName string, key string) (DeleteKeySuccessOrFail, error)
GetUserShareKeyCount(name string) (int64, error)
}

@ -37,3 +37,27 @@ func (sf *ShareKey) POST(db *gorm.DB) (DeleteKeySuccessOrFail, error) {
return sof, nil
}
func (s *ShareKey) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*ShareKey, error) {
var records []*ShareKey
var err error
if offset >= 0 && limit > 0 {
db = db.Offset(offset).Limit(limit)
}
db = db.Table("p_share_key").Where("user_name = ?", s.UserName)
////如果没有传order则执行过滤条件
//for k, v := range *conditions {
// if k == "ORDER" {
// db = db.Order(v)
// } else {
// db = db.Where(k, v)
// }
//}
if err = db.Table("p_share_key").Where("status = ?", 0).Find(&records).Error; err != nil {
return nil, err
}
return records, nil
}

@ -2,6 +2,7 @@ package jinzhu
import (
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
"gorm.io/gorm"
)
@ -21,14 +22,21 @@ func (s ShareKeyService) DeleteUserKey(UserName string, key string) (core.Delete
return deleteKey, nil
}
func (s ShareKeyService) GetUserKeys(UserName string) ([]*core.ShareKey, error) {
//根据username查询相应的keys
var keys []*core.ShareKey
err := s.db.Table("p_share_key").Where("user_name = ? and status = 0", UserName).Find(&keys).Error
func (s ShareKeyService) GetUserKeys(UserName string, offset, limit int) ([]*core.ShareKey, error) {
statement := &dbr.ShareKey{
UserName: UserName,
}
//fmt.Print(statement.List(s.db, &dbr.ConditionsT{}, offset, limit))
return statement.List(s.db, &dbr.ConditionsT{}, offset, limit)
}
func (s ShareKeyService) GetUserShareKeyCount(name string) (int64, error) {
var count int64
err := s.db.Table("p_share_key").Where("user_name = ? and status = 0", name).Count(&count).Error
if err != nil {
return nil, err
return 0, err
}
return keys, nil
return count, nil
}
func NewShareKeyService(db *gorm.DB) *ShareKeyService {

@ -4,6 +4,7 @@ import (
"github.com/alimy/mir/v4"
"github.com/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/servants/base"
"github.com/rocboss/paopao-ce/pkg/app"
"github.com/rocboss/paopao-ce/pkg/convert"
"github.com/rocboss/paopao-ce/pkg/xerror"
)
@ -12,6 +13,8 @@ import (
type GetUserKeysReq struct {
UserId int64
UserName string
Page int
PageSize int
}
func (g *GetUserKeysReq) Bind(c *gin.Context) mir.Error {
@ -21,6 +24,7 @@ func (g *GetUserKeysReq) Bind(c *gin.Context) mir.Error {
}
g.UserId = uid.ID
g.UserName = uid.Username
g.Page, g.PageSize = app.GetPageInfo(c)
return nil
}
@ -30,9 +34,7 @@ type KeyInfo struct {
Description string `json:"description"`
}
type GetUserKeysResp struct {
ShareKeys []KeyInfo `json:"shareKeys"`
}
type GetUserKeysResp base.PageResp
// 逻辑删除服务
type DeleteKeyReq struct {

@ -90,8 +90,10 @@ var (
ErrFileUploadFailed = xerror.NewError(10200, "文件上传失败")
ErrFileInvalidExt = xerror.NewError(10201, "文件类型不合法")
ErrFileInvalidSize = xerror.NewError(10202, "文件大小超限")
ErrGetUserKeysFailed = xerror.NewError(11001, "获取用户Share Key失败")
ErrDsNil = xerror.NewError(11002, "数据源为空")
ErrUserNameEmpty = xerror.NewError(11003, "用户名为空")
ErrDeleteUserKeyFailed = xerror.NewError(11004, "删除用户Share Key失败")
ErrGetUserShareKeyCountFailed = xerror.NewError(11005, "获取用户Share Key数量失败")
)

@ -37,7 +37,7 @@ func (s *shareKey) GetKeyDetail(req *web.GetUserKeysReq) (*web.GetUserKeysResp,
return nil, web.ErrUserNameEmpty
}
// 调用数据源的方法查询用户的所有key信息
keys, err := s.Ds.GetUserKeys(req.UserName)
keys, err := s.Ds.GetUserKeys(req.UserName, (req.Page-1)*req.PageSize, req.PageSize)
if err != nil {
logrus.Errorf("GetUserKeys err: %s", err)
return nil, web.ErrGetUserKeysFailed
@ -53,11 +53,16 @@ func (s *shareKey) GetKeyDetail(req *web.GetUserKeysReq) (*web.GetUserKeysResp,
})
}
// 构建返回结果并返回
resp := &web.GetUserKeysResp{
ShareKeys: keyInfos,
//计算share_key的总数
totalRows, err := s.Ds.GetUserShareKeyCount(req.UserName)
if err != nil {
logrus.Errorf("GetUserShareKeyCount err: %s", err)
return nil, web.ErrGetUserShareKeyCountFailed
}
return resp, nil
resp := base.PageRespFrom(keys, req.Page, req.PageSize, totalRows)
// 构建返回结果并返回
return (*web.GetUserKeysResp)(resp), nil
}
func (s *shareKey) DeleteKeyDetail(req *web.DeleteKeyReq) (*web.DeleteKeyResp, mir.Error) {

@ -10,13 +10,14 @@ import { request } from "@/utils/request";
// params,
// });
// }
export const getShareKeys = (token: NetParams.AuthUserInfo = ""): Promise<NetReq.UserGetShareKeys> => {
export const getShareKeys = (params: NetParams.UserGetShareKeys, token: NetParams.AuthUserInfo = ""): Promise<NetReq.UserGetShareKeys> => {
return request({
method: "get",
url: "/v1/user/keys",
headers: {
Authorization: `Bearer ${token}`,
},
params,
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -20,7 +20,7 @@
:options="optionsRef"
@search="handleSearch"
@update:value="changeContent"
placeholder="说说您的新鲜事..."
placeholder="讲讲今天和AI聊的工具吧"
/>
</div>
@ -104,7 +104,7 @@
</n-button>
</n-upload-trigger>
<n-upload-trigger
<!-- <n-upload-trigger
v-if="allowTweetAttachment"
#="{ handleClick }" abstract>
<n-button
@ -132,7 +132,7 @@
</n-icon>
</template>
</n-button>
</n-upload-trigger>
</n-upload-trigger> -->
<n-button
quaternary

@ -69,6 +69,13 @@ import {
WalletOutline,
SettingsOutline,
LogOutOutline,
CaretUpCircleSharp,
LinkOutline,
PersonOutline,
PlanetOutline,
RocketOutline,
TodayOutline,
NewspaperOutline,
} from '@vicons/ionicons5';
import { Hash } from '@vicons/tabler';
import { getUnreadMsgCount } from '@/api/user';
@ -122,69 +129,69 @@ onMounted(() => {
const menuOptions = computed(() => {
const options = [
{
label: '广',
label: '',
key: 'home',
icon: () => h(HomeOutline),
icon: () => h(PlanetOutline),
href: '/',
},
{
label: '',
label: '',
key: 'topic',
icon: () => h(Hash),
icon: () => h(NewspaperOutline),
href: '/topic',
},
];
if (import.meta.env.VITE_ENABLE_ANOUNCEMENT.toLowerCase() === 'true') {
options.push( {
label: '',
label: '',
key: 'anouncement',
icon: () => h(MegaphoneOutline),
icon: () => h(RocketOutline),
href: '/anouncement',
});
}
options.push({
label: '',
label: '',
key: 'profile',
icon: () => h(LeafOutline),
icon: () => h(HomeOutline),
href: '/profile',
});
options.push({
label: '',
label: '',
key: 'messages',
icon: () => h(ChatbubblesOutline),
href: '/messages',
})
options.push({
label: '',
key: 'collection',
icon: () => h(BookmarksOutline),
href: '/collection',
});
options.push({
label: '',
key: 'contacts',
icon: () => h(PeopleOutline),
href: '/contacts',
});
// options.push({
// label: '收藏',
// key: 'collection',
// icon: () => h(BookmarksOutline),
// href: '/collection',
// });
// options.push({
// label: '好友',
// key: 'contacts',
// icon: () => h(PeopleOutline),
// href: '/contacts',
// });
if (import.meta.env.VITE_ENABLE_WALLET.toLocaleLowerCase() === 'true') {
options.push({
label: '',
label: '',
key: 'wallet',
icon: () => h(WalletOutline),
icon: () => h(TodayOutline),
href: '/wallet',
});
}
options.push({
label: '',
label: '',
key: 'setting',
icon: () => h(SettingsOutline),
icon: () => h(PersonOutline),
href: '/setting',
});
options.push({
label: '',
label: '',
key: 'sharekey',
icon: () => h(SettingsOutline),
icon: () => h(LinkOutline),
href: '/sharekey',
});
@ -192,15 +199,15 @@ const menuOptions = computed(() => {
? options
: [
{
label: '广',
label: '',
key: 'home',
icon: () => h(HomeOutline),
icon: () => h(PlanetOutline),
href: '/',
},
{
label: '',
label: '',
key: 'topic',
icon: () => h(Hash),
icon: () => h(NewspaperOutline),
href: '/topic',
},
];

@ -60,10 +60,8 @@ declare module NetParams {
//获取用户分享码请求参数
interface UserGetShareKeys {
userId : number;
userName : string;
// page: number;
// page_size: number;
page: number;
page_size: number;
}
//删除用户分享码请求参数

@ -65,7 +65,7 @@ declare module NetReq {
//用户获取分享码响应参数
interface UserGetShareKeys {
shareKeys: Item.ShareKeyProps[];
list: Item.ShareKeyProps[];
/** 页码信息 */
pager: Item.PagerProps;
}

@ -55,7 +55,7 @@ const page = ref(+(route.query.p as string) || 1);
const pageSize = ref(20);
const totalPage = ref(0);
const title = computed(() => {
let t = 'AIMO';
let t = 'Aimo Community';
if (route.query && route.query.q) {
if (route.query.t && route.query.t === 'tag') {

@ -8,6 +8,16 @@
<n-statistic style="color:black; font-weight:bold;"></n-statistic>
</div>
</div>
<template #footer>
<div class="pagination-wrap" v-if="totalPage > 1">
<n-pagination
:page="page"
@update:page="updatePage"
:page-slot="!store.state.collapsedRight ? 8 : 5"
:page-count="totalPage"
/>
</div>
</template>
<div v-if="loading" class="skeleton-wrap">
<post-skeleton :num="pageSize" />
@ -21,7 +31,23 @@
<div class="bill-line">
<div>{{ sharekey.share_key }}</div>
<div>{{ sharekey.name }}</div>
<div>{{ sharekey.description }}</div>
<!-- <div>{{ sharekey.description }}</div> -->
<div>
<span
class="truncated-content"
@mouseover="showFullContent(sharekey.share_key)"
@mouseleave="hideFullContent"
>
{{ truncatedDescription(sharekey.description) }}
</span>
<!-- -->
<div
class="popover-content"
v-show="showFullContentId === sharekey.share_key"
>
{{ sharekey.description }}
</div>
</div>
<n-button
size="small"
secondary
@ -45,7 +71,7 @@
<div class="amount-options" v-if="rechargeQrcode.length === 0">
<div v-if="selectedShareKey !== null" class="amount-options">
<n-space align="baseline">
<div>{{ selectedShareKey.share_key }}</div>
<div> {{selectedShareKey.name}} {{ selectedShareKey.share_key }}</div>
</n-space>
</div>
</div>
@ -77,6 +103,7 @@ import { useStore } from 'vuex';
import { useRoute } from 'vue-router';
import { getShareKeys, deleteThisShareKey } from '@/api/shareKey';
const store = useStore();
const route = useRoute();
const showRecharge = ref(false);
const rechargeQrcode = ref('');
@ -84,18 +111,24 @@ const loading = ref(false);
// 获取 ShareKey
const shareKeys = ref<Item.ShareKeyProps[]>([]);
const selectedShareKey = ref<Item.ShareKeyProps | null>(null);
const showFullContentId = ref<string | null>(null);
const page = ref(+(route.query.p as string) || 1);
const pageSize = ref(20);
const pageSize = ref(5);
const totalPage = ref(0);
const loadKeys = () => {
loading.value = true;
const token = localStorage.getItem('PAOPAO_TOKEN') || '';
if(token) {
getShareKeys(token)
const params: NetParams.UserGetShareKeys = {
page: page.value,
page_size: pageSize.value,
}
getShareKeys(params, token)
.then((rsp) => {
loading.value = false;
shareKeys.value = rsp.shareKeys;
shareKeys.value = rsp.list;
totalPage.value = Math.ceil(rsp.pager.total_rows / pageSize.value);
window.scrollTo(0, 0);
})
.catch((err) => {
@ -130,16 +163,69 @@ const deleteShareKey = (keyToDelete: string) => {
}
showRecharge.value = false;
};
// const updatePage = (p: number) => {
// page.value = p;
// loadPosts();
// };
const updatePage = (p: number) => {
page.value = p;
loadKeys();
};
const showFullContent = (shareKeyId: string) => {
showFullContentId.value = shareKeyId;
};
const hideFullContent = () => {
showFullContentId.value = null;
};
const truncatedDescription = (description: string) => {
const maxLength = 6;
if (description.length <= maxLength) {
return description;
}
return `${description.slice(0, maxLength)}...`;
};
onMounted(() => {
loadKeys();
});
</script>
<style lang="less" scoped>
.popover-content {
position: absolute;
background-color: #fff; /* 白色背景 */
color: #000; /* 弹出框文字颜色 */
padding: 8px; /* 弹出框内边距 */
border-radius: 4px; /* 弹出框边框圆角 */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* 弹出框阴影效果 */
max-width: 200px; /* 弹出框最大宽度 */
white-space: pre-wrap; /* 弹出框内容换行 */
z-index: 999; /* 设置弹出框显示在文字上方,值越大显示越靠上 */
/* 创建气泡三角形 */
&::before {
content: '';
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -8px; /* 三角形的位置在弹出框中心 */
border-width: 8px;
border-style: solid;
border-color: transparent transparent #fff transparent; /* 透明 上方白色 透明 透明 */
}
}
/* 鼠标悬浮时显示弹出框 */
.truncated-content:hover + .popover-content {
display: block;
}
/* 隐藏弹出框 */
.popover-content {
display: none;
}
.balance-wrap {
padding: 16px;

Loading…
Cancel
Save