npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

befly-admin-ui

v1.8.37

Published

Befly - 管理后台功能组件

Readme

Admin 管理后台插件

功能说明

提供管理后台的基础功能,包括:

  • 管理员注册
  • 管理员登录(支持邮箱和手机号两种方式)
  • 发送短信验证码
  • 获取用户信息
  • 退出登录

图标规范(离线/outline)

  • 仅使用 tdesign-icons-vue-next 的组件形式(如 <AddIcon />),禁止 <Icon name="..." />
  • 统一使用 outline 风格:不要使用 *FilledIcon
  • 图标必须显式导入(adminUI 视图不依赖自动导入)。
  • 已验证存在性(基于 tdesign-icons-vue-next/esm/icons.d.ts)的当前使用清单:

AddIcon, CallIcon, ChartIcon, CheckCircleIcon, ChevronDownIcon, CircleIcon, CloseCircleIcon, CloudIcon, CodeIcon, CpuIcon, DataBaseIcon, DeleteIcon, EditIcon, ErrorCircleIcon, ErrorTriangleIcon, HardDiskStorageIcon, InfoCircleIcon, LightingCircleIcon, LinkIcon, LockOnIcon, MailIcon, MenuIcon, NotificationIcon, RefreshIcon, SearchIcon, SendIcon, ServerIcon, SettingIcon, SystemStorageIcon, TimeIcon, TrendingUpIcon, UsergroupIcon, UserIcon

API 接口

所有接口路由前缀: /api/core/

1. 注册接口

路由: POST /api/core/admin/register

请求参数:

{
    "name": "管理员姓名",
    "email": "[email protected]",
    "password": "密码(至少6位)"
}

响应:

{
    "code": 0,
    "msg": "注册成功",
    "data": {
        "id": 1,
        "name": "管理员姓名",
        "email": "[email protected]"
    }
}

2. 登录接口

路由: POST /api/core/admin/login

邮箱登录:

{
    "email": "[email protected]",
    "password": "密码"
}

手机号登录:

{
    "phone": "13800138000",
    "code": "验证码"
}

响应:

{
    "code": 0,
    "msg": "登录成功",
    "data": {
        "token": "Session SID",
        "userInfo": {
            "id": 1,
            "name": "管理员姓名",
            "email": "[email protected]",
            "role": "admin",
            "status": 1
        }
    }
}

3. 发送短信验证码

路由: POST /api/core/admin/sendSmsCode

请求参数:

{
    "phone": "13800138000"
}

响应:

{
    "code": 0,
    "msg": "验证码已发送",
    "data": {
        "code": "123456" // 仅开发环境返回
    }
}

4. 获取用户信息

路由: GET /api/core/admin/userInfo

请求头:

Authorization: Bearer {token}

响应:

{
    "code": 0,
    "msg": "获取成功",
    "data": {
        "id": 1,
        "name": "管理员姓名",
        "email": "[email protected]",
        "role": "admin",
        "status": 1
    }
}

5. 退出登录

路由: POST /api/core/admin/logout

请求头:

Authorization: Bearer {token}

响应:

{
    "code": 0,
    "msg": "退出成功",
    "data": null
}

数据库表

admin_admin 表

| 字段 | 类型 | 说明 | | --------------- | -------------------- | ------------------- | | id | int | 主键 ID | | name | varchar(50) | 姓名 | | email | varchar(100) | 邮箱 | | phone | varchar(20) | 手机号 | | password | varchar(255) | 密码(加密) | | role | enum('admin','user') | 角色 | | status | tinyint(1) | 状态(1-启用 0-禁用) | | last_login_time | datetime | 最后登录时间 | | last_login_ip | varchar(50) | 最后登录 IP | | created_at | datetime | 创建时间 | | updated_at | datetime | 更新时间 |

注意事项

  1. 短信验证码功能需要配置短信服务提供商
  2. 建议在生产环境配置 Redis 来存储验证码和 token 黑名单
  3. 密码使用 bcrypt 加密存储
  4. Token 有效期默认为 7 天