Compare commits

..
28 Commits
Author SHA1 Message Date
v03413 eeb7ac1f79 fix: update pnpm version in Dockerfile
现在 pnpm 已经更新到v11, v10 和 v11 有兼容问题;懒得折腾,先这样吧。
2026-05-12 15:27:19 +08:00
莫名 468fe8b0c2 Merge pull request #191 from betaxab/pr-update-packages
update: web: update package
2026-05-11 08:53:28 +08:00
betaxab 48b7c0b414 update: web: update package
Update packages using pnpm up
Remove unexpected color schemes from the chart
Update the Stylelint config to match the upstream changes
2026-05-10 22:53:52 +08:00
v03413 c8304a05cd chore: update golang version & rename Dockerfile
fix: https://github.com/v03413/BEpusdt/actions/runs/25508875970/job/74861939552
2026-05-08 09:17:22 +08:00
莫名 34127df014 Merge pull request #190 from betaxab/pr-update-dependencies
Update dependencies
2026-05-07 20:32:50 +08:00
betaxab f4a225baea update: upgrade to Go 1.26.2 && upgrade dependencies 2026-05-07 01:21:09 +08:00
betaxab 126905400d update: Update dependencies based on upstream changes
update: git ignore static/secure folder
remove: mock data
remove: vite-plugin-eslint plugin
update: follow the upstream updates for Vite 7
fix: Chart rendering issue in dark mode
2026-05-07 01:20:55 +08:00
莫名 89bd4caba4 Merge pull request #189 from betaxab/pr-standardize-line-endings
misc: Unify line endings to Unix LF format
2026-05-06 13:39:05 +08:00
betaxab c84ca4ab30 misc: Unify line endings to Unix LF format
by run:
find . -type f -exec dos2unix {} +

find:
find . -type f -exec file {} + | grep "CRLF"
2026-05-06 11:18:40 +08:00
莫名 3be13ebb6f Merge pull request #187 from betaxab/pr-enhanced-dashboard
feat: dashboard: Enhanced dashboard displays more statistics
2026-05-06 08:45:02 +08:00
莫名 584998bf02 Merge pull request #188 from betaxab/pr-mobile-optimization
style: Optimize web pages for mobile devices
2026-05-06 08:44:50 +08:00
betaxab f14a7680af style: Optimize web pages for mobile devices 2026-05-05 20:52:31 +08:00
betaxab cd6994d611 feat: dashboard: Enhanced dashboard displays more statistics 2026-05-05 20:06:06 +08:00
莫名 64ab143e0e Merge pull request #186 from betaxab/pr-fix-order-notify-slow-query
perf: add order notify retry index
2026-05-05 18:03:18 +08:00
莫名 8525dd4722 Merge pull request #185 from betaxab/pr-optimize-night-mode
style: Optimize night mode display
2026-05-05 18:03:02 +08:00
betaxab 90e672f7f8 style: Optimize night mode display 2026-05-02 18:30:33 +08:00
betaxab cb5aed93c6 perf: add order notify retry index 2026-05-02 17:18:05 +08:00
v03413 e46706370c refactor: optimize type casting and formatting logic
fix: https://github.com/v03413/BEpusdt/issues/184
2026-04-30 22:27:25 +08:00
莫名 34e7dc6b81 Merge pull request #183 from 34892002/edge-key
docs: 添加 EdgeKey 对接文档
2026-04-30 20:55:00 +08:00
ggyy 5a0d333f71 feat: 新增项目对接说明 2026-04-30 18:43:21 +08:00
莫名 9f89015722 Merge pull request #182 from betaxab/pr-minor-update
update: minor adjustments to order confirmation
2026-04-29 21:39:06 +08:00
betaxab 609a850e61 update: minor adjustments to order confirmation 2026-04-29 18:52:19 +08:00
莫名 43614ee3c5 Merge pull request #181 from betaxab/pr-zoom-in-page
style: Enlarge the entire page by about 20%
2026-04-27 17:07:27 +08:00
betaxab a603e201c1 style: Enlarge the entire page by about 20% 2026-04-27 16:43:07 +08:00
莫名 4081e7e5ab Merge pull request #180 from betaxab/pr-try-to-fix-tron-task
fix: Try to resolve the failed queue blocking web issue in Tron
2026-04-27 09:11:28 +08:00
betaxab 17b0d1cad1 fix: Try to resolve the failed queue blocking web issue in Tron 2026-04-27 08:48:58 +08:00
莫名 742d05d253 Merge pull request #179 from luoyanglang/wolf/web-dayjs-direct-dependency
fix(web): declare dayjs dependency
2026-04-26 19:56:17 +08:00
Codex 1b0df627a5 fix(web): declare dayjs dependency 2026-04-26 11:24:52 +00:00
154 changed files with 12780 additions and 15744 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ jobs:
with:
node-version: '25'
- name: Install pnpm
run: npm install -g pnpm
run: npm install -g pnpm@10
- name: Install frontend dependencies
working-directory: ./web
run: pnpm install --frozen-lockfile --shamefully-hoist
@@ -40,7 +40,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.4'
go-version: '1.26.2'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
+2 -1
View File
@@ -7,4 +7,5 @@ conf.toml
# Added by goreleaser init:
dist/
static/web
*.log
static/secure
*.log
+1 -1
View File
@@ -64,7 +64,7 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
- 安装:[Docker](docs/docker/docker.md) [Linux](docs/linux/install.md) [1Panel](./docs/1panel/README.md) [宝塔](./docs/bt_panel/README.md)
- 开发:[API对接](docs/api/api.md) [订单回调](docs/notify/readme.md) [Python](https://github.com/luoyanglang/bepusdt-python-sdk) [PHP](https://github.com/v03413/bepusdt-php-sdk)
- 对接:[独角Next](docs/api/dujiao-next/dujiao-next.md) [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) [whmcs](https://github.com/v03413/whmcs-gateway-epusdt) [其它](docs/api/other.md)
- 对接:[独角Next](docs/api/dujiao-next/dujiao-next.md) [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) [whmcs](https://github.com/v03413/whmcs-gateway-epusdt) [EdgeKey](docs/api/edge-key/edge-key.md) [其它](docs/api/other.md)
- 其它:[https 配置](./docs/ssl.md) [时钟同步](docs/linux/systemd-timesyncd.md) [收银台修改](docs/payment-template/README.md)
## 🖼 功能截图
+227 -29
View File
@@ -1,19 +1,37 @@
package admin
import (
"errors"
"fmt"
"time"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
"github.com/spf13/cast"
"github.com/v03413/bepusdt/app/handler/base"
"github.com/v03413/bepusdt/app/model"
"github.com/v03413/go-cache"
)
type Dashboard struct {
}
type homeReq struct {
Fiat string `json:"fiat" binding:"required"`
Fiat string `json:"fiat" binding:"required"`
Range string `json:"range"`
TZ string `json:"tz"`
From string `json:"from"`
To string `json:"to"`
Force bool `json:"force"`
}
type dashboardPoint struct {
Date string `json:"date"`
OrdersTotal int64 `json:"orders_total"`
OrdersPaid int64 `json:"orders_paid"`
OrdersSuccess int64 `json:"orders_success"`
OrdersFailed int64 `json:"orders_failed"`
GMVPaid string `json:"gmv_paid"`
}
func (Dashboard) Home(ctx *gin.Context) {
@@ -24,13 +42,33 @@ func (Dashboard) Home(ctx *gin.Context) {
return
}
var rows = make([]model.Order, 0)
model.Db.Where("fiat = ? and status = ?", req.Fiat, model.OrderStatusSuccess).Find(&rows)
rangeKey, from, to, loc, err := resolveDashboardRange(req)
if err != nil {
base.BadRequest(ctx, err.Error())
var today = time.Now().Format("2006-01-02")
var totalMoney, todayMoney float64
var totalCount, todayCount int64
var monthly = make(map[string]float64)
return
}
cacheKey := dashboardCacheKey(req.Fiat, rangeKey, loc.String(), from, to)
if !req.Force {
if data, ok := cache.Get(cacheKey); ok {
base.Ok(ctx, data)
return
}
}
data := buildDashboardHome(req, rangeKey, from, to, loc)
cache.Set(cacheKey, data, dashboardCacheTTL(rangeKey, to, loc))
base.Ok(ctx, data)
}
func buildDashboardHome(req homeReq, rangeKey string, from, to time.Time, loc *time.Location) gin.H {
var rows = make([]model.Order, 0)
model.Db.Where("fiat = ? and created_at >= ? and created_at <= ?", req.Fiat, from, to).Find(&rows)
var totalCount, pendingCount, confirmingCount, successCount, expiredCount, failedCount, notifyFailedCount int64
gmvPaid := decimal.Zero
var tokenMap = map[model.Crypto]float64{
model.USDT: 0,
model.USDC: 0,
@@ -38,38 +76,198 @@ func (Dashboard) Home(ctx *gin.Context) {
model.BNB: 0,
model.ETH: 0,
}
points := make([]dashboardPoint, 0)
pointMap := make(map[string]int)
for day := dayStart(from, loc); !day.After(dayStart(to, loc)); day = day.AddDate(0, 0, 1) {
date := day.Format("2006-01-02")
point := dashboardPoint{
Date: date,
GMVPaid: "0.00",
}
points = append(points, point)
pointMap[date] = len(points) - 1
}
for _, itm := range rows {
money := cast.ToFloat64(itm.Money)
totalMoney += money
totalCount++
if itm.CreatedAt.Format("2006-01-02") == today {
todayMoney += money
todayCount++
createdAt := time.Now().In(loc)
if itm.CreatedAt != nil {
createdAt = time.Time(*itm.CreatedAt).In(loc)
}
date := createdAt.Format("2006-01-02")
pointIndex, ok := pointMap[date]
if !ok {
continue
}
point := &points[pointIndex]
if crypto, err := model.GetCrypto(itm.TradeType); err == nil {
point.OrdersTotal++
switch itm.Status {
case model.OrderStatusWaiting:
pendingCount++
case model.OrderStatusConfirming:
confirmingCount++
case model.OrderStatusExpired:
expiredCount++
case model.OrderStatusSuccess:
successCount++
point.OrdersSuccess++
point.OrdersPaid++
money, _ := decimal.NewFromString(itm.Money)
gmvPaid = gmvPaid.Add(money)
pointMoney, _ := decimal.NewFromString(point.GMVPaid)
point.GMVPaid = pointMoney.Add(money).Round(2).StringFixed(2)
crypto := itm.Crypto
if crypto == "" {
if tradeCrypto, err := model.GetCrypto(itm.TradeType); err == nil {
crypto = tradeCrypto
}
}
if _, ok := tokenMap[crypto]; !ok {
tokenMap[crypto] = 0
}
tokenAmount := cast.ToFloat64(itm.Amount)
if tokenAmount == 0 {
tokenAmount = cast.ToFloat64(itm.Money)
}
tokenMap[crypto] += tokenAmount
tokenMap[crypto] += money
if itm.NotifyState == model.OrderNotifyStateFail {
notifyFailedCount++
}
case model.OrderStatusFailed:
failedCount++
point.OrdersFailed++
}
var month = itm.CreatedAt.Time().Format("2006/01")
if _, ok := monthly[month]; !ok {
monthly[month] = 0
}
monthly[month] += money
}
base.Ok(ctx, gin.H{
"total_money": totalMoney,
"total_count": totalCount,
"today_money": todayMoney,
"today_count": todayCount,
"token_map": tokenMap,
"monthly": monthly,
})
successRate := "0.00"
finishedCount := successCount + expiredCount + failedCount
if finishedCount > 0 {
rate := decimal.NewFromInt(successCount).Div(decimal.NewFromInt(finishedCount)).Mul(decimal.NewFromInt(100))
successRate = rate.Round(2).StringFixed(2)
}
return gin.H{
"range": rangeKey,
"from": from.In(loc).Format(time.RFC3339),
"to": to.In(loc).Format(time.RFC3339),
"timezone": loc.String(),
"currency": req.Fiat,
"kpi": gin.H{
"orders_total": totalCount,
"orders_pending": pendingCount,
"orders_confirming": confirmingCount,
"gmv_paid": gmvPaid.Round(2).StringFixed(2),
"orders_success": successCount,
"orders_failed": failedCount,
"notify_failed": notifyFailedCount,
"order_success_rate": successRate,
},
"token_map": tokenMap,
"points": points,
}
}
func dashboardCacheKey(fiat, rangeKey, timezone string, from, to time.Time) string {
return fmt.Sprintf("dashboard:home:v1:%s:%s:%s:%d:%d", fiat, rangeKey, timezone, from.Unix(), to.Unix())
}
func dashboardCacheTTL(rangeKey string, to time.Time, loc *time.Location) time.Duration {
switch rangeKey {
case "today":
return 10 * time.Second
case "30d":
return time.Minute
case "custom":
if to.Before(dayStart(time.Now().In(loc), loc)) {
return 5 * time.Minute
}
return 30 * time.Second
default:
return 30 * time.Second
}
}
func resolveDashboardRange(req homeReq) (string, time.Time, time.Time, *time.Location, error) {
loc := time.Local
if req.TZ != "" {
if loadedLoc, err := time.LoadLocation(req.TZ); err == nil {
loc = loadedLoc
}
}
rangeKey := req.Range
if rangeKey == "" {
rangeKey = "7d"
}
now := time.Now().In(loc)
switch rangeKey {
case "today":
start := dayStart(now, loc)
return rangeKey, start, dayEnd(start), loc, nil
case "30d":
yesterday := dayStart(now, loc).AddDate(0, 0, -1)
start := yesterday.AddDate(0, 0, -29)
return rangeKey, start, dayEnd(yesterday), loc, nil
case "custom":
from, err := parseDashboardDate(req.From, loc, true)
if err != nil {
return "", time.Time{}, time.Time{}, nil, err
}
to, err := parseDashboardDate(req.To, loc, false)
if err != nil {
return "", time.Time{}, time.Time{}, nil, err
}
if to.Before(from) {
return "", time.Time{}, time.Time{}, nil, errors.New("自定义统计周期结束时间不能早于开始时间")
}
return rangeKey, from, to, loc, nil
case "7d":
fallthrough
default:
yesterday := dayStart(now, loc).AddDate(0, 0, -1)
start := yesterday.AddDate(0, 0, -6)
return "7d", start, dayEnd(yesterday), loc, nil
}
}
func parseDashboardDate(value string, loc *time.Location, start bool) (time.Time, error) {
if value == "" {
return time.Time{}, errors.New("请选择自定义统计周期")
}
layouts := []string{time.RFC3339, "2006-01-02 15:04:05", "2006-01-02"}
for _, layout := range layouts {
t, err := time.ParseInLocation(layout, value, loc)
if err != nil {
continue
}
if layout == "2006-01-02" {
if start {
return dayStart(t, loc), nil
}
return dayEnd(t), nil
}
return t.In(loc), nil
}
return time.Time{}, errors.New("自定义统计周期格式错误")
}
func dayStart(t time.Time, loc *time.Location) time.Time {
local := t.In(loc)
return time.Date(local.Year(), local.Month(), local.Day(), 0, 0, 0, 0, loc)
}
func dayEnd(t time.Time) time.Time {
start := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
return start.Add(24*time.Hour - time.Nanosecond)
}
+6 -1
View File
@@ -201,10 +201,11 @@ func (Order) Paid(ctx *gin.Context) {
return
}
confirmedAt := time.Now()
var update = map[string]interface{}{
"ref_hash": req.RefHash,
"status": model.OrderStatusSuccess,
"confirmed_at": model.Datetime(time.Now()),
"confirmed_at": model.Datetime(confirmedAt),
}
err := model.Db.Model(&order).Updates(update).Error
@@ -214,6 +215,10 @@ func (Order) Paid(ctx *gin.Context) {
return
}
order.RefHash = req.RefHash
order.Status = model.OrderStatusSuccess
order.ConfirmedAt = &confirmedAt
go notify.Handle(order)
base.Ok(ctx, "操作成功")
+10 -5
View File
@@ -65,13 +65,13 @@ type Order struct {
Address string `gorm:"column:address;type:varchar(128);index;not null;comment:收款地址" json:"address"`
FromAddress string `gorm:"column:from_address;type:varchar(128);not null;default:'';comment:支付地址" json:"from_address"`
AddressLocked bool `gorm:"column:address_locked;not null;default:false;comment:地址锁定 1:独占 0:共享" json:"address_locked"`
Status int `gorm:"column:status;not null;default:1;index;comment:交易状态" json:"status"`
Status int `gorm:"column:status;not null;default:1;index;index:idx_order_notify_retry,priority:1;comment:交易状态" json:"status"`
Name string `gorm:"column:name;type:varchar(64);not null;default:'';comment:商品名称" json:"name"`
ApiType string `gorm:"column:api_type;type:varchar(20);not null;default:'epusdt';comment:API类型" json:"api_type"`
ReturnUrl string `gorm:"column:return_url;type:varchar(255);not null;default:'';comment:同步地址" json:"return_url"`
NotifyUrl string `gorm:"column:notify_url;type:varchar(255);not null;default:'';comment:异步地址" json:"notify_url"`
NotifyNum int `gorm:"column:notify_num;not null;default:0;comment:回调次数" json:"notify_num"`
NotifyState int `gorm:"column:notify_state;not null;default:0;comment:回调状态 1:成功 0:失败" json:"notify_state"`
NotifyNum int `gorm:"column:notify_num;not null;default:0;index:idx_order_notify_retry,priority:3;comment:回调次数" json:"notify_num"`
NotifyState int `gorm:"column:notify_state;not null;default:0;index:idx_order_notify_retry,priority:2;comment:回调状态 1:成功 0:失败" json:"notify_state"`
RefHash string `gorm:"column:ref_hash;type:varchar(128);not null;default:'';index;comment:交易哈希" json:"ref_hash"`
RefBlockNum int `gorm:"column:ref_block_num;not null;default:0;comment:区块索引" json:"ref_block_num"`
ExpiredAt time.Time `gorm:"column:expired_at;not null;comment:失效时间" json:"expired_at"`
@@ -180,9 +180,14 @@ func GetOrderByStatus(Status int) []Order {
func GetNotifyFailedTradeOrders() ([]Order, error) {
var orders []Order
maxRetry := cast.ToInt(GetC(NotifyMaxRetry))
if maxRetry <= 0 {
maxRetry = cast.ToInt(defaultConf[NotifyMaxRetry])
}
res := Db.Where("status = ?", OrderStatusSuccess).
Where("notify_num <= ?", GetC(NotifyMaxRetry)).
Where("notify_state = ?", OrderNotifyStateFail).Find(&orders)
Where("notify_state = ?", OrderNotifyStateFail).
Where("notify_num <= ?", maxRetry).Find(&orders)
return orders, res.Error
}
+1 -1
View File
@@ -396,7 +396,7 @@ func (e *evm) tradeConfirmHandle(ctx context.Context) {
if !ok {
return
}
if last.(int)-o.RefBlockNum < e.Block.ConfirmedOffset {
if cast.ToInt(last)-o.RefBlockNum < e.Block.ConfirmedOffset {
return
}
}
+7
View File
@@ -6,6 +6,7 @@ import (
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model"
"github.com/v03413/bepusdt/app/notifier"
"github.com/v03413/bepusdt/app/task/notify"
"github.com/v03413/bepusdt/app/utils"
)
@@ -37,3 +38,9 @@ func notifyRoll(context.Context) {
notify.Bepusdt(o)
}
}
// notifyOrderSuccess 统一触发订单成功后的回调与订单通知。
func notifyOrderSuccess(order model.Order) {
go notify.Handle(order)
go notifier.Success(order)
}
+1 -3
View File
@@ -227,9 +227,7 @@ func tronResourceHandle(ctx context.Context) {
func markFinalConfirmed(o model.Order) {
o.SetSuccess()
go notify.Handle(o) // 订单回调
go notifier.Success(o) // 消息通知
notifyOrderSuccess(o)
}
func getAllWaitingOrders() map[string][]model.Order {
+83 -8
View File
@@ -37,6 +37,9 @@ type tron struct {
blockScanQueue *chanx.UnboundedChan[int]
conn map[string]*grpc.ClientConn
connMu sync.RWMutex
retryMu sync.Mutex
retryAttempts map[int]int
retryScheduled map[int]*time.Timer
}
var tr tron
@@ -54,6 +57,8 @@ func newTron() tron {
blockConfirmedOffset: 30,
blockScanQueue: chanx.NewUnboundedChan[int](context.Background(), 30),
conn: make(map[string]*grpc.ClientConn),
retryAttempts: make(map[int]int),
retryScheduled: make(map[int]*time.Timer),
}
}
@@ -138,7 +143,7 @@ func (t *tron) syncBlocksBackward(now int) {
}()
}
func (t *tron) blockDispatch(context.Context) {
func (t *tron) blockDispatch(ctx context.Context) {
p, err := ants.NewPoolWithFunc(2, t.blockParse)
if err != nil {
log.Task.Warn("Error creating pool:", err)
@@ -148,11 +153,19 @@ func (t *tron) blockDispatch(context.Context) {
defer p.Release()
for n := range t.blockScanQueue.Out {
if err := p.Invoke(n); err != nil {
t.blockScanQueue.In <- n
for {
select {
case <-ctx.Done():
return
case n, ok := <-t.blockScanQueue.Out:
if !ok {
return
}
if err := p.Invoke(n); err != nil {
t.scheduleBlockRetry(n, 0)
log.Task.Warn("Tron Error invoking process block:", err)
log.Task.Warn("Tron Error invoking process block:", err)
}
}
}
}
@@ -168,19 +181,20 @@ func (t *tron) blockParse(n any) {
return
}
conf.RecordSuccess(conf.Tron)
var ctx, cancel = context.WithTimeout(context.Background(), time.Second*5)
bok, err2 := api.NewWalletClient(conn).GetBlockByNum2(ctx, &api.NumberMessage{Num: int64(num)})
cancel()
if err2 != nil {
conf.RecordFailure(conf.Tron)
t.blockScanQueue.In <- int(num)
t.scheduleBlockRetry(num, 0)
log.Task.Warn("GetBlockByNum2 ", err2)
return
}
conf.RecordSuccess(conf.Tron)
t.resetBlockRetry(num)
var resources = make([]resource, 0)
var transfers = make([]transfer, 0)
var timestamp = time.UnixMilli(bok.GetBlockHeader().GetRawData().GetTimestamp())
@@ -495,6 +509,67 @@ func (t *tron) syncBreak() bool {
return true
}
func (t *tron) scheduleBlockRetry(num int, delay time.Duration) {
t.retryMu.Lock()
if _, ok := t.retryScheduled[num]; ok {
t.retryMu.Unlock()
return
}
attempt := t.retryAttempts[num] + 1
t.retryAttempts[num] = attempt
if delay <= 0 {
delay = tronRetryDelay(attempt)
}
var timer *time.Timer
timer = time.AfterFunc(delay, func() {
t.retryMu.Lock()
if t.retryScheduled[num] != timer {
t.retryMu.Unlock()
return
}
delete(t.retryScheduled, num)
t.retryMu.Unlock()
if t.blockScanQueue.Len() >= blockQueueLimit {
log.Task.Warn("Tron 重试延后,当前区块消费堆积数量:", t.blockScanQueue.Len())
t.scheduleBlockRetry(num, delay)
return
}
t.blockScanQueue.In <- num
})
t.retryScheduled[num] = timer
t.retryMu.Unlock()
}
func (t *tron) resetBlockRetry(num int) {
t.retryMu.Lock()
defer t.retryMu.Unlock()
delete(t.retryAttempts, num)
if timer, ok := t.retryScheduled[num]; ok {
timer.Stop()
delete(t.retryScheduled, num)
}
}
func tronRetryDelay(attempt int) time.Duration {
if attempt < 1 {
attempt = 1
}
if attempt > 5 {
attempt = 5
}
return time.Duration(1<<uint(attempt-1)) * 5 * time.Second
}
func (t *tron) client() (*grpc.ClientConn, error) {
var endpoint = model.Endpoint(conf.Tron)
+2 -2
View File
@@ -1,7 +1,7 @@
FROM node:25.2.1 AS web_builder
# 安装 pnpm
RUN npm install -g pnpm
RUN npm install -g pnpm@10
WORKDIR /web
COPY web/package.json web/pnpm-lock.yaml ./
@@ -11,7 +11,7 @@ RUN pnpm install --frozen-lockfile --shamefully-hoist
COPY web/ ./
RUN pnpm run build:prod
FROM golang:1.24.3-alpine3.20 AS builder
FROM golang:1.26.2-alpine3.23 AS builder
ENV GO111MODULE=on
WORKDIR /go/release
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+79
View File
@@ -0,0 +1,79 @@
# EdgeKey 对接 BEpusdt 教程
**当前教程对接BEpusdt(v1.23.5)通过测试验收**
## 配置步骤
**配置说明**
- **网关地址**:只需填写域名,如 `https://test.shop.com`,系统会自动拼接 API 路径(`/api/v1/order/create-order`)。
- **App ID 和 App Secret**:在 BEpusdt 后台「系统管理 → 基本设置 → API 设置」中获取。
- **支付币种**:用户在 BEpusdt 收银台页面自由选择支付币种,具体在 BEpusdt 后台配置。
**配置步骤示例**:
1. 登录 EdgeKey 管理后台
2. 进入「支付配置」页面
3. 选择 BEpusdt 标签页
4. 填写具体配置
5. 启用支付方式:点击右上角的启用开关
6. 保存配置:点击「保存配置」按钮
![支付配置](./1.jpg)
### 重要提示
填写完配置信息后,点击右上角的 **启用** 开关,然后点击 **保存配置** 按钮。
⚠️ **重要提示**:启用支付前,请先前往「站点设置」配置网站地址,否则无法获取支付结果。
![网站地址配置](./2.jpg)
## 配置字段说明
**通用字段说明**:
- **显示名称**:支付方式在前台显示的名称,用户可自定义
- **网关地址**:支付网关服务域名,系统会自动处理接口路径
- **Notify URL**:异步通知地址,支付完成后系统会回调此地址
- **Return URL**:同步回跳地址,用户支付完成后跳转的页面
**BEpusdt专用字段**:
- **App ID**:BEpusdt后台获取的应用ID
- **App Secret**:BEpusdt后台获取的应用密钥(API密钥)
## 异步通知地址和同步回跳地址
这两个地址的路由部分 **严格按要求填写**,只需将域名部分替换为您实际部署的 EdgeKey 服务器地址:
- **异步通知地址**:`/api/payments/bepusdt/notify`
- 路由固定为 `/api/payments/bepusdt/notify`
- 示例:若部署地址为 `https://example.com`,则填写 `/api/payments/bepusdt/notify`
- **同步回跳地址**:`/order/{orderNo}?token={token}`
- 路由固定为 `/order/{orderNo}?token={token}`(`:orderNo` 和 `{token}` 为动态参数)
- 示例:若部署地址为 `https://example.com`,则填写 `/order/{orderNo}?token={token}`
## 配置验证
配置完成后,请按照以下步骤进行测试:
1. 进入 EdgeKey 前台,选择一个商品进行购买。
2. 在结算页面选择 BEpusdt 支付方式。
3. 观察是否正常跳转到收银台页面。
## 故障排查
若出现网关错误提示,请按照以下步骤排查:
- **检查网络连通性**:确认 EdgeKey 服务器能够正常访问 BEpusdt API 地址。
- **检查 App ID 和 App Secret**:确认所配置的 App ID 和 App Secret 与 BEpusdt 中的一致。
- **检查回调地址**:确保异步通知地址可以从外部访问,且格式正确。
- **检查站点设置**:确保在「站点设置」中配置了正确的网站地址。
- **查看日志**:检查 EdgeKey 和 BEpusdt 的应用日志,获取更详细的错误信息。
## BEpusdt 工作模式
本项目使用 **收银台模式**(`/api/v1/order/create-order`),用户在 BEpusdt 收银台页面自由选择支付链,无需在代码中指定 `trade_type`。
## 相关链接
- [BEpusdt 项目主页](https://github.com/v03413/bepusdt)
- [EdgeKey 项目主页](https://github.com/34892002/edgeKey)
+1
View File
@@ -21,4 +21,5 @@
- [WHMCS](https://github.com/v03413/whmcs-gateway-epusdt)
- [异次元发卡](acg-faka/README.md)
- [萌次元商城](./mcy-faka/mcy-shop.md)
- [EdgeKey](./edge-key/edge-key.md)
+42 -38
View File
@@ -1,49 +1,51 @@
module github.com/v03413/bepusdt
go 1.24.3
go 1.26.2
require (
github.com/btcsuite/btcd/btcutil v1.1.6
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/eclipse/paho.mqtt.golang v1.5.1
github.com/gin-contrib/sessions v1.0.4
github.com/gin-gonic/gin v1.10.1
github.com/gin-contrib/sessions v1.1.0
github.com/gin-gonic/gin v1.12.0
github.com/glebarez/sqlite v1.11.0
github.com/go-telegram/bot v1.17.0
github.com/go-telegram/bot v1.20.0
github.com/joho/godotenv v1.5.1
github.com/matoous/go-nanoid/v2 v2.1.0
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/panjf2000/ants/v2 v2.11.3
github.com/panjf2000/ants/v2 v2.12.0
github.com/shopspring/decimal v1.4.0
github.com/sirupsen/logrus v1.9.3
github.com/sirupsen/logrus v1.9.4
github.com/smallnest/chanx v1.2.0
github.com/spf13/cast v1.9.2
github.com/spf13/cast v1.10.0
github.com/tidwall/gjson v1.18.0
github.com/urfave/cli/v3 v3.5.0
github.com/urfave/cli/v3 v3.8.0
github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158
golang.org/x/crypto v0.42.0
google.golang.org/grpc v1.73.0
golang.org/x/crypto v0.50.0
google.golang.org/grpc v1.81.0
gorm.io/driver/mysql v1.6.0
gorm.io/driver/postgres v1.6.0
gorm.io/gorm v1.31.1
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
filippo.io/edwards25519 v1.2.0 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/bytedance/sonic v1.13.3 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/bytedance/gopkg v0.1.4 // indirect
github.com/bytedance/sonic v1.15.1 // indirect
github.com/bytedance/sonic/loader v0.5.1 // indirect
github.com/cloudwego/base64x v0.1.7 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
github.com/gin-contrib/sse v1.1.1 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect
github.com/go-sql-driver/mysql v1.9.3 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/go-playground/validator/v10 v10.30.2 // indirect
github.com/go-sql-driver/mysql v1.10.0 // indirect
github.com/goccy/go-json v0.10.6 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
@@ -51,38 +53,40 @@ require (
github.com/gorilla/websocket v1.5.3 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.6.0 // indirect
github.com/jackc/pgx/v5 v5.9.2 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pelletier/go-toml/v2 v2.3.1 // indirect
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.59.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.14 // indirect
golang.org/x/arch v0.18.0 // indirect
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.33.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
google.golang.org/protobuf v1.36.6 // indirect
github.com/ugorji/go/codec v1.3.1 // indirect
go.mongodb.org/mongo-driver/v2 v2.6.0 // indirect
golang.org/x/arch v0.26.0 // indirect
golang.org/x/net v0.53.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/tools v0.44.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.65.10 // indirect
modernc.org/libc v1.72.2 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
modernc.org/sqlite v1.38.0 // indirect
modernc.org/sqlite v1.50.0 // indirect
)
+122 -109
View File
@@ -1,5 +1,5 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
@@ -27,14 +27,16 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0=
github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
github.com/bytedance/gopkg v0.1.4/go.mod h1:v1zWfPm21Fb+OsyXN2VAHdL6TBb2L88anLQgdyje6R4=
github.com/bytedance/sonic v1.15.1 h1:nJD5PmM0vY7J8CT6MxoqbVAAMhkSmV2HgRAUrrpLoOw=
github.com/bytedance/sonic v1.15.1/go.mod h1:mT2NbXunuaEbnZ+mRIX/vYqKISmgEuHFDI4UzmKx2SA=
github.com/bytedance/sonic/loader v0.5.1 h1:Ygpfa9zwRCCKSlrp5bBP/b/Xzc3VxsAW+5NIYXrOOpI=
github.com/bytedance/sonic/loader v0.5.1/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudwego/base64x v0.1.7 h1:NppS+Fgzg5ovhn4NkUXaDT3x9jldgH5ToMCqzBSi2zI=
github.com/cloudwego/base64x v0.1.7/go.mod h1:Cu1PV9zfrSf7ET2tIbWbbEy7jO7HHJ13q4X2SQ8aWYg=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -50,20 +52,20 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
github.com/gin-contrib/sessions v1.0.4 h1:ha6CNdpYiTOK/hTp05miJLbpTSNfOnFg5Jm2kbcqy8U=
github.com/gin-contrib/sessions v1.0.4/go.mod h1:ccmkrb2z6iU2osiAHZG3x3J4suJK+OU27oqzlWOqQgs=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gin-contrib/sessions v1.1.0 h1:00mhHfNEGF5sP2fwxa98aRqj1FOJdL6IkR86n2hOiBo=
github.com/gin-contrib/sessions v1.1.0/go.mod h1:TyYZDIs6qCQg2SOoYPgMT9pAkmZceVNEJMcv5qbIy60=
github.com/gin-contrib/sse v1.1.1 h1:uGYpNwTacv5R68bSGMapo62iLTRa9l5zxGCps4hK6ko=
github.com/gin-contrib/sse v1.1.1/go.mod h1:QXzuVkA0YO7o/gun03UI1Q+FTI8ZV/n5t03kIQAI89s=
github.com/gin-gonic/gin v1.12.0 h1:b3YAbrZtnf8N//yjKeU2+MQsh2mY5htkZidOM7O0wG8=
github.com/gin-gonic/gin v1.12.0/go.mod h1:VxccKfsSllpKshkBWgVgRniFFAzFb9csfngsqANjnLc=
github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
@@ -72,14 +74,16 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/go-telegram/bot v1.17.0 h1:Hs0kGxSj97QFqOQP0zxduY/4tSx8QDzvNI9uVRS+zmY=
github.com/go-telegram/bot v1.17.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/go-playground/validator/v10 v10.30.2 h1:JiFIMtSSHb2/XBUbWM4i/MpeQm9ZK2xqPNk8vgvu5JQ=
github.com/go-playground/validator/v10 v10.30.2/go.mod h1:mAf2pIOVXjTEBrwUMGKkCWKKPs9NheYGabeB04txQSc=
github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw=
github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
github.com/go-telegram/bot v1.20.0 h1:4Pea/qTidSspr4WBJw9FbHUMNhYeqszBqQUfsQEyFbc=
github.com/go-telegram/bot v1.20.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU=
github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
@@ -111,13 +115,15 @@ github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2e
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw=
github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -132,10 +138,8 @@ github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlT
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -144,8 +148,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE=
github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -153,8 +157,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -164,92 +168,100 @@ github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
github.com/panjf2000/ants/v2 v2.12.0 h1:u9JhESo83i/GkZnhfTNuFMMWcNt7mnV1bGJ6FT4wXH8=
github.com/panjf2000/ants/v2 v2.12.0/go.mod h1:tSQuaNQ6r6NRhPt+IZVUevvDyFMTs+eS4ztZc52uJTY=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=
github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY99imuIeoh8Vr0GSwAlYxPAhqZrpFc=
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg=
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/smallnest/chanx v1.2.0 h1:RLyldZBbQZ4O0dSvdkTMHo4+mDw20Bc1jXXTHf+ymZo=
github.com/smallnest/chanx v1.2.0/go.mod h1:+4nWMF0+CqEcU74SnX2NxaGqZ8zX4pcQ8Jcs77DbX5A=
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.14 h1:yOQvXCBc3Ij46LRkRoh4Yd5qK6LVOgi0bYOXfb7ifjw=
github.com/ugorji/go/codec v1.2.14/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/urfave/cli/v3 v3.5.0 h1:qCuFMmdayTF3zmjG8TSsoBzrDqszNrklYg2x3g4MSgw=
github.com/urfave/cli/v3 v3.5.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI=
github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932 h1:Z2aWpconrfks7x1QZgmxHyS5i2rXOYIvQZrzhaCOFrI=
github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932/go.mod h1:QKQ2xRbIt1CAA6767Z00YzFWXQ9ihmoIJi7A14klR2g=
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158 h1:zAlBqlv+ljSO0AOvHQo2ur/MiCZFdwMYPVf7Hu0vezE=
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158/go.mod h1:ToWfuVvvk9OTE5i0nisoXPWxVdeBdEduj7ddlwf/s9M=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
go.mongodb.org/mongo-driver/v2 v2.6.0 h1:b9sJOYrkmt4l8bY43ZenFBcPlhYIjaOfYHLtbB/5qi8=
go.mongodb.org/mongo-driver/v2 v2.6.0/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc=
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
golang.org/x/arch v0.26.0 h1:jZ6dpec5haP/fUv1kLCbuJy6dnRrfX6iVK08lZBFpk4=
golang.org/x/arch v0.26.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4=
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -259,37 +271,35 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 h1:hE3bRWtU6uceqlh4fhrSnUyjKHMKB9KrTLLG+bc0ddM=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463/go.mod h1:U90ffi8eUL9MwPcrJylN5+Mk2v3vuPDptd5yyNUiRR8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348 h1:U8orV30l6KpDsi9dxU0CoJZGbjS8EEpw+6ba+XwGPQA=
google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348/go.mod h1:Yzdzr5OOZFgSsEV2D/Xi9NL3bszpXFAg0hFJiRohcD8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 h1:pfIbyB44sWzHiCpRqIen67ZQnVXSfIxWrqUMk1qwODE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw=
google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
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=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
@@ -307,28 +317,31 @@ gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4=
gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo=
gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg=
gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
modernc.org/cc/v4 v4.26.1 h1:+X5NtzVBn0KgsBCBe+xkDC7twLb/jNVj9FPgiwSQO3s=
modernc.org/cc/v4 v4.26.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU=
modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE=
modernc.org/fileutil v1.3.3 h1:3qaU+7f7xxTUmvU1pJTZiDLAIoJVdUSSauJNHg9yXoA=
modernc.org/fileutil v1.3.3/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
modernc.org/cc/v4 v4.28.1 h1:XpLbkYVQ24E8tX5u8+yWGvaxerxkR/S4zqxI8ZoSBuc=
modernc.org/cc/v4 v4.28.1/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
modernc.org/ccgo/v4 v4.34.0 h1:yRLPFZieg532OT4rp4JFNIVcquwalMX26G95WQDqwCQ=
modernc.org/ccgo/v4 v4.34.0/go.mod h1:AS5WYMyBakQ+fhsHhtP8mWB82KTGPkNNJDGfGQCe0/A=
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
modernc.org/libc v1.65.10 h1:ZwEk8+jhW7qBjHIT+wd0d9VjitRyQef9BnzlzGwMODc=
modernc.org/libc v1.65.10/go.mod h1:StFvYpx7i/mXtBAfVOjaU0PWZOvIRoZSgXhrwXzr8Po=
modernc.org/gc/v3 v3.1.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo=
modernc.org/gc/v3 v3.1.2/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
modernc.org/libc v1.72.2 h1:HwRjrHwX7hZIFCfRyw6otVlY+BoZEHFQmHQa5B0BzDE=
modernc.org/libc v1.72.2/go.mod h1:43RZAMuEX483KwP1bW+3lTFm3dzwFpl6R8HMEutqy/w=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
modernc.org/sqlite v1.38.0 h1:+4OrfPQ8pxHKuWG4md1JpR/EYAh3Md7TdejuuzE7EUI=
modernc.org/sqlite v1.38.0/go.mod h1:1Bj+yES4SVvBZ4cBOpVZ6QgesMCKpJZDq0nxYzOpmNE=
modernc.org/sqlite v1.50.0 h1:eMowQSWLK0MeiQTdmz3lqoF5dqclujdlIKeJA11+7oM=
modernc.org/sqlite v1.50.0/go.mod h1:m0w8xhwYUVY3H6pSDwc3gkJ/irZT/0YEXwBlhaxQEew=
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
File diff suppressed because one or more lines are too long
+36 -36
View File
@@ -1,37 +1,37 @@
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="44" height="44" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
<g fill="none" fill-rule="evenodd" stroke-width="2">
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="0s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="0s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="-0.9s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="-0.9s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
</g>
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="44" height="44" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
<g fill="none" fill-rule="evenodd" stroke-width="2">
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="0s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="0s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="-0.9s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="-0.9s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+17 -17
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="katman_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FF060A;}
.st1{fill:#FFFFFF;}
</style>
<path class="st0" d="M399.8,549.7c144.2,0,261-112,261-250.1S544,49.5,399.8,49.5c-144.2,0-261,112-261,250.1
S255.7,549.7,399.8,549.7z"/>
<path class="st1" d="M546.6,254.7c-14.4-12.8-34.4-32.3-50.6-46.1l-1-0.6c-1.6-1.2-3.4-2.2-5.3-2.9l0,0
c-39.2-7-221.6-39.7-225.1-39.3c-1,0.1-2,0.5-2.8,1l-0.9,0.7c-1.1,1.1-2,2.4-2.5,3.9l-0.2,0.6v3.3v0.5
c20.5,54.8,101.6,234.2,117.6,276.4c1,2.9,2.8,8.3,6.2,8.6h0.8c1.8,0,9.6-9.9,9.6-9.9s139.3-161.8,153.4-179
c1.8-2.1,3.4-4.4,4.8-6.8c0.4-1.9,0.2-3.8-0.5-5.6S548.1,256,546.6,254.7L546.6,254.7z M428,273.6l59.4-47.2l34.9,30.8L428,273.6z
M404.9,270.5l-102.3-80.4l165.6,29.3L404.9,270.5z M414.1,291.5l104.7-16.2L399.1,413.6L414.1,291.5z M288.7,198.2l107.7,87.5
l-15.6,128L288.7,198.2z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="katman_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FF060A;}
.st1{fill:#FFFFFF;}
</style>
<path class="st0" d="M399.8,549.7c144.2,0,261-112,261-250.1S544,49.5,399.8,49.5c-144.2,0-261,112-261,250.1
S255.7,549.7,399.8,549.7z"/>
<path class="st1" d="M546.6,254.7c-14.4-12.8-34.4-32.3-50.6-46.1l-1-0.6c-1.6-1.2-3.4-2.2-5.3-2.9l0,0
c-39.2-7-221.6-39.7-225.1-39.3c-1,0.1-2,0.5-2.8,1l-0.9,0.7c-1.1,1.1-2,2.4-2.5,3.9l-0.2,0.6v3.3v0.5
c20.5,54.8,101.6,234.2,117.6,276.4c1,2.9,2.8,8.3,6.2,8.6h0.8c1.8,0,9.6-9.9,9.6-9.9s139.3-161.8,153.4-179
c1.8-2.1,3.4-4.4,4.8-6.8c0.4-1.9,0.2-3.8-0.5-5.6S548.1,256,546.6,254.7L546.6,254.7z M428,273.6l59.4-47.2l34.9,30.8L428,273.6z
M404.9,270.5l-102.3-80.4l165.6,29.3L404.9,270.5z M414.1,291.5l104.7-16.2L399.1,413.6L414.1,291.5z M288.7,198.2l107.7,87.5
l-15.6,128L288.7,198.2z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+6 -3
View File
@@ -142,8 +142,12 @@
function generateQRCode() {
const qrContainer = document.getElementById('qrcode');
const containerWidth = qrContainer.offsetWidth;
const qrSize = Math.min(containerWidth - 10, 150);
const containerWidth = qrContainer.clientWidth;
const containerHeight = qrContainer.clientHeight || containerWidth;
const measuredSize = Math.floor(Math.min(containerWidth, containerHeight) - 10);
const qrSize = measuredSize > 0 ? measuredSize : 150;
qrContainer.innerHTML = '';
$('#qrcode').qrcode({
text: paymentConfig.address,
@@ -523,4 +527,3 @@
init: init
};
})();
+15 -15
View File
@@ -1,15 +1,15 @@
# @see: http://editorconfig.org
root = true
[*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8
indent_style = space # 缩进风格(tab | space)
indent_size = 2 # 缩进大小
max_line_length = 130 # 最大行长度
end_of_line = crlf # 控制换行类型(lf | cr | crlf)
insert_final_newline = true # 始终在文件末尾插入一个新行
[*.md] # 表示仅对 md 文件适用以下规则
max_line_length = off # 关闭最大行长度限制
trim_trailing_whitespace = false # 关闭末尾空格修剪
# @see: http://editorconfig.org
root = true
[*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8
indent_style = space # 缩进风格(tab | space)
indent_size = 2 # 缩进大小
max_line_length = 130 # 最大行长度
end_of_line = crlf # 控制换行类型(lf | cr | crlf)
insert_final_newline = true # 始终在文件末尾插入一个新行
[*.md] # 表示仅对 md 文件适用以下规则
max_line_length = off # 关闭最大行长度限制
trim_trailing_whitespace = false # 关闭末尾空格修剪
+11 -14
View File
@@ -1,14 +1,11 @@
# 生产环境优先级
# development & production & test > .env
# title
VITE_GLOB_APP_TITLE = 'BEpusdt'
# 静态资源url
VITE_IMG_BASE_URL = 'https://my-image-cdn.com'
# 本地mock数据 true开启 false关闭
VITE_APP_OPEN_MOCK = false
# 资源公共路径
VITE_PUBLIC_PATH = '/secure/'
# 生产环境优先级
# development & production & test > .env
# title
VITE_GLOB_APP_TITLE = 'BEpusdt'
# 静态资源url
VITE_IMG_BASE_URL = 'https://my-image-cdn.com'
# 资源公共路径
VITE_PUBLIC_PATH = '/secure/'
+12 -12
View File
@@ -1,12 +1,12 @@
# 开发环境
VITE_USER_NODE_ENV = development
# 路由模式 hash | history
VITE_ROUTER_MODE = hash
# 打包路径 开发环境地址前缀 (一般 '/' 或 './' 都可以,如果开发环境 '/' 打包预览白屏,请使用 './')
# 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上,所以这里 VITE_PUBLIC_PATH 为 '/'
VITE_PUBLIC_PATH = './'
# 请求路径 管理系统/开发环境
VITE_APP_BASE_URL = 'http://127.0.0.1:8080'
# 开发环境
VITE_USER_NODE_ENV = development
# 路由模式 hash | history
VITE_ROUTER_MODE = hash
# 打包路径 开发环境地址前缀 (一般 '/' 或 './' 都可以,如果开发环境 '/' 打包预览白屏,请使用 './')
# 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上,所以这里 VITE_PUBLIC_PATH 为 '/'
VITE_PUBLIC_PATH = './'
# 请求路径 管理系统/开发环境
VITE_APP_BASE_URL = 'http://127.0.0.1:8080'
+10 -10
View File
@@ -1,11 +1,11 @@
# 开发环境
VITE_USER_NODE_ENV = test
# 路由模式 hash | history
VITE_ROUTER_MODE = hash
# 开发环境地址前缀 (一般 '/' 或 './' 都可以)
VITE_PUBLIC_PATH = '/test'
# 请求路径 管理系统/开发环境
# 开发环境
VITE_USER_NODE_ENV = test
# 路由模式 hash | history
VITE_ROUTER_MODE = hash
# 开发环境地址前缀 (一般 '/' 或 './' 都可以)
VITE_PUBLIC_PATH = '/test'
# 请求路径 管理系统/开发环境
VITE_APP_BASE_URL = '/'
+28 -27
View File
@@ -1,27 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist.zip
dist.7z
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist.zip
dist.7z
dist-ssr
*.local
.eslintcache
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+1 -1
View File
@@ -1 +1 @@
npx --no-install commitlint --edit "$1"
npx --no-install commitlint --edit "$1"
+1 -1
View File
@@ -1 +1 @@
npm run lint:lint-staged
npm run lint:lint-staged
+2 -2
View File
@@ -1,8 +1,8 @@
/dist/*
.local
/node_modules/**
**/*.svg
**/*.sh
/public/*
/src/components.d.ts
/src/auto-import.d.ts
-4
View File
@@ -1,4 +0,0 @@
/dist/*
/public/*
public/*
stats.html
+44 -44
View File
@@ -1,44 +1,44 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": "explicit"
},
"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"],
"files.eol": "\n",
"marscode.chatLanguage": "cn",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"i18n-ally.localesPaths": [
"src/lang",
"src/views/i18n"
]
}
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": "explicit"
},
"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"],
"files.eol": "\n",
"marscode.chatLanguage": "cn",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"i18n-ally.localesPaths": [
"src/lang",
"src/views/i18n"
]
}
+21 -21
View File
@@ -1,21 +1,21 @@
MIT License
Copyright (c) 2024 兔子先森Ace
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2024 兔子先森Ace
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+287 -256
View File
@@ -1,256 +1,287 @@
# SnowAdmin
<div>
<p>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/License-MIT-%2343aefc" alt="License">
</a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/vue_.js-vue3_.x-%2300b42a" alt="Vue">
</a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/Vite-6x-%2311B337" alt="Vite">
</a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img alt="arco.design" src="https://img.shields.io/badge/arco.design-2.57.0-%23%2028%2C175%2C%2063">
</a>
</p>
</div>
### 介绍 📖
SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite6, TypeScript, Pinia。它内置了丰富的主题配置和组件,代码规范严谨,实现了自动化的文件路由系统。SnowAdmin 为您提供了一站式的后台管理解决方案,无需额外配置,开箱即用。同样是一个快速学习前沿技术的最佳实践。
### 版本 📦
**预览及文档**
项目预览地址:[SnowAdmin](http://115.190.79.132/#/login)
项目文档地址:[SnowAdmin-开发指南](http://115.190.79.132:81/)
**代码仓库**
| 平台 | 仓库地址 |
| ------ | ------------------------------------------------------ |
| GitHub | [Github 仓库](https://github.com/WangFan-io/SnowAdmin) |
| Gitee | [Gitee 仓库](https://gitee.com/wang_fan_w/SnowAdmin) |
> 完整版分支:main
>
> 极简版分支:main-thin
>
> ⚠️主要的维护在github上,提issue/pr请认准github主战场
>
> 大家也可以进wx群交流,二维码在介绍末尾
### 先行预览 🖼️
![登录页](https://ooo.0x0.ooo/2025/04/11/O0lhbG.png)
![首页](https://ooo.0x0.ooo/2025/04/11/O0lnVI.png)
![文件库](https://ooo.0x0.ooo/2025/04/11/O0l7qD.png)
![国际化](https://ooo.0x0.ooo/2025/04/11/O0lNAF.png)
![横向布局](https://ooo.0x0.ooo/2025/04/11/O0leQ6.png)
![混合布局](https://ooo.0x0.ooo/2025/04/11/O0lrCP.png)
![主题配置](https://ooo.0x0.ooo/2025/04/11/O0lKnb.png)
![黑暗模式-1](https://ooo.0x0.ooo/2025/04/11/O0lZ4l.png)
![黑暗模式-2](https://ooo.0x0.ooo/2025/04/11/O0lv6g.png)
![黑暗模式-3](https://ooo.0x0.ooo/2025/04/11/O0lgkB.png)
### 项目功能 🔨
- 清晰的项目架构:结构清晰,优雅易懂,代码全注释
- 前沿技术应用:采用 Vue3, Vite6, TypeScript等最新流行的技术栈
- 内置RBAC角色权限模型,实现路由、角色、按钮权限访问控制
- 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件
- 支持 Arco-Design 组件大小切换、多主题布局、暗黑模式、i18n 国际化
- 使用 VueRouter 配置动态路由权限拦截、路由懒加载,支持页面按钮权限控制
- 使用 KeepAlive 对页面进行缓存,支持多级嵌套路由缓存
- 使用 Prettier 统一格式化代码,集成 ESLint、Stylelint 代码校验规范
- 使用 husky、lint-staged、commitlint等插件,规范提交信息
- 丰富的页面组件:内置多样页面和组件,包括 401、404、500 页面,以及布局组件、标签组件、主题配置组件等
### 环境准备 🏝️
确保你的环境满足以下要求(重要):
- **git**: 你需要 git 来克隆和管理项目版本。
- **NodeJS**: >=18.12.0,推荐 20.12.0 或更高。
- **pnpm**: >= 8.7.0,推荐最新版本。
### 安装使用步骤 📔
### 从 GitHub 获取代码 🔗
```bash
# 克隆代码
git clone https://github.com/WangFan-io/SnowAdmin.git
```
### 从 Gitee 获取代码 🔗
```bash
# 克隆代码
git clone https://gitee.com/wang_fan_w/SnowAdmin.git
```
### 安装依赖 📌
安装项目依赖
```bash
pnpm install
```
### 插件配置 🛠️
安装 Vue - Official,禁用 Vetur
- [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) - Vue 服务插件
### 项目启动 🚀
```json
{
// 开发环境启动
"dev": "vite",
// 开发环境构建
"build:dev": "vue-tsc && vite build --mode development",
// 生产环境构建
"build:prod": "vue-tsc && vite build --mode production",
// 测试环境构建
"build:test": "vue-tsc && vite build --mode test",
// 预览环境启动
"preview": "vite preview"
}
```
### 文件资源目录 📚
```text
SnowAdmin
├─ .husky # husky 配置文件
├─ .vscode # VSCode 推荐配置
├─ build # vite项目配置目录
├─ public # 静态资源文件(该文件夹不会被打包)
├─ src
│ ├─ api # API 接口管理
│ ├─ assets # 静态资源文件
│ ├─ components # 全局组件
│ ├─ config # 全局配置项
│ ├─ directives # 全局自定义指令文件
│ ├─ globals # 全局函数
│ ├─ hooks # 常用 Hooks 封装
│ ├─ lang # 语言国际化 i18n
│ ├─ layout # 框架布局模块
│ ├─ mock # 本地数据mock
│ ├─ router # 路由管理
│ ├─ store # pinia store
│ ├─ style # 全局样式文件
│ ├─ typings # 全局 ts 声明
│ ├─ utils # 常用工具库
│ ├─ views # 项目所有页面
│ ├─ App.vue # 项目主组件
│ ├─ main.ts # 项目入口文件
│ └─ vite-env.d.ts # 指定 ts 识别 vue
├─ .editorconfig # 代码编辑器配置文件
├─ .env # 通用环境配置
├─ .env.development # 开发环境配置
├─ .env.production # 生产环境配置
├─ .env.test # 测试环境配置
├─ .eslintignore # 忽略 Eslint 校验
├─ .eslintrc.cjs # Eslint 校验配置文件
├─ .gitignore # 忽略 git 提交
├─ .prettierignore # 忽略 Prettier 格式化
├─ .prettierrc.cjs # Prettier 格式化配置
├─ .stylelintignore # 忽略 Stylelint 校验
├─ .stylelintrc.cjs # Stylelint 格式化配置
├─ commitlint.config.cjs # git 提交规范配置
├─ index.html # 入口 html
├─ LICENSE # 开源协议
├─ lint-staged.config.cjs # lint-staged 配置文件
├─ package-lock.json # 依赖包包版本锁
├─ package.json # 依赖包管理
├─ pnpm-lock.yaml # 依赖包包版本锁
├─ README.md # README 介绍
├─ tsconfig.json # typescript 全局配置
└─ vite.config.ts # vite 全局配置文件
```
### 浏览器支持 🌎
- 本地开发推荐使用 Chrome 最新版浏览器 [Download](https://www.google.com/intl/zh-CN/chrome/)。
- 生产环境支持现代浏览器,不再支持 IE 浏览器,更多浏览器可以查看 [Can I Use Es Module](https://caniuse.com/?search=ESModule)。
| ![IE](https://i.imgtg.com/2023/04/11/8z7ot.png) | ![Edge](https://i.imgtg.com/2023/04/11/8zr3p.png) | ![Firefox](https://i.imgtg.com/2023/04/11/8zKiU.png) | ![Chrome](https://i.imgtg.com/2023/04/11/8zNrx.png) | ![Safari](https://i.imgtg.com/2023/04/11/8zeGj.png) |
| :---------------------------------------------: | :-----------------------------------------------: | :--------------------------------------------------: | :-------------------------------------------------: | :-------------------------------------------------: |
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
### 鸣谢列表 🧩
- [vue:https://v3.cn.vuejs.org/](https://v3.cn.vuejs.org/)
- [axios:https://github.com/axios/axios](https://github.com/axios/axios)
- [nprogress:https://github.com/rstacruz/nprogress](https://github.com/rstacruz/nprogress)
- [sortablejs:https://github.com/SortableJS/Sortabl](https://github.com/SortableJS/Sortable)
- [sass:https://github.com/sass/sass](https://github.com/sass/sass)
- [typescript:https://github.com/microsoft/TypeScript](https://github.com/microsoft/TypeScript)
- [vite:https://github.com/vitejs/vite](https://github.com/vitejs/vite)
- [wangeditor:https://github.com/wangeditor-team/wangEditor](https://github.com/wangeditor-team/wangEditor)
- [qrcodejs:https://github.com/davidshimjs/qrcodejs](https://github.com/davidshimjs/qrcodejs)
- [print-js:https://github.com/crabbly/Print.js](https://github.com/crabbly/Print.js)
- [eslint:https://github.com/eslint/eslint](https://github.com/eslint/eslint)
- [prettier:https://github.com/prettier/prettier](https://github.com/prettier/prettier)
- [arco.design:https://arco.design/](https://arco.design/)
- [pinyin-pro:https://github.com/zh-lx/pinyin-pro](https://github.com/zh-lx/pinyin-pro)
- [qrcode:https://www.npmjs.com/package/qrcode](https://www.npmjs.com/package/qrcode)
- [jsbarcode:https://github.com/lindell/JsBarcode/wiki/Options](https://github.com/lindell/JsBarcode/wiki/Options)
- [fingerprintjs2:https://www.npmjs.com/package/fingerprintjs2](https://www.npmjs.com/package/fingerprintjs2)
### 特别鸣谢 🎉
- [vue-next-admin:http://vuenextadmin.ccfast.cc/](http://vuenextadmin.ccfast.cc/)
- [Gi-admin:https://lin-97.github.io/gi-demo/](https://lin-97.github.io/gi-demo/#/home)
- [Geeker-Admin:https://admin.spicyboy.cn/](https://admin.spicyboy.cn/#/home/index)
感谢以上框架为本项目提供了帮助,项目中的很多设计思想值得参考和学习,再次感谢。
### 学习 & 交流 🏫
| SnowAdmin 交流群 |
| :---------------------------------------------------------------------------------------------------------: |
| ![微信图片_20250726141221](https://github.com/user-attachments/assets/8c1ebf3c-4630-487e-9a54-810fd4d6972c) |
使用过程中有各种问题也可以进群交流,欢迎大家积极参与
### 支持作者 🌟
如果觉得框架不错,或者已经在使用了,希望你可以去 [GitHub](https://github.com/WangFan-io/SnowAdmin) ⭐ Star,这将是对我极大的鼓励与支持。
### 免责条款 📫
您充分了解并同意,您必须为自己使用本服务及注册帐号下的一切行为负责,包括您所发表的任何内容以及由此产生的任何后果。您应对本服务中的内容自行加以判断,并自行承担因使用内容而引起的所有风险。
`SnowAdmin` 对网站上所显示的信息或资料的准确性、内容、完整性、合法性、可靠性、可操作性或可用性不承担任何责任。
`SnowAdmin` 二次开发使用者因为违法而触犯中华人民共和国法律的,一切后果自己负责,`SnowAdmin` 作者不承担任何责任。
本声明未涉及的问题参见国家有关法律法规,当本声明与国家法律法规冲突时,以国家法律法规为准。
### 学习 & 商用 🌈
`SnowAdmin` 是免费和开源的,可免费用于学习、商业使用 。
### 捐赠 💖
| 微信 | 支付宝 |
| :------------------------------------------------: | :--------------------------------------------------: |
| ![微信](https://ooo.0x0.ooo/2025/07/20/OYtFn1.jpg) | ![支付宝](https://ooo.0x0.ooo/2025/07/20/OYth4I.jpg) |
# SnowAdmin
<div>
<p>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/License-MIT-%2343aefc" alt="License">
</a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/vue_.js-vue3_.x-%2300b42a" alt="Vue">
</a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/Vite-6x-%2311B337" alt="Vite">
</a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img alt="arco.design" src="https://img.shields.io/badge/arco.design-2.57.0-%23%2028%2C175%2C%2063">
</a>
</p>
</div>
### 介绍 📖
SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite7, TypeScript, Pinia。它内置了丰富的主题配置和组件,代码规范严谨,实现了自动化的文件路由系统。SnowAdmin 为您提供了一站式的后台管理解决方案,无需额外配置,开箱即用。同样是一个快速学习前沿技术的最佳实践。
### 版本 📦
**预览及文档**
项目预览地址:[SnowAdmin](http://115.190.79.132/#/login)
项目文档地址:[SnowAdmin-开发指南](http://115.190.79.132:81/)
**代码仓库**
| 平台 | 仓库地址 |
| ------ | ------------------------------------------------------ |
| GitHub | [Github 仓库](https://github.com/WangFan-io/SnowAdmin) |
| Gitee | [Gitee 仓库](https://gitee.com/wang_fan_w/SnowAdmin) |
> 完整版分支:main
>
> 极简版分支:main-thin
>
> ⚠️主要的维护在github上,提issue/pr请认准github主战场
>
> 大家也可以进wx群交流,二维码在介绍末尾
### 先行预览 🖼️
![登录页](https://ooo.0x0.ooo/2025/04/11/O0lhbG.png)
![首页](https://ooo.0x0.ooo/2025/04/11/O0lnVI.png)
![文件库](https://ooo.0x0.ooo/2025/04/11/O0l7qD.png)
![国际化](https://ooo.0x0.ooo/2025/04/11/O0lNAF.png)
![横向布局](https://ooo.0x0.ooo/2025/04/11/O0leQ6.png)
![混合布局](https://ooo.0x0.ooo/2025/04/11/O0lrCP.png)
![主题配置](https://ooo.0x0.ooo/2025/04/11/O0lKnb.png)
![黑暗模式-1](https://ooo.0x0.ooo/2025/04/11/O0lZ4l.png)
![黑暗模式-2](https://ooo.0x0.ooo/2025/04/11/O0lv6g.png)
![黑暗模式-3](https://ooo.0x0.ooo/2025/04/11/O0lgkB.png)
### 项目功能 🔨
- 清晰的项目架构:结构清晰,优雅易懂,代码全注释
- 前沿技术应用:采用 Vue3, Vite7, TypeScript等最新流行的技术栈
- 内置RBAC角色权限模型,实现路由、角色、按钮权限访问控制
- 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件
- 支持 Arco-Design 组件大小切换、多主题布局、暗黑模式、i18n 国际化
- 使用 VueRouter 配置动态路由权限拦截、路由懒加载,支持页面按钮权限控制
- 使用 KeepAlive 对页面进行缓存,支持多级嵌套路由缓存
- 使用 Prettier 统一格式化代码,集成 ESLint、Stylelint 代码校验规范
- 使用 husky、lint-staged、commitlint等插件,规范提交信息
- 丰富的页面组件:内置多样页面和组件,包括 401、404、500 页面,以及布局组件、标签组件、主题配置组件等
### 环境准备 🏝️
确保你的环境满足以下要求(重要):
- **git**: 你需要 git 来克隆和管理项目版本。
- **NodeJS**: >=18.12.0,推荐 20.12.0 或更高。
- **pnpm**: >= 8.7.0,推荐最新版本。
### 安装使用步骤 📔
### 从 GitHub 获取代码 🔗
```bash
# 克隆代码
git clone https://github.com/WangFan-io/SnowAdmin.git
```
### 从 Gitee 获取代码 🔗
```bash
# 克隆代码
git clone https://gitee.com/wang_fan_w/SnowAdmin.git
```
### 安装依赖 📌
安装项目依赖
```bash
pnpm install
```
### 插件配置 🛠️
安装 Vue - Official,禁用 Vetur
- [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) - Vue 服务插件
### 项目启动 🚀
```json
{
// 开发环境启动
"dev": "vite",
// 开发环境构建
"build:dev": "vue-tsc && vite build --mode development",
// 生产环境构建
"build:prod": "vue-tsc && vite build --mode production",
// 测试环境构建
"build:test": "vue-tsc && vite build --mode test",
// 预览环境启动
"preview": "vite preview"
}
```
### 文件资源目录 📚
```text
SnowAdmin
├─ .github # GitHub 配置目录
│ └─ ISSUE_TEMPLATE # Issue 模板
├─ .husky # husky 配置文件
├─ build # vite 项目配置目录
├─ node_modules # 依赖包(自动生成)
├─ public # 静态资源文件(不会被打包)
├─ src
│ ├─ api # API 接口管理
│ │ └─ modules # 接口模块
│ ├─ assets # 静态资源文件
│ │ ├─ fonts # 字体文件
│ │ ├─ img # 图片资源
│ │ ├─ logo # Logo 图标
│ │ └─ svgs # SVG 图标
│ ├─ components # 全局组件(code-view/qrcode/svg-icon等)
│ ├─ config # 全局配置项
│ ├─ directives # 全局自定义指令(防抖/节流/权限指令)
│ ├─ globals # 全局函数
│ ├─ hooks # 常用 Hooks 封装
│ ├─ lang # 语言国际化 i18n
│ ├─ layout # 框架布局模块
│ │ ├─ components # 布局组件(Aside/Header/Footer/Menu/Tabs等)
│ │ └─ layout-* # 布局类型(defaults/head/mixing)
│ ├─ mock # 本地数据 mock
│ ├─ router # 路由管理
│ ├─ store # pinia store
│ ├─ style # 全局样式文件
│ │ ├─ media # 响应式样式
│ │ ├─ model # 动画/滚动条/全局样式
│ │ └─ var # 主题变量
│ ├─ typings # 全局 ts 声明
│ ├─ utils # 常用工具库
│ ├─ views # 项目所有页面
│ │ ├─ about # 关于页面
│ │ ├─ component # 组件展示页
│ │ ├─ directive # 指令展示页
│ │ ├─ error # 错误页面(401/404/500)
│ │ ├─ file # 文件管理
│ │ ├─ form # 表单页
│ │ ├─ functions # 工具函数演示
│ │ ├─ home # 首页
│ │ ├─ i18n # 国际化演示
│ │ ├─ link # 链接演示
│ │ ├─ login # 登录页
│ │ ├─ monitor # 系统监控
│ │ ├─ multilevel # 多级菜单演示
│ │ ├─ permission # 权限演示
│ │ ├─ personal # 个人中心
│ │ ├─ system # 系统管理
│ │ ├─ table # 表格页
│ │ └─ thin-preview # 简洁预览页
│ ├─ App.vue # 项目主组件
│ ├─ auto-import.d.ts # 自动导入声明
│ ├─ components.d.ts # 组件声明
│ ├─ main.ts # 项目入口文件
│ ├─ style.css # 全局样式入口
│ └─ vite-env.d.ts # 指定 ts 识别 vue
├─ .editorconfig # 代码编辑器配置文件
├─ .env # 通用环境配置
├─ .env.development # 开发环境配置
├─ .env.production # 生产环境配置
├─ .env.test # 测试环境配置
├─ .eslintrc-auto-import.json # ESLint 自动导入配置
├─ .gitignore # 忽略 git 提交
├─ .prettierignore # 忽略 Prettier 格式化
├─ .prettierrc.cjs # Prettier 格式化配置
├─ .stylelintignore # 忽略 Stylelint 校验
├─ .stylelintrc.cjs # Stylelint 格式化配置
├─ commitlint.config.cjs # git 提交规范配置
├─ eslint.config.js # Eslint 校验配置文件
├─ index.html # 入口 html
├─ LICENSE # 开源协议
├─ lint-staged.config.cjs # lint-staged 配置文件
├─ package.json # 依赖包管理
├─ pnpm-lock.yaml # 依赖包版本锁
├─ README.md # README 介绍
└─ vite.config.ts # vite 全局配置文件
```
### 浏览器支持 🌎
- 本地开发推荐使用 Chrome 最新版浏览器 [Download](https://www.google.com/intl/zh-CN/chrome/)。
- 生产环境支持现代浏览器,不再支持 IE 浏览器,更多浏览器可以查看 [Can I Use Es Module](https://caniuse.com/?search=ESModule)。
| ![IE](https://i.imgtg.com/2023/04/11/8z7ot.png) | ![Edge](https://i.imgtg.com/2023/04/11/8zr3p.png) | ![Firefox](https://i.imgtg.com/2023/04/11/8zKiU.png) | ![Chrome](https://i.imgtg.com/2023/04/11/8zNrx.png) | ![Safari](https://i.imgtg.com/2023/04/11/8zeGj.png) |
| :---------------------------------------------: | :-----------------------------------------------: | :--------------------------------------------------: | :-------------------------------------------------: | :-------------------------------------------------: |
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
### 鸣谢列表 🧩
- [vue:https://v3.cn.vuejs.org/](https://v3.cn.vuejs.org/)
- [axios:https://github.com/axios/axios](https://github.com/axios/axios)
- [nprogress:https://github.com/rstacruz/nprogress](https://github.com/rstacruz/nprogress)
- [sortablejs:https://github.com/SortableJS/Sortabl](https://github.com/SortableJS/Sortable)
- [sass:https://github.com/sass/sass](https://github.com/sass/sass)
- [typescript:https://github.com/microsoft/TypeScript](https://github.com/microsoft/TypeScript)
- [vite:https://github.com/vitejs/vite](https://github.com/vitejs/vite)
- [wangeditor:https://github.com/wangeditor-team/wangEditor](https://github.com/wangeditor-team/wangEditor)
- [qrcodejs:https://github.com/davidshimjs/qrcodejs](https://github.com/davidshimjs/qrcodejs)
- [print-js:https://github.com/crabbly/Print.js](https://github.com/crabbly/Print.js)
- [eslint:https://github.com/eslint/eslint](https://github.com/eslint/eslint)
- [prettier:https://github.com/prettier/prettier](https://github.com/prettier/prettier)
- [arco.design:https://arco.design/](https://arco.design/)
- [pinyin-pro:https://github.com/zh-lx/pinyin-pro](https://github.com/zh-lx/pinyin-pro)
- [qrcode:https://www.npmjs.com/package/qrcode](https://www.npmjs.com/package/qrcode)
- [jsbarcode:https://github.com/lindell/JsBarcode/wiki/Options](https://github.com/lindell/JsBarcode/wiki/Options)
- [fingerprintjs2:https://www.npmjs.com/package/fingerprintjs2](https://www.npmjs.com/package/fingerprintjs2)
### 特别鸣谢 🎉
- [vue-next-admin:http://vuenextadmin.ccfast.cc/](http://vuenextadmin.ccfast.cc/)
- [Gi-admin:https://lin-97.github.io/gi-demo/](https://lin-97.github.io/gi-demo/#/home)
- [Geeker-Admin:https://admin.spicyboy.cn/](https://admin.spicyboy.cn/#/home/index)
感谢以上框架为本项目提供了帮助,项目中的很多设计思想值得参考和学习,再次感谢。
### 学习 & 交流 🏫
| SnowAdmin 交流群 |
| :---------------------------------------------------------------------------------------------------------: |
| ![微信图片_20250726141221](https://github.com/user-attachments/assets/8c1ebf3c-4630-487e-9a54-810fd4d6972c) |
使用过程中有各种问题也可以进群交流,欢迎大家积极参与
### 支持作者 🌟
如果觉得框架不错,或者已经在使用了,希望你可以去 [GitHub](https://github.com/WangFan-io/SnowAdmin) ⭐ Star,这将是对我极大的鼓励与支持。
### 免责条款 📫
您充分了解并同意,您必须为自己使用本服务及注册帐号下的一切行为负责,包括您所发表的任何内容以及由此产生的任何后果。您应对本服务中的内容自行加以判断,并自行承担因使用内容而引起的所有风险。
`SnowAdmin` 对网站上所显示的信息或资料的准确性、内容、完整性、合法性、可靠性、可操作性或可用性不承担任何责任。
`SnowAdmin` 二次开发使用者因为违法而触犯中华人民共和国法律的,一切后果自己负责,`SnowAdmin` 作者不承担任何责任。
本声明未涉及的问题参见国家有关法律法规,当本声明与国家法律法规冲突时,以国家法律法规为准。
### 学习 & 商用 🌈
`SnowAdmin` 是免费和开源的,可免费用于学习、商业使用 。
### 捐赠 💖
| 微信 | 支付宝 |
| :------------------------------------------------: | :--------------------------------------------------: |
| ![微信](https://ooo.0x0.ooo/2025/07/20/OYtFn1.jpg) | ![支付宝](https://ooo.0x0.ooo/2025/07/20/OYth4I.jpg) |
+56 -73
View File
@@ -1,73 +1,56 @@
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { PluginOption } from "vite";
import { vitePluginForArco } from "@arco-plugins/vite-vue";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import AutoImport from "unplugin-auto-import/vite";
import { ArcoResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import { viteMockServe } from "vite-plugin-mock";
import eslintPlugin from "vite-plugin-eslint";
/**
* 创建 vite 插件
* @param viteEnv
*/
export const createVitePlugins = (viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
const env = viteEnv;
return [
vue(),
// esLint 报错信息显示在浏览器界面上
eslintPlugin(),
vitePluginForArco({
style: "css"
}),
createSvgIconsPlugin({
// 配置src下存放svg的路径,这里表示在src/assets/svgs文件夹下
iconDirs: [resolve(process.cwd(), "src/assets/svgs")],
symbolId: "icon-[dir]-[name]"
}),
AutoImport({
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
imports: ["vue", "vue-router"],
// 自动导入的目录-自定义全局函数
dirs: ["src/globals"],
// arco组件的按需加载
resolvers: [ArcoResolver()],
// 解决eslint报错问题
eslintrc: {
// 这里先设置成true然后npm run dev 运行之后会生成 .eslintrc-auto-import.json 文件之后,在改为false
enabled: false,
filepath: "./.eslintrc-auto-import.json", // 生成的文件路径
globalsPropValue: true
},
// 配置文件生成位置
dts: "src/auto-import.d.ts"
}),
Components({
resolvers: [
// arco组件的按需加载
ArcoResolver({
sideEffect: true
})
],
// 自动加载组件的目录配置,默认的为 'src/components'
dirs: ["src/components"],
// 组件的有效文件扩展名
extensions: ["vue"],
// 配置文件生成位置
dts: "src/components.d.ts"
}),
viteMockServe({
mockPath: "./src/mock/", // 目录位置
logger: true, // 是否在控制台显示请求日志
supportTs: true, // 是否读取ts文件模块
localEnabled: env.VITE_APP_OPEN_MOCK === "true", // 设置是否启用本地mock文件
prodEnabled: env.VITE_APP_OPEN_MOCK === "true", // 设置打包是否启用mock功能
// 这样可以控制关闭mock的时候不让mock打包到最终代码内
injectCode: `
import { setupProdMockServer } from '../src/mock/index';
setupProdMockServer();
`
})
];
};
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { PluginOption } from "vite";
import { vitePluginForArco } from "@arco-plugins/vite-vue";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import AutoImport from "unplugin-auto-import/vite";
import { ArcoResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
/**
* 创建 vite 插件
* @param viteEnv
*/
export const createVitePlugins = (_viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
return [
vue(),
vitePluginForArco({
style: "css"
}),
createSvgIconsPlugin({
// 配置src下存放svg的路径,这里表示在src/assets/svgs文件夹下
iconDirs: [resolve(process.cwd(), "src/assets/svgs")],
symbolId: "icon-[dir]-[name]"
}),
AutoImport({
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
imports: ["vue", "vue-router"],
// 自动导入的目录-自定义全局函数
dirs: ["src/globals"],
// arco组件的按需加载
resolvers: [ArcoResolver()],
// 解决eslint报错问题
eslintrc: {
// 这里先设置成true然后npm run dev 运行之后会生成 .eslintrc-auto-import.json 文件之后,在改为false
enabled: false,
filepath: "./.eslintrc-auto-import.json", // 生成的文件路径
globalsPropValue: true
},
// 配置文件生成位置
dts: "src/auto-import.d.ts"
}),
Components({
resolvers: [
// arco组件的按需加载
ArcoResolver({
sideEffect: true
})
],
// 自动加载组件的目录配置,默认的为 'src/components'
dirs: ["src/components"],
// 组件的有效文件扩展名
extensions: ["vue"],
// 配置文件生成位置
dts: "src/components.d.ts"
})
];
};
+52 -52
View File
@@ -1,52 +1,52 @@
module.exports = {
ignores: [commit => commit.includes("init")],
extends: ["@commitlint/config-conventional"],
rules: {
"body-leading-blank": [2, "always"],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 108],
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"type-enum": [
2,
"always",
[
"feat",
"fix",
"style",
"perf",
"refactor",
"test",
"chore",
"docs",
"workflow",
"build",
"ci",
"revert",
"wip",
"release",
"deps",
"merge",
"sync"
// feat:交新功能
// fix:bug修复
// style: 调整代码格式,未修改代码逻辑
// perf: 性能优化
// refactor:代码重构,既没修复bug也没有添加新功能
// test:增加测试
// chore: 其他修改(不在上述类型中的修改)
// docs:修改文档或注释
// workflow: 工作流
// build: 项目打包构建相关的配置修改
// ci: 持续集成相关
// revert: 恢复上一次提交(回滚)
// wip: work in progress 工作中 还没完成
// release: 发版
// deps: 依赖相关的修改
// merge 代码合并
// sync 同步主线或分支的Bug
// scope 说明 commit 影响的范围,比如数据层、控制层、视图层等等
]
]
}
};
module.exports = {
ignores: [commit => commit.includes("init")],
extends: ["@commitlint/config-conventional"],
rules: {
"body-leading-blank": [2, "always"],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 108],
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"type-enum": [
2,
"always",
[
"feat",
"fix",
"style",
"perf",
"refactor",
"test",
"chore",
"docs",
"workflow",
"build",
"ci",
"revert",
"wip",
"release",
"deps",
"merge",
"sync"
// feat:交新功能
// fix:bug修复
// style: 调整代码格式,未修改代码逻辑
// perf: 性能优化
// refactor:代码重构,既没修复bug也没有添加新功能
// test:增加测试
// chore: 其他修改(不在上述类型中的修改)
// docs:修改文档或注释
// workflow: 工作流
// build: 项目打包构建相关的配置修改
// ci: 持续集成相关
// revert: 恢复上一次提交(回滚)
// wip: work in progress 工作中 还没完成
// release: 发版
// deps: 依赖相关的修改
// merge 代码合并
// sync 同步主线或分支的Bug
// scope 说明 commit 影响的范围,比如数据层、控制层、视图层等等
]
]
}
};
+1 -2
View File
@@ -67,8 +67,7 @@ export default defineConfig([
"/docs",
".husky",
".local",
"/bin",
"/src/mock/*"
"/bin"
]
},
eslintConfigPrettier
+15 -18
View File
@@ -1,21 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/logo/snow.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/css/loading.css" type="text/css" />
<title>BEpusdt 一款更好用的个人加密货币收款网关!</title>
</head>
<body>
<div id="app">
<div class="init-page">
<div class="snow-loader"></div>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/logo/snow.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/css/loading.css" type="text/css" />
<title>BEpusdt 一款更好用的个人加密货币收款网关!</title>
</head>
<body>
<div id="app">
<div class="init-page">
<div class="snow-loader"></div>
</div>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+8 -8
View File
@@ -1,8 +1,8 @@
module.exports = {
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": ["prettier --write--parser json"],
"package.json": ["prettier --write"],
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
"*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"],
"*.md": ["prettier --write"]
};
module.exports = {
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": ["prettier --write--parser json"],
"package.json": ["prettier --write"],
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
"*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"],
"*.md": ["prettier --write"]
};
+36 -41
View File
@@ -33,66 +33,61 @@
},
"dependencies": {
"@arco-design/color": "^0.4.0",
"@visactor/vchart": "^1.11.0",
"@visactor/vchart-arco-theme": "^1.11.0",
"@vueuse/core": "^12.4.0",
"axios": "^1.6.8",
"axios": "^1.16.0",
"dayjs": "^1.11.20",
"echarts": "^6.0.0",
"nprogress": "^0.2.0",
"pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^3.2.1",
"vue": "^3.5.15",
"pinia": "^2.3.1",
"pinia-plugin-persistedstate": "^3.2.3",
"vue": "^3.5.34",
"vue-color-kit": "^1.0.6",
"vue-echarts": "^8.0.1",
"vue-i18n": "10.0.0-alpha.3",
"vue-pick-colors": "^1.7.6",
"vue-router": "^4.3.0"
"vue-pick-colors": "^1.8.0",
"vue-router": "^4.6.4"
},
"devDependencies": {
"@arco-design/web-vue": "^2.57.0",
"@arco-plugins/vite-vue": "^1.4.5",
"@arco-design/web-vue": "^2.58.0",
"@arco-plugins/vite-vue": "^1.4.6",
"@commitlint/cli": "^19.8.0",
"@commitlint/config-conventional": "^19.8.0",
"@types/node": "^22.13.11",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"@vitejs/plugin-vue": "^5.2.1",
"@types/node": "^22.19.18",
"@typescript-eslint/eslint-plugin": "^8.59.2",
"@typescript-eslint/parser": "^8.59.2",
"@vitejs/plugin-vue": "^6.0.6",
"commitlint": "^19.2.1",
"depcheck": "^1.4.7",
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-vue": "^10.0.0",
"eslint": "^9.39.4",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-vue": "^10.9.1",
"globals": "^16.1.0",
"husky": "^9.0.11",
"husky": "^9.1.7",
"lint-staged": "^15.2.2",
"mockjs": "^1.1.0",
"postcss": "^8.4.38",
"postcss-html": "^1.6.0",
"postcss": "^8.5.14",
"postcss-html": "^1.8.1",
"postcss-preset-env": "^9.5.2",
"postcss-scss": "^4.0.9",
"prettier": "^3.2.5",
"rollup-plugin-visualizer": "^6.0.5",
"sass-embedded": "^1.86.0",
"stylelint": "^16.16.0",
"prettier": "^3.8.3",
"sass-embedded": "^1.99.0",
"stylelint": "^16.26.1",
"stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^6.0.0",
"stylelint-config-recommended-scss": "^14.1.0",
"stylelint-config-recommended-vue": "^1.6.0",
"stylelint-config-standard": "^37.0.0",
"stylelint-config-standard-scss": "^14.0.0",
"terser": "^5.29.2",
"typescript": "^5.2.2",
"typescript-eslint": "^8.32.1",
"stylelint-config-recess-order": "^7.7.0",
"stylelint-config-recommended-scss": "^16.0.2",
"stylelint-config-recommended-vue": "^1.6.1",
"stylelint-config-standard": "^39.0.1",
"stylelint-config-standard-scss": "^16.0.0",
"terser": "^5.47.1",
"typescript": "^5.9.3",
"typescript-eslint": "^8.59.2",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^6.3.5",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-inspect": "^11.3.3",
"vite-plugin-mock": "^2.9.6",
"vite": "^7.3.3",
"vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^2.2.4"
},
"engines": {
"node": ">= 18.12.0",
"pnpm": ">= 8.7.0"
"node": ">=20.19.0",
"pnpm": ">=10.0.0 <11"
}
}
+3033 -3873
View File
File diff suppressed because it is too large Load Diff
+42 -41
View File
@@ -1,41 +1,42 @@
// @see: https://www.prettier.cn
module.exports = {
// 指定最大换行长度
printWidth: 130,
// 缩进制表符宽度 | 空格数
tabWidth: 2,
// 使用制表符而不是空格缩进行 (true:制表符,false:空格)
useTabs: false,
// 结尾不用分号 (true:有,false:没有)
semi: true,
// 使用单引号 (true:单引号,false:双引号)
singleQuote: false,
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
quoteProps: 'as-needed',
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
jsxSingleQuote: false,
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
trailingComma: 'none',
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
bracketSpacing: true,
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
bracketSameLine: false,
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
arrowParens: 'avoid',
// 指定要使用的解析器,不需要写文件开头的 @prettier
requirePragma: false,
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
insertPragma: false,
// 用于控制文本是否应该被换行以及如何进行换行
proseWrap: 'preserve',
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
htmlWhitespaceSensitivity: 'css',
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
vueIndentScriptAndStyle: false,
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
endOfLine: 'auto',
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
rangeStart: 0,
rangeEnd: Infinity
};
// prettier.config.ts
// @see: https://www.prettier.cn
export default {
// 指定最大换行长度
printWidth: 130,
// 缩进制表符宽度 | 空格数
tabWidth: 2,
// 使用制表符而不是空格缩进行 (true:制表符,false:空格)
useTabs: false,
// 结尾不用分号 (true:有,false:没有)
semi: true,
// 使用单引号 (true:单引号,false:双引号)
singleQuote: false,
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
quoteProps: "as-needed",
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
jsxSingleQuote: false,
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
trailingComma: "none",
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
bracketSpacing: true,
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
bracketSameLine: false,
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
arrowParens: "avoid",
// 指定要使用的解析器,不需要写文件开头的 @prettier
requirePragma: false,
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
insertPragma: false,
// 用于控制文本是否应该被换行以及如何进行换行
proseWrap: "preserve",
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
htmlWhitespaceSensitivity: "css",
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
vueIndentScriptAndStyle: false,
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
endOfLine: "auto",
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
rangeStart: 0,
rangeEnd: Infinity
};
+61 -61
View File
@@ -1,61 +1,61 @@
body {
margin: 0;
overflow: hidden;
}
.init-page {
width: 100vw;
height: 100vh;
left: 0;
top: 0;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
}
/* HTML: <div class="snow-loader"></div> */
.snow-loader {
width: 45px;
aspect-ratio: 1;
--c: no-repeat linear-gradient(rgb(22, 93, 255) 0 0);
background:
var(--c) 0% 50%,
var(--c) 50% 50%,
var(--c) 100% 50%;
background-size: 20% 100%;
animation: l1 1s infinite linear;
}
@keyframes l1 {
0% {
background-size:
20% 100%,
20% 100%,
20% 100%;
}
33% {
background-size:
20% 10%,
20% 100%,
20% 100%;
}
50% {
background-size:
20% 100%,
20% 10%,
20% 100%;
}
66% {
background-size:
20% 100%,
20% 100%,
20% 10%;
}
100% {
background-size:
20% 100%,
20% 100%,
20% 100%;
}
}
body {
margin: 0;
overflow: hidden;
}
.init-page {
width: 100vw;
height: 100vh;
left: 0;
top: 0;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
}
/* HTML: <div class="snow-loader"></div> */
.snow-loader {
width: 45px;
aspect-ratio: 1;
--c: no-repeat linear-gradient(rgb(22, 93, 255) 0 0);
background:
var(--c) 0% 50%,
var(--c) 50% 50%,
var(--c) 100% 50%;
background-size: 20% 100%;
animation: l1 1s infinite linear;
}
@keyframes l1 {
0% {
background-size:
20% 100%,
20% 100%,
20% 100%;
}
33% {
background-size:
20% 10%,
20% 100%,
20% 100%;
}
50% {
background-size:
20% 100%,
20% 10%,
20% 100%;
}
66% {
background-size:
20% 100%,
20% 100%,
20% 10%;
}
100% {
background-size:
20% 100%,
20% 100%,
20% 100%;
}
}
+18 -18
View File
@@ -1,18 +1,18 @@
<template>
<div>
<router-view />
</div>
</template>
<script setup lang="ts">
import { useThemeMethods } from "@/hooks/useThemeMethods";
// 初始化主题
const onTheme = () => {
let { initTheme } = useThemeMethods();
initTheme();
};
onTheme();
</script>
<style lang="scss" scoped></style>
<template>
<div>
<router-view />
</div>
</template>
<script setup lang="ts">
import { useThemeMethods } from "@/hooks/useThemeMethods";
// 初始化主题
const onTheme = () => {
let { initTheme } = useThemeMethods();
initTheme();
};
onTheme();
</script>
<style lang="scss" scoped></style>
+101 -101
View File
@@ -1,101 +1,101 @@
import axios from "axios";
import { Message } from "@arco-design/web-vue";
import { useUserInfoStore } from "@/store/modules/user-info";
import pinia from "@/store/index";
declare module "axios" {
interface AxiosInstance {
(config: AxiosRequestConfig): Promise<any>;
}
}
// 创建axios实例
const service = axios.create();
// 请求拦截器
service.interceptors.request.use(
function (config: any) {
// 发送请求之前做什么
// 获取token鉴权
let userInfo: any = {};
if (localStorage.getItem("user-info")) {
userInfo = JSON.parse(localStorage.getItem("user-info") as string);
}
if (userInfo?.token) {
// 有token,在请求头中携带token
config.headers.Authorization = userInfo.token;
}
return config;
},
function (error: any) {
// 请求错误
return Promise.reject(error);
}
);
// 响应拦截器
service.interceptors.response.use(
function (response: any) {
if (response.status != 200) {
Message.error("服务器异常,请联系管理员");
return Promise.reject(response.data);
}
let res = response.data;
if (res.code == 400) {
Message.error(res.msg);
return Promise.reject(res);
}
if (res.code == 403) {
// 清除 localStorage
localStorage.removeItem("user-info");
// 清除 Pinia store 中的 token 和用户信息
const userStore = useUserInfoStore(pinia);
userStore.logOut();
// 跳转到登录页(保留当前路径前缀,如 /admin)
const basePath = window.location.pathname.split("#")[0];
window.location.href = `${basePath}#/login`;
return Promise.reject(res);
}
if (res.code == 404) {
Message.error("请求连接超时");
return Promise.reject(res);
}
if (res.code != 200) {
Message.error(res.message);
return Promise.reject(res);
}
// 返回数据
return Promise.resolve(res);
},
function (error: any) {
// 处理 HTTP 错误状态码
if (error.response) {
if (error.response.status === 403) {
localStorage.removeItem("user-info");
const userStore = useUserInfoStore(pinia);
userStore.logOut();
Message.error("登录已过期,请重新登录");
const basePath = window.location.pathname.split("#")[0];
return (window.location.href = `${basePath}#/login`);
}
return Message.error(error.message || "请求失败");
}
}
);
export default service;
import axios from "axios";
import { Message } from "@arco-design/web-vue";
import { useUserInfoStore } from "@/store/modules/user-info";
import pinia from "@/store/index";
declare module "axios" {
interface AxiosInstance {
(config: AxiosRequestConfig): Promise<any>;
}
}
// 创建axios实例
const service = axios.create();
// 请求拦截器
service.interceptors.request.use(
function (config: any) {
// 发送请求之前做什么
// 获取token鉴权
let userInfo: any = {};
if (localStorage.getItem("user-info")) {
userInfo = JSON.parse(localStorage.getItem("user-info") as string);
}
if (userInfo?.token) {
// 有token,在请求头中携带token
config.headers.Authorization = userInfo.token;
}
return config;
},
function (error: any) {
// 请求错误
return Promise.reject(error);
}
);
// 响应拦截器
service.interceptors.response.use(
function (response: any) {
if (response.status != 200) {
Message.error("服务器异常,请联系管理员");
return Promise.reject(response.data);
}
let res = response.data;
if (res.code == 400) {
Message.error(res.msg);
return Promise.reject(res);
}
if (res.code == 403) {
// 清除 localStorage
localStorage.removeItem("user-info");
// 清除 Pinia store 中的 token 和用户信息
const userStore = useUserInfoStore(pinia);
userStore.logOut();
// 跳转到登录页(保留当前路径前缀,如 /admin)
const basePath = window.location.pathname.split("#")[0];
window.location.href = `${basePath}#/login`;
return Promise.reject(res);
}
if (res.code == 404) {
Message.error("请求连接超时");
return Promise.reject(res);
}
if (res.code != 200) {
Message.error(res.message);
return Promise.reject(res);
}
// 返回数据
return Promise.resolve(res);
},
function (error: any) {
// 处理 HTTP 错误状态码
if (error.response) {
if (error.response.status === 403) {
localStorage.removeItem("user-info");
const userStore = useUserInfoStore(pinia);
userStore.logOut();
Message.error("登录已过期,请重新登录");
const basePath = window.location.pathname.split("#")[0];
return (window.location.href = `${basePath}#/login`);
}
return Message.error(error.message || "请求失败");
}
}
);
export default service;
+9 -9
View File
@@ -1,9 +1,9 @@
import axios from "@/api";
export const getDashboardHomeAPI = (data: any) => {
return axios({
url: "/api/dashboard/home",
method: "post",
data
});
};
import axios from "@/api";
export const getDashboardHomeAPI = (data: any) => {
return axios({
url: "/api/dashboard/home",
method: "post",
data
});
};
+32 -32
View File
@@ -1,32 +1,32 @@
import axios from "@/api";
export const getRateListAPI = (data: any) => {
return axios({
url: "/api/rate/list",
method: "post",
data
});
};
export const getSyntaxListAPI = () => {
return axios({
url: "/api/rate/syntax",
method: "post"
});
};
export const setSyntaxAPI = (data: any) => {
return axios({
url: "/api/rate/set_syntax",
method: "post",
data
});
};
export const onSyncAPI = (data: any) => {
return axios({
url: "/api/rate/sync",
method: "post",
data
});
};
import axios from "@/api";
export const getRateListAPI = (data: any) => {
return axios({
url: "/api/rate/list",
method: "post",
data
});
};
export const getSyntaxListAPI = () => {
return axios({
url: "/api/rate/syntax",
method: "post"
});
};
export const setSyntaxAPI = (data: any) => {
return axios({
url: "/api/rate/set_syntax",
method: "post",
data
});
};
export const onSyncAPI = (data: any) => {
return axios({
url: "/api/rate/sync",
method: "post",
data
});
};
+58 -58
View File
@@ -1,58 +1,58 @@
import axios from "@/api";
// 获取菜单数据
export const getRoutersAPI = () => {
return axios({
url: "/api/auth/menu",
method: "get"
});
};
// 获取字典数据
export const getDictAPI = () => {
return axios({
url: "/mock/system/getDict",
method: "get"
});
};
// 获取部门数据
export const getDivisionAPI = () => {
return axios({
url: "/mock/system/getDivision",
method: "get"
});
};
// 获取角色数据
export const getRoleAPI = () => {
return axios({
url: "/mock/system/getRole",
method: "get"
});
};
// 获取账户数据
export const getAccountAPI = () => {
return axios({
url: "/mock/system/getAccount",
method: "get"
});
};
// 获取菜单管理列表
export const getMenuListAPI = () => {
return axios({
url: "/mock/menu/getMenuList",
method: "get"
});
};
// 根据角色获取权限数据
export const getUserPermissionAPI = (params: { role: string }) => {
return axios({
url: "/mock/menu/getUserPermission",
method: "get",
params
});
};
import axios from "@/api";
// 获取菜单数据
export const getRoutersAPI = () => {
return axios({
url: "/api/auth/menu",
method: "get"
});
};
// 获取字典数据
export const getDictAPI = () => {
return axios({
url: "/mock/system/getDict",
method: "get"
});
};
// 获取部门数据
export const getDivisionAPI = () => {
return axios({
url: "/mock/system/getDivision",
method: "get"
});
};
// 获取角色数据
export const getRoleAPI = () => {
return axios({
url: "/mock/system/getRole",
method: "get"
});
};
// 获取账户数据
export const getAccountAPI = () => {
return axios({
url: "/mock/system/getAccount",
method: "get"
});
};
// 获取菜单管理列表
export const getMenuListAPI = () => {
return axios({
url: "/mock/menu/getMenuList",
method: "get"
});
};
// 根据角色获取权限数据
export const getUserPermissionAPI = (params: { role: string }) => {
return axios({
url: "/mock/menu/getUserPermission",
method: "get",
params
});
};
+37 -37
View File
@@ -1,37 +1,37 @@
import axios from "@/api";
// 登录
export const loginAPI = (data: any) => {
return axios({
url: "/api/auth/login",
method: "post",
data
});
};
// 获取用户信息
export const getUserInfoAPI = (params?: any) => {
return axios({
url: "/api/auth/info",
method: "get",
params
});
};
// 安全设置
export const securityAPI = (data: any) => {
return axios({
url: "/api/auth/security",
method: "post",
data
});
};
// 设置密码
export const setPasswordAPI = (data: any) => {
return axios({
url: "/api/auth/set_password",
method: "post",
data
});
};
import axios from "@/api";
// 登录
export const loginAPI = (data: any) => {
return axios({
url: "/api/auth/login",
method: "post",
data
});
};
// 获取用户信息
export const getUserInfoAPI = (params?: any) => {
return axios({
url: "/api/auth/info",
method: "get",
params
});
};
// 安全设置
export const securityAPI = (data: any) => {
return axios({
url: "/api/auth/security",
method: "post",
data
});
};
// 设置密码
export const setPasswordAPI = (data: any) => {
return axios({
url: "/api/auth/set_password",
method: "post",
data
});
};
+33 -33
View File
@@ -1,33 +1,33 @@
import axios from "@/api";
export const getWalletListAPI = (data: any) => {
return axios({
url: "/api/wallet/list",
method: "post",
data
});
};
export const delWalletAPI = (data: any) => {
return axios({
url: "/api/wallet/del",
method: "post",
data
});
};
export const addWalletAPI = (data: any) => {
return axios({
url: "/api/wallet/add",
method: "post",
data
});
};
export const modWalletAPI = (data: any) => {
return axios({
url: "/api/wallet/mod",
method: "post",
data
});
};
import axios from "@/api";
export const getWalletListAPI = (data: any) => {
return axios({
url: "/api/wallet/list",
method: "post",
data
});
};
export const delWalletAPI = (data: any) => {
return axios({
url: "/api/wallet/del",
method: "post",
data
});
};
export const addWalletAPI = (data: any) => {
return axios({
url: "/api/wallet/add",
method: "post",
data
});
};
export const modWalletAPI = (data: any) => {
return axios({
url: "/api/wallet/mod",
method: "post",
data
});
};
+6 -6
View File
@@ -1,6 +1,6 @@
@font-face {
font-family: "AliFangYuanTi"; /*字体名-自定义*/
src: url("./AlimamaFangYuanTiVF-Thin.ttf"); /* 字体路径 */
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "AliFangYuanTi"; /*字体名-自定义*/
src: url("./AlimamaFangYuanTiVF-Thin.ttf"); /* 字体路径 */
font-weight: normal;
font-style: normal;
}
+1 -1
View File
@@ -74,6 +74,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}
+1
View File
@@ -9,6 +9,7 @@ declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SEcharts: typeof import('./components/s-echarts/index.vue')['default']
SLangProvider: typeof import('./components/s-lang-provider/index.vue')['default']
SMainTransition: typeof import('./components/s-main-transition/index.vue')['default']
SSvgIcon: typeof import('./components/s-svg-icon/index.vue')['default']
+32
View File
@@ -0,0 +1,32 @@
<template>
<VCharts v-if="renderChart" :option="options" :autoresize="autoResize" :style="{ width, height }" />
</template>
<script lang="ts" setup>
import VCharts from "vue-echarts";
defineProps({
options: {
type: Object,
default() {
return {};
}
},
autoResize: {
type: Boolean,
default: true
},
width: {
type: String,
default: "100%"
},
height: {
type: String,
default: "100%"
}
});
const renderChart = ref(false);
// wait container expand
nextTick(() => {
renderChart.value = true;
});
</script>
+31 -31
View File
@@ -1,31 +1,31 @@
import { App, Directive } from "vue";
import antiShake from "@/directives/modules/global/anti-shake";
import throttle from "@/directives/modules/global/throttle";
import custom from "@/directives/modules/global/custom";
import hasPerm from "@/directives/modules/permission/has-perm";
import hasRole from "@/directives/modules/permission/has-role";
// 定义安装函数
// install 函数是一个对象中的方法,其作用是将一系列指令对象安装到 Vue 应用实例中,它自带两个参数:app 和 options
// app就是vue实例,options则是安装函数的参数(可选)
// install 方法的定义就插件对象,install 方法会在引入插件时自动被 vue 调用,并传参 vue 实例和 options
const group: { [key: string]: Directive } = {
antiShake,
throttle,
custom,
hasPerm,
hasRole
};
const directives = {
install(app: App<Element>) {
// 将一系列自定义指令对象安装到 Vue 应用实例中
for (const key in group) {
app.directive(key, group[key]);
}
}
};
// 导出安装函数
export default directives;
import { App, Directive } from "vue";
import antiShake from "@/directives/modules/global/anti-shake";
import throttle from "@/directives/modules/global/throttle";
import custom from "@/directives/modules/global/custom";
import hasPerm from "@/directives/modules/permission/has-perm";
import hasRole from "@/directives/modules/permission/has-role";
// 定义安装函数
// install 函数是一个对象中的方法,其作用是将一系列指令对象安装到 Vue 应用实例中,它自带两个参数:app 和 options
// app就是vue实例,options则是安装函数的参数(可选)
// install 方法的定义就插件对象,install 方法会在引入插件时自动被 vue 调用,并传参 vue 实例和 options
const group: { [key: string]: Directive } = {
antiShake,
throttle,
custom,
hasPerm,
hasRole
};
const directives = {
install(app: App<Element>) {
// 将一系列自定义指令对象安装到 Vue 应用实例中
for (const key in group) {
app.directive(key, group[key]);
}
}
};
// 导出安装函数
export default directives;
+50 -50
View File
@@ -1,50 +1,50 @@
import { Directive } from "vue";
const antiShake: Directive = {
mounted(el, binding) {
// 判断是否是函数,防抖指令必须绑定函数
if (typeof binding.value != "function") {
return console.warn("Anti-shake instructions must be bound to a function");
}
let timeout: any = null;
// 给el添加自定义事件-防抖函数
el.__onClick__ = () => {
if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => {
// 由于绑定的是函数,这里直接调用绑定之即可(也就是调用绑定的函数)
binding.value();
}, 500);
};
// 监听点击事件,点击后调用绑定的自定义事件
el.addEventListener("click", el.__onClick__);
},
beforeUnmount(el) {
el.removeEventListener("click", el.__onClick__);
}
};
export default antiShake;
// 每个生命周期都有两个参数,el、binding
// 其中el为绑定的dom元素,binding为指令的传入值
// app.directive("focus", {
// 在绑定元素的 attribute 前
// 或事件监听器应用前调用
// created(el, binding, vnode) {
// // 下面会介绍各个参数的细节
// },
// // 在元素被插入到 DOM 前调用
// beforeMount(el, binding, vnode) {},
// // 在绑定元素的父组件
// // 及他自己的所有子节点都挂载完成后调用
// mounted(el, binding, vnode) {},
// // 绑定元素的父组件更新前调用
// beforeUpdate(el, binding, vnode, prevVnode) {},
// // 在绑定元素的父组件
// // 及他自己的所有子节点都更新后调用
// updated(el, binding, vnode, prevVnode) {},
// // 绑定元素的父组件卸载前调用
// beforeUnmount(el, binding, vnode) {},
// // 绑定元素的父组件卸载后调用
// unmounted(el, binding, vnode) {}
// });
import { Directive } from "vue";
const antiShake: Directive = {
mounted(el, binding) {
// 判断是否是函数,防抖指令必须绑定函数
if (typeof binding.value != "function") {
return console.warn("Anti-shake instructions must be bound to a function");
}
let timeout: any = null;
// 给el添加自定义事件-防抖函数
el.__onClick__ = () => {
if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => {
// 由于绑定的是函数,这里直接调用绑定之即可(也就是调用绑定的函数)
binding.value();
}, 500);
};
// 监听点击事件,点击后调用绑定的自定义事件
el.addEventListener("click", el.__onClick__);
},
beforeUnmount(el) {
el.removeEventListener("click", el.__onClick__);
}
};
export default antiShake;
// 每个生命周期都有两个参数,el、binding
// 其中el为绑定的dom元素,binding为指令的传入值
// app.directive("focus", {
// 在绑定元素的 attribute 前
// 或事件监听器应用前调用
// created(el, binding, vnode) {
// // 下面会介绍各个参数的细节
// },
// // 在元素被插入到 DOM 前调用
// beforeMount(el, binding, vnode) {},
// // 在绑定元素的父组件
// // 及他自己的所有子节点都挂载完成后调用
// mounted(el, binding, vnode) {},
// // 绑定元素的父组件更新前调用
// beforeUpdate(el, binding, vnode, prevVnode) {},
// // 在绑定元素的父组件
// // 及他自己的所有子节点都更新后调用
// updated(el, binding, vnode, prevVnode) {},
// // 绑定元素的父组件卸载前调用
// beforeUnmount(el, binding, vnode) {},
// // 绑定元素的父组件卸载后调用
// unmounted(el, binding, vnode) {}
// });
+13 -13
View File
@@ -1,13 +1,13 @@
import { Directive } from "vue";
const custom: Directive = {
mounted(el, binding) {
el.__onClick__ = () => {
let { goodsId, event } = binding.value;
event(goodsId);
};
el.addEventListener("click", el.__onClick__);
}
};
export default custom;
import { Directive } from "vue";
const custom: Directive = {
mounted(el, binding) {
el.__onClick__ = () => {
let { goodsId, event } = binding.value;
event(goodsId);
};
el.addEventListener("click", el.__onClick__);
}
};
export default custom;
+31 -31
View File
@@ -1,31 +1,31 @@
import { Directive } from "vue";
const throttle: Directive = {
mounted(el, binding) {
if (typeof binding.value != "function") {
return console.warn("The throttling instruction must be bound to a function");
}
let countDown = 0;
let timer: any = null;
el.__onClick__ = () => {
if (timer) return;
if (countDown == 0) {
binding.value();
countDown = 1;
}
timer = setInterval(() => {
countDown--;
if (countDown <= 0) {
clearInterval(timer);
timer = null;
}
}, 1000);
};
el.addEventListener("click", el.__onClick__);
},
beforeUnmount(el) {
el.removeEventListener("click", el.__onClick__);
}
};
export default throttle;
import { Directive } from "vue";
const throttle: Directive = {
mounted(el, binding) {
if (typeof binding.value != "function") {
return console.warn("The throttling instruction must be bound to a function");
}
let countDown = 0;
let timer: any = null;
el.__onClick__ = () => {
if (timer) return;
if (countDown == 0) {
binding.value();
countDown = 1;
}
timer = setInterval(() => {
countDown--;
if (countDown <= 0) {
clearInterval(timer);
timer = null;
}
}, 1000);
};
el.addEventListener("click", el.__onClick__);
},
beforeUnmount(el) {
el.removeEventListener("click", el.__onClick__);
}
};
export default throttle;
+39
View File
@@ -0,0 +1,39 @@
import { computed } from "vue";
import { storeToRefs } from "pinia";
import { EChartsOption } from "echarts";
import { useThemeConfig } from "@/store/modules/theme-config";
interface optionsFn {
(isDark?: boolean, palette?: string[]): EChartsOption;
}
/**
* ECharts图表hooks
* @param sourceOption ECharts配置项函数
* @returns { option: ComputedRef<EChartsOption>, theme: ComputedRef<string | undefined> } ECharts配置项和主题
*/
export function useChart(sourceOption: optionsFn): {
option: ComputedRef<EChartsOption>;
theme: ComputedRef<string | undefined>;
} {
const themeStore = useThemeConfig();
const { darkMode } = storeToRefs(themeStore);
// 预设调色盘,适配arco.design主题:https://visactor.io/vchart/guide/tutorial_docs/Theme/Arco_Design
const palette = ["#4080FF", "#55C5FD", "#FF7D00", "#4CD263", "#A871E3", "#F7BA1E", "#9FDB1D", "#F979B7", "#0FC6C2", "#E865DF"];
// echarts support https://echarts.apache.org/zh/theme-builder.html
const option = computed<EChartsOption>(() => {
return sourceOption(darkMode.value, palette);
});
// 主题
const theme = computed(() => (darkMode.value ? "dark" : undefined));
return {
// ECharts配置项
option,
// 黑暗模式
theme
};
}
+21 -21
View File
@@ -1,21 +1,21 @@
import { computed } from "vue";
import { useWindowSize } from "@vueuse/core";
interface DeviceSize {
isPc: ComputedRef<boolean>;
isPad: ComputedRef<boolean>;
isMobile: ComputedRef<boolean>;
}
/**
* 小于 768px:适配移动设备(如手机)。
* 768px - 1024px:适配平板设备。
* 大于 1024px:适配桌面设备。
* @returns PC窗口isPc, 平板窗口isPad, 移动端窗口isMobile
*/
export const useDevicesSize = (): DeviceSize => {
const { width } = useWindowSize();
const isPc = computed(() => width.value > 1024);
const isPad = computed(() => width.value > 768 && width.value <= 1024);
const isMobile = computed(() => width.value <= 768);
return { isPc, isPad, isMobile };
};
import { computed } from "vue";
import { useWindowSize } from "@vueuse/core";
interface DeviceSize {
isPc: ComputedRef<boolean>;
isPad: ComputedRef<boolean>;
isMobile: ComputedRef<boolean>;
}
/**
* 小于 768px:适配移动设备(如手机)。
* 768px - 1024px:适配平板设备。
* 大于 1024px:适配桌面设备。
* @returns PC窗口isPc, 平板窗口isPad, 移动端窗口isMobile
*/
export const useDevicesSize = (): DeviceSize => {
const { width } = useWindowSize();
const isPc = computed(() => width.value > 1024);
const isPad = computed(() => width.value > 768 && width.value <= 1024);
const isMobile = computed(() => width.value <= 768);
return { isPc, isPad, isMobile };
};
+3 -3
View File
@@ -1,3 +1,3 @@
// 用于全局使用globalProperties
import { getCurrentInstance, ComponentInternalInstance } from "vue";
export default () => (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties;
// 用于全局使用globalProperties
import { getCurrentInstance, ComponentInternalInstance } from "vue";
export default () => (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties;
+23
View File
@@ -0,0 +1,23 @@
import { computed } from "vue";
import type { ComputedRef } from "vue";
import { useDevicesSize } from "@/hooks/useDevicesSize";
interface LayoutModel {
formLayout: ComputedRef<"vertical" | "horizontal">;
tableFixed: ComputedRef<"" | "right">;
descriptionsLayout: ComputedRef<"inline-vertical" | "right">;
descriptionsColumn: (min?: number, max?: number) => number;
dialogWidth: (min?: string, max?: string) => string;
}
export const useLayoutModel = (): LayoutModel => {
const { isMobile } = useDevicesSize();
const formLayout = computed(() => (isMobile.value ? "vertical" : "horizontal"));
const tableFixed = computed(() => (isMobile.value ? "" : "right"));
const descriptionsLayout = computed(() => (isMobile.value ? "inline-vertical" : "right"));
const descriptionsColumn = (min: number = 1, max: number = 2) => (isMobile.value ? min : max);
const dialogWidth = (min: string = "40%", max: string = "95%") => (isMobile.value ? max : min);
return { formLayout, tableFixed, descriptionsLayout, descriptionsColumn, dialogWidth };
};
+29 -29
View File
@@ -1,29 +1,29 @@
/**
* 菜单处理hooks,内置多种菜单处理场景
* @returns 菜单处理方法
*/
export const useMenuMethod = () => {
/**
* 多级菜单的显示隐藏
* @param {Menu.MenuOptions} item 菜单的item
* @returns type:1为目录,并且不隐藏,返回true,否则返回false
*/
const menuShow = (item: Menu.MenuOptions) => {
if (item.meta.type == 1 && !item.meta.hide) return true;
return false;
};
/**
* 单级菜单的显示隐藏
* @param {Menu.MenuOptions} item 菜单的item
* @returns type:2为菜单,并且单级菜单不隐藏,返回true,否则返回false
*/
const aMenuShow = (item: Menu.MenuOptions) => {
if (item.meta.type == 2 && !item.meta.hide) return true;
return false;
};
return {
menuShow,
aMenuShow
};
};
/**
* 菜单处理hooks,内置多种菜单处理场景
* @returns 菜单处理方法
*/
export const useMenuMethod = () => {
/**
* 多级菜单的显示隐藏
* @param {Menu.MenuOptions} item 菜单的item
* @returns type:1为目录,并且不隐藏,返回true,否则返回false
*/
const menuShow = (item: Menu.MenuOptions) => {
if (item.meta.type == 1 && !item.meta.hide) return true;
return false;
};
/**
* 单级菜单的显示隐藏
* @param {Menu.MenuOptions} item 菜单的item
* @returns type:2为菜单,并且单级菜单不隐藏,返回true,否则返回false
*/
const aMenuShow = (item: Menu.MenuOptions) => {
if (item.meta.type == 2 && !item.meta.hide) return true;
return false;
};
return {
menuShow,
aMenuShow
};
};
+88 -83
View File
@@ -1,83 +1,88 @@
import pinia from "@/store/index";
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { findCategoryById, findPathOfParentNode } from "@/utils/tree-tools";
/**
* 路由处理hooks,内置多种路由处理场景
* @returns 路由方法
*/
export const useRoutingMethod = () => {
/**
* 从一维路由中查找路由
* @param {string} path 路由的path
* @returns 查找到的路由,undefined则表示未找到
*/
const findLinearArray = (path: string) => {
const routerStore = useRouteConfigStore(pinia);
const { routeTree } = storeToRefs(routerStore);
return findCategoryById(routeTree.value, "path", path);
};
/**
* 根据当前路由找到所有直属父级路由
* @param {string} path 路由的path
* @returns 查找到的所有父级路由,未找到则null
*/
const getAllParentRoute = (path: string) => {
const routerStore = useRouteConfigStore(pinia);
const { routeTree } = storeToRefs(routerStore);
return findPathOfParentNode(routeTree.value, "path", path);
};
/**
* 从一维路由中判断路由是否存在
* @param {string} key 路由的name
* @returns 路由是否存在,true存在 false不存在
*/
const hasRoute = (key: string) => {
const routerStore = useRouteConfigStore(pinia);
const { routeList } = storeToRefs(routerStore);
return routeList.value.some((item: Menu.MenuOptions) => item.name == key);
};
/**
* 从tabs路由中查找路由
* @param {string} key 路由的name
* @returns 查找到的路由,undefined则表示未找到
*/
const findTagsList = (key: string) => {
const routerStore = useRouteConfigStore(pinia);
const { tabsList } = storeToRefs(routerStore);
return tabsList.value.find((item: Menu.MenuOptions) => item.name == key);
};
/**
* 处理外链跳转,打开一个新窗口并根据url跳转
* @param {any} route 路由
*/
const openExternalLinks = (route: any) => {
// 处理外链跳转
if (route.meta.link && !route.meta.iframe) {
window.open(route.meta.link as string, "_blank");
}
};
/**
* 检测是否是动态匹配路由,如果是动态匹配路由,则path必然带有"/:"字样,例如:/user/:id
* @param {string} path 路由path
* @returns 是否是动态匹配路由
*/
const isDynamicRoute = (path: string) => {
return path.includes("/:");
};
return {
findLinearArray,
getAllParentRoute,
findTagsList,
openExternalLinks,
isDynamicRoute,
hasRoute
};
};
import pinia from "@/store/index";
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { findCategoryById, findPathOfParentNode } from "@/utils/tree-tools";
/**
* 路由处理hooks,内置多种路由处理场景
* @returns 路由方法
*/
export const useRoutingMethod = () => {
/**
* 从一维路由中查找路由
* @param {string} path 路由的path
* @returns 查找到的路由,undefined则表示未找到
*/
const findLinearArray = (path: string) => {
const routerStore = useRouteConfigStore(pinia);
const { routeTree } = storeToRefs(routerStore);
return findCategoryById(routeTree.value, "path", path);
};
/**
* 根据当前路由找到所有直属父级路由
* @param {string} path 路由的path
* @returns 查找到的所有父级路由,未找到则null
*/
const getAllParentRoute = (path: string) => {
const routerStore = useRouteConfigStore(pinia);
const { routeTree } = storeToRefs(routerStore);
return findPathOfParentNode(routeTree.value, "path", path);
};
/**
* 从一维路由中判断路由是否存在
* @param {string} key 路由的name
* @returns 路由是否存在,true存在 false不存在
*/
const hasRoute = (key: string) => {
const routerStore = useRouteConfigStore(pinia);
const { routeList } = storeToRefs(routerStore);
return routeList.value.some((item: Menu.MenuOptions) => item.name == key);
};
/**
* 从tabs路由中查找路由
* @param {string} key 路由的name
* @returns 查找到的路由,undefined则表示未找到
*/
const findTagsList = (key: string) => {
const routerStore = useRouteConfigStore(pinia);
const { tabsList } = storeToRefs(routerStore);
return tabsList.value.find((item: Menu.MenuOptions) => item.name == key);
};
/**
* 处理外链跳转,打开一个新窗口并根据url跳转
* @param {any} route 路由
*/
const openExternalLinks = (route: any) => {
// 处理外链跳转
if (route.meta.link && !route.meta.iframe) {
window.open(route.meta.link as string, "_blank");
}
};
/**
* 检测是否是动态匹配路由,如果是动态匹配路由,则path必然带有"/:"字样,例如:/user/:id
* @param {string} path 路由path
* @returns 是否是动态匹配路由
*/
const isDynamicRoute = (route: any) => {
// to.matched 包含了当前路由匹配到的所有层级(包括父级 layout 等)
// 我们主要关心叶子节点或包含参数的节点
return route.matched.some((record: any) => {
// record.path 是定义时的路径,如 "/user/:id"
return record.path.includes("/:");
});
};
return {
findLinearArray,
getAllParentRoute,
findTagsList,
openExternalLinks,
isDynamicRoute,
hasRoute
};
};
+99 -99
View File
@@ -1,99 +1,99 @@
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { generate, getRgbStr } from "@arco-design/color";
/**
* 主题处理hooks,内置多种主题处理场景
* @returns 主题方法
*/
export const useThemeMethods = () => {
/**
* @description: 初始化主题
*/
const initTheme = () => {
// 黑暗模式和主题色
setDarkMode();
// 色弱模式和灰色模式
const themeStore = useThemeConfig();
const { grayMode } = storeToRefs(themeStore);
if (grayMode.value) {
setGray();
} else {
setColorWeak();
}
};
/**
* @description: 暗黑模式
*/
const setDarkMode = () => {
const themeStore = useThemeConfig();
const { darkMode, asideDark } = storeToRefs(themeStore);
if (darkMode.value) {
// 设置为暗黑主题
document.body.setAttribute("arco-theme", "dark");
asideDark.value = false; // 黑暗模式与侧边栏深色互斥
} else {
// 恢复亮色主题
document.body.removeAttribute("arco-theme");
}
// 黑暗模式切换后需要更新主题色
setThemeColor();
};
/**
* @description: 主题色设置
*/
const setThemeColor = () => {
const themeStore = useThemeConfig();
const { themeColor, darkMode } = storeToRefs(themeStore);
// 对于给定的颜色,使用算法生成包含10种颜色的渐变样本。这适用于光模式和暗模式。
let list = generate(themeColor.value, { list: true, dark: darkMode.value });
list.forEach((color: string, index: number) => {
// https://arco.design/palette/list
// arco的颜色等级为1-10,这里需要index+1
document.body.style.setProperty(`--primary-${index + 1}`, getRgbStr(color));
});
};
/**
* @description: 色弱模式
*/
const setColorWeak = () => {
// 获取html
const htmlCase = document.querySelector("html") as HTMLHtmlElement | null;
if (!htmlCase) return;
const themeStore = useThemeConfig();
const { colorWeakMode, grayMode } = storeToRefs(themeStore);
if (colorWeakMode.value) {
grayMode.value = false; // 色弱模式和灰色模式互斥
htmlCase.style.filter = "invert(80%)"; // 反转色80%
} else {
htmlCase.style.filter = "";
}
};
/**
* @description: 灰色模式
*/
const setGray = () => {
// 获取html
const htmlCase = document.querySelector("html") as HTMLHtmlElement | null;
if (!htmlCase) return;
const themeStore = useThemeConfig();
const { colorWeakMode, grayMode } = storeToRefs(themeStore);
if (grayMode.value) {
colorWeakMode.value = false; // 色弱模式和灰色模式互斥
htmlCase.style.filter = "grayscale(100%)"; // 灰度100%
} else {
htmlCase.style.filter = "";
}
};
return {
initTheme,
setDarkMode,
setThemeColor,
setColorWeak,
setGray
};
};
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { generate, getRgbStr } from "@arco-design/color";
/**
* 主题处理hooks,内置多种主题处理场景
* @returns 主题方法
*/
export const useThemeMethods = () => {
/**
* @description: 初始化主题
*/
const initTheme = () => {
// 黑暗模式和主题色
setDarkMode();
// 色弱模式和灰色模式
const themeStore = useThemeConfig();
const { grayMode } = storeToRefs(themeStore);
if (grayMode.value) {
setGray();
} else {
setColorWeak();
}
};
/**
* @description: 暗黑模式
*/
const setDarkMode = () => {
const themeStore = useThemeConfig();
const { darkMode, asideDark } = storeToRefs(themeStore);
if (darkMode.value) {
// 设置为暗黑主题
document.body.setAttribute("arco-theme", "dark");
asideDark.value = false; // 黑暗模式与侧边栏深色互斥
} else {
// 恢复亮色主题
document.body.removeAttribute("arco-theme");
}
// 黑暗模式切换后需要更新主题色
setThemeColor();
};
/**
* @description: 主题色设置
*/
const setThemeColor = () => {
const themeStore = useThemeConfig();
const { themeColor, darkMode } = storeToRefs(themeStore);
// 对于给定的颜色,使用算法生成包含10种颜色的渐变样本。这适用于光模式和暗模式。
let list = generate(themeColor.value, { list: true, dark: darkMode.value });
list.forEach((color: string, index: number) => {
// https://arco.design/palette/list
// arco的颜色等级为1-10,这里需要index+1
document.body.style.setProperty(`--primary-${index + 1}`, getRgbStr(color));
});
};
/**
* @description: 色弱模式
*/
const setColorWeak = () => {
// 获取html
const htmlCase = document.querySelector("html") as HTMLHtmlElement | null;
if (!htmlCase) return;
const themeStore = useThemeConfig();
const { colorWeakMode, grayMode } = storeToRefs(themeStore);
if (colorWeakMode.value) {
grayMode.value = false; // 色弱模式和灰色模式互斥
htmlCase.style.filter = "invert(80%)"; // 反转色80%
} else {
htmlCase.style.filter = "";
}
};
/**
* @description: 灰色模式
*/
const setGray = () => {
// 获取html
const htmlCase = document.querySelector("html") as HTMLHtmlElement | null;
if (!htmlCase) return;
const themeStore = useThemeConfig();
const { colorWeakMode, grayMode } = storeToRefs(themeStore);
if (grayMode.value) {
colorWeakMode.value = false; // 色弱模式和灰色模式互斥
htmlCase.style.filter = "grayscale(100%)"; // 灰度100%
} else {
htmlCase.style.filter = "";
}
};
return {
initTheme,
setDarkMode,
setThemeColor,
setColorWeak,
setGray
};
};
+39 -39
View File
@@ -1,39 +1,39 @@
import { createI18n } from "vue-i18n";
import zhCN from "@/lang/modules/zhCN";
import enUS from "@/lang/modules/enUS";
/* 获取语言 */
const getLang = () => {
let store = localStorage.getItem("theme-config");
if (store) {
return JSON.parse(store)?.language || "zh-CN";
} else {
return "zh-CN";
}
};
/* 这里必须是messages名称 */
const messages = {
"zh-CN": zhCN,
"en-US": enUS
};
const i18n = createI18n({
legacy: false, // Composition API模式需要设为false
globalInjection: true, // 全局生效: $
locale: getLang(), // 默认语言
messages, // 数据源
missing: (_: string, key: string) => {
return removeBeforeFirstDot(key);
}
});
/**
* @param { string } str 国际化key
* @returns 去掉第一个点之前的字符串,例如:"menu.home" => "home",否则返回原字符串
*/
function removeBeforeFirstDot(str: string) {
const dotIndex = str.indexOf(".");
return dotIndex >= 0 ? str.slice(dotIndex + 1) : str;
}
export default i18n;
import { createI18n } from "vue-i18n";
import zhCN from "@/lang/modules/zhCN";
import enUS from "@/lang/modules/enUS";
/* 获取语言 */
const getLang = () => {
let store = localStorage.getItem("theme-config");
if (store) {
return JSON.parse(store)?.language || "zh-CN";
} else {
return "zh-CN";
}
};
/* 这里必须是messages名称 */
const messages = {
"zh-CN": zhCN,
"en-US": enUS
};
const i18n = createI18n({
legacy: false, // Composition API模式需要设为false
globalInjection: true, // 全局生效: $
locale: getLang(), // 默认语言
messages, // 数据源
missing: (_: string, key: string) => {
return removeBeforeFirstDot(key);
}
});
/**
* @param { string } str 国际化key
* @returns 去掉第一个点之前的字符串,例如:"menu.home" => "home",否则返回原字符串
*/
function removeBeforeFirstDot(str: string) {
const dotIndex = str.indexOf(".");
return dotIndex >= 0 ? str.slice(dotIndex + 1) : str;
}
export default i18n;
+139 -119
View File
@@ -1,119 +1,139 @@
export default {
system: {
["login"]: "login",
["not-power"]: "No permission",
["not-found"]: "Page not found",
["zh-CN"]: "中文",
["en-US"]: "English",
["refresh"]: "refresh",
["close-current"]: "close current",
["close-left-side"]: "close left side",
["close-right-side"]: "close right side",
["close-other"]: "close other",
["close-all"]: "close all",
["switch-to-night-mode"]: "switch to night mode",
["switch-to-daytime-mode"]: "switch to daytime mode",
["full-screen"]: "full screen",
["exit-full-screen"]: "exit full screen",
["system-settings"]: "system settings",
["theme-settings"]: "theme settings",
["personal-information"]: "personal information",
["change-password"]: "change password",
["project-address"]: "project address",
["logout"]: "logout",
["notice"]: "Notice",
["message"]: "Message",
["backlog"]: "Backlog",
["switch-language-to-preview"]: "Please switch the language to preview the internationalization effect",
["please-enter-something"]: "Please enter something"
},
menu: {
["home"]: "home",
["file"]: "file",
["document-library"]: "document-library",
["table"]: "table",
["common-table"]: "common-table",
["custom-table"]: "custom-table",
["form"]: "form",
["common-form"]: "common-form",
["step-form"]: "step-form",
["multilevel"]: "multilevel",
["second-1"]: "second-1",
["second-2"]: "second-2",
["third-1"]: "third-1",
["third-2"]: "third-2",
["third-3"]: "third-3",
["third-4"]: "third-4",
["third-5"]: "third-5",
["third-6"]: "third-6",
["third-7"]: "third-7",
["third-8"]: "third-8",
["third-9"]: "third-9",
["component"]: "component",
["player"]: "player",
["print"]: "print",
["draggable"]: "draggable",
["editor"]: "editor",
["newbie"]: "newbie",
["icon-selector"]: "icon-selector",
["user-center"]: "user-center",
["fingerprintjs2"]: "fingerprintjs2",
["barcode"]: "barcode",
["qrcode"]: "qrcode",
["pinyin"]: "pinyin",
["markdown"]: "Markdown",
["directive"]: "directive",
["anti-shake"]: "anti-shake",
["throttle"]: "throttle",
["test-directive"]: "test-directive",
["personal"]: "personal",
["userinfo"]: "userinfo",
["user-settings"]: "user-settings",
["system"]: "system",
["account"]: "account",
["role"]: "role",
["menu"]: "menu",
["division"]: "division",
["dictionary"]: "dictionary",
["log"]: "log",
["about"]: "about",
["link"]: "link",
["internal"]: "internal",
["uigradients"]: "uigradients",
["color-taking-tool"]: "color-taking-tool",
["grid-generator"]: "grid-generator",
["external"]: "external",
["vue"]: "vue",
["vite"]: "vite",
["github"]: "github",
["SnowAdmin-Docs"]: "SnowAdmin-Docs",
["juejin"]: "juejin",
["disable-menu"]: "disable-menu",
["hide-menu"]: "hide-menu",
["system-monitor"]: "system monitor",
["onlineuser"]: "online user",
["crontab"]: "crontab",
["crontab-logs"]: "crontab logs",
["i18n"]: "i18n",
["amap"]: "amap",
["permission"]: "permission",
["btn-perm"]: "btn perm",
["admin-page"]: "admin page",
["common-page"]: "common page",
["functions"]: "functions",
["routing-operation"]: "routing operation",
["common-route"]: "common route",
["dynamic-route"]: "dynamic route",
["audio"]: "audio",
["recorder"]: "recorder",
["virtual-list"]: "virtual-list",
["common-tools"]: "common tools",
["tree-tools"]: "tree-tools",
["file-tools"]: "file-tools",
["verify-tools"]: "verify tools",
["common-layouts"]: "common layouts",
["data-screen"]: "data screen",
["thin-preview"]: "thin preview",
["test"]: "test"
}
};
export default {
system: {
["login"]: "login",
["not-power"]: "No permission",
["not-found"]: "Page not found",
["zh-CN"]: "中文",
["en-US"]: "English",
["refresh"]: "refresh",
["close-current"]: "close current",
["close-left-side"]: "close left side",
["close-right-side"]: "close right side",
["close-other"]: "close other",
["close-all"]: "close all",
["switch-to-night-mode"]: "switch to night mode",
["switch-to-daytime-mode"]: "switch to daytime mode",
["full-screen"]: "full screen",
["exit-full-screen"]: "exit full screen",
["system-settings"]: "system settings",
["theme-settings"]: "theme settings",
["navigate mode"]: "navigate mode",
["personal-information"]: "personal information",
["change-password"]: "change password",
["project-address"]: "project address",
["logout"]: "logout",
["notice"]: "Notice",
["message"]: "Message",
["backlog"]: "Backlog",
["switch-language-to-preview"]: "Please switch the language to preview the internationalization effect",
["please-enter-something"]: "please enter something",
["color weakness mode"]: "color weakness mode",
["grey mode"]: "grey mode",
["sidebar is dark"]: "sidebar is dark",
["page transition"]: "page transition",
["interface settings"]: "interface settings",
["menu folding"]: "menu folding",
["menu accordion"]: "menu accordion",
["breadcrumb"]: "breadcrumb",
["tab bar"]: "tab bar",
["page footer"]: "page footer",
["watermark settings"]: "watermark settings",
["watermark color"]: "watermark color",
["watermark text"]: "watermark text",
["watermark size"]: "watermark size",
["watermark angle"]: "watermark angle",
["watermark gap"]: "watermark gap",
["system settings"]: "system settings",
["anti-debugging"]: "anti-debugging",
["please select"]: "please select"
},
menu: {
["home"]: "home",
["file"]: "file",
["document-library"]: "document-library",
["table"]: "table",
["common-table"]: "common-table",
["custom-table"]: "custom-table",
["form"]: "form",
["common-form"]: "common-form",
["step-form"]: "step-form",
["multilevel"]: "multilevel",
["second-1"]: "second-1",
["second-2"]: "second-2",
["third-1"]: "third-1",
["third-2"]: "third-2",
["third-3"]: "third-3",
["third-4"]: "third-4",
["third-5"]: "third-5",
["third-6"]: "third-6",
["third-7"]: "third-7",
["third-8"]: "third-8",
["third-9"]: "third-9",
["component"]: "component",
["player"]: "player",
["print"]: "print",
["draggable"]: "draggable",
["editor"]: "editor",
["newbie"]: "newbie",
["icon-selector"]: "icon-selector",
["user-center"]: "user-center",
["fingerprintjs2"]: "fingerprintjs2",
["barcode"]: "barcode",
["qrcode"]: "qrcode",
["pinyin"]: "pinyin",
["markdown"]: "Markdown",
["directive"]: "directive",
["anti-shake"]: "anti-shake",
["throttle"]: "throttle",
["test-directive"]: "test-directive",
["personal"]: "personal",
["userinfo"]: "userinfo",
["user-settings"]: "user-settings",
["system"]: "system",
["account"]: "account",
["role"]: "role",
["menu"]: "menu",
["division"]: "division",
["dictionary"]: "dictionary",
["log"]: "log",
["about"]: "about",
["link"]: "link",
["internal"]: "internal",
["uigradients"]: "uigradients",
["color-taking-tool"]: "color-taking-tool",
["grid-generator"]: "grid-generator",
["external"]: "external",
["vue"]: "vue",
["vite"]: "vite",
["github"]: "github",
["SnowAdmin-Docs"]: "SnowAdmin-Docs",
["juejin"]: "juejin",
["disable-menu"]: "disable-menu",
["hide-menu"]: "hide-menu",
["system-monitor"]: "system monitor",
["onlineuser"]: "online user",
["crontab"]: "crontab",
["crontab-logs"]: "crontab logs",
["i18n"]: "i18n",
["amap"]: "amap",
["permission"]: "permission",
["btn-perm"]: "btn perm",
["admin-page"]: "admin page",
["common-page"]: "common page",
["functions"]: "functions",
["routing-operation"]: "routing operation",
["common-route"]: "common route",
["dynamic-route"]: "dynamic route",
["audio"]: "audio",
["recorder"]: "recorder",
["virtual-list"]: "virtual-list",
["common-tools"]: "common tools",
["tree-tools"]: "tree-tools",
["file-tools"]: "file-tools",
["verify-tools"]: "verify tools",
["common-layouts"]: "common layouts",
["data-screen"]: "data screen",
["thin-preview"]: "thin preview",
["test"]: "test"
}
};
+148 -128
View File
@@ -1,128 +1,148 @@
export default {
system: {
["login"]: "登录",
["not-power"]: "没有权限",
["not-found"]: "未找到页面",
["zh-CN"]: "中文",
["en-US"]: "English",
["refresh"]: "刷新",
["close-current"]: "关闭当前",
["close-left-side"]: "关闭左侧",
["close-right-side"]: "关闭右侧",
["close-other"]: "关闭其它",
["close-all"]: "关闭全部",
["switch-to-night-mode"]: "切换黑夜模式",
["switch-to-daytime-mode"]: "切换白天模式",
["full-screen"]: "全屏",
["exit-full-screen"]: "退出全屏",
["system-settings"]: "系统设置",
["theme-settings"]: "主题设置",
["personal-information"]: "个人信息",
["change-password"]: "修改密码",
["project-address"]: "项目地址",
["logout"]: "退出登录",
["notice"]: "通知",
["message"]: "消息",
["backlog"]: "待办",
["switch-language-to-preview"]: "请切换语言来预览国际化效果",
["please-enter-something"]: "请输入"
},
menu: {
["home"]: "首页",
["wallet"]: "钱包管理",
["order"]: "交易订单",
["rate"]: "汇率监控",
["rate-list"]: "同步记录",
["rate-syntax"]: "汇率配置",
["system-base"]: "基本设置",
["system-rpc"]: "区块节点",
["create-order"]: "创建订单",
["github-api-doc"]: "对接文档",
["file"]: "文件管理",
["document-library"]: "文件库",
["table"]: "列表管理",
["common-table"]: "普通列表",
["custom-table"]: "自定义列表",
["form"]: "表单管理",
["common-form"]: "普通表单",
["step-form"]: "分步表单",
["multilevel"]: "多级菜单",
["second-1"]: "二级菜单-1",
["second-2"]: "二级菜单-2",
["third-1"]: "三级菜单-1",
["third-2"]: "三级菜单-2",
["third-3"]: "三级菜单-3",
["third-4"]: "三级菜单-4",
["third-5"]: "三级菜单-5",
["third-6"]: "三级菜单-6",
["third-7"]: "三级菜单-7",
["third-8"]: "三级菜单-8",
["third-9"]: "三级菜单-9",
["component"]: "组件管理",
["player"]: "播放器",
["print"]: "打印",
["draggable"]: "拖拽",
["editor"]: "富文本",
["newbie"]: "新手指引",
["icon-selector"]: "图标选择器",
["user-center"]: "用户中心",
["fingerprintjs2"]: "浏览器指纹",
["barcode"]: "条形码",
["qrcode"]: "二维码",
["pinyin"]: "拼音转换",
["markdown"]: "Markdown",
["directive"]: "自定义指令",
["anti-shake"]: "防抖",
["throttle"]: "节流",
["test-directive"]: "测试指令",
["personal"]: "个人中心",
["userinfo"]: "用户信息",
["user-settings"]: "用户设置",
["system"]: "系统管理",
["account"]: "账号管理",
["role"]: "角色管理",
["menu"]: "菜单管理",
["division"]: "部门管理",
["dictionary"]: "字典管理",
["log"]: "系统日志",
["about"]: "关于项目",
["link"]: "外部链接",
["internal"]: "内部",
["uigradients"]: "渐变配色",
["color-taking-tool"]: "取色工具",
["grid-generator"]: "网格生成器",
["external"]: "外部",
["vue"]: "vue官网",
["vite"]: "vite官网",
["github"]: "github",
["SnowAdmin-Docs"]: "SnowAdmin文档",
["juejin"]: "掘金",
["disable-menu"]: "停用菜单",
["hide-menu"]: "隐藏菜单",
["system-monitor"]: "系统监控",
["onlineuser"]: "在线用户",
["crontab"]: "定时任务",
["crontab-logs"]: "任务日志",
["i18n"]: "国际化",
["amap"]: "高德地图",
["permission"]: "权限测试",
["btn-perm"]: "按钮权限",
["admin-page"]: "管理员页面",
["common-page"]: "普通角色页面",
["functions"]: "常用功能",
["routing-operation"]: "路由操作",
["common-route"]: "普通路由",
["dynamic-route"]: "动态路由",
["audio"]: "音频",
["recorder"]: "录音",
["virtual-list"]: "虚拟列表",
["common-tools"]: "常用工具类",
["tree-tools"]: "树处理工具类",
["file-tools"]: "文件工具类",
["verify-tools"]: "校验工具类",
["common-layouts"]: "常用布局",
["data-screen"]: "数据大屏",
["thin-preview"]: "极简版预览",
["test"]: "测试"
}
};
export default {
system: {
["login"]: "登录",
["not-power"]: "没有权限",
["not-found"]: "未找到页面",
["zh-CN"]: "中文",
["en-US"]: "English",
["refresh"]: "刷新",
["close-current"]: "关闭当前",
["close-left-side"]: "关闭左侧",
["close-right-side"]: "关闭右侧",
["close-other"]: "关闭其它",
["close-all"]: "关闭全部",
["switch-to-night-mode"]: "切换黑夜模式",
["switch-to-daytime-mode"]: "切换白天模式",
["full-screen"]: "全屏",
["exit-full-screen"]: "退出全屏",
["system-settings"]: "系统设置",
["theme-settings"]: "主题设置",
["navigate mode"]: "导航模式",
["personal-information"]: "个人信息",
["change-password"]: "修改密码",
["project-address"]: "项目地址",
["logout"]: "退出登录",
["notice"]: "通知",
["message"]: "消息",
["backlog"]: "待办",
["switch-language-to-preview"]: "请切换语言来预览国际化效果",
["please-enter-something"]: "请输入",
["color weakness mode"]: "色弱模式",
["grey mode"]: "灰色模式",
["sidebar is dark"]: "侧边栏深色",
["page transition"]: "页面过渡",
["interface settings"]: "界面设置",
["menu folding"]: "菜单折叠",
["menu accordion"]: "菜单手风琴",
["breadcrumb"]: "面包屑",
["tab bar"]: "标签栏",
["page footer"]: "页脚",
["watermark settings"]: "水印设置",
["watermark color"]: "水印颜色",
["watermark text"]: "水印文案",
["watermark size"]: "水印大小",
["watermark angle"]: "水印角度",
["watermark gap"]: "水印间隙",
["system settings"]: "系统设置",
["anti-debugging"]: "防调试",
["please select"]: "请选择"
},
menu: {
["home"]: "首页",
["wallet"]: "钱包管理",
["order"]: "交易订单",
["rate"]: "汇率监控",
["rate-list"]: "同步记录",
["rate-syntax"]: "汇率配置",
["system-base"]: "基本设置",
["system-rpc"]: "区块节点",
["create-order"]: "创建订单",
["github-api-doc"]: "对接文档",
["file"]: "文件管理",
["document-library"]: "文件库",
["table"]: "列表管理",
["common-table"]: "普通列表",
["custom-table"]: "自定义列表",
["form"]: "表单管理",
["common-form"]: "普通表单",
["step-form"]: "分步表单",
["multilevel"]: "多级菜单",
["second-1"]: "二级菜单-1",
["second-2"]: "二级菜单-2",
["third-1"]: "三级菜单-1",
["third-2"]: "三级菜单-2",
["third-3"]: "三级菜单-3",
["third-4"]: "三级菜单-4",
["third-5"]: "三级菜单-5",
["third-6"]: "三级菜单-6",
["third-7"]: "三级菜单-7",
["third-8"]: "三级菜单-8",
["third-9"]: "三级菜单-9",
["component"]: "组件管理",
["player"]: "播放器",
["print"]: "打印",
["draggable"]: "拖拽",
["editor"]: "富文本",
["newbie"]: "新手指引",
["icon-selector"]: "图标选择器",
["user-center"]: "用户中心",
["fingerprintjs2"]: "浏览器指纹",
["barcode"]: "条形码",
["qrcode"]: "二维码",
["pinyin"]: "拼音转换",
["markdown"]: "Markdown",
["directive"]: "自定义指令",
["anti-shake"]: "防抖",
["throttle"]: "节流",
["test-directive"]: "测试指令",
["personal"]: "个人中心",
["userinfo"]: "用户信息",
["user-settings"]: "用户设置",
["system"]: "系统管理",
["account"]: "账号管理",
["role"]: "角色管理",
["menu"]: "菜单管理",
["division"]: "部门管理",
["dictionary"]: "字典管理",
["log"]: "系统日志",
["about"]: "关于项目",
["link"]: "外部链接",
["internal"]: "内部",
["uigradients"]: "渐变配色",
["color-taking-tool"]: "取色工具",
["grid-generator"]: "网格生成器",
["external"]: "外部",
["vue"]: "vue官网",
["vite"]: "vite官网",
["github"]: "github",
["SnowAdmin-Docs"]: "SnowAdmin文档",
["juejin"]: "掘金",
["disable-menu"]: "停用菜单",
["hide-menu"]: "隐藏菜单",
["system-monitor"]: "系统监控",
["onlineuser"]: "在线用户",
["crontab"]: "定时任务",
["crontab-logs"]: "任务日志",
["i18n"]: "国际化",
["amap"]: "高德地图",
["permission"]: "权限测试",
["btn-perm"]: "按钮权限",
["admin-page"]: "管理员页面",
["common-page"]: "普通角色页面",
["functions"]: "常用功能",
["routing-operation"]: "路由操作",
["common-route"]: "普通路由",
["dynamic-route"]: "动态路由",
["audio"]: "音频",
["recorder"]: "录音",
["virtual-list"]: "虚拟列表",
["common-tools"]: "常用工具类",
["tree-tools"]: "树处理工具类",
["file-tools"]: "文件工具类",
["verify-tools"]: "校验工具类",
["common-layouts"]: "常用布局",
["data-screen"]: "数据大屏",
["thin-preview"]: "极简版预览",
["test"]: "测试"
}
};
+75 -75
View File
@@ -1,75 +1,75 @@
<template>
<div :class="asideDark ? 'aside dark' : 'aside'">
<Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar>
</a-layout-sider>
</div>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark } = storeToRefs(themeStore);
const routerStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routerStore);
</script>
<style lang="scss" scoped>
.aside {
display: flex;
flex-direction: column;
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
flex: 1;
overflow: hidden;
.scrollbar {
height: 100%;
}
}
// 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// 消除title占位
.arco-menu-title {
display: none;
}
}
// 去掉sider背景
.arco-layout-sider {
background: unset;
}
</style>
<template>
<div :class="asideDark ? 'aside dark' : 'aside'">
<Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar>
</a-layout-sider>
</div>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark } = storeToRefs(themeStore);
const routerStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routerStore);
</script>
<style lang="scss" scoped>
.aside {
display: flex;
flex-direction: column;
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
flex: 1;
overflow: hidden;
.scrollbar {
height: 100%;
}
}
// 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// 消除title占位
.arco-menu-title {
display: none;
}
}
// 去掉sider背景
.arco-layout-sider {
background: unset;
}
</style>
+2 -1
View File
@@ -2,13 +2,14 @@
<a-layout-footer class="footer">
<div class="footer_title">
<div class="left-placeholder"></div>
<span @click="onBEpusdt" class="primary-copyright">© 2026 BEpusdt. All rights reserved.</span>
<span @click="onBEpusdt" class="primary-copyright">{{ currentYear }} © BEpusdt. All rights reserved.</span>
<span class="secondary-info">Powered by SnowAdmin</span>
</div>
</a-layout-footer>
</template>
<script setup lang="ts">
const currentYear = ref(new Date().getFullYear());
const onBEpusdt = () => {
window.open("https://github.com/v03413/BEpusdt", "_blank");
};
@@ -1,81 +1,81 @@
<template>
<div id="system-breadcrumb" class="breadcrumb" v-if="!isMobile && isBreadcrumb">
<a-space direction="vertical">
<a-breadcrumb>
<a-breadcrumb-item v-for="(item, index) in breadcrumb" :key="item.path" :class="transition">
<span v-if="index === breadcrumb.length - 1" class="main_button">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span>
<span v-else class="route_button" @click="onBreadcrumb(item)">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span>
</a-breadcrumb-item>
</a-breadcrumb>
</a-space>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
import { findPathOfParentNode } from "@/utils/tree-tools";
import { HOME_PATH } from "@/config/index";
const themeStore = useThemeConfig();
const { isBreadcrumb, transitionPage } = storeToRefs(themeStore);
const routeConfigStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routeConfigStore);
const { isMobile } = useDevicesSize();
const route = useRoute();
const router = useRouter();
/**
* 获取面包屑
* 根据当前路由信息获取,route.matched可以获取当前路由的所有父级路由信息
* 如果当前路由是home路由,则只返回当前路由信息(说明当前就是顶层)
* 否则返回所有父级路由信息,顶层路由重写为首页
*/
const breadcrumb = computed(() => {
// 如果是首页则直接返回当前路由信息
if (route.path === HOME_PATH) return [route];
// 返回路径信息
let list = findPathOfParentNode(routeTree.value, "name", route.name);
if (!list) return [];
if (!routeTree.value[0].children) list.unshift(routeTree.value[0]);
return list;
});
// 页面过渡
const transition = computed(() => {
if (transitionPage.value === "fadeInOut") {
return "fadeInOut-enter-active";
} else if (transitionPage.value === "cardInOut") {
return "cardInOut-enter-active";
} else {
return "fadeOut-enter-active";
}
});
// 面包屑跳转
const onBreadcrumb = (route: any) => {
let path = route.redirect || route.path;
router.replace((path as string) || HOME_PATH);
};
</script>
<style lang="scss" scoped>
.breadcrumb {
margin-left: $margin;
overflow: auto;
.main_button {
color: $color-text-1;
white-space: nowrap;
cursor: pointer;
}
.route_button {
color: $color-text-2;
white-space: nowrap;
cursor: pointer;
&:hover {
color: $color-primary;
}
}
}
</style>
<template>
<div id="system-breadcrumb" class="breadcrumb" v-if="!isMobile && isBreadcrumb">
<a-space direction="vertical">
<a-breadcrumb>
<a-breadcrumb-item v-for="(item, index) in breadcrumb" :key="item.path" :class="transition">
<span v-if="index === breadcrumb.length - 1" class="main_button">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span>
<span v-else class="route_button" @click="onBreadcrumb(item)">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span>
</a-breadcrumb-item>
</a-breadcrumb>
</a-space>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
import { findPathOfParentNode } from "@/utils/tree-tools";
import { HOME_PATH } from "@/config/index";
const themeStore = useThemeConfig();
const { isBreadcrumb, transitionPage } = storeToRefs(themeStore);
const routeConfigStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routeConfigStore);
const { isMobile } = useDevicesSize();
const route = useRoute();
const router = useRouter();
/**
* 获取面包屑
* 根据当前路由信息获取,route.matched可以获取当前路由的所有父级路由信息
* 如果当前路由是home路由,则只返回当前路由信息(说明当前就是顶层)
* 否则返回所有父级路由信息,顶层路由重写为首页
*/
const breadcrumb = computed(() => {
// 如果是首页则直接返回当前路由信息
if (route.path === HOME_PATH) return [route];
// 返回路径信息
let list = findPathOfParentNode(routeTree.value, "name", route.name);
if (!list) return [];
if (!routeTree.value[0].children) list.unshift(routeTree.value[0]);
return list;
});
// 页面过渡
const transition = computed(() => {
if (transitionPage.value === "fadeInOut") {
return "fadeInOut-enter-active";
} else if (transitionPage.value === "cardInOut") {
return "cardInOut-enter-active";
} else {
return "fadeOut-enter-active";
}
});
// 面包屑跳转
const onBreadcrumb = (route: any) => {
let path = route.redirect || route.path;
router.replace((path as string) || HOME_PATH);
};
</script>
<style lang="scss" scoped>
.breadcrumb {
margin-left: $margin;
overflow: auto;
.main_button {
color: $color-text-1;
white-space: nowrap;
cursor: pointer;
}
.route_button {
color: $color-text-2;
white-space: nowrap;
cursor: pointer;
&:hover {
color: $color-primary;
}
}
}
</style>
@@ -1,75 +1,75 @@
<template>
<a-tabs :default-active-key="current" :active-key="current" @tab-click="onTab">
<a-tab-pane v-for="item in noticeData" :key="item.id">
<template #title>{{ `${$t(`system.${item.title}`)}(${item.data.length})` }}</template>
<div class="notice" v-for="content in item.data" :key="content.id">
<a-image width="36" height="36" fit="cover" :src="myImage" class="notice_img" />
<div class="content margin-left-text">
<div>
<span class="nickname">{{ content.nickname }}</span>
<span class="time margin-left-text">{{ content.time }}</span>
</div>
<div class="context">{{ content.content }}</div>
</div>
</div>
<a-empty v-if="item.data.length === 0" />
</a-tab-pane>
</a-tabs>
</template>
<script setup lang="ts">
import myImage from "@/assets/img/my-image.jpg";
const data = ref([
{ id: 100, img: "", time: "1分钟前", nickname: "兔子先森", content: "一键三连" },
{ id: 120, img: "", time: "1小时前", nickname: "捷克大力士", content: "与你握手问好" },
{ id: 130, img: "", time: "2小时前", nickname: "forever", content: "you forever" }
]);
const noticeData = ref([
{
id: 1,
title: "notice",
data: data.value
},
{ id: 2, title: "message", data: [] },
{ id: 3, title: "backlog", data: [] }
]);
const current = ref<number>(1);
const onTab = (key: number) => {
current.value = key;
};
</script>
<style lang="scss" scoped>
.notice {
display: flex;
align-items: center;
margin-bottom: $margin;
.notice_img {
width: 36px;
height: 36px;
border-radius: 50%;
}
.content {
width: 200px;
.nickname {
font-size: $font-size-body-3;
color: $color-text-2;
}
.time {
font-size: $font-size-body-1;
color: $color-text-3;
}
.context {
font-size: $font-size-body-3;
}
}
}
.margin-left-text {
margin-left: $margin-text;
}
// 解决tabs宽度异常的bug
:deep(.arco-tabs-content .arco-tabs-content-list) {
display: unset;
}
</style>
<template>
<a-tabs :default-active-key="current" :active-key="current" @tab-click="onTab">
<a-tab-pane v-for="item in noticeData" :key="item.id">
<template #title>{{ `${$t(`system.${item.title}`)}(${item.data.length})` }}</template>
<div class="notice" v-for="content in item.data" :key="content.id">
<a-image width="36" height="36" fit="cover" :src="myImage" class="notice_img" />
<div class="content margin-left-text">
<div>
<span class="nickname">{{ content.nickname }}</span>
<span class="time margin-left-text">{{ content.time }}</span>
</div>
<div class="context">{{ content.content }}</div>
</div>
</div>
<a-empty v-if="item.data.length === 0" />
</a-tab-pane>
</a-tabs>
</template>
<script setup lang="ts">
import myImage from "@/assets/img/my-image.jpg";
const data = ref([
{ id: 100, img: "", time: "1分钟前", nickname: "兔子先森", content: "一键三连" },
{ id: 120, img: "", time: "1小时前", nickname: "捷克大力士", content: "与你握手问好" },
{ id: 130, img: "", time: "2小时前", nickname: "forever", content: "you forever" }
]);
const noticeData = ref([
{
id: 1,
title: "notice",
data: data.value
},
{ id: 2, title: "message", data: [] },
{ id: 3, title: "backlog", data: [] }
]);
const current = ref<number>(1);
const onTab = (key: number) => {
current.value = key;
};
</script>
<style lang="scss" scoped>
.notice {
display: flex;
align-items: center;
margin-bottom: $margin;
.notice_img {
width: 36px;
height: 36px;
border-radius: 50%;
}
.content {
width: 200px;
.nickname {
font-size: $font-size-body-3;
color: $color-text-2;
}
.time {
font-size: $font-size-body-1;
color: $color-text-3;
}
.context {
font-size: $font-size-body-3;
}
}
}
.margin-left-text {
margin-left: $margin-text;
}
// 解决tabs宽度异常的bug
:deep(.arco-tabs-content .arco-tabs-content-list) {
display: unset;
}
</style>
@@ -1,48 +1,48 @@
<template>
<div class="menu_fold">
<a-button size="mini" type="text" class="menu_fold_icon" id="system-collapsed" @click="onCollapsed">
<template #icon>
<icon-menu-fold :size="18" v-if="!collapsed" />
<icon-menu-unfold :size="18" v-if="collapsed" />
</template>
</a-button>
</div>
<DrawerAside v-if="!isPc" />
</template>
<script setup lang="ts">
import DrawerAside from "@/layout/components/drawer-aside/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
const themeStore = useThemeConfig();
const { collapsed } = storeToRefs(themeStore);
const { isPc } = useDevicesSize();
// 刷新时,PC窗口展开菜单,移动端收起菜单
collapsed.value = isPc.value ? false : true;
// 折叠
const onCollapsed = () => {
themeStore.setCollapsed(!collapsed.value);
};
// 监听屏幕尺寸变化,PC端自动展开菜单,移动端自动收起
watch(isPc, (newV: boolean) => {
collapsed.value = newV ? false : true;
});
</script>
<style lang="scss" scoped>
.menu_fold {
display: flex;
align-items: center;
justify-content: space-around;
width: 32px;
height: 32px;
.menu_fold_icon {
color: $color-text-1;
border-radius: $radius-box-1;
}
}
</style>
<template>
<div class="menu_fold">
<a-button size="mini" type="text" class="menu_fold_icon" id="system-collapsed" @click="onCollapsed">
<template #icon>
<icon-menu-fold :size="18" v-if="!collapsed" />
<icon-menu-unfold :size="18" v-if="collapsed" />
</template>
</a-button>
</div>
<DrawerAside v-if="!isPc" />
</template>
<script setup lang="ts">
import DrawerAside from "@/layout/components/drawer-aside/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
const themeStore = useThemeConfig();
const { collapsed } = storeToRefs(themeStore);
const { isPc } = useDevicesSize();
// 刷新时,PC窗口展开菜单,移动端收起菜单
collapsed.value = isPc.value ? false : true;
// 折叠
const onCollapsed = () => {
themeStore.setCollapsed(!collapsed.value);
};
// 监听屏幕尺寸变化,PC端自动展开菜单,移动端自动收起
watch(isPc, (newV: boolean) => {
collapsed.value = newV ? false : true;
});
</script>
<style lang="scss" scoped>
.menu_fold {
display: flex;
align-items: center;
justify-content: space-around;
width: 32px;
height: 32px;
.menu_fold_icon {
color: $color-text-1;
border-radius: $radius-box-1;
}
}
</style>
@@ -1,19 +1,19 @@
<template>
<div class="header_crumb">
<ButtonCollapsed />
<Breadcrumb />
</div>
</template>
<script setup lang="ts">
import Breadcrumb from "@/layout/components/Header/components/Breadcrumb/index.vue";
import ButtonCollapsed from "@/layout/components/Header/components/button-collapsed/index.vue";
</script>
<style lang="scss" scoped>
.header_crumb {
display: flex;
align-items: center;
width: 100%;
}
</style>
<template>
<div class="header_crumb">
<ButtonCollapsed />
<Breadcrumb />
</div>
</template>
<script setup lang="ts">
import Breadcrumb from "@/layout/components/Header/components/Breadcrumb/index.vue";
import ButtonCollapsed from "@/layout/components/Header/components/button-collapsed/index.vue";
</script>
<style lang="scss" scoped>
.header_crumb {
display: flex;
align-items: center;
width: 100%;
}
</style>
@@ -1,224 +1,224 @@
<template>
<div class="header_setting" :class="isMobile && 'head-absolute-fix'">
<!-- 国际化 -->
<!-- 暂时也是真没精力搞国际化 -->
<!-- <a-dropdown trigger="hover" @select="onLange">
<a-button size="mini" type="text" class="icon_btn" id="system-language">
<template #icon>
<icon-language :size="18" />
</template>
</a-button>
<template #content>
<a-doption :disabled="language === 'zh-CN'">{{ $t(`system.zh-CN`) }}</a-doption>
<a-doption :disabled="language === 'en-US'">{{ $t(`system.en-US`) }}</a-doption>
</template>
</a-dropdown> -->
<!-- 皮肤设置 -->
<a-tooltip :content="$t(`system.system-settings`)">
<a-button size="mini" type="text" class="icon_btn" id="system-settings" @click="onSystemSetting">
<template #icon>
<icon-skin :size="18" />
</template>
</a-button>
</a-tooltip>
<!-- 切换黑夜模式 -->
<a-tooltip :content="$t(`system.${!darkMode ? 'switch-to-night-mode' : 'switch-to-daytime-mode'}`)">
<a-button size="mini" type="text" class="icon_btn" id="system-dark" @click="onNightMode">
<template #icon>
<icon-sun-fill :size="18" v-if="!darkMode" />
<icon-moon-fill :size="18" v-else />
</template>
</a-button>
</a-tooltip>
<!-- 我的 -->
<a-dropdown trigger="hover">
<div class="my_setting" id="system-my-setting">
<!-- <a-image width="32" height="32" fit="cover" :src="account.user.avatar || myImage" class="my_image" /> -->
<span class="user-nickname">Hi {{ admin_username || "BEpusdt" }}</span>
<div class="icon_down">
<icon-down style="stroke-width: 3" />
</div>
</div>
<template #content>
<!-- 项目地址 -->
<a-doption @click="onProject">
<template #default>
<s-svg-icon :name="'github'" :size="18" />
<span class="margin-left-text">{{ $t(`system.project-address`) }}</span>
</template>
</a-doption>
<a-divider margin="0" />
<!-- 退出登录 -->
<a-doption @click="logOut">
<template #default>
<s-svg-icon :name="'exit'" :size="18" />
<span class="margin-left-text">{{ $t(`system.logout`) }}</span>
</template>
</a-doption>
</template>
</a-dropdown>
</div>
<SystemSettings :system-open="systemOpen" @system-cancel="systemOpen = false" />
<ThemeSettings :theme-open="themeOpen" @theme-cancel="themeOpen = false" />
</template>
<script setup lang="ts">
// import Notice from "@/layout/components/Header/components/Notice/index.vue";
import SystemSettings from "@/layout/components/Header/components/system-settings/index.vue";
import ThemeSettings from "@/layout/components/Header/components/theme-settings/index.vue";
// import { useI18n } from "vue-i18n";
import { Modal } from "@arco-design/web-vue";
import { useRouter } from "vue-router";
import { storeToRefs } from "pinia";
import { useUserInfoStore } from "@/store/modules/user-info";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useThemeMethods } from "@/hooks/useThemeMethods";
import { useDevicesSize } from "@/hooks/useDevicesSize";
import { useRouteConfigStore } from "@/store/modules/route-config";
// const i18n = useI18n();
const router = useRouter();
const { isMobile } = useDevicesSize();
const userStore = useUserInfoStore();
const themeStore = useThemeConfig();
// const { language, darkMode } = storeToRefs(themeStore);
const { darkMode } = storeToRefs(themeStore);
const { admin_username } = storeToRefs(userStore); // 添加这行来获取 admin_username
// 系统设置
const systemOpen = ref(false);
const onSystemSetting = () => {
systemOpen.value = true;
};
// 主题设置
const themeOpen = ref(false);
// const onThemeSetting = () => {
// themeOpen.value = true;
// };
// 全屏
// const fullScreen = ref(true);
// const onFullScreen = () => {
// if (!document.fullscreenElement) {
// document.documentElement.requestFullscreen();
// fullScreen.value = false;
// } else {
// if (document.exitFullscreen) {
// document.exitFullscreen();
// fullScreen.value = true;
// }
// }
// };
// 黑暗模式
const onNightMode = () => {
darkMode.value = !darkMode.value;
let { setDarkMode } = useThemeMethods();
setDarkMode();
};
// 语言
// const onLange = (value: string) => {
// if (value === "Chinese" || value === "中文") {
// themeStore.setLanguage("zh-CN");
// } else {
// themeStore.setLanguage("en-US");
// }
// i18n.locale.value = language.value;
// };
// 项目地址
const onProject = () => {
window.open("https://github.com/v03413/BEpusdt", "_blank");
};
// 退出登录
const logOut = () => {
Modal.warning({
title: "提示",
content: "确定退出登录?",
hideCancel: false,
closable: true,
onBeforeOk: async () => {
try {
// 用户退出
await userStore.logOut();
router.replace("/login");
// 清除路由数据
useRouteConfigStore().resetRoute();
return true;
} catch {
return false;
}
}
});
};
</script>
<style lang="scss" scoped>
.head-absolute-fix {
position: absolute;
top: 0;
right: $padding;
}
.header_setting {
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
background-color: $color-bg-2;
> .icon_btn {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-around;
width: $icon-box;
height: $icon-box;
margin-left: $margin;
color: $color-text-1;
border-radius: $radius-box-1;
}
.my_setting {
display: flex;
align-items: center;
justify-content: space-between;
height: 32px;
margin-left: $margin;
overflow: hidden;
.my_image {
margin-right: 8px;
border-radius: 50%;
}
.user-nickname {
white-space: nowrap;
}
.icon_down {
margin: 0 0 0 5px;
transform: rotate(0deg);
transition: transform 0.2s;
}
}
}
.notice {
position: relative;
&::before {
position: absolute;
top: -4px;
right: -2px;
width: 6px;
height: 6px;
content: "";
background: $color-danger;
border: 2px solid #ffffff;
border-radius: 50%;
}
}
:deep(.arco-dropdown-open) {
.icon_down {
transform: rotate(180deg) !important;
}
}
.margin-left-text {
margin-left: $margin-text;
}
</style>
<template>
<div class="header_setting" :class="isMobile && 'head-absolute-fix'">
<!-- 国际化 -->
<!-- 暂时也是真没精力搞国际化 -->
<!-- <a-dropdown trigger="hover" @select="onLange">
<a-button size="mini" type="text" class="icon_btn" id="system-language">
<template #icon>
<icon-language :size="18" />
</template>
</a-button>
<template #content>
<a-doption :disabled="language === 'zh-CN'">{{ $t(`system.zh-CN`) }}</a-doption>
<a-doption :disabled="language === 'en-US'">{{ $t(`system.en-US`) }}</a-doption>
</template>
</a-dropdown> -->
<!-- 皮肤设置 -->
<a-tooltip :content="$t(`system.system-settings`)">
<a-button size="mini" type="text" class="icon_btn" id="system-settings" @click="onSystemSetting">
<template #icon>
<icon-skin :size="18" />
</template>
</a-button>
</a-tooltip>
<!-- 切换黑夜模式 -->
<a-tooltip :content="$t(`system.${!darkMode ? 'switch-to-night-mode' : 'switch-to-daytime-mode'}`)">
<a-button size="mini" type="text" class="icon_btn" id="system-dark" @click="onNightMode">
<template #icon>
<icon-sun-fill :size="18" v-if="!darkMode" />
<icon-moon-fill :size="18" v-else />
</template>
</a-button>
</a-tooltip>
<!-- 我的 -->
<a-dropdown trigger="hover">
<div class="my_setting" id="system-my-setting">
<!-- <a-image width="32" height="32" fit="cover" :src="account.user.avatar || myImage" class="my_image" /> -->
<span class="user-nickname">Hi {{ admin_username || "BEpusdt" }}</span>
<div class="icon_down">
<icon-down style="stroke-width: 3" />
</div>
</div>
<template #content>
<!-- 项目地址 -->
<a-doption @click="onProject">
<template #default>
<s-svg-icon :name="'github'" :size="18" />
<span class="margin-left-text">{{ $t(`system.project-address`) }}</span>
</template>
</a-doption>
<a-divider margin="0" />
<!-- 退出登录 -->
<a-doption @click="logOut">
<template #default>
<s-svg-icon :name="'exit'" :size="18" />
<span class="margin-left-text">{{ $t(`system.logout`) }}</span>
</template>
</a-doption>
</template>
</a-dropdown>
</div>
<SystemSettings :system-open="systemOpen" @system-cancel="systemOpen = false" />
<ThemeSettings :theme-open="themeOpen" @theme-cancel="themeOpen = false" />
</template>
<script setup lang="ts">
// import Notice from "@/layout/components/Header/components/Notice/index.vue";
import SystemSettings from "@/layout/components/Header/components/system-settings/index.vue";
import ThemeSettings from "@/layout/components/Header/components/theme-settings/index.vue";
// import { useI18n } from "vue-i18n";
import { Modal } from "@arco-design/web-vue";
import { useRouter } from "vue-router";
import { storeToRefs } from "pinia";
import { useUserInfoStore } from "@/store/modules/user-info";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useThemeMethods } from "@/hooks/useThemeMethods";
import { useDevicesSize } from "@/hooks/useDevicesSize";
import { useRouteConfigStore } from "@/store/modules/route-config";
// const i18n = useI18n();
const router = useRouter();
const { isMobile } = useDevicesSize();
const userStore = useUserInfoStore();
const themeStore = useThemeConfig();
// const { language, darkMode } = storeToRefs(themeStore);
const { darkMode } = storeToRefs(themeStore);
const { admin_username } = storeToRefs(userStore); // 添加这行来获取 admin_username
// 系统设置
const systemOpen = ref(false);
const onSystemSetting = () => {
systemOpen.value = true;
};
// 主题设置
const themeOpen = ref(false);
// const onThemeSetting = () => {
// themeOpen.value = true;
// };
// 全屏
// const fullScreen = ref(true);
// const onFullScreen = () => {
// if (!document.fullscreenElement) {
// document.documentElement.requestFullscreen();
// fullScreen.value = false;
// } else {
// if (document.exitFullscreen) {
// document.exitFullscreen();
// fullScreen.value = true;
// }
// }
// };
// 黑暗模式
const onNightMode = () => {
darkMode.value = !darkMode.value;
let { setDarkMode } = useThemeMethods();
setDarkMode();
};
// 语言
// const onLange = (value: string) => {
// if (value === "Chinese" || value === "中文") {
// themeStore.setLanguage("zh-CN");
// } else {
// themeStore.setLanguage("en-US");
// }
// i18n.locale.value = language.value;
// };
// 项目地址
const onProject = () => {
window.open("https://github.com/v03413/BEpusdt", "_blank");
};
// 退出登录
const logOut = () => {
Modal.warning({
title: "提示",
content: "确定退出登录?",
hideCancel: false,
closable: true,
onBeforeOk: async () => {
try {
// 用户退出
await userStore.logOut();
router.replace("/login");
// 清除路由数据
useRouteConfigStore().resetRoute();
return true;
} catch {
return false;
}
}
});
};
</script>
<style lang="scss" scoped>
.head-absolute-fix {
position: absolute;
top: 0;
right: $padding;
}
.header_setting {
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
background-color: $color-bg-2;
> .icon_btn {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-around;
width: $icon-box;
height: $icon-box;
margin-left: $margin;
color: $color-text-1;
border-radius: $radius-box-1;
}
.my_setting {
display: flex;
align-items: center;
justify-content: space-between;
height: 32px;
margin-left: $margin;
overflow: hidden;
.my_image {
margin-right: 8px;
border-radius: 50%;
}
.user-nickname {
white-space: nowrap;
}
.icon_down {
margin: 0 0 0 5px;
transform: rotate(0deg);
transition: transform 0.2s;
}
}
}
.notice {
position: relative;
&::before {
position: absolute;
top: -4px;
right: -2px;
width: 6px;
height: 6px;
content: "";
background: $color-danger;
border: 2px solid #ffffff;
border-radius: 50%;
}
}
:deep(.arco-dropdown-open) {
.icon_down {
transform: rotate(180deg) !important;
}
}
.margin-left-text {
margin-left: $margin-text;
}
</style>
@@ -1,154 +1,159 @@
<template>
<a-drawer :width="340" :visible="props.systemOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
<template #title> 系统设置 </template>
<div>
<div>
<div class="title">界面设置</div>
<div class="flex-row">
<div>菜单折叠</div>
<a-switch v-model="collapsed" />
</div>
<div class="flex-row">
<div>菜单手风琴</div>
<a-switch v-model="isAccordion" />
</div>
<div class="flex-row">
<div>面包屑</div>
<a-switch v-model="isBreadcrumb" />
</div>
<div class="flex-row">
<div>标签栏</div>
<a-switch v-model="isTabs" @change="tabsChange" />
</div>
<div class="flex-row">
<div>页脚</div>
<a-switch v-model="isFooter" />
</div>
</div>
<div>
<div class="title">水印设置</div>
<div class="flex-row">
<div>水印颜色</div>
<pick-colors
:theme="darkMode ? 'dark' : 'light'"
show-alpha
format="rgb"
v-model:value="watermarkStyle.color"
:colors="['rgba(0, 0, 0, 0.15)']"
:z-index="2000"
/>
</div>
<div class="flex-row">
<div>水印文案</div>
<a-input :style="{ width: '100px' }" v-model="watermark" placeholder="请输入" allow-clear />
</div>
<div class="flex-row">
<div>水印大小</div>
<a-slider v-model="watermarkStyle.fontSize" :min="10" :max="50" :style="{ width: '100px' }" />
</div>
<div class="flex-row">
<div>水印角度</div>
<a-slider v-model="watermarkRotate" :min="0" :max="360" :style="{ width: '100px' }" />
</div>
<div class="flex-row">
<div>水印间隙</div>
<a-slider :default-value="gapInfo[0]" :min="0" :max="300" :style="{ width: '100px' }" @change="onWatermarkGap" />
</div>
</div>
<div>
<div class="title">系统设置</div>
<div class="flex-row">
<div>防调试</div>
<a-switch v-model="debugPrevention" />
</div>
</div>
</div>
</a-drawer>
</template>
<script setup lang="ts">
import PickColors from "vue-pick-colors";
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useThemeConfig } from "@/store/modules/theme-config";
import { currentlyRoute } from "@/router/route-output";
import { DebugControl } from "@/utils/debug-prevention";
const themeStore = useThemeConfig();
const routerStore = useRouteConfigStore();
const {
collapsed,
isAccordion,
isBreadcrumb,
isTabs,
isFooter,
watermark,
watermarkStyle,
watermarkRotate,
watermarkGap,
darkMode,
debugPrevention
} = storeToRefs(themeStore);
const { tabsList, cacheRoutes } = storeToRefs(routerStore);
const route = useRoute();
const props = defineProps({
systemOpen: {
type: Boolean,
default: false
}
});
const gapInfo = ref(watermarkGap.value);
const onWatermarkGap = (e: number) => {
watermarkGap.value = watermarkGap.value.map(() => e);
};
/*
是否关闭tabs栏
如果关闭,那么所有tabs全部取消、所有页面缓存全部取消
如果开启,那么添加当前路由到tabs
*/
const tabsChange = (e: boolean) => {
if (!e) {
tabsList.value = [];
cacheRoutes.value = [];
} else {
currentlyRoute(route);
}
};
// 监听debug开关;
const debugControl = new DebugControl();
watch(
() => debugPrevention.value,
newValue => {
if (newValue) {
debugControl.start();
} else {
debugControl.stop();
}
},
{
immediate: true
}
);
const emits = defineEmits(["systemCancel"]);
const handleCancel = () => {
emits("systemCancel");
};
</script>
<style lang="scss" scoped>
.title {
margin-bottom: $margin;
font-size: $font-size-title-1;
font-weight: bold;
color: $color-text-1;
}
.flex-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: $margin;
}
</style>
<template>
<a-drawer :width="340" :visible="props.systemOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
<template #title>{{ $t(`system.system settings`) }}</template>
<div>
<div>
<div class="title">{{ $t(`system.interface settings`) }}</div>
<div class="flex-row">
<div>{{ $t(`system.menu folding`) }}</div>
<a-switch v-model="collapsed" />
</div>
<div class="flex-row">
<div>{{ $t(`system.menu accordion`) }}</div>
<a-switch v-model="isAccordion" />
</div>
<div class="flex-row">
<div>{{ $t(`system.breadcrumb`) }}</div>
<a-switch v-model="isBreadcrumb" />
</div>
<div class="flex-row">
<div>{{ $t(`system.tab bar`) }}</div>
<a-switch v-model="isTabs" @change="tabsChange" />
</div>
<div class="flex-row">
<div>{{ $t(`system.page footer`) }}</div>
<a-switch v-model="isFooter" />
</div>
</div>
<div>
<div class="title">{{ $t(`system.watermark settings`) }}</div>
<div class="flex-row">
<div>{{ $t(`system.watermark color`) }}</div>
<pick-colors
:theme="darkMode ? 'dark' : 'light'"
show-alpha
format="rgb"
v-model:value="watermarkStyle.color"
:colors="['rgba(0, 0, 0, 0.15)']"
:z-index="2000"
/>
</div>
<div class="flex-row">
<div>{{ $t(`system.watermark text`) }}</div>
<a-input
:style="{ width: '100px' }"
v-model="watermark"
:placeholder="$t(`system.please-enter-something`)"
allow-clear
/>
</div>
<div class="flex-row">
<div>{{ $t(`system.watermark size`) }}</div>
<a-slider v-model="watermarkStyle.fontSize" :min="10" :max="50" :style="{ width: '100px' }" />
</div>
<div class="flex-row">
<div>{{ $t(`system.watermark angle`) }}</div>
<a-slider v-model="watermarkRotate" :min="0" :max="360" :style="{ width: '100px' }" />
</div>
<div class="flex-row">
<div>{{ $t(`system.watermark gap`) }}</div>
<a-slider :default-value="gapInfo[0]" :min="0" :max="300" :style="{ width: '100px' }" @change="onWatermarkGap" />
</div>
</div>
<div>
<div class="title">{{ $t(`system.system settings`) }}</div>
<div class="flex-row">
<div>{{ $t(`system.anti-debugging`) }}</div>
<a-switch v-model="debugPrevention" />
</div>
</div>
</div>
</a-drawer>
</template>
<script setup lang="ts">
import PickColors from "vue-pick-colors";
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useThemeConfig } from "@/store/modules/theme-config";
import { currentlyRoute } from "@/router/route-output";
import { DebugControl } from "@/utils/debug-prevention";
const themeStore = useThemeConfig();
const routerStore = useRouteConfigStore();
const {
collapsed,
isAccordion,
isBreadcrumb,
isTabs,
isFooter,
watermark,
watermarkStyle,
watermarkRotate,
watermarkGap,
darkMode,
debugPrevention
} = storeToRefs(themeStore);
const { tabsList, cacheRoutes } = storeToRefs(routerStore);
const route = useRoute();
const props = defineProps({
systemOpen: {
type: Boolean,
default: false
}
});
const gapInfo = ref(watermarkGap.value);
const onWatermarkGap = (e: number) => {
watermarkGap.value = watermarkGap.value.map(() => e);
};
/*
是否关闭tabs栏
如果关闭,那么所有tabs全部取消、所有页面缓存全部取消
如果开启,那么添加当前路由到tabs
*/
const tabsChange = (e: boolean) => {
if (!e) {
tabsList.value = [];
cacheRoutes.value = [];
} else {
currentlyRoute(route);
}
};
// 监听debug开关;
const debugControl = new DebugControl();
watch(
() => debugPrevention.value,
newValue => {
if (newValue) {
debugControl.start();
} else {
debugControl.stop();
}
},
{
immediate: true
}
);
const emits = defineEmits(["systemCancel"]);
const handleCancel = () => {
emits("systemCancel");
};
</script>
<style lang="scss" scoped>
.title {
margin-bottom: $margin;
font-size: $font-size-title-1;
font-weight: bold;
color: $color-text-1;
}
.flex-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: $margin;
}
</style>
@@ -1,237 +1,237 @@
<template>
<a-drawer :width="340" :visible="props.themeOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
<template #title> 主题设置 </template>
<div>
<div>
<a-divider orientation="center">导航模式</a-divider>
<div class="flex-center">
<a-tooltip v-for="item in layoutList" :key="item.value" :content="item.label" position="top" mini>
<div
:class="layoutType === item.value ? `current-layout ${item.class}` : item.class"
@click="layouetChange(item.value)"
>
<icon-check-circle-fill class="layout-icon" />
</div>
</a-tooltip>
</div>
</div>
<div class="box-gap">
<a-divider orientation="center">主题设置</a-divider>
<div class="flex-center">
<ColorPicker
:theme="darkMode ? 'dark' : 'light'"
sucker-hide
:colors-default="presetColors"
:color="themeColor"
@change-color="themeColorChange"
/>
</div>
</div>
<div class="box-gap">
<div class="flex-row">
<div>色弱模式</div>
<a-switch v-model="colorWeakMode" @change="onColorWeak" />
</div>
<div class="flex-row">
<div>灰色模式</div>
<a-switch v-model="grayMode" @change="onGray" />
</div>
<div class="flex-row">
<div>侧边栏深色</div>
<a-switch :disabled="darkMode" v-model="asideDark" />
</div>
<div class="flex-row">
<div>页面过渡</div>
<a-select v-model="transitionPage" :style="{ width: '120px' }" placeholder="请选择">
<a-option v-for="item in transitions" :key="item.value" :value="item.value" :label="item.label" />
</a-select>
</div>
</div>
</div>
</a-drawer>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useThemeMethods } from "@/hooks/useThemeMethods";
import { useDevicesSize } from "@/hooks/useDevicesSize";
import { ColorPicker } from "vue-color-kit";
import "vue-color-kit/dist/vue-color-kit.css";
const themeStore = useThemeConfig();
const { layoutType, collapsed, colorWeakMode, grayMode, darkMode, asideDark, transitionPage, themeColor, presetColors } =
storeToRefs(themeStore);
const layoutList = reactive({
layoutDefaults: {
value: "layoutDefaults",
label: "默认布局",
class: "layout-defaults"
},
layoutHead: {
value: "layoutHead",
label: "横向布局",
class: "layout-head"
},
layoutMixing: {
value: "layoutMixing",
label: "混合布局",
class: "layout-mixing"
}
});
const transitions = ref([
{ value: "fadeInOut", label: "轻过渡" },
{ value: "cardInOut", label: "卡片" },
{ value: "fadeOut", label: "渐退" }
]);
interface IThemeColor {
hex: string;
hsv: {
h: number;
s: number;
v: number;
};
rgba: {
r: number;
g: number;
b: number;
a: number;
};
}
// 主题色设置
const themeColorChange = (value: IThemeColor) => {
themeColor.value = value.hex;
const { setThemeColor } = useThemeMethods();
setThemeColor();
};
// 色弱模式
const onColorWeak = () => {
const { setColorWeak } = useThemeMethods();
setColorWeak();
};
// 灰色模式
const onGray = () => {
const { setGray } = useThemeMethods();
setGray();
};
// 布局变化
const layouetChange = (type: string) => {
layoutType.value = type;
const { isPc } = useDevicesSize();
collapsed.value = isPc.value ? false : true;
};
const props = defineProps({
themeOpen: {
type: Boolean,
default: false
}
});
const emits = defineEmits(["themeCancel"]);
const handleCancel = () => {
emits("themeCancel");
};
</script>
<style lang="scss" scoped>
.box-gap {
margin-top: 30px;
}
.flex-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: $margin;
}
.flex-center {
display: flex;
column-gap: $margin;
align-items: center;
justify-content: center;
margin-bottom: $margin;
}
.layout-defaults,
.layout-head,
.layout-mixing {
width: 70px;
height: 50px;
overflow: hidden;
background: $color-fill-1;
border-radius: $radius-box-1;
box-shadow: $shadow-special;
.layout-icon {
display: none;
}
}
.current-layout {
position: relative;
.layout-icon {
position: absolute;
right: 2px;
bottom: 2px;
display: block;
font-size: $font-size-body-3;
color: $color-primary;
}
}
.layout-defaults {
position: relative;
&::before {
position: absolute;
left: 0;
width: 10px;
height: 100%;
content: "";
background: #232324;
}
&::after {
position: absolute;
top: 0;
right: 0;
width: 60px;
height: 10px;
content: "";
background: #c2c4c8;
}
}
.layout-head {
position: relative;
&::before {
position: absolute;
top: 0;
width: 100%;
height: 10px;
content: "";
background: #232324;
}
}
.layout-mixing {
position: relative;
&::before {
position: absolute;
top: 0;
width: 100%;
height: 10px;
content: "";
background: #232324;
}
&::after {
position: absolute;
top: 10px;
left: 0;
width: 10px;
height: calc(100% - 10px);
content: "";
background: #232324;
}
}
:deep(.arco-divider-text) {
background: $color-bg-3;
}
</style>
<template>
<a-drawer :width="340" :visible="props.themeOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
<template #title>{{ $t(`system.theme-settings`) }}</template>
<div>
<div>
<a-divider orientation="center">{{ $t(`system.navigate mode`) }}</a-divider>
<div class="flex-center">
<a-tooltip v-for="item in layoutList" :key="item.value" :content="item.label" position="top" mini>
<div
:class="layoutType === item.value ? `current-layout ${item.class}` : item.class"
@click="layouetChange(item.value)"
>
<icon-check-circle-fill class="layout-icon" />
</div>
</a-tooltip>
</div>
</div>
<div class="box-gap">
<a-divider orientation="center">{{ $t(`system.theme-settings`) }}</a-divider>
<div class="flex-center">
<ColorPicker
:theme="darkMode ? 'dark' : 'light'"
sucker-hide
:colors-default="presetColors"
:color="themeColor"
@change-color="themeColorChange"
/>
</div>
</div>
<div class="box-gap">
<div class="flex-row">
<div>{{ $t(`system.color weakness mode`) }}</div>
<a-switch v-model="colorWeakMode" @change="onColorWeak" />
</div>
<div class="flex-row">
<div>{{ $t(`system.grey mode`) }}</div>
<a-switch v-model="grayMode" @change="onGray" />
</div>
<div class="flex-row">
<div>{{ $t(`system.sidebar is dark`) }}</div>
<a-switch :disabled="darkMode" v-model="asideDark" />
</div>
<div class="flex-row">
<div>{{ $t(`system.page transition`) }}</div>
<a-select v-model="transitionPage" :style="{ width: '120px' }" :placeholder="$t(`system.please select`)">
<a-option v-for="item in transitions" :key="item.value" :value="item.value" :label="item.label" />
</a-select>
</div>
</div>
</div>
</a-drawer>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useThemeMethods } from "@/hooks/useThemeMethods";
import { useDevicesSize } from "@/hooks/useDevicesSize";
import { ColorPicker } from "vue-color-kit";
import "vue-color-kit/dist/vue-color-kit.css";
const themeStore = useThemeConfig();
const { layoutType, collapsed, colorWeakMode, grayMode, darkMode, asideDark, transitionPage, themeColor, presetColors } =
storeToRefs(themeStore);
const layoutList = reactive({
layoutDefaults: {
value: "layoutDefaults",
label: "默认布局",
class: "layout-defaults"
},
layoutHead: {
value: "layoutHead",
label: "横向布局",
class: "layout-head"
},
layoutMixing: {
value: "layoutMixing",
label: "混合布局",
class: "layout-mixing"
}
});
const transitions = ref([
{ value: "fadeInOut", label: "轻过渡" },
{ value: "cardInOut", label: "卡片" },
{ value: "fadeOut", label: "渐退" }
]);
interface IThemeColor {
hex: string;
hsv: {
h: number;
s: number;
v: number;
};
rgba: {
r: number;
g: number;
b: number;
a: number;
};
}
// 主题色设置
const themeColorChange = (value: IThemeColor) => {
themeColor.value = value.hex;
const { setThemeColor } = useThemeMethods();
setThemeColor();
};
// 色弱模式
const onColorWeak = () => {
const { setColorWeak } = useThemeMethods();
setColorWeak();
};
// 灰色模式
const onGray = () => {
const { setGray } = useThemeMethods();
setGray();
};
// 布局变化
const layouetChange = (type: string) => {
layoutType.value = type;
const { isPc } = useDevicesSize();
collapsed.value = isPc.value ? false : true;
};
const props = defineProps({
themeOpen: {
type: Boolean,
default: false
}
});
const emits = defineEmits(["themeCancel"]);
const handleCancel = () => {
emits("themeCancel");
};
</script>
<style lang="scss" scoped>
.box-gap {
margin-top: 30px;
}
.flex-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: $margin;
}
.flex-center {
display: flex;
column-gap: $margin;
align-items: center;
justify-content: center;
margin-bottom: $margin;
}
.layout-defaults,
.layout-head,
.layout-mixing {
width: 70px;
height: 50px;
overflow: hidden;
background: $color-fill-1;
border-radius: $radius-box-1;
box-shadow: $shadow-special;
.layout-icon {
display: none;
}
}
.current-layout {
position: relative;
.layout-icon {
position: absolute;
right: 2px;
bottom: 2px;
display: block;
font-size: $font-size-body-3;
color: $color-primary;
}
}
.layout-defaults {
position: relative;
&::before {
position: absolute;
left: 0;
width: 10px;
height: 100%;
content: "";
background: #232324;
}
&::after {
position: absolute;
top: 0;
right: 0;
width: 60px;
height: 10px;
content: "";
background: #c2c4c8;
}
}
.layout-head {
position: relative;
&::before {
position: absolute;
top: 0;
width: 100%;
height: 10px;
content: "";
background: #232324;
}
}
.layout-mixing {
position: relative;
&::before {
position: absolute;
top: 0;
width: 100%;
height: 10px;
content: "";
background: #232324;
}
&::after {
position: absolute;
top: 10px;
left: 0;
width: 10px;
height: calc(100% - 10px);
content: "";
background: #232324;
}
}
:deep(.arco-divider-text) {
background: $color-bg-3;
}
</style>
+22 -22
View File
@@ -1,22 +1,22 @@
<template>
<a-layout-header class="header">
<HeaderLeft />
<HeaderRight />
</a-layout-header>
</template>
<script setup lang="ts">
import HeaderLeft from "@/layout/components/Header/components/header-left/index.vue";
import HeaderRight from "@/layout/components/Header/components/header-right/index.vue";
</script>
<style lang="scss" scoped>
.header {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
height: 60px;
padding: 0 $padding;
border-bottom: $border-1 solid $color-border-2;
}
</style>
<template>
<a-layout-header class="header">
<HeaderLeft />
<HeaderRight />
</a-layout-header>
</template>
<script setup lang="ts">
import HeaderLeft from "@/layout/components/Header/components/header-left/index.vue";
import HeaderRight from "@/layout/components/Header/components/header-right/index.vue";
</script>
<style lang="scss" scoped>
.header {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
height: 60px;
padding: 0 $padding;
border-bottom: $border-1 solid $color-border-2;
}
</style>
+78 -78
View File
@@ -1,78 +1,78 @@
<template>
<div :class="layoutType == 'layoutHead' ? 'logo_head no-border' : 'logo_head'">
<div class="logo_box" :class="(collapsed || layoutType == 'layoutHead') && 'padding-unset'">
<s-svg-icon name="snow" :size="30" />
<span :class="isDark ? 'logo_title dark' : 'logo_title'" v-if="isTitle">{{ title }}</span>
</div>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark, layoutType } = storeToRefs(themeStore);
// 全局title
const title = import.meta.env.VITE_GLOB_APP_TITLE;
// 黑暗模式的文字渲染
const isDark = computed(() => {
if (asideDark.value && layoutType.value != "layoutHead") {
return true;
} else {
return false;
}
});
// 是否展示标题
const isTitle = computed(() => {
if (!collapsed.value || layoutType.value == "layoutHead") {
return true;
} else {
return false;
}
});
</script>
<style lang="scss" scoped>
// 头部
.logo_head {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-around;
height: 60px;
border-right: $border-1 solid $color-border-2;
.logo_box {
display: flex;
column-gap: $padding;
align-items: center;
width: 100%;
padding: 0 $padding;
overflow: hidden;
}
// 折叠或者是横向布局-去掉padding,logo居中
.padding-unset {
justify-content: space-around;
padding: unset;
}
.logo_title {
box-sizing: border-box;
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
font-size: $font-size-title-2;
font-weight: bold;
text-align: left;
white-space: nowrap;
}
.dark {
color: #ffffff;
}
}
.no-border {
border: unset;
}
</style>
<template>
<div :class="layoutType == 'layoutHead' ? 'logo_head no-border' : 'logo_head'">
<div class="logo_box" :class="(collapsed || layoutType == 'layoutHead') && 'padding-unset'">
<s-svg-icon name="snow" :size="30" />
<span :class="isDark ? 'logo_title dark' : 'logo_title'" v-if="isTitle">{{ title }}</span>
</div>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark, layoutType } = storeToRefs(themeStore);
// 全局title
const title = import.meta.env.VITE_GLOB_APP_TITLE;
// 黑暗模式的文字渲染
const isDark = computed(() => {
if (asideDark.value && layoutType.value != "layoutHead") {
return true;
} else {
return false;
}
});
// 是否展示标题
const isTitle = computed(() => {
if (!collapsed.value || layoutType.value == "layoutHead") {
return true;
} else {
return false;
}
});
</script>
<style lang="scss" scoped>
// 头部
.logo_head {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-around;
height: 60px;
border-right: $border-1 solid $color-border-2;
.logo_box {
display: flex;
column-gap: $padding;
align-items: center;
width: 100%;
padding: 0 $padding;
overflow: hidden;
}
// 折叠或者是横向布局-去掉padding,logo居中
.padding-unset {
justify-content: space-around;
padding: unset;
}
.logo_title {
box-sizing: border-box;
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
font-size: $font-size-title-2;
font-weight: bold;
text-align: left;
white-space: nowrap;
}
.dark {
color: #ffffff;
}
}
.no-border {
border: unset;
}
</style>
+53 -53
View File
@@ -1,53 +1,53 @@
<template>
<a-menu
:breakpoint="layoutType != 'layoutHead' ? 'xl' : undefined"
:mode="'vertical'"
:theme="asideDark ? 'dark' : 'light'"
:collapsed="collapsed"
:auto-scroll-into-view="true"
:auto-open-selected="true"
:accordion="isAccordion"
:selected-keys="[selectedMenu]"
@menu-item-click="onMenuItem"
>
<MenuItem :route-tree="props.routeTree" />
</a-menu>
</template>
<script setup lang="ts">
import MenuItem from "@/layout/components/Menu/menu-item.vue";
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
const route = useRoute();
const router = useRouter();
const themeStore = useThemeConfig();
const { collapsed, isAccordion, layoutType, asideDark } = storeToRefs(themeStore);
interface Props {
routeTree: Menu.MenuOptions[];
}
// props的数据类型
// type类型参考:https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
const props = withDefaults(defineProps<Props>(), {
routeTree: () => []
});
const onMenuItem = (path: string) => router.push(path);
const selectedMenu = computed(() => {
const { getAllParentRoute } = useRoutingMethod();
const find = getAllParentRoute(route.matched.at(-1).path);
if (!find) return "";
let path = "";
for (let i = find.length - 1; i >= 0; i--) {
if (find[i].meta && !find[i].meta.hide) {
path = find[i].path;
break;
}
}
return path;
});
</script>
<style lang="scss" scoped></style>
<template>
<a-menu
:breakpoint="layoutType != 'layoutHead' ? 'xl' : undefined"
:mode="'vertical'"
:theme="asideDark ? 'dark' : 'light'"
:collapsed="collapsed"
:auto-scroll-into-view="true"
:auto-open-selected="true"
:accordion="isAccordion"
:selected-keys="[selectedMenu]"
@menu-item-click="onMenuItem"
>
<MenuItem :route-tree="props.routeTree" />
</a-menu>
</template>
<script setup lang="ts">
import MenuItem from "@/layout/components/Menu/menu-item.vue";
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
const route = useRoute();
const router = useRouter();
const themeStore = useThemeConfig();
const { collapsed, isAccordion, layoutType, asideDark } = storeToRefs(themeStore);
interface Props {
routeTree: Menu.MenuOptions[];
}
// props的数据类型
// type类型参考:https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
const props = withDefaults(defineProps<Props>(), {
routeTree: () => []
});
const onMenuItem = (path: string) => router.push(path);
const selectedMenu = computed(() => {
const { getAllParentRoute } = useRoutingMethod();
const find = getAllParentRoute(route.matched.at(-1).path);
if (!find) return "";
let path = "";
for (let i = find.length - 1; i >= 0; i--) {
if (find[i].meta && !find[i].meta.hide) {
path = find[i].path;
break;
}
}
return path;
});
</script>
<style lang="scss" scoped></style>
@@ -1,19 +1,19 @@
<template>
<s-svg-icon v-if="props.svgIcon" :name="props.svgIcon" :size="25" />
<component v-else-if="props.icon" :is="props.icon"></component>
</template>
<script setup lang="ts">
const props = defineProps({
svgIcon: {
type: String,
default: ""
},
icon: {
type: String,
default: ""
}
});
</script>
<style lang="scss" scoped></style>
<template>
<s-svg-icon v-if="props.svgIcon" :name="props.svgIcon" :size="25" />
<component v-else-if="props.icon" :is="props.icon"></component>
</template>
<script setup lang="ts">
const props = defineProps({
svgIcon: {
type: String,
default: ""
},
icon: {
type: String,
default: ""
}
});
</script>
<style lang="scss" scoped></style>
+37 -37
View File
@@ -1,37 +1,37 @@
<template>
<template v-for="item in props.routeTree" :key="item.path">
<a-sub-menu v-if="menuShow(item)" :key="item.path">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<template #title>{{ $t(`menu.${item.meta.title}`) }}</template>
<MenuItem :route-tree="item.children" />
</a-sub-menu>
<a-menu-item v-else-if="aMenuShow(item)" :key="item?.path">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<span>{{ $t(`menu.${item.meta.title}`) }}</span>
</a-menu-item>
</template>
</template>
<script setup lang="ts">
import MenuItem from "@/layout/components/Menu/menu-item.vue";
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
import { useMenuMethod } from "@/hooks/useMenuMethod";
defineOptions({ name: "MenuItem", inheritAttrs: false });
interface Props {
routeTree: Menu.MenuOptions[];
}
// props的数据类型
// type类型参考:https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
const props = withDefaults(defineProps<Props>(), {
routeTree: () => []
});
const { menuShow, aMenuShow } = useMenuMethod();
</script>
<style lang="scss" scoped></style>
<template>
<template v-for="item in props.routeTree" :key="item.path">
<a-sub-menu v-if="menuShow(item)" :key="item.path">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<template #title>{{ $t(`menu.${item.meta.title}`) }}</template>
<MenuItem :route-tree="item.children" />
</a-sub-menu>
<a-menu-item v-else-if="aMenuShow(item)" :key="item?.path">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<span>{{ $t(`menu.${item.meta.title}`) }}</span>
</a-menu-item>
</template>
</template>
<script setup lang="ts">
import MenuItem from "@/layout/components/Menu/menu-item.vue";
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
import { useMenuMethod } from "@/hooks/useMenuMethod";
defineOptions({ name: "MenuItem", inheritAttrs: false });
interface Props {
routeTree: Menu.MenuOptions[];
}
// props的数据类型
// type类型参考:https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
const props = withDefaults(defineProps<Props>(), {
routeTree: () => []
});
const { menuShow, aMenuShow } = useMenuMethod();
</script>
<style lang="scss" scoped></style>
+187 -187
View File
@@ -1,187 +1,187 @@
<template>
<div class="tabs">
<a-tabs
:editable="true"
:hide-content="true"
:active-key="currentRoute.path"
size="medium"
type="line"
@tab-click="onTabs"
@delete="onDelete"
>
<a-tab-pane v-for="item of tabsList" :key="item.path" :title="$t(`menu.${item.meta.title}`)" :closable="!item.meta.affix" />
</a-tabs>
<div class="tabs_setting">
<a-space>
<a-tooltip :content="$t(`system.refresh`)" position="bottom" mini>
<span ref="refreshRef" id="system-tabs-refresh" :class="rotateOpen && 'refresh'">
<icon-refresh :size="18" @click="refresh" />
</span>
</a-tooltip>
<a-dropdown trigger="hover" :popup-max-height="false">
<div class="setting" id="system-tabs-setting"><icon-apps :size="18" /></div>
<template #content>
<a-doption @click="closeCurrent">
<template #icon><icon-close /></template>
<template #default>{{ $t(`system.close-current`) }}</template>
</a-doption>
<a-doption @click="closeSides('left')">
<template #icon><icon-left /></template>
<template #default>{{ $t(`system.close-left-side`) }}</template>
</a-doption>
<a-doption @click="closeSides('right')">
<template #icon><icon-right /></template>
<template #default>{{ $t(`system.close-right-side`) }}</template>
</a-doption>
<a-doption @click="closeOther('other')">
<template #icon><icon-close-circle /></template>
<template #default>{{ $t(`system.close-other`) }}</template>
</a-doption>
<a-doption @click="closeOther('all')">
<template #icon><icon-folder-delete /></template>
<template #default>{{ $t(`system.close-all`) }}</template>
</a-doption>
</template>
</a-dropdown>
</a-space>
</div>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useThemeConfig } from "@/store/modules/theme-config";
const router = useRouter();
const routerStore = useRouteConfigStore();
const { tabsList, currentRoute } = storeToRefs(routerStore);
// 点击标签页,如果标签页存在,则跳转
const onTabs = (key: string) => {
router.push(key);
};
// 删除当前标签页并跳转到最后一个标签页
const onDelete = (path: string) => {
routerStore.removeTabsList(path);
routerStore.removeRouteName(path);
if (tabsList.value.length == 0) return;
if (currentRoute.value.path != path) return;
router.push(tabsList.value.at(-1).path);
};
// 刷新当前页
const rotateOpen = ref(false);
const refresh = () => {
rotateOpen.value = true;
setTimeout(() => {
rotateOpen.value = false;
}, 500);
const themeStore = useThemeConfig();
themeStore.setRefreshPage(false);
currentRoute.value.meta.keepAlive && routerStore.removeRouteName(currentRoute.value.path);
nextTick(() => {
themeStore.setRefreshPage(true);
currentRoute.value.meta.keepAlive && routerStore.setRoutePaths(currentRoute.value.path);
});
};
// 关闭当前
const closeCurrent = () => {
onDelete(currentRoute.value.path);
};
// 关闭右侧&关闭左侧
const closeSides = (type: string) => {
// 获得当前index
let currentIndex = tabsList.value.findIndex((item: Menu.MenuOptions) => item.path === currentRoute.value.path);
// 过滤出两侧可关闭的 affix: false 表示可关闭
let rightList = tabsList.value.filter((item: Menu.MenuOptions, index: number) => {
if (type == "right") {
if (index > currentIndex && !item.meta.affix) return item;
} else {
if (index < currentIndex && !item.meta.affix) return item;
}
});
// 返回可关闭名称
let rightPaths = rightList.map((item: Menu.MenuOptions) => item.path);
// 删除右侧
tabsList.value = tabsList.value.filter((item: Menu.MenuOptions) => !rightPaths.includes(item.path));
// 删除缓存
routerStore.removeRoutePaths(rightPaths);
};
// 关闭其它&关闭全部
const closeOther = (type: string) => {
// 过滤出可关闭项 affix: false 表示可关闭
let list = tabsList.value.filter((item: Menu.MenuOptions) => {
if (type == "other") {
if (item.path != currentRoute.value.path && !item.meta.affix) {
return item;
}
} else {
if (!item.meta.affix) {
return item;
}
}
});
// 返回可关闭名称
let rightNames = list.map((item: Menu.MenuOptions) => item.path);
// 删除可关闭项
tabsList.value = tabsList.value.filter((item: Menu.MenuOptions) => !rightNames.includes(item.path));
// 删除缓存
routerStore.removeRoutePaths(rightNames);
// 关闭全部,若当前被关闭则跳转最后一个
if (tabsList.value.length != 0 && !currentRoute.value.meta.affix && type == "all") {
router.push(tabsList.value.at(-1).path);
}
};
</script>
<style lang="scss" scoped>
.tabs {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
border-bottom: $border-1 solid $color-border-2;
.tabs_setting {
margin: 0 0 0 $margin;
.setting {
margin-right: $margin;
color: $color-text-2;
}
.refresh {
transform: rotate(360deg);
transition: transform 0.5s;
}
}
}
:deep(.arco-tabs-nav-tab) {
// 移入展示关闭icon
.arco-tabs-tab-closable {
svg {
width: 0;
transition: all 0.2s;
}
&:hover {
svg {
width: 1em;
}
}
}
// 消除tab移入的背景色
&:hover .arco-tabs-tab-title::before {
background: unset;
}
}
// 消除tabs底部边线
:deep(.arco-tabs-nav) {
&::before {
background: unset;
}
}
</style>
<template>
<div class="tabs">
<a-tabs
:editable="true"
:hide-content="true"
:active-key="currentRoute.path"
size="medium"
type="line"
@tab-click="onTabs"
@delete="onDelete"
>
<a-tab-pane v-for="item of tabsList" :key="item.path" :title="$t(`menu.${item.meta.title}`)" :closable="!item.meta.affix" />
</a-tabs>
<div class="tabs_setting">
<a-space>
<a-tooltip :content="$t(`system.refresh`)" position="bottom" mini>
<span ref="refreshRef" id="system-tabs-refresh" :class="rotateOpen && 'refresh'">
<icon-refresh :size="18" @click="refresh" />
</span>
</a-tooltip>
<a-dropdown trigger="hover" :popup-max-height="false">
<div class="setting" id="system-tabs-setting"><icon-apps :size="18" /></div>
<template #content>
<a-doption @click="closeCurrent">
<template #icon><icon-close /></template>
<template #default>{{ $t(`system.close-current`) }}</template>
</a-doption>
<a-doption @click="closeSides('left')">
<template #icon><icon-left /></template>
<template #default>{{ $t(`system.close-left-side`) }}</template>
</a-doption>
<a-doption @click="closeSides('right')">
<template #icon><icon-right /></template>
<template #default>{{ $t(`system.close-right-side`) }}</template>
</a-doption>
<a-doption @click="closeOther('other')">
<template #icon><icon-close-circle /></template>
<template #default>{{ $t(`system.close-other`) }}</template>
</a-doption>
<a-doption @click="closeOther('all')">
<template #icon><icon-folder-delete /></template>
<template #default>{{ $t(`system.close-all`) }}</template>
</a-doption>
</template>
</a-dropdown>
</a-space>
</div>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useThemeConfig } from "@/store/modules/theme-config";
const router = useRouter();
const routerStore = useRouteConfigStore();
const { tabsList, currentRoute } = storeToRefs(routerStore);
// 点击标签页,如果标签页存在,则跳转
const onTabs = (key: string) => {
router.push(key);
};
// 删除当前标签页并跳转到最后一个标签页
const onDelete = (path: string) => {
routerStore.removeTabsList(path);
routerStore.removeRouteName(path);
if (tabsList.value.length == 0) return;
if (currentRoute.value.path != path) return;
router.push(tabsList.value.at(-1).path);
};
// 刷新当前页
const rotateOpen = ref(false);
const refresh = () => {
rotateOpen.value = true;
setTimeout(() => {
rotateOpen.value = false;
}, 500);
const themeStore = useThemeConfig();
themeStore.setRefreshPage(false);
currentRoute.value.meta.keepAlive && routerStore.removeRouteName(currentRoute.value.path);
nextTick(() => {
themeStore.setRefreshPage(true);
currentRoute.value.meta.keepAlive && routerStore.setRoutePaths(currentRoute.value.path);
});
};
// 关闭当前
const closeCurrent = () => {
onDelete(currentRoute.value.path);
};
// 关闭右侧&关闭左侧
const closeSides = (type: string) => {
// 获得当前index
let currentIndex = tabsList.value.findIndex((item: Menu.MenuOptions) => item.path === currentRoute.value.path);
// 过滤出两侧可关闭的 affix: false 表示可关闭
let rightList = tabsList.value.filter((item: Menu.MenuOptions, index: number) => {
if (type == "right") {
if (index > currentIndex && !item.meta.affix) return item;
} else {
if (index < currentIndex && !item.meta.affix) return item;
}
});
// 返回可关闭名称
let rightPaths = rightList.map((item: Menu.MenuOptions) => item.path);
// 删除右侧
tabsList.value = tabsList.value.filter((item: Menu.MenuOptions) => !rightPaths.includes(item.path));
// 删除缓存
routerStore.removeRoutePaths(rightPaths);
};
// 关闭其它&关闭全部
const closeOther = (type: string) => {
// 过滤出可关闭项 affix: false 表示可关闭
let list = tabsList.value.filter((item: Menu.MenuOptions) => {
if (type == "other") {
if (item.path != currentRoute.value.path && !item.meta.affix) {
return item;
}
} else {
if (!item.meta.affix) {
return item;
}
}
});
// 返回可关闭名称
let rightNames = list.map((item: Menu.MenuOptions) => item.path);
// 删除可关闭项
tabsList.value = tabsList.value.filter((item: Menu.MenuOptions) => !rightNames.includes(item.path));
// 删除缓存
routerStore.removeRoutePaths(rightNames);
// 关闭全部,若当前被关闭则跳转最后一个
if (tabsList.value.length != 0 && !currentRoute.value.meta.affix && type == "all") {
router.push(tabsList.value.at(-1).path);
}
};
</script>
<style lang="scss" scoped>
.tabs {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
border-bottom: $border-1 solid $color-border-2;
.tabs_setting {
margin: 0 0 0 $margin;
.setting {
margin-right: $margin;
color: $color-text-2;
}
.refresh {
transform: rotate(360deg);
transition: transform 0.5s;
}
}
}
:deep(.arco-tabs-nav-tab) {
// 移入展示关闭icon
.arco-tabs-tab-closable {
svg {
width: 0;
transition: all 0.2s;
}
&:hover {
svg {
width: 1em;
}
}
}
// 消除tab移入的背景色
&:hover .arco-tabs-tab-title::before {
background: unset;
}
}
// 消除tabs底部边线
:deep(.arco-tabs-nav) {
&::before {
background: unset;
}
}
</style>
@@ -1,98 +1,98 @@
<template>
<a-drawer
:width="220"
class="drawer-aside"
placement="left"
:header="false"
:footer="false"
:visible="!collapsed"
@cancel="handleCancel"
unmount-on-close
>
<div :class="asideDark ? 'aside dark' : 'aside'">
<Logo />
<a-layout-sider class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar>
</a-layout-sider>
</div>
</a-drawer>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark } = storeToRefs(themeStore);
const routerStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routerStore);
const handleCancel = () => {
collapsed.value = true;
};
</script>
<style lang="scss" scoped>
.aside {
display: flex;
flex-direction: column;
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
flex: 1;
overflow: hidden;
.scrollbar {
height: 100%;
}
}
// 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// 消除title占位
.arco-menu-title {
display: none;
}
}
// 去掉sider背景
.arco-layout-sider {
background: unset;
}
</style>
<style lang="scss">
.drawer-aside {
.arco-drawer .arco-drawer-body {
padding: 0;
overflow: hidden;
}
}
</style>
<template>
<a-drawer
:width="220"
class="drawer-aside"
placement="left"
:header="false"
:footer="false"
:visible="!collapsed"
@cancel="handleCancel"
unmount-on-close
>
<div :class="asideDark ? 'aside dark' : 'aside'">
<Logo />
<a-layout-sider class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar>
</a-layout-sider>
</div>
</a-drawer>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark } = storeToRefs(themeStore);
const routerStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routerStore);
const handleCancel = () => {
collapsed.value = true;
};
</script>
<style lang="scss" scoped>
.aside {
display: flex;
flex-direction: column;
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
flex: 1;
overflow: hidden;
.scrollbar {
height: 100%;
}
}
// 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// 消除title占位
.arco-menu-title {
display: none;
}
}
// 去掉sider背景
.arco-layout-sider {
background: unset;
}
</style>
<style lang="scss">
.drawer-aside {
.arco-drawer .arco-drawer-body {
padding: 0;
overflow: hidden;
}
}
</style>
+24 -24
View File
@@ -1,24 +1,24 @@
<template>
<div>
<s-lang-provider>
<component :is="layouts[layoutType]" />
</s-lang-provider>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
const themeStore = useThemeConfig();
const { layoutType } = storeToRefs(themeStore);
// 引入组件-异步组件
const layouts: any = {
layoutDefaults: defineAsyncComponent(() => import("@/layout/layout-defaults/index.vue")),
layoutHead: defineAsyncComponent(() => import("@/layout/layout-head/index.vue")),
layoutMixing: defineAsyncComponent(() => import("@/layout/layout-mixing/index.vue"))
};
</script>
<style lang="scss" scoped></style>
<template>
<div>
<s-lang-provider>
<component :is="layouts[layoutType]" />
</s-lang-provider>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
const themeStore = useThemeConfig();
const { layoutType } = storeToRefs(themeStore);
// 引入组件-异步组件
const layouts: any = {
layoutDefaults: defineAsyncComponent(() => import("@/layout/layout-defaults/index.vue")),
layoutHead: defineAsyncComponent(() => import("@/layout/layout-head/index.vue")),
layoutMixing: defineAsyncComponent(() => import("@/layout/layout-mixing/index.vue"))
};
</script>
<style lang="scss" scoped></style>
+37 -37
View File
@@ -1,37 +1,37 @@
<template>
<a-layout class="layout" :has-sider="true">
<Aside v-if="isPc" />
<a-layout class="layout-right">
<Header />
<Main />
<Footer v-if="isFooter" />
</a-layout>
</a-layout>
</template>
<script setup lang="ts">
import Aside from "@/layout/components/Aside/index.vue";
import Header from "@/layout/components/Header/index.vue";
import Main from "@/layout/components/Main/index.vue";
import Footer from "@/layout/components/Footer/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
defineOptions({ name: "LayoutDefaults" });
const themeStore = useThemeConfig();
let { isFooter } = storeToRefs(themeStore);
const { isPc } = useDevicesSize();
</script>
<style lang="scss" scoped>
.layout {
height: 100vh;
}
.layout-right {
display: grid;
grid-template-rows: auto 1fr auto;
}
</style>
<template>
<a-layout class="layout" :has-sider="true">
<Aside v-if="isPc" />
<a-layout class="layout-right">
<Header />
<Main />
<Footer v-if="isFooter" />
</a-layout>
</a-layout>
</template>
<script setup lang="ts">
import Aside from "@/layout/components/Aside/index.vue";
import Header from "@/layout/components/Header/index.vue";
import Main from "@/layout/components/Main/index.vue";
import Footer from "@/layout/components/Footer/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
defineOptions({ name: "LayoutDefaults" });
const themeStore = useThemeConfig();
let { isFooter } = storeToRefs(themeStore);
const { isPc } = useDevicesSize();
</script>
<style lang="scss" scoped>
.layout {
height: 100vh;
}
.layout-right {
display: grid;
grid-template-rows: auto 1fr auto;
}
</style>
+134 -134
View File
@@ -1,134 +1,134 @@
<template>
<div class="layout-head">
<div class="layout-head-top">
<a-layout-header class="header">
<div class="header-logo" v-if="!isMobile">
<Logo />
</div>
<div class="layout-head-menu" v-if="!isMobile">
<a-menu
v-if="drawing"
mode="horizontal"
:selected-keys="[selectedMenu]"
@menu-item-click="onMenuItem"
:popup-max-height="600"
>
<template v-for="item in routeTree" :key="item.path">
<a-sub-menu v-if="menuShow(item)" :key="item.path" :popup-max-height="600">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<template #title>{{ $t(`menu.${item.meta.title}`) }}</template>
<MenuItem :route-tree="item.children" />
</a-sub-menu>
<a-menu-item v-else-if="aMenuShow(item)" :key="item?.path">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<span>{{ $t(`menu.${item.meta.title}`) }}</span>
</a-menu-item>
</template>
</a-menu>
</div>
<ButtonCollapsed v-else />
<HeaderRight />
</a-layout-header>
<Main />
<Footer v-if="isFooter" />
</div>
</div>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import HeaderRight from "@/layout/components/Header/components/header-right/index.vue";
import Main from "@/layout/components/Main/index.vue";
import Footer from "@/layout/components/Footer/index.vue";
import MenuItem from "@/layout/components/Menu/menu-item.vue";
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
import ButtonCollapsed from "@/layout/components/Header/components/button-collapsed/index.vue";
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useMenuMethod } from "@/hooks/useMenuMethod";
import { useDevicesSize } from "@/hooks/useDevicesSize";
defineOptions({ name: "LayoutHead" });
const route = useRoute();
const router = useRouter();
const routerStore = useRouteConfigStore();
const themeStore = useThemeConfig();
const { routeTree } = storeToRefs(routerStore);
const { isFooter, language } = storeToRefs(themeStore);
const { isMobile } = useDevicesSize();
const { menuShow, aMenuShow } = useMenuMethod();
const drawing = ref<boolean>(true);
watch(language, () => {
drawing.value = false;
nextTick(() => (drawing.value = true));
});
const onMenuItem = (path: string) => router.push(path);
const selectedMenu = computed(() => {
const { getAllParentRoute } = useRoutingMethod();
const find = getAllParentRoute(route.matched.at(-1).path);
if (!find) return "";
let path = "";
for (let i = find.length - 1; i >= 0; i--) {
if (find[i].meta && !find[i].meta.hide) {
path = find[i].path;
break;
}
}
return path;
});
</script>
<style lang="scss" scoped>
.layout-head {
height: 100vh;
&-top {
position: relative;
display: grid;
grid-template-rows: auto 1fr auto;
height: 100%;
}
}
.header {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
width: 100%;
height: 60px;
padding: 0 $padding;
overflow: hidden;
border-bottom: $border-1 solid $color-border-2;
.header-logo {
max-width: 180px;
}
.layout-head-menu {
display: flex;
flex: 1;
overflow: hidden;
}
}
:deep(.arco-menu-pop) {
white-space: nowrap;
}
// 横向菜单样式修改
:deep(.arco-menu-horizontal) {
flex: 1;
overflow: hidden;
.arco-menu-inner {
padding-left: 0; // 横向排列,禁用左padding
.arco-menu-overflow-wrap {
white-space: nowrap; // 禁用换行,否则会导致菜单换行闪烁
}
}
}
</style>
<template>
<div class="layout-head">
<div class="layout-head-top">
<a-layout-header class="header">
<div class="header-logo" v-if="!isMobile">
<Logo />
</div>
<div class="layout-head-menu" v-if="!isMobile">
<a-menu
v-if="drawing"
mode="horizontal"
:selected-keys="[selectedMenu]"
@menu-item-click="onMenuItem"
:popup-max-height="600"
>
<template v-for="item in routeTree" :key="item.path">
<a-sub-menu v-if="menuShow(item)" :key="item.path" :popup-max-height="600">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<template #title>{{ $t(`menu.${item.meta.title}`) }}</template>
<MenuItem :route-tree="item.children" />
</a-sub-menu>
<a-menu-item v-else-if="aMenuShow(item)" :key="item?.path">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<span>{{ $t(`menu.${item.meta.title}`) }}</span>
</a-menu-item>
</template>
</a-menu>
</div>
<ButtonCollapsed v-else />
<HeaderRight />
</a-layout-header>
<Main />
<Footer v-if="isFooter" />
</div>
</div>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import HeaderRight from "@/layout/components/Header/components/header-right/index.vue";
import Main from "@/layout/components/Main/index.vue";
import Footer from "@/layout/components/Footer/index.vue";
import MenuItem from "@/layout/components/Menu/menu-item.vue";
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
import ButtonCollapsed from "@/layout/components/Header/components/button-collapsed/index.vue";
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useMenuMethod } from "@/hooks/useMenuMethod";
import { useDevicesSize } from "@/hooks/useDevicesSize";
defineOptions({ name: "LayoutHead" });
const route = useRoute();
const router = useRouter();
const routerStore = useRouteConfigStore();
const themeStore = useThemeConfig();
const { routeTree } = storeToRefs(routerStore);
const { isFooter, language } = storeToRefs(themeStore);
const { isMobile } = useDevicesSize();
const { menuShow, aMenuShow } = useMenuMethod();
const drawing = ref<boolean>(true);
watch(language, () => {
drawing.value = false;
nextTick(() => (drawing.value = true));
});
const onMenuItem = (path: string) => router.push(path);
const selectedMenu = computed(() => {
const { getAllParentRoute } = useRoutingMethod();
const find = getAllParentRoute(route.matched.at(-1).path);
if (!find) return "";
let path = "";
for (let i = find.length - 1; i >= 0; i--) {
if (find[i].meta && !find[i].meta.hide) {
path = find[i].path;
break;
}
}
return path;
});
</script>
<style lang="scss" scoped>
.layout-head {
height: 100vh;
&-top {
position: relative;
display: grid;
grid-template-rows: auto 1fr auto;
height: 100%;
}
}
.header {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
width: 100%;
height: 60px;
padding: 0 $padding;
overflow: hidden;
border-bottom: $border-1 solid $color-border-2;
.header-logo {
max-width: 180px;
}
.layout-head-menu {
display: flex;
flex: 1;
overflow: hidden;
}
}
:deep(.arco-menu-pop) {
white-space: nowrap;
}
// 横向菜单样式修改
:deep(.arco-menu-horizontal) {
flex: 1;
overflow: hidden;
.arco-menu-inner {
padding-left: 0; // 横向排列,禁用左padding
.arco-menu-overflow-wrap {
white-space: nowrap; // 禁用换行,否则会导致菜单换行闪烁
}
}
}
</style>
+217 -217
View File
@@ -1,217 +1,217 @@
<template>
<a-layout class="layout">
<div :class="asideDark ? 'aside dark' : 'aside'" v-if="isPc">
<Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeList" /></a-scrollbar>
</a-layout-sider>
</div>
<a-layout class="layout-right">
<a-layout-header class="header">
<div class="header-left">
<ButtonCollapsed />
<Breadcrumb v-if="!isPc" />
</div>
<div class="layout-head-menu" v-if="isPc">
<a-menu
v-if="drawing"
mode="horizontal"
:selected-keys="[selectedMenu]"
@menu-item-click="onMenuItem"
:popup-max-height="600"
>
<template v-for="item in routeTree" :key="item.path">
<a-menu-item v-if="!item.meta.hide" :key="item.path" :popup-max-height="600">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<span>{{ $t(`menu.${item.meta.title}`) }}</span>
</a-menu-item>
</template>
</a-menu>
</div>
<HeaderRight />
</a-layout-header>
<Main />
<Footer v-if="isFooter" />
</a-layout>
</a-layout>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Main from "@/layout/components/Main/index.vue";
import Footer from "@/layout/components/Footer/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import HeaderRight from "@/layout/components/Header/components/header-right/index.vue";
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
import ButtonCollapsed from "@/layout/components/Header/components/button-collapsed/index.vue";
import Breadcrumb from "@/layout/components/Header/components/Breadcrumb/index.vue";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
defineOptions({ name: "LayoutMixing" });
const route = useRoute();
const router = useRouter();
const routerStore = useRouteConfigStore();
const themeStore = useThemeConfig();
const { isFooter, collapsed, asideDark, language } = storeToRefs(themeStore);
const { routeTree } = storeToRefs(routerStore);
const { isPc } = useDevicesSize();
const drawing = ref<boolean>(true);
watch(language, () => {
drawing.value = false;
nextTick(() => (drawing.value = true));
});
// 横向菜单点击事件
// 将一级菜单下的children给左侧菜单
// 如果没有children则直接自身菜单给左侧菜单
const routeList = ref<any>([]);
const onMenuItem = (path: string) => {
const { findLinearArray } = useRoutingMethod();
const find = findLinearArray(path);
// 路由存在则存入并跳转,不存在则跳404
if (find) {
// 给左侧树赋值
setAside(find);
// 若有重定向,则跳转到重定向的路由
// 如果有子路由则重定向到自己的第一个菜单
// 如果没有子路由则说明当前父级是一个菜单,直接跳转
let path = "";
if (find.redirect) {
path = find.redirect;
} else if (find.children && find.children.length > 0) {
path = find.children[0].path;
} else {
path = find.path;
}
router.push(path);
} else {
router.push("/404");
}
};
// 给左侧树赋值
const setAsideMenu = (find: Menu.MenuOptions) => {
// 将父级的chindren给左侧树
if (find.children && find.children.length > 0) {
routeList.value = find.children;
} else {
// 如果没有则直接将父级给左侧树,做一级兜底
routeList.value = [find];
}
};
const setAside = debounce(setAsideMenu, 150);
// 由于刷新后,路由信息丢失,所以需要重新获取
// 混合布局的横向菜单为顶层路由下的一级菜单
const selectedMenu = computed(() => {
const { getAllParentRoute } = useRoutingMethod();
// 动态路由参数会在path拼接,导致匹配失败
// 这取matched做路由匹配
const find = getAllParentRoute(route.matched.at(-1).path);
if (find) {
setAside(find[0]);
return find[0].path;
}
return "";
});
</script>
<style lang="scss" scoped>
.layout {
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
height: calc(100% - 60px);
.scrollbar {
height: 100%;
}
}
// 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// 消除title占位
.arco-menu-title {
display: none;
}
}
// 去掉sider背景
.arco-layout-sider {
background: unset;
}
.layout-right {
display: grid;
grid-template-rows: auto 1fr auto;
height: 100%;
.header {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 60px;
padding: 0 $padding;
overflow: hidden;
border-bottom: $border-1 solid $color-border-2;
.header-left {
display: flex;
align-items: center;
}
}
.layout-head-menu {
display: flex;
flex: 1;
overflow: hidden;
}
}
:deep(.arco-menu-pop) {
white-space: nowrap;
}
// 横向菜单样式修改
:deep(.arco-menu-horizontal) {
flex: 1;
overflow: hidden;
.arco-menu-inner {
padding-left: 0; // 横向排列,禁用左padding
.arco-menu-overflow-wrap {
white-space: nowrap; // 禁用换行,否则会导致菜单换行闪烁
}
}
}
</style>
<template>
<a-layout class="layout">
<div :class="asideDark ? 'aside dark' : 'aside'" v-if="isPc">
<Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeList" /></a-scrollbar>
</a-layout-sider>
</div>
<a-layout class="layout-right">
<a-layout-header class="header">
<div class="header-left">
<ButtonCollapsed />
<Breadcrumb v-if="!isPc" />
</div>
<div class="layout-head-menu" v-if="isPc">
<a-menu
v-if="drawing"
mode="horizontal"
:selected-keys="[selectedMenu]"
@menu-item-click="onMenuItem"
:popup-max-height="600"
>
<template v-for="item in routeTree" :key="item.path">
<a-menu-item v-if="!item.meta.hide" :key="item.path" :popup-max-height="600">
<template #icon v-if="item.meta.svgIcon || item.meta.icon">
<MenuItemIcon :svg-icon="item.meta.svgIcon" :icon="item.meta.icon" />
</template>
<span>{{ $t(`menu.${item.meta.title}`) }}</span>
</a-menu-item>
</template>
</a-menu>
</div>
<HeaderRight />
</a-layout-header>
<Main />
<Footer v-if="isFooter" />
</a-layout>
</a-layout>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Main from "@/layout/components/Main/index.vue";
import Footer from "@/layout/components/Footer/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import HeaderRight from "@/layout/components/Header/components/header-right/index.vue";
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
import ButtonCollapsed from "@/layout/components/Header/components/button-collapsed/index.vue";
import Breadcrumb from "@/layout/components/Header/components/Breadcrumb/index.vue";
import { useRouteConfigStore } from "@/store/modules/route-config";
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useDevicesSize } from "@/hooks/useDevicesSize";
defineOptions({ name: "LayoutMixing" });
const route = useRoute();
const router = useRouter();
const routerStore = useRouteConfigStore();
const themeStore = useThemeConfig();
const { isFooter, collapsed, asideDark, language } = storeToRefs(themeStore);
const { routeTree } = storeToRefs(routerStore);
const { isPc } = useDevicesSize();
const drawing = ref<boolean>(true);
watch(language, () => {
drawing.value = false;
nextTick(() => (drawing.value = true));
});
// 横向菜单点击事件
// 将一级菜单下的children给左侧菜单
// 如果没有children则直接自身菜单给左侧菜单
const routeList = ref<any>([]);
const onMenuItem = (path: string) => {
const { findLinearArray } = useRoutingMethod();
const find = findLinearArray(path);
// 路由存在则存入并跳转,不存在则跳404
if (find) {
// 给左侧树赋值
setAside(find);
// 若有重定向,则跳转到重定向的路由
// 如果有子路由则重定向到自己的第一个菜单
// 如果没有子路由则说明当前父级是一个菜单,直接跳转
let path = "";
if (find.redirect) {
path = find.redirect;
} else if (find.children && find.children.length > 0) {
path = find.children[0].path;
} else {
path = find.path;
}
router.push(path);
} else {
router.push("/404");
}
};
// 给左侧树赋值
const setAsideMenu = (find: Menu.MenuOptions) => {
// 将父级的chindren给左侧树
if (find.children && find.children.length > 0) {
routeList.value = find.children;
} else {
// 如果没有则直接将父级给左侧树,做一级兜底
routeList.value = [find];
}
};
const setAside = debounce(setAsideMenu, 150);
// 由于刷新后,路由信息丢失,所以需要重新获取
// 混合布局的横向菜单为顶层路由下的一级菜单
const selectedMenu = computed(() => {
const { getAllParentRoute } = useRoutingMethod();
// 动态路由参数会在path拼接,导致匹配失败
// 这取matched做路由匹配
const find = getAllParentRoute(route.matched.at(-1).path);
if (find) {
setAside(find[0]);
return find[0].path;
}
return "";
});
</script>
<style lang="scss" scoped>
.layout {
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
height: calc(100% - 60px);
.scrollbar {
height: 100%;
}
}
// 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// 消除title占位
.arco-menu-title {
display: none;
}
}
// 去掉sider背景
.arco-layout-sider {
background: unset;
}
.layout-right {
display: grid;
grid-template-rows: auto 1fr auto;
height: 100%;
.header {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 60px;
padding: 0 $padding;
overflow: hidden;
border-bottom: $border-1 solid $color-border-2;
.header-left {
display: flex;
align-items: center;
}
}
.layout-head-menu {
display: flex;
flex: 1;
overflow: hidden;
}
}
:deep(.arco-menu-pop) {
white-space: nowrap;
}
// 横向菜单样式修改
:deep(.arco-menu-horizontal) {
flex: 1;
overflow: hidden;
.arco-menu-inner {
padding-left: 0; // 横向排列,禁用左padding
.arco-menu-overflow-wrap {
white-space: nowrap; // 禁用换行,否则会导致菜单换行闪烁
}
}
}
</style>
+37 -43
View File
@@ -1,43 +1,37 @@
import { createApp } from "vue";
import "@/style.css";
import App from "@/App.vue";
// arco-design
import ArcoVue from "@arco-design/web-vue";
// vue-router
import router from "@/router/index";
// pinia
import pinia from "@/store/index";
// arco-css
import "@arco-design/web-vue/dist/arco.css";
// vchart-arco-theme 主题关联-黑暗模式
import { initVChartArcoTheme } from "@visactor/vchart-arco-theme";
// 额外引入图标库
import ArcoVueIcon from "@arco-design/web-vue/es/icon";
// 注册全局svg
import "virtual:svg-icons-register";
// 引入i18n
import i18n from "@/lang/index";
// 引入字体
import "@/assets/fonts/fonts.scss";
// 引入自定义指令
import directives from "@/directives/index";
// vchart黑暗模式
// https://arco.design/react/docs/vchart
initVChartArcoTheme();
const app = createApp(App);
// app.use(plugin, options)
// 其中 plugin 表示要传递的插件对象, options 参数是可选的,表示选项配置
// https://cn.vuejs.org/api/application.html#app-use
app.use(ArcoVue, {
componentPrefix: "arco"
});
app.use(pinia);
app.use(ArcoVueIcon);
app.use(router);
app.use(i18n);
app.use(directives);
app.mount("#app");
import { createApp } from "vue";
import "@/style.css";
import App from "@/App.vue";
// arco-design
import ArcoVue from "@arco-design/web-vue";
// vue-router
import router from "@/router/index";
// pinia
import pinia from "@/store/index";
// arco-css
import "@arco-design/web-vue/dist/arco.css";
// 额外引入图标库
import ArcoVueIcon from "@arco-design/web-vue/es/icon";
// 注册全局svg
import "virtual:svg-icons-register";
// 引入i18n
import i18n from "@/lang/index";
// 引入字体
import "@/assets/fonts/fonts.scss";
// 引入自定义指令
import directives from "@/directives/index";
const app = createApp(App);
// app.use(plugin, options)
// 其中 plugin 表示要传递的插件对象, options 参数是可选的,表示选项配置
// https://cn.vuejs.org/api/application.html#app-use
app.use(ArcoVue, {
componentPrefix: "arco"
});
app.use(pinia);
app.use(ArcoVueIcon);
app.use(router);
app.use(i18n);
app.use(directives);
app.mount("#app");
-86
View File
@@ -1,86 +0,0 @@
// 在线用户
export const onlineuser = [
{
tokenId: "2t6c278e-495h-821t-as26-31c98f8d2379",
userName: "admin",
deptName: "研发部门",
ipaddr: "115.23.16.25",
loginLocation: "上海市 上海市",
browser: "Quark 7.9.2.771",
os: "HarmonyOS NEXT 5.0.0.102",
loginTime: "2025-04-12 10:30:59",
status: 1 // 0离线 1在线
},
{
tokenId: "37adftaf-172c-1527-dcf6-efa3f92adc5c",
userName: "admin",
deptName: "研发部门",
ipaddr: "112.21.152.215",
loginLocation: "浙江省 杭州市",
browser: "Chrome 135.0.0.0",
os: "Windows 11",
loginTime: "2025-04-12 10:30:59",
status: 1 // 0离线 1在线
}
];
// 定时任务
export const crontab = [
{
id: 1,
name: "cron任务,5秒执行一次", // 任务名称
cron: "0/5 * * * * * ", // cron-执行规则
every: null, // 间隔时间秒-执行规则
service: "taskDemoService.test()", // 执行服务
startDate: "2025-03-30 11:28:35", // 开始时间
nextRunTime: "2025-03-13 11:20:50", // 下次执行时间
taskType: 0, // 任务类型 0 cron 1 指定时间(秒)
misfirePolicy: 1, // 执行策略 1 循环 2 执行一次
remark: "这是定时任务", // 备注
status: 1, // 0离线 1在线
createBy: "admin",
createTime: "2024-06-30 11:28:35",
updateBy: null,
updateTime: null
},
{
id: 2,
name: "每秒执行一次",
cron: null,
every: 1,
service: "taskDemoService.test(1,2)",
startDate: "2025-03-30 11:28:35",
nextRunTime: "2025-03-13 11:20:50",
taskType: 1,
misfirePolicy: 1,
remark: "这是定时任务",
status: 1,
createBy: "admin",
createTime: "2024-06-30 11:28:35",
updateBy: null,
updateTime: null
}
];
// 任务日志
export const crontabLogs = [
{
id: 1,
taskId: 1,
taskName: "cron任务,5秒执行一次",
status: 1,
remark: "",
createTime: "2025-03-30 11:28:35",
executionTime: "2025-03-30 11:28:35"
},
{
id: 2,
taskId: 2,
taskName: "每秒执行一次",
status: 0,
remark:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', `_isUTC` = false, `_pf` = '[object Object]', `_locale` = '[object Object]', `_' at line 1",
createTime: "2025-03-30 11:28:35",
executionTime: "2025-03-30 11:28:35"
}
];
-251
View File
@@ -1,251 +0,0 @@
// 部门数据
export const divisionData = [
{
id: "100",
parentId: "0",
name: "xxx机构有限公司",
leader: "兔子先森",
phone: "15888888888",
email: "2547096351@qq.com",
sort: 1,
status: 1,
description: "这是总部门",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 10:08:25",
children: [
{
id: "10001",
parentId: "100",
name: "华中总部",
leader: "小唐",
phone: "",
email: "",
sort: 1,
status: 1,
description: "这里是华中总部",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 17:30:40",
children: [
{
id: "1000101",
parentId: "10001",
name: "SnowAdmin开发组",
leader: "小汤",
phone: "",
email: "",
sort: 1,
status: 1,
description: "这是项目研发部",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 17:30:40",
children: [
{
id: "100010101",
parentId: "1000101",
name: "UI组",
leader: "晓棠",
phone: "",
email: "",
sort: 1,
status: 1,
description: "这里负责UI设计",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 17:30:40",
children: null
},
{
id: "100010102",
parentId: "1000101",
name: "研发组",
leader: "小塘",
phone: "",
email: "",
sort: 2,
status: 1,
description: "这里负责开发",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 17:30:40",
children: null
}
]
},
{
id: "1000102",
parentId: "10001",
name: "人事部门",
leader: "兔子",
phone: "",
email: "",
sort: 2,
status: 1,
description: "这里是人事部门",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 17:30:40",
children: null
},
{
id: "1000103",
parentId: "10001",
name: "财务部门",
leader: "小鹿",
phone: "",
email: "",
sort: 3,
status: 1,
description: "负责收账的",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: "admin",
updateTime: "2024-09-09 17:30:40",
children: null
}
]
}
]
}
];
// 角色数据
export const roleData = [
{
id: 1,
name: "超级管理员",
code: "admin",
sort: 1,
status: 1,
admin: true,
description: "默认角色,超级管理员,上帝角色",
createBy: null,
createTime: "2024-03-27 11:21:01",
updateBy: null,
updateTime: null
},
{
id: 2,
name: "普通员工",
code: "common",
sort: 2,
status: 1,
admin: false,
description: "负责一些基础功能",
createBy: null,
createTime: "2024-03-27 11:21:01",
updateBy: null,
updateTime: null
}
];
// 字典数据
export const dictData = [
{
id: "01",
name: "性别",
code: "gender",
status: 1,
description: "这是一个性别字典",
createTime: "2024-07-01 10:00:00",
list: [
{ id: "012", name: "女", value: 0, status: 1 },
{ id: "011", name: "男", value: 1, status: 1 },
{ id: "013", name: "其它", value: 2, status: 1 }
]
},
{
id: "02",
name: "状态",
code: "status",
status: 1,
description: "状态字段可以用这个",
createTime: "2024-07-01 10:00:00",
list: [
{ id: "021", name: "禁用", value: 0, status: 1 },
{ id: "022", name: "启用", value: 1, status: 1 }
]
},
{
id: "03",
name: "岗位",
code: "post",
status: 1,
description: "岗位字段",
createTime: "2024-07-01 10:00:00",
list: [
{ id: "031", name: "总经理", value: 1, status: 1 },
{ id: "032", name: "总监", value: 2, status: 1 },
{ id: "033", name: "人事主管", value: 3, status: 1 },
{ id: "034", name: "开发部主管", value: 4, status: 1 },
{ id: "035", name: "普通职员", value: 5, status: 1 },
{ id: "036", name: "其它", value: 999, status: 1 }
]
},
{
id: "04",
name: "任务状态",
code: "taskStatus",
status: 1,
description: "任务状态字段可以用它",
createTime: "2024-07-01 10:00:00",
list: [
{ id: "041", name: "失败", value: 0, status: 1 },
{ id: "042", name: "成功", value: 1, status: 1 }
]
}
];
// 账户数据
export const accountData = [
{
id: 1,
deptId: "100",
deptName: "研发部门",
userName: "admin",
nickName: "超级管理员",
email: "2547096351@qq.com",
phone: "15888888888",
sex: 1,
avatar: "https://ooo.0x0.ooo/2025/04/10/O0dG7r.jpg",
status: 1,
description: "系统初始用户",
roles: ["admin"],
loginIp: "0:0:0:0:0:0:0:1",
loginDate: "2025-03-31 10:30:59",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: null,
updateTime: null,
admin: true
},
{
id: 2,
deptId: "100010101",
deptName: "研发部门",
userName: "common",
nickName: "普通用户",
email: "2547096351@qq.com",
phone: "15222222222",
sex: 0,
avatar: "https://ooo.0x0.ooo/2025/04/10/O0ddJI.jpg",
status: 1,
description: "UI组用户",
roles: ["common"],
loginIp: "0:0:0:0:0:0:0:1",
loginDate: "2025-03-31 10:30:59",
createBy: "admin",
createTime: "2024-03-19 11:21:01",
updateBy: null,
updateTime: null,
admin: false
}
];
File diff suppressed because it is too large Load Diff
-187
View File
@@ -1,187 +0,0 @@
import Mock from "mockjs";
/** 返回成功数据 */
export const resultSuccess = (data: unknown) => {
return Mock.mock({
code: 200,
data,
message: "请求成功",
success: true
});
};
/** 返回失败数据 */
export const resultError = (data: unknown, message: string, code = 500) => {
return Mock.mock({
code,
data,
message,
success: false
});
};
/**
* 路由树递归排序
* 1、先给当前层排序
* 2、若当前层有children则递归排序
* @param {array} tree 根据角色权限过滤后的路由树
* @returns 返回排序之后的树
*/
export const treeSort = (tree: Menu.MenuOptions[]) => {
if (!tree || tree.length == 0) return [];
tree.sort((a: Menu.MenuOptions, b: Menu.MenuOptions) => {
// a和b都是undefined则相等
if (a.meta.sort != 0 && !a.meta.sort && b.meta.sort != 0 && !b.meta.sort) {
return 0;
}
// a是undefined则a被排在b之后
if (a.meta.sort != 0 && !a.meta.sort) return 1;
// b是undefined则b被排在a之后
if (b.meta.sort != 0 && !b.meta.sort) return -1;
return a.meta.sort - b.meta.sort;
});
// 深层递归
return tree.map((item: any) => {
if (item?.children?.length > 0) {
item.children = treeSort(item.children);
}
return item;
});
};
/**
* 过滤路由树,返回有权限的树
* 1、根据角色权限过滤原始路由树
* 2、过滤禁用的菜单,该菜单是不可访问的,直接去掉
* @param {array} tree 根据角色权限过滤原始路由树
* @returns 返回有权限的树
*/
export const filterByDisable = (tree: any, userRoles: Array<string>) => {
return tree.filter((item: any) => {
// 过滤角色权限
if (item?.meta?.roles) {
if (!roleBase(item.meta.roles, userRoles)) return false;
}
// 过滤是否禁用
if (item?.meta?.disable) return false;
return true;
});
};
/**
* 校验该角色是否有路由权限
* @param {array} roles 路由的角色权限
* @returns 是否有权限 true是 false否
*/
export const roleBase = (roles: Array<string>, userRoles: Array<string>) => {
// 如果是admin则直接放行
if (userRoles.includes("admin")) return true;
// 否则判断权限
return userRoles.some((item: string) => roles.includes(item));
};
/**
* 深拷贝
* @param { string } data 需要深拷贝的数据
* @returns 深拷贝的数据
*/
export function deepClone(data: any) {
let stack = [];
let cloned;
if (Array.isArray(data)) {
cloned = [];
} else if (typeof data === "object" && data !== null) {
cloned = {};
} else {
return data;
}
stack.push({
original: data,
copy: cloned
});
while (stack.length > 0) {
let current: any = stack.pop();
let original = current.original;
let copy = current.copy;
for (let key in original) {
if (original.hasOwnProperty(key)) {
let value = original[key];
if (typeof value === "object" && value !== null) {
copy[key] = Array.isArray(value) ? [] : {};
stack.push({
original: value,
copy: copy[key]
});
} else {
copy[key] = value;
}
}
}
}
return cloned;
}
/**
* 将扁平路由组装成树形结构
* @param {array} nodes 扁平数组
* @returns 树形结构
*/
export const buildTreeOptimized = (nodes: Menu.MenuOptions[]) => {
const nodeMap = new Map(); // 哈希表存储所有节点
const roots = []; // 存储顶层节点
const duplicates = new Set(); // 检测重复ID
// 第一次遍历: 注册所有节点 & 检测重复
for (const node of nodes) {
const id = node.id;
// 循环引用检测
if (node.id === node.parentId) {
throw new Error(`循环引用: ${node.id} -> ${node.parentId}`);
}
// 重复ID检测
if (nodeMap.has(id)) {
duplicates.add(id);
continue;
}
// 初始化子节点为null,这里children必须得是null,因为arco.design的展开列表组件根据数组判断是否显示展开按钮,哪怕是空数组也会显示展开按钮
node.children = null;
nodeMap.set(id, node);
}
// 输出重复警告
if (duplicates.size > 0) {
console.warn(`检测到重复ID: ${Array.from(duplicates).join(", ")}`);
}
// 第二次遍历: 构建树结构
for (const node of nodes) {
const { parentId } = node;
// 跳过已处理的重复节点
if (duplicates.has(node.id)) continue;
if (parentId === "0") {
roots.push(node); // 顶层节点
} else if (parentId) {
const parent = nodeMap.get(parentId);
if (parent) {
// 初始化父节点的children为数组(若为null)
if (parent.children === null) {
parent.children = [];
}
parent.children.push(node);
}
} else {
console.warn(`独立节点 ${node.id}: parentId为空`);
}
}
return roots;
};
-194
View File
@@ -1,194 +0,0 @@
import type { MockMethod } from "vite-plugin-mock";
import { resultSuccess } from "../_utils";
export default [
{
url: "/mock/document-library/tree",
method: "get",
timeout: 500,
response: () => {
let list = [
{
title: "总公司",
key: "0-0",
children: [
{
title: "行政部门",
key: "0-0-0",
children: [
{
title: "人力资源部",
key: "0-0-0-0",
children: [{ title: "员工出差申请表", key: "0-0-0-0-0" }]
},
{
title: "财务部",
key: "0-0-0-1",
children: [{ title: "行政费用预算分析", key: "0-0-0-0-1" }]
},
{
title: "法务部",
key: "0-0-0-2",
children: [{ title: "公司章程", key: "0-0-0-0-2" }]
},
{ title: "行政工作计划", key: "0-0-0-3" },
{ title: "会议室预订统计", key: "0-0-0-4" },
{ title: "月度工作总结", key: "0-0-0-5" }
]
},
{
title: "业务部门",
key: "0-0-1",
children: [
{ title: "客户反馈集锦", key: "0-0-1-0" },
{ title: "市场分析报告-季度", key: "0-0-1-1" }
]
},
{
title: "技术部门",
key: "0-0-2",
children: [
{ title: "代码审查记录", key: "0-0-2-0" },
{ title: "数据库优化方案", key: "0-0-2-1" },
{ title: "技术支持工单", key: "0-0-2-2" },
{ title: "安全漏洞扫描报告", key: "0-0-2-3" },
{ title: "系统性能调优总结", key: "0-0-2-4" },
{ title: "软件版本发布计划", key: "0-0-2-5" },
{ title: "技术培训材料", key: "0-0-2-6" },
{ title: "技术文档更新计划", key: "0-0-2-7" }
]
},
{
title: "后勤部门",
key: "0-0-3",
children: [
{ title: "设施维护报告", key: "0-0-3-0" },
{ title: "物流运输安排", key: "0-0-3-1" },
{ title: "仓库库存清单", key: "0-0-3-2" },
{ title: "办公室布局设计", key: "0-0-3-3" },
{ title: "设备采购申请表", key: "0-0-3-4" },
{ title: "食品安全检查记录", key: "0-0-3-5" }
]
}
]
}
];
return resultSuccess(list);
}
},
{
url: "/mock/document-library/table",
method: "get",
timeout: 500,
response: () => {
let list = [
{
key: "1",
source: "bilibili",
sourceSvg: "bilibili",
sourceType: "分享",
flow: "5015",
percent: "75",
status: 1,
createTime: "2024-05-27 09:00:00"
},
{
key: "2",
source: "微信",
sourceSvg: "wechat",
sourceType: "分享",
flow: "3217",
percent: "60",
status: 0,
createTime: "2024-05-26 15:30:00"
},
{
key: "3",
source: "QQ音乐",
sourceSvg: "QQ音乐",
sourceType: "搜索",
flow: "1343",
percent: "55",
status: 1,
createTime: "2024-05-25 12:45:00"
},
{
key: "4",
source: "百度",
sourceSvg: "百度",
sourceType: "搜索",
flow: "1235",
percent: "20",
status: 0,
createTime: "2024-05-24 11:20:00"
},
{
key: "5",
source: "优酷",
sourceSvg: "优酷",
sourceType: "首页推荐",
flow: "3456",
percent: "20",
status: 1,
createTime: "2024-05-23 14:10:00"
},
{
key: "6",
source: "网易云音乐",
sourceSvg: "网易云音乐",
sourceType: "每日一推",
flow: "5873",
percent: "30",
status: 0,
createTime: "2024-05-22 10:05:00"
},
{
key: "7",
source: "抖音",
sourceSvg: "抖音",
sourceType: "自然",
flow: "5465",
percent: "86",
status: 1,
createTime: "2024-05-21 08:45:00"
},
{
key: "8",
source: "西瓜视频",
sourceSvg: "西瓜视频",
sourceType: "搜索",
flow: "4642",
percent: "45",
status: 0,
createTime: "2024-05-20 16:30:00"
},
{
key: "9",
source: "微博",
sourceSvg: "微博",
sourceType: "搜索",
flow: "2375",
percent: "60",
status: 1,
createTime: "2024-05-19 09:20:00"
},
{
key: "10",
source: "豆瓣",
sourceSvg: "豆瓣",
sourceType: "搜索",
flow: "2465",
percent: "40",
status: 0,
createTime: "2024-05-18 13:55:00"
}
];
let data = {
list,
total: list.length
};
return resultSuccess(data);
}
}
] as MockMethod[];
-12
View File
@@ -1,12 +0,0 @@
import { createProdMockServer } from "vite-plugin-mock/es/createProdMockServer";
import testModule from "./test/index";
import userModule from "./user/index";
import systemModule from "./system/index";
import fileModule from "./file/index";
import tableModule from "./table/index";
import monitorModule from "./monitor/index";
export function setupProdMockServer() {
createProdMockServer([...testModule, ...userModule, ...systemModule, ...fileModule, ...tableModule, ...monitorModule]);
}
-35
View File
@@ -1,35 +0,0 @@
import type { MockMethod } from "vite-plugin-mock";
import { resultSuccess } from "../_utils";
import { onlineuser, crontab, crontabLogs } from "../_data/monitor_data";
/**
* post请求body,get请求query
* /mock/monitor/getOnlineuser 获取在线用户
* /mock/monitor/getCrontab 定时任务
*/
export default [
{
url: "/mock/monitor/getOnlineuser",
method: "get",
timeout: 300,
response: () => {
return resultSuccess(onlineuser);
}
},
{
url: "/mock/monitor/getCrontab",
method: "get",
timeout: 300,
response: () => {
return resultSuccess(crontab);
}
},
{
url: "/mock/monitor/getCrontabLogs",
method: "get",
timeout: 300,
response: ({ query }: any) => {
console.log(query);
return resultSuccess(crontabLogs);
}
}
] as MockMethod[];
-4
View File
@@ -1,4 +0,0 @@
import menu from "./menu";
import system from "./system";
export default [...menu, ...system];
-74
View File
@@ -1,74 +0,0 @@
import type { MockMethod } from "vite-plugin-mock";
import { deepClone, filterByDisable, buildTreeOptimized, treeSort, resultSuccess } from "../_utils";
import { systemMenu, permissionData } from "../_data/system_menu";
/**
* 初始化
* 后端接口需要做的事情:
* 1、根据token判断角色
* 2、过滤扁平路由,根据角色过滤权限和非禁用的节点
* 3、将扁平路由转换为树结构
* 4、路由树排序
* 5、返回路由树
*
* 前端调用接口拿到路由数据后:
* 1、将模块设置为真实模块
* 2、存储路由树,用于生成菜单
* 3、根据树生成一维路由数组
* 4、动态添加路由
* 5、缓存一维路由
*/
/**
* post请求body,get请求query
* /mock/menu/getRouters 获取路由数据
* /mock/menu/getMenuList 获取菜单列表数据-菜单管理
* /mock/menu/getUserPermission 根据角色获取权限数据
* /mock/menu/getPermission 获取权限数据
*/
export default [
{
url: "/mock/menu/getRouters",
method: "get",
timeout: 300,
response: ({ headers }: any) => {
let token = headers.authorization;
// 根据token或登录账号判断是什么角色,这里模拟两个角色,admin、common
let userRoles = token === "Admin-Token" ? ["admin"] : ["common"];
const originMenu: any = deepClone(systemMenu);
// 1. 过滤扁平路由,根据角色返回有权限且非禁用的节点
const survivalTree = filterByDisable(originMenu, userRoles);
// 2. 将扁平路由转换为树结构
// 2. 给路由树排序
// 3. 返回路由树
return resultSuccess(treeSort(buildTreeOptimized(survivalTree)));
}
},
{
url: "/mock/menu/getMenuList",
method: "get",
timeout: 300,
response: () => {
// 菜单管理这里需要查看到所有菜单,无需判断角色权限、禁用菜单
// 将扁平路由和权限菜单合并
const originMenu: any = [...deepClone(systemMenu), ...deepClone(permissionData)];
// 1. 将扁平路由转换为树结构
// 2. 给路由树排序
// 3. 返回路由树
return resultSuccess(treeSort(buildTreeOptimized(originMenu)));
}
},
{
url: "/mock/menu/getUserPermission",
method: "get",
timeout: 300,
response: ({ query }: any) => {
let { role } = query;
// 将扁平路由和权限菜单合并
const originMenu: any = [...deepClone(systemMenu), ...deepClone(permissionData)];
// 根据角色过滤id
let idList = originMenu.filter((item: any) => item.meta.roles.includes(role)).map((item: any) => item.id);
return resultSuccess(idList);
}
}
] as MockMethod[];
-45
View File
@@ -1,45 +0,0 @@
import type { MockMethod } from "vite-plugin-mock";
import { resultSuccess } from "../_utils";
import { dictData, divisionData, roleData, accountData } from "../_data/system_data";
/**
* post请求body,get请求query
* /mock/system/getDict 获取字典数据
* /mock/system/getDivision 获取部门数据
* /mock/system/getRole 获取角色数据
* /mock/system/getAccount 获取账号数据
*/
export default [
{
url: "/mock/system/getDict",
method: "get",
timeout: 300,
response: () => {
return resultSuccess(dictData);
}
},
{
url: "/mock/system/getDivision",
method: "get",
timeout: 300,
response: () => {
return resultSuccess(divisionData);
}
},
{
url: "/mock/system/getRole",
method: "get",
timeout: 300,
response: () => {
return resultSuccess(roleData);
}
},
{
url: "/mock/system/getAccount",
method: "get",
timeout: 300,
response: () => {
return resultSuccess(accountData);
}
}
] as MockMethod[];
-233
View File
@@ -1,233 +0,0 @@
import type { MockMethod } from "vite-plugin-mock";
import { resultSuccess } from "../_utils";
export default [
{
url: "/mock/common-table/list",
method: "get",
timeout: 500,
response: () => {
let list = [
{
key: "1",
name: "陈思源",
avatar: "陈",
phone: "13812345678",
email: "zhangsan@example.com",
address: "北京市朝阳区",
status: 1,
createTime: "2024-05-27 09:00:00"
},
{
key: "2",
name: "李婉娴",
avatar: "李",
phone: "13987654321",
email: "lisi@example.com",
address: "上海市浦东新区",
status: 0,
createTime: "2024-05-26 15:30:00"
},
{
key: "3",
name: "王雨菲",
avatar: "王",
phone: "13666666666",
email: "wangwu@example.com",
address: "广州市天河区",
status: 1,
createTime: "2024-05-25 12:45:00"
},
{
key: "4",
name: "张晨曦",
avatar: "张",
phone: "13788888888",
email: "zhaoliu@example.com",
address: "深圳市福田区",
status: 0,
createTime: "2024-05-24 11:20:00"
},
{
key: "5",
name: "赵梦琪",
avatar: "赵",
phone: "13599999999",
email: "qianqi@example.com",
address: "成都市锦江区",
status: 1,
createTime: "2024-05-23 14:10:00"
},
{
key: "6",
name: "刘昊然",
avatar: "刘",
phone: "13377777777",
email: "sunba@example.com",
address: "杭州市西湖区",
status: 0,
createTime: "2024-05-22 10:05:00"
},
{
key: "7",
name: "孙梦洁",
avatar: "孙",
phone: "13266666666",
email: "zhoujiu@example.com",
address: "南京市鼓楼区",
status: 1,
createTime: "2024-05-21 08:45:00"
},
{
key: "8",
name: "黄俊杰",
avatar: "黄",
phone: "13155555555",
email: "wushi@example.com",
address: "重庆市渝中区",
status: 0,
createTime: "2024-05-20 16:30:00"
},
{
key: "9",
name: "周雨萱",
avatar: "周",
phone: "13044444444",
email: "zhengshiyi@example.com",
address: "武汉市江汉区",
status: 1,
createTime: "2024-05-19 09:20:00"
},
{
key: "10",
name: "韩雪儿",
avatar: "韩",
phone: "13933333333",
email: "kongshier@example.com",
address: "西安市雁塔区",
status: 0,
createTime: "2024-05-18 13:55:00"
}
];
let data = {
list,
total: list.length
};
return resultSuccess(data);
}
},
{
url: "/mock/custom-table/list",
method: "get",
timeout: 500,
response: () => {
let list = [
{
key: "1",
serial: "57",
name: "WEIJEIWGSDG",
content: "图文",
searchType: "阅读量",
contentSize: 3700,
status: 1,
createTime: "2024-05-27 09:00:00"
},
{
key: "2",
serial: "58",
name: "DHDWEH",
content: "图文",
searchType: "阅读量",
contentSize: 3700,
status: 0,
createTime: "2024-05-26 15:30:00"
},
{
key: "3",
serial: "59",
name: "SHEHWAE",
content: "视频",
searchType: "播放量",
contentSize: 2500,
status: 1,
createTime: "2024-05-25 12:45:00"
},
{
key: "4",
serial: "60",
name: "WEHJUK",
content: "视频",
searchType: "播放量",
contentSize: 2500,
status: 0,
createTime: "2024-05-24 11:20:00"
},
{
key: "5",
serial: "61",
name: "EYTUJDGSD",
content: "音频",
searchType: "播放量",
contentSize: 2500,
status: 1,
createTime: "2024-05-23 14:10:00"
},
{
key: "6",
serial: "62",
name: "RTIFSDF",
content: "图文",
searchType: "阅读量",
contentSize: 3700,
status: 0,
createTime: "2024-05-22 10:05:00"
},
{
key: "7",
serial: "63",
name: "OIKSHHFD",
content: "图文",
searchType: "阅读量",
contentSize: 3700,
status: 1,
createTime: "2024-05-21 08:45:00"
},
{
key: "8",
serial: "64",
name: "QEUHRKO",
content: "视频",
searchType: "播放量",
contentSize: 2500,
status: 0,
createTime: "2024-05-20 16:30:00"
},
{
key: "9",
serial: "65",
name: "JSGSDRI",
content: "视频",
searchType: "播放量",
contentSize: 2300,
status: 1,
createTime: "2024-05-19 09:20:00"
},
{
key: "10",
serial: "66",
name: "AOUSTHREGG",
content: "音频",
searchType: "播放量",
contentSize: 2300,
status: 0,
createTime: "2024-05-18 13:55:00"
}
];
let data = {
list,
total: list.length
};
return resultSuccess(data);
}
}
] as MockMethod[];
-21
View File
@@ -1,21 +0,0 @@
import type { MockMethod } from "vite-plugin-mock";
import { resultSuccess, resultError } from "../_utils";
export default [
{
url: "/mock/test/success",
method: "get",
timeout: 300,
response: () => {
return resultSuccess("SnowAdmin开源免费,Welcome!");
}
},
{
url: "/mock/test/fail",
method: "get",
timeout: 300,
response: () => {
return resultError(null, "模拟mock数据出错", 500);
}
}
] as MockMethod[];

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