Full Code of LiuYuYang01/ThriveX-Admin for AI

main 6ef1271b5240 cached
159 files
500.0 KB
143.6k tokens
126 symbols
1 requests
Download .txt
Showing preview only (564K chars total). Download the full file or copy to clipboard to get everything.
Repository: LiuYuYang01/ThriveX-Admin
Branch: main
Commit: 6ef1271b5240
Files: 159
Total size: 500.0 KB

Directory structure:
gitextract_u6ur3t29/

├── .dockerignore
├── .gitignore
├── .prettierrc
├── .vite/
│   └── deps_temp_474a67bf/
│       └── package.json
├── LICENSE
├── README.md
├── dockerfile
├── eslint.config.js
├── index.html
├── package.json
├── postcss.config.cjs
├── public/
│   └── _redirects
├── src/
│   ├── App.tsx
│   ├── api/
│   │   ├── album_cate.ts
│   │   ├── album_image.ts
│   │   ├── article.ts
│   │   ├── assistant.ts
│   │   ├── auth.ts
│   │   ├── cate.ts
│   │   ├── comment.ts
│   │   ├── config.ts
│   │   ├── email.ts
│   │   ├── file.ts
│   │   ├── footprint.ts
│   │   ├── oss.ts
│   │   ├── record.ts
│   │   ├── rss.ts
│   │   ├── statis.ts
│   │   ├── swiper.ts
│   │   ├── tag.ts
│   │   ├── user.ts
│   │   ├── wall.ts
│   │   └── web.ts
│   ├── components/
│   │   ├── CardDataStats/
│   │   │   └── index.tsx
│   │   ├── ClickOutside.tsx
│   │   ├── Drawer/
│   │   │   └── index.tsx
│   │   ├── Dropdowns/
│   │   │   └── DropdownDefault.tsx
│   │   ├── Empty/
│   │   │   └── index.tsx
│   │   ├── FileUpload/
│   │   │   └── index.tsx
│   │   ├── HasPermission/
│   │   │   └── index.tsx
│   │   ├── Header/
│   │   │   ├── DarkModeSwitcher.tsx
│   │   │   ├── DropdownUser.tsx
│   │   │   └── index.tsx
│   │   ├── Loader/
│   │   │   └── index.tsx
│   │   ├── Material/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── NotFound/
│   │   │   └── index.tsx
│   │   ├── PageTab/
│   │   │   └── index.tsx
│   │   ├── PageTitle.tsx
│   │   ├── RandomAvatar/
│   │   │   └── index.tsx
│   │   ├── RouteList/
│   │   │   └── index.tsx
│   │   ├── Sidebar/
│   │   │   ├── SidebarLinkGroup.tsx
│   │   │   └── index.tsx
│   │   ├── StatusTag/
│   │   │   └── index.tsx
│   │   ├── SystemNotification/
│   │   │   └── index.tsx
│   │   ├── Title/
│   │   │   └── index.tsx
│   │   └── WangEditor/
│   │       ├── index.scss
│   │       └── index.tsx
│   ├── hooks/
│   │   ├── useAssistant.tsx
│   │   ├── useAuthRedirect.tsx
│   │   ├── useLocalStorage.tsx
│   │   └── useVersionData.tsx
│   ├── layout/
│   │   └── DefaultLayout.tsx
│   ├── main.tsx
│   ├── pages/
│   │   ├── article/
│   │   │   ├── components/
│   │   │   │   ├── ArticleExport.tsx
│   │   │   │   └── ArticleImportModal.tsx
│   │   │   └── index.tsx
│   │   ├── assistant/
│   │   │   └── index.tsx
│   │   ├── cate/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── comment/
│   │   │   └── index.tsx
│   │   ├── config/
│   │   │   └── index.tsx
│   │   ├── create/
│   │   │   ├── components/
│   │   │   │   ├── Editor/
│   │   │   │   │   ├── index.scss
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   ├── markdown.scss
│   │   │   │   │   └── plugins.tsx
│   │   │   │   └── PublishForm/
│   │   │   │       ├── index.scss
│   │   │   │       └── index.tsx
│   │   │   └── index.tsx
│   │   ├── create_record/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── dashboard/
│   │   │   ├── components/
│   │   │   │   ├── HeaderInfo/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── Info/
│   │   │   │   │   └── index.tsx
│   │   │   │   └── Stats/
│   │   │   │       ├── components/
│   │   │   │       │   ├── NewOldVisitors/
│   │   │   │       │   │   └── index.tsx
│   │   │   │       │   └── VisitorsStatisChat/
│   │   │   │       │       ├── index.tsx
│   │   │   │       │       └── type.d.ts
│   │   │   │       └── index.tsx
│   │   │   └── index.tsx
│   │   ├── decycle/
│   │   │   └── index.tsx
│   │   ├── draft/
│   │   │   └── index.tsx
│   │   ├── file/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── footprint/
│   │   │   └── index.tsx
│   │   ├── iterative/
│   │   │   └── index.tsx
│   │   ├── login/
│   │   │   └── index.tsx
│   │   ├── page/
│   │   │   └── my.tsx
│   │   ├── record/
│   │   │   └── index.tsx
│   │   ├── setup/
│   │   │   ├── components/
│   │   │   │   ├── My/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── Other/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── System/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── Theme/
│   │   │   │   │   ├── components/
│   │   │   │   │   │   ├── RecordTheme/
│   │   │   │   │   │   │   └── index.tsx
│   │   │   │   │   │   └── SynthesisTheme/
│   │   │   │   │   │       ├── index.tsx
│   │   │   │   │   │       └── type.d.ts
│   │   │   │   │   └── index.tsx
│   │   │   │   └── Web/
│   │   │   │       └── index.tsx
│   │   │   └── index.tsx
│   │   ├── storage/
│   │   │   └── index.tsx
│   │   ├── swiper/
│   │   │   └── index.tsx
│   │   ├── tag/
│   │   │   └── index.tsx
│   │   ├── wall/
│   │   │   └── index.tsx
│   │   ├── web/
│   │   │   └── index.tsx
│   │   └── work/
│   │       ├── components/
│   │       │   └── List/
│   │       │       └── index.tsx
│   │       └── index.tsx
│   ├── services/
│   │   └── assistant.ts
│   ├── stores/
│   │   ├── index.ts
│   │   └── modules/
│   │       ├── config.ts
│   │       ├── tabs.ts
│   │       ├── user.ts
│   │       └── web.ts
│   ├── styles/
│   │   ├── antd.scss
│   │   ├── custom.scss
│   │   ├── index.css
│   │   ├── sty.ts
│   │   └── var.scss
│   ├── types/
│   │   ├── app/
│   │   │   ├── album.d.ts
│   │   │   ├── article.d.ts
│   │   │   ├── assistant.d.ts
│   │   │   ├── brand.d.ts
│   │   │   ├── cate.d.ts
│   │   │   ├── chat.d.ts
│   │   │   ├── comment.d.ts
│   │   │   ├── config.d.ts
│   │   │   ├── email.d.ts
│   │   │   ├── file.d.ts
│   │   │   ├── footprint.d.ts
│   │   │   ├── oss.d.ts
│   │   │   ├── package.d.ts
│   │   │   ├── permission.d.ts
│   │   │   ├── product.d.ts
│   │   │   ├── record.d.ts
│   │   │   ├── role.d.ts
│   │   │   ├── route.d.ts
│   │   │   ├── rss.d.ts
│   │   │   ├── swiper.d.ts
│   │   │   ├── tag.d.ts
│   │   │   ├── user.d.ts
│   │   │   ├── wall.d.ts
│   │   │   └── web.d.ts
│   │   ├── env.d.ts
│   │   ├── global.d.ts
│   │   └── response.d.ts
│   └── utils/
│       ├── index.ts
│       ├── permission.ts
│       ├── request.ts
│       └── route.tsx
├── tsconfig.json
├── tsconfig.node.json
├── vercel.json
└── vite.config.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .dockerignore
================================================
node_modules
npm-debug.log
Dockerfile
.dockerignore

================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

================================================
FILE: .prettierrc
================================================
{
  "singleQuote": true,
  "jsxSingleQuote": false,
  "printWidth": 999,
  "semi": true,
  "bracketSpacing": true,
  "arrowParens": "always"
}


================================================
FILE: .vite/deps_temp_474a67bf/package.json
================================================
{
  "type": "module"
}


================================================
FILE: LICENSE
================================================
                    GNU AFFERO GENERAL PUBLIC LICENSE
                       Version 3, 19 November 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.

  A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate.  Many developers of free software are heartened and
encouraged by the resulting cooperation.  However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.

  The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community.  It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server.  Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.

  An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals.  This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU Affero General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Remote Network Interaction; Use with the GNU General Public License.

  Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software.  This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time.  Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source.  For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code.  There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.


================================================
FILE: README.md
================================================
<p align="center">
    <a href="https://liuyuyang.net" target="_blank">
        <img width="120" src="https://bu.dusays.com/2024/11/17/6739adf188f64.png" alt="ThriveX logo" />
    </a>
</p>
<h1 align="center" style="margin: 20px 0; font-weight: 700; padding-bottom:10px;">ThriveX Admin</h1>


<p align="center">
    <a href="https://github.com/LiuYuYang01/ThriveX-Admin/blob/main/LICENSE" target="_blank">
        <img alt="License: AGPL-3.0" src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=flat-square&logo=gnu" />
    </a>
    <a href="https://github.com/LiuYuYang01/ThriveX-Admin/stargazers" target="_blank">
        <img alt="Stars" src="https://img.shields.io/github/stars/LiuYuYang01/ThriveX-Admin?style=flat-square&logo=github&color=gold" />
    </a>
    <a href="https://github.com/LiuYuYang01/ThriveX-Admin/network" target="_blank">
        <img alt="Forks" src="https://img.shields.io/github/forks/LiuYuYang01/ThriveX-Admin?style=flat-square&logo=github" />
    </a>
</p>

## 📖 项目简介

**ThriveX Admin** 是 ThriveX 博客系统的现代化管理后台,采用 Next.js 15 + React 19 + Ant Design 构建,提供全功能的内容管理、用户管理、系统配置等一站式解决方案。

作为 ThriveX 全栈解决方案的核心组成部分,Admin 控制端与前端博客([ThriveX-Blog](https://github.com/LiuYuYang01/ThriveX-Blog))和后端服务([ThriveX-Server](https://github.com/LiuYuYang01/ThriveX-Server))共同构成了一个完整的开源博客生态系统。



## ✨ 核心特性

- 🎨 **现代化 UI**:基于 Ant Design 6.x + Tailwind CSS 4.x,提供优雅的视觉体验
- 📝 **富文本编辑器**:集成 WangEditor + ByteMD,支持 Markdown/HTML 双模式
- 📊 **数据可视化**:ECharts 图表展示访问统计、文章分类、用户增长等关键指标
- 🎯 **权限管理**:细粒度的 RBAC 权限控制,支持角色分配与权限配置
- 📁 **文件管理**:支持本地存储与多种 OSS 服务商(阿里云、腾讯云、七牛云等)
- 📧 **邮件系统**:内置 SMTP 邮件服务,支持评论回复、通知推送
- 📱 **响应式设计**:完美适配桌面端与平板设备
- 🌓 **暗色模式**:支持主题切换,保护用户视力
- ⚡ **性能优化**:代码分割、懒加载、缓存策略,确保极致性能



## 📸 界面预览

<div align="center">
    <img src="https://bu.dusays.com/2026/03/08/69ad27c95c51f.jpg" alt="ThriveX Admin Dashboard" style="border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1)" />
</div>


## 🚀 快速开始

https://docs.liuyuyang.net/docs/项目部署/1Panel.html



## 📂 项目结构

```
ThriveX-Admin/
├── src/
│   ├── api/              # API 接口定义
│   ├── components/       # 公共组件
│   ├── hooks/            # 自定义 Hooks
│   ├── layout/           # 布局组件
│   ├── pages/            # 页面路由
│   │   ├── article/      # 文章管理
│   │   ├── cate/         # 分类管理
│   │   ├── comment/      # 评论管理
│   │   ├── config/       # 系统配置
│   │   ├── dashboard/    # 仪表盘
│   │   ├── file/         # 文件管理
│   │   ├── storage/      # 存储配置
│   │   └── user/         # 用户管理
│   ├── services/         # 服务层
│   ├── stores/           # 状态管理
│   ├── styles/           # 样式文件
│   ├── types/            # TypeScript 类型定义
│   └── utils/            # 工具函数
├── public/               # 静态资源
├── .env                  # 环境变量配置
├── package.json          # 项目配置
└── vite.config.js        # Vite 配置
```



## 🌐 项目链接

| 名称        | 链接                                                                                         | 说明         |
| ----------- | -------------------------------------------------------------------------------------------- | ------------ |
| 博客预览    | [https://liuyuyang.net](https://liuyuyang.net)                                               | 前端博客展示 |
| 官网地址    | [https://thrivex.liuyuyang.net](https://thrivex.liuyuyang.net)                               | 项目官网     |
| 文档中心    | [https://docs.liuyuyang.net](https://docs.liuyuyang.net)                                     | 使用文档     |
| GitHub 主页 | [https://github.com/LiuYuYang01/ThriveX-Admin](https://github.com/LiuYuYang01/ThriveX-Admin) | 源码仓库     |



## 📝 开源协议

本项目采用 **AGPL-3.0** 许可证。

**使用须知**:

- ✅ 允许商业使用、修改、分发
- ✅ 必须保留原始版权说明
- ✅ 修改后的版本必须开源
- ❌ 禁止任何闭源商业行为

在项目 Star 突破 2K 后,您可以自由选择保留或删除版权信息。



## ⭐ Star History

[![Star History Chart](https://api.star-history.com/svg?repos=LiuYuYang01/ThriveX-Admin&type=Date)](https://star-history.com/#LiuYuYang01/ThriveX-Admin&Date)



## 👨‍💻 作者信息

**刘宇阳**

- GitHub: [@LiuYuYang01](https://github.com/LiuYuYang01)
- 我的博客: [https://liuyuyang.net](https://liuyuyang.net)
- 关于我:[https://my.liuyuyang.net](https://my.liuyuyang.net)
- 邮箱: [liuyuyang1024@yeah.net](mailto:liuyuyang1024@yeah.net)



## 💬 交流群

欢迎加入 ThriveX 官方交流群,与开发者和其他用户交流:

<div align="center">
    <img src="https://bu.dusays.com/2025/06/03/683e96eb43ad8.jpg" alt="WeChat Group" style="width: 300px; border-radius: 8px;" />
</div>

**加群方式**:添加微信 `liuyuyang2023`,备注 "ThriveX"



## 🙏 鸣谢

感谢所有为 ThriveX 项目做出贡献的开发者和用户!

特别感谢以下项目提供的灵感与技术支持:

- [zw-blog](https://blog.zwying.com/)
- [blatr](https://www.blatr.cn/)
- [poetize](https://poetize.cn/)



## 🔒 免责声明

本项目仅供学习交流使用,不提供任何技术咨询或技术支持服务。使用者在使用本项目时应遵守当地法律法规,不得用于任何违法活动。


================================================
FILE: dockerfile
================================================
# 使用官方的Node.js镜像作为基础镜像
FROM registry.cn-hangzhou.aliyuncs.com/liuyi778/node-20-alpine AS builder

# 设置工作目录
WORKDIR /thrive

# 复制 package.json 和 package-lock.json
COPY package*.json ./

# 配置 npm 镜像源
RUN npm config set registry https://registry.npmmirror.com

# 安装依赖
RUN npm install

# 复制项目文件
COPY . .

# 构建项目
RUN npm run build

# 使用 Nginx 作为生产环境的基础镜像
FROM nginx:alpine

# 复制构建输出到 Nginx 的默认静态文件目录
COPY --from=builder /thrive/dist /usr/share/nginx/html

# 暴露端口
EXPOSE 80

# 启动 Nginx
CMD ["nginx", "-g", "daemon off;"]


================================================
FILE: eslint.config.js
================================================
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import { defineConfig } from 'eslint/config';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';

export default defineConfig([
  { ignores: ['dist'] },
  {
    files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
    plugins: { js },
    extends: ['js/recommended'],
  },
  {
    files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
    languageOptions: { globals: globals.browser },
  },
  {
    plugins: {
      'react-hooks': reactHooks,
      'react-refresh': reactRefresh,
    },
  },
  tseslint.configs.recommended,
  pluginReact.configs.flat.recommended,
  {
    settings: {
      react: {
        // 从 package.json 自动检测 React 版本
        version: 'detect',
      },
    },
  },
  {
    rules: {
      'no-unused-vars': 'off', // 关闭未使用变量的检查
      'react-refresh/only-export-components': 'off',
      'react/display-name': 'off',
      // 约束js使用单引号,允许jsx双引号
      quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
      'jsx-quotes': ['error', 'prefer-double'],
      'react-hooks/exhaustive-deps': 'off',
      'react/react-in-jsx-scope': 'off',
      // 禁止使用 any 类型
      '@typescript-eslint/no-explicit-any': 'error',
    },
  },
]);


================================================
FILE: index.html
================================================
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ThriveX 现代化博客管理系统</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>


================================================
FILE: package.json
================================================
{
  "name": "thrivex-admin",
  "private": true,
  "version": "3.0",
  "type": "module",
  "scripts": {
    "dev": "eslint . && vite",
    "build": "eslint . && vite build",
    "preview": "vite preview",
    "lint": "eslint ."
  },
  "author": {
    "name": "刘宇阳",
    "email": "liuyuyang1024@yeah.net",
    "url": "https://liuyuyang.net"
  },
  "engines": {
    "node": ">=20",
    "npm": ">=10"
  },
  "dependencies": {
    "@ant-design/icons": "^6.1.0",
    "@bytemd/plugin-gemoji": "^1.21.0",
    "@bytemd/plugin-gfm": "^1.21.0",
    "@bytemd/plugin-highlight": "^1.21.0",
    "@bytemd/plugin-math": "^1.21.0",
    "@bytemd/react": "^1.21.0",
    "@codemirror/lang-json": "^6.0.2",
    "@dicebear/collection": "^7.0.0",
    "@dicebear/core": "^7.0.0",
    "@uiw/react-codemirror": "^4.23.14",
    "@wangeditor-next/editor": "^5.6.45",
    "@wangeditor-next/editor-for-react": "^1.0.10",
    "antd": "^6.3.1",
    "apexcharts": "^4.7.0",
    "axios": "^1.7.2",
    "bytemd": "^1.22.0",
    "compressorjs": "^1.2.1",
    "dayjs": "^1.11.13",
    "echarts": "^5.6.0",
    "echarts-for-react": "^3.0.2",
    "eslint-plugin-react-hooks": "^5.2.0",
    "file-saver": "^2.0.5",
    "highlight.js": "^11.11.1",
    "jszip": "^3.10.1",
    "katex": "^0.16.11",
    "react": "19.2.4",
    "react-apexcharts": "^1.7.0",
    "react-dom": "19.2.4",
    "react-github-calendar": "^4.2.2",
    "react-icons": "^4.12.0",
    "react-masonry-css": "^1.0.16",
    "react-router-dom": "^6.14.2",
    "rehype-callouts": "^1.4.1",
    "remark-mark-highlight": "^0.1.1",
    "sass": "^1.77.8",
    "unified": "^11.0.4",
    "unist-util-visit": "^5.0.0",
    "vite": "^7.3.1",
    "vite-plugin-sass-dts": "^1.3.25",
    "zustand": "^4.5.4"
  },
  "devDependencies": {
    "@eslint/js": "^9.31.0",
    "@tailwindcss/postcss": "^4.2.1",
    "@types/file-saver": "^2.0.7",
    "@types/hast": "^3.0.4",
    "@types/react": "19.2.14",
    "@types/react-dom": "19.2.3",
    "@vitejs/plugin-react": "^4.0.3",
    "codemod": "^1.5.4",
    "eslint": "^9.31.0",
    "eslint-plugin-react": "^7.37.5",
    "eslint-plugin-react-refresh": "^0.4.20",
    "globals": "^16.3.0",
    "postcss": "^8.4.27",
    "prettier": "^3.0.0",
    "prettier-plugin-tailwindcss": "^0.7.2",
    "tailwindcss": "^4.2.1",
    "typescript-eslint": "^8.37.0"
  },
  "pnpm": {
    "onlyBuiltDependencies": [
      "@parcel/watcher",
      "es5-ext",
      "esbuild",
      "sharp"
    ]
  }
}


================================================
FILE: postcss.config.cjs
================================================
// eslint-disable-next-line no-undef
module.exports = {
  plugins: {
    '@tailwindcss/postcss': {},
  },
}


================================================
FILE: public/_redirects
================================================
/* /index.html 200

================================================
FILE: src/App.tsx
================================================
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import useAuthRedirect from '@/hooks/useAuthRedirect';
import { App as AntdApp, ConfigProvider, theme } from 'antd';
import RouteList from './components/RouteList';
import '@/styles/antd.scss';

import { getWebConfigDataAPI } from '@/api/config';
import { useWebStore, useUserStore, useConfigStore } from './stores';
import { Web } from './types/app/config';

import zhCN from 'antd/locale/zh_CN';
import 'dayjs/locale/zh-cn';

function App() {
  useAuthRedirect();

  const token = useUserStore((state) => state.token);
  const colorMode = useConfigStore((state) => state.colorMode);
  const { pathname } = useLocation();

  useEffect(() => {
    window.scrollTo(0, 0);
  }, [pathname]);

  const setWeb = useWebStore((state) => state.setWeb);
  const getWebData = async () => {
    if (!token) return;
    const { data } = await getWebConfigDataAPI<{ value: Web }>('web');
    setWeb(data.value);
  };

  useEffect(() => {
    getWebData();
  }, [token]);

  return (
    <ConfigProvider
      theme={{
        token: {
          colorPrimary: '#60a5fa',
          borderRadius: 6,
          colorBgBase: colorMode === 'dark' ? '#263444' : '#ffffff',
          colorTextBase: colorMode === 'dark' ? '#e0e0e0' : '#000000',
          ...(colorMode === 'dark' && {
            colorBgLayout: '#263444',
            colorBgContainer: '#263444',
            colorBgElevated: '#263444',
            colorBgSpotlight: '#263444',
          }),
        },
        algorithm: colorMode === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm,
      }}
      locale={zhCN}
    >
      <AntdApp>
        <RouteList />
      </AntdApp>
    </ConfigProvider>
  );
}

export default App;


================================================
FILE: src/api/album_cate.ts
================================================
import Request from '@/utils/request'
import { AlbumCate, AlbumImage } from '@/types/app/album'

// 新增相册
export const addAlbumCateDataAPI = (data: AlbumCate) => Request('POST', '/album/cate', { data })

// 删除相册
export const delAlbumCateDataAPI = (id: number) => Request('DELETE', `/album/cate/${id}`)

// 修改相册
export const editAlbumCateDataAPI = (data: AlbumCate) => Request('PATCH', '/album/cate', { data })

// 获取相册
export const getAlbumCateDataAPI = (id?: number) => Request<AlbumCate>('GET', `/album/cate/${id}`)

// 获取相册列表
export const getAlbumCateListAPI = (data?: QueryData) => Request<AlbumCate[]>('POST', '/album/cate/list', {
  data: { ...data?.query }
});

// 分页获取相册列表
export const getAlbumCatePagingAPI = (data?: QueryData) => Request<Paginate<AlbumCate[]>>('POST', `/album/cate/paging`, {
  data: { ...data?.query },
  params: {
    ...data?.pagination
  }
})

// 获取指定相册中的所有照片
export const getImagesByAlbumIdAPI = (id: number, page: number = 1, size: number = 10) =>
  Request<Paginate<AlbumImage[]>>('GET', `/album/cate/${id}/images`, {
    params: {
      page,
      size
    }
  })

================================================
FILE: src/api/album_image.ts
================================================
import Request from '@/utils/request'
import { AlbumImage } from '@/types/app/album'

// 新增照片
export const addAlbumImageDataAPI = (data: AlbumImage) => Request('POST', '/album/image', { data })

// 删除照片
export const delAlbumImageDataAPI = (id: number) => Request('DELETE', `/album/image/${id}`)

// 修改照片
export const editAlbumImageDataAPI = (data: AlbumImage) => Request('PATCH', '/album/image', { data })

// 获取照片
export const getAlbumImageDataAPI = (id?: number) => Request<AlbumImage>('GET', `/album/image/${id}`)

// 获取照片列表
export const getAlbumImageListAPI = (data?: QueryData) => Request<AlbumImage[]>('POST', '/album/image/list', {
  data: { ...data?.query }
});

// 分页获取照片列表
export const getAlbumImagePagingAPI = (data?: QueryData) => Request<Paginate<AlbumImage[]>>('POST', `/album/image/paging`, {
  data: { ...data?.query },
  params: {
    ...data?.pagination
  }
})

================================================
FILE: src/api/article.ts
================================================
import Request from '@/utils/request';
import { Article, ArticleFilterQueryParams } from '@/types/app/article';

// 新增文章
export const addArticleDataAPI = (data: Article) =>
  Request('POST', '/article', { data });

// 删除文章
export const delArticleDataAPI = (id: number, isDel?: boolean) =>
  Request('DELETE', isDel ? `/article/${id}/1` : `/article/${id}/0`);

// 批量删除文章
export const delBatchArticleDataAPI = (ids: number[]) =>
  Request('DELETE', '/article/batch', { data: ids });
// 还原被删除的文章
export const reductionArticleDataAPI = (id: number) =>
  Request('PATCH', `/article/reduction/${id}`);

// 编辑文章
export const editArticleDataAPI = (data: Article) =>
  Request('PATCH', '/article', { data });

// 获取文章
export const getArticleDataAPI = (id?: number) => Request<Article>('GET', `/article/${id}`)

// 获取文章列表
export const getArticlePagingAPI = (params?: ArticleFilterQueryParams) => Request<Paginate<Article[]>>('GET', `/article`, { params })

// 导入文章
export const importArticleDataAPI = (list: File[]) => {
  const formData = new FormData();

  list.forEach((file) => {
    formData.append(`list`, file);
  });

  return Request('POST', '/article/import', {
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

================================================
FILE: src/api/assistant.ts
================================================
import Request from '@/utils/request'
import { Assistant } from '@/types/app/assistant'

// 新增助手
export const addAssistantDataAPI = (data: Assistant) => Request('POST', '/assistant', { data })

// 删除助手
export const delAssistantDataAPI = (id: number) => Request('DELETE', `/assistant/${id}`)

// 修改助手
export const editAssistantDataAPI = (data: Assistant) => Request('PATCH', '/assistant', { data })

// 获取助手
export const getAssistantDataAPI = (id?: number) => Request<Assistant>('GET', `/assistant/${id}`)

// 获取助手列表
export const getAssistantListAPI = (data?: QueryData) => Request<Assistant[]>('POST', '/assistant/list', {
    data: { ...data?.query }
});

// 设置默认助手
export const setDefaultAssistantAPI = (id: number) => Request('PATCH', `/assistant/default/${id}`)

================================================
FILE: src/api/auth.ts
================================================
import { LoginReturn } from '@/types/app/user'
import Request from '@/utils/request'

// 授权 github 登录
export const authGitHubLoginAPI = (code: string) => Request<LoginReturn>('POST', `/auth/github/login?code=${code}`)

// 绑定 github 登录
export const bindGitHubLoginAPI = (code: string, userId: string) => Request('POST', `/auth/github/bind?code=${code}&userId=${userId}`)

================================================
FILE: src/api/cate.ts
================================================
import Request from '@/utils/request'
import { Cate, CateFilterQueryParams } from '@/types/app/cate'

// 新增分类
export const addCateDataAPI = (data: Cate) => Request('POST', '/cate', { data })

// 删除分类
export const delCateDataAPI = (id: number) => Request('DELETE', `/cate/${id}`)

// 修改分类
export const editCateDataAPI = (data: Cate) => Request('PATCH', '/cate', { data })

// 获取分类
export const getCateDataAPI = (id?: number) => Request<Cate>('GET', `/cate/${id}`)

// 获取分类列表
export const getCateListAPI = (params?: CateFilterQueryParams) => Request<Paginate<Cate[]>>('GET', `/cate`, { params })

================================================
FILE: src/api/comment.ts
================================================
import Request from '@/utils/request'
import { Comment } from '@/types/app/comment'

// 新增评论
export const addCommentDataAPI = (data: Comment) => Request('POST', '/comment', { data })

// 删除评论
export const delCommentDataAPI = (id: number) => Request('DELETE', `/comment/${id}`)

// 审核评论
export const auditCommentDataAPI = (id: number) => Request('PATCH', `/comment/audit/${id}`)

// 修改评论
export const editCommentDataAPI = (data: Comment) => Request('PATCH', '/comment', { data })

// 获取评论
export const getCommentDataAPI = (id?: number) => Request<Paginate<Comment>>('GET', `/comment/${id}`)

// 获取评论列表
export const getCommentListAPI = (data?: QueryData) => Request<Comment[]>('POST', `/comment/list`, {
    data: { ...data, ...data?.query },
})

// 分页获取评论列表
export const getCommentPagingAPI = (data?: QueryData) => Request<Paginate<Comment[]>>('POST', `/comment/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

================================================
FILE: src/api/config.ts
================================================
import Request from '@/utils/request';
import { Config, EnvConfigName, WebConfigType } from '@/types/app/config';

// 获取网站配置
export const getWebConfigDataAPI = <T>(name: WebConfigType) => Request<T>('GET', `/web_config/name/${name}`);

// 修改网站配置
export const editWebConfigDataAPI = (name: WebConfigType, data: object) => Request<Config>('PATCH', `/web_config/json/name/${name}`, { data });

// 获取环境配置
export const getEnvConfigDataAPI = (name: EnvConfigName) => Request<Config>('GET', `/env_config/name/${name}`);

// 获取环境配置列表
export const getEnvConfigListAPI = () => Request<Config[]>('GET', `/env_config/list`);

// 更新环境配置
export const updateEnvConfigDataAPI = (data: Config) => Request('PATCH', `/env_config/json/${data.id}`, { data: data.value });

// 根据id获取页面配置
export const getPageConfigDataAPI = (id: number) => Request<Config>('GET', `/page_config/${id}`);

// 根据名称获取页面配置
export const getPageConfigDataByNameAPI = (name: string) => Request<Config>('GET', `/page_config/name/${name}`);

// 获取页面配置列表
export const getPageConfigListAPI = () => Request<Config[]>('GET', `/page_config/list`);

// 更新页面配置
export const updatePageConfigDataAPI = (id: number, data: object) => Request('PATCH', `/page_config/json/${id}`, { data });


================================================
FILE: src/api/email.ts
================================================
import Request from '@/utils/request'
import { DismissEmail, ReplyWallEmail } from '@/types/app/email'

// 发送驳回邮件
export const sendDismissEmailAPI = async (data: DismissEmail) => {
    return await Request<string>('POST', `/email/dismiss`, { data });
}

// 发送回复留言邮件
export const sendReplyWallEmailAPI = async (data: ReplyWallEmail) => {
    return await Request<string>('POST', `/email/reply_wall`, { data });
}

================================================
FILE: src/api/file.ts
================================================
import Request from '@/utils/request'
import { File, FileDir } from '@/types/app/file'

// 删除文件
export const delFileDataAPI = (filePath: string) => Request('DELETE', `/file?filePath=${filePath}`)

// 获取文件
export const getFileDataAPI = (filePath: string) => Request<File>('GET', `/file/info?filePath=${filePath}`)

// 获取文件列表
export const getFileListAPI = (dir: string, paging?: Page) => Request<Paginate<File[]>>('GET', `/file/list?dir=${dir}`, {
  params: {
    ...paging
  }
})

// 获取目录列表
export const getDirListAPI = () => Request<FileDir[]>('GET', '/file/dir')

================================================
FILE: src/api/footprint.ts
================================================
import Request from '@/utils/request'
import { Footprint } from '@/types/app/footprint'

// 新增足迹
export const addFootprintDataAPI = (data: Footprint) => Request('POST', '/footprint', { data })

// 删除足迹
export const delFootprintDataAPI = (id: number) => Request('DELETE', `/footprint/${id}`)

// 修改足迹
export const editFootprintDataAPI = (data: Footprint) => Request('PATCH', '/footprint', { data })

// 获取足迹
export const getFootprintDataAPI = (id?: number) => Request<Footprint>('GET', `/footprint/${id}`)

// 获取足迹列表
export const getFootprintListAPI = (data?: QueryData) => Request<Footprint[]>('POST', '/footprint/list', {
    data: { ...data?.query }
});

================================================
FILE: src/api/oss.ts
================================================
import Request from '@/utils/request'
import { Oss } from '@/types/app/oss'

// 新增OSS
export const addOssDataAPI = (data: Oss) => Request('POST', '/oss', { data })

// 删除OSS
export const delOssDataAPI = (id: number) => Request('DELETE', `/oss/${id}`)

// 修改OSS
export const editOssDataAPI = (data: Oss) => Request('PATCH', '/oss', { data })

// 获取OSS
export const getOssDataAPI = (id?: number) => Request<Oss>('GET', `/oss/${id}`)

// 获取OSS列表
export const getOssListAPI = () => Request<Oss[]>('POST', `/oss/list`)

// 获取启用的OSS列表
export const getOssEnableListAPI = () => Request<Oss[]>('GET', `/oss/getEnableOss`)

// 启用OSS
export const enableOssDataAPI = (id: number) => Request('PATCH', `/oss/enable/${id}`)

// 禁用OSS
export const disableOssDataAPI = (id: number) => Request('PATCH', `/oss/disable/${id}`)

// 获取支持的OSS平台列表
export const getOssPlatformListAPI = () => Request<{ name: string, value: string }[]>('GET', `/oss/platform`)

================================================
FILE: src/api/record.ts
================================================
import Request from '@/utils/request'
import { Record } from '@/types/app/record'

// 新增说说
export const addRecordDataAPI = (data: Record) => Request('POST', '/record', { data })

// 删除说说
export const delRecordDataAPI = (id: number) => Request('DELETE', `/record/${id}`)

// 修改说说
export const editRecordDataAPI = (data: Record) => Request('PATCH', '/record', { data })

// 获取说说
export const getRecordDataAPI = (id?: number) => Request<Record>('GET', `/record/${id}`)

// 获取说说列表
export const getRecordListAPI = (data?: QueryData) => Request<Record[]>('POST', `/record/list`, {
    data: { ...data?.query },
})

// 分页获取说说列表
export const getRecordPagingAPI = (data?: QueryData) => Request<Paginate<Record[]>>('POST', `/record/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

================================================
FILE: src/api/rss.ts
================================================
import { Rss } from '@/types/app/rss';
import Request from '@/utils/request';

// 获取订阅数据列表
export const getRssListAPI = (data?: QueryData) => Request<Rss[]>('GET', `/rss/list`, {
    data: { ...data?.query },
})

// 分页获取订阅列表
export const getRssPagingAPI = (data?: QueryData) => Request<Paginate<Rss[]>>('POST', `/rss/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

================================================
FILE: src/api/statis.ts
================================================
import Request from '@/utils/request';

type StatisType = 'overview' | 'new-visitor' | 'basic-overview';

// overview(概览趋势), new-visitor(新访客趋势), basic-overview(基础概览趋势)
// 获取 PV量、IP量、跳出率、平均访问时长
export const getStatisAPI = (type: StatisType, startDate: string, endDate: string) => Request('GET', `/statis`, {
  params: {
    startDate,
    endDate,
    type
  },
})

================================================
FILE: src/api/swiper.ts
================================================
import Request from '@/utils/request'
import { Swiper } from '@/types/app/swiper'

// 新增轮播图
export const addSwiperDataAPI = (data: Swiper) => Request('POST', '/swiper', { data })

// 删除轮播图
export const delSwiperDataAPI = (id: number) => Request('DELETE', `/swiper/${id}`)

// 修改轮播图
export const editSwiperDataAPI = (data: Swiper) => Request('PATCH', '/swiper', { data })

// 获取轮播图
export const getSwiperDataAPI = (id?: number) => Request<Swiper>('GET', `/swiper/${id}`)

// 获取轮播图数据列表
export const getSwiperListAPI = (data?: QueryData) => Request<Swiper[]>('POST', `/swiper/list`, {
    data: { ...data?.query },
})

// 分页获取轮播图列表
export const getSwiperPagingAPI = (data?: QueryData) => Request<Paginate<Swiper[]>>('POST', `/swiper/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

================================================
FILE: src/api/tag.ts
================================================
import Request from '@/utils/request'
import { Tag } from '@/types/app/tag'

// 新增标签
export const addTagDataAPI = (data: Tag) => Request('POST', '/tag', { data })

// 删除标签
export const delTagDataAPI = (id: number) => Request('DELETE', `/tag/${id}`)

// 修改标签
export const editTagDataAPI = (data: Tag) => Request('PATCH', '/tag', { data })

// 获取标签
export const getTagDataAPI = (id?: number) => Request<Tag>('GET', `/tag/${id}`)

// 获取标签列表
// export const getTagListAPI = (data?: QueryData) => Request<Tag[]>('POST', `/tag/list`, {
//     data: { ...data?.query },
// })

// 统计每个标签下的文章数量
export const getTagListAPI = () => Request<Tag[]>('GET', '/tag/article/count')

// 分页获取标签列表
export const getTagPagingAPI = (data?: QueryData) => Request<Paginate<Tag[]>>('POST', `/tag/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

================================================
FILE: src/api/user.ts
================================================
import Request from '@/utils/request'
import { LoginReturn, EditUser, Login, User, UserInfo } from '@/types/app/user'

// 新增用户
export const addUserDataAPI = (data: User) => Request('POST', '/user', { data });

// 删除用户
export const delUserDataAPI = (id: number) => Request('DELETE', `/user/${id}`);

// 编辑用户
export const editUserDataAPI = (data: UserInfo) => Request('PATCH', '/user', { data })

// 获取用户
export const getUserDataAPI = (id?: number) => Request<User>('GET', `/user/${id}`)

// 获取用户列表
export const getUserListAPI = (data?: QueryData) => Request<User[]>('POST', `/user/list`, {
    data: { ...data?.query },
})

// 分页获取用户列表
export const getUserPagingAPI = (data?: QueryData) => Request<Paginate<User[]>>('POST', `/user/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

// 登录
export const loginDataAPI = (data: Login) => Request<LoginReturn>('POST', '/user/login', { data })

// 修改管理员密码
export const editAdminPassAPI = (data: EditUser) => Request('PATCH', '/user/pass', { data })

// 判断当前token是否有效
export const checkTokenAPI = (token: string) => Request('GET', `/user/check?token=${token}`)

================================================
FILE: src/api/wall.ts
================================================
import Request from '@/utils/request'
import { Wall, Cate } from '@/types/app/wall'

// 新增留言
export const addWallDataAPI = (data: Wall) => Request('POST', '/wall', { data })

// 删除留言
export const delWallDataAPI = (id: number) => Request('DELETE', `/wall/${id}`)

// 审核留言
export const auditWallDataAPI = (id: number) => Request('PATCH', `/wall/audit/${id}`)

// 修改留言
export const editWallDataAPI = (data: Wall) => Request('PATCH', '/wall', { data })

// 获取留言
export const getWallDataAPI = (id?: number) => Request<Paginate<Wall>>('GET', `/wall/${id}`)

// 获取留言列表
export const getWallListAPI = (data?: QueryData) => Request<Wall[]>('POST', `/wall/list`, {
    data: { ...data?.query },
})

// 分页获取留言列表
export const getWallPagingAPI = (data?: QueryData) => Request<Paginate<Wall[]>>('POST', `/wall/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

// 获取留言分类列表
export const getWallCateListAPI = () => Request<Cate[]>('GET', `/wall/cate`)

// 设置与取消精选
export const updateChoiceAPI = (id: number) => Request('PATCH', `/wall/choice/${id}`)

================================================
FILE: src/api/web.ts
================================================
import Request from '@/utils/request'
import { Web, WebType } from '@/types/app/web'

// 新增网站
export const addLinkDataAPI = (data: Web) => Request('POST', '/link', { data })

// 删除网站
export const delLinkDataAPI = (id: number) => Request('DELETE', `/link/${id}`)

// 修改网站
export const editLinkDataAPI = (data: Web) => Request('PATCH', '/link', { data })

// 获取网站
export const getLinkDataAPI = (id?: number) => Request<Web>('GET', `/link/${id}`)

// 获取网站列表
export const getLinkListAPI = (data?: QueryData) => Request<Web[]>('POST', `/link/list`, {
    data: { ...data?.query },
})

// 分页获取评论列表
export const getLinkPagingAPI = (data?: QueryData) => Request<Paginate<Web[]>>('POST', `/link/paging`, {
    data: { ...data?.query },
    params: {
        ...data?.pagination
    }
})

// 获取网站类型列表
export const getWebTypeListAPI = () => {
    return Request<WebType[]>('GET', `/link/type`);
};

// 审核网站
export const auditWebDataAPI = (id: number) => Request<Web>('PATCH', `/link/audit/${id}`)


================================================
FILE: src/components/CardDataStats/index.tsx
================================================
import { ReactNode } from 'react';

interface Props {
  title: string;
  total: string;
  children: ReactNode;
}

export default ({ title, total, children }: Props) => {
  return (
    <div className="rounded-md border border-stroke py-6 px-7 shadow-default dark:border-transparent bg-light-gradient dark:bg-dark-gradient">
      <h3 className="text-sm text-slate-700 dark:text-white">{title}</h3>

      <div className="flex items-center justify-between">
        <h4 className="font-bold text-2xl my-2 text-black dark:text-white">{total}</h4>

        <div className="flex h-11 w-11 items-center justify-center rounded-md bg-[#e7f2fe] dark:bg-[#4e5969]">
          {children}
        </div>
      </div>
    </div>
  );
};


================================================
FILE: src/components/ClickOutside.tsx
================================================
import React, { useRef, useEffect } from 'react';

interface Props {
  children: React.ReactNode;
  exceptionRef?: React.RefObject<HTMLElement>;
  onClick: () => void;
  className?: string;
}

const ClickOutside: React.FC<Props> = ({
  children,
  exceptionRef,
  onClick,
  className,
}) => {
  const wrapperRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const handleClickListener = (event: MouseEvent) => {
      let clickedInside: null | boolean = false;
      if (exceptionRef) {
        clickedInside =
          (wrapperRef.current &&
            wrapperRef.current.contains(event.target as Node)) ||
          (exceptionRef.current && exceptionRef.current === event.target) ||
          (exceptionRef.current &&
            exceptionRef.current.contains(event.target as Node));
      } else {
        clickedInside =
          wrapperRef.current &&
          wrapperRef.current.contains(event.target as Node);
      }

      if (!clickedInside) onClick();
    };

    document.addEventListener('mousedown', handleClickListener);

    return () => {
      document.removeEventListener('mousedown', handleClickListener);
    };
  }, [exceptionRef, onClick]);

  return (
    <div ref={wrapperRef} className={`${className || ''}`}>
      {children}
    </div>
  );
};

export default ClickOutside;


================================================
FILE: src/components/Drawer/index.tsx
================================================
import { Drawer } from 'antd';
import { CloseOutlined } from '@ant-design/icons';

interface Props {
  title: string;
  loading?: boolean;
  open?: boolean;
  onClose?: (open: boolean) => void;
  className?: string;
  children: React.ReactNode;
}

export default ({ title, children, open, onClose, loading, className }: Props) => {
  const Title = () => {
    return (
      <div className="flex justify-between items-center">
        <div></div>
        <div className="ml-6">{title}</div>
        <div
          onClick={() => onClose?.(false)}
          className="group p-3 px-6 hover:bg-red-500 hover:text-white transition-colors cursor-pointer"
        >
          <CloseOutlined className="group-hover:scale-150 transition-transform" />
        </div>
      </div>
    );
  };

  return (
    <Drawer
      loading={loading}
      title={<Title />}
      open={open}
      onClose={() => onClose?.(false)}
      height="100vh"
      placement="bottom"
      closeIcon={null}
      className={`[&>.ant-drawer-header]:p-0! ${className}`}
    >
      {children}
    </Drawer>
  );
};


================================================
FILE: src/components/Dropdowns/DropdownDefault.tsx
================================================
import { useEffect, useRef, useState } from 'react';

const DropdownDefault = () => {
  const [dropdownOpen, setDropdownOpen] = useState(false);

  const trigger = useRef<HTMLButtonElement>(null);
  const dropdown = useRef<HTMLDivElement>(null);

  // 监听点击事件,如果点击发生在下拉菜单外部,则关闭下拉菜单
  useEffect(() => {
    const clickHandler = ({ target }: MouseEvent) => {
      // 如果下拉菜单未挂载,直接返回
      if (!dropdown.current || !trigger.current) return;
      // 如果下拉菜单未打开,或者点击目标在下拉菜单或触发按钮内部,则不做处理
      if (!dropdownOpen || dropdown.current.contains(target as Node) || trigger.current.contains(target as Node)) return;
      // 否则关闭下拉菜单
      setDropdownOpen(false);
    };
    // 添加全局点击事件监听
    document.addEventListener('click', clickHandler);
    // 组件卸载时移除监听
    return () => document.removeEventListener('click', clickHandler);
  });

  // 监听键盘事件,如果按下的是 ESC 键,则关闭下拉菜单
  useEffect(() => {
    const keyHandler = (event: KeyboardEvent) => {
      // 如果下拉菜单未打开或按下的不是 ESC 键,则不做处理
      if (!dropdownOpen || event.key !== 'Escape') return;
      // 关闭下拉菜单
      setDropdownOpen(false);
    };
    // 添加全局键盘按下事件监听
    document.addEventListener('keydown', keyHandler);
    // 组件卸载时移除监听
    return () => document.removeEventListener('keydown', keyHandler);
  });

  return (
    <div className="relative flex">
      <button className="text-[#98A6AD] hover:text-[#64748B]" ref={trigger} onClick={() => setDropdownOpen(!dropdownOpen)}>
        <svg className="fill-current" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M2.25 11.25C3.49264 11.25 4.5 10.2426 4.5 9C4.5 7.75736 3.49264 6.75 2.25 6.75C1.00736 6.75 0 7.75736 0 9C0 10.2426 1.00736 11.25 2.25 11.25Z" fill="" />
          <path d="M9 11.25C10.2426 11.25 11.25 10.2426 11.25 9C11.25 7.75736 10.2426 6.75 9 6.75C7.75736 6.75 6.75 7.75736 6.75 9C6.75 10.2426 7.75736 11.25 9 11.25Z" fill="" />
          <path d="M15.75 11.25C16.9926 11.25 18 10.2426 18 9C18 7.75736 16.9926 6.75 15.75 6.75C14.5074 6.75 13.5 7.75736 13.5 9C13.5 10.2426 14.5074 11.25 15.75 11.25Z" fill="" />
        </svg>
      </button>

      <div ref={dropdown} onFocus={() => setDropdownOpen(true)} onBlur={() => setDropdownOpen(false)} className={`absolute right-0 top-full z-40 w-40 space-y-1 rounded-xs border border-stroke dark:border-strokedark bg-white p-1.5 shadow-default dark:bg-boxdark ${dropdownOpen === true ? 'block' : 'hidden'}`}>
        <button className="flex w-full items-center gap-2 rounded-xs px-4 py-1.5 text-left text-sm hover:bg-[#EFF4FB] dark:hover:bg-[#313D4A]">
          <svg className="fill-current" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
            <g clipPath="url(#clip0_62_9787)">
              <path
                d="M15.55 2.97499C15.55 2.77499 15.475 2.57499 15.325 2.42499C15.025 2.12499 14.725 1.82499 14.45 1.52499C14.175 1.24999 13.925 0.974987 13.65 0.724987C13.525 0.574987 13.375 0.474986 13.175 0.449986C12.95 0.424986 12.75 0.474986 12.575 0.624987L10.875 2.32499H2.02495C1.17495 2.32499 0.449951 3.02499 0.449951 3.89999V14C0.449951 14.85 1.14995 15.575 2.02495 15.575H12.15C13 15.575 13.725 14.875 13.725 14V5.12499L15.35 3.49999C15.475 3.34999 15.55 3.17499 15.55 2.97499ZM8.19995 8.99999C8.17495 9.02499 8.17495 9.02499 8.14995 9.02499L6.34995 9.62499L6.94995 7.82499C6.94995 7.79999 6.97495 7.79999 6.97495 7.77499L11.475 3.27499L12.725 4.49999L8.19995 8.99999ZM12.575 14C12.575 14.25 12.375 14.45 12.125 14.45H2.02495C1.77495 14.45 1.57495 14.25 1.57495 14V3.87499C1.57495 3.62499 1.77495 3.42499 2.02495 3.42499H9.72495L6.17495 6.99999C6.04995 7.12499 5.92495 7.29999 5.87495 7.49999L4.94995 10.3C4.87495 10.5 4.92495 10.675 5.02495 10.85C5.09995 10.95 5.24995 11.1 5.52495 11.1H5.62495L8.49995 10.15C8.67495 10.1 8.84995 9.97499 8.97495 9.84999L12.575 6.24999V14ZM13.5 3.72499L12.25 2.49999L13.025 1.72499C13.225 1.92499 14.05 2.74999 14.25 2.97499L13.5 3.72499Z"
                fill=""
              />
            </g>

            <defs>
              <clipPath id="clip0_62_9787">
                <rect width="16" height="16" fill="white" />
              </clipPath>
            </defs>
          </svg>
          Edit
        </button>

        <button className="flex w-full items-center gap-2 rounded-xs px-4 py-1.5 text-left text-sm hover:bg-[#EFF4FB] dark:hover:bg-[#313D4A]">
          <svg className="fill-current" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M12.225 2.20005H10.3V1.77505C10.3 1.02505 9.70005 0.425049 8.95005 0.425049H7.02505C6.27505 0.425049 5.67505 1.02505 5.67505 1.77505V2.20005H3.75005C3.02505 2.20005 2.42505 2.80005 2.42505 3.52505V4.27505C2.42505 4.82505 2.75005 5.27505 3.22505 5.47505L3.62505 13.75C3.67505 14.775 4.52505 15.575 5.55005 15.575H10.4C11.425 15.575 12.275 14.775 12.325 13.75L12.75 5.45005C13.225 5.25005 13.55 4.77505 13.55 4.25005V3.50005C13.55 2.80005 12.95 2.20005 12.225 2.20005ZM6.82505 1.77505C6.82505 1.65005 6.92505 1.55005 7.05005 1.55005H8.97505C9.10005 1.55005 9.20005 1.65005 9.20005 1.77505V2.20005H6.85005V1.77505H6.82505ZM3.57505 3.52505C3.57505 3.42505 3.65005 3.32505 3.77505 3.32505H12.225C12.325 3.32505 12.425 3.40005 12.425 3.52505V4.27505C12.425 4.37505 12.35 4.47505 12.225 4.47505H3.77505C3.67505 4.47505 3.57505 4.40005 3.57505 4.27505V3.52505V3.52505ZM10.425 14.45H5.57505C5.15005 14.45 4.80005 14.125 4.77505 13.675L4.40005 5.57505H11.625L11.25 13.675C11.2 14.1 10.85 14.45 10.425 14.45Z"
              fill=""
            />
            <path d="M8.00005 8.1001C7.70005 8.1001 7.42505 8.3501 7.42505 8.6751V11.8501C7.42505 12.1501 7.67505 12.4251 8.00005 12.4251C8.30005 12.4251 8.57505 12.1751 8.57505 11.8501V8.6751C8.57505 8.3501 8.30005 8.1001 8.00005 8.1001Z" fill="" />
            <path d="M9.99994 8.60004C9.67494 8.57504 9.42494 8.80004 9.39994 9.12504L9.24994 11.325C9.22494 11.625 9.44994 11.9 9.77494 11.925C9.79994 11.925 9.79994 11.925 9.82494 11.925C10.1249 11.925 10.3749 11.7 10.3749 11.4L10.5249 9.20004C10.5249 8.87504 10.2999 8.62504 9.99994 8.60004Z" fill="" />
            <path d="M5.97497 8.60004C5.67497 8.62504 5.42497 8.90004 5.44997 9.20004L5.62497 11.4C5.64997 11.7 5.89997 11.925 6.17497 11.925C6.19997 11.925 6.19997 11.925 6.22497 11.925C6.52497 11.9 6.77497 11.625 6.74997 11.325L6.57497 9.12504C6.57497 8.80004 6.29997 8.57504 5.97497 8.60004Z" fill="" />
          </svg>
          Delete
        </button>
      </div>
    </div>
  );
};

export default DropdownDefault;


================================================
FILE: src/components/Empty/index.tsx
================================================
import Empty from './empty.svg';

export default () => {
  return (
    <div className="flex flex-col justify-center items-center h-full text-base">
      <img src={Empty} alt="" className="w-2/12" /> 空空如也
    </div>
  );
};


================================================
FILE: src/components/FileUpload/index.tsx
================================================
import { useRef, useState, useCallback } from 'react';
import { InboxOutlined } from '@ant-design/icons';
import { message, Modal, Radio, Select, Spin } from 'antd';
import { useUserStore } from '@/stores';
import { DirList } from '@/types/app/file';
import { baseURL } from '@/utils/request';
import Compressor from 'compressorjs';

interface Props {
  multiple?: boolean;
  dir: DirList;
  open: boolean;
  onSuccess: (urls: string[]) => void;
  onCancel: () => void;
}

export default ({ multiple, dir, open, onCancel, onSuccess }: Props) => {
  const store = useUserStore();
  const dragCounterRef = useRef(0);

  const fileInputRef = useRef<HTMLInputElement>(null);
  const [quality, setQuality] = useState(1000);
  const [isCompressionUpload, setIsCompressionUpload] = useState(false);
  const [isLoading, setIsLoading] = useState(false);
  const [isDragging, setIsDragging] = useState(false);

  const onUploadFile = async (files: File[]) => {
    try {
      setIsLoading(true);

      // 上传前先压缩文件大小
      const compressedFiles = await Promise.all(
        files.map((file) => {
          return new Promise<File>((resolve, reject) => {
            new Compressor(file, {
              quality,
              success: (blob) => {
                // 将 Blob 转换为 File
                const f = new File([blob], file.name, {
                  type: file.type,
                  lastModified: Date.now(),
                });
                resolve(f);
              },
              error: (err) => reject(err),
            });
          });
        }),
      );

      // 处理成后端需要的格式
      const formData = new FormData();
      formData.append('dir', dir);
      for (let i = 0; i < compressedFiles.length; i++) {
        formData.append('files', compressedFiles[i]);
      }

      // 发起网络请求
      const res = await fetch(`${baseURL}/file`, {
        method: 'POST',
        body: formData,
        headers: {
          Authorization: `Bearer ${store.token}`,
        },
      });

      const { code, message: msg, data } = await res.json();
      if (code !== 200) return message.error('文件上传失败:' + msg);

      try {
        // 把数据写入到剪贴板
        await navigator.clipboard.writeText(data.join('\n'));
      } catch (error) {
        console.error(error);
        message.error('复制到剪贴板失败,请手动复制');
        onSuccess(data);
        setIsLoading(false);
        return;
      }

      message.success(`🎉 文件上传成功,URL链接已复制到剪贴板`);
      onSuccess(data);
      onCloseModel();
    } catch (error) {
      message.error('文件上传失败:' + (error as Error).message);
      onCloseModel();
    }
  };

  const onCloseModel = () => {
    setIsCompressionUpload(false);
    setQuality(1000);
    setIsLoading(false);
    onCancel();
  };

  // 文件上传
  const handleFileInput = (e: React.ChangeEvent<HTMLInputElement>) => {
    if (e.target.files) {
      onUploadFile([...e.target.files]);
    }
  };

  // 拖拽上传
  const handleDragOver = useCallback((e: React.DragEvent<HTMLDivElement>) => {
    e.preventDefault();
    e.stopPropagation();
  }, []);

  // 拖拽进入
  const handleDragEnter = useCallback((e: React.DragEvent<HTMLDivElement>) => {
    e.preventDefault();
    e.stopPropagation();
    dragCounterRef.current++;
    if (dragCounterRef.current === 1) {
      setIsDragging(true);
    }
  }, []);

  // 拖拽离开
  const handleDragLeave = useCallback((e: React.DragEvent<HTMLDivElement>) => {
    e.preventDefault();
    e.stopPropagation();
    dragCounterRef.current--;
    if (dragCounterRef.current === 0) {
      setIsDragging(false);
    }
  }, []);

  // 拖拽放下
  const handleDrop = useCallback(
    (e: React.DragEvent<HTMLDivElement>) => {
      e.preventDefault();
      e.stopPropagation();
      dragCounterRef.current = 0;
      setIsDragging(false);

      const files = Array.from(e.dataTransfer.files);
      if (files.length > 0) {
        onUploadFile(files);
      }
    },
    [onUploadFile],
  );

  return (
    <>
      <Modal title="文件上传" open={open} onCancel={onCloseModel} footer={null}>
        <Spin spinning={isLoading}>
          <div className="my-4">
            <Radio.Group
              defaultValue={0}
              value={isCompressionUpload ? 1 : 0}
              onChange={(e) => setIsCompressionUpload(e.target.value ? true : false)}
            >
              <Radio value={0}>无损上传</Radio>
              <Radio value={1}>压缩上传</Radio>
            </Radio.Group>

            {isCompressionUpload && (
              <Select
                onChange={setQuality}
                options={[
                  { value: 1, label: '轻量压缩(推荐)' },
                  { value: 'NaN', label: '自适应压缩' },
                  { value: 0.9, label: '0.9' },
                  { value: 0.8, label: '0.8' },
                  { value: 0.7, label: '0.7' },
                  { value: 0.6, label: '0.6' },
                  { value: 0.5, label: '0.5' },
                  { value: 0.4, label: '0.4' },
                  { value: 0.3, label: '0.3' },
                  { value: 0.2, label: '0.2' },
                  { value: 0.1, label: '0.1' },
                ]}
                defaultValue={1}
                placeholder="请选择图片压缩质量"
                className="min-w-44"
              />
            )}
          </div>

          <div
            onClick={() => fileInputRef?.current?.click()}
            onDragOver={handleDragOver}
            onDragEnter={handleDragEnter}
            onDragLeave={handleDragLeave}
            onDrop={handleDrop}
            className={`w-full h-40 p-4 border border-dashed rounded-lg transition-all duration-300 ${
              isDragging ? 'border-primary bg-primary/5' : 'border-[#D7D7D7] hover:border-primary bg-[#FAFAFA]'
            } space-y-2 cursor-pointer`}
          >
            <div className="flex justify-center">
              <InboxOutlined className="text-5xl text-primary" />
            </div>

            <p className="text-base text-center">{isDragging ? '释放文件以上传' : '点击或拖动文件到此区域进行上传'}</p>
            <p className="text-sm text-[#999] text-center">支持单个或多个上传</p>
          </div>

          <input multiple={multiple} type="file" onChange={handleFileInput} ref={fileInputRef} className="hidden" />
        </Spin>
      </Modal>
    </>
  );
};


================================================
FILE: src/components/HasPermission/index.tsx
================================================
import { useHasPermission } from '@/utils/permission';

interface Props {
    code: string;
    children: React.ReactNode;
}

export default ({ code, children }: Props) => {
    const hasPermission = useHasPermission(code);
    return hasPermission ? children : null;
}

================================================
FILE: src/components/Header/DarkModeSwitcher.tsx
================================================
import { useConfigStore } from '../../stores';

const DarkModeSwitcher = () => {
  const colorMode = useConfigStore((state) => state.colorMode);
  const setColorMode = useConfigStore((state) => state.setColorMode);

  return (
    <li className="ml-4">
      <label className={`relative m-0 block h-7 w-14 rounded-full ${colorMode === 'dark' ? 'bg-primary' : 'bg-stroke'}`}>
        <input
          type="checkbox"
          onChange={() => {
            if (typeof setColorMode === 'function') {
              setColorMode(colorMode === 'light' ? 'dark' : 'light');
            }
          }}
          className="dur absolute top-0 z-50 m-0 h-full w-full cursor-pointer opacity-0"
        />
        <span className={`absolute top-1/2 left-[3px] flex h-6 w-6 -translate-y-1/2 translate-x-0 items-center justify-center rounded-full bg-white shadow-switcher duration-75 ease-linear ${colorMode === 'dark' && 'right-[3px]! translate-x-full!'}`}>
          <span className="dark:hidden">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M7.99992 12.6666C10.5772 12.6666 12.6666 10.5772 12.6666 7.99992C12.6666 5.42259 10.5772 3.33325 7.99992 3.33325C5.42259 3.33325 3.33325 5.42259 3.33325 7.99992C3.33325 10.5772 5.42259 12.6666 7.99992 12.6666Z" fill="#969AA1" />
              <path
                d="M8.00008 15.3067C7.63341 15.3067 7.33342 15.0334 7.33342 14.6667V14.6134C7.33342 14.2467 7.63341 13.9467 8.00008 13.9467C8.36675 13.9467 8.66675 14.2467 8.66675 14.6134C8.66675 14.9801 8.36675 15.3067 8.00008 15.3067ZM12.7601 13.4267C12.5867 13.4267 12.4201 13.3601 12.2867 13.2334L12.2001 13.1467C11.9401 12.8867 11.9401 12.4667 12.2001 12.2067C12.4601 11.9467 12.8801 11.9467 13.1401 12.2067L13.2267 12.2934C13.4867 12.5534 13.4867 12.9734 13.2267 13.2334C13.1001 13.3601 12.9334 13.4267 12.7601 13.4267ZM3.24008 13.4267C3.06675 13.4267 2.90008 13.3601 2.76675 13.2334C2.50675 12.9734 2.50675 12.5534 2.76675 12.2934L2.85342 12.2067C3.11342 11.9467 3.53341 11.9467 3.79341 12.2067C4.05341 12.4667 4.05341 12.8867 3.79341 13.1467L3.70675 13.2334C3.58008 13.3601 3.40675 13.4267 3.24008 13.4267ZM14.6667 8.66675H14.6134C14.2467 8.66675 13.9467 8.36675 13.9467 8.00008C13.9467 7.63341 14.2467 7.33342 14.6134 7.33342C14.9801 7.33342 15.3067 7.63341 15.3067 8.00008C15.3067 8.36675 15.0334 8.66675 14.6667 8.66675ZM1.38675 8.66675H1.33341C0.966748 8.66675 0.666748 8.36675 0.666748 8.00008C0.666748 7.63341 0.966748 7.33342 1.33341 7.33342C1.70008 7.33342 2.02675 7.63341 2.02675 8.00008C2.02675 8.36675 1.75341 8.66675 1.38675 8.66675ZM12.6734 3.99341C12.5001 3.99341 12.3334 3.92675 12.2001 3.80008C11.9401 3.54008 11.9401 3.12008 12.2001 2.86008L12.2867 2.77341C12.5467 2.51341 12.9667 2.51341 13.2267 2.77341C13.4867 3.03341 13.4867 3.45341 13.2267 3.71341L13.1401 3.80008C13.0134 3.92675 12.8467 3.99341 12.6734 3.99341ZM3.32675 3.99341C3.15341 3.99341 2.98675 3.92675 2.85342 3.80008L2.76675 3.70675C2.50675 3.44675 2.50675 3.02675 2.76675 2.76675C3.02675 2.50675 3.44675 2.50675 3.70675 2.76675L3.79341 2.85342C4.05341 3.11342 4.05341 3.53341 3.79341 3.79341C3.66675 3.92675 3.49341 3.99341 3.32675 3.99341ZM8.00008 2.02675C7.63341 2.02675 7.33342 1.75341 7.33342 1.38675V1.33341C7.33342 0.966748 7.63341 0.666748 8.00008 0.666748C8.36675 0.666748 8.66675 0.966748 8.66675 1.33341C8.66675 1.70008 8.36675 2.02675 8.00008 2.02675Z"
                fill="#969AA1"
              />
            </svg>
          </span>
          <span className="hidden dark:inline-block">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M14.3533 10.62C14.2466 10.44 13.9466 10.16 13.1999 10.2933C12.7866 10.3667 12.3666 10.4 11.9466 10.38C10.3933 10.3133 8.98659 9.6 8.00659 8.5C7.13993 7.53333 6.60659 6.27333 6.59993 4.91333C6.59993 4.15333 6.74659 3.42 7.04659 2.72666C7.33993 2.05333 7.13326 1.7 6.98659 1.55333C6.83326 1.4 6.47326 1.18666 5.76659 1.48C3.03993 2.62666 1.35326 5.36 1.55326 8.28666C1.75326 11.04 3.68659 13.3933 6.24659 14.28C6.85993 14.4933 7.50659 14.62 8.17326 14.6467C8.27993 14.6533 8.38659 14.66 8.49326 14.66C10.7266 14.66 12.8199 13.6067 14.1399 11.8133C14.5866 11.1933 14.4666 10.8 14.3533 10.62Z" fill="#969AA1" />
            </svg>
          </span>
        </span>
      </label>
    </li>
  );
};

export default DarkModeSwitcher;


================================================
FILE: src/components/Header/DropdownUser.tsx
================================================
import { Link } from 'react-router-dom';
import { Dropdown, MenuProps } from 'antd';

import { useUserStore } from '@/stores';

const DropdownUser = () => {
  const store = useUserStore();

  // 菜单项配置
  const items: MenuProps['items'] = [
    {
      key: 'profile',
      label: (
        <Link to="/setup?tab=my" className="flex items-center gap-2">
          <svg className="fill-current" width="16" height="16" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M11 9.62499C8.42188 9.62499 6.35938 7.59687 6.35938 5.12187C6.35938 2.64687 8.42188 0.618744 11 0.618744C13.5781 0.618744 15.6406 2.64687 15.6406 5.12187C15.6406 7.59687 13.5781 9.62499 11 9.62499ZM11 2.16562C9.28125 2.16562 7.90625 3.50624 7.90625 5.12187C7.90625 6.73749 9.28125 8.07812 11 8.07812C12.7188 8.07812 14.0938 6.73749 14.0938 5.12187C14.0938 3.50624 12.7188 2.16562 11 2.16562Z" fill="" />
            <path d="M17.7719 21.4156H4.2281C3.5406 21.4156 2.9906 20.8656 2.9906 20.1781V17.0844C2.9906 13.7156 5.7406 10.9656 9.10935 10.9656H12.925C16.2937 10.9656 19.0437 13.7156 19.0437 17.0844V20.1781C19.0094 20.8312 18.4594 21.4156 17.7719 21.4156ZM4.53748 19.8687H17.4969V17.0844C17.4969 14.575 15.4344 12.5125 12.925 12.5125H9.07498C6.5656 12.5125 4.5031 14.575 4.5031 17.0844V19.8687H4.53748Z" fill="" />
          </svg>
          我的资料
        </Link>
      ),
    },
    {
      key: 'setup',
      label: (
        <Link to="/setup?tab=web" className="flex items-center gap-2">
          <svg className="fill-current" width="16" height="16" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M20.8656 8.86874C20.5219 8.49062 20.0406 8.28437 19.525 8.28437H19.4219C19.25 8.28437 19.1125 8.18124 19.0781 8.04374C19.0437 7.90624 18.975 7.80312 18.9406 7.66562C18.8719 7.52812 18.9406 7.39062 19.0437 7.28749L19.1125 7.21874C19.4906 6.87499 19.6969 6.39374 19.6969 5.87812C19.6969 5.36249 19.525 4.88124 19.1469 4.50312L17.8062 3.12812C17.0844 2.37187 15.8469 2.33749 15.0906 3.09374L14.9875 3.16249C14.8844 3.26562 14.7125 3.29999 14.5406 3.23124C14.4031 3.16249 14.2656 3.09374 14.0937 3.05937C13.9219 2.99062 13.8187 2.85312 13.8187 2.71562V2.54374C13.8187 1.47812 12.9594 0.618744 11.8937 0.618744H9.96875C9.45312 0.618744 8.97187 0.824994 8.62812 1.16874C8.25 1.54687 8.07812 2.02812 8.07812 2.50937V2.64687C8.07812 2.78437 7.975 2.92187 7.8375 2.99062C7.76875 3.02499 7.73437 3.02499 7.66562 3.05937C7.52812 3.12812 7.35625 3.09374 7.25312 2.99062L7.18437 2.88749C6.84062 2.50937 6.35937 2.30312 5.84375 2.30312C5.32812 2.30312 4.84687 2.47499 4.46875 2.85312L3.09375 4.19374C2.3375 4.91562 2.30312 6.15312 3.05937 6.90937L3.12812 7.01249C3.23125 7.11562 3.26562 7.28749 3.19687 7.39062C3.12812 7.52812 3.09375 7.63124 3.025 7.76874C2.95625 7.90624 2.85312 7.97499 2.68125 7.97499H2.57812C2.0625 7.97499 1.58125 8.14687 1.20312 8.52499C0.824996 8.86874 0.618746 9.34999 0.618746 9.86562L0.584371 11.7906C0.549996 12.8562 1.40937 13.7156 2.475 13.75H2.57812C2.75 13.75 2.8875 13.8531 2.92187 13.9906C2.99062 14.0937 3.05937 14.1969 3.09375 14.3344C3.12812 14.4719 3.09375 14.6094 2.99062 14.7125L2.92187 14.7812C2.54375 15.125 2.3375 15.6062 2.3375 16.1219C2.3375 16.6375 2.50937 17.1187 2.8875 17.4969L4.22812 18.8719C4.95 19.6281 6.1875 19.6625 6.94375 18.9062L7.04687 18.8375C7.15 18.7344 7.32187 18.7 7.49375 18.7687C7.63125 18.8375 7.76875 18.9062 7.94062 18.9406C8.1125 19.0094 8.21562 19.1469 8.21562 19.2844V19.4219C8.21562 20.4875 9.075 21.3469 10.1406 21.3469H12.0656C13.1312 21.3469 13.9906 20.4875 13.9906 19.4219V19.2844C13.9906 19.1469 14.0937 19.0094 14.2312 18.9406C14.3 18.9062 14.3344 18.9062 14.4031 18.8719C14.575 18.8031 14.7125 18.8375 14.8156 18.9406L14.8844 19.0437C15.2281 19.4219 15.7094 19.6281 16.225 19.6281C16.7406 19.6281 17.2219 19.4562 17.6 19.0781L18.975 17.7375C19.7312 17.0156 19.7656 15.7781 19.0094 15.0219L18.9406 14.9187C18.8375 14.8156 18.8031 14.6437 18.8719 14.5406C18.9406 14.4031 18.975 14.3 19.0437 14.1625C19.1125 14.025 19.25 13.9562 19.3875 13.9562H19.4906H19.525C20.5562 13.9562 21.4156 13.1312 21.45 12.0656L21.4844 10.1406C21.4156 9.72812 21.2094 9.21249 20.8656 8.86874ZM19.8344 12.1C19.8344 12.3062 19.6625 12.4781 19.4562 12.4781H19.3531H19.3187C18.5281 12.4781 17.8062 12.9594 17.5312 13.6469C17.4969 13.75 17.4281 13.8531 17.3937 13.9562C17.0844 14.6437 17.2219 15.5031 17.7719 16.0531L17.8406 16.1562C17.9781 16.2937 17.9781 16.5344 17.8406 16.6719L16.4656 18.0125C16.3625 18.1156 16.2594 18.1156 16.1906 18.1156C16.1219 18.1156 16.0187 18.1156 15.9156 18.0125L15.8469 17.9094C15.2969 17.325 14.4719 17.1531 13.7156 17.4969L13.5781 17.5656C12.8219 17.875 12.3406 18.5625 12.3406 19.3531V19.4906C12.3406 19.6969 12.1687 19.8687 11.9625 19.8687H10.0375C9.83125 19.8687 9.65937 19.6969 9.65937 19.4906V19.3531C9.65937 18.5625 9.17812 17.8406 8.42187 17.5656C8.31875 17.5312 8.18125 17.4625 8.07812 17.4281C7.80312 17.2906 7.52812 17.2562 7.25312 17.2562C6.77187 17.2562 6.29062 17.4281 5.9125 17.8062L5.84375 17.8406C5.70625 17.9781 5.46562 17.9781 5.32812 17.8406L3.9875 16.4656C3.88437 16.3625 3.88437 16.2594 3.88437 16.1906C3.88437 16.1219 3.88437 16.0187 3.9875 15.9156L4.05625 15.8469C4.64062 15.2969 4.8125 14.4375 4.50312 13.75C4.46875 13.6469 4.43437 13.5437 4.36562 13.4406C4.09062 12.7187 3.40312 12.2031 2.6125 12.2031H2.50937C2.30312 12.2031 2.13125 12.0312 2.13125 11.825L2.16562 9.89999C2.16562 9.76249 2.23437 9.69374 2.26875 9.62499C2.30312 9.59062 2.40625 9.52187 2.54375 9.52187H2.64687C3.4375 9.55624 4.15937 9.07499 4.46875 8.35312C4.50312 8.24999 4.57187 8.14687 4.60625 8.04374C4.91562 7.35624 4.77812 6.49687 4.22812 5.94687L4.15937 5.84374C4.02187 5.70624 4.02187 5.46562 4.15937 5.32812L5.53437 3.98749C5.6375 3.88437 5.74062 3.88437 5.80937 3.88437C5.87812 3.88437 5.98125 3.88437 6.08437 3.98749L6.15312 4.09062C6.70312 4.67499 7.52812 4.84687 8.28437 4.53749L8.42187 4.46874C9.17812 4.15937 9.65937 3.47187 9.65937 2.68124V2.54374C9.65937 2.40624 9.72812 2.33749 9.7625 2.26874C9.79687 2.19999 9.9 2.16562 10.0375 2.16562H11.9625C12.1687 2.16562 12.3406 2.33749 12.3406 2.54374V2.68124C12.3406 3.47187 12.8219 4.19374 13.5781 4.46874C13.6812 4.50312 13.8187 4.57187 13.9219 4.60624C14.6437 4.94999 15.5031 4.81249 16.0875 4.26249L16.1906 4.19374C16.3281 4.05624 16.5687 4.05624 16.7062 4.19374L18.0469 5.56874C18.15 5.67187 18.15 5.77499 18.15 5.84374C18.15 5.91249 18.1156 6.01562 18.0469 6.11874L17.9781 6.18749C17.3594 6.70312 17.1875 7.56249 17.4625 8.24999C17.4969 8.35312 17.5312 8.45624 17.6 8.55937C17.875 9.28124 18.5625 9.79687 19.3531 9.79687H19.4562C19.5937 9.79687 19.6625 9.86562 19.7312 9.89999C19.8 9.93437 19.8344 10.0375 19.8344 10.175V12.1Z"
              fill=""
            />
            <path d="M11 6.32498C8.42189 6.32498 6.32501 8.42186 6.32501 11C6.32501 13.5781 8.42189 15.675 11 15.675C13.5781 15.675 15.675 13.5781 15.675 11C15.675 8.42186 13.5781 6.32498 11 6.32498ZM11 14.1281C9.28126 14.1281 7.87189 12.7187 7.87189 11C7.87189 9.28123 9.28126 7.87186 11 7.87186C12.7188 7.87186 14.1281 9.28123 14.1281 11C14.1281 12.7187 12.7188 14.1281 11 14.1281Z" fill="" />
          </svg>
          网站配置
        </Link>
      ),
    },
    {
      type: 'divider',
    },
    {
      key: 'logout',
      label: (
        <button className="flex items-center gap-2 w-full cursor-pointer" onClick={store.quitLogin}>
          <svg className="fill-current" width="16" height="16" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M15.5375 0.618744H11.6531C10.7594 0.618744 10.0031 1.37499 10.0031 2.26874V4.64062C10.0031 5.05312 10.3469 5.39687 10.7594 5.39687C11.1719 5.39687 11.55 5.05312 11.55 4.64062V2.23437C11.55 2.16562 11.5844 2.13124 11.6531 2.13124H15.5375C16.3625 2.13124 17.0156 2.78437 17.0156 3.60937V18.3562C17.0156 19.1812 16.3625 19.8344 15.5375 19.8344H11.6531C11.5844 19.8344 11.55 19.8 11.55 19.7312V17.3594C11.55 16.9469 11.2062 16.6031 10.7594 16.6031C10.3125 16.6031 10.0031 16.9469 10.0031 17.3594V19.7312C10.0031 20.625 10.7594 21.3812 11.6531 21.3812H15.5375C17.2219 21.3812 18.5625 20.0062 18.5625 18.3562V3.64374C18.5625 1.95937 17.1875 0.618744 15.5375 0.618744Z" fill="" />
            <path d="M6.05001 11.7563H12.2031C12.6156 11.7563 12.9594 11.4125 12.9594 11C12.9594 10.5875 12.6156 10.2438 12.2031 10.2438H6.08439L8.21564 8.07813C8.52501 7.76875 8.52501 7.2875 8.21564 6.97812C7.90626 6.66875 7.42501 6.66875 7.11564 6.97812L3.67814 10.4844C3.36876 10.7938 3.36876 11.275 3.67814 11.5844L7.11564 15.0906C7.25314 15.2281 7.45939 15.3312 7.66564 15.3312C7.87189 15.3312 8.04376 15.2625 8.21564 15.125C8.52501 14.8156 8.52501 14.3344 8.21564 14.025L6.05001 11.7563Z" fill="" />
          </svg>
          退出登录
        </button>
      ),
    },
  ];

  return (
    <Dropdown menu={{ items }} placement="bottomRight" trigger={['click']}>
      <div className="flex items-center gap-2 cursor-pointer">
        <span className="hidden text-right lg:block">
          <span className="block text-sm font-medium text-black dark:text-white">{store.user?.name}</span>
          <span className="block text-xs">超级管理员</span>
        </span>

        <span className="overflow-hidden h-8 w-8 rounded-full border border-stroke">
          <img src={store.user?.avatar} alt="User" />
        </span>

        <svg className="hidden fill-current sm:block" width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path fillRule="evenodd" clipRule="evenodd" d="M0.410765 0.910734C0.736202 0.585297 1.26384 0.585297 1.58928 0.910734L6.00002 5.32148L10.4108 0.910734C10.7362 0.585297 11.2638 0.585297 11.5893 0.910734C11.9147 1.23617 11.9147 1.76381 11.5893 2.08924L6.58928 7.08924C6.26384 7.41468 5.7362 7.41468 5.41077 7.08924L0.410765 2.08924C0.0853277 1.76381 0.0853277 1.23617 0.410765 0.910734Z" fill="" />
        </svg>
      </div>
    </Dropdown>
  );
};

export default DropdownUser;


================================================
FILE: src/components/Header/index.tsx
================================================
import { Link } from 'react-router-dom';
import { useEffect, useState } from 'react';
import { Skeleton } from 'antd';
import { useUserStore } from '@/stores';
import DropdownUser from './DropdownUser';
import DarkModeSwitcher from './DarkModeSwitcher';
import logo from '/logo.png';
import PageTab from '../PageTab';

const Header = (props: { sidebarOpen: string | boolean | undefined; setSidebarOpen: (arg0: boolean) => void }) => {
  const user = useUserStore((state) => state.user);
  const [initialLoading, setInitialLoading] = useState<boolean>(true);

  // 等待用户信息加载完成后,取消初始加载状态
  useEffect(() => {
    if (user?.name) {
      setInitialLoading(false);
    } else {
      // 如果用户信息未加载,等待最多 500ms 后显示内容
      const timer = setTimeout(() => {
        setInitialLoading(false);
      }, 500);
      return () => clearTimeout(timer);
    }
  }, [user]);

  // 初始加载时显示骨架屏
  if (initialLoading) {
    return (
      <header className="sticky top-0 z-99 flex w-full bg-light-gradient dark:bg-dark-gradient">
        <div className="flex grow items-center justify-between px-4 py-3 shadow-2 md:px-6 2xl:px-11 overflow-scroll">
          <div className="flex items-center gap-4 flex-1 min-w-0">
            {/* 移动端菜单按钮和 Logo 骨架屏 */}
            <div className="flex items-center gap-4 lg:hidden shrink-0">
              <Skeleton.Button active size="default" style={{ width: 32, height: 32 }} />
              <Skeleton.Avatar active size={32} shape="square" />
            </div>

            {/* PageTab 骨架屏 */}
            <div className="flex-1 min-w-0 w-2/6 overflow-x-auto">
              <div className="flex items-center gap-2">
                {[1, 2, 3].map((item) => (
                  <Skeleton.Button key={item} active size="default" style={{ width: 100, height: 32 }} />
                ))}
              </div>
            </div>
          </div>

          {/* 右侧操作栏骨架屏 */}
          <div className="flex items-center gap-3 2xsm:gap-7 shrink-0 ml-4">
            <ul className="flex items-center gap-2 2xsm:gap-4 sm:mr-4">
              <Skeleton.Button active size="default" style={{ width: 32, height: 30 }} />
            </ul>

            <div className="sm:block hidden">
              <div className="flex items-center gap-2">
                <div className="hidden text-right lg:block space-x-4">
                  <Skeleton.Input active size="small" style={{ width: 80, height: 30, marginBottom: 4 }} />
                  <Skeleton.Input active size="small" style={{ width: 60, height: 30 }} />
                </div>

                <Skeleton.Avatar active size={32} shape="circle" className="ml-4" />
              </div>
            </div>
          </div>
        </div>
      </header>
    );
  }

  return (
    <header className="sticky top-0 z-99 flex w-full bg-light-gradient dark:bg-dark-gradient dark:backdrop-blur-xl">
      <div className="flex grow items-center justify-between px-4 py-3 shadow-2 md:px-6 2xl:px-11 overflow-scroll">
        <div className="flex items-center gap-4 flex-1 min-w-0">
          <div className="flex items-center gap-4 lg:hidden shrink-0">
            <button
              aria-controls="sidebar"
              onClick={(e) => {
                e.stopPropagation();
                props.setSidebarOpen(!props.sidebarOpen);
              }}
              className="z-99999 block rounded-xs border border-stroke bg-white p-1 shadow-xs dark:border-strokedark dark:bg-boxdark lg:hidden"
            >
              <span className="relative block h-6 w-6 cursor-pointer">
                <span className="du-block absolute right-0 h-full w-full">
                  <span className={`relative left-0 top-0 my-1 block h-0.5 w-0 rounded-xs bg-black delay-[0] duration-200 ease-in-out dark:bg-white ${!props.sidebarOpen && 'w-full! delay-300'}`}></span>
                  <span className={`relative left-0 top-0 my-1 block h-0.5 w-0 rounded-xs bg-black delay-150 duration-200 ease-in-out dark:bg-white ${!props.sidebarOpen && 'delay-400 w-full!'}`}></span>
                  <span className={`relative left-0 top-0 my-1 block h-0.5 w-0 rounded-xs bg-black delay-200 duration-200 ease-in-out dark:bg-white ${!props.sidebarOpen && 'w-full! delay-500'}`}></span>
                </span>
                <span className="absolute right-0 h-full w-full rotate-45">
                  <span className={`absolute left-2.5 top-0 block h-full w-0.5 rounded-xs bg-black delay-300 duration-200 ease-in-out dark:bg-white ${!props.sidebarOpen && 'h-0! delay-[0]!'}`}></span>
                  <span className={`delay-400 absolute left-0 top-2.5 block h-0.5 w-full rounded-xs bg-black duration-200 ease-in-out dark:bg-white ${!props.sidebarOpen && 'h-0! delay-200!'}`}></span>
                </span>
              </span>
            </button>

            <Link className="block shrink-0 lg:hidden" to="/">
              <img src={logo} alt="logo" className="w-8" />
            </Link>
          </div>

          <div className="flex-1 min-w-0 w-2/6 overflow-x-auto">
            <PageTab />
          </div>
        </div>

        <div className="flex items-center gap-3 2xsm:gap-7 shrink-0 ml-4">
          <ul className="flex items-center gap-2 2xsm:gap-4 sm:mr-4">
            <DarkModeSwitcher />
          </ul>

          <div className="sm:block hidden">
            <DropdownUser />
          </div>
        </div>
      </div>
    </header>
  );
};

export default Header;


================================================
FILE: src/components/Loader/index.tsx
================================================
export default () => {
  return (
    <div className="flex h-screen items-center justify-center bg-white">
      <div className="h-16 w-16 animate-spin rounded-full border-4 border-solid border-primary border-t-transparent"></div>
    </div>
  );
};


================================================
FILE: src/components/Material/index.scss
================================================
.FilePage {
    .ant-image {
        display: block;
        width: 100%;

        .ant-image-img {
            width: 100%;
            height: auto;
            display: block;
        }
    }
}

// 自定义图片预览样式
.customAntdPreviewsItem {
    overflow: hidden;
    background: #fff;
    border-radius: 10px;

    .anticon {
        font-size: 20px;
        color: #5d5d5d;
        padding: 10px;

        &:hover {
            color: #60a5fa;
        }
    }
}

================================================
FILE: src/components/Material/index.tsx
================================================
import { useEffect, useState, useRef } from 'react';
import { Image, Spin, message, Button } from 'antd';
import { CheckOutlined } from '@ant-design/icons';
import { Modal } from 'antd';
import Masonry from 'react-masonry-css';
import { getFileListAPI, getDirListAPI } from '@/api/file';
import { File, FileDir } from '@/types/app/file';
import errorImg from '@/pages/file/image/error.png';
import fileSvg from '@/pages/file/image/file.svg';
import { PiKeyReturnFill } from 'react-icons/pi';
import FileUpload from '@/components/FileUpload';
import './index.scss';

interface Props {
  multiple?: boolean;
  maxCount?: number;
  open: boolean;
  onClose: () => void;
  onSelect?: (files: string[]) => void;
}

// Masonry 布局的响应式断点配置
const breakpointColumnsObj = {
  default: 4,
  1100: 3,
  700: 2,
  500: 1,
};

export default ({ multiple, open, onClose, onSelect, maxCount }: Props) => {
  // 加载状态
  const [loading, setLoading] = useState(false);
  // 当前页码
  const [page, setPage] = useState(1);
  // 是否还有更多数据
  const [hasMore, setHasMore] = useState(true);
  // 防止重复加载的引用
  const loadingRef = useRef(false);
  // 文件列表数据
  const [fileList, setFileList] = useState<File[]>([]);
  // 目录列表数据
  const [dirList, setDirList] = useState<FileDir[]>([]);
  // 当前选中的目录
  const [dirName, setDirName] = useState('');
  // 选中的文件列表
  const [selectedFiles, setSelectedFiles] = useState<File[]>([]);

  // 上传文件弹窗
  const [isUploadModalOpen, setIsUploadModalOpen] = useState(false);

  // 获取目录列表
  const getDirList = async () => {
    try {
      setLoading(true);
      const { data } = await getDirListAPI();

      const dirList = ['default', 'equipment', 'record', 'article', 'footprint', 'swiper', 'album'];
      dirList.forEach((dir) => {
        if (!data.some((item: FileDir) => item.name === dir)) {
          data.push({ name: dir, path: '' });
        }
      });

      setDirList(data);

      setLoading(false);
    } catch (error) {
      console.error(error);
      setLoading(false);
    }
  };

  useEffect(() => {
    getDirList();
  }, []);

  // 获取文件列表
  const getFileList = async (dir: string, isLoadMore = false) => {
    // 防止重复加载
    if (loadingRef.current) return;

    try {
      loadingRef.current = true;
      setLoading(true);

      // 请求文件列表数据,如果是加载更多则页码+1
      const { data } = await getFileListAPI(dir, { page: isLoadMore ? page + 1 : 1, size: 15 });

      // 根据是否是加载更多来决定是替换还是追加数据
      if (!isLoadMore) {
        setFileList(data.result);
        setPage(1);
      } else {
        setFileList((prev) => [...prev, ...data.result]);
        setPage((prev) => prev + 1);
      }

      // 判断是否还有更多数据
      setHasMore(data.result.length === 15);

      setLoading(false);
      loadingRef.current = false;
    } catch (error) {
      console.error(error);
      setLoading(false);
      loadingRef.current = false;
    }
  };

  // 处理滚动事件,实现下拉加载更多
  const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {
    const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
    // 当滚动到底部(距离底部小于50px)且还有更多数据时,触发加载更多
    if (scrollHeight - scrollTop - clientHeight < 50 && hasMore && !loading) {
      getFileList(dirName, true);
    }
  };

  // 取消选择
  const onCancelSelect = () => {
    reset();
    onClose();
  };

  // 打开目录
  const openDir = (dir: string) => {
    setDirName(dir);
    getFileList(dir);
  };

  // 处理选中的图片
  const onHandleSelectImage = (item: File) => {
    setSelectedFiles((prev) => {
      // 如果 maxCount 不为 1,则开启多选
      const isMultiple = multiple || (maxCount !== undefined && maxCount !== 1);

      if (isMultiple) {
        // 多选模式
        const isSelected = prev.some((file) => file.url === item.url);
        if (isSelected) {
          return prev.filter((file) => file.url !== item.url);
        } else {
          // 检查是否超过最大数量限制
          if (maxCount && prev.length >= maxCount) {
            message.warning(`最多只能选择 ${maxCount} 个文件`);
            return prev;
          }

          return [...prev, item];
        }
      } else {
        // 单选模式
        return [item];
      }
    });
  };

  // 处理文件上传成功做的事情
  const onUpdateSuccess = (urls: string[]) => {
    setIsUploadModalOpen(false);
    if (onSelect) onSelect(urls);
    reset();
    onClose();
  };

  // 确认选择
  const onHandleSelect = () => {
    const list = selectedFiles.map((item) => item.url);
    if (onSelect) onSelect(list);
    reset();
    onClose();
  };

  const reset = () => {
    setFileList([]);
    setSelectedFiles([]);
    setDirName('');
  };

  return (
    <Modal
      title="素材库"
      width={1200}
      open={open}
      onCancel={onCancelSelect}
      destroyOnHidden
      footer={
        dirName
          ? [
            <Button key="cancel" onClick={onCancelSelect}>
              取消
            </Button>,
            <Button key="confirm" type="primary" onClick={onHandleSelect} disabled={selectedFiles.length === 0}>
              选择 ({selectedFiles.length})
            </Button>,
          ]
          : null
      }
      zIndex={1100}
    >
      <div className="flex justify-between mb-4 px-4">
        {!fileList.length && !dirName ? <PiKeyReturnFill className="text-4xl text-[#E0DFDF] cursor-pointer" /> : <PiKeyReturnFill className="text-4xl text-primary cursor-pointer" onClick={reset} />}

        {dirName && (
          <Button type="primary" onClick={() => setIsUploadModalOpen(true)}>
            上传文件
          </Button>
        )}
      </div>

      <Spin spinning={loading}>
        <div className={`flex flex-wrap ${dirName ? 'justify-center!' : 'justify-start'} md:justify-normal overflow-y-auto max-h-[calc(100vh-300px)]`} onScroll={handleScroll}>
          {fileList.length || (!fileList.length && dirName) ? (
            <Masonry breakpointCols={breakpointColumnsObj} className="masonry-grid" columnClassName="masonry-grid_column">
              {fileList.map((item, index) => (
                <div key={index} className={`group relative overflow-hidden rounded-md cursor-pointer mb-4 border-2 border-stroke dark:border-transparent hover:border-primary! p-1 ${selectedFiles.some((file) => file.url === item.url) ? 'border-primary' : 'border-gray-100'}`} onClick={() => onHandleSelectImage(item)}>
                  <div className="relative">
                    <Image src={item.url} className="w-full rounded-md" loading="lazy" fallback={errorImg} preview={false} />

                    {selectedFiles.some((file) => file.url === item.url) && (
                      <div className="absolute top-2 right-2 bg-primary text-white rounded-full w-6 h-6 flex items-center justify-center">
                        <CheckOutlined />
                      </div>
                    )}
                  </div>
                </div>
              ))}
            </Masonry>
          ) : (
            dirList.map((item, index) => (
              <div key={index} className="group w-20 flex flex-col items-center cursor-pointer mx-4 my-2" onClick={() => openDir(item.name)}>
                <img src={fileSvg} alt="" />
                <p className="group-hover:text-primary transition-colors">{item.name}</p>
              </div>
            ))
          )}
        </div>
      </Spin>

      {/* 文件上传弹窗 */}
      <FileUpload multiple={multiple || (maxCount !== undefined && maxCount !== 1)} dir={dirName} open={isUploadModalOpen} onSuccess={onUpdateSuccess} onCancel={() => setIsUploadModalOpen(false)} />
    </Modal>
  );
};


================================================
FILE: src/components/NotFound/index.tsx
================================================
import { Button, Result } from 'antd'

export default () => {
    return (
        <>
            <Result
                status="404"
                title="404"
                subTitle="对不起,您访问的页面不存在。"
                extra={<Button type="primary" onClick={() => window.open('https://github.com/LiuYuYang01/ThriveX-Admin')}>借此机会帮忙点个star</Button>}
            />
        </>
    )
}

================================================
FILE: src/components/PageTab/index.tsx
================================================
import { useEffect, useRef } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { AiOutlineClose } from 'react-icons/ai';
import useTabsStore, { TabItem } from '@/stores/modules/tabs';
import { getRouteConfig } from '@/utils/route';

export default () => {
  const navigate = useNavigate();
  const location = useLocation();
  const { tabs, activeTab, addTab, removeTab, setActiveTab } = useTabsStore();
  const tabsContainerRef = useRef<HTMLDivElement>(null);

  // 监听路由变化,自动添加标签
  useEffect(() => {
    const pathname = location.pathname;
    const routeConfig = getRouteConfig(pathname);

    if (routeConfig) {
      addTab({
        path: pathname,
        title: routeConfig.title,
      });
      setActiveTab(pathname);
    }
  }, [location.pathname, addTab, setActiveTab]);

  // 检查滚动状态
  const checkScroll = () => {
    if (!tabsContainerRef.current) return;
  };

  useEffect(() => {
    checkScroll();
    const container = tabsContainerRef.current;
    if (container) {
      container.addEventListener('scroll', checkScroll);
      window.addEventListener('resize', checkScroll);
    }
    return () => {
      if (container) {
        container.removeEventListener('scroll', checkScroll);
      }
      window.removeEventListener('resize', checkScroll);
    };
  }, [tabs]);

  // 切换到指定标签
  const handleTabClick = (tab: TabItem) => {
    setActiveTab(tab.path);
    navigate(tab.path);
  };

  // 关闭标签
  const handleCloseTab = (e: React.MouseEvent, tab: TabItem) => {
    e.stopPropagation();

    if (tabs.length <= 1) {
      return; // 至少保留一个标签
    }

    const currentIndex = tabs.findIndex((t) => t.path === tab.path);
    const isActiveTab = activeTab === tab.path;

    // 如果关闭的是当前激活的标签,先导航到新的激活标签
    if (isActiveTab) {
      let newActivePath = '/';

      if (currentIndex > 0) {
        newActivePath = tabs[currentIndex - 1].path;
      } else if (tabs.length > 1) {
        newActivePath = tabs[1].path;
      }

      navigate(newActivePath);
    }

    // 移除标签
    removeTab(tab.path);
  };

  // 获取标签图标
  const getTabIcon = (path: string) => {
    const routeConfig = getRouteConfig(path);
    return routeConfig?.icon || null;
  };

  return (
    <div className="relative flex items-center">
      {/* 标签容器 */}
      <div ref={tabsContainerRef} className="flex-1 flex items-center" style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}>
        <div className="flex items-center h-10">
          {tabs.map((tab) => {
            const isActive = activeTab === tab.path;
            const icon = getTabIcon(tab.path);

            return (
              <div
                key={tab.path}
                onClick={() => handleTabClick(tab)}
                className={`
                  relative flex items-center gap-2 px-4 h-10 cursor-pointer
                  transition-all duration-200  hover:text-primary!
                  ${isActive ? 'text-primary' : 'text-gray-500 dark:text-gray-400'}
                `}
              >
                {icon && <span className="shrink-0">{icon}</span>}
                <span className="whitespace-nowrap text-sm">{tab.title}</span>
                {tabs.length > 1 && (
                  <button onClick={(e) => handleCloseTab(e, tab)} className="ml-1 shrink-0 w-4 h-4 flex items-center justify-center rounded-sm text-gray-300 hover:text-white hover:bg-red-500 dark:hover:bg-red-500 transition-colors" onMouseDown={(e) => e.stopPropagation()}>
                    <AiOutlineClose className="text-xs" />
                  </button>
                )}
              </div>
            );
          })}
        </div>
      </div>
    </div>
  );
};


================================================
FILE: src/components/PageTitle.tsx
================================================
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

interface Props {
  title: string;
}

export default ({ title }: Props) => {
  const location = useLocation();

  useEffect(() => {
    document.title = title;
  }, [location, title]);

  return null;
};


================================================
FILE: src/components/RandomAvatar/index.tsx
================================================
import { useMemo } from 'react';
import { createAvatar } from '@dicebear/core';

// 使用指定风格头像
import { pixelArt } from '@dicebear/collection';

export default ({ className }: { className?: string }) => {
    const avatar = useMemo(() => {
        // 生成一个随机种子
        const seed = Math.random().toString(36).substring(2, 15);

        // 创建头像
        return createAvatar(pixelArt, {
            seed: seed, // 使用随机种子
            size: 128,
            // 其他选项
        }).toDataUri();
    }, []);

    return <img src={avatar} alt="Avatar" className={className} />
}

================================================
FILE: src/components/RouteList/index.tsx
================================================
import { useEffect } from 'react';
import DefaultLayout from '@/layout/DefaultLayout';
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';

import Home from '@/pages/dashboard';
import Create from '@/pages/create';
import CreateRecord from '@/pages/create_record';
import Cate from '@/pages/cate';
import Article from '@/pages/article';
import Comment from '@/pages/comment';
import Wall from '@/pages/wall';
import Tag from '@/pages/tag';
import Web from '@/pages/web';
import Swiper from '@/pages/swiper';
import Footprint from '@/pages/footprint';
import Setup from '@/pages/setup';
import File from '@/pages/file';
import Iterative from '@/pages/iterative';
import Login from '@/pages/login';
import Work from '@/pages/work';
import Draft from '@/pages/draft';
import Decycle from '@/pages/decycle';
import Record from '@/pages/record';
import Storage from '@/pages/storage';
import Assistant from '@/pages/assistant';
import Config from '@/pages/config';

import PageTitle from '../PageTitle';

import { useUserStore } from '@/stores';
import { checkTokenAPI } from '@/api/user';
import NotFound from '../NotFound';

export default () => {
  const navigate = useNavigate();
  const store = useUserStore();
  const { pathname } = useLocation();
  const isLoginRoute = pathname === '/login' || pathname === '/auth';

  const routes = [
    { path: '/', title: '仪表盘', component: <Home /> },
    { path: '/create', title: '发挥灵感', component: <Create /> },
    { path: '/create_record', title: '闪念', component: <CreateRecord /> },
    { path: '/draft', title: '草稿箱', component: <Draft /> },
    { path: '/recycle', title: '回收站', component: <Decycle /> },
    { path: '/cate', title: '导航管理', component: <Cate /> },
    { path: '/article', title: '文章管理', component: <Article /> },
    { path: '/record', title: '说说管理', component: <Record /> },
    { path: '/tag', title: '标签管理', component: <Tag /> },
    { path: '/comment', title: '评论管理', component: <Comment /> },
    { path: '/wall', title: '评论管理', component: <Wall /> },
    { path: '/web', title: '网站管理', component: <Web /> },
    { path: '/swiper', title: '轮播图管理', component: <Swiper /> },
    { path: '/footprint', title: '足迹管理', component: <Footprint /> },
    { path: '/storage', title: '存储管理', component: <Storage /> },
    { path: '/setup', title: '项目配置', component: <Setup /> },
    { path: '/file', title: '文件管理', component: <File /> },
    { path: '/iter', title: '项目更新记录', component: <Iterative /> },
    { path: '/work', title: '工作台', component: <Work /> },
    { path: '/assistant', title: '助手管理', component: <Assistant /> },
    { path: '/config', title: '项目配置', component: <Config /> },
  ];

  useEffect(() => {
    // 如果没有token并且不在登录相关页面就跳转到登录页
    if (!store.token && !isLoginRoute) return navigate('/login');
  }, [store, isLoginRoute]);

  useEffect(() => {
    if (store.token) checkTokenAPI(store.token);
  }, [store, pathname]);

  if (isLoginRoute) {
    return (
      <Routes>
        <Route
          path="/login"
          element={
            <>
              <PageTitle title="ThriveX | 现代化博客管理系统" />
              <Login />
            </>
          }
        />
      </Routes>
    );
  }

  return (
    <DefaultLayout>
      <Routes>
        {routes.map(({ path, title, component }) => (
          <Route
            key={path}
            path={path}
            element={
              <>
                <PageTitle title={`ThriveX - ${title}`} />
                {component}
              </>
            }
          />
        ))}

        <Route path="*" element={<NotFound />} />
      </Routes>
    </DefaultLayout>
  );
};


================================================
FILE: src/components/Sidebar/SidebarLinkGroup.tsx
================================================
import { ReactNode, useState } from 'react';

interface SidebarLinkGroupProps {
  children: (handleClick: () => void, open: boolean) => ReactNode;
  activeCondition: boolean;
}

const SidebarLinkGroup = ({
  children,
  activeCondition,
}: SidebarLinkGroupProps) => {
  const [open, setOpen] = useState<boolean>(activeCondition);

  const handleClick = () => {
    setOpen(!open);
  };

  return <li>{children(handleClick, open)}</li>;
};

export default SidebarLinkGroup;

================================================
FILE: src/components/Sidebar/index.tsx
================================================
import React, { useEffect, useRef, useState } from 'react';
import { NavLink, useLocation } from 'react-router-dom';
import { Skeleton } from 'antd';
import SidebarLinkGroup from './SidebarLinkGroup';

import { BiEditAlt, BiFolderOpen, BiHomeSmile, BiSliderAlt, BiCategoryAlt, BiBug } from 'react-icons/bi';
import { TbBrandAirtable } from 'react-icons/tb';

import logo from '/logo.png';

interface SidebarProps {
  sidebarOpen: boolean;
  setSidebarOpen: (arg: boolean) => void;
}

// 定义导航项的类型
interface MenuItem {
  to: string;
  path: string;
  icon: React.ReactNode;
  name: string | React.ReactNode;
  subMenu?: SubMenuItem[];
}

interface SubMenuItem {
  to: string;
  path: string;
  name: string;
}

const Sidebar = ({ sidebarOpen, setSidebarOpen }: SidebarProps) => {
  const location = useLocation();
  const { pathname } = location;
  const [initialLoading, setInitialLoading] = useState<boolean>(true);

  // 创建 ref 用于触发器和侧边栏元素
  const trigger = useRef<HTMLButtonElement>(null);
  const sidebar = useRef<HTMLDivElement>(null);

  // 从 localStorage 获取侧边栏展开状态
  const storedSidebarExpanded = localStorage.getItem('sidebar-expanded');
  const [sidebarExpanded, setSidebarExpanded] = useState(storedSidebarExpanded === null ? false : storedSidebarExpanded === 'true');

  // 点击事件处理:点击侧边栏外部时关闭侧边栏
  useEffect(() => {
    const clickHandler = ({ target }: MouseEvent) => {
      if (!sidebar.current || !trigger.current) return;
      if (!sidebarOpen || sidebar.current.contains(target as Node) || trigger.current.contains(target as Node)) return;
      setSidebarOpen(false);
    };
    document.addEventListener('click', clickHandler);
    return () => document.removeEventListener('click', clickHandler);
  });

  // 键盘事件处理:按 ESC 键关闭侧边栏
  useEffect(() => {
    const keyHandler = ({ keyCode }: KeyboardEvent) => {
      if (!sidebarOpen || keyCode !== 27) return;
      setSidebarOpen(false);
    };
    document.addEventListener('keydown', keyHandler);
    return () => document.removeEventListener('keydown', keyHandler);
  });

  // 侧边栏展开状态持久化处理
  useEffect(() => {
    localStorage.setItem('sidebar-expanded', sidebarExpanded.toString());
    if (sidebarExpanded) {
      document.querySelector('body')?.classList.add('sidebar-expanded');
    } else {
      document.querySelector('body')?.classList.remove('sidebar-expanded');
    }
  }, [sidebarExpanded]);

  // 版本数据加载完成后,取消初始加载状态
  useEffect(() => {
    setInitialLoading(false);
  }, []);

  const [isSideBarTheme] = useState<'dark' | 'light'>('light');

  // 定义导航项的样式类
  const sidebarItemStyDark = 'group relative flex items-center gap-2.5 py-2 px-4 text-[#DEE4EE]! duration-300 ease-in-out hover:bg-graydark dark:hover:bg-[#313D4A] rounded-xs font-medium hover:text-primary! dark:hover:text-primary!';
  const sidebarItemStyLight = 'group relative flex items-center gap-2.5 py-2 px-4 text-[#444]! dark:text-slate-200! duration-300 ease-in-out hover:bg-[rgba(241,241,244,0.9)] dark:hover:bg-[#313D4A] rounded-md hover:backdrop-blur-[15px] hover:text-primary! dark:hover:text-primary!';
  const sidebarItemActiveSty = `${isSideBarTheme === 'dark' ? 'bg-graydark' : 'text-primary!'}`;

  // 箭头图标组件:用于显示子菜单的展开/收起状态
  const Arrow = ({ open }: { open: boolean }) => {
    return (
      <svg className={`absolute right-4 top-1/2 -translate-y-1/2 fill-current ${open && 'rotate-180'}`} width="17" height="17" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path fillRule="evenodd" clipRule="evenodd" d="M4.41107 6.9107C4.73651 6.58527 5.26414 6.58527 5.58958 6.9107L10.0003 11.3214L14.4111 6.91071C14.7365 6.58527 15.2641 6.58527 15.5896 6.91071C15.915 7.23614 15.915 7.76378 15.5896 8.08922L10.5896 13.0892C10.2641 13.4147 9.73651 13.4147 9.41107 13.0892L4.41107 8.08922C4.08563 7.76378 4.08563 7.23614 4.41107 6.9107Z" fill="#ccc" />
      </svg>
    );
  };

  // 定义完整的路由列表配置
  const routes: { group: string; list: MenuItem[] }[] = [
    {
      group: '',
      list: [
        {
          to: '/',
          path: 'dashboard',
          icon: <BiHomeSmile className="text-[22px]" />,
          name: '仪表盘',
        },
        {
          to: '#',
          path: 'write',
          icon: <BiEditAlt className="text-[22px]" />,
          name: '创作',
          subMenu: [
            {
              to: '/create',
              path: 'create',
              name: '谱写',
            },
            {
              to: '/create_record',
              path: 'create_record',
              name: '闪念',
            },
            {
              to: '/draft',
              path: 'draft',
              name: '草稿箱',
            },
            {
              to: '/recycle',
              path: 'recycle',
              name: '回收站',
            },
          ],
        },
        {
          to: '#',
          path: 'manage',
          icon: <BiCategoryAlt className="text-[22px]" />,
          name: '管理',
          subMenu: [
            {
              to: '/article',
              path: 'article',
              name: '文章管理',
            },
            {
              to: '/assistant',
              path: 'assistant',
              name: '助手管理',
            },
            {
              to: '/record',
              path: 'record',
              name: '说说管理',
            },
            {
              to: '/tag',
              path: 'tag',
              name: '标签管理',
            },
            {
              to: '/comment',
              path: 'comment',
              name: '评论管理',
            },
            {
              to: '/wall',
              path: 'wall',
              name: '留言管理',
            },
            {
              to: '/cate',
              path: 'cate',
              name: '导航管理',
            },
            {
              to: '/web',
              path: 'web',
              name: '网站管理',
            },
            {
              to: '/swiper',
              path: 'swiper',
              name: '轮播图管理',
            },
            {
              to: '/footprint',
              path: 'footprint',
              name: '足迹管理',
            },
            {
              to: '/storage',
              path: 'storage',
              name: '存储管理',
            },
            {
              to: '/config',
              path: 'config',
              name: '项目配置',
            },
          ],
        },
        {
          to: '/setup',
          path: 'setup',
          icon: <BiSliderAlt className="text-[22px]" />,
          name: '系统',
        },
      ],
    },
    {
      group: 'New',
      list: [
        {
          to: '/work',
          path: 'work',
          icon: <TbBrandAirtable className="text-[22px]" />,
          name: '工作台',
        },
        {
          to: '/file',
          path: 'file',
          icon: <BiFolderOpen className="text-[22px]" />,
          name: '文件系统',
        },
        {
          to: '/iter',
          path: 'iter',
          icon: <BiBug className="text-[22px]" />,
          name: (
            <div className="flex items-center w-full justify-between">
              <span>更新日志</span>
              <div className="flex items-center gap-1"/>
            </div>
          ),
        },
      ],
    },
  ];

  // 初始加载时显示骨架屏
  if (initialLoading) {
    return (
      <aside ref={sidebar} className={`absolute left-0 top-0 z-999 flex h-screen w-64 flex-col overflow-y-hidden duration-300 ease-linear lg:static lg:translate-x-0 ${sidebarOpen ? 'translate-x-0' : '-translate-x-full'} ${isSideBarTheme === 'dark' ? 'bg-black dark:bg-boxdark' : 'bg-light-gradient dark:bg-dark-gradient border-r border-stroke dark:border-strokedark transition-all backdrop-blur-2xl'}`}>
        {/* Logo 和标题骨架屏 */}
        <div className="flex justify-center items-center gap-2 px-6 py-5 pb-0 lg:pt-6 mb-4">
          <div className="flex items-center">
            <Skeleton.Input active size="default" style={{ width: 100, height: 40 }} />
          </div>
        </div>

        {/* 导航菜单骨架屏 */}
        <div className="no-scrollbar flex flex-col overflow-y-auto duration-300 ease-linear">
          <nav className="pt-2 pb-4 px-4 lg:px-6">
            {/* 第一个路由组 */}
            <div className="mb-6">
              <ul className="flex flex-col gap-1.5">
                {[1, 2, 3].map((item) => (
                  <li key={item}>
                    <div className="flex items-center gap-2.5 py-2 px-4">
                      <Skeleton.Avatar active size={22} shape="square" />
                      <Skeleton.Input active size="small" style={{ width: 80, height: 20 }} />
                    </div>
                  </li>
                ))}

                {/* 带子菜单的项 */}
                <li>
                  <div className="flex items-center gap-2.5 py-2 px-4">
                    <Skeleton.Avatar active size={22} shape="square" />
                    <Skeleton.Input active size="small" style={{ width: 60, height: 20, flex: 1 }} />
                    <Skeleton.Avatar active size={12} shape="circle" />
                  </div>

                  {/* 子菜单骨架屏 */}
                  <div className="mt-4 mb-5.5 flex flex-col gap-2.5 pl-6">
                    {[1, 2, 3, 4].map((subItem) => (
                      <div key={subItem} className="ml-6">
                        <Skeleton.Input active size="small" style={{ width: 80, height: 20 }} />
                      </div>
                    ))}
                  </div>
                </li>
              </ul>
            </div>

            {/* 第二个路由组 */}
            <div>
              <Skeleton.Input active size="small" style={{ width: 20, height: 16, marginBottom: 16, marginLeft: 16 }} />
              <ul className="flex flex-col gap-1.5">
                {[1, 2, 3].map((item) => (
                  <li key={item}>
                    <div className="flex items-center gap-2.5 py-2 px-4">
                      <Skeleton.Avatar active size={22} shape="square" />
                      <Skeleton.Input active size="small" style={{ width: 80, height: 20 }} />
                    </div>
                  </li>
                ))}
              </ul>
            </div>
          </nav>
        </div>
      </aside>
    );
  }

  // 渲染侧边栏组件
  return (
    <aside ref={sidebar} className={`absolute left-0 top-0 z-999 flex h-screen w-64 flex-col overflow-y-hidden duration-300 ease-linear lg:static lg:translate-x-0 ${sidebarOpen ? 'translate-x-0' : '-translate-x-full'} ${isSideBarTheme === 'dark' ? 'bg-black dark:bg-boxdark' : 'bg-light-gradient dark:bg-dark-gradient border-r border-stroke dark:border-strokedark transition-all backdrop-blur-2xl'}`}>
      {/* Logo 和标题区域 */}
      <div className="flex justify-center items-center gap-2 px-6 py-5 pb-0 lg:pt-6">
        <NavLink to="/" className={`flex items-center ${isSideBarTheme === 'dark' ? 'font-bold text-white' : 'font-medium text-[#555]! dark:text-white!'}`}>
          <img src={logo} alt="logo" className="w-8 mr-2.5" />
          <div>Thrive X</div>
        </NavLink>

        {/* 移动端侧边栏触发器按钮 */}
        <button ref={trigger} onClick={() => setSidebarOpen(!sidebarOpen)} aria-controls="sidebar" aria-expanded={sidebarOpen} className="block lg:hidden" />
      </div>

      {/* 导航菜单区域 */}
      <div className="no-scrollbar flex flex-col overflow-y-auto duration-300 ease-linear">
        <nav className="pt-2 pb-4 px-4 lg:px-6">
          {/* 遍历路由组并渲染 */}
          {routes.map((group, index) => (
            <div key={index}>
              {/* 路由组标题 */}
              <h3 className="mb-4 ml-4 text-sm font-semibold text-primary">{group.group}</h3>

              {/* 路由列表 */}
              <ul className="mb-6 flex flex-col gap-1.5">
                {group.list.map((item, subIndex) =>
                  // 根据是否有子菜单渲染不同的导航项
                  item.subMenu ? (
                    // 带子菜单的导航项组件
                    <SidebarLinkGroup
                      key={subIndex}
                      activeCondition={
                        // 默认展开"创作"菜单,或当前路径属于该菜单的子菜单
                        item.path === 'write' || (item.subMenu && item.subMenu.some((subItem) => pathname.includes(subItem.path)))
                      }
                    >
                      {(handleClick, open) => (
                        <React.Fragment>
                          {/* 父级菜单项 */}
                          <NavLink
                            to={item.to}
                            className={`${isSideBarTheme === 'dark' ? sidebarItemStyDark : sidebarItemStyLight}`}
                            onClick={(e) => {
                              e.preventDefault();

                              if (sidebarExpanded) {
                                handleClick();
                              } else {
                                setSidebarExpanded(true);
                              }
                            }}
                          >
                            {item.icon}
                            {item.name}
                            <Arrow open={open} />
                          </NavLink>

                          {/* 子菜单列表 */}
                          <div className={`translate transform overflow-hidden ${!open && 'hidden'}`}>
                            <ul className="mt-4 mb-5.5 flex flex-col gap-2.5 pl-6">
                              {item.subMenu!.map((subItem, subSubIndex) => (
                                <li key={subSubIndex}>
                                  <NavLink to={subItem.to} className={({ isActive }) => `text-gray-500! dark:text-gray-400! dark:hover:text-primary! group relative flex items-center gap-2.5 rounded-md px-4 duration-300 ease-in-out ${isSideBarTheme === 'dark' ? 'hover:text-white text-[#8A99AF] font-medium' : 'hover:text-primary! text-[#666] dark:text-slate-400'} ` + (isActive && 'text-primary!')}>
                                    {subItem.name}
                                  </NavLink>
                                </li>
                              ))}
                            </ul>
                          </div>
                        </React.Fragment>
                      )}
                    </SidebarLinkGroup>
                  ) : (
                    // 普通导航项
                    <li key={subIndex}>
                      <NavLink to={item.to} className={`${isSideBarTheme === 'dark' ? sidebarItemStyDark : sidebarItemStyLight} ${pathname.includes(item.path) && sidebarItemActiveSty}`}>
                        {item.icon}
                        {item.name}
                      </NavLink>
                    </li>
                  ),
                )}
              </ul>
            </div>
          ))}
        </nav>
      </div>
    </aside>
  );
};

export default Sidebar;


================================================
FILE: src/components/StatusTag/index.tsx
================================================
interface StatusTagProps {
  status: number | boolean;
  className?: string;
  flash?: boolean;
}

export default ({ status, className, flash = false }: StatusTagProps) => {
  const enabled = Boolean(status);
  const animateClass = flash ? 'animate-pulse' : '';
  const pingClass = flash ? 'animate-ping' : '';

  return (
    <div className={`flex items-center justify-center ${className || ''}`}>
      {enabled ? (
        <div className="w-9 h-9 flex items-center justify-center rounded-full bg-green-50 hover:bg-green-100 transition-colors relative">
          <span className={`w-2.5 h-2.5 bg-green-500 rounded-full ${animateClass}`} />
          <span className={`absolute w-2.5 h-2.5 bg-green-500 rounded-full ${pingClass} opacity-75`} />
        </div>
      ) : (
        <div className="w-6 h-6 flex items-center justify-center rounded-full bg-red-50 hover:bg-red-100 transition-colors relative">
          <span className={`w-2.5 h-2.5 bg-red-500 rounded-full ${animateClass}`} />
          <span className={`absolute w-2.5 h-2.5 bg-red-500 rounded-full ${pingClass} opacity-75`} />
        </div>
      )}
    </div>
  );
};


================================================
FILE: src/components/SystemNotification/index.tsx
================================================
import { Modal, Button } from 'antd';
import { GithubOutlined } from '@ant-design/icons';

const SHOW_NOTIFICATION_KEY = 'show_login_notification';
const GITHUB_URL = 'https://github.com/LiuYuYang01/ThriveX-Admin';

interface Props {
  open: boolean;
  onClose: () => void;
}

export default ({ open, onClose }: Props) => {
  // 关闭通知框
  const handleClose = () => {
    localStorage.removeItem(SHOW_NOTIFICATION_KEY);
    onClose();
  };

  // 跳转到 GitHub
  const handleGoToGitHub = () => {
    window.open(GITHUB_URL, '_blank');
  };

  return (
    <Modal title="📢 系统通知" open={open} onCancel={handleClose} footer={null} width={600} className="login-notification-modal">
      <div className="py-4">
        <div className="text-center space-y-4">
          <div className="space-y-2">
            <h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200">⭐ 喜欢 ThriveX 吗?</h3>
            <p className="text-gray-600 dark:text-gray-400 leading-relaxed">
              如果这个项目对你有帮助,欢迎在 GitHub 上给我们一个 Star!
              <br />
              你的支持是我们持续更新的最大动力 🚀
            </p>
          </div>

          <div className="pt-2">
            <Button
              type="primary"
              size="large"
              icon={<GithubOutlined />}
              onClick={handleGoToGitHub}
              style={{
                height: '48px',
                fontSize: '16px',
                fontWeight: 500,
              }}
            >
              前往 GitHub 点 Star
            </Button>
          </div>

          <div className="pt-2">
            <p className="text-sm text-gray-500 dark:text-gray-400">ThriveX 是一个年轻、高颜值、全开源、永不收费的现代化博客管理系统</p>
          </div>
        </div>
      </div>
    </Modal>
  );
};

// 导出工具函数:设置显示通知标记
export const setShowLoginNotification = () => {
  localStorage.setItem(SHOW_NOTIFICATION_KEY, 'true');
};

// 导出工具函数:检查是否需要显示通知
export const shouldShowLoginNotification = (): boolean => {
  return localStorage.getItem(SHOW_NOTIFICATION_KEY) === 'true';
};


================================================
FILE: src/components/Title/index.tsx
================================================
import { ReactNode } from 'react'

interface Props {
    value: string,
    children?: ReactNode,
    className?: string
}

export default ({ value, children }: Props) => {
    return (
        <div className="px-6 py-2.5 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark mb-2">
            <div className="overflow-auto flex justify-between items-center">
                <h2 className="font-semibold text-black dark:text-white text-xl min-w-24">{value}</h2>

                {children}
            </div>
        </div>
    )
}

================================================
FILE: src/components/WangEditor/index.scss
================================================
.w-e-text-container {
    .w-e-bar {
        display: none;
    }
}

================================================
FILE: src/components/WangEditor/index.tsx
================================================
import { useState, useEffect, useImperativeHandle, forwardRef } from 'react';
import { Editor, Toolbar } from '@wangeditor-next/editor-for-react';
import { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor-next/editor';
import '@wangeditor-next/editor/dist/css/style.css';
import './index.scss';

export default forwardRef((_props, ref) => {
  // editor 实例
  const [editor, setEditor] = useState<IDomEditor | null>(null);

  // 编辑器内容
  const [html, setHtml] = useState('');

  // 工具栏配置
  const toolbarConfig: Partial<IToolbarConfig> = {
    excludeKeys: ['headerSelect', 'blockquote', 'emotion', 'group-video', 'group-image', 'formatPainter', 'divider', 'codeBlock', 'numberedList', 'bulletedList', 'todo', 'fontFamily', 'fontSize', 'fontColor'],
  };

  // 编辑器配置
  const editorConfig: Partial<IEditorConfig> = {
    placeholder: '记录此刻美好...',
    autoFocus: true, // 默认获取焦点
  };

  useEffect(() => {
    return () => {
      if (editor == null) return;
      editor.destroy();
      setEditor(null);
    };
  }, [editor]);

  // 暴露方法
  useImperativeHandle(ref, () => {
    return {
      setValue: (value: string) => {
        setHtml(value);
      },
      getValue: () => {
        return editor?.getHtml();
      },
    };
  }, [editor]);

  return (
    <div className="overflow-hidden border border-stroke rounded-xl z-40 w-full">
      <Toolbar editor={editor} defaultConfig={toolbarConfig} mode="default" className="border-b border-stroke" />

      <Editor defaultConfig={editorConfig} value={html} onCreated={setEditor} onChange={(editor) => setHtml(editor.getHtml())} mode="default" className="min-h-64" />
    </div>
  );
});


================================================
FILE: src/hooks/useAssistant.tsx
================================================
import { useState, useEffect } from 'react';
import { message } from 'antd';
import { testAssistantConnection, callAssistantAPI } from '@/services/assistant';
import { Assistant } from '@/types/app/assistant';
import { delAssistantDataAPI, getAssistantListAPI, addAssistantDataAPI, editAssistantDataAPI, setDefaultAssistantAPI } from '@/api/assistant';

export default function useAssistant() {
  const [loading, setLoading] = useState(false);
  const [testingMap, setTestingMap] = useState<Record<string, boolean>>({});

  const [list, setList] = useState<Assistant[]>([]);
  const [assistant, setAssistant] = useState<string | null>(null);

  // 获取助手列表
  const getAssistantList = async () => {
    const { data } = await getAssistantListAPI();
    setList(data);

    // 设置默认助手
    const defaultAssistant = data.find((a) => a.isDefault);
    if (defaultAssistant) setAssistant(String(defaultAssistant.id));
  };

  // 初始化加载助手列表
  useEffect(() => {
    getAssistantList();
  }, []);

  // 添加或更新助手
  const saveAssistant = async (assistant: Assistant) => {
    setLoading(true);

    try {
      if (assistant.id) {
        // 更新现有助手
        await editAssistantDataAPI(assistant);
      } else {
        // 添加新助手
        await addAssistantDataAPI(assistant);
      }

      // 更新成功后重新获取列表
      await getAssistantList();
      message.success(assistant.id ? '助手已更新' : '助手已添加');
      return true;
    } catch (error) {
      console.error(error);
      return false;
    } finally {
      setLoading(false);
    }
  };

  // 删除助手
  const delAssistantData = async (id: number) => {
    await delAssistantDataAPI(id);
    getAssistantList();
    message.success('助手已删除');
  };

  // 设置默认助手
  const setDefaultAssistant = async (id: number) => {
    await setDefaultAssistantAPI(id);
    getAssistantList();
    message.success('默认助手已更新');
  };

  // 测试助手连接
  const testConnection = async (assistant: Assistant) => {
    setTestingMap((prev) => ({ ...prev, [assistant.id]: true }));
    try {
      const result = await testAssistantConnection(assistant);
      return result;
    } finally {
      setTestingMap((prev) => ({ ...prev, [assistant.id]: false }));
    }
  };

  // 调用助手API
  const callAssistant = async (
    messages: Array<{ role: string; content: string }>,
    options?: {
      stream?: boolean;
      temperature?: number;
      max_tokens?: number;
    },
  ) => {
    if (!assistant) {
      message.error('请先选择助手');
      return null;
    }

    const data = list.find((a) => a.id === Number(assistant));
    if (!data) {
      message.error('助手不存在');
      return null;
    }

    return callAssistantAPI(data, messages, options);
  };

  return {
    list,
    assistant,
    setAssistant,
    loading,
    testingMap,
    saveAssistant,
    delAssistantData,
    setDefaultAssistant,
    testConnection,
    callAssistant,
  };
}


================================================
FILE: src/hooks/useAuthRedirect.tsx
================================================
import { useEffect } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useUserStore } from '@/stores';

// 如果即将去往的是 /login 页面并且有 token 情况就自动重定向到 /,否则就跳转
const useAuthRedirect = () => {
  const store = useUserStore();
  const navigate = useNavigate();
  const location = useLocation();

  useEffect(() => {
    const token = store.token;
    const isGoingToLogin = location.pathname === '/login';

    if (isGoingToLogin && token) navigate('/');
  }, [location, navigate, store.token]);
};

export default useAuthRedirect;


================================================
FILE: src/hooks/useLocalStorage.tsx
================================================
import { useEffect, useState } from 'react';

type SetValue<T> = T | ((val: T) => T);

function useLocalStorage<T>(key: string, initialValue: T): [T, (value: SetValue<T>) => void] {
  // 存储值的状态
  // 将初始状态函数传递给useState,因此逻辑只执行一次
  const [storedValue, setStoredValue] = useState(() => {
    try {
      // 通过键从本地存储中获取
      const item = window.localStorage.getItem(key);
      // 解析存储的json,如果没有则返回initialValue
      return item ? JSON.parse(item) : initialValue;
    } catch (error) {
      // 如果出错也返回initialValue
      console.log(error);
      return initialValue;
    }
  });

  // 当状态改变时,useEffect更新本地存储
  useEffect(() => {
    try {
      // 允许值为函数,因此我们有与useState相同的API
      const valueToStore = typeof storedValue === 'function' ? storedValue(storedValue) : storedValue;
      // 保存状态
      window.localStorage.setItem(key, JSON.stringify(valueToStore));
    } catch (error) {
      // 更高级的实现会处理错误情况
      console.log(error);
    }
  }, [key, storedValue]);

  return [storedValue, setStoredValue];
}

export default useLocalStorage;


================================================
FILE: src/hooks/useVersionData.tsx
================================================
import { useState, useEffect } from 'react';
import axios from 'axios';

interface Version {
  name: string;
  tag_name: string;
  html_url: string;
}

const useVersionData = () => {
  const [version, setVersion] = useState<Version>({} as Version);

  useEffect(() => {
    const getVersionData = async () => {
      try {
        // 先检查 sessionStorage 中是否有缓存的版本数据
        const cachedVersion = sessionStorage.getItem('project_version');

        if (cachedVersion) {
          const parsedVersion = JSON.parse(cachedVersion);
          // 检查缓存的数据是否有效(包含必要字段)
          if (parsedVersion.tag_name && parsedVersion.html_url) {
            setVersion(parsedVersion);
            return; // 使用缓存数据,不调用接口
          }
        }

        // 如果没有缓存或缓存无效,则调用接口获取数据
        // https://api.github.com/repos/LiuYuYang01/ThriveX-Blog/releases
        const { data } = await axios.get('https://api.github.com/repos/LiuYuYang01/ThriveX-Admin/releases/latest');
        setVersion(data);
        // 将新数据存储到 sessionStorage
        sessionStorage.setItem('project_version', JSON.stringify(data));
      } catch (error) {
        console.error('获取版本信息失败:', error);
      }
    };

    getVersionData();
  }, []);

  return version;
};

export default useVersionData;


================================================
FILE: src/layout/DefaultLayout.tsx
================================================
import { useState, useEffect } from 'react';
import Header from '../components/Header/index';
import Sidebar from '../components/Sidebar/index';
import { useConfigStore } from '@/stores';

export default ({ children }: { children: React.ReactNode }) => {
  const [sidebarOpen, setSidebarOpen] = useState(false);
  const colorMode = useConfigStore((state) => state.colorMode);

  useEffect(() => {
    const className = 'dark';
    const bodyClass = window.document.body.classList;

    if (colorMode === 'dark') {
      bodyClass.add(className);
    } else {
      bodyClass.remove(className);
    }
  }, [colorMode]);

  return (
    <div className="dark:bg-[#1A222C] dark:text-[#AEB7C0]">
      <div className="flex h-screen overflow-hidden">
        <Sidebar sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />

        <div className="relative flex flex-1 flex-col overflow-y-auto overflow-x-hidden">
          <Header sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />

          <main>
            <div className="mx-auto p-4">{children}</div>
          </main>
        </div>
      </div>
    </div>
  );
};


================================================
FILE: src/main.tsx
================================================
import ReactDOM from 'react-dom/client';
import { BrowserRouter as Router } from 'react-router-dom';
import App from './App';
import '@/styles/index.css';

const app = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);

app.render(
  <Router>
    <App />
  </Router>,
);


================================================
FILE: src/pages/article/components/ArticleExport.tsx
================================================
import React, { useCallback } from 'react';
import { Button, Dropdown, Popconfirm, Tooltip, message } from 'antd';
import { DownloadOutlined } from '@ant-design/icons';
import JSZip from 'jszip';
import { saveAs } from 'file-saver';

import type { Article } from '@/types/app/article';

// 文章 → Markdown
function articleToMarkdown(article: Article): string {
  const { title, description, content, cover, createTime, cateList, tagList } = article;
  const formatDate = (timestamp: string) => {
    const date = new Date(Number(timestamp));
    const pad = (n: number) => String(n).padStart(2, '0');
    return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
  };
  const tags = (tagList || []).map((t) => t.name);
  const categories = (cateList || []).map((c) => c.name);
  const keywords = [...tags, ...categories].join(' ');
  return `---\ntitle: ${title}\ntags: ${tags.join(' ')}\ncategories: ${categories.join(' ')}\ncover: ${cover}\ndate: ${formatDate(createTime || String(Date.now()))}\nkeywords: ${keywords}\ndescription: ${description}\n---\n\n${(content || '').trim()}`;
}

function safeFileName(title: string): string {
  return title.replace(/[\\/:*?"<>|]/g, '_');
}

function downloadBlob(content: string, fileName: string, mimeType = 'text/plain;charset=utf-8') {
  const blob = new Blob([content], { type: mimeType });
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = fileName;
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
  URL.revokeObjectURL(url);
}

async function downloadArticlesZip(articles: Article[]) {
  const zip = new JSZip();
  const folder = zip.folder('data');
  for (const article of articles) {
    const markdown = articleToMarkdown(article);
    folder?.file(`${safeFileName(article.title)}.md`, markdown);
  }
  zip.file('articles.json', JSON.stringify(articles, null, 2));
  const blob = await zip.generateAsync({ type: 'blob' });
  saveAs(blob, `导出文章_${Date.now()}.zip`);
}

// 单篇导出
export interface ArticleExportSingleProps {
  article: Article;
}

export const ArticleExportSingle = ({ article }: ArticleExportSingleProps) => {
  const handleExport = useCallback(() => {
    const markdown = articleToMarkdown(article);
    downloadBlob(markdown, `${safeFileName(article.title)}.md`, 'text/markdown;charset=utf-8');
  }, [article]);

  return (
    <Tooltip title="导出">
      <Popconfirm
        title="提醒"
        description="确定要导出该文章吗?"
        okText="确定"
        cancelText="取消"
        onConfirm={handleExport}
      >
        <Button
          type="text"
          size="small"
          icon={<DownloadOutlined />}
          className="hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50"
        />
      </Popconfirm>
    </Tooltip>
  );
};


// 批量导出
export interface ArticleExportDropdownProps {
  selectedArticles: Article[];
  onLoadAll: () => Promise<Article[]>;
  setLoading?: (loading: boolean) => void;
}

export const ArticleExportDropdown = ({
  selectedArticles,
  onLoadAll,
  setLoading,
}: ArticleExportDropdownProps) => {
  const handleExportSelected = useCallback(() => {
    if (!selectedArticles.length) {
      message.warning('请选择要导出的文章');
      return;
    }
    downloadArticlesZip(selectedArticles);
  }, [selectedArticles]);

  const handleExportAll = useCallback(async () => {
    try {
      setLoading?.(true);
      const all = await onLoadAll();
      await downloadArticlesZip(all);
    } catch (err) {
      console.error(err);
      message.error('导出全部失败');
    } finally {
      setLoading?.(false);
    }
  }, [onLoadAll, setLoading]);

  return (
    <Dropdown.Button
      icon={<DownloadOutlined />}
      className="w-[120px]"
      menu={{
        items: [
          { label: '导出选中', key: 'selected', onClick: handleExportSelected },
          { label: '导出全部', key: 'all', onClick: () => handleExportAll() },
        ],
      }}
    >
      导出文章
    </Dropdown.Button>
  );
};

const ArticleExport = {
  Single: ArticleExportSingle,
  Dropdown: ArticleExportDropdown,
};

export default ArticleExport;

================================================
FILE: src/pages/article/components/ArticleImportModal.tsx
================================================
import React, { useState, useRef, useEffect, useCallback, ChangeEvent, DragEvent } from 'react';
import { Modal, Button, message } from 'antd';
import type { UploadFile } from 'antd/es/upload/interface';
import type { RcFile } from 'antd/es/upload/interface';
import type { UploadFileStatus } from 'antd/es/upload/interface';
import { InboxOutlined } from '@ant-design/icons';

const ACCEPT_EXT = ['.md', '.json'];
const MAX_FILES = 5;

const createUploadFile = (file: File): UploadFile => {
  const rc = file as RcFile;
  if (!rc.uid) rc.uid = Math.random().toString();
  return {
    uid: rc.uid,
    name: file.name,
    status: 'done' as UploadFileStatus,
    originFileObj: rc,
  };
};

const isValidFile = (name: string) =>
  ACCEPT_EXT.some((ext) => name.toLowerCase().endsWith(ext));

export interface ArticleImportModalProps {
  open: boolean;
  onClose: () => void;
  onImport: (files: File[]) => Promise<void>;
}

const ArticleImportModal: React.FC<ArticleImportModalProps> = ({
  open,
  onClose,
  onImport,
}) => {
  const [fileList, setFileList] = useState<UploadFile[]>([]);
  const [isDragging, setIsDragging] = useState(false);
  const [importLoading, setImportLoading] = useState(false);
  const fileInputRef = useRef<HTMLInputElement | null>(null);

  // 关闭时清空文件列表
  useEffect(() => {
    if (!open) {
      setFileList([]);
      setIsDragging(false);
    }
  }, [open]);

  const handleCancel = useCallback(() => {
    if (!importLoading) onClose();
  }, [importLoading, onClose]);

  const handleDragOver = useCallback((e: DragEvent) => {
    e.preventDefault();
    e.stopPropagation();
  }, []);

  const handleDragEnter = useCallback((e: DragEvent) => {
    e.preventDefault();
    e.stopPropagation();
    setIsDragging(true);
  }, []);

  const handleDragLeave = useCallback((e: DragEvent) => {
    e.preventDefault();
    e.stopPropagation();
    setIsDragging(false);
  }, []);

  const handleDrop = useCallback((e: DragEvent) => {
    e.preventDefault();
    e.stopPropagation();
    setIsDragging(false);
    const files = Array.from(e.dataTransfer.files);
    const valid = files.filter((f) => isValidFile(f.name));
    if (!valid.length) {
      message.error('仅支持 Markdown(.md) 或 JSON(.json) 文件');
      return;
    }
    if (fileList.length + valid.length > MAX_FILES) {
      message.error(`最多只能上传 ${MAX_FILES} 个文件`);
      return;
    }
    setFileList((prev) => [...prev, ...valid.map(createUploadFile)]);
    message.success(`成功添加 ${valid.length} 个文件`);
  }, [fileList.length]);

  const handleFileInputChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
    const files = Array.from(e.target.files || []);
    const valid = files.filter((f) => isValidFile(f.name));
    if (!valid.length) {
      message.error('仅支持 Markdown(.md) 或 JSON(.json) 文件');
      e.target.value = '';
      return;
    }
    if (fileList.length + valid.length > MAX_FILES) {
      message.error(`最多只能上传 ${MAX_FILES} 个文件`);
      e.target.value = '';
      return;
    }
    setFileList((prev) => [...prev, ...valid.map(createUploadFile)]);
    e.target.value = '';
  }, [fileList.length]);

  const removeFile = useCallback((uid: string) => {
    setFileList((prev) => prev.filter((f) => f.uid !== uid));
  }, []);

  const downloadMarkdownTemplate = useCallback(() => {
    const content = `---\ntitle: 示例文章标题\ndescription: 这里是文章描述\ntags: 示例标签1 示例标签2\ncategories: 示例分类\ncover: https://example.com/image.png\ndate: 2025-07-12 12:00:00\nkeywords: 示例标签1 示例标签2 示例分类\n---\n\n这里是 Markdown 正文内容,请开始创作吧~`;
    const blob = new Blob([content], { type: 'text/markdown;charset=utf-8' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = '文章模板.md';
    a.click();
    URL.revokeObjectURL(url);
  }, []);

  const downloadJsonTemplate = useCallback(() => {
    const data = {
      title: '示例文章标题',
      description: '文章描述',
      content: '# 正文内容',
      cover: '',
      createTime: Date.now().toString(),
      cateList: [{ id: 1, name: '示例分类' }],
      tagList: [{ id: 2, name: '示例标签' }],
      config: {
        status: 'default',
        password: '',
        isDraft: 0,
        isEncrypt: 0,
        isDel: 0,
      },
    };
    const blob = new Blob([JSON.stringify(data, null, 2)], {
      type: 'application/json',
    });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = '文章模板.json';
    a.click();
    URL.revokeObjectURL(url);
  }, []);

  const handleImport = useCallback(async () => {
    if (fileList.length === 0) {
      message.warning('请上传至少一个 .md 或 .json 文件');
      return;
    }
    const files = fileList
      .map((f) => f.originFileObj as File)
      .filter(Boolean);
    if (!files.length) return;
    setImportLoading(true);
    try {
      await onImport(files);
      onClose();
    } finally {
      setImportLoading(false);
    }
  }, [fileList, onImport, onClose]);

  return (
    <Modal
      title="导入文章"
      open={open}
      onCancel={handleCancel}
      footer={[
        <Button key="cancel" onClick={handleCancel} disabled={importLoading}>
          取消
        </Button>,
        <Button
          key="import"
          type="primary"
          onClick={handleImport}
          loading={importLoading}
          disabled={fileList.length === 0}
        >
          开始导入
        </Button>,
      ]}
    >
      <div className="py-4">
        <div
          role="button"
          tabIndex={0}
          onClick={() => fileInputRef.current?.click()}
          onKeyDown={(e) => e.key === 'Enter' && fileInputRef.current?.click()}
          onDragOver={handleDragOver}
          onDragEnter={handleDragEnter}
          onDragLeave={handleDragLeave}
          onDrop={handleDrop}
          className={`w-full h-40 p-4 border border-dashed rounded-lg transition-all duration-300 ${
            isDragging
              ? 'border-primary bg-primary/5'
              : 'border-[#D7D7D7] hover:border-primary bg-[#FAFAFA]'
          } space-y-2 cursor-pointer`}
        >
          <div className="flex justify-center">
            <InboxOutlined className="text-5xl text-primary" />
          </div>
          <p className="text-base text-center">
            {isDragging ? '文件放在此处即上传' : '点击或拖动文件到此区域'}
          </p>
          <p className="text-sm text-[#999] text-center">
            仅支持 Markdown 或 JSON 格式
          </p>
        </div>

        <input
          multiple
          type="file"
          ref={fileInputRef}
          onChange={handleFileInputChange}
          className="hidden"
          accept=".md,.json"
        />

        {fileList.length > 0 && (
          <div className="mt-4">
            <p className="text-sm text-gray-500 mb-2">已选择的文件:</p>
            <ul className="space-y-2">
              {fileList.map((file) => (
                <li
                  key={file.uid}
                  className="flex items-center justify-between bg-gray-50 p-2 rounded-sm"
                >
                  <span className="text-sm">{file.name}</span>
                  <Button
                    type="text"
                    danger
                    size="small"
                    onClick={(e) => {
                      e.stopPropagation();
                      removeFile(file.uid);
                    }}
                  >
                    删除
                  </Button>
                </li>
              ))}
            </ul>
          </div>
        )}

        {fileList.length === 0 && (
          <div className="mt-4 flex justify-between items-center text-sm text-gray-500">
            <span>你可以下载模板后填写再导入:</span>
            <div className="space-x-2">
              <Button type="link" size="small" onClick={downloadMarkdownTemplate}>
                下载 Markdown 模板
              </Button>
              <Button type="link" size="small" onClick={downloadJsonTemplate}>
                下载 JSON 模板
              </Button>
            </div>
          </div>
        )}
      </div>
    </Modal>
  );
};

export default ArticleImportModal;


================================================
FILE: src/pages/article/index.tsx
================================================
import { useState, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';

import { Table, Button, Tag, notification, Popconfirm, Form, Input, Select, DatePicker, message, Tooltip, Space, Divider, Popover } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import type { TableRowSelection } from 'antd/es/table/interface';
import { DeleteOutlined, FormOutlined, InboxOutlined, SearchOutlined, ClearOutlined, EyeOutlined, CommentOutlined } from '@ant-design/icons';
import { HiOutlineChevronDown, HiOutlineChevronUp } from 'react-icons/hi';
import dayjs from 'dayjs';

import Title from '@/components/Title';
import ArticleImportModal from './components/ArticleImportModal';
import ArticleExport from './components/ArticleExport';

import { getCateListAPI } from '@/api/cate';
import { getTagListAPI } from '@/api/tag';
import { delArticleDataAPI, getArticlePagingAPI, addArticleDataAPI, delBatchArticleDataAPI } from '@/api/article';

import type { Tag as ArticleTag } from '@/types/app/tag';
import type { Cate as ArticleCate } from '@/types/app/cate';
import type { Article, Config, ArticleFilterQueryParams, ArticleFilterDataForm } from '@/types/app/article';

import { useWebStore } from '@/stores';

const { RangePicker } = DatePicker;

export default () => {
  const [loading, setLoading] = useState<boolean>(false);
  const [initialLoading, setInitialLoading] = useState<boolean>(true);
  const [btnLoading, setBtnLoading] = useState<number | null>(null);
  const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
  const isFirstLoadRef = useRef<boolean>(true);
  const filterDebounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);

  const [form] = Form.useForm();
  const web = useWebStore((state) => state.web);
  const [articleList, setArticleList] = useState<Article[]>([]);

  const [total, setTotal] = useState<number>(0);

  const [filter, setFilter] = useState<ArticleFilterQueryParams>({
    key: undefined,
    cateId: undefined,
    tagId: undefined,
    isDraft: 0,
    isDel: 0,
    startDate: undefined,
    endDate: undefined,
    page: 1,
    size: 8,
  });
  const [showBatchActions, setShowBatchActions] = useState<boolean>(false);

  // 分页获取文章
  const getArticleList = async () => {
    try {
      if (isFirstLoadRef.current) {
        setInitialLoading(true);
      } else {
        setLoading(true);
      }

      const { data } = await getArticlePagingAPI(filter);
      setTotal(data.total);
      setArticleList(data.result);
      isFirstLoadRef.current = false;
    } catch (error) {
      console.error(error);
    } finally {
      setInitialLoading(false);
      setLoading(false);
    }
  };

  const delArticleData = async (id: number) => {
    try {
      setBtnLoading(id);
      await delArticleDataAPI(id, true);
      await getArticleList();
      notification.success({ message: '删除成功' });
    } catch (error) {
      console.error(error);
    } finally {
      setBtnLoading(null);
    }
  };

  // 分类/标签:柔和色系,收纳展示(默认显示前 2 个,其余 +N,悬停展示全部)
  const tagColors = [
    'default',
    'processing',
    'success',
    'warning',
    'cyan',
  ] as const;
  const VISIBLE_TAG_COUNT = 1;

  const renderCollapsibleTags = <T extends { id?: number; name: string }>(
    list: T[],
    keyPrefix: string,
  ) => {
    if (list.length === 0) return null;
    const visible = list.slice(0, VISIBLE_TAG_COUNT);
    const restCount = list.length - VISIBLE_TAG_COUNT;
    const items = (
      <div className="flex flex-wrap gap-1.5 max-w-[280px]">
        {list.map((item, index) => (
          <Tag
            key={item.id ?? index}
            color={tagColors[index % tagColors.length]}
            className="m-0! border-0!"
          >
            {item.name}
          </Tag>
        ))}
      </div>
    );
    return (
      <div className="flex flex-wrap items-center gap-1.5 justify-start">
        {visible.map((item, index) => (
          <Tag
            key={`${keyPrefix}-${item.id ?? index}`}
            color={tagColors[index % tagColors.length]}
            className="m-0! border-0!"
          >
            {item.name}
          </Tag>
        ))}

        {restCount > 0 && (
          <Popover
            content={items}
            trigger="hover"
            placement="topLeft"
            classNames={{ root: 'article-tags-popover' }}
          >
            <span
              className="inline-flex items-center justify-center min-w-[28px] h-6 px-1.5 rounded-md text-xs font-medium bg-gray-100 text-gray-500 hover:bg-gray-200 dark:bg-boxdark-2 dark:text-gray-400 dark:hover:bg-strokedark/80 border-0 cursor-pointer"
              role="button"
              tabIndex={0}
            >
              +{restCount}
            </span>
          </Popover>
        )}
      </div>
    );
  };

  const columns: ColumnsType<Article> = [
    {
      title: 'ID',
      dataIndex: 'id',
      key: 'id',
      width: 80,
      align: 'center',
      render: (text) => <span className="text-gray-400 dark:text-gray-500 font-mono">#{text}</span>,
    },
    {
      title: '标题',
      dataIndex: 'title',
      key: 'title',
      width: 280,
      render: (text: string, record: Article) => (
        <>
          {text ? (
            <Tooltip title={text} placement="topLeft">
              <a
                href={`${web.url}/article/${record.id}`}
                target="_blank"
                rel="noreferrer"
                className="max-w-[280px] truncate block text-gray-700 dark:text-gray-200 font-medium hover:text-primary dark:hover:text-primary"
              >
                {text}
              </a>
            </Tooltip>
          )
            : (
              <span className="text-gray-300 dark:text-gray-500 italic">暂无标题</span>
            )
          }
        </>
      ),
    },
    {
      title: '摘要',
      dataIndex: 'description',
      key: 'description',
      width: 320,
      render: (text: string) => (
        <>
          {text ? (
            <Tooltip title={text}>
              <div className="max-w-[320px] truncate text-gray-700 dark:text-gray-200 hover:text-primary dark:hover:text-primary cursor-pointer">
                {text}
              </div>
            </Tooltip>
          ) : (
            <span className="text-gray-300 dark:text-gray-500 italic">暂无摘要</span>
          )}
        </>
      ),
    },
    {
      title: '分类',
      dataIndex: 'cateList',
      key: 'cateList',
      width: 140,
      render: (cates: ArticleCate[]) => renderCollapsibleTags(cates || [], 'cate'),
    },
    {
      title: '标签',
      dataIndex: 'tagList',
      key: 'tagList',
      width: 160,
      render: (tags: ArticleTag[]) => renderCollapsibleTags(tags || [], 'tag'),
    },
    {
      title: '浏览量',
      dataIndex: 'view',
      key: 'view',
      width: 100,
      align: 'center',
      render: (v) => (
        <span className="inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums">
          <EyeOutlined className="text-gray-400 dark:text-gray-500 text-xs" />
          <span className="font-medium">{v ?? 0}</span>
        </span>
      ),
      sorter: (a: Article, b: Article) => (a.view ?? 0) - (b.view ?? 0),
      showSorterTooltip: false,
    },
    {
      title: '评论',
      dataIndex: 'comment',
      key: 'comment',
      width: 90,
      align: 'center',
      render: (v) => (
        <span className="inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums">
          <CommentOutlined className="text-gray-400 dark:text-gray-500 text-xs" />
          <span className="font-medium">{v ?? 0}</span>
        </span>
      ),
      sorter: (a: Article, b: Article) => (a.comment ?? 0) - (b.comment ?? 0),
      showSorterTooltip: false,
    },
    {
      title: '状态',
      dataIndex: 'config',
      key: 'config',
      width: 130,
      align: 'center',
      render: (config: Config) => {
        const statusMap: Record<string, string> = {
          default: '正常',
          no_home: '不在首页显示',
          hide: '隐藏',
        };
        const label = config.password?.trim() ? '文章加密' : statusMap[config.status];
        const statusColorMap: Record<string, string> = {
          default: 'success',
          no_home: 'warning',
          hide: 'default',
        };
        const color = config.password?.trim() ? 'processing' : statusColorMap[config.status] ?? 'default';
        return (
          <Tag color={color} className="m-0! border-0! whitespace-nowrap">
            {label}
          </Tag>
        );
      },
    },
    {
      title: '发布时间',
      dataIndex: 'createTime',
      key: 'createTime',
      width: 140,
      render: (text: string) => (
        <div className="flex flex-col">
          <span className="text-gray-700 dark:text-gray-200 font-medium">{dayjs(+text).format('YYYY-MM-DD')}</span>
          <span className="text-gray-400 dark:text-gray-500 text-xs">{dayjs(+text).format('HH:mm:ss')}</span>
        </div>
      ),
    },
    {
      title: '操作',
      key: 'action',
      fixed: 'right',
      width: 165,
      align: 'center',
      render: (_, record: Article) => (
        <Space separator={<Divider orientation="vertical" />}>
          <ArticleExport.Single article={record} />

          <Tooltip title="编辑">
            <Link to={`/create?id=${record.id}`}>
              <Button
                type="text"
                size="small"
                icon={<FormOutlined className="text-blue-500" />}
                className="text-blue-500 dark:text-gray-300 dark:hover:text-blue-500! hover:bg-blue-50 dark:hover:bg-blue-900/20"
              />
            </Link>
          </Tooltip>

          <Tooltip title="删除">
            <Popconfirm
              title="删除确认"
              description="该操作可从回收站恢复,确定删除吗?"
              okText="删除"
              okButtonProps={{ danger: true }}
              cancelText="取消"
              onConfirm={() => delArticleData(record.id!)}
            >
              <Button
                type="text"
                size="small"
                danger
                loading={btnLoading === record.id}
                icon={<DeleteOutlined />}
                className="hover:bg-red-50 dark:hover:bg-red-900/20"
              />
            </Popconfirm>
          </Tooltip>
        </Space>
      ),
    },
  ];

  const applyFormValuesToFilter = (values: ArticleFilterDataForm) => {
    setFilter((prev) => ({
      ...prev,
      key: values.title,
      cateId: values.cateId,
      tagId: values.tagId,
      startDate: values.createTime?.[0] ? String(values.createTime[0].valueOf()) : undefined,
      endDate: values.createTime?.[1] ? String(values.createTime[1].valueOf()) : undefined,
      page: 1,
      size: prev.size ?? 8,
    }));
  };

  const onFilterValuesChange = (_: Partial<ArticleFilterDataForm>, allValues: ArticleFilterDataForm) => {
    if (filterDebounceRef.current) {
      clearTimeout(filterDebounceRef.current);
      filterDebounceRef.current = null;
    }
    const hasTitleChange = 'title' in (_ as Partial<ArticleFilterDataForm>);
    if (hasTitleChange) {
      filterDebounceRef.current = setTimeout(() => applyFormValuesToFilter(allValues), 400);
    } else {
      applyFormValuesToFilter(allValues);
    }
  };

  const onFilterReset = () => {
    if (filterDebounceRef.current) {
      clearTimeout(filterDebounceRef.current);
      filterDebounceRef.current = null;
    }
    form.resetFields();
    setFilter({
      page: 1,
      size: 8,
      key: undefined,
      cateId: undefined,
      tagId: undefined,
      isDraft: 0,
      isDel: 0,
      startDate: undefined,
      endDate: undefined,
    });
  };

  const [cateList, setCateList] = useState<ArticleCate[]>([]);
  const [tagList, setTagList] = useState<ArticleTag[]>([]);

  const getCateList = async () => {
    const { data } = await getCateListAPI();
    setCateList(data.result.filter((item: ArticleCate) => item.type === 'cate'));
  };

  const getTagList = async () => {
    const { data } = await getTagListAPI();
    setTagList(data as ArticleTag[]);
  };

  // 导入文章:收集文件后调用,仅负责解析与提交
  const handleArticleImport = async (files: File[]) => {
    const articles: Article[] = [];

    for (const file of files) {
      const text = await file.text();
      if (file.name.endsWith('.md')) {
        const article = parseMarkdownToArticle(text);
        articles.push(article);
      } else if (file.name.endsWith('.json')) {
        const json = JSON.parse(text);
        articles.push(...parseJsonToArticles(json));
      }
    }

    if (articles.length === 0) {
      notification.error({ message: '解析失败,未提取出有效文章数据' });
      return;
    }

    try {
      setLoading(true);
      for (const article of articles) {
        try {
          const { code } = await addArticleDataAPI(article);
          if (code === 200) message.success(`${article.title}--导入成功~`);
        } catch (error) {
          console.error(error);
          message.error(`${article.title}--导入失败~`);
        }
      }
      await getArticleList();
      notification.success({ message: `🎉 成功导入 ${articles.length} 篇文章` });
    } catch (err) {
      console.error(err);
      notification.error({ message: '导入失败,请检查文件格式或控制台报错' });
      throw err;
    } finally {
      setLoading(false);
    }
  };

  const getTagOrCateIdsByNames = (names: string[], allTags: ArticleTag[] | ArticleCate[]) => {
    const lowerCaseMap = new Map<string, number>();

    // 忽略大小写
    for (const item of allTags) {
      lowerCaseMap.set(item.name.toLowerCase(), item.id as number);
    }

    return (
      names
        .map((name) => lowerCaseMap.get(name.toLowerCase()))
        // 去除未匹配项
        .filter((id): id is number => id !== undefined)
    );
  };

  // 从 markdown 字符串解析为 Article JSON
  const parseMarkdownToArticle = (mdText: string): Article => {
    // 提取 frontmatter 块
    const frontmatterMatch = mdText.match(/^---\n([\s\S]*?)\n---/);
    if (!frontmatterMatch) throw new Error('Markdown 文件格式错误,缺少 frontmatter');

    const frontmatterText = frontmatterMatch[1];
    // 去除 frontmatter 后的正文
    const content = mdText.replace(frontmatterMatch[0], '').trim();

    const meta: Record<string, string> = {};

    // 解析 frontmatter 每一行 key: value
    frontmatterText.split('\n').forEach((line) => {
      const [key, ...rest] = line.split(':');
      meta[key.trim()] = rest.join(':').trim();
    });

    // 时间戳(从 YYYY-MM-DD HH:mm:ss 转为 timestamp)
    const parseDateToTimestamp = (str: string): string => {
      const d = new Date(str);
      if (isNaN(d.getTime())) return Date.now().toString();
      return d.getTime().toString();
    };
    const tagNames = meta.tags?.split(/\s+/).filter(Boolean) || [];
    const tagIds = getTagOrCateIdsByNames(tagNames, tagList);
    const cateNames = meta.categories?.split(/\s+/).filter(Boolean) || [];
    const cateIds = getTagOrCateIdsByNames(cateNames, cateList);

    const article: Article = {
      title: meta.title || '未命名文章',
      description: meta.description || '',
      content,
      cover: meta.cover || '',
      createTime: parseDateToTimestamp(meta.date || ''),
      cateIds,
      tagIds,
      config: {
        status: 'default',
        password: '',
        isDraft: 0,
        isEncrypt: 0,
        isDel: 0,
      },
    };

    return article;
  };

  // 解析 JSON 内容为文章数据列表
  const parseJsonToArticles = (raw: Article | Article[]): Article[] => {
    const parseSingle = (item: Article): Article => ({
      title: item.title || '未命名文章',
      description: item.description || '',
      content: item.content || '',
      cover: item.cover || '',
      createTime: item.createTime,
      cateIds: (item.cateList || []).map((cate) => cate.id).filter((id): id is number => id !== undefined),
      tagIds: (item.tagList || []).map((tag) => tag.id).filter((id): id is number => id !== undefined),
      config: {
        status: item.config?.status || 'default',
        password: item.config?.password || '',
        isDraft: item.config?.isDraft || 0,
        isEncrypt: item.config?.isEncrypt || 0,
        isDel: item.config?.isDel || 0,
      },
    });

    // 如果是数组则批量解析,否则解析单个
    return Array.isArray(raw) ? raw.map(parseSingle) : [parseSingle(raw)];
  };

  // 删除选中
  const delSelected = async () => {
    if (!selectedRowKeys.length) {
      message.warning('请选择要删除的文章');
      return;
    }

    try {
      setLoading(true);
      const { code } = await delBatchArticleDataAPI(selectedRowKeys as number[]);
      if (code === 200) {
        message.success('删除成功');
        await getArticlePagingAPI({ page: 1, size: 8 });
      } else {
        message.error('删除失败');
      }
    } catch (error) {
      console.error(error);
    } finally {
      setLoading(false);
    }
  };

  const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);

  const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
    setSelectedRowKeys(newSelectedRowKeys);
  };

  // 选择行
  const rowSelection: TableRowSelection<Article> = {
    selectedRowKeys,
    onChange: onSelectChange,
    fixed: 'left',
  };

  // 导出全部时拉取所有文章
  const loadAllArticles = async (): Promise<Article[]> => {
    const { data } = await getArticlePagingAPI();
    return data.result;
  };

  useEffect(() => {
    getArticleList();
  }, [filter]);

  useEffect(() => {
    getCateList();
    getTagList();
  }, []);

  // 自定义骨架屏
  if (initialLoading) {
    return (
      <div className="space-y-2">
        <div className="px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark">
          <div className="skeleton h-8" style={{ width: 200 }} />
        </div>

        <div className="px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark">
          <div className="flex justify-between mb-6">
            <div className="flex gap-4 flex-wrap">
              <div className="skeleton h-9" style={{ width: 200 }} />
              <div className="skeleton h-9" style={{ width: 180 }} />
              <div className="skeleton h-9" style={{ width: 180 }} />
              <div className="skeleton h-9" style={{ width: 280 }} />
            </div>
            <div className="flex gap-2">
              <div className="skeleton h-9 rounded-md" style={{ width: 80 }} />
              <div className="skeleton h-9 rounded-md" style={{ width: 80 }} />
            </div>
          </div>

          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (
            <div key={i} className="flex gap-4 mb-4 items-center">
              <div className="skeleton shrink-0 rounded-lg" style={{ width: 56, height: 56 }} />
              <div className="flex-1 space-y-2 min-w-0">
                <div className="skeleton h-4 w-full rounded-sm" />
                <div className="skeleton h-3 rounded-sm" style={{ width: '60%' }} />
              </div>
            </div>
          ))}
        </div>
      </div>
    );
  }

  return (
    <div className="mx-auto">
      <Title value="文章管理" />

      <div className="bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden">
        <div className="p-5 border-b border-gray-100 dark:border-strokedark bg-gray-50/30 dark:bg-boxdark-2/50 space-y-4">
          {/* 筛选区:搜索条件 + 查询/重置 */}
          <Form form={form} layout="inline" onValuesChange={onFilterValuesChange} className="flex! flex-wrap! items-center! gap-y-2.5!">
            <Form.Item name="title" className="mb-0!">
              <Input
                prefix={<SearchOutlined className="text-gray-400 dark:text-gray-500" />}
                placeholder="搜索文章标题..."
                className="w-[220px]!"
                allowClear
              />
            </Form.Item>

            <Form.Item name="cateId" className="mb-0!">
              <Select
                allowClear
                options={cateList}
                fieldNames={{ label: 'name', value: 'id' }}
                placeholder="选择分类"
                className="w-[160px]!"
              />
            </Form.Item>

            <Form.Item name="tagId" className="mb-0!">
              <Select
                allowClear
                showSearch
                options={tagList}
                fieldNames={{ label: 'name', value: 'id' }}
                placeholder="选择标签"
                className="w-[140px]!"
                filterOption={(input, option) => (option?.name ?? '').toLowerCase().includes(input.toLowerCase())}
              />
            </Form.Item>

            <Form.Item name="createTime" className="mb-0!">
              <RangePicker
                className="w-[260px]!"
                placeholder={['开始日期', '结束日期']}
                disabledDate={(current) => current && current > dayjs().endOf('day')}
              />
            </Form.Item>

            <Space className="sm:flex-nowrap">
              <Button icon={<ClearOutlined />} onClick={onFilterReset}>
                重置
              </Button>
              <Button
                icon={showBatchActions ? <HiOutlineChevronUp /> : <HiOutlineChevronDown />}
                onClick={() => setShowBatchActions((v) => !v)}
              >
                {showBatchActions ? '收起' : '功能'}
              </Button>
            </Space>
          </Form>

          {showBatchActions && (
            <div className="flex justify-between items-center pt-2 mt-2! border-t border-gray-100 dark:border-strokedark gap-2">
              <div></div>

              <div className="flex space-x-3">
                <ArticleExport.Dropdown
                  selectedArticles={articleList.filter((a) => selectedRowKeys.includes(a.id as number))}
                  onLoadAll={loadAllArticles}
                  setLoading={setLoading}
                />

                <Button type="primary" icon={<InboxOutlined />} onClick={() => setIsModalOpen(true)}>
                  导入文章
                </Button>
                <Popconfirm title="删除确认" description="确定要删除选中的文章吗?" okText="删除" okButtonProps={{ danger: true }} cancelText="取消" onConfirm={() => delSelected()}>
                  <Button danger icon={<DeleteOutlined />}>删除选中</Button>
                </Popconfirm>
              </div>
            </div>
          )}
        </div>

        <Table
          rowKey="id"
          rowSelection={rowSelection}
          dataSource={articleList}
          columns={columns}
          loading={loading}
          pagination={{
            position: ['bottomRight'],
            current: filter.page,
            pageSize: filter.size,
            total,
            showTotal: (totalCount) => (
              <div className="mt-[9px] text-xs text-gray-500 dark:text-gray-400">
                当前第 {filter.page} / {Math.ceil(totalCount / (filter.size || 8))} 页 | 共 {totalCount} 条数据
              </div>
            ),
            onChange: (page, size) => setFilter((prev) => ({ ...prev, page, size: size || prev.size })),
            onShowSizeChange: (_, size) => setFilter((prev) => ({ ...prev, page: 1, size })),
            className: 'px-6! py-4!',
          }}
          className="[&_.ant-table-thead>tr>th]:bg-gray-50! dark:[&_.ant-table-thead>tr>th]:bg-boxdark-2! [&_.ant-table-thead>tr>th]:font-medium! [&_.ant-table-thead>tr>th]:text-gray-500! dark:[&_.ant-table-thead>tr>th]:text-gray-400!"
          scroll={{ x: 1400 }}
        />
      </div>

      <ArticleImportModal
        open={isModalOpen}
        onClose={() => setIsModalOpen(false)}
        onImport={handleArticleImport}
      />
    </div>
  );
};


================================================
FILE: src/pages/assistant/index.tsx
================================================
import { useState, useEffect, useRef } from 'react';
import { Button, Card, Form, Input, Modal, Select, Tooltip, Space, Skeleton, Avatar, Tag, Dropdown, MenuProps } from 'antd';
import { DeleteOutlined, FormOutlined, PlusOutlined, InfoCircleOutlined, MoreOutlined, ApiOutlined, ThunderboltFilled } from '@ant-design/icons';
import { ImSwitch } from 'react-icons/im';

import Title from '@/components/Title';
import useAssistant from '@/hooks/useAssistant';
import { Assistant } from '@/types/app/assistant';

// 模型信息
const modelInfoMap: Record<string, { desc: string; label: string }> = {
  'deepseek-chat': {
    desc: '通用聊天模型',
    label: 'DeepSeek Chat',
  },
  'deepseek-reasoner': {
    desc: '多步推理优化模型',
    label: 'DeepSeek Reasoner',
  },
  'moonshot-v1-128k': {
    desc: '长上下文模型,支持128k上下文',
    label: 'Moonshot v1 128k',
  },
  'gpt-4o': {
    desc: '多模态大模型',
    label: 'OpenAI GPT-4o',
  },
  'gpt-3.5-turbo': {
    desc: '轻量快速模型',
    label: 'OpenAI GPT-3.5 Turbo',
  },
  'glm-4': {
    desc: '中文大模型',
    label: '智谱 GLM-4',
  },
  'qwen-turbo': {
    desc: '快速对话模型',
    label: '通义千问 Turbo',
  },
  'ernie-bot': {
    desc: '文心一言大模型',
    label: '百度文心一言大模型',
  },
  'doubao-chat': {
    desc: '字节跳动豆包模型',
    label: '豆包 Chat',
  },
  // 你可以继续添加更多模型
};

// 获取模型主题(颜色和图标)
const getModelTheme = (model: string): { color: string; icon: string } => {
  const themeMap: Record<string, { color: string; icon: string }> = {
    'deepseek-chat': { color: '#1890ff', icon: 'DS' },
    'deepseek-reasoner': { color: '#722ed1', icon: 'DR' },
    'moonshot-v1-128k': { color: '#13c2c2', icon: 'M' },
    'gpt-4o': { color: '#52c41a', icon: 'GPT4' },
    'gpt-3.5-turbo': { color: '#faad14', icon: 'GPT3' },
    'glm-4': { color: '#eb2f96', icon: 'GLM' },
    'qwen-turbo': { color: '#f5222d', icon: 'QW' },
    'ernie-bot': { color: '#fa8c16', icon: 'EB' },
    'doubao-chat': { color: '#2f54eb', icon: 'DB' },
  };

  return themeMap[model] || { color: '#8c8c8c', icon: 'AI' };
};

export default () => {
  const [form] = Form.useForm();
  const [isModalOpen, setIsModalOpen] = useState(false);
  const [assistant, setAssistant] = useState<Assistant>({} as Assistant);
  const [inputModelValue, setInputModelValue] = useState('');
  const [initialLoading, setInitialLoading] = useState<boolean>(true);
  const isFirstLoadRef = useRef<boolean>(true);

  const { list, testingMap, saveAssistant, delAssistantData, setDefaultAssistant, testConnection } = useAssistant();

  // 监听 list 变化,设置初始加载状态
  useEffect(() => {
    if (list.length > 0 || isFirstLoadRef.current) {
      if (isFirstLoadRef.current && list.length > 0) {
        setInitialLoading(false);
        isFirstLoadRef.current = false;
      }
    }
  }, [list]);

  const handleSubmit = () => {
    form.validateFields().then((values) => {
      console.log(values);

      // 如果输入的模型不在列表,则直接用输入的文本
      const model = values.model;
      saveAssistant({ ...assistant, ...values, model }).then((success) => {
        if (success) {
          setIsModalOpen(false);
          form.resetFields();
          setInputModelValue('');
          setAssistant({} as Assistant);
        }
      });
    });
  };

  // 生成 Select options
  const selectOptions = Object.entries(modelInfoMap).map(([value, info]) => ({
    label: info.label,
    value,
  }));

  // 如果输入值是新模型,且不在选项里,加入它
  if (inputModelValue && !selectOptions.find((opt) => opt.value === inputModelValue)) {
    selectOptions.push({ label: inputModelValue, value: inputModelValue });
  }

  // 初始加载时显示骨架屏
  if (initialLoading) {
    return (
      <div>
        {/* Title 骨架屏 */}
        <Card className="[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2">
          <div className="flex justify-between items-center">
            <Skeleton.Input active size="large" style={{ width: 150, height: 32 }} />
            <Skeleton.Button active size="default" style={{ width: 100, height: 32 }} />
          </div>
        </Card>

        {/* 卡片网格骨架屏 */}
        <div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 mt-3">
          {[1, 2, 3, 4, 5, 6].map((item) => (
            <Card key={item} className="border-stroke dark:border-strokedark">
              <div className="flex items-start justify-between mb-4">
                <div className="flex items-center gap-3">
                  <Skeleton.Avatar active size={48} shape="square" />
                  <div>
                    <Skeleton.Input active size="small" style={{ width: 80, height: 16 }} />
                  </div>
                </div>
                <Skeleton.Button active size="small" style={{ width: 32, height: 32 }} />
              </div>
              <div className="bg-gray-100 dark:bg-boxdark-2 rounded-md p-3 py-4 mb-4">

              </div>
              <div className="pt-2 border-t border-gray-100 dark:border-strokedark">
                <Skeleton.Button active size="default" style={{ width: '100%', height: 32 }} />
              </div>
            </Card>
          ))}
        </div>
      </div>
    );
  }

  return (
    <div>
      <Title value="助手管理">
        <Button type="primary" onClick={() => setIsModalOpen(true)}>
          添加助手
        </Button>
      </Title>

      {/* 卡片网格区域 */}
      <div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 mt-3">
        {list.map((item) => {
          const info = modelInfoMap[item.model];
          const theme = getModelTheme(item.model);
          const isTesting = testingMap[item.id];
          const isDefault = !!item.isDefault;

          // 下拉菜单项
          const menuItems: MenuProps['items'] = [
            {
              key: 'edit',
              label: '编辑配置',
              icon: <FormOutlined />,
              onClick: () => {
                form.setFieldsValue(item);
                setInputModelValue(item.model);
                setAssistant(item);
                setIsModalOpen(true);
              }
            },
            {
              key: 'default',
              label: isDefault ? '已开启' : '开启助手',
              icon: <ImSwitch />,
              disabled: isDefault,
              onClick: () => setDefaultAssistant(+item.id)
            },
            {
              type: 'divider',
            },
            {
              key: 'delete',
              label: '删除助手',
              danger: true,
              icon: <DeleteOutlined />,
              onClick: () => {
                Modal.confirm({
                  title: '确认删除',
                  content: `您确定要删除助手 "${item.name}" 吗?此操作无法撤销。`,
                  okText: '删除',
                  okType: 'danger',
                  cancelText: '取消',
                  onOk: () => delAssistantData(+item.id),
                });
              }
            }
          ];

          return (
            <Card
              key={item.id}
              className={`relative p-5 rounded-xl shadow-xs hover:shadow-md transition-shadow duration-300 overflow-hidden ${item.isDefault
                ? 'border-2! border-primary! bg-linear-to-br from-blue-50 via-white to-blue-50 dark:from-blue-900/30 dark:via-boxdark dark:to-blue-900/30 dark:border-primary!'
                : 'border border-gray-200 bg-linear-to-br from-gray-50 via-white to-slate-50 dark:from-boxdark/80 dark:via-boxdark dark:to-boxdark-2/80 dark:border-strokedark'
                }`}
              styles={{ body: { flex: 1, display: 'flex', flexDirection: 'column', backgroundColor: 'transparent' } }}
            >
              {/* 卡片头部:图标与名称 */}
              <div className="flex items-start justify-between mb-4">
                <div className="flex items-center gap-3">
                  <Avatar
                    shape="square"
                    size={48}
                    style={{ backgroundColor: theme.color, verticalAlign: 'middle' }}
                    className="shadow-md text-lg font-bold"
                  >
                    {theme.icon}
                  </Avatar>

                  <div>
                    <div className="font-bold text-lg text-gray-800 dark:text-white leading-tight mb-1 truncate max-w-[160px] ml-[5px]">
                      {item.name}
                    </div>

                    <Space size={4}>
                      <Tag bordered={false} className="text-xs bg-gray-100 text-gray-500 dark:bg-boxdark-2 dark:text-gray-300 mr-0">
                        {info ? info.label : item.model}
                      </Tag>

                      {info && (
                        <Tooltip title={info.desc}>
                          <InfoCircleOutlined className="text-gray-400! dark:text-gray-500 cursor-pointer hover:text-primary dark:hover:text-primary" />
                        </Tooltip>
                      )}
                    </Space>
                  </div>
                </div>

                {/* 更多操作菜单 */}
                <Dropdown menu={{ items: menuItems }} placement="bottomRight" arrow className="bg-gray-50 dark:bg-boxdark-2/50 dark:hover:bg-boxdark-2/30">
                  <Button type="text" icon={<MoreOutlined className="text-xl text-gray-400 dark:text-gray-500" />} />
                </Dropdown>
              </div>

              {/* 卡片内容:URL显示 */}
              <div className="bg-gray-50 dark:bg-boxdark-2 rounded-md px-3 py-2 mb-2 flex-1 border border-gray-100 dark:border-strokedark">
                <div className="flex items-center text-gray-400 dark:text-gray-500 text-xs uppercase font-bold mb-1">
                  <ApiOutlined className="mr-1" /> API Endpoint
                </div>
                <div
                  className="text-gray-600 dark:text-gray-300 font-mono text-sm m-0 break-all"
                >
                  {item.url}
                </div>
              </div>

              {/* 卡片底部:主要操作 */}
              <div className="mt-auto pt-2 border-t border-gray-100 dark:border-strokedark flex justify-end">
                <Button
                  type={isTesting ? 'default' : 'dashed'}
                  className={`${isTesting ? '' : 'text-primary border-primary bg-blue-50/50 dark:bg-blue-900/20 dark:border-primary dark:text-primary'} w-full`}
                  icon={isTesting ? <ThunderboltFilled spin /> : <ThunderboltFilled />}
                  loading={isTesting}
                  onClick={() => testConnection(item)}
                >
                  {isTesting ? '连接测试中...' : '测试连接'}
                </Button>
              </div>
            </Card>
          );
        })}

        {/* 空状态下的添加按钮(如果没有数据或者作为最后一个Card) */}
        <Button
          type="dashed"
          className="h-auto min-h-[200px] border-2 flex flex-col items-center justify-center gap-2 bg-white! dark:bg-boxdark! text-gray-400 dark:text-gray-500 hover:text-primary dark:hover:text-primary hover:border-primary dark:hover:border-primary rounded-lg bg-transparent dark:border-strokedark"
          onClick={() => setIsModalOpen(true)}
        >
          <PlusOutlined style={{ fontSize: '24px' }} />
          <span className="font-medium">添加新助手</span>
        </Button>
      </div>

      <Modal
        title={assistant.id ? '编辑助手' : '添加助手'}
        open={isModalOpen}
        onOk={handleSubmit}
        onCancel={() => {
          setIsModalOpen(false);
          form.resetFields();
          setInputModelValue('');
          setAssistant({} as Assistant);
        }}
      >
        <Form form={form} layout="vertical" size="large">
          <Form.Item name="name" label="名称" rules={[{ required: true, message: '请输入助手名称' }]}>
            <Input placeholder="例如:DeepSeek、OpenAI 等" />
          </Form.Item>

          <Form.Item
            name="url"
            label="API 地址"
            tooltip="填写完整的 API 接口地址,如 https://api.deepseek.com/v1"
            rules={[
              { required: true, message: '请输入 API 地址' },
              {
                pattern: /^https?:\/\//,
                message: '请输入正确的 API 地址'
              }
            ]}
          >
            <Input placeholder="https://api.deepseek.com/v1" autoComplete="off" />
          </Form.Item>

          <Form.Item name="key" label="API 密钥" rules={[{ required: true, message: '请输入 API 密钥' }]}>
            <Input.Password placehold
Download .txt
gitextract_u6ur3t29/

├── .dockerignore
├── .gitignore
├── .prettierrc
├── .vite/
│   └── deps_temp_474a67bf/
│       └── package.json
├── LICENSE
├── README.md
├── dockerfile
├── eslint.config.js
├── index.html
├── package.json
├── postcss.config.cjs
├── public/
│   └── _redirects
├── src/
│   ├── App.tsx
│   ├── api/
│   │   ├── album_cate.ts
│   │   ├── album_image.ts
│   │   ├── article.ts
│   │   ├── assistant.ts
│   │   ├── auth.ts
│   │   ├── cate.ts
│   │   ├── comment.ts
│   │   ├── config.ts
│   │   ├── email.ts
│   │   ├── file.ts
│   │   ├── footprint.ts
│   │   ├── oss.ts
│   │   ├── record.ts
│   │   ├── rss.ts
│   │   ├── statis.ts
│   │   ├── swiper.ts
│   │   ├── tag.ts
│   │   ├── user.ts
│   │   ├── wall.ts
│   │   └── web.ts
│   ├── components/
│   │   ├── CardDataStats/
│   │   │   └── index.tsx
│   │   ├── ClickOutside.tsx
│   │   ├── Drawer/
│   │   │   └── index.tsx
│   │   ├── Dropdowns/
│   │   │   └── DropdownDefault.tsx
│   │   ├── Empty/
│   │   │   └── index.tsx
│   │   ├── FileUpload/
│   │   │   └── index.tsx
│   │   ├── HasPermission/
│   │   │   └── index.tsx
│   │   ├── Header/
│   │   │   ├── DarkModeSwitcher.tsx
│   │   │   ├── DropdownUser.tsx
│   │   │   └── index.tsx
│   │   ├── Loader/
│   │   │   └── index.tsx
│   │   ├── Material/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── NotFound/
│   │   │   └── index.tsx
│   │   ├── PageTab/
│   │   │   └── index.tsx
│   │   ├── PageTitle.tsx
│   │   ├── RandomAvatar/
│   │   │   └── index.tsx
│   │   ├── RouteList/
│   │   │   └── index.tsx
│   │   ├── Sidebar/
│   │   │   ├── SidebarLinkGroup.tsx
│   │   │   └── index.tsx
│   │   ├── StatusTag/
│   │   │   └── index.tsx
│   │   ├── SystemNotification/
│   │   │   └── index.tsx
│   │   ├── Title/
│   │   │   └── index.tsx
│   │   └── WangEditor/
│   │       ├── index.scss
│   │       └── index.tsx
│   ├── hooks/
│   │   ├── useAssistant.tsx
│   │   ├── useAuthRedirect.tsx
│   │   ├── useLocalStorage.tsx
│   │   └── useVersionData.tsx
│   ├── layout/
│   │   └── DefaultLayout.tsx
│   ├── main.tsx
│   ├── pages/
│   │   ├── article/
│   │   │   ├── components/
│   │   │   │   ├── ArticleExport.tsx
│   │   │   │   └── ArticleImportModal.tsx
│   │   │   └── index.tsx
│   │   ├── assistant/
│   │   │   └── index.tsx
│   │   ├── cate/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── comment/
│   │   │   └── index.tsx
│   │   ├── config/
│   │   │   └── index.tsx
│   │   ├── create/
│   │   │   ├── components/
│   │   │   │   ├── Editor/
│   │   │   │   │   ├── index.scss
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   ├── markdown.scss
│   │   │   │   │   └── plugins.tsx
│   │   │   │   └── PublishForm/
│   │   │   │       ├── index.scss
│   │   │   │       └── index.tsx
│   │   │   └── index.tsx
│   │   ├── create_record/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── dashboard/
│   │   │   ├── components/
│   │   │   │   ├── HeaderInfo/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── Info/
│   │   │   │   │   └── index.tsx
│   │   │   │   └── Stats/
│   │   │   │       ├── components/
│   │   │   │       │   ├── NewOldVisitors/
│   │   │   │       │   │   └── index.tsx
│   │   │   │       │   └── VisitorsStatisChat/
│   │   │   │       │       ├── index.tsx
│   │   │   │       │       └── type.d.ts
│   │   │   │       └── index.tsx
│   │   │   └── index.tsx
│   │   ├── decycle/
│   │   │   └── index.tsx
│   │   ├── draft/
│   │   │   └── index.tsx
│   │   ├── file/
│   │   │   ├── index.scss
│   │   │   └── index.tsx
│   │   ├── footprint/
│   │   │   └── index.tsx
│   │   ├── iterative/
│   │   │   └── index.tsx
│   │   ├── login/
│   │   │   └── index.tsx
│   │   ├── page/
│   │   │   └── my.tsx
│   │   ├── record/
│   │   │   └── index.tsx
│   │   ├── setup/
│   │   │   ├── components/
│   │   │   │   ├── My/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── Other/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── System/
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── Theme/
│   │   │   │   │   ├── components/
│   │   │   │   │   │   ├── RecordTheme/
│   │   │   │   │   │   │   └── index.tsx
│   │   │   │   │   │   └── SynthesisTheme/
│   │   │   │   │   │       ├── index.tsx
│   │   │   │   │   │       └── type.d.ts
│   │   │   │   │   └── index.tsx
│   │   │   │   └── Web/
│   │   │   │       └── index.tsx
│   │   │   └── index.tsx
│   │   ├── storage/
│   │   │   └── index.tsx
│   │   ├── swiper/
│   │   │   └── index.tsx
│   │   ├── tag/
│   │   │   └── index.tsx
│   │   ├── wall/
│   │   │   └── index.tsx
│   │   ├── web/
│   │   │   └── index.tsx
│   │   └── work/
│   │       ├── components/
│   │       │   └── List/
│   │       │       └── index.tsx
│   │       └── index.tsx
│   ├── services/
│   │   └── assistant.ts
│   ├── stores/
│   │   ├── index.ts
│   │   └── modules/
│   │       ├── config.ts
│   │       ├── tabs.ts
│   │       ├── user.ts
│   │       └── web.ts
│   ├── styles/
│   │   ├── antd.scss
│   │   ├── custom.scss
│   │   ├── index.css
│   │   ├── sty.ts
│   │   └── var.scss
│   ├── types/
│   │   ├── app/
│   │   │   ├── album.d.ts
│   │   │   ├── article.d.ts
│   │   │   ├── assistant.d.ts
│   │   │   ├── brand.d.ts
│   │   │   ├── cate.d.ts
│   │   │   ├── chat.d.ts
│   │   │   ├── comment.d.ts
│   │   │   ├── config.d.ts
│   │   │   ├── email.d.ts
│   │   │   ├── file.d.ts
│   │   │   ├── footprint.d.ts
│   │   │   ├── oss.d.ts
│   │   │   ├── package.d.ts
│   │   │   ├── permission.d.ts
│   │   │   ├── product.d.ts
│   │   │   ├── record.d.ts
│   │   │   ├── role.d.ts
│   │   │   ├── route.d.ts
│   │   │   ├── rss.d.ts
│   │   │   ├── swiper.d.ts
│   │   │   ├── tag.d.ts
│   │   │   ├── user.d.ts
│   │   │   ├── wall.d.ts
│   │   │   └── web.d.ts
│   │   ├── env.d.ts
│   │   ├── global.d.ts
│   │   └── response.d.ts
│   └── utils/
│       ├── index.ts
│       ├── permission.ts
│       ├── request.ts
│       └── route.tsx
├── tsconfig.json
├── tsconfig.node.json
├── vercel.json
└── vite.config.js
Download .txt
SYMBOL INDEX (126 symbols across 63 files)

FILE: src/App.tsx
  function App (line 15) | function App() {

FILE: src/api/statis.ts
  type StatisType (line 3) | type StatisType = 'overview' | 'new-visitor' | 'basic-overview';

FILE: src/components/CardDataStats/index.tsx
  type Props (line 3) | interface Props {

FILE: src/components/ClickOutside.tsx
  type Props (line 3) | interface Props {

FILE: src/components/Drawer/index.tsx
  type Props (line 4) | interface Props {

FILE: src/components/FileUpload/index.tsx
  type Props (line 9) | interface Props {

FILE: src/components/HasPermission/index.tsx
  type Props (line 3) | interface Props {

FILE: src/components/Material/index.tsx
  type Props (line 14) | interface Props {

FILE: src/components/PageTitle.tsx
  type Props (line 4) | interface Props {

FILE: src/components/Sidebar/SidebarLinkGroup.tsx
  type SidebarLinkGroupProps (line 3) | interface SidebarLinkGroupProps {

FILE: src/components/Sidebar/index.tsx
  type SidebarProps (line 11) | interface SidebarProps {
  type MenuItem (line 17) | interface MenuItem {
  type SubMenuItem (line 25) | interface SubMenuItem {

FILE: src/components/StatusTag/index.tsx
  type StatusTagProps (line 1) | interface StatusTagProps {

FILE: src/components/SystemNotification/index.tsx
  constant SHOW_NOTIFICATION_KEY (line 4) | const SHOW_NOTIFICATION_KEY = 'show_login_notification';
  constant GITHUB_URL (line 5) | const GITHUB_URL = 'https://github.com/LiuYuYang01/ThriveX-Admin';
  type Props (line 7) | interface Props {

FILE: src/components/Title/index.tsx
  type Props (line 3) | interface Props {

FILE: src/hooks/useAssistant.tsx
  function useAssistant (line 7) | function useAssistant() {

FILE: src/hooks/useLocalStorage.tsx
  type SetValue (line 3) | type SetValue<T> = T | ((val: T) => T);
  function useLocalStorage (line 5) | function useLocalStorage<T>(key: string, initialValue: T): [T, (value: S...

FILE: src/hooks/useVersionData.tsx
  type Version (line 4) | interface Version {

FILE: src/pages/article/components/ArticleExport.tsx
  function articleToMarkdown (line 10) | function articleToMarkdown(article: Article): string {
  function safeFileName (line 23) | function safeFileName(title: string): string {
  function downloadBlob (line 27) | function downloadBlob(content: string, fileName: string, mimeType = 'tex...
  function downloadArticlesZip (line 39) | async function downloadArticlesZip(articles: Article[]) {
  type ArticleExportSingleProps (line 52) | interface ArticleExportSingleProps {
  type ArticleExportDropdownProps (line 84) | interface ArticleExportDropdownProps {

FILE: src/pages/article/components/ArticleImportModal.tsx
  constant ACCEPT_EXT (line 8) | const ACCEPT_EXT = ['.md', '.json'];
  constant MAX_FILES (line 9) | const MAX_FILES = 5;
  type ArticleImportModalProps (line 25) | interface ArticleImportModalProps {

FILE: src/pages/config/index.tsx
  type Props (line 15) | interface Props {
  function ConfigEditModal (line 28) | function ConfigEditModal({ open, onCancel, onSave, value, error, onChang...

FILE: src/pages/create/components/Editor/index.tsx
  type Props (line 17) | interface Props {

FILE: src/pages/create/components/PublishForm/index.tsx
  type Props (line 21) | interface Props {
  type FieldType (line 26) | interface FieldType {
  type AssistantResponse (line 41) | interface AssistantResponse {

FILE: src/pages/dashboard/components/Info/index.tsx
  function InfoCard (line 8) | function InfoCard() {

FILE: src/pages/dashboard/components/Stats/components/NewOldVisitors/index.tsx
  type ChartThreeState (line 9) | interface ChartThreeState {

FILE: src/pages/dashboard/components/Stats/components/VisitorsStatisChat/type.d.ts
  type StatisResult (line 1) | interface StatisResult {
  type StatisResponse (line 12) | interface StatisResponse {
  type EChartsParams (line 16) | interface EChartsParams {
  type Result (line 22) | interface Result {

FILE: src/pages/footprint/index.tsx
  type ListQuery (line 17) | type ListQuery = { key?: string; startDate?: string; endDate?: string };

FILE: src/pages/iterative/index.tsx
  type Commit (line 14) | interface Commit {
  type TimelineItem (line 21) | interface TimelineItem {
  type TimelineCardIcon (line 26) | type TimelineCardIcon = React.ComponentType<{ size?: number; className?:...
  constant CARD_STYLES (line 53) | const CARD_STYLES = [
  type SetTimelineData (line 164) | type SetTimelineData = React.Dispatch<React.SetStateAction<TimelineItem[...

FILE: src/pages/setup/components/My/index.tsx
  type UserForm (line 8) | interface UserForm {

FILE: src/pages/setup/components/Theme/components/SynthesisTheme/type.d.ts
  type ThemeFormValues (line 1) | interface ThemeFormValues {

FILE: src/pages/setup/index.tsx
  type Setup (line 15) | interface Setup {

FILE: src/pages/work/components/List/index.tsx
  type Menu (line 15) | type Menu = 'comment' | 'link' | 'wall';
  type ListItemProps (line 17) | interface ListItemProps {

FILE: src/pages/work/index.tsx
  type Menu (line 21) | type Menu = 'comment' | 'link' | 'wall';

FILE: src/stores/modules/config.ts
  type ColorMode (line 4) | type ColorMode = 'light' | 'dark';
  type ConfigStore (line 6) | interface ConfigStore {

FILE: src/stores/modules/tabs.ts
  type TabItem (line 4) | interface TabItem {
  type TabsStore (line 10) | interface TabsStore {

FILE: src/stores/modules/user.ts
  type UserStore (line 7) | interface UserStore {

FILE: src/stores/modules/web.ts
  type WebStore (line 4) | interface WebStore {

FILE: src/types/app/album.d.ts
  type AlbumCate (line 1) | interface AlbumCate {
  type AlbumImage (line 9) | interface AlbumImage {

FILE: src/types/app/article.d.ts
  type Status (line 4) | type Status = 'default' | 'no_home' | 'hide';
  type Config (line 6) | interface Config {
  type Article (line 16) | interface Article {
  type ArticleFilterDataForm (line 32) | interface ArticleFilterDataForm {
  type ArticleFilterQueryParams (line 39) | interface ArticleFilterQueryParams extends Page {

FILE: src/types/app/assistant.d.ts
  type Assistant (line 1) | interface Assistant {

FILE: src/types/app/brand.d.ts
  type BRAND (line 1) | type BRAND = {

FILE: src/types/app/cate.d.ts
  type Cate (line 1) | interface Cate {
  type CateFilterQueryParams (line 15) | interface CateFilterQueryParams extends Page {

FILE: src/types/app/chat.d.ts
  type Chat (line 1) | type Chat = {

FILE: src/types/app/comment.d.ts
  type Comment (line 1) | interface Comment {
  type Info (line 15) | interface Info {
  type FilterForm (line 22) | interface FilterForm {

FILE: src/types/app/config.d.ts
  type WebConfigType (line 2) | type WebConfigType = 'web' | 'theme' | 'other';
  type Social (line 4) | interface Social {
  type System (line 10) | interface System {
  type Web (line 19) | interface Web {
  type ArticleLayout (line 31) | type ArticleLayout = 'classics' | 'card' | 'waterfall' | '';
  type RightSidebar (line 32) | type RightSidebar = 'author' | 'hotArticle' | 'randomArticle' | 'newComm...
  type Theme (line 35) | interface Theme {
  type Other (line 50) | interface Other {
  type EnvConfigName (line 54) | type EnvConfigName = 'baidu_statis' | 'email' | 'gaode_map' | 'gaode_coo...
  type Config (line 56) | interface Config {

FILE: src/types/app/email.d.ts
  type Email (line 1) | interface Email {
  type CommentEmail (line 10) | interface CommentEmail extends Email {
  type DismissEmail (line 17) | interface DismissEmail extends Email {
  type ReplyWallEmail (line 24) | interface ReplyWallEmail extends Omit<Email, 'subject'> {

FILE: src/types/app/file.d.ts
  type DirList (line 1) | type DirList = 'default' | 'article' | 'swiper' | string;
  type File (line 3) | interface File {
  type FileDir (line 11) | interface FileDir {

FILE: src/types/app/footprint.d.ts
  type Footprint (line 1) | interface Footprint {
  type FilterForm (line 11) | interface FilterForm {

FILE: src/types/app/oss.d.ts
  type Oss (line 1) | interface Oss {

FILE: src/types/app/package.d.ts
  type Package (line 1) | type Package = {

FILE: src/types/app/permission.d.ts
  type Permission (line 1) | interface Permission {

FILE: src/types/app/product.d.ts
  type Product (line 1) | type Product = {

FILE: src/types/app/record.d.ts
  type Record (line 1) | interface Record {

FILE: src/types/app/role.d.ts
  type Role (line 1) | interface Role {

FILE: src/types/app/route.d.ts
  type Route (line 1) | interface Route {

FILE: src/types/app/rss.d.ts
  type Rss (line 3) | interface Rss extends Omit<Web, 'id' | 'type' | 'typeId' | 'rss'> {

FILE: src/types/app/swiper.d.ts
  type Swiper (line 1) | interface Swiper {

FILE: src/types/app/tag.d.ts
  type Tag (line 1) | interface Tag {

FILE: src/types/app/user.d.ts
  type Login (line 1) | interface Login {
  type UserInfo (line 6) | interface UserInfo {
  type User (line 16) | type User = Login & UserInfo & { createTime?: string };
  type LoginReturn (line 18) | interface LoginReturn {
  type EditUser (line 24) | interface EditUser {
  type FilterForm (line 31) | interface FilterForm {
  type FilterUser (line 37) | interface FilterUser extends FilterQueryParams {

FILE: src/types/app/wall.d.ts
  type Cate (line 1) | interface Cate {
  type Wall (line 8) | interface Wall {
  type FilterForm (line 21) | interface FilterForm {
  type FilterWall (line 27) | interface FilterWall extends FilterQueryParams {

FILE: src/types/app/web.d.ts
  type WebType (line 1) | interface WebType {
  type Web (line 8) | interface Web {

FILE: src/types/env.d.ts
  type ImportMetaEnv (line 1) | interface ImportMetaEnv {
  type ImportMeta (line 13) | interface ImportMeta {

FILE: src/types/response.d.ts
  type Response (line 1) | interface Response<T> {
  type Paginate (line 7) | interface Paginate<T> {
  type Page (line 17) | interface Page {
  type FilterQueryParams (line 22) | interface FilterQueryParams {
  type QueryData (line 31) | interface QueryData<T = FilterQueryParams> {

FILE: src/utils/route.tsx
  type RouteConfig (line 6) | interface RouteConfig {
Condensed preview — 159 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (562K chars).
[
  {
    "path": ".dockerignore",
    "chars": 51,
    "preview": "node_modules\nnpm-debug.log\nDockerfile\n.dockerignore"
  },
  {
    "path": ".gitignore",
    "chars": 252,
    "preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndis"
  },
  {
    "path": ".prettierrc",
    "chars": 143,
    "preview": "{\n  \"singleQuote\": true,\n  \"jsxSingleQuote\": false,\n  \"printWidth\": 999,\n  \"semi\": true,\n  \"bracketSpacing\": true,\n  \"ar"
  },
  {
    "path": ".vite/deps_temp_474a67bf/package.json",
    "chars": 23,
    "preview": "{\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "LICENSE",
    "chars": 34523,
    "preview": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C)"
  },
  {
    "path": "README.md",
    "chars": 4582,
    "preview": "<p align=\"center\">\n    <a href=\"https://liuyuyang.net\" target=\"_blank\">\n        <img width=\"120\" src=\"https://bu.dusays."
  },
  {
    "path": "dockerfile",
    "chars": 515,
    "preview": "# 使用官方的Node.js镜像作为基础镜像\nFROM registry.cn-hangzhou.aliyuncs.com/liuyi778/node-20-alpine AS builder\n\n# 设置工作目录\nWORKDIR /thri"
  },
  {
    "path": "eslint.config.js",
    "chars": 1372,
    "preview": "import js from '@eslint/js';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\nimport pluginReact"
  },
  {
    "path": "index.html",
    "chars": 372,
    "preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <link rel=\"icon\" type=\"image/svg+xml\" href"
  },
  {
    "path": "package.json",
    "chars": 2436,
    "preview": "{\n  \"name\": \"thrivex-admin\",\n  \"private\": true,\n  \"version\": \"3.0\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"eslin"
  },
  {
    "path": "postcss.config.cjs",
    "chars": 108,
    "preview": "// eslint-disable-next-line no-undef\nmodule.exports = {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "public/_redirects",
    "chars": 18,
    "preview": "/* /index.html 200"
  },
  {
    "path": "src/App.tsx",
    "chars": 1760,
    "preview": "import { useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport useAuthRedirect from '@/hooks/"
  },
  {
    "path": "src/api/album_cate.ts",
    "chars": 1098,
    "preview": "import Request from '@/utils/request'\nimport { AlbumCate, AlbumImage } from '@/types/app/album'\n\n// 新增相册\nexport const ad"
  },
  {
    "path": "src/api/album_image.ts",
    "chars": 878,
    "preview": "import Request from '@/utils/request'\nimport { AlbumImage } from '@/types/app/album'\n\n// 新增照片\nexport const addAlbumImage"
  },
  {
    "path": "src/api/article.ts",
    "chars": 1254,
    "preview": "import Request from '@/utils/request';\nimport { Article, ArticleFilterQueryParams } from '@/types/app/article';\n\n// 新增文章"
  },
  {
    "path": "src/api/assistant.ts",
    "chars": 765,
    "preview": "import Request from '@/utils/request'\nimport { Assistant } from '@/types/app/assistant'\n\n// 新增助手\nexport const addAssista"
  },
  {
    "path": "src/api/auth.ts",
    "chars": 369,
    "preview": "import { LoginReturn } from '@/types/app/user'\nimport Request from '@/utils/request'\n\n// 授权 github 登录\nexport const authG"
  },
  {
    "path": "src/api/cate.ts",
    "chars": 593,
    "preview": "import Request from '@/utils/request'\nimport { Cate, CateFilterQueryParams } from '@/types/app/cate'\n\n// 新增分类\nexport con"
  },
  {
    "path": "src/api/comment.ts",
    "chars": 952,
    "preview": "import Request from '@/utils/request'\nimport { Comment } from '@/types/app/comment'\n\n// 新增评论\nexport const addCommentData"
  },
  {
    "path": "src/api/config.ts",
    "chars": 1229,
    "preview": "import Request from '@/utils/request';\nimport { Config, EnvConfigName, WebConfigType } from '@/types/app/config';\n\n// 获取"
  },
  {
    "path": "src/api/email.ts",
    "chars": 411,
    "preview": "import Request from '@/utils/request'\nimport { DismissEmail, ReplyWallEmail } from '@/types/app/email'\n\n// 发送驳回邮件\nexport"
  },
  {
    "path": "src/api/file.ts",
    "chars": 563,
    "preview": "import Request from '@/utils/request'\nimport { File, FileDir } from '@/types/app/file'\n\n// 删除文件\nexport const delFileData"
  },
  {
    "path": "src/api/footprint.ts",
    "chars": 655,
    "preview": "import Request from '@/utils/request'\nimport { Footprint } from '@/types/app/footprint'\n\n// 新增足迹\nexport const addFootpri"
  },
  {
    "path": "src/api/oss.ts",
    "chars": 933,
    "preview": "import Request from '@/utils/request'\nimport { Oss } from '@/types/app/oss'\n\n// 新增OSS\nexport const addOssDataAPI = (data"
  },
  {
    "path": "src/api/record.ts",
    "chars": 813,
    "preview": "import Request from '@/utils/request'\nimport { Record } from '@/types/app/record'\n\n// 新增说说\nexport const addRecordDataAPI"
  },
  {
    "path": "src/api/rss.ts",
    "chars": 408,
    "preview": "import { Rss } from '@/types/app/rss';\nimport Request from '@/utils/request';\n\n// 获取订阅数据列表\nexport const getRssListAPI = "
  },
  {
    "path": "src/api/statis.ts",
    "chars": 363,
    "preview": "import Request from '@/utils/request';\n\ntype StatisType = 'overview' | 'new-visitor' | 'basic-overview';\n\n// overview(概览"
  },
  {
    "path": "src/api/swiper.ts",
    "chars": 821,
    "preview": "import Request from '@/utils/request'\nimport { Swiper } from '@/types/app/swiper'\n\n// 新增轮播图\nexport const addSwiperDataAP"
  },
  {
    "path": "src/api/tag.ts",
    "chars": 861,
    "preview": "import Request from '@/utils/request'\nimport { Tag } from '@/types/app/tag'\n\n// 新增标签\nexport const addTagDataAPI = (data:"
  },
  {
    "path": "src/api/user.ts",
    "chars": 1143,
    "preview": "import Request from '@/utils/request'\nimport { LoginReturn, EditUser, Login, User, UserInfo } from '@/types/app/user'\n\n/"
  },
  {
    "path": "src/api/wall.ts",
    "chars": 1074,
    "preview": "import Request from '@/utils/request'\nimport { Wall, Cate } from '@/types/app/wall'\n\n// 新增留言\nexport const addWallDataAPI"
  },
  {
    "path": "src/api/web.ts",
    "chars": 986,
    "preview": "import Request from '@/utils/request'\nimport { Web, WebType } from '@/types/app/web'\n\n// 新增网站\nexport const addLinkDataAP"
  },
  {
    "path": "src/components/CardDataStats/index.tsx",
    "chars": 725,
    "preview": "import { ReactNode } from 'react';\n\ninterface Props {\n  title: string;\n  total: string;\n  children: ReactNode;\n}\n\nexport"
  },
  {
    "path": "src/components/ClickOutside.tsx",
    "chars": 1316,
    "preview": "import React, { useRef, useEffect } from 'react';\n\ninterface Props {\n  children: React.ReactNode;\n  exceptionRef?: React"
  },
  {
    "path": "src/components/Drawer/index.tsx",
    "chars": 1088,
    "preview": "import { Drawer } from 'antd';\nimport { CloseOutlined } from '@ant-design/icons';\n\ninterface Props {\n  title: string;\n  "
  },
  {
    "path": "src/components/Dropdowns/DropdownDefault.tsx",
    "chars": 6556,
    "preview": "import { useEffect, useRef, useState } from 'react';\n\nconst DropdownDefault = () => {\n  const [dropdownOpen, setDropdown"
  },
  {
    "path": "src/components/Empty/index.tsx",
    "chars": 225,
    "preview": "import Empty from './empty.svg';\n\nexport default () => {\n  return (\n    <div className=\"flex flex-col justify-center ite"
  },
  {
    "path": "src/components/FileUpload/index.tsx",
    "chars": 6214,
    "preview": "import { useRef, useState, useCallback } from 'react';\nimport { InboxOutlined } from '@ant-design/icons';\nimport { messa"
  },
  {
    "path": "src/components/HasPermission/index.tsx",
    "chars": 269,
    "preview": "import { useHasPermission } from '@/utils/permission';\n\ninterface Props {\n    code: string;\n    children: React.ReactNod"
  },
  {
    "path": "src/components/Header/DarkModeSwitcher.tsx",
    "chars": 4420,
    "preview": "import { useConfigStore } from '../../stores';\n\nconst DarkModeSwitcher = () => {\n  const colorMode = useConfigStore((sta"
  },
  {
    "path": "src/components/Header/DropdownUser.tsx",
    "chars": 9970,
    "preview": "import { Link } from 'react-router-dom';\nimport { Dropdown, MenuProps } from 'antd';\n\nimport { useUserStore } from '@/st"
  },
  {
    "path": "src/components/Header/index.tsx",
    "chars": 5435,
    "preview": "import { Link } from 'react-router-dom';\nimport { useEffect, useState } from 'react';\nimport { Skeleton } from 'antd';\ni"
  },
  {
    "path": "src/components/Loader/index.tsx",
    "chars": 250,
    "preview": "export default () => {\n  return (\n    <div className=\"flex h-screen items-center justify-center bg-white\">\n      <div cl"
  },
  {
    "path": "src/components/Material/index.scss",
    "chars": 458,
    "preview": ".FilePage {\n    .ant-image {\n        display: block;\n        width: 100%;\n\n        .ant-image-img {\n            width: 1"
  },
  {
    "path": "src/components/Material/index.tsx",
    "chars": 7412,
    "preview": "import { useEffect, useState, useRef } from 'react';\nimport { Image, Spin, message, Button } from 'antd';\nimport { Check"
  },
  {
    "path": "src/components/NotFound/index.tsx",
    "chars": 384,
    "preview": "import { Button, Result } from 'antd'\n\nexport default () => {\n    return (\n        <>\n            <Result\n              "
  },
  {
    "path": "src/components/PageTab/index.tsx",
    "chars": 3663,
    "preview": "import { useEffect, useRef } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { AiOutli"
  },
  {
    "path": "src/components/PageTitle.tsx",
    "chars": 288,
    "preview": "import { useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\n\ninterface Props {\n  title: string;\n}"
  },
  {
    "path": "src/components/RandomAvatar/index.tsx",
    "chars": 563,
    "preview": "import { useMemo } from 'react';\nimport { createAvatar } from '@dicebear/core';\n\n// 使用指定风格头像\nimport { pixelArt } from '@"
  },
  {
    "path": "src/components/RouteList/index.tsx",
    "chars": 3642,
    "preview": "import { useEffect } from 'react';\nimport DefaultLayout from '@/layout/DefaultLayout';\nimport { Route, Routes, useLocati"
  },
  {
    "path": "src/components/Sidebar/SidebarLinkGroup.tsx",
    "chars": 472,
    "preview": "import { ReactNode, useState } from 'react';\n\ninterface SidebarLinkGroupProps {\n  children: (handleClick: () => void, op"
  },
  {
    "path": "src/components/Sidebar/index.tsx",
    "chars": 14708,
    "preview": "import React, { useEffect, useRef, useState } from 'react';\nimport { NavLink, useLocation } from 'react-router-dom';\nimp"
  },
  {
    "path": "src/components/StatusTag/index.tsx",
    "chars": 1138,
    "preview": "interface StatusTagProps {\n  status: number | boolean;\n  className?: string;\n  flash?: boolean;\n}\n\nexport default ({ sta"
  },
  {
    "path": "src/components/SystemNotification/index.tsx",
    "chars": 2003,
    "preview": "import { Modal, Button } from 'antd';\nimport { GithubOutlined } from '@ant-design/icons';\n\nconst SHOW_NOTIFICATION_KEY ="
  },
  {
    "path": "src/components/Title/index.tsx",
    "chars": 571,
    "preview": "import { ReactNode } from 'react'\n\ninterface Props {\n    value: string,\n    children?: ReactNode,\n    className?: string"
  },
  {
    "path": "src/components/WangEditor/index.scss",
    "chars": 67,
    "preview": ".w-e-text-container {\n    .w-e-bar {\n        display: none;\n    }\n}"
  },
  {
    "path": "src/components/WangEditor/index.tsx",
    "chars": 1649,
    "preview": "import { useState, useEffect, useImperativeHandle, forwardRef } from 'react';\nimport { Editor, Toolbar } from '@wangedit"
  },
  {
    "path": "src/hooks/useAssistant.tsx",
    "chars": 2851,
    "preview": "import { useState, useEffect } from 'react';\nimport { message } from 'antd';\nimport { testAssistantConnection, callAssis"
  },
  {
    "path": "src/hooks/useAuthRedirect.tsx",
    "chars": 556,
    "preview": "import { useEffect } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { useUserStore } "
  },
  {
    "path": "src/hooks/useLocalStorage.tsx",
    "chars": 1039,
    "preview": "import { useEffect, useState } from 'react';\n\ntype SetValue<T> = T | ((val: T) => T);\n\nfunction useLocalStorage<T>(key: "
  },
  {
    "path": "src/hooks/useVersionData.tsx",
    "chars": 1249,
    "preview": "import { useState, useEffect } from 'react';\nimport axios from 'axios';\n\ninterface Version {\n  name: string;\n  tag_name:"
  },
  {
    "path": "src/layout/DefaultLayout.tsx",
    "chars": 1134,
    "preview": "import { useState, useEffect } from 'react';\nimport Header from '../components/Header/index';\nimport Sidebar from '../co"
  },
  {
    "path": "src/main.tsx",
    "chars": 289,
    "preview": "import ReactDOM from 'react-dom/client';\nimport { BrowserRouter as Router } from 'react-router-dom';\nimport App from './"
  },
  {
    "path": "src/pages/article/components/ArticleExport.tsx",
    "chars": 4198,
    "preview": "import React, { useCallback } from 'react';\nimport { Button, Dropdown, Popconfirm, Tooltip, message } from 'antd';\nimpor"
  },
  {
    "path": "src/pages/article/components/ArticleImportModal.tsx",
    "chars": 8091,
    "preview": "import React, { useState, useRef, useEffect, useCallback, ChangeEvent, DragEvent } from 'react';\nimport { Modal, Button,"
  },
  {
    "path": "src/pages/article/index.tsx",
    "chars": 23619,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Link } from 'react-router-dom';\n\nimport { Table, Button, T"
  },
  {
    "path": "src/pages/assistant/index.tsx",
    "chars": 13543,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Button, Card, Form, Input, Modal, Select, Tooltip, Space, "
  },
  {
    "path": "src/pages/cate/index.scss",
    "chars": 1011,
    "preview": "/* 仅保留 Ant Design Tree 布局覆盖,其余样式均使用 Tailwind 写在 tsx 中 */\n.CatePage {\n    .ant-tree-node-content-wrapper {\n        backgr"
  },
  {
    "path": "src/pages/cate/index.tsx",
    "chars": 10630,
    "preview": "import { useState, useEffect, useRef } from 'react';\n\nimport { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-d"
  },
  {
    "path": "src/pages/comment/index.tsx",
    "chars": 11357,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport dayjs from 'dayjs';\n\nimport { message, Table, Popconfirm, Bu"
  },
  {
    "path": "src/pages/config/index.tsx",
    "chars": 9304,
    "preview": "import { useEffect, useState, useRef } from 'react';\nimport { Table, Button, Modal, Form, message, Card, Tabs, Skeleton "
  },
  {
    "path": "src/pages/create/components/Editor/index.scss",
    "chars": 900,
    "preview": "@use \"./markdown.scss\";\n@reference \"../../../../styles/index.css\";\n\n.bytemd {\n    height: calc(100vh - 200px);\n    borde"
  },
  {
    "path": "src/pages/create/components/Editor/index.tsx",
    "chars": 2463,
    "preview": "import { useState, useEffect } from 'react';\nimport { Spin } from 'antd';\nimport axios from 'axios';\n\nimport { Editor } "
  },
  {
    "path": "src/pages/create/components/Editor/markdown.scss",
    "chars": 3629,
    "preview": ".markdown-body {\n     pre {\n         margin: 15px 0;\n\n         code.hljs {\n             border-radius: 10px;\n           "
  },
  {
    "path": "src/pages/create/components/Editor/plugins.tsx",
    "chars": 5246,
    "preview": "import gemoji from '@bytemd/plugin-gemoji';\nimport gfm from '@bytemd/plugin-gfm';\nimport highlight from '@bytemd/plugin-"
  },
  {
    "path": "src/pages/create/components/PublishForm/index.scss",
    "chars": 67,
    "preview": "// .ant-drawer-content-wrapper {\n//     width: 50% !important;\n// }"
  },
  {
    "path": "src/pages/create/components/PublishForm/index.tsx",
    "chars": 11275,
    "preview": "import { useEffect, useState } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router-dom';\n\nimport { "
  },
  {
    "path": "src/pages/create/index.tsx",
    "chars": 7216,
    "preview": "import { useEffect, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { Button, Card, "
  },
  {
    "path": "src/pages/create_record/index.scss",
    "chars": 365,
    "preview": ".create_record_page {\n  .ant-input:focus {\n    box-shadow: none !important;\n  }\n  \n  .image-container {\n    &.aspect-squ"
  },
  {
    "path": "src/pages/create_record/index.tsx",
    "chars": 12327,
    "preview": "import { useEffect, useState } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router-dom';\nimport { B"
  },
  {
    "path": "src/pages/dashboard/components/HeaderInfo/index.tsx",
    "chars": 911,
    "preview": "\nimport { useUserStore } from '@/stores';\n\nconst HeaderInfo = () => {\n  const { user } = useUserStore();\n\n  return (\n   "
  },
  {
    "path": "src/pages/dashboard/components/Info/index.tsx",
    "chars": 1991,
    "preview": "import { useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { getCommentListAPI"
  },
  {
    "path": "src/pages/dashboard/components/Stats/components/NewOldVisitors/index.tsx",
    "chars": 3783,
    "preview": "import { ApexOptions } from 'apexcharts';\nimport { useEffect, useState } from 'react';\nimport ReactApexChart from 'react"
  },
  {
    "path": "src/pages/dashboard/components/Stats/components/VisitorsStatisChat/index.tsx",
    "chars": 14534,
    "preview": "import { useEffect, useState, useMemo } from 'react';\nimport { Spin } from 'antd';\nimport { ApexOptions } from 'apexchar"
  },
  {
    "path": "src/pages/dashboard/components/Stats/components/VisitorsStatisChat/type.d.ts",
    "chars": 494,
    "preview": "export interface StatisResult {\n  timeSpan: string[];\n  fields: string[];\n  items: [\n      string[][],\n      (string | n"
  },
  {
    "path": "src/pages/dashboard/components/Stats/index.tsx",
    "chars": 3481,
    "preview": "import { useEffect, useState } from 'react';\nimport { Spin } from 'antd';\nimport VisitorsStatisChat from './components/V"
  },
  {
    "path": "src/pages/dashboard/index.tsx",
    "chars": 3357,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Skeleton, Card } from 'antd';\nimport InfoCard from './comp"
  },
  {
    "path": "src/pages/decycle/index.tsx",
    "chars": 10147,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Table, But"
  },
  {
    "path": "src/pages/draft/index.tsx",
    "chars": 9800,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Table, Button, Tag, notification, Popconfirm, Form, Toolti"
  },
  {
    "path": "src/pages/file/index.scss",
    "chars": 458,
    "preview": ".FilePage {\n    .ant-image {\n        display: block;\n        width: 100%;\n\n        .ant-image-img {\n            width: 1"
  },
  {
    "path": "src/pages/file/index.tsx",
    "chars": 11987,
    "preview": "import { useEffect, useState, useRef } from 'react';\nimport { Image, Card, Space, Spin, message, Popconfirm, Button, Dra"
  },
  {
    "path": "src/pages/footprint/index.tsx",
    "chars": 16325,
    "preview": "import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Button, DatePicker, Divider, Form, I"
  },
  {
    "path": "src/pages/iterative/index.tsx",
    "chars": 11535,
    "preview": "import React, { useEffect, useState, useRef } from 'react';\nimport GitHubCalendar from 'react-github-calendar';\nimport d"
  },
  {
    "path": "src/pages/login/index.tsx",
    "chars": 4223,
    "preview": "import { useState } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { useForm } from '"
  },
  {
    "path": "src/pages/page/my.tsx",
    "chars": 48,
    "preview": "export default () => {\n  return <h1>Hello</h1>\n}"
  },
  {
    "path": "src/pages/record/index.tsx",
    "chars": 11861,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Link } from 'react-router-dom';\nimport {\n  Table, Button, "
  },
  {
    "path": "src/pages/setup/components/My/index.tsx",
    "chars": 2279,
    "preview": "import { useEffect, useState } from 'react';\nimport { Form, Input, Button, message } from 'antd';\n\nimport { useUserStore"
  },
  {
    "path": "src/pages/setup/components/Other/index.tsx",
    "chars": 2642,
    "preview": "import { useEffect, useState } from 'react';\nimport { Form, Input, Button, message } from 'antd';\nimport { editWebConfig"
  },
  {
    "path": "src/pages/setup/components/System/index.tsx",
    "chars": 2291,
    "preview": "import { Form, Input, Button, Modal } from 'antd';\nimport { useState } from 'react';\n\nimport { useUserStore } from '@/st"
  },
  {
    "path": "src/pages/setup/components/Theme/components/RecordTheme/index.tsx",
    "chars": 2079,
    "preview": "import { useEffect, useState } from 'react';\nimport { Form, notification, Input, Button } from 'antd';\n\nimport { Theme }"
  },
  {
    "path": "src/pages/setup/components/Theme/components/SynthesisTheme/index.tsx",
    "chars": 6991,
    "preview": "import { useEffect, useState } from 'react';\n\nimport { Alert, Button, Checkbox, Divider, Form, Input, notification } fro"
  },
  {
    "path": "src/pages/setup/components/Theme/components/SynthesisTheme/type.d.ts",
    "chars": 186,
    "preview": "export interface ThemeFormValues {\n  light_logo: string;\n  dark_logo: string;\n  swiper_image: string;\n  swiper_text: str"
  },
  {
    "path": "src/pages/setup/components/Theme/index.tsx",
    "chars": 512,
    "preview": "import { useState } from 'react';\nimport { Segmented } from 'antd';\nimport SynthesisTheme from './components/SynthesisTh"
  },
  {
    "path": "src/pages/setup/components/Web/index.tsx",
    "chars": 3133,
    "preview": "import { useState } from 'react';\nimport { Form, Input, Button, message, DatePicker } from 'antd';\nimport { editWebConfi"
  },
  {
    "path": "src/pages/setup/index.tsx",
    "chars": 5165,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { useSearchParams } from 'react-router-dom';\n\nimport { Card,"
  },
  {
    "path": "src/pages/storage/index.tsx",
    "chars": 15733,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Button, Form, Input, Popconfirm, message, Card, Modal, Sel"
  },
  {
    "path": "src/pages/swiper/index.tsx",
    "chars": 9374,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Table, Button, Image, Form, Input, Tabs, Popconfirm, messa"
  },
  {
    "path": "src/pages/tag/index.tsx",
    "chars": 6977,
    "preview": "import { useState, useEffect, useRef } from 'react';\nimport { Table, Button, Form, Input, Popconfirm, message, Card, Spi"
  },
  {
    "path": "src/pages/wall/index.tsx",
    "chars": 11609,
    "preview": "import { useEffect, useState, useRef } from 'react';\n\nimport { Button, DatePicker, Form, Input, Modal, Popconfirm, Selec"
  },
  {
    "path": "src/pages/web/index.tsx",
    "chars": 19562,
    "preview": "import { useEffect, useState, useRef } from 'react';\n\nimport { Button, Card, Empty, Form, Input, Popconfirm, Select, Spi"
  },
  {
    "path": "src/pages/work/components/List/index.tsx",
    "chars": 8840,
    "preview": "import { useState } from 'react';\n\nimport { Button, Dropdown, message, Modal } from 'antd';\nimport dayjs from 'dayjs';\n\n"
  },
  {
    "path": "src/pages/work/index.tsx",
    "chars": 5235,
    "preview": "import { useEffect, useState, useRef } from 'react';\n\nimport { Card, Spin, Skeleton } from 'antd';\n\nimport { getCommentL"
  },
  {
    "path": "src/services/assistant.ts",
    "chars": 4905,
    "preview": "import { message } from 'antd';\nimport { Assistant } from '@/types/app/assistant';\n\n/**\n * 将用户输入的通用模型名(不区分大小写)映射为实际 API "
  },
  {
    "path": "src/stores/index.ts",
    "chars": 243,
    "preview": "import useWebStore from './modules/web';\nimport useUserStore from './modules/user';\nimport useConfigStore from './module"
  },
  {
    "path": "src/stores/modules/config.ts",
    "chars": 471,
    "preview": "import { create } from 'zustand';\nimport { persist } from 'zustand/middleware';\n\ntype ColorMode = 'light' | 'dark';\n\nint"
  },
  {
    "path": "src/stores/modules/tabs.ts",
    "chars": 2143,
    "preview": "import { create } from 'zustand';\nimport { persist } from 'zustand/middleware';\n\nexport interface TabItem {\n  path: stri"
  },
  {
    "path": "src/stores/modules/user.ts",
    "chars": 1368,
    "preview": "import { Permission } from '@/types/app/permission';\nimport { Role } from '@/types/app/role';\nimport { User } from '@/ty"
  },
  {
    "path": "src/stores/modules/web.ts",
    "chars": 264,
    "preview": "import { Web } from '@/types/app/config';\nimport { create } from 'zustand';\n\ninterface WebStore {\n  web: Web;\n  setWeb: "
  },
  {
    "path": "src/styles/antd.scss",
    "chars": 3453,
    "preview": "/* ------------------ 自定义Antd组件样式开始 ------------------ */\n\n// 只取消颜色相关的过渡效果, 其他过渡保持正常 (暗色切换时颜色变化不一致会导致效果不好)\n* {\n    trans"
  },
  {
    "path": "src/styles/custom.scss",
    "chars": 1654,
    "preview": "// 编辑器样式\n.vditor .vditor-reset {\n    .dark & {\n        color: #fff;\n    }\n}\n\n/* 文本渐变 */\n.text-gradient {\n    display: in"
  },
  {
    "path": "src/styles/index.css",
    "chars": 2269,
    "preview": "@import \"tailwindcss/theme.css\" layer(theme);\n@import \"tailwindcss/preflight.css\" layer(custom-base);\n@import \"tailwindc"
  },
  {
    "path": "src/styles/sty.ts",
    "chars": 177,
    "preview": "export const titleSty = 'border-stroke dark:border-strokedark [&>.ant-card-head]:border-stroke dark:[&>.ant-card-head]:b"
  },
  {
    "path": "src/styles/var.scss",
    "chars": 16,
    "preview": "$color: #60a5fa;"
  },
  {
    "path": "src/types/app/album.d.ts",
    "chars": 260,
    "preview": "export interface AlbumCate {\n  id?: number;\n  name: string;\n  cover: string;\n  images: string[];\n  count: number;\n}\n\nexp"
  },
  {
    "path": "src/types/app/article.d.ts",
    "chars": 869,
    "preview": "import { Cate } from './cate';\nimport { Tag } from './tag';\n\nexport type Status = 'default' | 'no_home' | 'hide';\n\nexpor"
  },
  {
    "path": "src/types/app/assistant.d.ts",
    "chars": 129,
    "preview": "export interface Assistant {\n  id: number;\n  name: string;\n  url: string;\n  key: string;\n  model: string;\n  isDefault: n"
  },
  {
    "path": "src/types/app/brand.d.ts",
    "chars": 136,
    "preview": "export type BRAND = {\n  logo: string;\n  name: string;\n  visitors: number;\n  revenues: string;\n  sales: number;\n  convers"
  },
  {
    "path": "src/types/app/cate.d.ts",
    "chars": 285,
    "preview": "export interface Cate {\n  id?: number;\n  name: string;\n  mark: string;\n  url: string;\n  icon: string;\n  level: number;\n "
  },
  {
    "path": "src/types/app/chat.d.ts",
    "chars": 128,
    "preview": "export type Chat = {\n  avatar: string;\n  name: string;\n  text: string;\n  time: number;\n  textCount: number;\n  color: str"
  },
  {
    "path": "src/types/app/comment.d.ts",
    "chars": 440,
    "preview": "export interface Comment {\n  id?: number;\n  name: string;\n  avatar: string;\n  email: string | null;\n  url: string;\n  con"
  },
  {
    "path": "src/types/app/config.d.ts",
    "chars": 1185,
    "preview": "// 网站配置类型\nexport type WebConfigType = 'web' | 'theme' | 'other';\n\nexport interface Social {\n  name: string;\n  url: strin"
  },
  {
    "path": "src/types/app/email.d.ts",
    "chars": 547,
    "preview": "export interface Email {\n  /*邮件接收者 */\n  to?: string;\n  /*邮件标题 */\n  subject: string;\n  /*邮件接收者 */\n  recipient: string;\n}\n"
  },
  {
    "path": "src/types/app/file.d.ts",
    "chars": 256,
    "preview": "export type DirList = 'default' | 'article' | 'swiper' | string;\n\nexport interface File {\n  name: string;\n  size: number"
  },
  {
    "path": "src/types/app/footprint.d.ts",
    "chars": 255,
    "preview": "export interface Footprint {\n  id: number;\n  title: string;\n  address: string;\n  content: string;\n  position: string;\n  "
  },
  {
    "path": "src/types/app/oss.d.ts",
    "chars": 227,
    "preview": "export interface Oss {\n  id?: number;\n  platform: string;\n  platformName?: string;\n  accessKey: string;\n  secretKey: str"
  },
  {
    "path": "src/types/app/package.d.ts",
    "chars": 101,
    "preview": "export type Package = {\n  name: string;\n  price: number;\n  invoiceDate: string;\n  status: string;\n};\n"
  },
  {
    "path": "src/types/app/permission.d.ts",
    "chars": 120,
    "preview": "export interface Permission {\n  id: number;\n  name: string;\n  description: string;\n  group: string;\n  roleId: number;\n}\n"
  },
  {
    "path": "src/types/app/product.d.ts",
    "chars": 131,
    "preview": "export type Product = {\n  image: string;\n  name: string;\n  category: string;\n  price: number;\n  sold: number;\n  profit: "
  },
  {
    "path": "src/types/app/record.d.ts",
    "chars": 122,
    "preview": "export interface Record {\n  id?: number;\n  content: string;\n  images: string | string[];\n  createTime?: string | Dayjs;\n"
  },
  {
    "path": "src/types/app/role.d.ts",
    "chars": 95,
    "preview": "export interface Role {\n  id: number;\n  name: string;\n  mark: string;\n  description: string;\n}\n"
  },
  {
    "path": "src/types/app/route.d.ts",
    "chars": 81,
    "preview": "export interface Route {\n  id?: number;\n  path: string;\n  description: string;\n}\n"
  },
  {
    "path": "src/types/app/rss.d.ts",
    "chars": 123,
    "preview": "import { Web } from './web';\n\nexport interface Rss extends Omit<Web, 'id' | 'type' | 'typeId' | 'rss'> {\n  type: string;"
  },
  {
    "path": "src/types/app/swiper.d.ts",
    "chars": 138,
    "preview": "export interface Swiper {\n  id?: number;\n  title: string;\n  description: string;\n  url: string;\n  image: string;\n  creat"
  },
  {
    "path": "src/types/app/tag.d.ts",
    "chars": 56,
    "preview": "export interface Tag {\n  id?: number;\n  name: string;\n}\n"
  },
  {
    "path": "src/types/app/user.d.ts",
    "chars": 663,
    "preview": "export interface Login {\n  username: string;\n  password: string;\n}\n\nexport interface UserInfo {\n  id?: number;\n  name: s"
  },
  {
    "path": "src/types/app/wall.d.ts",
    "chars": 492,
    "preview": "export interface Cate {\n  id: number;\n  name: string;\n  mark: string;\n  order: number;\n}\n\nexport interface Wall {\n  id: "
  },
  {
    "path": "src/types/app/web.d.ts",
    "chars": 337,
    "preview": "export interface WebType {\n  id: number;\n  name: string;\n  order: number;\n  isAdmin: number;\n}\n\nexport interface Web {\n "
  },
  {
    "path": "src/types/env.d.ts",
    "chars": 335,
    "preview": "interface ImportMetaEnv {\n  readonly VITE_PROJECT_API: string;\n\n  readonly VITE_BAIDU_TONGJI_SITE_ID: string;\n  readonly"
  },
  {
    "path": "src/types/global.d.ts",
    "chars": 259,
    "preview": "declare module '*.png';\ndeclare module '*.svg';\ndeclare module '*.jpeg';\ndeclare module '*.jpg';\n\ndeclare module '*.svg?"
  },
  {
    "path": "src/types/response.d.ts",
    "chars": 582,
    "preview": "interface Response<T> {\n  code: number;\n  message: string;\n  data: T;\n}\n\ninterface Paginate<T> {\n  next: boolean;\n  prev"
  },
  {
    "path": "src/utils/index.ts",
    "chars": 299,
    "preview": "// 对象转url参数\nexport const ObjectToUrlParam = (obj: object): string => {\n    return obj && new URLSearchParams(\n        Ob"
  },
  {
    "path": "src/utils/permission.ts",
    "chars": 3447,
    "preview": "import { Permission } from '@/types/app/permission';\n\n// 判断是否有权限\nexport const useHasPermission = (code: string) => {\n   "
  },
  {
    "path": "src/utils/request.ts",
    "chars": 2569,
    "preview": "import axios, { AxiosError, AxiosResponse, InternalAxiosRequestConfig } from 'axios';\nimport { Modal, notification } fro"
  },
  {
    "path": "src/utils/route.tsx",
    "chars": 3011,
    "preview": "import { BiEditAlt, BiFolderOpen, BiHomeSmile, BiSliderAlt, BiCategoryAlt, BiBug } from 'react-icons/bi';\nimport { TbBra"
  },
  {
    "path": "tsconfig.json",
    "chars": 660,
    "preview": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ESNext\"],\n    \"module\": \"ESNext\",\n "
  },
  {
    "path": "tsconfig.node.json",
    "chars": 213,
    "preview": "{\n  \"compilerOptions\": {\n    \"composite\": true,\n    \"skipLibCheck\": true,\n    \"module\": \"ESNext\",\n    \"moduleResolution\""
  },
  {
    "path": "vercel.json",
    "chars": 121,
    "preview": "{\n    \"rewrites\": [\n        {\n            \"source\": \"/:path*\",\n            \"destination\": \"/index.html\"\n        }\n    ]\n"
  },
  {
    "path": "vite.config.js",
    "chars": 638,
    "preview": "/* eslint-disable no-undef */\nimport { defineConfig } from 'vite'\nimport sassDts from 'vite-plugin-sass-dts';\nimport rea"
  }
]

About this extraction

This page contains the full source code of the LiuYuYang01/ThriveX-Admin GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 159 files (500.0 KB), approximately 143.6k tokens, and a symbol index with 126 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!