[
  {
    "path": ".dockerignore",
    "content": "node_modules\nnpm-debug.log\nDockerfile\n.dockerignore"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.local\n\n# Editor directories and files\n.vscode/*\n!.vscode/extensions.json\n.idea\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"singleQuote\": true,\n  \"jsxSingleQuote\": false,\n  \"printWidth\": 999,\n  \"semi\": true,\n  \"bracketSpacing\": true,\n  \"arrowParens\": \"always\"\n}\n"
  },
  {
    "path": ".vite/deps_temp_474a67bf/package.json",
    "content": "{\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n    <a href=\"https://liuyuyang.net\" target=\"_blank\">\n        <img width=\"120\" src=\"https://bu.dusays.com/2024/11/17/6739adf188f64.png\" alt=\"ThriveX logo\" />\n    </a>\n</p>\n<h1 align=\"center\" style=\"margin: 20px 0; font-weight: 700; padding-bottom:10px;\">ThriveX Admin</h1>\n\n\n<p align=\"center\">\n    <a href=\"https://github.com/LiuYuYang01/ThriveX-Admin/blob/main/LICENSE\" target=\"_blank\">\n        <img alt=\"License: AGPL-3.0\" src=\"https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=flat-square&logo=gnu\" />\n    </a>\n    <a href=\"https://github.com/LiuYuYang01/ThriveX-Admin/stargazers\" target=\"_blank\">\n        <img alt=\"Stars\" src=\"https://img.shields.io/github/stars/LiuYuYang01/ThriveX-Admin?style=flat-square&logo=github&color=gold\" />\n    </a>\n    <a href=\"https://github.com/LiuYuYang01/ThriveX-Admin/network\" target=\"_blank\">\n        <img alt=\"Forks\" src=\"https://img.shields.io/github/forks/LiuYuYang01/ThriveX-Admin?style=flat-square&logo=github\" />\n    </a>\n</p>\n\n## 📖 项目简介\n\n**ThriveX Admin** 是 ThriveX 博客系统的现代化管理后台，采用 Next.js 15 + React 19 + Ant Design 构建，提供全功能的内容管理、用户管理、系统配置等一站式解决方案。\n\n作为 ThriveX 全栈解决方案的核心组成部分，Admin 控制端与前端博客（[ThriveX-Blog](https://github.com/LiuYuYang01/ThriveX-Blog)）和后端服务（[ThriveX-Server](https://github.com/LiuYuYang01/ThriveX-Server)）共同构成了一个完整的开源博客生态系统。\n\n\n\n## ✨ 核心特性\n\n- 🎨 **现代化 UI**：基于 Ant Design 6.x + Tailwind CSS 4.x，提供优雅的视觉体验\n- 📝 **富文本编辑器**：集成 WangEditor + ByteMD，支持 Markdown/HTML 双模式\n- 📊 **数据可视化**：ECharts 图表展示访问统计、文章分类、用户增长等关键指标\n- 🎯 **权限管理**：细粒度的 RBAC 权限控制，支持角色分配与权限配置\n- 📁 **文件管理**：支持本地存储与多种 OSS 服务商（阿里云、腾讯云、七牛云等）\n- 📧 **邮件系统**：内置 SMTP 邮件服务，支持评论回复、通知推送\n- 📱 **响应式设计**：完美适配桌面端与平板设备\n- 🌓 **暗色模式**：支持主题切换，保护用户视力\n- ⚡ **性能优化**：代码分割、懒加载、缓存策略，确保极致性能\n\n\n\n## 📸 界面预览\n\n<div align=\"center\">\n    <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)\" />\n</div>\n\n\n## 🚀 快速开始\n\nhttps://docs.liuyuyang.net/docs/项目部署/1Panel.html\n\n\n\n## 📂 项目结构\n\n```\nThriveX-Admin/\n├── src/\n│   ├── api/              # API 接口定义\n│   ├── components/       # 公共组件\n│   ├── hooks/            # 自定义 Hooks\n│   ├── layout/           # 布局组件\n│   ├── pages/            # 页面路由\n│   │   ├── article/      # 文章管理\n│   │   ├── cate/         # 分类管理\n│   │   ├── comment/      # 评论管理\n│   │   ├── config/       # 系统配置\n│   │   ├── dashboard/    # 仪表盘\n│   │   ├── file/         # 文件管理\n│   │   ├── storage/      # 存储配置\n│   │   └── user/         # 用户管理\n│   ├── services/         # 服务层\n│   ├── stores/           # 状态管理\n│   ├── styles/           # 样式文件\n│   ├── types/            # TypeScript 类型定义\n│   └── utils/            # 工具函数\n├── public/               # 静态资源\n├── .env                  # 环境变量配置\n├── package.json          # 项目配置\n└── vite.config.js        # Vite 配置\n```\n\n\n\n## 🌐 项目链接\n\n| 名称        | 链接                                                                                         | 说明         |\n| ----------- | -------------------------------------------------------------------------------------------- | ------------ |\n| 博客预览    | [https://liuyuyang.net](https://liuyuyang.net)                                               | 前端博客展示 |\n| 官网地址    | [https://thrivex.liuyuyang.net](https://thrivex.liuyuyang.net)                               | 项目官网     |\n| 文档中心    | [https://docs.liuyuyang.net](https://docs.liuyuyang.net)                                     | 使用文档     |\n| GitHub 主页 | [https://github.com/LiuYuYang01/ThriveX-Admin](https://github.com/LiuYuYang01/ThriveX-Admin) | 源码仓库     |\n\n\n\n## 📝 开源协议\n\n本项目采用 **AGPL-3.0** 许可证。\n\n**使用须知**：\n\n- ✅ 允许商业使用、修改、分发\n- ✅ 必须保留原始版权说明\n- ✅ 修改后的版本必须开源\n- ❌ 禁止任何闭源商业行为\n\n在项目 Star 突破 2K 后，您可以自由选择保留或删除版权信息。\n\n\n\n## ⭐ Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=LiuYuYang01/ThriveX-Admin&type=Date)](https://star-history.com/#LiuYuYang01/ThriveX-Admin&Date)\n\n\n\n## 👨‍💻 作者信息\n\n**刘宇阳**\n\n- GitHub: [@LiuYuYang01](https://github.com/LiuYuYang01)\n- 我的博客: [https://liuyuyang.net](https://liuyuyang.net)\n- 关于我：[https://my.liuyuyang.net](https://my.liuyuyang.net)\n- 邮箱: [liuyuyang1024@yeah.net](mailto:liuyuyang1024@yeah.net)\n\n\n\n## 💬 交流群\n\n欢迎加入 ThriveX 官方交流群，与开发者和其他用户交流：\n\n<div align=\"center\">\n    <img src=\"https://bu.dusays.com/2025/06/03/683e96eb43ad8.jpg\" alt=\"WeChat Group\" style=\"width: 300px; border-radius: 8px;\" />\n</div>\n\n**加群方式**：添加微信 `liuyuyang2023`，备注 \"ThriveX\"\n\n\n\n## 🙏 鸣谢\n\n感谢所有为 ThriveX 项目做出贡献的开发者和用户！\n\n特别感谢以下项目提供的灵感与技术支持：\n\n- [zw-blog](https://blog.zwying.com/)\n- [blatr](https://www.blatr.cn/)\n- [poetize](https://poetize.cn/)\n\n\n\n## 🔒 免责声明\n\n本项目仅供学习交流使用，不提供任何技术咨询或技术支持服务。使用者在使用本项目时应遵守当地法律法规，不得用于任何违法活动。\n"
  },
  {
    "path": "dockerfile",
    "content": "# 使用官方的Node.js镜像作为基础镜像\nFROM registry.cn-hangzhou.aliyuncs.com/liuyi778/node-20-alpine AS builder\n\n# 设置工作目录\nWORKDIR /thrive\n\n# 复制 package.json 和 package-lock.json\nCOPY package*.json ./\n\n# 配置 npm 镜像源\nRUN npm config set registry https://registry.npmmirror.com\n\n# 安装依赖\nRUN npm install\n\n# 复制项目文件\nCOPY . .\n\n# 构建项目\nRUN npm run build\n\n# 使用 Nginx 作为生产环境的基础镜像\nFROM nginx:alpine\n\n# 复制构建输出到 Nginx 的默认静态文件目录\nCOPY --from=builder /thrive/dist /usr/share/nginx/html\n\n# 暴露端口\nEXPOSE 80\n\n# 启动 Nginx\nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n"
  },
  {
    "path": "eslint.config.js",
    "content": "import js from '@eslint/js';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\nimport pluginReact from 'eslint-plugin-react';\nimport { defineConfig } from 'eslint/config';\nimport reactHooks from 'eslint-plugin-react-hooks';\nimport reactRefresh from 'eslint-plugin-react-refresh';\n\nexport default defineConfig([\n  { ignores: ['dist'] },\n  {\n    files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n    plugins: { js },\n    extends: ['js/recommended'],\n  },\n  {\n    files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n    languageOptions: { globals: globals.browser },\n  },\n  {\n    plugins: {\n      'react-hooks': reactHooks,\n      'react-refresh': reactRefresh,\n    },\n  },\n  tseslint.configs.recommended,\n  pluginReact.configs.flat.recommended,\n  {\n    settings: {\n      react: {\n        // 从 package.json 自动检测 React 版本\n        version: 'detect',\n      },\n    },\n  },\n  {\n    rules: {\n      'no-unused-vars': 'off', // 关闭未使用变量的检查\n      'react-refresh/only-export-components': 'off',\n      'react/display-name': 'off',\n      // 约束js使用单引号，允许jsx双引号\n      quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],\n      'jsx-quotes': ['error', 'prefer-double'],\n      'react-hooks/exhaustive-deps': 'off',\n      'react/react-in-jsx-scope': 'off',\n      // 禁止使用 any 类型\n      '@typescript-eslint/no-explicit-any': 'error',\n    },\n  },\n]);\n"
  },
  {
    "path": "index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <link rel=\"icon\" type=\"image/svg+xml\" href=\"/favicon.ico\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>ThriveX 现代化博客管理系统</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"thrivex-admin\",\n  \"private\": true,\n  \"version\": \"3.0\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"eslint . && vite\",\n    \"build\": \"eslint . && vite build\",\n    \"preview\": \"vite preview\",\n    \"lint\": \"eslint .\"\n  },\n  \"author\": {\n    \"name\": \"刘宇阳\",\n    \"email\": \"liuyuyang1024@yeah.net\",\n    \"url\": \"https://liuyuyang.net\"\n  },\n  \"engines\": {\n    \"node\": \">=20\",\n    \"npm\": \">=10\"\n  },\n  \"dependencies\": {\n    \"@ant-design/icons\": \"^6.1.0\",\n    \"@bytemd/plugin-gemoji\": \"^1.21.0\",\n    \"@bytemd/plugin-gfm\": \"^1.21.0\",\n    \"@bytemd/plugin-highlight\": \"^1.21.0\",\n    \"@bytemd/plugin-math\": \"^1.21.0\",\n    \"@bytemd/react\": \"^1.21.0\",\n    \"@codemirror/lang-json\": \"^6.0.2\",\n    \"@dicebear/collection\": \"^7.0.0\",\n    \"@dicebear/core\": \"^7.0.0\",\n    \"@uiw/react-codemirror\": \"^4.23.14\",\n    \"@wangeditor-next/editor\": \"^5.6.45\",\n    \"@wangeditor-next/editor-for-react\": \"^1.0.10\",\n    \"antd\": \"^6.3.1\",\n    \"apexcharts\": \"^4.7.0\",\n    \"axios\": \"^1.7.2\",\n    \"bytemd\": \"^1.22.0\",\n    \"compressorjs\": \"^1.2.1\",\n    \"dayjs\": \"^1.11.13\",\n    \"echarts\": \"^5.6.0\",\n    \"echarts-for-react\": \"^3.0.2\",\n    \"eslint-plugin-react-hooks\": \"^5.2.0\",\n    \"file-saver\": \"^2.0.5\",\n    \"highlight.js\": \"^11.11.1\",\n    \"jszip\": \"^3.10.1\",\n    \"katex\": \"^0.16.11\",\n    \"react\": \"19.2.4\",\n    \"react-apexcharts\": \"^1.7.0\",\n    \"react-dom\": \"19.2.4\",\n    \"react-github-calendar\": \"^4.2.2\",\n    \"react-icons\": \"^4.12.0\",\n    \"react-masonry-css\": \"^1.0.16\",\n    \"react-router-dom\": \"^6.14.2\",\n    \"rehype-callouts\": \"^1.4.1\",\n    \"remark-mark-highlight\": \"^0.1.1\",\n    \"sass\": \"^1.77.8\",\n    \"unified\": \"^11.0.4\",\n    \"unist-util-visit\": \"^5.0.0\",\n    \"vite\": \"^7.3.1\",\n    \"vite-plugin-sass-dts\": \"^1.3.25\",\n    \"zustand\": \"^4.5.4\"\n  },\n  \"devDependencies\": {\n    \"@eslint/js\": \"^9.31.0\",\n    \"@tailwindcss/postcss\": \"^4.2.1\",\n    \"@types/file-saver\": \"^2.0.7\",\n    \"@types/hast\": \"^3.0.4\",\n    \"@types/react\": \"19.2.14\",\n    \"@types/react-dom\": \"19.2.3\",\n    \"@vitejs/plugin-react\": \"^4.0.3\",\n    \"codemod\": \"^1.5.4\",\n    \"eslint\": \"^9.31.0\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-refresh\": \"^0.4.20\",\n    \"globals\": \"^16.3.0\",\n    \"postcss\": \"^8.4.27\",\n    \"prettier\": \"^3.0.0\",\n    \"prettier-plugin-tailwindcss\": \"^0.7.2\",\n    \"tailwindcss\": \"^4.2.1\",\n    \"typescript-eslint\": \"^8.37.0\"\n  },\n  \"pnpm\": {\n    \"onlyBuiltDependencies\": [\n      \"@parcel/watcher\",\n      \"es5-ext\",\n      \"esbuild\",\n      \"sharp\"\n    ]\n  }\n}\n"
  },
  {
    "path": "postcss.config.cjs",
    "content": "// eslint-disable-next-line no-undef\nmodule.exports = {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "public/_redirects",
    "content": "/* /index.html 200"
  },
  {
    "path": "src/App.tsx",
    "content": "import { useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport useAuthRedirect from '@/hooks/useAuthRedirect';\nimport { App as AntdApp, ConfigProvider, theme } from 'antd';\nimport RouteList from './components/RouteList';\nimport '@/styles/antd.scss';\n\nimport { getWebConfigDataAPI } from '@/api/config';\nimport { useWebStore, useUserStore, useConfigStore } from './stores';\nimport { Web } from './types/app/config';\n\nimport zhCN from 'antd/locale/zh_CN';\nimport 'dayjs/locale/zh-cn';\n\nfunction App() {\n  useAuthRedirect();\n\n  const token = useUserStore((state) => state.token);\n  const colorMode = useConfigStore((state) => state.colorMode);\n  const { pathname } = useLocation();\n\n  useEffect(() => {\n    window.scrollTo(0, 0);\n  }, [pathname]);\n\n  const setWeb = useWebStore((state) => state.setWeb);\n  const getWebData = async () => {\n    if (!token) return;\n    const { data } = await getWebConfigDataAPI<{ value: Web }>('web');\n    setWeb(data.value);\n  };\n\n  useEffect(() => {\n    getWebData();\n  }, [token]);\n\n  return (\n    <ConfigProvider\n      theme={{\n        token: {\n          colorPrimary: '#60a5fa',\n          borderRadius: 6,\n          colorBgBase: colorMode === 'dark' ? '#263444' : '#ffffff',\n          colorTextBase: colorMode === 'dark' ? '#e0e0e0' : '#000000',\n          ...(colorMode === 'dark' && {\n            colorBgLayout: '#263444',\n            colorBgContainer: '#263444',\n            colorBgElevated: '#263444',\n            colorBgSpotlight: '#263444',\n          }),\n        },\n        algorithm: colorMode === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm,\n      }}\n      locale={zhCN}\n    >\n      <AntdApp>\n        <RouteList />\n      </AntdApp>\n    </ConfigProvider>\n  );\n}\n\nexport default App;\n"
  },
  {
    "path": "src/api/album_cate.ts",
    "content": "import Request from '@/utils/request'\nimport { AlbumCate, AlbumImage } from '@/types/app/album'\n\n// 新增相册\nexport const addAlbumCateDataAPI = (data: AlbumCate) => Request('POST', '/album/cate', { data })\n\n// 删除相册\nexport const delAlbumCateDataAPI = (id: number) => Request('DELETE', `/album/cate/${id}`)\n\n// 修改相册\nexport const editAlbumCateDataAPI = (data: AlbumCate) => Request('PATCH', '/album/cate', { data })\n\n// 获取相册\nexport const getAlbumCateDataAPI = (id?: number) => Request<AlbumCate>('GET', `/album/cate/${id}`)\n\n// 获取相册列表\nexport const getAlbumCateListAPI = (data?: QueryData) => Request<AlbumCate[]>('POST', '/album/cate/list', {\n  data: { ...data?.query }\n});\n\n// 分页获取相册列表\nexport const getAlbumCatePagingAPI = (data?: QueryData) => Request<Paginate<AlbumCate[]>>('POST', `/album/cate/paging`, {\n  data: { ...data?.query },\n  params: {\n    ...data?.pagination\n  }\n})\n\n// 获取指定相册中的所有照片\nexport const getImagesByAlbumIdAPI = (id: number, page: number = 1, size: number = 10) =>\n  Request<Paginate<AlbumImage[]>>('GET', `/album/cate/${id}/images`, {\n    params: {\n      page,\n      size\n    }\n  })"
  },
  {
    "path": "src/api/album_image.ts",
    "content": "import Request from '@/utils/request'\nimport { AlbumImage } from '@/types/app/album'\n\n// 新增照片\nexport const addAlbumImageDataAPI = (data: AlbumImage) => Request('POST', '/album/image', { data })\n\n// 删除照片\nexport const delAlbumImageDataAPI = (id: number) => Request('DELETE', `/album/image/${id}`)\n\n// 修改照片\nexport const editAlbumImageDataAPI = (data: AlbumImage) => Request('PATCH', '/album/image', { data })\n\n// 获取照片\nexport const getAlbumImageDataAPI = (id?: number) => Request<AlbumImage>('GET', `/album/image/${id}`)\n\n// 获取照片列表\nexport const getAlbumImageListAPI = (data?: QueryData) => Request<AlbumImage[]>('POST', '/album/image/list', {\n  data: { ...data?.query }\n});\n\n// 分页获取照片列表\nexport const getAlbumImagePagingAPI = (data?: QueryData) => Request<Paginate<AlbumImage[]>>('POST', `/album/image/paging`, {\n  data: { ...data?.query },\n  params: {\n    ...data?.pagination\n  }\n})"
  },
  {
    "path": "src/api/article.ts",
    "content": "import Request from '@/utils/request';\nimport { Article, ArticleFilterQueryParams } from '@/types/app/article';\n\n// 新增文章\nexport const addArticleDataAPI = (data: Article) =>\n  Request('POST', '/article', { data });\n\n// 删除文章\nexport const delArticleDataAPI = (id: number, isDel?: boolean) =>\n  Request('DELETE', isDel ? `/article/${id}/1` : `/article/${id}/0`);\n\n// 批量删除文章\nexport const delBatchArticleDataAPI = (ids: number[]) =>\n  Request('DELETE', '/article/batch', { data: ids });\n// 还原被删除的文章\nexport const reductionArticleDataAPI = (id: number) =>\n  Request('PATCH', `/article/reduction/${id}`);\n\n// 编辑文章\nexport const editArticleDataAPI = (data: Article) =>\n  Request('PATCH', '/article', { data });\n\n// 获取文章\nexport const getArticleDataAPI = (id?: number) => Request<Article>('GET', `/article/${id}`)\n\n// 获取文章列表\nexport const getArticlePagingAPI = (params?: ArticleFilterQueryParams) => Request<Paginate<Article[]>>('GET', `/article`, { params })\n\n// 导入文章\nexport const importArticleDataAPI = (list: File[]) => {\n  const formData = new FormData();\n\n  list.forEach((file) => {\n    formData.append(`list`, file);\n  });\n\n  return Request('POST', '/article/import', {\n    data: formData,\n    headers: {\n      'Content-Type': 'multipart/form-data'\n    }\n  });\n}"
  },
  {
    "path": "src/api/assistant.ts",
    "content": "import Request from '@/utils/request'\nimport { Assistant } from '@/types/app/assistant'\n\n// 新增助手\nexport const addAssistantDataAPI = (data: Assistant) => Request('POST', '/assistant', { data })\n\n// 删除助手\nexport const delAssistantDataAPI = (id: number) => Request('DELETE', `/assistant/${id}`)\n\n// 修改助手\nexport const editAssistantDataAPI = (data: Assistant) => Request('PATCH', '/assistant', { data })\n\n// 获取助手\nexport const getAssistantDataAPI = (id?: number) => Request<Assistant>('GET', `/assistant/${id}`)\n\n// 获取助手列表\nexport const getAssistantListAPI = (data?: QueryData) => Request<Assistant[]>('POST', '/assistant/list', {\n    data: { ...data?.query }\n});\n\n// 设置默认助手\nexport const setDefaultAssistantAPI = (id: number) => Request('PATCH', `/assistant/default/${id}`)"
  },
  {
    "path": "src/api/auth.ts",
    "content": "import { LoginReturn } from '@/types/app/user'\nimport Request from '@/utils/request'\n\n// 授权 github 登录\nexport const authGitHubLoginAPI = (code: string) => Request<LoginReturn>('POST', `/auth/github/login?code=${code}`)\n\n// 绑定 github 登录\nexport const bindGitHubLoginAPI = (code: string, userId: string) => Request('POST', `/auth/github/bind?code=${code}&userId=${userId}`)"
  },
  {
    "path": "src/api/cate.ts",
    "content": "import Request from '@/utils/request'\nimport { Cate, CateFilterQueryParams } from '@/types/app/cate'\n\n// 新增分类\nexport const addCateDataAPI = (data: Cate) => Request('POST', '/cate', { data })\n\n// 删除分类\nexport const delCateDataAPI = (id: number) => Request('DELETE', `/cate/${id}`)\n\n// 修改分类\nexport const editCateDataAPI = (data: Cate) => Request('PATCH', '/cate', { data })\n\n// 获取分类\nexport const getCateDataAPI = (id?: number) => Request<Cate>('GET', `/cate/${id}`)\n\n// 获取分类列表\nexport const getCateListAPI = (params?: CateFilterQueryParams) => Request<Paginate<Cate[]>>('GET', `/cate`, { params })"
  },
  {
    "path": "src/api/comment.ts",
    "content": "import Request from '@/utils/request'\nimport { Comment } from '@/types/app/comment'\n\n// 新增评论\nexport const addCommentDataAPI = (data: Comment) => Request('POST', '/comment', { data })\n\n// 删除评论\nexport const delCommentDataAPI = (id: number) => Request('DELETE', `/comment/${id}`)\n\n// 审核评论\nexport const auditCommentDataAPI = (id: number) => Request('PATCH', `/comment/audit/${id}`)\n\n// 修改评论\nexport const editCommentDataAPI = (data: Comment) => Request('PATCH', '/comment', { data })\n\n// 获取评论\nexport const getCommentDataAPI = (id?: number) => Request<Paginate<Comment>>('GET', `/comment/${id}`)\n\n// 获取评论列表\nexport const getCommentListAPI = (data?: QueryData) => Request<Comment[]>('POST', `/comment/list`, {\n    data: { ...data, ...data?.query },\n})\n\n// 分页获取评论列表\nexport const getCommentPagingAPI = (data?: QueryData) => Request<Paginate<Comment[]>>('POST', `/comment/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})"
  },
  {
    "path": "src/api/config.ts",
    "content": "import Request from '@/utils/request';\nimport { Config, EnvConfigName, WebConfigType } from '@/types/app/config';\n\n// 获取网站配置\nexport const getWebConfigDataAPI = <T>(name: WebConfigType) => Request<T>('GET', `/web_config/name/${name}`);\n\n// 修改网站配置\nexport const editWebConfigDataAPI = (name: WebConfigType, data: object) => Request<Config>('PATCH', `/web_config/json/name/${name}`, { data });\n\n// 获取环境配置\nexport const getEnvConfigDataAPI = (name: EnvConfigName) => Request<Config>('GET', `/env_config/name/${name}`);\n\n// 获取环境配置列表\nexport const getEnvConfigListAPI = () => Request<Config[]>('GET', `/env_config/list`);\n\n// 更新环境配置\nexport const updateEnvConfigDataAPI = (data: Config) => Request('PATCH', `/env_config/json/${data.id}`, { data: data.value });\n\n// 根据id获取页面配置\nexport const getPageConfigDataAPI = (id: number) => Request<Config>('GET', `/page_config/${id}`);\n\n// 根据名称获取页面配置\nexport const getPageConfigDataByNameAPI = (name: string) => Request<Config>('GET', `/page_config/name/${name}`);\n\n// 获取页面配置列表\nexport const getPageConfigListAPI = () => Request<Config[]>('GET', `/page_config/list`);\n\n// 更新页面配置\nexport const updatePageConfigDataAPI = (id: number, data: object) => Request('PATCH', `/page_config/json/${id}`, { data });\n"
  },
  {
    "path": "src/api/email.ts",
    "content": "import Request from '@/utils/request'\nimport { DismissEmail, ReplyWallEmail } from '@/types/app/email'\n\n// 发送驳回邮件\nexport const sendDismissEmailAPI = async (data: DismissEmail) => {\n    return await Request<string>('POST', `/email/dismiss`, { data });\n}\n\n// 发送回复留言邮件\nexport const sendReplyWallEmailAPI = async (data: ReplyWallEmail) => {\n    return await Request<string>('POST', `/email/reply_wall`, { data });\n}"
  },
  {
    "path": "src/api/file.ts",
    "content": "import Request from '@/utils/request'\nimport { File, FileDir } from '@/types/app/file'\n\n// 删除文件\nexport const delFileDataAPI = (filePath: string) => Request('DELETE', `/file?filePath=${filePath}`)\n\n// 获取文件\nexport const getFileDataAPI = (filePath: string) => Request<File>('GET', `/file/info?filePath=${filePath}`)\n\n// 获取文件列表\nexport const getFileListAPI = (dir: string, paging?: Page) => Request<Paginate<File[]>>('GET', `/file/list?dir=${dir}`, {\n  params: {\n    ...paging\n  }\n})\n\n// 获取目录列表\nexport const getDirListAPI = () => Request<FileDir[]>('GET', '/file/dir')"
  },
  {
    "path": "src/api/footprint.ts",
    "content": "import Request from '@/utils/request'\nimport { Footprint } from '@/types/app/footprint'\n\n// 新增足迹\nexport const addFootprintDataAPI = (data: Footprint) => Request('POST', '/footprint', { data })\n\n// 删除足迹\nexport const delFootprintDataAPI = (id: number) => Request('DELETE', `/footprint/${id}`)\n\n// 修改足迹\nexport const editFootprintDataAPI = (data: Footprint) => Request('PATCH', '/footprint', { data })\n\n// 获取足迹\nexport const getFootprintDataAPI = (id?: number) => Request<Footprint>('GET', `/footprint/${id}`)\n\n// 获取足迹列表\nexport const getFootprintListAPI = (data?: QueryData) => Request<Footprint[]>('POST', '/footprint/list', {\n    data: { ...data?.query }\n});"
  },
  {
    "path": "src/api/oss.ts",
    "content": "import Request from '@/utils/request'\nimport { Oss } from '@/types/app/oss'\n\n// 新增OSS\nexport const addOssDataAPI = (data: Oss) => Request('POST', '/oss', { data })\n\n// 删除OSS\nexport const delOssDataAPI = (id: number) => Request('DELETE', `/oss/${id}`)\n\n// 修改OSS\nexport const editOssDataAPI = (data: Oss) => Request('PATCH', '/oss', { data })\n\n// 获取OSS\nexport const getOssDataAPI = (id?: number) => Request<Oss>('GET', `/oss/${id}`)\n\n// 获取OSS列表\nexport const getOssListAPI = () => Request<Oss[]>('POST', `/oss/list`)\n\n// 获取启用的OSS列表\nexport const getOssEnableListAPI = () => Request<Oss[]>('GET', `/oss/getEnableOss`)\n\n// 启用OSS\nexport const enableOssDataAPI = (id: number) => Request('PATCH', `/oss/enable/${id}`)\n\n// 禁用OSS\nexport const disableOssDataAPI = (id: number) => Request('PATCH', `/oss/disable/${id}`)\n\n// 获取支持的OSS平台列表\nexport const getOssPlatformListAPI = () => Request<{ name: string, value: string }[]>('GET', `/oss/platform`)"
  },
  {
    "path": "src/api/record.ts",
    "content": "import Request from '@/utils/request'\nimport { Record } from '@/types/app/record'\n\n// 新增说说\nexport const addRecordDataAPI = (data: Record) => Request('POST', '/record', { data })\n\n// 删除说说\nexport const delRecordDataAPI = (id: number) => Request('DELETE', `/record/${id}`)\n\n// 修改说说\nexport const editRecordDataAPI = (data: Record) => Request('PATCH', '/record', { data })\n\n// 获取说说\nexport const getRecordDataAPI = (id?: number) => Request<Record>('GET', `/record/${id}`)\n\n// 获取说说列表\nexport const getRecordListAPI = (data?: QueryData) => Request<Record[]>('POST', `/record/list`, {\n    data: { ...data?.query },\n})\n\n// 分页获取说说列表\nexport const getRecordPagingAPI = (data?: QueryData) => Request<Paginate<Record[]>>('POST', `/record/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})"
  },
  {
    "path": "src/api/rss.ts",
    "content": "import { Rss } from '@/types/app/rss';\nimport Request from '@/utils/request';\n\n// 获取订阅数据列表\nexport const getRssListAPI = (data?: QueryData) => Request<Rss[]>('GET', `/rss/list`, {\n    data: { ...data?.query },\n})\n\n// 分页获取订阅列表\nexport const getRssPagingAPI = (data?: QueryData) => Request<Paginate<Rss[]>>('POST', `/rss/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})"
  },
  {
    "path": "src/api/statis.ts",
    "content": "import Request from '@/utils/request';\n\ntype StatisType = 'overview' | 'new-visitor' | 'basic-overview';\n\n// overview(概览趋势), new-visitor(新访客趋势), basic-overview(基础概览趋势)\n// 获取 PV量、IP量、跳出率、平均访问时长\nexport const getStatisAPI = (type: StatisType, startDate: string, endDate: string) => Request('GET', `/statis`, {\n  params: {\n    startDate,\n    endDate,\n    type\n  },\n})"
  },
  {
    "path": "src/api/swiper.ts",
    "content": "import Request from '@/utils/request'\nimport { Swiper } from '@/types/app/swiper'\n\n// 新增轮播图\nexport const addSwiperDataAPI = (data: Swiper) => Request('POST', '/swiper', { data })\n\n// 删除轮播图\nexport const delSwiperDataAPI = (id: number) => Request('DELETE', `/swiper/${id}`)\n\n// 修改轮播图\nexport const editSwiperDataAPI = (data: Swiper) => Request('PATCH', '/swiper', { data })\n\n// 获取轮播图\nexport const getSwiperDataAPI = (id?: number) => Request<Swiper>('GET', `/swiper/${id}`)\n\n// 获取轮播图数据列表\nexport const getSwiperListAPI = (data?: QueryData) => Request<Swiper[]>('POST', `/swiper/list`, {\n    data: { ...data?.query },\n})\n\n// 分页获取轮播图列表\nexport const getSwiperPagingAPI = (data?: QueryData) => Request<Paginate<Swiper[]>>('POST', `/swiper/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})"
  },
  {
    "path": "src/api/tag.ts",
    "content": "import Request from '@/utils/request'\nimport { Tag } from '@/types/app/tag'\n\n// 新增标签\nexport const addTagDataAPI = (data: Tag) => Request('POST', '/tag', { data })\n\n// 删除标签\nexport const delTagDataAPI = (id: number) => Request('DELETE', `/tag/${id}`)\n\n// 修改标签\nexport const editTagDataAPI = (data: Tag) => Request('PATCH', '/tag', { data })\n\n// 获取标签\nexport const getTagDataAPI = (id?: number) => Request<Tag>('GET', `/tag/${id}`)\n\n// 获取标签列表\n// export const getTagListAPI = (data?: QueryData) => Request<Tag[]>('POST', `/tag/list`, {\n//     data: { ...data?.query },\n// })\n\n// 统计每个标签下的文章数量\nexport const getTagListAPI = () => Request<Tag[]>('GET', '/tag/article/count')\n\n// 分页获取标签列表\nexport const getTagPagingAPI = (data?: QueryData) => Request<Paginate<Tag[]>>('POST', `/tag/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})"
  },
  {
    "path": "src/api/user.ts",
    "content": "import Request from '@/utils/request'\nimport { LoginReturn, EditUser, Login, User, UserInfo } from '@/types/app/user'\n\n// 新增用户\nexport const addUserDataAPI = (data: User) => Request('POST', '/user', { data });\n\n// 删除用户\nexport const delUserDataAPI = (id: number) => Request('DELETE', `/user/${id}`);\n\n// 编辑用户\nexport const editUserDataAPI = (data: UserInfo) => Request('PATCH', '/user', { data })\n\n// 获取用户\nexport const getUserDataAPI = (id?: number) => Request<User>('GET', `/user/${id}`)\n\n// 获取用户列表\nexport const getUserListAPI = (data?: QueryData) => Request<User[]>('POST', `/user/list`, {\n    data: { ...data?.query },\n})\n\n// 分页获取用户列表\nexport const getUserPagingAPI = (data?: QueryData) => Request<Paginate<User[]>>('POST', `/user/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})\n\n// 登录\nexport const loginDataAPI = (data: Login) => Request<LoginReturn>('POST', '/user/login', { data })\n\n// 修改管理员密码\nexport const editAdminPassAPI = (data: EditUser) => Request('PATCH', '/user/pass', { data })\n\n// 判断当前token是否有效\nexport const checkTokenAPI = (token: string) => Request('GET', `/user/check?token=${token}`)"
  },
  {
    "path": "src/api/wall.ts",
    "content": "import Request from '@/utils/request'\nimport { Wall, Cate } from '@/types/app/wall'\n\n// 新增留言\nexport const addWallDataAPI = (data: Wall) => Request('POST', '/wall', { data })\n\n// 删除留言\nexport const delWallDataAPI = (id: number) => Request('DELETE', `/wall/${id}`)\n\n// 审核留言\nexport const auditWallDataAPI = (id: number) => Request('PATCH', `/wall/audit/${id}`)\n\n// 修改留言\nexport const editWallDataAPI = (data: Wall) => Request('PATCH', '/wall', { data })\n\n// 获取留言\nexport const getWallDataAPI = (id?: number) => Request<Paginate<Wall>>('GET', `/wall/${id}`)\n\n// 获取留言列表\nexport const getWallListAPI = (data?: QueryData) => Request<Wall[]>('POST', `/wall/list`, {\n    data: { ...data?.query },\n})\n\n// 分页获取留言列表\nexport const getWallPagingAPI = (data?: QueryData) => Request<Paginate<Wall[]>>('POST', `/wall/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})\n\n// 获取留言分类列表\nexport const getWallCateListAPI = () => Request<Cate[]>('GET', `/wall/cate`)\n\n// 设置与取消精选\nexport const updateChoiceAPI = (id: number) => Request('PATCH', `/wall/choice/${id}`)"
  },
  {
    "path": "src/api/web.ts",
    "content": "import Request from '@/utils/request'\nimport { Web, WebType } from '@/types/app/web'\n\n// 新增网站\nexport const addLinkDataAPI = (data: Web) => Request('POST', '/link', { data })\n\n// 删除网站\nexport const delLinkDataAPI = (id: number) => Request('DELETE', `/link/${id}`)\n\n// 修改网站\nexport const editLinkDataAPI = (data: Web) => Request('PATCH', '/link', { data })\n\n// 获取网站\nexport const getLinkDataAPI = (id?: number) => Request<Web>('GET', `/link/${id}`)\n\n// 获取网站列表\nexport const getLinkListAPI = (data?: QueryData) => Request<Web[]>('POST', `/link/list`, {\n    data: { ...data?.query },\n})\n\n// 分页获取评论列表\nexport const getLinkPagingAPI = (data?: QueryData) => Request<Paginate<Web[]>>('POST', `/link/paging`, {\n    data: { ...data?.query },\n    params: {\n        ...data?.pagination\n    }\n})\n\n// 获取网站类型列表\nexport const getWebTypeListAPI = () => {\n    return Request<WebType[]>('GET', `/link/type`);\n};\n\n// 审核网站\nexport const auditWebDataAPI = (id: number) => Request<Web>('PATCH', `/link/audit/${id}`)\n"
  },
  {
    "path": "src/components/CardDataStats/index.tsx",
    "content": "import { ReactNode } from 'react';\n\ninterface Props {\n  title: string;\n  total: string;\n  children: ReactNode;\n}\n\nexport default ({ title, total, children }: Props) => {\n  return (\n    <div className=\"rounded-md border border-stroke py-6 px-7 shadow-default dark:border-transparent bg-light-gradient dark:bg-dark-gradient\">\n      <h3 className=\"text-sm text-slate-700 dark:text-white\">{title}</h3>\n\n      <div className=\"flex items-center justify-between\">\n        <h4 className=\"font-bold text-2xl my-2 text-black dark:text-white\">{total}</h4>\n\n        <div className=\"flex h-11 w-11 items-center justify-center rounded-md bg-[#e7f2fe] dark:bg-[#4e5969]\">\n          {children}\n        </div>\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/components/ClickOutside.tsx",
    "content": "import React, { useRef, useEffect } from 'react';\n\ninterface Props {\n  children: React.ReactNode;\n  exceptionRef?: React.RefObject<HTMLElement>;\n  onClick: () => void;\n  className?: string;\n}\n\nconst ClickOutside: React.FC<Props> = ({\n  children,\n  exceptionRef,\n  onClick,\n  className,\n}) => {\n  const wrapperRef = useRef<HTMLDivElement>(null);\n\n  useEffect(() => {\n    const handleClickListener = (event: MouseEvent) => {\n      let clickedInside: null | boolean = false;\n      if (exceptionRef) {\n        clickedInside =\n          (wrapperRef.current &&\n            wrapperRef.current.contains(event.target as Node)) ||\n          (exceptionRef.current && exceptionRef.current === event.target) ||\n          (exceptionRef.current &&\n            exceptionRef.current.contains(event.target as Node));\n      } else {\n        clickedInside =\n          wrapperRef.current &&\n          wrapperRef.current.contains(event.target as Node);\n      }\n\n      if (!clickedInside) onClick();\n    };\n\n    document.addEventListener('mousedown', handleClickListener);\n\n    return () => {\n      document.removeEventListener('mousedown', handleClickListener);\n    };\n  }, [exceptionRef, onClick]);\n\n  return (\n    <div ref={wrapperRef} className={`${className || ''}`}>\n      {children}\n    </div>\n  );\n};\n\nexport default ClickOutside;\n"
  },
  {
    "path": "src/components/Drawer/index.tsx",
    "content": "import { Drawer } from 'antd';\nimport { CloseOutlined } from '@ant-design/icons';\n\ninterface Props {\n  title: string;\n  loading?: boolean;\n  open?: boolean;\n  onClose?: (open: boolean) => void;\n  className?: string;\n  children: React.ReactNode;\n}\n\nexport default ({ title, children, open, onClose, loading, className }: Props) => {\n  const Title = () => {\n    return (\n      <div className=\"flex justify-between items-center\">\n        <div></div>\n        <div className=\"ml-6\">{title}</div>\n        <div\n          onClick={() => onClose?.(false)}\n          className=\"group p-3 px-6 hover:bg-red-500 hover:text-white transition-colors cursor-pointer\"\n        >\n          <CloseOutlined className=\"group-hover:scale-150 transition-transform\" />\n        </div>\n      </div>\n    );\n  };\n\n  return (\n    <Drawer\n      loading={loading}\n      title={<Title />}\n      open={open}\n      onClose={() => onClose?.(false)}\n      height=\"100vh\"\n      placement=\"bottom\"\n      closeIcon={null}\n      className={`[&>.ant-drawer-header]:p-0! ${className}`}\n    >\n      {children}\n    </Drawer>\n  );\n};\n"
  },
  {
    "path": "src/components/Dropdowns/DropdownDefault.tsx",
    "content": "import { useEffect, useRef, useState } from 'react';\n\nconst DropdownDefault = () => {\n  const [dropdownOpen, setDropdownOpen] = useState(false);\n\n  const trigger = useRef<HTMLButtonElement>(null);\n  const dropdown = useRef<HTMLDivElement>(null);\n\n  // 监听点击事件，如果点击发生在下拉菜单外部，则关闭下拉菜单\n  useEffect(() => {\n    const clickHandler = ({ target }: MouseEvent) => {\n      // 如果下拉菜单未挂载，直接返回\n      if (!dropdown.current || !trigger.current) return;\n      // 如果下拉菜单未打开，或者点击目标在下拉菜单或触发按钮内部，则不做处理\n      if (!dropdownOpen || dropdown.current.contains(target as Node) || trigger.current.contains(target as Node)) return;\n      // 否则关闭下拉菜单\n      setDropdownOpen(false);\n    };\n    // 添加全局点击事件监听\n    document.addEventListener('click', clickHandler);\n    // 组件卸载时移除监听\n    return () => document.removeEventListener('click', clickHandler);\n  });\n\n  // 监听键盘事件，如果按下的是 ESC 键，则关闭下拉菜单\n  useEffect(() => {\n    const keyHandler = (event: KeyboardEvent) => {\n      // 如果下拉菜单未打开或按下的不是 ESC 键，则不做处理\n      if (!dropdownOpen || event.key !== 'Escape') return;\n      // 关闭下拉菜单\n      setDropdownOpen(false);\n    };\n    // 添加全局键盘按下事件监听\n    document.addEventListener('keydown', keyHandler);\n    // 组件卸载时移除监听\n    return () => document.removeEventListener('keydown', keyHandler);\n  });\n\n  return (\n    <div className=\"relative flex\">\n      <button className=\"text-[#98A6AD] hover:text-[#64748B]\" ref={trigger} onClick={() => setDropdownOpen(!dropdownOpen)}>\n        <svg className=\"fill-current\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n          <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=\"\" />\n          <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=\"\" />\n          <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=\"\" />\n        </svg>\n      </button>\n\n      <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'}`}>\n        <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]\">\n          <svg className=\"fill-current\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n            <g clipPath=\"url(#clip0_62_9787)\">\n              <path\n                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\"\n                fill=\"\"\n              />\n            </g>\n\n            <defs>\n              <clipPath id=\"clip0_62_9787\">\n                <rect width=\"16\" height=\"16\" fill=\"white\" />\n              </clipPath>\n            </defs>\n          </svg>\n          Edit\n        </button>\n\n        <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]\">\n          <svg className=\"fill-current\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path\n              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\"\n              fill=\"\"\n            />\n            <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=\"\" />\n            <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=\"\" />\n            <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=\"\" />\n          </svg>\n          Delete\n        </button>\n      </div>\n    </div>\n  );\n};\n\nexport default DropdownDefault;\n"
  },
  {
    "path": "src/components/Empty/index.tsx",
    "content": "import Empty from './empty.svg';\n\nexport default () => {\n  return (\n    <div className=\"flex flex-col justify-center items-center h-full text-base\">\n      <img src={Empty} alt=\"\" className=\"w-2/12\" /> 空空如也\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/components/FileUpload/index.tsx",
    "content": "import { useRef, useState, useCallback } from 'react';\nimport { InboxOutlined } from '@ant-design/icons';\nimport { message, Modal, Radio, Select, Spin } from 'antd';\nimport { useUserStore } from '@/stores';\nimport { DirList } from '@/types/app/file';\nimport { baseURL } from '@/utils/request';\nimport Compressor from 'compressorjs';\n\ninterface Props {\n  multiple?: boolean;\n  dir: DirList;\n  open: boolean;\n  onSuccess: (urls: string[]) => void;\n  onCancel: () => void;\n}\n\nexport default ({ multiple, dir, open, onCancel, onSuccess }: Props) => {\n  const store = useUserStore();\n  const dragCounterRef = useRef(0);\n\n  const fileInputRef = useRef<HTMLInputElement>(null);\n  const [quality, setQuality] = useState(1000);\n  const [isCompressionUpload, setIsCompressionUpload] = useState(false);\n  const [isLoading, setIsLoading] = useState(false);\n  const [isDragging, setIsDragging] = useState(false);\n\n  const onUploadFile = async (files: File[]) => {\n    try {\n      setIsLoading(true);\n\n      // 上传前先压缩文件大小\n      const compressedFiles = await Promise.all(\n        files.map((file) => {\n          return new Promise<File>((resolve, reject) => {\n            new Compressor(file, {\n              quality,\n              success: (blob) => {\n                // 将 Blob 转换为 File\n                const f = new File([blob], file.name, {\n                  type: file.type,\n                  lastModified: Date.now(),\n                });\n                resolve(f);\n              },\n              error: (err) => reject(err),\n            });\n          });\n        }),\n      );\n\n      // 处理成后端需要的格式\n      const formData = new FormData();\n      formData.append('dir', dir);\n      for (let i = 0; i < compressedFiles.length; i++) {\n        formData.append('files', compressedFiles[i]);\n      }\n\n      // 发起网络请求\n      const res = await fetch(`${baseURL}/file`, {\n        method: 'POST',\n        body: formData,\n        headers: {\n          Authorization: `Bearer ${store.token}`,\n        },\n      });\n\n      const { code, message: msg, data } = await res.json();\n      if (code !== 200) return message.error('文件上传失败：' + msg);\n\n      try {\n        // 把数据写入到剪贴板\n        await navigator.clipboard.writeText(data.join('\\n'));\n      } catch (error) {\n        console.error(error);\n        message.error('复制到剪贴板失败，请手动复制');\n        onSuccess(data);\n        setIsLoading(false);\n        return;\n      }\n\n      message.success(`🎉 文件上传成功，URL链接已复制到剪贴板`);\n      onSuccess(data);\n      onCloseModel();\n    } catch (error) {\n      message.error('文件上传失败：' + (error as Error).message);\n      onCloseModel();\n    }\n  };\n\n  const onCloseModel = () => {\n    setIsCompressionUpload(false);\n    setQuality(1000);\n    setIsLoading(false);\n    onCancel();\n  };\n\n  // 文件上传\n  const handleFileInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n    if (e.target.files) {\n      onUploadFile([...e.target.files]);\n    }\n  };\n\n  // 拖拽上传\n  const handleDragOver = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n    e.preventDefault();\n    e.stopPropagation();\n  }, []);\n\n  // 拖拽进入\n  const handleDragEnter = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n    e.preventDefault();\n    e.stopPropagation();\n    dragCounterRef.current++;\n    if (dragCounterRef.current === 1) {\n      setIsDragging(true);\n    }\n  }, []);\n\n  // 拖拽离开\n  const handleDragLeave = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n    e.preventDefault();\n    e.stopPropagation();\n    dragCounterRef.current--;\n    if (dragCounterRef.current === 0) {\n      setIsDragging(false);\n    }\n  }, []);\n\n  // 拖拽放下\n  const handleDrop = useCallback(\n    (e: React.DragEvent<HTMLDivElement>) => {\n      e.preventDefault();\n      e.stopPropagation();\n      dragCounterRef.current = 0;\n      setIsDragging(false);\n\n      const files = Array.from(e.dataTransfer.files);\n      if (files.length > 0) {\n        onUploadFile(files);\n      }\n    },\n    [onUploadFile],\n  );\n\n  return (\n    <>\n      <Modal title=\"文件上传\" open={open} onCancel={onCloseModel} footer={null}>\n        <Spin spinning={isLoading}>\n          <div className=\"my-4\">\n            <Radio.Group\n              defaultValue={0}\n              value={isCompressionUpload ? 1 : 0}\n              onChange={(e) => setIsCompressionUpload(e.target.value ? true : false)}\n            >\n              <Radio value={0}>无损上传</Radio>\n              <Radio value={1}>压缩上传</Radio>\n            </Radio.Group>\n\n            {isCompressionUpload && (\n              <Select\n                onChange={setQuality}\n                options={[\n                  { value: 1, label: '轻量压缩(推荐)' },\n                  { value: 'NaN', label: '自适应压缩' },\n                  { value: 0.9, label: '0.9' },\n                  { value: 0.8, label: '0.8' },\n                  { value: 0.7, label: '0.7' },\n                  { value: 0.6, label: '0.6' },\n                  { value: 0.5, label: '0.5' },\n                  { value: 0.4, label: '0.4' },\n                  { value: 0.3, label: '0.3' },\n                  { value: 0.2, label: '0.2' },\n                  { value: 0.1, label: '0.1' },\n                ]}\n                defaultValue={1}\n                placeholder=\"请选择图片压缩质量\"\n                className=\"min-w-44\"\n              />\n            )}\n          </div>\n\n          <div\n            onClick={() => fileInputRef?.current?.click()}\n            onDragOver={handleDragOver}\n            onDragEnter={handleDragEnter}\n            onDragLeave={handleDragLeave}\n            onDrop={handleDrop}\n            className={`w-full h-40 p-4 border border-dashed rounded-lg transition-all duration-300 ${\n              isDragging ? 'border-primary bg-primary/5' : 'border-[#D7D7D7] hover:border-primary bg-[#FAFAFA]'\n            } space-y-2 cursor-pointer`}\n          >\n            <div className=\"flex justify-center\">\n              <InboxOutlined className=\"text-5xl text-primary\" />\n            </div>\n\n            <p className=\"text-base text-center\">{isDragging ? '释放文件以上传' : '点击或拖动文件到此区域进行上传'}</p>\n            <p className=\"text-sm text-[#999] text-center\">支持单个或多个上传</p>\n          </div>\n\n          <input multiple={multiple} type=\"file\" onChange={handleFileInput} ref={fileInputRef} className=\"hidden\" />\n        </Spin>\n      </Modal>\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/HasPermission/index.tsx",
    "content": "import { useHasPermission } from '@/utils/permission';\n\ninterface Props {\n    code: string;\n    children: React.ReactNode;\n}\n\nexport default ({ code, children }: Props) => {\n    const hasPermission = useHasPermission(code);\n    return hasPermission ? children : null;\n}"
  },
  {
    "path": "src/components/Header/DarkModeSwitcher.tsx",
    "content": "import { useConfigStore } from '../../stores';\n\nconst DarkModeSwitcher = () => {\n  const colorMode = useConfigStore((state) => state.colorMode);\n  const setColorMode = useConfigStore((state) => state.setColorMode);\n\n  return (\n    <li className=\"ml-4\">\n      <label className={`relative m-0 block h-7 w-14 rounded-full ${colorMode === 'dark' ? 'bg-primary' : 'bg-stroke'}`}>\n        <input\n          type=\"checkbox\"\n          onChange={() => {\n            if (typeof setColorMode === 'function') {\n              setColorMode(colorMode === 'light' ? 'dark' : 'light');\n            }\n          }}\n          className=\"dur absolute top-0 z-50 m-0 h-full w-full cursor-pointer opacity-0\"\n        />\n        <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!'}`}>\n          <span className=\"dark:hidden\">\n            <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n              <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\" />\n              <path\n                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\"\n                fill=\"#969AA1\"\n              />\n            </svg>\n          </span>\n          <span className=\"hidden dark:inline-block\">\n            <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n              <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\" />\n            </svg>\n          </span>\n        </span>\n      </label>\n    </li>\n  );\n};\n\nexport default DarkModeSwitcher;\n"
  },
  {
    "path": "src/components/Header/DropdownUser.tsx",
    "content": "import { Link } from 'react-router-dom';\nimport { Dropdown, MenuProps } from 'antd';\n\nimport { useUserStore } from '@/stores';\n\nconst DropdownUser = () => {\n  const store = useUserStore();\n\n  // 菜单项配置\n  const items: MenuProps['items'] = [\n    {\n      key: 'profile',\n      label: (\n        <Link to=\"/setup?tab=my\" className=\"flex items-center gap-2\">\n          <svg className=\"fill-current\" width=\"16\" height=\"16\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n            <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=\"\" />\n            <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=\"\" />\n          </svg>\n          我的资料\n        </Link>\n      ),\n    },\n    {\n      key: 'setup',\n      label: (\n        <Link to=\"/setup?tab=web\" className=\"flex items-center gap-2\">\n          <svg className=\"fill-current\" width=\"16\" height=\"16\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path\n              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\"\n              fill=\"\"\n            />\n            <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=\"\" />\n          </svg>\n          网站配置\n        </Link>\n      ),\n    },\n    {\n      type: 'divider',\n    },\n    {\n      key: 'logout',\n      label: (\n        <button className=\"flex items-center gap-2 w-full cursor-pointer\" onClick={store.quitLogin}>\n          <svg className=\"fill-current\" width=\"16\" height=\"16\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n            <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=\"\" />\n            <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=\"\" />\n          </svg>\n          退出登录\n        </button>\n      ),\n    },\n  ];\n\n  return (\n    <Dropdown menu={{ items }} placement=\"bottomRight\" trigger={['click']}>\n      <div className=\"flex items-center gap-2 cursor-pointer\">\n        <span className=\"hidden text-right lg:block\">\n          <span className=\"block text-sm font-medium text-black dark:text-white\">{store.user?.name}</span>\n          <span className=\"block text-xs\">超级管理员</span>\n        </span>\n\n        <span className=\"overflow-hidden h-8 w-8 rounded-full border border-stroke\">\n          <img src={store.user?.avatar} alt=\"User\" />\n        </span>\n\n        <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\">\n          <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=\"\" />\n        </svg>\n      </div>\n    </Dropdown>\n  );\n};\n\nexport default DropdownUser;\n"
  },
  {
    "path": "src/components/Header/index.tsx",
    "content": "import { Link } from 'react-router-dom';\nimport { useEffect, useState } from 'react';\nimport { Skeleton } from 'antd';\nimport { useUserStore } from '@/stores';\nimport DropdownUser from './DropdownUser';\nimport DarkModeSwitcher from './DarkModeSwitcher';\nimport logo from '/logo.png';\nimport PageTab from '../PageTab';\n\nconst Header = (props: { sidebarOpen: string | boolean | undefined; setSidebarOpen: (arg0: boolean) => void }) => {\n  const user = useUserStore((state) => state.user);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n\n  // 等待用户信息加载完成后，取消初始加载状态\n  useEffect(() => {\n    if (user?.name) {\n      setInitialLoading(false);\n    } else {\n      // 如果用户信息未加载，等待最多 500ms 后显示内容\n      const timer = setTimeout(() => {\n        setInitialLoading(false);\n      }, 500);\n      return () => clearTimeout(timer);\n    }\n  }, [user]);\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <header className=\"sticky top-0 z-99 flex w-full bg-light-gradient dark:bg-dark-gradient\">\n        <div className=\"flex grow items-center justify-between px-4 py-3 shadow-2 md:px-6 2xl:px-11 overflow-scroll\">\n          <div className=\"flex items-center gap-4 flex-1 min-w-0\">\n            {/* 移动端菜单按钮和 Logo 骨架屏 */}\n            <div className=\"flex items-center gap-4 lg:hidden shrink-0\">\n              <Skeleton.Button active size=\"default\" style={{ width: 32, height: 32 }} />\n              <Skeleton.Avatar active size={32} shape=\"square\" />\n            </div>\n\n            {/* PageTab 骨架屏 */}\n            <div className=\"flex-1 min-w-0 w-2/6 overflow-x-auto\">\n              <div className=\"flex items-center gap-2\">\n                {[1, 2, 3].map((item) => (\n                  <Skeleton.Button key={item} active size=\"default\" style={{ width: 100, height: 32 }} />\n                ))}\n              </div>\n            </div>\n          </div>\n\n          {/* 右侧操作栏骨架屏 */}\n          <div className=\"flex items-center gap-3 2xsm:gap-7 shrink-0 ml-4\">\n            <ul className=\"flex items-center gap-2 2xsm:gap-4 sm:mr-4\">\n              <Skeleton.Button active size=\"default\" style={{ width: 32, height: 30 }} />\n            </ul>\n\n            <div className=\"sm:block hidden\">\n              <div className=\"flex items-center gap-2\">\n                <div className=\"hidden text-right lg:block space-x-4\">\n                  <Skeleton.Input active size=\"small\" style={{ width: 80, height: 30, marginBottom: 4 }} />\n                  <Skeleton.Input active size=\"small\" style={{ width: 60, height: 30 }} />\n                </div>\n\n                <Skeleton.Avatar active size={32} shape=\"circle\" className=\"ml-4\" />\n              </div>\n            </div>\n          </div>\n        </div>\n      </header>\n    );\n  }\n\n  return (\n    <header className=\"sticky top-0 z-99 flex w-full bg-light-gradient dark:bg-dark-gradient dark:backdrop-blur-xl\">\n      <div className=\"flex grow items-center justify-between px-4 py-3 shadow-2 md:px-6 2xl:px-11 overflow-scroll\">\n        <div className=\"flex items-center gap-4 flex-1 min-w-0\">\n          <div className=\"flex items-center gap-4 lg:hidden shrink-0\">\n            <button\n              aria-controls=\"sidebar\"\n              onClick={(e) => {\n                e.stopPropagation();\n                props.setSidebarOpen(!props.sidebarOpen);\n              }}\n              className=\"z-99999 block rounded-xs border border-stroke bg-white p-1 shadow-xs dark:border-strokedark dark:bg-boxdark lg:hidden\"\n            >\n              <span className=\"relative block h-6 w-6 cursor-pointer\">\n                <span className=\"du-block absolute right-0 h-full w-full\">\n                  <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>\n                  <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>\n                  <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>\n                </span>\n                <span className=\"absolute right-0 h-full w-full rotate-45\">\n                  <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>\n                  <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>\n                </span>\n              </span>\n            </button>\n\n            <Link className=\"block shrink-0 lg:hidden\" to=\"/\">\n              <img src={logo} alt=\"logo\" className=\"w-8\" />\n            </Link>\n          </div>\n\n          <div className=\"flex-1 min-w-0 w-2/6 overflow-x-auto\">\n            <PageTab />\n          </div>\n        </div>\n\n        <div className=\"flex items-center gap-3 2xsm:gap-7 shrink-0 ml-4\">\n          <ul className=\"flex items-center gap-2 2xsm:gap-4 sm:mr-4\">\n            <DarkModeSwitcher />\n          </ul>\n\n          <div className=\"sm:block hidden\">\n            <DropdownUser />\n          </div>\n        </div>\n      </div>\n    </header>\n  );\n};\n\nexport default Header;\n"
  },
  {
    "path": "src/components/Loader/index.tsx",
    "content": "export default () => {\n  return (\n    <div className=\"flex h-screen items-center justify-center bg-white\">\n      <div className=\"h-16 w-16 animate-spin rounded-full border-4 border-solid border-primary border-t-transparent\"></div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/components/Material/index.scss",
    "content": ".FilePage {\n    .ant-image {\n        display: block;\n        width: 100%;\n\n        .ant-image-img {\n            width: 100%;\n            height: auto;\n            display: block;\n        }\n    }\n}\n\n// 自定义图片预览样式\n.customAntdPreviewsItem {\n    overflow: hidden;\n    background: #fff;\n    border-radius: 10px;\n\n    .anticon {\n        font-size: 20px;\n        color: #5d5d5d;\n        padding: 10px;\n\n        &:hover {\n            color: #60a5fa;\n        }\n    }\n}"
  },
  {
    "path": "src/components/Material/index.tsx",
    "content": "import { useEffect, useState, useRef } from 'react';\nimport { Image, Spin, message, Button } from 'antd';\nimport { CheckOutlined } from '@ant-design/icons';\nimport { Modal } from 'antd';\nimport Masonry from 'react-masonry-css';\nimport { getFileListAPI, getDirListAPI } from '@/api/file';\nimport { File, FileDir } from '@/types/app/file';\nimport errorImg from '@/pages/file/image/error.png';\nimport fileSvg from '@/pages/file/image/file.svg';\nimport { PiKeyReturnFill } from 'react-icons/pi';\nimport FileUpload from '@/components/FileUpload';\nimport './index.scss';\n\ninterface Props {\n  multiple?: boolean;\n  maxCount?: number;\n  open: boolean;\n  onClose: () => void;\n  onSelect?: (files: string[]) => void;\n}\n\n// Masonry 布局的响应式断点配置\nconst breakpointColumnsObj = {\n  default: 4,\n  1100: 3,\n  700: 2,\n  500: 1,\n};\n\nexport default ({ multiple, open, onClose, onSelect, maxCount }: Props) => {\n  // 加载状态\n  const [loading, setLoading] = useState(false);\n  // 当前页码\n  const [page, setPage] = useState(1);\n  // 是否还有更多数据\n  const [hasMore, setHasMore] = useState(true);\n  // 防止重复加载的引用\n  const loadingRef = useRef(false);\n  // 文件列表数据\n  const [fileList, setFileList] = useState<File[]>([]);\n  // 目录列表数据\n  const [dirList, setDirList] = useState<FileDir[]>([]);\n  // 当前选中的目录\n  const [dirName, setDirName] = useState('');\n  // 选中的文件列表\n  const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n\n  // 上传文件弹窗\n  const [isUploadModalOpen, setIsUploadModalOpen] = useState(false);\n\n  // 获取目录列表\n  const getDirList = async () => {\n    try {\n      setLoading(true);\n      const { data } = await getDirListAPI();\n\n      const dirList = ['default', 'equipment', 'record', 'article', 'footprint', 'swiper', 'album'];\n      dirList.forEach((dir) => {\n        if (!data.some((item: FileDir) => item.name === dir)) {\n          data.push({ name: dir, path: '' });\n        }\n      });\n\n      setDirList(data);\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getDirList();\n  }, []);\n\n  // 获取文件列表\n  const getFileList = async (dir: string, isLoadMore = false) => {\n    // 防止重复加载\n    if (loadingRef.current) return;\n\n    try {\n      loadingRef.current = true;\n      setLoading(true);\n\n      // 请求文件列表数据，如果是加载更多则页码+1\n      const { data } = await getFileListAPI(dir, { page: isLoadMore ? page + 1 : 1, size: 15 });\n\n      // 根据是否是加载更多来决定是替换还是追加数据\n      if (!isLoadMore) {\n        setFileList(data.result);\n        setPage(1);\n      } else {\n        setFileList((prev) => [...prev, ...data.result]);\n        setPage((prev) => prev + 1);\n      }\n\n      // 判断是否还有更多数据\n      setHasMore(data.result.length === 15);\n\n      setLoading(false);\n      loadingRef.current = false;\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n      loadingRef.current = false;\n    }\n  };\n\n  // 处理滚动事件，实现下拉加载更多\n  const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {\n    const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;\n    // 当滚动到底部（距离底部小于50px）且还有更多数据时，触发加载更多\n    if (scrollHeight - scrollTop - clientHeight < 50 && hasMore && !loading) {\n      getFileList(dirName, true);\n    }\n  };\n\n  // 取消选择\n  const onCancelSelect = () => {\n    reset();\n    onClose();\n  };\n\n  // 打开目录\n  const openDir = (dir: string) => {\n    setDirName(dir);\n    getFileList(dir);\n  };\n\n  // 处理选中的图片\n  const onHandleSelectImage = (item: File) => {\n    setSelectedFiles((prev) => {\n      // 如果 maxCount 不为 1，则开启多选\n      const isMultiple = multiple || (maxCount !== undefined && maxCount !== 1);\n\n      if (isMultiple) {\n        // 多选模式\n        const isSelected = prev.some((file) => file.url === item.url);\n        if (isSelected) {\n          return prev.filter((file) => file.url !== item.url);\n        } else {\n          // 检查是否超过最大数量限制\n          if (maxCount && prev.length >= maxCount) {\n            message.warning(`最多只能选择 ${maxCount} 个文件`);\n            return prev;\n          }\n\n          return [...prev, item];\n        }\n      } else {\n        // 单选模式\n        return [item];\n      }\n    });\n  };\n\n  // 处理文件上传成功做的事情\n  const onUpdateSuccess = (urls: string[]) => {\n    setIsUploadModalOpen(false);\n    if (onSelect) onSelect(urls);\n    reset();\n    onClose();\n  };\n\n  // 确认选择\n  const onHandleSelect = () => {\n    const list = selectedFiles.map((item) => item.url);\n    if (onSelect) onSelect(list);\n    reset();\n    onClose();\n  };\n\n  const reset = () => {\n    setFileList([]);\n    setSelectedFiles([]);\n    setDirName('');\n  };\n\n  return (\n    <Modal\n      title=\"素材库\"\n      width={1200}\n      open={open}\n      onCancel={onCancelSelect}\n      destroyOnHidden\n      footer={\n        dirName\n          ? [\n            <Button key=\"cancel\" onClick={onCancelSelect}>\n              取消\n            </Button>,\n            <Button key=\"confirm\" type=\"primary\" onClick={onHandleSelect} disabled={selectedFiles.length === 0}>\n              选择 ({selectedFiles.length})\n            </Button>,\n          ]\n          : null\n      }\n      zIndex={1100}\n    >\n      <div className=\"flex justify-between mb-4 px-4\">\n        {!fileList.length && !dirName ? <PiKeyReturnFill className=\"text-4xl text-[#E0DFDF] cursor-pointer\" /> : <PiKeyReturnFill className=\"text-4xl text-primary cursor-pointer\" onClick={reset} />}\n\n        {dirName && (\n          <Button type=\"primary\" onClick={() => setIsUploadModalOpen(true)}>\n            上传文件\n          </Button>\n        )}\n      </div>\n\n      <Spin spinning={loading}>\n        <div className={`flex flex-wrap ${dirName ? 'justify-center!' : 'justify-start'} md:justify-normal overflow-y-auto max-h-[calc(100vh-300px)]`} onScroll={handleScroll}>\n          {fileList.length || (!fileList.length && dirName) ? (\n            <Masonry breakpointCols={breakpointColumnsObj} className=\"masonry-grid\" columnClassName=\"masonry-grid_column\">\n              {fileList.map((item, index) => (\n                <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)}>\n                  <div className=\"relative\">\n                    <Image src={item.url} className=\"w-full rounded-md\" loading=\"lazy\" fallback={errorImg} preview={false} />\n\n                    {selectedFiles.some((file) => file.url === item.url) && (\n                      <div className=\"absolute top-2 right-2 bg-primary text-white rounded-full w-6 h-6 flex items-center justify-center\">\n                        <CheckOutlined />\n                      </div>\n                    )}\n                  </div>\n                </div>\n              ))}\n            </Masonry>\n          ) : (\n            dirList.map((item, index) => (\n              <div key={index} className=\"group w-20 flex flex-col items-center cursor-pointer mx-4 my-2\" onClick={() => openDir(item.name)}>\n                <img src={fileSvg} alt=\"\" />\n                <p className=\"group-hover:text-primary transition-colors\">{item.name}</p>\n              </div>\n            ))\n          )}\n        </div>\n      </Spin>\n\n      {/* 文件上传弹窗 */}\n      <FileUpload multiple={multiple || (maxCount !== undefined && maxCount !== 1)} dir={dirName} open={isUploadModalOpen} onSuccess={onUpdateSuccess} onCancel={() => setIsUploadModalOpen(false)} />\n    </Modal>\n  );\n};\n"
  },
  {
    "path": "src/components/NotFound/index.tsx",
    "content": "import { Button, Result } from 'antd'\n\nexport default () => {\n    return (\n        <>\n            <Result\n                status=\"404\"\n                title=\"404\"\n                subTitle=\"对不起，您访问的页面不存在。\"\n                extra={<Button type=\"primary\" onClick={() => window.open('https://github.com/LiuYuYang01/ThriveX-Admin')}>借此机会帮忙点个star</Button>}\n            />\n        </>\n    )\n}"
  },
  {
    "path": "src/components/PageTab/index.tsx",
    "content": "import { useEffect, useRef } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { AiOutlineClose } from 'react-icons/ai';\nimport useTabsStore, { TabItem } from '@/stores/modules/tabs';\nimport { getRouteConfig } from '@/utils/route';\n\nexport default () => {\n  const navigate = useNavigate();\n  const location = useLocation();\n  const { tabs, activeTab, addTab, removeTab, setActiveTab } = useTabsStore();\n  const tabsContainerRef = useRef<HTMLDivElement>(null);\n\n  // 监听路由变化，自动添加标签\n  useEffect(() => {\n    const pathname = location.pathname;\n    const routeConfig = getRouteConfig(pathname);\n\n    if (routeConfig) {\n      addTab({\n        path: pathname,\n        title: routeConfig.title,\n      });\n      setActiveTab(pathname);\n    }\n  }, [location.pathname, addTab, setActiveTab]);\n\n  // 检查滚动状态\n  const checkScroll = () => {\n    if (!tabsContainerRef.current) return;\n  };\n\n  useEffect(() => {\n    checkScroll();\n    const container = tabsContainerRef.current;\n    if (container) {\n      container.addEventListener('scroll', checkScroll);\n      window.addEventListener('resize', checkScroll);\n    }\n    return () => {\n      if (container) {\n        container.removeEventListener('scroll', checkScroll);\n      }\n      window.removeEventListener('resize', checkScroll);\n    };\n  }, [tabs]);\n\n  // 切换到指定标签\n  const handleTabClick = (tab: TabItem) => {\n    setActiveTab(tab.path);\n    navigate(tab.path);\n  };\n\n  // 关闭标签\n  const handleCloseTab = (e: React.MouseEvent, tab: TabItem) => {\n    e.stopPropagation();\n\n    if (tabs.length <= 1) {\n      return; // 至少保留一个标签\n    }\n\n    const currentIndex = tabs.findIndex((t) => t.path === tab.path);\n    const isActiveTab = activeTab === tab.path;\n\n    // 如果关闭的是当前激活的标签，先导航到新的激活标签\n    if (isActiveTab) {\n      let newActivePath = '/';\n\n      if (currentIndex > 0) {\n        newActivePath = tabs[currentIndex - 1].path;\n      } else if (tabs.length > 1) {\n        newActivePath = tabs[1].path;\n      }\n\n      navigate(newActivePath);\n    }\n\n    // 移除标签\n    removeTab(tab.path);\n  };\n\n  // 获取标签图标\n  const getTabIcon = (path: string) => {\n    const routeConfig = getRouteConfig(path);\n    return routeConfig?.icon || null;\n  };\n\n  return (\n    <div className=\"relative flex items-center\">\n      {/* 标签容器 */}\n      <div ref={tabsContainerRef} className=\"flex-1 flex items-center\" style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}>\n        <div className=\"flex items-center h-10\">\n          {tabs.map((tab) => {\n            const isActive = activeTab === tab.path;\n            const icon = getTabIcon(tab.path);\n\n            return (\n              <div\n                key={tab.path}\n                onClick={() => handleTabClick(tab)}\n                className={`\n                  relative flex items-center gap-2 px-4 h-10 cursor-pointer\n                  transition-all duration-200  hover:text-primary!\n                  ${isActive ? 'text-primary' : 'text-gray-500 dark:text-gray-400'}\n                `}\n              >\n                {icon && <span className=\"shrink-0\">{icon}</span>}\n                <span className=\"whitespace-nowrap text-sm\">{tab.title}</span>\n                {tabs.length > 1 && (\n                  <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()}>\n                    <AiOutlineClose className=\"text-xs\" />\n                  </button>\n                )}\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/components/PageTitle.tsx",
    "content": "import { useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\n\ninterface Props {\n  title: string;\n}\n\nexport default ({ title }: Props) => {\n  const location = useLocation();\n\n  useEffect(() => {\n    document.title = title;\n  }, [location, title]);\n\n  return null;\n};\n"
  },
  {
    "path": "src/components/RandomAvatar/index.tsx",
    "content": "import { useMemo } from 'react';\nimport { createAvatar } from '@dicebear/core';\n\n// 使用指定风格头像\nimport { pixelArt } from '@dicebear/collection';\n\nexport default ({ className }: { className?: string }) => {\n    const avatar = useMemo(() => {\n        // 生成一个随机种子\n        const seed = Math.random().toString(36).substring(2, 15);\n\n        // 创建头像\n        return createAvatar(pixelArt, {\n            seed: seed, // 使用随机种子\n            size: 128,\n            // 其他选项\n        }).toDataUri();\n    }, []);\n\n    return <img src={avatar} alt=\"Avatar\" className={className} />\n}"
  },
  {
    "path": "src/components/RouteList/index.tsx",
    "content": "import { useEffect } from 'react';\nimport DefaultLayout from '@/layout/DefaultLayout';\nimport { Route, Routes, useLocation, useNavigate } from 'react-router-dom';\n\nimport Home from '@/pages/dashboard';\nimport Create from '@/pages/create';\nimport CreateRecord from '@/pages/create_record';\nimport Cate from '@/pages/cate';\nimport Article from '@/pages/article';\nimport Comment from '@/pages/comment';\nimport Wall from '@/pages/wall';\nimport Tag from '@/pages/tag';\nimport Web from '@/pages/web';\nimport Swiper from '@/pages/swiper';\nimport Footprint from '@/pages/footprint';\nimport Setup from '@/pages/setup';\nimport File from '@/pages/file';\nimport Iterative from '@/pages/iterative';\nimport Login from '@/pages/login';\nimport Work from '@/pages/work';\nimport Draft from '@/pages/draft';\nimport Decycle from '@/pages/decycle';\nimport Record from '@/pages/record';\nimport Storage from '@/pages/storage';\nimport Assistant from '@/pages/assistant';\nimport Config from '@/pages/config';\n\nimport PageTitle from '../PageTitle';\n\nimport { useUserStore } from '@/stores';\nimport { checkTokenAPI } from '@/api/user';\nimport NotFound from '../NotFound';\n\nexport default () => {\n  const navigate = useNavigate();\n  const store = useUserStore();\n  const { pathname } = useLocation();\n  const isLoginRoute = pathname === '/login' || pathname === '/auth';\n\n  const routes = [\n    { path: '/', title: '仪表盘', component: <Home /> },\n    { path: '/create', title: '发挥灵感', component: <Create /> },\n    { path: '/create_record', title: '闪念', component: <CreateRecord /> },\n    { path: '/draft', title: '草稿箱', component: <Draft /> },\n    { path: '/recycle', title: '回收站', component: <Decycle /> },\n    { path: '/cate', title: '导航管理', component: <Cate /> },\n    { path: '/article', title: '文章管理', component: <Article /> },\n    { path: '/record', title: '说说管理', component: <Record /> },\n    { path: '/tag', title: '标签管理', component: <Tag /> },\n    { path: '/comment', title: '评论管理', component: <Comment /> },\n    { path: '/wall', title: '评论管理', component: <Wall /> },\n    { path: '/web', title: '网站管理', component: <Web /> },\n    { path: '/swiper', title: '轮播图管理', component: <Swiper /> },\n    { path: '/footprint', title: '足迹管理', component: <Footprint /> },\n    { path: '/storage', title: '存储管理', component: <Storage /> },\n    { path: '/setup', title: '项目配置', component: <Setup /> },\n    { path: '/file', title: '文件管理', component: <File /> },\n    { path: '/iter', title: '项目更新记录', component: <Iterative /> },\n    { path: '/work', title: '工作台', component: <Work /> },\n    { path: '/assistant', title: '助手管理', component: <Assistant /> },\n    { path: '/config', title: '项目配置', component: <Config /> },\n  ];\n\n  useEffect(() => {\n    // 如果没有token并且不在登录相关页面就跳转到登录页\n    if (!store.token && !isLoginRoute) return navigate('/login');\n  }, [store, isLoginRoute]);\n\n  useEffect(() => {\n    if (store.token) checkTokenAPI(store.token);\n  }, [store, pathname]);\n\n  if (isLoginRoute) {\n    return (\n      <Routes>\n        <Route\n          path=\"/login\"\n          element={\n            <>\n              <PageTitle title=\"ThriveX | 现代化博客管理系统\" />\n              <Login />\n            </>\n          }\n        />\n      </Routes>\n    );\n  }\n\n  return (\n    <DefaultLayout>\n      <Routes>\n        {routes.map(({ path, title, component }) => (\n          <Route\n            key={path}\n            path={path}\n            element={\n              <>\n                <PageTitle title={`ThriveX - ${title}`} />\n                {component}\n              </>\n            }\n          />\n        ))}\n\n        <Route path=\"*\" element={<NotFound />} />\n      </Routes>\n    </DefaultLayout>\n  );\n};\n"
  },
  {
    "path": "src/components/Sidebar/SidebarLinkGroup.tsx",
    "content": "import { ReactNode, useState } from 'react';\n\ninterface SidebarLinkGroupProps {\n  children: (handleClick: () => void, open: boolean) => ReactNode;\n  activeCondition: boolean;\n}\n\nconst SidebarLinkGroup = ({\n  children,\n  activeCondition,\n}: SidebarLinkGroupProps) => {\n  const [open, setOpen] = useState<boolean>(activeCondition);\n\n  const handleClick = () => {\n    setOpen(!open);\n  };\n\n  return <li>{children(handleClick, open)}</li>;\n};\n\nexport default SidebarLinkGroup;"
  },
  {
    "path": "src/components/Sidebar/index.tsx",
    "content": "import React, { useEffect, useRef, useState } from 'react';\nimport { NavLink, useLocation } from 'react-router-dom';\nimport { Skeleton } from 'antd';\nimport SidebarLinkGroup from './SidebarLinkGroup';\n\nimport { BiEditAlt, BiFolderOpen, BiHomeSmile, BiSliderAlt, BiCategoryAlt, BiBug } from 'react-icons/bi';\nimport { TbBrandAirtable } from 'react-icons/tb';\n\nimport logo from '/logo.png';\n\ninterface SidebarProps {\n  sidebarOpen: boolean;\n  setSidebarOpen: (arg: boolean) => void;\n}\n\n// 定义导航项的类型\ninterface MenuItem {\n  to: string;\n  path: string;\n  icon: React.ReactNode;\n  name: string | React.ReactNode;\n  subMenu?: SubMenuItem[];\n}\n\ninterface SubMenuItem {\n  to: string;\n  path: string;\n  name: string;\n}\n\nconst Sidebar = ({ sidebarOpen, setSidebarOpen }: SidebarProps) => {\n  const location = useLocation();\n  const { pathname } = location;\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n\n  // 创建 ref 用于触发器和侧边栏元素\n  const trigger = useRef<HTMLButtonElement>(null);\n  const sidebar = useRef<HTMLDivElement>(null);\n\n  // 从 localStorage 获取侧边栏展开状态\n  const storedSidebarExpanded = localStorage.getItem('sidebar-expanded');\n  const [sidebarExpanded, setSidebarExpanded] = useState(storedSidebarExpanded === null ? false : storedSidebarExpanded === 'true');\n\n  // 点击事件处理：点击侧边栏外部时关闭侧边栏\n  useEffect(() => {\n    const clickHandler = ({ target }: MouseEvent) => {\n      if (!sidebar.current || !trigger.current) return;\n      if (!sidebarOpen || sidebar.current.contains(target as Node) || trigger.current.contains(target as Node)) return;\n      setSidebarOpen(false);\n    };\n    document.addEventListener('click', clickHandler);\n    return () => document.removeEventListener('click', clickHandler);\n  });\n\n  // 键盘事件处理：按 ESC 键关闭侧边栏\n  useEffect(() => {\n    const keyHandler = ({ keyCode }: KeyboardEvent) => {\n      if (!sidebarOpen || keyCode !== 27) return;\n      setSidebarOpen(false);\n    };\n    document.addEventListener('keydown', keyHandler);\n    return () => document.removeEventListener('keydown', keyHandler);\n  });\n\n  // 侧边栏展开状态持久化处理\n  useEffect(() => {\n    localStorage.setItem('sidebar-expanded', sidebarExpanded.toString());\n    if (sidebarExpanded) {\n      document.querySelector('body')?.classList.add('sidebar-expanded');\n    } else {\n      document.querySelector('body')?.classList.remove('sidebar-expanded');\n    }\n  }, [sidebarExpanded]);\n\n  // 版本数据加载完成后，取消初始加载状态\n  useEffect(() => {\n    setInitialLoading(false);\n  }, []);\n\n  const [isSideBarTheme] = useState<'dark' | 'light'>('light');\n\n  // 定义导航项的样式类\n  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!';\n  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!';\n  const sidebarItemActiveSty = `${isSideBarTheme === 'dark' ? 'bg-graydark' : 'text-primary!'}`;\n\n  // 箭头图标组件：用于显示子菜单的展开/收起状态\n  const Arrow = ({ open }: { open: boolean }) => {\n    return (\n      <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\">\n        <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\" />\n      </svg>\n    );\n  };\n\n  // 定义完整的路由列表配置\n  const routes: { group: string; list: MenuItem[] }[] = [\n    {\n      group: '',\n      list: [\n        {\n          to: '/',\n          path: 'dashboard',\n          icon: <BiHomeSmile className=\"text-[22px]\" />,\n          name: '仪表盘',\n        },\n        {\n          to: '#',\n          path: 'write',\n          icon: <BiEditAlt className=\"text-[22px]\" />,\n          name: '创作',\n          subMenu: [\n            {\n              to: '/create',\n              path: 'create',\n              name: '谱写',\n            },\n            {\n              to: '/create_record',\n              path: 'create_record',\n              name: '闪念',\n            },\n            {\n              to: '/draft',\n              path: 'draft',\n              name: '草稿箱',\n            },\n            {\n              to: '/recycle',\n              path: 'recycle',\n              name: '回收站',\n            },\n          ],\n        },\n        {\n          to: '#',\n          path: 'manage',\n          icon: <BiCategoryAlt className=\"text-[22px]\" />,\n          name: '管理',\n          subMenu: [\n            {\n              to: '/article',\n              path: 'article',\n              name: '文章管理',\n            },\n            {\n              to: '/assistant',\n              path: 'assistant',\n              name: '助手管理',\n            },\n            {\n              to: '/record',\n              path: 'record',\n              name: '说说管理',\n            },\n            {\n              to: '/tag',\n              path: 'tag',\n              name: '标签管理',\n            },\n            {\n              to: '/comment',\n              path: 'comment',\n              name: '评论管理',\n            },\n            {\n              to: '/wall',\n              path: 'wall',\n              name: '留言管理',\n            },\n            {\n              to: '/cate',\n              path: 'cate',\n              name: '导航管理',\n            },\n            {\n              to: '/web',\n              path: 'web',\n              name: '网站管理',\n            },\n            {\n              to: '/swiper',\n              path: 'swiper',\n              name: '轮播图管理',\n            },\n            {\n              to: '/footprint',\n              path: 'footprint',\n              name: '足迹管理',\n            },\n            {\n              to: '/storage',\n              path: 'storage',\n              name: '存储管理',\n            },\n            {\n              to: '/config',\n              path: 'config',\n              name: '项目配置',\n            },\n          ],\n        },\n        {\n          to: '/setup',\n          path: 'setup',\n          icon: <BiSliderAlt className=\"text-[22px]\" />,\n          name: '系统',\n        },\n      ],\n    },\n    {\n      group: 'New',\n      list: [\n        {\n          to: '/work',\n          path: 'work',\n          icon: <TbBrandAirtable className=\"text-[22px]\" />,\n          name: '工作台',\n        },\n        {\n          to: '/file',\n          path: 'file',\n          icon: <BiFolderOpen className=\"text-[22px]\" />,\n          name: '文件系统',\n        },\n        {\n          to: '/iter',\n          path: 'iter',\n          icon: <BiBug className=\"text-[22px]\" />,\n          name: (\n            <div className=\"flex items-center w-full justify-between\">\n              <span>更新日志</span>\n              <div className=\"flex items-center gap-1\"/>\n            </div>\n          ),\n        },\n      ],\n    },\n  ];\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <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'}`}>\n        {/* Logo 和标题骨架屏 */}\n        <div className=\"flex justify-center items-center gap-2 px-6 py-5 pb-0 lg:pt-6 mb-4\">\n          <div className=\"flex items-center\">\n            <Skeleton.Input active size=\"default\" style={{ width: 100, height: 40 }} />\n          </div>\n        </div>\n\n        {/* 导航菜单骨架屏 */}\n        <div className=\"no-scrollbar flex flex-col overflow-y-auto duration-300 ease-linear\">\n          <nav className=\"pt-2 pb-4 px-4 lg:px-6\">\n            {/* 第一个路由组 */}\n            <div className=\"mb-6\">\n              <ul className=\"flex flex-col gap-1.5\">\n                {[1, 2, 3].map((item) => (\n                  <li key={item}>\n                    <div className=\"flex items-center gap-2.5 py-2 px-4\">\n                      <Skeleton.Avatar active size={22} shape=\"square\" />\n                      <Skeleton.Input active size=\"small\" style={{ width: 80, height: 20 }} />\n                    </div>\n                  </li>\n                ))}\n\n                {/* 带子菜单的项 */}\n                <li>\n                  <div className=\"flex items-center gap-2.5 py-2 px-4\">\n                    <Skeleton.Avatar active size={22} shape=\"square\" />\n                    <Skeleton.Input active size=\"small\" style={{ width: 60, height: 20, flex: 1 }} />\n                    <Skeleton.Avatar active size={12} shape=\"circle\" />\n                  </div>\n\n                  {/* 子菜单骨架屏 */}\n                  <div className=\"mt-4 mb-5.5 flex flex-col gap-2.5 pl-6\">\n                    {[1, 2, 3, 4].map((subItem) => (\n                      <div key={subItem} className=\"ml-6\">\n                        <Skeleton.Input active size=\"small\" style={{ width: 80, height: 20 }} />\n                      </div>\n                    ))}\n                  </div>\n                </li>\n              </ul>\n            </div>\n\n            {/* 第二个路由组 */}\n            <div>\n              <Skeleton.Input active size=\"small\" style={{ width: 20, height: 16, marginBottom: 16, marginLeft: 16 }} />\n              <ul className=\"flex flex-col gap-1.5\">\n                {[1, 2, 3].map((item) => (\n                  <li key={item}>\n                    <div className=\"flex items-center gap-2.5 py-2 px-4\">\n                      <Skeleton.Avatar active size={22} shape=\"square\" />\n                      <Skeleton.Input active size=\"small\" style={{ width: 80, height: 20 }} />\n                    </div>\n                  </li>\n                ))}\n              </ul>\n            </div>\n          </nav>\n        </div>\n      </aside>\n    );\n  }\n\n  // 渲染侧边栏组件\n  return (\n    <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'}`}>\n      {/* Logo 和标题区域 */}\n      <div className=\"flex justify-center items-center gap-2 px-6 py-5 pb-0 lg:pt-6\">\n        <NavLink to=\"/\" className={`flex items-center ${isSideBarTheme === 'dark' ? 'font-bold text-white' : 'font-medium text-[#555]! dark:text-white!'}`}>\n          <img src={logo} alt=\"logo\" className=\"w-8 mr-2.5\" />\n          <div>Thrive X</div>\n        </NavLink>\n\n        {/* 移动端侧边栏触发器按钮 */}\n        <button ref={trigger} onClick={() => setSidebarOpen(!sidebarOpen)} aria-controls=\"sidebar\" aria-expanded={sidebarOpen} className=\"block lg:hidden\" />\n      </div>\n\n      {/* 导航菜单区域 */}\n      <div className=\"no-scrollbar flex flex-col overflow-y-auto duration-300 ease-linear\">\n        <nav className=\"pt-2 pb-4 px-4 lg:px-6\">\n          {/* 遍历路由组并渲染 */}\n          {routes.map((group, index) => (\n            <div key={index}>\n              {/* 路由组标题 */}\n              <h3 className=\"mb-4 ml-4 text-sm font-semibold text-primary\">{group.group}</h3>\n\n              {/* 路由列表 */}\n              <ul className=\"mb-6 flex flex-col gap-1.5\">\n                {group.list.map((item, subIndex) =>\n                  // 根据是否有子菜单渲染不同的导航项\n                  item.subMenu ? (\n                    // 带子菜单的导航项组件\n                    <SidebarLinkGroup\n                      key={subIndex}\n                      activeCondition={\n                        // 默认展开\"创作\"菜单，或当前路径属于该菜单的子菜单\n                        item.path === 'write' || (item.subMenu && item.subMenu.some((subItem) => pathname.includes(subItem.path)))\n                      }\n                    >\n                      {(handleClick, open) => (\n                        <React.Fragment>\n                          {/* 父级菜单项 */}\n                          <NavLink\n                            to={item.to}\n                            className={`${isSideBarTheme === 'dark' ? sidebarItemStyDark : sidebarItemStyLight}`}\n                            onClick={(e) => {\n                              e.preventDefault();\n\n                              if (sidebarExpanded) {\n                                handleClick();\n                              } else {\n                                setSidebarExpanded(true);\n                              }\n                            }}\n                          >\n                            {item.icon}\n                            {item.name}\n                            <Arrow open={open} />\n                          </NavLink>\n\n                          {/* 子菜单列表 */}\n                          <div className={`translate transform overflow-hidden ${!open && 'hidden'}`}>\n                            <ul className=\"mt-4 mb-5.5 flex flex-col gap-2.5 pl-6\">\n                              {item.subMenu!.map((subItem, subSubIndex) => (\n                                <li key={subSubIndex}>\n                                  <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!')}>\n                                    {subItem.name}\n                                  </NavLink>\n                                </li>\n                              ))}\n                            </ul>\n                          </div>\n                        </React.Fragment>\n                      )}\n                    </SidebarLinkGroup>\n                  ) : (\n                    // 普通导航项\n                    <li key={subIndex}>\n                      <NavLink to={item.to} className={`${isSideBarTheme === 'dark' ? sidebarItemStyDark : sidebarItemStyLight} ${pathname.includes(item.path) && sidebarItemActiveSty}`}>\n                        {item.icon}\n                        {item.name}\n                      </NavLink>\n                    </li>\n                  ),\n                )}\n              </ul>\n            </div>\n          ))}\n        </nav>\n      </div>\n    </aside>\n  );\n};\n\nexport default Sidebar;\n"
  },
  {
    "path": "src/components/StatusTag/index.tsx",
    "content": "interface StatusTagProps {\n  status: number | boolean;\n  className?: string;\n  flash?: boolean;\n}\n\nexport default ({ status, className, flash = false }: StatusTagProps) => {\n  const enabled = Boolean(status);\n  const animateClass = flash ? 'animate-pulse' : '';\n  const pingClass = flash ? 'animate-ping' : '';\n\n  return (\n    <div className={`flex items-center justify-center ${className || ''}`}>\n      {enabled ? (\n        <div className=\"w-9 h-9 flex items-center justify-center rounded-full bg-green-50 hover:bg-green-100 transition-colors relative\">\n          <span className={`w-2.5 h-2.5 bg-green-500 rounded-full ${animateClass}`} />\n          <span className={`absolute w-2.5 h-2.5 bg-green-500 rounded-full ${pingClass} opacity-75`} />\n        </div>\n      ) : (\n        <div className=\"w-6 h-6 flex items-center justify-center rounded-full bg-red-50 hover:bg-red-100 transition-colors relative\">\n          <span className={`w-2.5 h-2.5 bg-red-500 rounded-full ${animateClass}`} />\n          <span className={`absolute w-2.5 h-2.5 bg-red-500 rounded-full ${pingClass} opacity-75`} />\n        </div>\n      )}\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/components/SystemNotification/index.tsx",
    "content": "import { Modal, Button } from 'antd';\nimport { GithubOutlined } from '@ant-design/icons';\n\nconst SHOW_NOTIFICATION_KEY = 'show_login_notification';\nconst GITHUB_URL = 'https://github.com/LiuYuYang01/ThriveX-Admin';\n\ninterface Props {\n  open: boolean;\n  onClose: () => void;\n}\n\nexport default ({ open, onClose }: Props) => {\n  // 关闭通知框\n  const handleClose = () => {\n    localStorage.removeItem(SHOW_NOTIFICATION_KEY);\n    onClose();\n  };\n\n  // 跳转到 GitHub\n  const handleGoToGitHub = () => {\n    window.open(GITHUB_URL, '_blank');\n  };\n\n  return (\n    <Modal title=\"📢 系统通知\" open={open} onCancel={handleClose} footer={null} width={600} className=\"login-notification-modal\">\n      <div className=\"py-4\">\n        <div className=\"text-center space-y-4\">\n          <div className=\"space-y-2\">\n            <h3 className=\"text-lg font-semibold text-gray-800 dark:text-gray-200\">⭐ 喜欢 ThriveX 吗？</h3>\n            <p className=\"text-gray-600 dark:text-gray-400 leading-relaxed\">\n              如果这个项目对你有帮助，欢迎在 GitHub 上给我们一个 Star！\n              <br />\n              你的支持是我们持续更新的最大动力 🚀\n            </p>\n          </div>\n\n          <div className=\"pt-2\">\n            <Button\n              type=\"primary\"\n              size=\"large\"\n              icon={<GithubOutlined />}\n              onClick={handleGoToGitHub}\n              style={{\n                height: '48px',\n                fontSize: '16px',\n                fontWeight: 500,\n              }}\n            >\n              前往 GitHub 点 Star\n            </Button>\n          </div>\n\n          <div className=\"pt-2\">\n            <p className=\"text-sm text-gray-500 dark:text-gray-400\">ThriveX 是一个年轻、高颜值、全开源、永不收费的现代化博客管理系统</p>\n          </div>\n        </div>\n      </div>\n    </Modal>\n  );\n};\n\n// 导出工具函数：设置显示通知标记\nexport const setShowLoginNotification = () => {\n  localStorage.setItem(SHOW_NOTIFICATION_KEY, 'true');\n};\n\n// 导出工具函数：检查是否需要显示通知\nexport const shouldShowLoginNotification = (): boolean => {\n  return localStorage.getItem(SHOW_NOTIFICATION_KEY) === 'true';\n};\n"
  },
  {
    "path": "src/components/Title/index.tsx",
    "content": "import { ReactNode } from 'react'\n\ninterface Props {\n    value: string,\n    children?: ReactNode,\n    className?: string\n}\n\nexport default ({ value, children }: Props) => {\n    return (\n        <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\">\n            <div className=\"overflow-auto flex justify-between items-center\">\n                <h2 className=\"font-semibold text-black dark:text-white text-xl min-w-24\">{value}</h2>\n\n                {children}\n            </div>\n        </div>\n    )\n}"
  },
  {
    "path": "src/components/WangEditor/index.scss",
    "content": ".w-e-text-container {\n    .w-e-bar {\n        display: none;\n    }\n}"
  },
  {
    "path": "src/components/WangEditor/index.tsx",
    "content": "import { useState, useEffect, useImperativeHandle, forwardRef } from 'react';\nimport { Editor, Toolbar } from '@wangeditor-next/editor-for-react';\nimport { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor-next/editor';\nimport '@wangeditor-next/editor/dist/css/style.css';\nimport './index.scss';\n\nexport default forwardRef((_props, ref) => {\n  // editor 实例\n  const [editor, setEditor] = useState<IDomEditor | null>(null);\n\n  // 编辑器内容\n  const [html, setHtml] = useState('');\n\n  // 工具栏配置\n  const toolbarConfig: Partial<IToolbarConfig> = {\n    excludeKeys: ['headerSelect', 'blockquote', 'emotion', 'group-video', 'group-image', 'formatPainter', 'divider', 'codeBlock', 'numberedList', 'bulletedList', 'todo', 'fontFamily', 'fontSize', 'fontColor'],\n  };\n\n  // 编辑器配置\n  const editorConfig: Partial<IEditorConfig> = {\n    placeholder: '记录此刻美好...',\n    autoFocus: true, // 默认获取焦点\n  };\n\n  useEffect(() => {\n    return () => {\n      if (editor == null) return;\n      editor.destroy();\n      setEditor(null);\n    };\n  }, [editor]);\n\n  // 暴露方法\n  useImperativeHandle(ref, () => {\n    return {\n      setValue: (value: string) => {\n        setHtml(value);\n      },\n      getValue: () => {\n        return editor?.getHtml();\n      },\n    };\n  }, [editor]);\n\n  return (\n    <div className=\"overflow-hidden border border-stroke rounded-xl z-40 w-full\">\n      <Toolbar editor={editor} defaultConfig={toolbarConfig} mode=\"default\" className=\"border-b border-stroke\" />\n\n      <Editor defaultConfig={editorConfig} value={html} onCreated={setEditor} onChange={(editor) => setHtml(editor.getHtml())} mode=\"default\" className=\"min-h-64\" />\n    </div>\n  );\n});\n"
  },
  {
    "path": "src/hooks/useAssistant.tsx",
    "content": "import { useState, useEffect } from 'react';\nimport { message } from 'antd';\nimport { testAssistantConnection, callAssistantAPI } from '@/services/assistant';\nimport { Assistant } from '@/types/app/assistant';\nimport { delAssistantDataAPI, getAssistantListAPI, addAssistantDataAPI, editAssistantDataAPI, setDefaultAssistantAPI } from '@/api/assistant';\n\nexport default function useAssistant() {\n  const [loading, setLoading] = useState(false);\n  const [testingMap, setTestingMap] = useState<Record<string, boolean>>({});\n\n  const [list, setList] = useState<Assistant[]>([]);\n  const [assistant, setAssistant] = useState<string | null>(null);\n\n  // 获取助手列表\n  const getAssistantList = async () => {\n    const { data } = await getAssistantListAPI();\n    setList(data);\n\n    // 设置默认助手\n    const defaultAssistant = data.find((a) => a.isDefault);\n    if (defaultAssistant) setAssistant(String(defaultAssistant.id));\n  };\n\n  // 初始化加载助手列表\n  useEffect(() => {\n    getAssistantList();\n  }, []);\n\n  // 添加或更新助手\n  const saveAssistant = async (assistant: Assistant) => {\n    setLoading(true);\n\n    try {\n      if (assistant.id) {\n        // 更新现有助手\n        await editAssistantDataAPI(assistant);\n      } else {\n        // 添加新助手\n        await addAssistantDataAPI(assistant);\n      }\n\n      // 更新成功后重新获取列表\n      await getAssistantList();\n      message.success(assistant.id ? '助手已更新' : '助手已添加');\n      return true;\n    } catch (error) {\n      console.error(error);\n      return false;\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // 删除助手\n  const delAssistantData = async (id: number) => {\n    await delAssistantDataAPI(id);\n    getAssistantList();\n    message.success('助手已删除');\n  };\n\n  // 设置默认助手\n  const setDefaultAssistant = async (id: number) => {\n    await setDefaultAssistantAPI(id);\n    getAssistantList();\n    message.success('默认助手已更新');\n  };\n\n  // 测试助手连接\n  const testConnection = async (assistant: Assistant) => {\n    setTestingMap((prev) => ({ ...prev, [assistant.id]: true }));\n    try {\n      const result = await testAssistantConnection(assistant);\n      return result;\n    } finally {\n      setTestingMap((prev) => ({ ...prev, [assistant.id]: false }));\n    }\n  };\n\n  // 调用助手API\n  const callAssistant = async (\n    messages: Array<{ role: string; content: string }>,\n    options?: {\n      stream?: boolean;\n      temperature?: number;\n      max_tokens?: number;\n    },\n  ) => {\n    if (!assistant) {\n      message.error('请先选择助手');\n      return null;\n    }\n\n    const data = list.find((a) => a.id === Number(assistant));\n    if (!data) {\n      message.error('助手不存在');\n      return null;\n    }\n\n    return callAssistantAPI(data, messages, options);\n  };\n\n  return {\n    list,\n    assistant,\n    setAssistant,\n    loading,\n    testingMap,\n    saveAssistant,\n    delAssistantData,\n    setDefaultAssistant,\n    testConnection,\n    callAssistant,\n  };\n}\n"
  },
  {
    "path": "src/hooks/useAuthRedirect.tsx",
    "content": "import { useEffect } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { useUserStore } from '@/stores';\n\n// 如果即将去往的是 /login 页面并且有 token 情况就自动重定向到 /，否则就跳转\nconst useAuthRedirect = () => {\n  const store = useUserStore();\n  const navigate = useNavigate();\n  const location = useLocation();\n\n  useEffect(() => {\n    const token = store.token;\n    const isGoingToLogin = location.pathname === '/login';\n\n    if (isGoingToLogin && token) navigate('/');\n  }, [location, navigate, store.token]);\n};\n\nexport default useAuthRedirect;\n"
  },
  {
    "path": "src/hooks/useLocalStorage.tsx",
    "content": "import { useEffect, useState } from 'react';\n\ntype SetValue<T> = T | ((val: T) => T);\n\nfunction useLocalStorage<T>(key: string, initialValue: T): [T, (value: SetValue<T>) => void] {\n  // 存储值的状态\n  // 将初始状态函数传递给useState，因此逻辑只执行一次\n  const [storedValue, setStoredValue] = useState(() => {\n    try {\n      // 通过键从本地存储中获取\n      const item = window.localStorage.getItem(key);\n      // 解析存储的json，如果没有则返回initialValue\n      return item ? JSON.parse(item) : initialValue;\n    } catch (error) {\n      // 如果出错也返回initialValue\n      console.log(error);\n      return initialValue;\n    }\n  });\n\n  // 当状态改变时，useEffect更新本地存储\n  useEffect(() => {\n    try {\n      // 允许值为函数，因此我们有与useState相同的API\n      const valueToStore = typeof storedValue === 'function' ? storedValue(storedValue) : storedValue;\n      // 保存状态\n      window.localStorage.setItem(key, JSON.stringify(valueToStore));\n    } catch (error) {\n      // 更高级的实现会处理错误情况\n      console.log(error);\n    }\n  }, [key, storedValue]);\n\n  return [storedValue, setStoredValue];\n}\n\nexport default useLocalStorage;\n"
  },
  {
    "path": "src/hooks/useVersionData.tsx",
    "content": "import { useState, useEffect } from 'react';\nimport axios from 'axios';\n\ninterface Version {\n  name: string;\n  tag_name: string;\n  html_url: string;\n}\n\nconst useVersionData = () => {\n  const [version, setVersion] = useState<Version>({} as Version);\n\n  useEffect(() => {\n    const getVersionData = async () => {\n      try {\n        // 先检查 sessionStorage 中是否有缓存的版本数据\n        const cachedVersion = sessionStorage.getItem('project_version');\n\n        if (cachedVersion) {\n          const parsedVersion = JSON.parse(cachedVersion);\n          // 检查缓存的数据是否有效（包含必要字段）\n          if (parsedVersion.tag_name && parsedVersion.html_url) {\n            setVersion(parsedVersion);\n            return; // 使用缓存数据，不调用接口\n          }\n        }\n\n        // 如果没有缓存或缓存无效，则调用接口获取数据\n        // https://api.github.com/repos/LiuYuYang01/ThriveX-Blog/releases\n        const { data } = await axios.get('https://api.github.com/repos/LiuYuYang01/ThriveX-Admin/releases/latest');\n        setVersion(data);\n        // 将新数据存储到 sessionStorage\n        sessionStorage.setItem('project_version', JSON.stringify(data));\n      } catch (error) {\n        console.error('获取版本信息失败:', error);\n      }\n    };\n\n    getVersionData();\n  }, []);\n\n  return version;\n};\n\nexport default useVersionData;\n"
  },
  {
    "path": "src/layout/DefaultLayout.tsx",
    "content": "import { useState, useEffect } from 'react';\nimport Header from '../components/Header/index';\nimport Sidebar from '../components/Sidebar/index';\nimport { useConfigStore } from '@/stores';\n\nexport default ({ children }: { children: React.ReactNode }) => {\n  const [sidebarOpen, setSidebarOpen] = useState(false);\n  const colorMode = useConfigStore((state) => state.colorMode);\n\n  useEffect(() => {\n    const className = 'dark';\n    const bodyClass = window.document.body.classList;\n\n    if (colorMode === 'dark') {\n      bodyClass.add(className);\n    } else {\n      bodyClass.remove(className);\n    }\n  }, [colorMode]);\n\n  return (\n    <div className=\"dark:bg-[#1A222C] dark:text-[#AEB7C0]\">\n      <div className=\"flex h-screen overflow-hidden\">\n        <Sidebar sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />\n\n        <div className=\"relative flex flex-1 flex-col overflow-y-auto overflow-x-hidden\">\n          <Header sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />\n\n          <main>\n            <div className=\"mx-auto p-4\">{children}</div>\n          </main>\n        </div>\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client';\nimport { BrowserRouter as Router } from 'react-router-dom';\nimport App from './App';\nimport '@/styles/index.css';\n\nconst app = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);\n\napp.render(\n  <Router>\n    <App />\n  </Router>,\n);\n"
  },
  {
    "path": "src/pages/article/components/ArticleExport.tsx",
    "content": "import React, { useCallback } from 'react';\nimport { Button, Dropdown, Popconfirm, Tooltip, message } from 'antd';\nimport { DownloadOutlined } from '@ant-design/icons';\nimport JSZip from 'jszip';\nimport { saveAs } from 'file-saver';\n\nimport type { Article } from '@/types/app/article';\n\n// 文章 → Markdown\nfunction articleToMarkdown(article: Article): string {\n  const { title, description, content, cover, createTime, cateList, tagList } = article;\n  const formatDate = (timestamp: string) => {\n    const date = new Date(Number(timestamp));\n    const pad = (n: number) => String(n).padStart(2, '0');\n    return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;\n  };\n  const tags = (tagList || []).map((t) => t.name);\n  const categories = (cateList || []).map((c) => c.name);\n  const keywords = [...tags, ...categories].join(' ');\n  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()}`;\n}\n\nfunction safeFileName(title: string): string {\n  return title.replace(/[\\\\/:*?\"<>|]/g, '_');\n}\n\nfunction downloadBlob(content: string, fileName: string, mimeType = 'text/plain;charset=utf-8') {\n  const blob = new Blob([content], { type: mimeType });\n  const url = URL.createObjectURL(blob);\n  const a = document.createElement('a');\n  a.href = url;\n  a.download = fileName;\n  document.body.appendChild(a);\n  a.click();\n  document.body.removeChild(a);\n  URL.revokeObjectURL(url);\n}\n\nasync function downloadArticlesZip(articles: Article[]) {\n  const zip = new JSZip();\n  const folder = zip.folder('data');\n  for (const article of articles) {\n    const markdown = articleToMarkdown(article);\n    folder?.file(`${safeFileName(article.title)}.md`, markdown);\n  }\n  zip.file('articles.json', JSON.stringify(articles, null, 2));\n  const blob = await zip.generateAsync({ type: 'blob' });\n  saveAs(blob, `导出文章_${Date.now()}.zip`);\n}\n\n// 单篇导出\nexport interface ArticleExportSingleProps {\n  article: Article;\n}\n\nexport const ArticleExportSingle = ({ article }: ArticleExportSingleProps) => {\n  const handleExport = useCallback(() => {\n    const markdown = articleToMarkdown(article);\n    downloadBlob(markdown, `${safeFileName(article.title)}.md`, 'text/markdown;charset=utf-8');\n  }, [article]);\n\n  return (\n    <Tooltip title=\"导出\">\n      <Popconfirm\n        title=\"提醒\"\n        description=\"确定要导出该文章吗？\"\n        okText=\"确定\"\n        cancelText=\"取消\"\n        onConfirm={handleExport}\n      >\n        <Button\n          type=\"text\"\n          size=\"small\"\n          icon={<DownloadOutlined />}\n          className=\"hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50\"\n        />\n      </Popconfirm>\n    </Tooltip>\n  );\n};\n\n\n// 批量导出\nexport interface ArticleExportDropdownProps {\n  selectedArticles: Article[];\n  onLoadAll: () => Promise<Article[]>;\n  setLoading?: (loading: boolean) => void;\n}\n\nexport const ArticleExportDropdown = ({\n  selectedArticles,\n  onLoadAll,\n  setLoading,\n}: ArticleExportDropdownProps) => {\n  const handleExportSelected = useCallback(() => {\n    if (!selectedArticles.length) {\n      message.warning('请选择要导出的文章');\n      return;\n    }\n    downloadArticlesZip(selectedArticles);\n  }, [selectedArticles]);\n\n  const handleExportAll = useCallback(async () => {\n    try {\n      setLoading?.(true);\n      const all = await onLoadAll();\n      await downloadArticlesZip(all);\n    } catch (err) {\n      console.error(err);\n      message.error('导出全部失败');\n    } finally {\n      setLoading?.(false);\n    }\n  }, [onLoadAll, setLoading]);\n\n  return (\n    <Dropdown.Button\n      icon={<DownloadOutlined />}\n      className=\"w-[120px]\"\n      menu={{\n        items: [\n          { label: '导出选中', key: 'selected', onClick: handleExportSelected },\n          { label: '导出全部', key: 'all', onClick: () => handleExportAll() },\n        ],\n      }}\n    >\n      导出文章\n    </Dropdown.Button>\n  );\n};\n\nconst ArticleExport = {\n  Single: ArticleExportSingle,\n  Dropdown: ArticleExportDropdown,\n};\n\nexport default ArticleExport;"
  },
  {
    "path": "src/pages/article/components/ArticleImportModal.tsx",
    "content": "import React, { useState, useRef, useEffect, useCallback, ChangeEvent, DragEvent } from 'react';\nimport { Modal, Button, message } from 'antd';\nimport type { UploadFile } from 'antd/es/upload/interface';\nimport type { RcFile } from 'antd/es/upload/interface';\nimport type { UploadFileStatus } from 'antd/es/upload/interface';\nimport { InboxOutlined } from '@ant-design/icons';\n\nconst ACCEPT_EXT = ['.md', '.json'];\nconst MAX_FILES = 5;\n\nconst createUploadFile = (file: File): UploadFile => {\n  const rc = file as RcFile;\n  if (!rc.uid) rc.uid = Math.random().toString();\n  return {\n    uid: rc.uid,\n    name: file.name,\n    status: 'done' as UploadFileStatus,\n    originFileObj: rc,\n  };\n};\n\nconst isValidFile = (name: string) =>\n  ACCEPT_EXT.some((ext) => name.toLowerCase().endsWith(ext));\n\nexport interface ArticleImportModalProps {\n  open: boolean;\n  onClose: () => void;\n  onImport: (files: File[]) => Promise<void>;\n}\n\nconst ArticleImportModal: React.FC<ArticleImportModalProps> = ({\n  open,\n  onClose,\n  onImport,\n}) => {\n  const [fileList, setFileList] = useState<UploadFile[]>([]);\n  const [isDragging, setIsDragging] = useState(false);\n  const [importLoading, setImportLoading] = useState(false);\n  const fileInputRef = useRef<HTMLInputElement | null>(null);\n\n  // 关闭时清空文件列表\n  useEffect(() => {\n    if (!open) {\n      setFileList([]);\n      setIsDragging(false);\n    }\n  }, [open]);\n\n  const handleCancel = useCallback(() => {\n    if (!importLoading) onClose();\n  }, [importLoading, onClose]);\n\n  const handleDragOver = useCallback((e: DragEvent) => {\n    e.preventDefault();\n    e.stopPropagation();\n  }, []);\n\n  const handleDragEnter = useCallback((e: DragEvent) => {\n    e.preventDefault();\n    e.stopPropagation();\n    setIsDragging(true);\n  }, []);\n\n  const handleDragLeave = useCallback((e: DragEvent) => {\n    e.preventDefault();\n    e.stopPropagation();\n    setIsDragging(false);\n  }, []);\n\n  const handleDrop = useCallback((e: DragEvent) => {\n    e.preventDefault();\n    e.stopPropagation();\n    setIsDragging(false);\n    const files = Array.from(e.dataTransfer.files);\n    const valid = files.filter((f) => isValidFile(f.name));\n    if (!valid.length) {\n      message.error('仅支持 Markdown(.md) 或 JSON(.json) 文件');\n      return;\n    }\n    if (fileList.length + valid.length > MAX_FILES) {\n      message.error(`最多只能上传 ${MAX_FILES} 个文件`);\n      return;\n    }\n    setFileList((prev) => [...prev, ...valid.map(createUploadFile)]);\n    message.success(`成功添加 ${valid.length} 个文件`);\n  }, [fileList.length]);\n\n  const handleFileInputChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n    const files = Array.from(e.target.files || []);\n    const valid = files.filter((f) => isValidFile(f.name));\n    if (!valid.length) {\n      message.error('仅支持 Markdown(.md) 或 JSON(.json) 文件');\n      e.target.value = '';\n      return;\n    }\n    if (fileList.length + valid.length > MAX_FILES) {\n      message.error(`最多只能上传 ${MAX_FILES} 个文件`);\n      e.target.value = '';\n      return;\n    }\n    setFileList((prev) => [...prev, ...valid.map(createUploadFile)]);\n    e.target.value = '';\n  }, [fileList.length]);\n\n  const removeFile = useCallback((uid: string) => {\n    setFileList((prev) => prev.filter((f) => f.uid !== uid));\n  }, []);\n\n  const downloadMarkdownTemplate = useCallback(() => {\n    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 正文内容，请开始创作吧~`;\n    const blob = new Blob([content], { type: 'text/markdown;charset=utf-8' });\n    const url = URL.createObjectURL(blob);\n    const a = document.createElement('a');\n    a.href = url;\n    a.download = '文章模板.md';\n    a.click();\n    URL.revokeObjectURL(url);\n  }, []);\n\n  const downloadJsonTemplate = useCallback(() => {\n    const data = {\n      title: '示例文章标题',\n      description: '文章描述',\n      content: '# 正文内容',\n      cover: '',\n      createTime: Date.now().toString(),\n      cateList: [{ id: 1, name: '示例分类' }],\n      tagList: [{ id: 2, name: '示例标签' }],\n      config: {\n        status: 'default',\n        password: '',\n        isDraft: 0,\n        isEncrypt: 0,\n        isDel: 0,\n      },\n    };\n    const blob = new Blob([JSON.stringify(data, null, 2)], {\n      type: 'application/json',\n    });\n    const url = URL.createObjectURL(blob);\n    const a = document.createElement('a');\n    a.href = url;\n    a.download = '文章模板.json';\n    a.click();\n    URL.revokeObjectURL(url);\n  }, []);\n\n  const handleImport = useCallback(async () => {\n    if (fileList.length === 0) {\n      message.warning('请上传至少一个 .md 或 .json 文件');\n      return;\n    }\n    const files = fileList\n      .map((f) => f.originFileObj as File)\n      .filter(Boolean);\n    if (!files.length) return;\n    setImportLoading(true);\n    try {\n      await onImport(files);\n      onClose();\n    } finally {\n      setImportLoading(false);\n    }\n  }, [fileList, onImport, onClose]);\n\n  return (\n    <Modal\n      title=\"导入文章\"\n      open={open}\n      onCancel={handleCancel}\n      footer={[\n        <Button key=\"cancel\" onClick={handleCancel} disabled={importLoading}>\n          取消\n        </Button>,\n        <Button\n          key=\"import\"\n          type=\"primary\"\n          onClick={handleImport}\n          loading={importLoading}\n          disabled={fileList.length === 0}\n        >\n          开始导入\n        </Button>,\n      ]}\n    >\n      <div className=\"py-4\">\n        <div\n          role=\"button\"\n          tabIndex={0}\n          onClick={() => fileInputRef.current?.click()}\n          onKeyDown={(e) => e.key === 'Enter' && fileInputRef.current?.click()}\n          onDragOver={handleDragOver}\n          onDragEnter={handleDragEnter}\n          onDragLeave={handleDragLeave}\n          onDrop={handleDrop}\n          className={`w-full h-40 p-4 border border-dashed rounded-lg transition-all duration-300 ${\n            isDragging\n              ? 'border-primary bg-primary/5'\n              : 'border-[#D7D7D7] hover:border-primary bg-[#FAFAFA]'\n          } space-y-2 cursor-pointer`}\n        >\n          <div className=\"flex justify-center\">\n            <InboxOutlined className=\"text-5xl text-primary\" />\n          </div>\n          <p className=\"text-base text-center\">\n            {isDragging ? '文件放在此处即上传' : '点击或拖动文件到此区域'}\n          </p>\n          <p className=\"text-sm text-[#999] text-center\">\n            仅支持 Markdown 或 JSON 格式\n          </p>\n        </div>\n\n        <input\n          multiple\n          type=\"file\"\n          ref={fileInputRef}\n          onChange={handleFileInputChange}\n          className=\"hidden\"\n          accept=\".md,.json\"\n        />\n\n        {fileList.length > 0 && (\n          <div className=\"mt-4\">\n            <p className=\"text-sm text-gray-500 mb-2\">已选择的文件：</p>\n            <ul className=\"space-y-2\">\n              {fileList.map((file) => (\n                <li\n                  key={file.uid}\n                  className=\"flex items-center justify-between bg-gray-50 p-2 rounded-sm\"\n                >\n                  <span className=\"text-sm\">{file.name}</span>\n                  <Button\n                    type=\"text\"\n                    danger\n                    size=\"small\"\n                    onClick={(e) => {\n                      e.stopPropagation();\n                      removeFile(file.uid);\n                    }}\n                  >\n                    删除\n                  </Button>\n                </li>\n              ))}\n            </ul>\n          </div>\n        )}\n\n        {fileList.length === 0 && (\n          <div className=\"mt-4 flex justify-between items-center text-sm text-gray-500\">\n            <span>你可以下载模板后填写再导入：</span>\n            <div className=\"space-x-2\">\n              <Button type=\"link\" size=\"small\" onClick={downloadMarkdownTemplate}>\n                下载 Markdown 模板\n              </Button>\n              <Button type=\"link\" size=\"small\" onClick={downloadJsonTemplate}>\n                下载 JSON 模板\n              </Button>\n            </div>\n          </div>\n        )}\n      </div>\n    </Modal>\n  );\n};\n\nexport default ArticleImportModal;\n"
  },
  {
    "path": "src/pages/article/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Link } from 'react-router-dom';\n\nimport { Table, Button, Tag, notification, Popconfirm, Form, Input, Select, DatePicker, message, Tooltip, Space, Divider, Popover } from 'antd';\nimport type { ColumnsType } from 'antd/es/table';\nimport type { TableRowSelection } from 'antd/es/table/interface';\nimport { DeleteOutlined, FormOutlined, InboxOutlined, SearchOutlined, ClearOutlined, EyeOutlined, CommentOutlined } from '@ant-design/icons';\nimport { HiOutlineChevronDown, HiOutlineChevronUp } from 'react-icons/hi';\nimport dayjs from 'dayjs';\n\nimport Title from '@/components/Title';\nimport ArticleImportModal from './components/ArticleImportModal';\nimport ArticleExport from './components/ArticleExport';\n\nimport { getCateListAPI } from '@/api/cate';\nimport { getTagListAPI } from '@/api/tag';\nimport { delArticleDataAPI, getArticlePagingAPI, addArticleDataAPI, delBatchArticleDataAPI } from '@/api/article';\n\nimport type { Tag as ArticleTag } from '@/types/app/tag';\nimport type { Cate as ArticleCate } from '@/types/app/cate';\nimport type { Article, Config, ArticleFilterQueryParams, ArticleFilterDataForm } from '@/types/app/article';\n\nimport { useWebStore } from '@/stores';\n\nconst { RangePicker } = DatePicker;\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState<number | null>(null);\n  const [isModalOpen, setIsModalOpen] = useState<boolean>(false);\n  const isFirstLoadRef = useRef<boolean>(true);\n  const filterDebounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const [form] = Form.useForm();\n  const web = useWebStore((state) => state.web);\n  const [articleList, setArticleList] = useState<Article[]>([]);\n\n  const [total, setTotal] = useState<number>(0);\n\n  const [filter, setFilter] = useState<ArticleFilterQueryParams>({\n    key: undefined,\n    cateId: undefined,\n    tagId: undefined,\n    isDraft: 0,\n    isDel: 0,\n    startDate: undefined,\n    endDate: undefined,\n    page: 1,\n    size: 8,\n  });\n  const [showBatchActions, setShowBatchActions] = useState<boolean>(false);\n\n  // 分页获取文章\n  const getArticleList = async () => {\n    try {\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getArticlePagingAPI(filter);\n      setTotal(data.total);\n      setArticleList(data.result);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  const delArticleData = async (id: number) => {\n    try {\n      setBtnLoading(id);\n      await delArticleDataAPI(id, true);\n      await getArticleList();\n      notification.success({ message: '删除成功' });\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setBtnLoading(null);\n    }\n  };\n\n  // 分类/标签：柔和色系，收纳展示（默认显示前 2 个，其余 +N，悬停展示全部）\n  const tagColors = [\n    'default',\n    'processing',\n    'success',\n    'warning',\n    'cyan',\n  ] as const;\n  const VISIBLE_TAG_COUNT = 1;\n\n  const renderCollapsibleTags = <T extends { id?: number; name: string }>(\n    list: T[],\n    keyPrefix: string,\n  ) => {\n    if (list.length === 0) return null;\n    const visible = list.slice(0, VISIBLE_TAG_COUNT);\n    const restCount = list.length - VISIBLE_TAG_COUNT;\n    const items = (\n      <div className=\"flex flex-wrap gap-1.5 max-w-[280px]\">\n        {list.map((item, index) => (\n          <Tag\n            key={item.id ?? index}\n            color={tagColors[index % tagColors.length]}\n            className=\"m-0! border-0!\"\n          >\n            {item.name}\n          </Tag>\n        ))}\n      </div>\n    );\n    return (\n      <div className=\"flex flex-wrap items-center gap-1.5 justify-start\">\n        {visible.map((item, index) => (\n          <Tag\n            key={`${keyPrefix}-${item.id ?? index}`}\n            color={tagColors[index % tagColors.length]}\n            className=\"m-0! border-0!\"\n          >\n            {item.name}\n          </Tag>\n        ))}\n\n        {restCount > 0 && (\n          <Popover\n            content={items}\n            trigger=\"hover\"\n            placement=\"topLeft\"\n            classNames={{ root: 'article-tags-popover' }}\n          >\n            <span\n              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\"\n              role=\"button\"\n              tabIndex={0}\n            >\n              +{restCount}\n            </span>\n          </Popover>\n        )}\n      </div>\n    );\n  };\n\n  const columns: ColumnsType<Article> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      width: 80,\n      align: 'center',\n      render: (text) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '标题',\n      dataIndex: 'title',\n      key: 'title',\n      width: 280,\n      render: (text: string, record: Article) => (\n        <>\n          {text ? (\n            <Tooltip title={text} placement=\"topLeft\">\n              <a\n                href={`${web.url}/article/${record.id}`}\n                target=\"_blank\"\n                rel=\"noreferrer\"\n                className=\"max-w-[280px] truncate block text-gray-700 dark:text-gray-200 font-medium hover:text-primary dark:hover:text-primary\"\n              >\n                {text}\n              </a>\n            </Tooltip>\n          )\n            : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无标题</span>\n            )\n          }\n        </>\n      ),\n    },\n    {\n      title: '摘要',\n      dataIndex: 'description',\n      key: 'description',\n      width: 320,\n      render: (text: string) => (\n        <>\n          {text ? (\n            <Tooltip title={text}>\n              <div className=\"max-w-[320px] truncate text-gray-700 dark:text-gray-200 hover:text-primary dark:hover:text-primary cursor-pointer\">\n                {text}\n              </div>\n            </Tooltip>\n          ) : (\n            <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无摘要</span>\n          )}\n        </>\n      ),\n    },\n    {\n      title: '分类',\n      dataIndex: 'cateList',\n      key: 'cateList',\n      width: 140,\n      render: (cates: ArticleCate[]) => renderCollapsibleTags(cates || [], 'cate'),\n    },\n    {\n      title: '标签',\n      dataIndex: 'tagList',\n      key: 'tagList',\n      width: 160,\n      render: (tags: ArticleTag[]) => renderCollapsibleTags(tags || [], 'tag'),\n    },\n    {\n      title: '浏览量',\n      dataIndex: 'view',\n      key: 'view',\n      width: 100,\n      align: 'center',\n      render: (v) => (\n        <span className=\"inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums\">\n          <EyeOutlined className=\"text-gray-400 dark:text-gray-500 text-xs\" />\n          <span className=\"font-medium\">{v ?? 0}</span>\n        </span>\n      ),\n      sorter: (a: Article, b: Article) => (a.view ?? 0) - (b.view ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '评论',\n      dataIndex: 'comment',\n      key: 'comment',\n      width: 90,\n      align: 'center',\n      render: (v) => (\n        <span className=\"inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums\">\n          <CommentOutlined className=\"text-gray-400 dark:text-gray-500 text-xs\" />\n          <span className=\"font-medium\">{v ?? 0}</span>\n        </span>\n      ),\n      sorter: (a: Article, b: Article) => (a.comment ?? 0) - (b.comment ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '状态',\n      dataIndex: 'config',\n      key: 'config',\n      width: 130,\n      align: 'center',\n      render: (config: Config) => {\n        const statusMap: Record<string, string> = {\n          default: '正常',\n          no_home: '不在首页显示',\n          hide: '隐藏',\n        };\n        const label = config.password?.trim() ? '文章加密' : statusMap[config.status];\n        const statusColorMap: Record<string, string> = {\n          default: 'success',\n          no_home: 'warning',\n          hide: 'default',\n        };\n        const color = config.password?.trim() ? 'processing' : statusColorMap[config.status] ?? 'default';\n        return (\n          <Tag color={color} className=\"m-0! border-0! whitespace-nowrap\">\n            {label}\n          </Tag>\n        );\n      },\n    },\n    {\n      title: '发布时间',\n      dataIndex: 'createTime',\n      key: 'createTime',\n      width: 140,\n      render: (text: string) => (\n        <div className=\"flex flex-col\">\n          <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{dayjs(+text).format('YYYY-MM-DD')}</span>\n          <span className=\"text-gray-400 dark:text-gray-500 text-xs\">{dayjs(+text).format('HH:mm:ss')}</span>\n        </div>\n      ),\n    },\n    {\n      title: '操作',\n      key: 'action',\n      fixed: 'right',\n      width: 165,\n      align: 'center',\n      render: (_, record: Article) => (\n        <Space separator={<Divider orientation=\"vertical\" />}>\n          <ArticleExport.Single article={record} />\n\n          <Tooltip title=\"编辑\">\n            <Link to={`/create?id=${record.id}`}>\n              <Button\n                type=\"text\"\n                size=\"small\"\n                icon={<FormOutlined className=\"text-blue-500\" />}\n                className=\"text-blue-500 dark:text-gray-300 dark:hover:text-blue-500! hover:bg-blue-50 dark:hover:bg-blue-900/20\"\n              />\n            </Link>\n          </Tooltip>\n\n          <Tooltip title=\"删除\">\n            <Popconfirm\n              title=\"删除确认\"\n              description=\"该操作可从回收站恢复，确定删除吗？\"\n              okText=\"删除\"\n              okButtonProps={{ danger: true }}\n              cancelText=\"取消\"\n              onConfirm={() => delArticleData(record.id!)}\n            >\n              <Button\n                type=\"text\"\n                size=\"small\"\n                danger\n                loading={btnLoading === record.id}\n                icon={<DeleteOutlined />}\n                className=\"hover:bg-red-50 dark:hover:bg-red-900/20\"\n              />\n            </Popconfirm>\n          </Tooltip>\n        </Space>\n      ),\n    },\n  ];\n\n  const applyFormValuesToFilter = (values: ArticleFilterDataForm) => {\n    setFilter((prev) => ({\n      ...prev,\n      key: values.title,\n      cateId: values.cateId,\n      tagId: values.tagId,\n      startDate: values.createTime?.[0] ? String(values.createTime[0].valueOf()) : undefined,\n      endDate: values.createTime?.[1] ? String(values.createTime[1].valueOf()) : undefined,\n      page: 1,\n      size: prev.size ?? 8,\n    }));\n  };\n\n  const onFilterValuesChange = (_: Partial<ArticleFilterDataForm>, allValues: ArticleFilterDataForm) => {\n    if (filterDebounceRef.current) {\n      clearTimeout(filterDebounceRef.current);\n      filterDebounceRef.current = null;\n    }\n    const hasTitleChange = 'title' in (_ as Partial<ArticleFilterDataForm>);\n    if (hasTitleChange) {\n      filterDebounceRef.current = setTimeout(() => applyFormValuesToFilter(allValues), 400);\n    } else {\n      applyFormValuesToFilter(allValues);\n    }\n  };\n\n  const onFilterReset = () => {\n    if (filterDebounceRef.current) {\n      clearTimeout(filterDebounceRef.current);\n      filterDebounceRef.current = null;\n    }\n    form.resetFields();\n    setFilter({\n      page: 1,\n      size: 8,\n      key: undefined,\n      cateId: undefined,\n      tagId: undefined,\n      isDraft: 0,\n      isDel: 0,\n      startDate: undefined,\n      endDate: undefined,\n    });\n  };\n\n  const [cateList, setCateList] = useState<ArticleCate[]>([]);\n  const [tagList, setTagList] = useState<ArticleTag[]>([]);\n\n  const getCateList = async () => {\n    const { data } = await getCateListAPI();\n    setCateList(data.result.filter((item: ArticleCate) => item.type === 'cate'));\n  };\n\n  const getTagList = async () => {\n    const { data } = await getTagListAPI();\n    setTagList(data as ArticleTag[]);\n  };\n\n  // 导入文章：收集文件后调用，仅负责解析与提交\n  const handleArticleImport = async (files: File[]) => {\n    const articles: Article[] = [];\n\n    for (const file of files) {\n      const text = await file.text();\n      if (file.name.endsWith('.md')) {\n        const article = parseMarkdownToArticle(text);\n        articles.push(article);\n      } else if (file.name.endsWith('.json')) {\n        const json = JSON.parse(text);\n        articles.push(...parseJsonToArticles(json));\n      }\n    }\n\n    if (articles.length === 0) {\n      notification.error({ message: '解析失败，未提取出有效文章数据' });\n      return;\n    }\n\n    try {\n      setLoading(true);\n      for (const article of articles) {\n        try {\n          const { code } = await addArticleDataAPI(article);\n          if (code === 200) message.success(`${article.title}--导入成功~`);\n        } catch (error) {\n          console.error(error);\n          message.error(`${article.title}--导入失败~`);\n        }\n      }\n      await getArticleList();\n      notification.success({ message: `🎉 成功导入 ${articles.length} 篇文章` });\n    } catch (err) {\n      console.error(err);\n      notification.error({ message: '导入失败，请检查文件格式或控制台报错' });\n      throw err;\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const getTagOrCateIdsByNames = (names: string[], allTags: ArticleTag[] | ArticleCate[]) => {\n    const lowerCaseMap = new Map<string, number>();\n\n    // 忽略大小写\n    for (const item of allTags) {\n      lowerCaseMap.set(item.name.toLowerCase(), item.id as number);\n    }\n\n    return (\n      names\n        .map((name) => lowerCaseMap.get(name.toLowerCase()))\n        // 去除未匹配项\n        .filter((id): id is number => id !== undefined)\n    );\n  };\n\n  // 从 markdown 字符串解析为 Article JSON\n  const parseMarkdownToArticle = (mdText: string): Article => {\n    // 提取 frontmatter 块\n    const frontmatterMatch = mdText.match(/^---\\n([\\s\\S]*?)\\n---/);\n    if (!frontmatterMatch) throw new Error('Markdown 文件格式错误，缺少 frontmatter');\n\n    const frontmatterText = frontmatterMatch[1];\n    // 去除 frontmatter 后的正文\n    const content = mdText.replace(frontmatterMatch[0], '').trim();\n\n    const meta: Record<string, string> = {};\n\n    // 解析 frontmatter 每一行 key: value\n    frontmatterText.split('\\n').forEach((line) => {\n      const [key, ...rest] = line.split(':');\n      meta[key.trim()] = rest.join(':').trim();\n    });\n\n    // 时间戳（从 YYYY-MM-DD HH:mm:ss 转为 timestamp）\n    const parseDateToTimestamp = (str: string): string => {\n      const d = new Date(str);\n      if (isNaN(d.getTime())) return Date.now().toString();\n      return d.getTime().toString();\n    };\n    const tagNames = meta.tags?.split(/\\s+/).filter(Boolean) || [];\n    const tagIds = getTagOrCateIdsByNames(tagNames, tagList);\n    const cateNames = meta.categories?.split(/\\s+/).filter(Boolean) || [];\n    const cateIds = getTagOrCateIdsByNames(cateNames, cateList);\n\n    const article: Article = {\n      title: meta.title || '未命名文章',\n      description: meta.description || '',\n      content,\n      cover: meta.cover || '',\n      createTime: parseDateToTimestamp(meta.date || ''),\n      cateIds,\n      tagIds,\n      config: {\n        status: 'default',\n        password: '',\n        isDraft: 0,\n        isEncrypt: 0,\n        isDel: 0,\n      },\n    };\n\n    return article;\n  };\n\n  // 解析 JSON 内容为文章数据列表\n  const parseJsonToArticles = (raw: Article | Article[]): Article[] => {\n    const parseSingle = (item: Article): Article => ({\n      title: item.title || '未命名文章',\n      description: item.description || '',\n      content: item.content || '',\n      cover: item.cover || '',\n      createTime: item.createTime,\n      cateIds: (item.cateList || []).map((cate) => cate.id).filter((id): id is number => id !== undefined),\n      tagIds: (item.tagList || []).map((tag) => tag.id).filter((id): id is number => id !== undefined),\n      config: {\n        status: item.config?.status || 'default',\n        password: item.config?.password || '',\n        isDraft: item.config?.isDraft || 0,\n        isEncrypt: item.config?.isEncrypt || 0,\n        isDel: item.config?.isDel || 0,\n      },\n    });\n\n    // 如果是数组则批量解析，否则解析单个\n    return Array.isArray(raw) ? raw.map(parseSingle) : [parseSingle(raw)];\n  };\n\n  // 删除选中\n  const delSelected = async () => {\n    if (!selectedRowKeys.length) {\n      message.warning('请选择要删除的文章');\n      return;\n    }\n\n    try {\n      setLoading(true);\n      const { code } = await delBatchArticleDataAPI(selectedRowKeys as number[]);\n      if (code === 200) {\n        message.success('删除成功');\n        await getArticlePagingAPI({ page: 1, size: 8 });\n      } else {\n        message.error('删除失败');\n      }\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);\n\n  const onSelectChange = (newSelectedRowKeys: React.Key[]) => {\n    setSelectedRowKeys(newSelectedRowKeys);\n  };\n\n  // 选择行\n  const rowSelection: TableRowSelection<Article> = {\n    selectedRowKeys,\n    onChange: onSelectChange,\n    fixed: 'left',\n  };\n\n  // 导出全部时拉取所有文章\n  const loadAllArticles = async (): Promise<Article[]> => {\n    const { data } = await getArticlePagingAPI();\n    return data.result;\n  };\n\n  useEffect(() => {\n    getArticleList();\n  }, [filter]);\n\n  useEffect(() => {\n    getCateList();\n    getTagList();\n  }, []);\n\n  // 自定义骨架屏\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"flex justify-between mb-6\">\n            <div className=\"flex gap-4 flex-wrap\">\n              <div className=\"skeleton h-9\" style={{ width: 200 }} />\n              <div className=\"skeleton h-9\" style={{ width: 180 }} />\n              <div className=\"skeleton h-9\" style={{ width: 180 }} />\n              <div className=\"skeleton h-9\" style={{ width: 280 }} />\n            </div>\n            <div className=\"flex gap-2\">\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n            </div>\n          </div>\n\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"文章管理\" />\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <div className=\"p-5 border-b border-gray-100 dark:border-strokedark bg-gray-50/30 dark:bg-boxdark-2/50 space-y-4\">\n          {/* 筛选区：搜索条件 + 查询/重置 */}\n          <Form form={form} layout=\"inline\" onValuesChange={onFilterValuesChange} className=\"flex! flex-wrap! items-center! gap-y-2.5!\">\n            <Form.Item name=\"title\" className=\"mb-0!\">\n              <Input\n                prefix={<SearchOutlined className=\"text-gray-400 dark:text-gray-500\" />}\n                placeholder=\"搜索文章标题...\"\n                className=\"w-[220px]!\"\n                allowClear\n              />\n            </Form.Item>\n\n            <Form.Item name=\"cateId\" className=\"mb-0!\">\n              <Select\n                allowClear\n                options={cateList}\n                fieldNames={{ label: 'name', value: 'id' }}\n                placeholder=\"选择分类\"\n                className=\"w-[160px]!\"\n              />\n            </Form.Item>\n\n            <Form.Item name=\"tagId\" className=\"mb-0!\">\n              <Select\n                allowClear\n                showSearch\n                options={tagList}\n                fieldNames={{ label: 'name', value: 'id' }}\n                placeholder=\"选择标签\"\n                className=\"w-[140px]!\"\n                filterOption={(input, option) => (option?.name ?? '').toLowerCase().includes(input.toLowerCase())}\n              />\n            </Form.Item>\n\n            <Form.Item name=\"createTime\" className=\"mb-0!\">\n              <RangePicker\n                className=\"w-[260px]!\"\n                placeholder={['开始日期', '结束日期']}\n                disabledDate={(current) => current && current > dayjs().endOf('day')}\n              />\n            </Form.Item>\n\n            <Space className=\"sm:flex-nowrap\">\n              <Button icon={<ClearOutlined />} onClick={onFilterReset}>\n                重置\n              </Button>\n              <Button\n                icon={showBatchActions ? <HiOutlineChevronUp /> : <HiOutlineChevronDown />}\n                onClick={() => setShowBatchActions((v) => !v)}\n              >\n                {showBatchActions ? '收起' : '功能'}\n              </Button>\n            </Space>\n          </Form>\n\n          {showBatchActions && (\n            <div className=\"flex justify-between items-center pt-2 mt-2! border-t border-gray-100 dark:border-strokedark gap-2\">\n              <div></div>\n\n              <div className=\"flex space-x-3\">\n                <ArticleExport.Dropdown\n                  selectedArticles={articleList.filter((a) => selectedRowKeys.includes(a.id as number))}\n                  onLoadAll={loadAllArticles}\n                  setLoading={setLoading}\n                />\n\n                <Button type=\"primary\" icon={<InboxOutlined />} onClick={() => setIsModalOpen(true)}>\n                  导入文章\n                </Button>\n                <Popconfirm title=\"删除确认\" description=\"确定要删除选中的文章吗？\" okText=\"删除\" okButtonProps={{ danger: true }} cancelText=\"取消\" onConfirm={() => delSelected()}>\n                  <Button danger icon={<DeleteOutlined />}>删除选中</Button>\n                </Popconfirm>\n              </div>\n            </div>\n          )}\n        </div>\n\n        <Table\n          rowKey=\"id\"\n          rowSelection={rowSelection}\n          dataSource={articleList}\n          columns={columns}\n          loading={loading}\n          pagination={{\n            position: ['bottomRight'],\n            current: filter.page,\n            pageSize: filter.size,\n            total,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                当前第 {filter.page} / {Math.ceil(totalCount / (filter.size || 8))} 页 | 共 {totalCount} 条数据\n              </div>\n            ),\n            onChange: (page, size) => setFilter((prev) => ({ ...prev, page, size: size || prev.size })),\n            onShowSizeChange: (_, size) => setFilter((prev) => ({ ...prev, page: 1, size })),\n            className: 'px-6! py-4!',\n          }}\n          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!\"\n          scroll={{ x: 1400 }}\n        />\n      </div>\n\n      <ArticleImportModal\n        open={isModalOpen}\n        onClose={() => setIsModalOpen(false)}\n        onImport={handleArticleImport}\n      />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/assistant/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Button, Card, Form, Input, Modal, Select, Tooltip, Space, Skeleton, Avatar, Tag, Dropdown, MenuProps } from 'antd';\nimport { DeleteOutlined, FormOutlined, PlusOutlined, InfoCircleOutlined, MoreOutlined, ApiOutlined, ThunderboltFilled } from '@ant-design/icons';\nimport { ImSwitch } from 'react-icons/im';\n\nimport Title from '@/components/Title';\nimport useAssistant from '@/hooks/useAssistant';\nimport { Assistant } from '@/types/app/assistant';\n\n// 模型信息\nconst modelInfoMap: Record<string, { desc: string; label: string }> = {\n  'deepseek-chat': {\n    desc: '通用聊天模型',\n    label: 'DeepSeek Chat',\n  },\n  'deepseek-reasoner': {\n    desc: '多步推理优化模型',\n    label: 'DeepSeek Reasoner',\n  },\n  'moonshot-v1-128k': {\n    desc: '长上下文模型，支持128k上下文',\n    label: 'Moonshot v1 128k',\n  },\n  'gpt-4o': {\n    desc: '多模态大模型',\n    label: 'OpenAI GPT-4o',\n  },\n  'gpt-3.5-turbo': {\n    desc: '轻量快速模型',\n    label: 'OpenAI GPT-3.5 Turbo',\n  },\n  'glm-4': {\n    desc: '中文大模型',\n    label: '智谱 GLM-4',\n  },\n  'qwen-turbo': {\n    desc: '快速对话模型',\n    label: '通义千问 Turbo',\n  },\n  'ernie-bot': {\n    desc: '文心一言大模型',\n    label: '百度文心一言大模型',\n  },\n  'doubao-chat': {\n    desc: '字节跳动豆包模型',\n    label: '豆包 Chat',\n  },\n  // 你可以继续添加更多模型\n};\n\n// 获取模型主题（颜色和图标）\nconst getModelTheme = (model: string): { color: string; icon: string } => {\n  const themeMap: Record<string, { color: string; icon: string }> = {\n    'deepseek-chat': { color: '#1890ff', icon: 'DS' },\n    'deepseek-reasoner': { color: '#722ed1', icon: 'DR' },\n    'moonshot-v1-128k': { color: '#13c2c2', icon: 'M' },\n    'gpt-4o': { color: '#52c41a', icon: 'GPT4' },\n    'gpt-3.5-turbo': { color: '#faad14', icon: 'GPT3' },\n    'glm-4': { color: '#eb2f96', icon: 'GLM' },\n    'qwen-turbo': { color: '#f5222d', icon: 'QW' },\n    'ernie-bot': { color: '#fa8c16', icon: 'EB' },\n    'doubao-chat': { color: '#2f54eb', icon: 'DB' },\n  };\n\n  return themeMap[model] || { color: '#8c8c8c', icon: 'AI' };\n};\n\nexport default () => {\n  const [form] = Form.useForm();\n  const [isModalOpen, setIsModalOpen] = useState(false);\n  const [assistant, setAssistant] = useState<Assistant>({} as Assistant);\n  const [inputModelValue, setInputModelValue] = useState('');\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const { list, testingMap, saveAssistant, delAssistantData, setDefaultAssistant, testConnection } = useAssistant();\n\n  // 监听 list 变化，设置初始加载状态\n  useEffect(() => {\n    if (list.length > 0 || isFirstLoadRef.current) {\n      if (isFirstLoadRef.current && list.length > 0) {\n        setInitialLoading(false);\n        isFirstLoadRef.current = false;\n      }\n    }\n  }, [list]);\n\n  const handleSubmit = () => {\n    form.validateFields().then((values) => {\n      console.log(values);\n\n      // 如果输入的模型不在列表，则直接用输入的文本\n      const model = values.model;\n      saveAssistant({ ...assistant, ...values, model }).then((success) => {\n        if (success) {\n          setIsModalOpen(false);\n          form.resetFields();\n          setInputModelValue('');\n          setAssistant({} as Assistant);\n        }\n      });\n    });\n  };\n\n  // 生成 Select options\n  const selectOptions = Object.entries(modelInfoMap).map(([value, info]) => ({\n    label: info.label,\n    value,\n  }));\n\n  // 如果输入值是新模型，且不在选项里，加入它\n  if (inputModelValue && !selectOptions.find((opt) => opt.value === inputModelValue)) {\n    selectOptions.push({ label: inputModelValue, value: inputModelValue });\n  }\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2\">\n          <div className=\"flex justify-between items-center\">\n            <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n            <Skeleton.Button active size=\"default\" style={{ width: 100, height: 32 }} />\n          </div>\n        </Card>\n\n        {/* 卡片网格骨架屏 */}\n        <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 mt-3\">\n          {[1, 2, 3, 4, 5, 6].map((item) => (\n            <Card key={item} className=\"border-stroke dark:border-strokedark\">\n              <div className=\"flex items-start justify-between mb-4\">\n                <div className=\"flex items-center gap-3\">\n                  <Skeleton.Avatar active size={48} shape=\"square\" />\n                  <div>\n                    <Skeleton.Input active size=\"small\" style={{ width: 80, height: 16 }} />\n                  </div>\n                </div>\n                <Skeleton.Button active size=\"small\" style={{ width: 32, height: 32 }} />\n              </div>\n              <div className=\"bg-gray-100 dark:bg-boxdark-2 rounded-md p-3 py-4 mb-4\">\n\n              </div>\n              <div className=\"pt-2 border-t border-gray-100 dark:border-strokedark\">\n                <Skeleton.Button active size=\"default\" style={{ width: '100%', height: 32 }} />\n              </div>\n            </Card>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"助手管理\">\n        <Button type=\"primary\" onClick={() => setIsModalOpen(true)}>\n          添加助手\n        </Button>\n      </Title>\n\n      {/* 卡片网格区域 */}\n      <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 mt-3\">\n        {list.map((item) => {\n          const info = modelInfoMap[item.model];\n          const theme = getModelTheme(item.model);\n          const isTesting = testingMap[item.id];\n          const isDefault = !!item.isDefault;\n\n          // 下拉菜单项\n          const menuItems: MenuProps['items'] = [\n            {\n              key: 'edit',\n              label: '编辑配置',\n              icon: <FormOutlined />,\n              onClick: () => {\n                form.setFieldsValue(item);\n                setInputModelValue(item.model);\n                setAssistant(item);\n                setIsModalOpen(true);\n              }\n            },\n            {\n              key: 'default',\n              label: isDefault ? '已开启' : '开启助手',\n              icon: <ImSwitch />,\n              disabled: isDefault,\n              onClick: () => setDefaultAssistant(+item.id)\n            },\n            {\n              type: 'divider',\n            },\n            {\n              key: 'delete',\n              label: '删除助手',\n              danger: true,\n              icon: <DeleteOutlined />,\n              onClick: () => {\n                Modal.confirm({\n                  title: '确认删除',\n                  content: `您确定要删除助手 \"${item.name}\" 吗？此操作无法撤销。`,\n                  okText: '删除',\n                  okType: 'danger',\n                  cancelText: '取消',\n                  onOk: () => delAssistantData(+item.id),\n                });\n              }\n            }\n          ];\n\n          return (\n            <Card\n              key={item.id}\n              className={`relative p-5 rounded-xl shadow-xs hover:shadow-md transition-shadow duration-300 overflow-hidden ${item.isDefault\n                ? '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!'\n                : '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'\n                }`}\n              styles={{ body: { flex: 1, display: 'flex', flexDirection: 'column', backgroundColor: 'transparent' } }}\n            >\n              {/* 卡片头部：图标与名称 */}\n              <div className=\"flex items-start justify-between mb-4\">\n                <div className=\"flex items-center gap-3\">\n                  <Avatar\n                    shape=\"square\"\n                    size={48}\n                    style={{ backgroundColor: theme.color, verticalAlign: 'middle' }}\n                    className=\"shadow-md text-lg font-bold\"\n                  >\n                    {theme.icon}\n                  </Avatar>\n\n                  <div>\n                    <div className=\"font-bold text-lg text-gray-800 dark:text-white leading-tight mb-1 truncate max-w-[160px] ml-[5px]\">\n                      {item.name}\n                    </div>\n\n                    <Space size={4}>\n                      <Tag bordered={false} className=\"text-xs bg-gray-100 text-gray-500 dark:bg-boxdark-2 dark:text-gray-300 mr-0\">\n                        {info ? info.label : item.model}\n                      </Tag>\n\n                      {info && (\n                        <Tooltip title={info.desc}>\n                          <InfoCircleOutlined className=\"text-gray-400! dark:text-gray-500 cursor-pointer hover:text-primary dark:hover:text-primary\" />\n                        </Tooltip>\n                      )}\n                    </Space>\n                  </div>\n                </div>\n\n                {/* 更多操作菜单 */}\n                <Dropdown menu={{ items: menuItems }} placement=\"bottomRight\" arrow className=\"bg-gray-50 dark:bg-boxdark-2/50 dark:hover:bg-boxdark-2/30\">\n                  <Button type=\"text\" icon={<MoreOutlined className=\"text-xl text-gray-400 dark:text-gray-500\" />} />\n                </Dropdown>\n              </div>\n\n              {/* 卡片内容：URL显示 */}\n              <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\">\n                <div className=\"flex items-center text-gray-400 dark:text-gray-500 text-xs uppercase font-bold mb-1\">\n                  <ApiOutlined className=\"mr-1\" /> API Endpoint\n                </div>\n                <div\n                  className=\"text-gray-600 dark:text-gray-300 font-mono text-sm m-0 break-all\"\n                >\n                  {item.url}\n                </div>\n              </div>\n\n              {/* 卡片底部：主要操作 */}\n              <div className=\"mt-auto pt-2 border-t border-gray-100 dark:border-strokedark flex justify-end\">\n                <Button\n                  type={isTesting ? 'default' : 'dashed'}\n                  className={`${isTesting ? '' : 'text-primary border-primary bg-blue-50/50 dark:bg-blue-900/20 dark:border-primary dark:text-primary'} w-full`}\n                  icon={isTesting ? <ThunderboltFilled spin /> : <ThunderboltFilled />}\n                  loading={isTesting}\n                  onClick={() => testConnection(item)}\n                >\n                  {isTesting ? '连接测试中...' : '测试连接'}\n                </Button>\n              </div>\n            </Card>\n          );\n        })}\n\n        {/* 空状态下的添加按钮（如果没有数据或者作为最后一个Card） */}\n        <Button\n          type=\"dashed\"\n          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\"\n          onClick={() => setIsModalOpen(true)}\n        >\n          <PlusOutlined style={{ fontSize: '24px' }} />\n          <span className=\"font-medium\">添加新助手</span>\n        </Button>\n      </div>\n\n      <Modal\n        title={assistant.id ? '编辑助手' : '添加助手'}\n        open={isModalOpen}\n        onOk={handleSubmit}\n        onCancel={() => {\n          setIsModalOpen(false);\n          form.resetFields();\n          setInputModelValue('');\n          setAssistant({} as Assistant);\n        }}\n      >\n        <Form form={form} layout=\"vertical\" size=\"large\">\n          <Form.Item name=\"name\" label=\"名称\" rules={[{ required: true, message: '请输入助手名称' }]}>\n            <Input placeholder=\"例如：DeepSeek、OpenAI 等\" />\n          </Form.Item>\n\n          <Form.Item\n            name=\"url\"\n            label=\"API 地址\"\n            tooltip=\"填写完整的 API 接口地址，如 https://api.deepseek.com/v1\"\n            rules={[\n              { required: true, message: '请输入 API 地址' },\n              {\n                pattern: /^https?:\\/\\//,\n                message: '请输入正确的 API 地址'\n              }\n            ]}\n          >\n            <Input placeholder=\"https://api.deepseek.com/v1\" autoComplete=\"off\" />\n          </Form.Item>\n\n          <Form.Item name=\"key\" label=\"API 密钥\" rules={[{ required: true, message: '请输入 API 密钥' }]}>\n            <Input.Password placeholder=\"请输入 API 密钥\" autoComplete=\"new-password\" />\n          </Form.Item>\n\n          <Form.Item name=\"model\" label=\"模型\" rules={[{ required: true, message: '请选择或输入模型' }]}>\n            <Select\n              showSearch\n              placeholder=\"选择或输入模型\"\n              filterOption={(input, option) => (option?.label ?? '').toLowerCase().includes((input ?? '').toLowerCase())}\n              onSearch={(val) => setInputModelValue(val)}\n              optionLabelProp=\"label\"\n              options={selectOptions}\n              optionRender={(option) => {\n                const info = modelInfoMap[option.value as string];\n                if (info) {\n                  return (\n                    <div\n                      style={{\n                        display: 'flex',\n                        justifyContent: 'space-between',\n                        alignItems: 'center',\n                      }}\n                    >\n                      <span>{option.label}</span>\n\n                      <Tooltip title={info.desc}>\n                        <InfoCircleOutlined className=\"text-slate-300\" />\n                      </Tooltip>\n                    </div>\n                  );\n                }\n                return <span>{option.label}</span>;\n              }}\n            />\n          </Form.Item>\n        </Form>\n      </Modal>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/cate/index.scss",
    "content": "/* 仅保留 Ant Design Tree 布局覆盖，其余样式均使用 Tailwind 写在 tsx 中 */\n.CatePage {\n    .ant-tree-node-content-wrapper {\n        background-color: transparent !important;\n    }\n    .ant-tree-treenode {\n        width: 100% !important;\n    }\n    .ant-tree-node-content-wrapper {\n        display: flex !important;\n        width: 100% !important;\n        flex: 1 !important;\n    }\n    .ant-tree-title {\n        width: 100% !important;\n        display: block !important;\n        flex: 1 !important;\n    }\n    .ant-tree-switcher {\n        margin-top: 7px !important;\n        flex-shrink: 0 !important;\n        color: #288eff;\n\n        svg {\n            position: relative;\n            left: 5px;\n        }\n    }\n    .ant-tree-switcher:before {\n        left: 5px;\n        z-index: 10;\n    }\n\n    .ant-tree-switcher-leaf-line:before {\n        border-inline-end: #ebebeb solid 1px !important;\n        bottom: -15px !important;\n    }\n    .ant-tree-switcher-leaf-line:after {\n        border-bottom: #ebebeb solid 1px !important;\n    }\n}\n"
  },
  {
    "path": "src/pages/cate/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\n\nimport { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';\nimport { Form, Input, Button, Tree, Modal, Spin, Dropdown, Card, MenuProps, Popconfirm, message, Radio, Select, Skeleton } from 'antd';\nimport type { DataNode } from 'antd/es/tree';\n\nimport { Cate } from '@/types/app/cate';\nimport { addCateDataAPI, delCateDataAPI, editCateDataAPI, getCateDataAPI, getCateListAPI } from '@/api/cate';\nimport Title from '@/components/Title';\n\nimport './index.scss';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState(false);\n  const [editLoading, setEditLoading] = useState(false);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [isModelOpen, setIsModelOpen] = useState(false);\n  const [cate, setCate] = useState<Cate>({} as Cate);\n  const [list, setList] = useState<Cate[]>([]);\n  const [isMethod, setIsMethod] = useState<'create' | 'edit'>('create');\n  const [isCateShow, setIsCateShow] = useState(false);\n  const [form] = Form.useForm();\n\n  const getCateList = async () => {\n    try {\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getCateListAPI();\n      data.result.sort((a: Cate, b: Cate) => a.order - b.order);\n      setList(data.result);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    setLoading(true);\n    getCateList();\n  }, []);\n\n  const addCateData = (id: number) => {\n    setIsMethod('create');\n    setIsModelOpen(true);\n    setIsCateShow(false);\n    form.resetFields();\n    setCate({ ...cate, level: id, type: 'cate' });\n  };\n\n  const editCateData = async (id: number) => {\n    try {\n      setEditLoading(true);\n\n      setIsMethod('edit');\n      setIsModelOpen(true);\n\n      const { data } = await getCateDataAPI(id);\n      setIsCateShow(data.type === 'cate' ? false : true);\n      setCate(data);\n      form.setFieldsValue(data);\n\n      setEditLoading(false);\n    } catch (error) {\n      console.error(error);\n      setEditLoading(false);\n    }\n  };\n\n  const delCateData = async (id: number) => {\n    try {\n      setLoading(true);\n\n      await delCateDataAPI(id);\n      await getCateList();\n      message.success('🎉 删除分类成功');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  const onSubmit = async () => {\n    setBtnLoading(true);\n\n    try {\n      form.validateFields().then(async (values: Cate) => {\n        if (values.type === 'cate') values.url = '/';\n\n        if (isMethod === 'edit') {\n          await editCateDataAPI({ ...cate, ...values });\n          message.success('🎉 修改分类成功');\n        } else {\n          await addCateDataAPI({ ...cate, ...values });\n          message.success('🎉 新增分类成功');\n        }\n\n        await getCateList();\n\n        form.resetFields();\n        setCate({} as Cate);\n\n        setIsModelOpen(false);\n        setIsMethod('create');\n      });\n\n      setBtnLoading(false);\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n  };\n\n  const closeModel = () => {\n    setIsCateShow(false);\n    setIsMethod('create');\n    setIsModelOpen(false);\n    form.resetFields();\n    setCate({} as Cate);\n  };\n\n  const toTreeData = (data: Cate[]): DataNode[] =>\n    data.map((item) => {\n      const items: MenuProps['items'] = [\n        {\n          key: '1',\n          label: (\n            <span className=\"flex items-center gap-2 py-1\">\n              <PlusOutlined className=\"text-md\" />\n              新增\n            </span>\n          ),\n          onClick: () => addCateData(item.id!),\n        },\n        {\n          key: '2',\n          label: (\n            <span className=\"flex items-center gap-2 py-1\">\n              <EditOutlined className=\"text-md\" />\n              编辑\n            </span>\n          ),\n          onClick: () => editCateData(item.id!),\n        },\n        {\n          key: '3',\n          label: (\n            <Popconfirm\n              title=\"删除确认\"\n              description=\"确定要删除该分类吗？\"\n              okText=\"确定\"\n              cancelText=\"取消\"\n              onConfirm={() => delCateData(item.id!)}\n            >\n              <span className=\"flex items-center gap-2 py-1 text-red-500 hover:text-red-600\">\n                <DeleteOutlined className=\"text-md\" />\n                删除\n              </span>\n            </Popconfirm>\n          ),\n        },\n      ];\n\n      return {\n        title: (\n          <div className=\"group flex w-full items-center justify-between gap-3 rounded-lg px-3 py-2 -ml-2.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5\">\n            <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n              <span className=\"text-lg leading-none opacity-80\">{item.icon}</span>\n              <span className=\"truncate text-slate-600 dark:text-slate-200\">{item.name}</span>\n            </div>\n\n            <Dropdown menu={{ items }} trigger={['click']} placement=\"bottomRight\">\n              <Button\n                type=\"text\"\n                size=\"small\"\n                className=\"flex shrink-0 items-center gap-1 text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-200\"\n              >\n                操作\n              </Button>\n            </Dropdown>\n          </div>\n        ),\n        key: item.id || 0,\n        children: item.children ? toTreeData(item.children) : [],\n      };\n    });\n\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  const toCascaderOptions: any = (data: Cate[], isRoot: boolean = true) => [\n    ...(isRoot ? [{ value: 0, label: '一级分类' }] : []),\n    ...data.map((item) => ({\n      value: item.id!,\n      label: item.name,\n      children: item.children ? toCascaderOptions(item.children, false) : undefined,\n    })),\n  ];\n\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <Card className=\"rounded-xl! border-stroke! shadow-xs! [&>.ant-card-body]:p-4! dark:border-strokedark!\">\n          <div className=\"flex items-center justify-between\">\n            <Skeleton.Input active size=\"large\" className=\"h-9! w-40!\" />\n            <Skeleton.Button active size=\"large\" className=\"h-10! w-28!\" />\n          </div>\n        </Card>\n\n        <Card className=\"min-h-[calc(100vh-160px)]! rounded-xl! border-stroke! shadow-xs! [&>.ant-card-body]:p-6! dark:border-strokedark!\">\n          <div className=\"space-y-5\">\n            {[1, 2, 3, 4, 5, 6].map((item) => (\n              <div key={item} className=\"space-y-2\">\n                <div className=\"flex items-center justify-between\">\n                  <Skeleton.Input active className=\"h-6! w-48!\" />\n                  <Skeleton.Button active size=\"small\" className=\"h-6! w-14!\" />\n                </div>\n                {item <= 3 && (\n                  <div className=\"ml-6 space-y-2\">\n                    {[1, 2, 3].map((child) => (\n                      <div key={child} className=\"flex items-center justify-between\">\n                        <Skeleton.Input active size=\"small\" className=\"h-5! w-36!\" />\n                        <Skeleton.Button active size=\"small\" className=\"h-5! w-12!\" />\n                      </div>\n                    ))}\n                  </div>\n                )}\n              </div>\n            ))}\n          </div>\n        </Card>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"space-y-2\">\n      <Title value=\"分类管理\">\n        <Button\n          type=\"primary\"\n          onClick={() => addCateData(0)}\n        >\n          新增分类\n        </Button>\n      </Title>\n\n      <Card\n        className={`CatePage min-h-[calc(100vh-160px)]! rounded-xl! border! border-stroke! bg-white! shadow-xs! [&>.ant-card-body]:p-6! dark:border-strokedark! dark:bg-boxdark!`}\n      >\n        <Spin spinning={loading} className=\"min-h-[280px]\">\n          <Tree\n            className=\"bg-transparent! [&_.ant-tree-treenode]:py-0.5! [&_.ant-tree-indent-unit]:w-4!\"\n            defaultExpandAll\n            treeData={toTreeData(list)}\n            showLine={{ showLeafIcon: false }}\n            blockNode\n          />\n        </Spin>\n      </Card>\n\n      <Modal\n        open={isModelOpen}\n        onCancel={closeModel}\n        footer={null}\n        title={isMethod === 'edit' ? '编辑分类' : '新增分类'}\n        loading={editLoading}\n        className=\"[&_.ant-modal-content]:rounded-2xl!\"\n      >\n        <Form\n          form={form}\n          layout=\"vertical\"\n          initialValues={cate}\n          size=\"large\"\n          preserve={false}\n          className=\"mt-2 [&_.ant-input]:rounded-lg! [&_.ant-select-selector]:rounded-lg!\"\n        >\n          <div className=\"grid gap-x-4 sm:grid-cols-2\">\n            <Form.Item label=\"名称\" name=\"name\" rules={[{ required: true, message: '分类名称不能为空' }]}>\n              <Input placeholder=\"请输入分类名称\" />\n            </Form.Item>\n            <Form.Item label=\"标识\" name=\"mark\" rules={[{ required: true, message: '分类标识不能为空' }]}>\n              <Input placeholder=\"请输入分类标识\" />\n            </Form.Item>\n          </div>\n\n          <Form.Item label=\"图标\" name=\"icon\">\n            <Input placeholder=\"请输入分类图标（如 emoji 或图标名）\" />\n          </Form.Item>\n\n          {isCateShow && (\n            <Form.Item label=\"链接\" name=\"url\">\n              <Input placeholder=\"请输入分类链接\" />\n            </Form.Item>\n          )}\n\n          <div className=\"grid gap-x-4 sm:grid-cols-2\">\n            <Form.Item label=\"顺序\" name=\"order\">\n              <Input placeholder=\"值越小越靠前\" />\n            </Form.Item>\n            <Form.Item label=\"级别\" name=\"level\">\n              <Select options={toCascaderOptions(list)} placeholder=\"请选择分类级别\" />\n            </Form.Item>\n          </div>\n\n          <Form.Item label=\"模式\" name=\"type\">\n            <Radio.Group\n              className=\"flex! gap-4!\"\n              onChange={(e) => {\n                const type = e.target.value;\n                setIsCateShow(type === 'nav');\n              }}\n            >\n              <Radio value=\"cate\" className=\"m-0!\">\n                分类\n              </Radio>\n              <Radio value=\"nav\" className=\"m-0!\">\n                导航\n              </Radio>\n            </Radio.Group>\n          </Form.Item>\n\n          <Form.Item className=\"mb-0!\">\n            <Button type=\"primary\" onClick={onSubmit} loading={btnLoading} className=\"w-full\">\n              确定\n            </Button>\n          </Form.Item>\n        </Form>\n      </Modal>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/comment/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport dayjs from 'dayjs';\n\nimport { message, Table, Popconfirm, Button, Modal, Form, Input, DatePicker, Tooltip } from 'antd';\nimport TextArea from 'antd/es/input/TextArea';\nimport { ColumnsType } from 'antd/es/table';\nimport { DeleteOutlined, SendOutlined, SearchOutlined, ClearOutlined } from '@ant-design/icons';\n\nimport { addCommentDataAPI, getCommentListAPI, delCommentDataAPI } from '@/api/comment';\nimport Title from '@/components/Title';\nimport { Comment, FilterForm } from '@/types/app/comment';\nimport { useWebStore, useUserStore } from '@/stores';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const web = useWebStore((state) => state.web);\n  const user = useUserStore((state) => state.user);\n\n  const [btnLoading, setBtnLoading] = useState(false);\n\n  const [comment, setComment] = useState<Comment>({} as Comment);\n  const [list, setList] = useState<Comment[]>([]);\n\n  const getCommentList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      // 否则使用 loading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getCommentListAPI();\n      setList(data);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getCommentList();\n  }, []);\n\n  const [filterForm] = Form.useForm();\n\n  const onFilterReset = () => {\n    filterForm.resetFields();\n    getCommentList();\n  };\n\n  const columns: ColumnsType<Comment> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      align: 'center',\n      width: 110,\n      render: (text: number) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '名称',\n      dataIndex: 'name',\n      key: 'name',\n      width: 110,\n      render: (text: string) => <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{text || '-'}</span>,\n    },\n    {\n      title: '内容',\n      dataIndex: 'content',\n      key: 'content',\n      width: 280,\n      render: (text: string, record: Comment) => (\n        <>\n          {text ? (\n            <Tooltip\n              title={text}\n            >\n              <span className=\"hover:text-primary cursor-pointer line-clamp-1 text-gray-700 dark:text-gray-200\"\n                onClick={() => {\n                  setComment(record);\n                }}>{text}</span>\n            </Tooltip>\n          )\n            : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无内容</span>\n            )\n          }\n        </>\n      ),\n    },\n    {\n      title: '邮箱',\n      dataIndex: 'email',\n      key: 'email',\n      width: 180,\n      render: (text: string) => <span className=\"text-gray-500 dark:text-gray-400\">{text || '暂无邮箱'}</span>,\n    },\n    {\n      title: '网站',\n      dataIndex: 'url',\n      key: 'url',\n      width: 180,\n      render: (url: string) =>\n        url ? (\n          <a href={url} target=\"_blank\" className=\"hover:text-primary text-gray-600 dark:text-gray-300\" rel=\"noreferrer\">\n            {url}\n          </a>\n        ) : (\n          <span className=\"text-gray-400 dark:text-gray-500\">无网站</span>\n        ),\n    },\n    {\n      title: '所属文章',\n      dataIndex: 'articleTitle',\n      key: 'articleTitle',\n      width: 200,\n      ellipsis: true,\n      render: (text: string, record: Comment) =>\n        text ? (\n          <Tooltip title={text}>\n            <a href={`${web.url}/article/${record.articleId}`} target=\"_blank\" className=\"hover:text-primary text-gray-600 dark:text-gray-300\" rel=\"noreferrer\">\n              {text}\n            </a>\n          </Tooltip>\n        ) : (\n          <span className=\"text-gray-400 dark:text-gray-500\">该评论暂未绑定文章</span>\n        ),\n    },\n    {\n      title: '评论时间',\n      dataIndex: 'createTime',\n      key: 'createTime',\n      width: 180,\n      render: (date: string) => <span className=\"text-gray-500 dark:text-gray-400\">{dayjs(+date).format('YYYY-MM-DD HH:mm:ss')}</span>,\n      sorter: (a: Comment, b: Comment) => +a.createTime! - +b.createTime!,\n      showSorterTooltip: false,\n    },\n    {\n      title: '操作',\n      key: 'action',\n      fixed: 'right',\n      align: 'center',\n      width: 110,\n      render: (_: string, record: Comment) => (\n        <div className=\"flex justify-center space-x-2\">\n          <Tooltip title=\"回复\">\n            <Button\n              type=\"text\"\n              onClick={() => {\n                setComment(record);\n                setIsReplyModalOpen(true);\n              }}\n              icon={<SendOutlined className=\"text-primary\" />}\n            />\n          </Tooltip>\n\n          <Popconfirm title=\"警告\" description=\"你确定要删除吗\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delCommentData(record.id!)}>\n            <Tooltip title=\"删除\">\n              <Button type=\"text\" danger icon={<DeleteOutlined />} />\n            </Tooltip>\n          </Popconfirm>\n        </div>\n      ),\n    },\n  ];\n\n  const { RangePicker } = DatePicker;\n\n  const delCommentData = async (id: number) => {\n    setLoading(true);\n\n    try {\n      await delCommentDataAPI(id);\n      await getCommentList();\n      message.success('🎉 删除评论成功');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  const onFilterSubmit = async (values: FilterForm) => {\n    try {\n      setLoading(true);\n      const query = {\n        key: values?.title,\n        content: values?.content,\n        startDate: values.createTime?.[0]?.valueOf()?.toString(),\n        endDate: values.createTime?.[1]?.valueOf()?.toString(),\n      };\n      const { data } = await getCommentListAPI({ query });\n      setList(data);\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // 回复内容\n  const [replyInfo, setReplyInfo] = useState('');\n  const [isReplyModalOpen, setIsReplyModalOpen] = useState(false);\n  const onHandleReply = async () => {\n    try {\n      setBtnLoading(true);\n\n      await addCommentDataAPI({\n        avatar: user.avatar,\n        url: web.url,\n        content: replyInfo,\n        commentId: comment?.id ?? 0,\n        auditStatus: 1,\n        email: user.email,\n        name: user.name,\n        articleId: comment?.articleId ?? 0,\n        createTime: new Date().getTime().toString(),\n      });\n\n      message.success('🎉 回复评论成功');\n      getCommentList();\n      setIsReplyModalOpen(false);\n      setReplyInfo('');\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setBtnLoading(false);\n    }\n  };\n\n  // 初始加载时显示骨架屏（与 article 一致）\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"flex justify-between mb-6\">\n            <div className=\"flex gap-4 flex-wrap\">\n              <div className=\"skeleton h-9\" style={{ width: 200 }} />\n              <div className=\"skeleton h-9\" style={{ width: 200 }} />\n              <div className=\"skeleton h-9\" style={{ width: 280 }} />\n            </div>\n            <div className=\"flex gap-2\">\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n            </div>\n          </div>\n\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"评论管理\" />\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <div className=\"p-5 border-b border-gray-100 dark:border-strokedark bg-gray-50/30 dark:bg-boxdark-2/50 space-y-4\">\n          <Form form={filterForm} layout=\"inline\" onFinish={onFilterSubmit} className=\"flex! flex-wrap! items-center! gap-y-2.5!\">\n            <Form.Item name=\"title\" className=\"mb-0!\">\n              <Input\n                prefix={<SearchOutlined className=\"text-gray-400 dark:text-gray-500\" />}\n                placeholder=\"搜索文章标题...\"\n                className=\"w-[220px]!\"\n                allowClear\n              />\n            </Form.Item>\n            <Form.Item name=\"content\" className=\"mb-0!\">\n              <Input\n                prefix={<SearchOutlined className=\"text-gray-400 dark:text-gray-500\" />}\n                placeholder=\"搜索评论内容...\"\n                className=\"w-[220px]!\"\n                allowClear\n              />\n            </Form.Item>\n            <Form.Item name=\"createTime\" className=\"mb-0!\">\n              <RangePicker\n                className=\"w-[260px]!\"\n                placeholder={['开始日期', '结束日期']}\n                disabledDate={(current) => current && current > dayjs().endOf('day')}\n              />\n            </Form.Item>\n\n            <div className=\"flex gap-2\">\n              <Button type=\"primary\" htmlType=\"submit\" icon={<SearchOutlined />}>\n                查询\n              </Button>\n              <Button icon={<ClearOutlined />} onClick={onFilterReset}>\n                重置\n              </Button>\n            </div>\n          </Form>\n        </div>\n\n        <Table\n          rowKey=\"id\"\n          dataSource={list}\n          columns={columns}\n          loading={loading}\n          scroll={{ x: 1300 }}\n          pagination={{\n            position: ['bottomRight'],\n            defaultPageSize: 8,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                共 {totalCount} 条数据\n              </div>\n            ),\n            className: 'px-6! py-4!',\n          }}\n          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!\"\n        />\n      </div>\n\n      <Modal title=\"回复评论\" open={isReplyModalOpen} footer={null} onCancel={() => setIsReplyModalOpen(false)}>\n        <TextArea value={replyInfo} onChange={(e) => setReplyInfo(e.target.value)} placeholder=\"请输入回复内容\" autoSize={{ minRows: 3, maxRows: 5 }} />\n\n        <div className=\"flex space-x-4\">\n          <Button className=\"w-full mt-2\" onClick={() => setIsReplyModalOpen(false)}>\n            取消\n          </Button>\n          <Button type=\"primary\" loading={btnLoading} onClick={onHandleReply} className=\"w-full mt-2\">\n            确定\n          </Button>\n        </div>\n      </Modal>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/config/index.tsx",
    "content": "import { useEffect, useState, useRef } from 'react';\nimport { Table, Button, Modal, Form, message, Card, Tabs, Skeleton } from 'antd';\nimport { FormOutlined } from '@ant-design/icons';\nimport type { FormInstance } from 'antd/es/form';\n\nimport CodeMirror from '@uiw/react-codemirror';\nimport { json } from '@codemirror/lang-json';\n\nimport Title from '@/components/Title';\nimport { getEnvConfigListAPI, updateEnvConfigDataAPI, getPageConfigListAPI, updatePageConfigDataAPI } from '@/api/config';\nimport { Config } from '@/types/app/config';\nimport { titleSty } from '@/styles/sty';\nimport { ColumnsType } from 'antd/es/table';\n\ninterface Props {\n  open: boolean;\n  onCancel: () => void;\n  onSave: () => void;\n  value: string;\n  error: string | null;\n  onChange: (value: string) => void;\n  onFormat: () => void;\n  loading: boolean;\n  title: string;\n  form: FormInstance;\n}\n\nfunction ConfigEditModal({ open, onCancel, onSave, value, error, onChange, onFormat, loading, title, form }: Props) {\n  return (\n    <Modal title={title} open={open} onCancel={onCancel} width={1000} footer={null}>\n      <Form form={form} layout=\"vertical\" onFinish={onSave} size=\"large\">\n        <Form.Item name=\"value\" rules={[{ required: true, message: '请输入配置内容' }]} className=\"mb-4\" validateStatus={error ? 'error' : ''} help={error ? `JSON格式错误: ${error}` : ''}>\n          <CodeMirror value={value} extensions={[json()]} onChange={onChange} theme={document.body.classList.contains('dark') ? 'dark' : 'light'} basicSetup={{ lineNumbers: true, foldGutter: true }} style={error ? { border: '1px solid #ff4d4f', borderRadius: 6 } : { borderRadius: 6 }} />\n        </Form.Item>\n\n        <Button onClick={onFormat} className=\"w-full mb-2\">\n          格式化\n        </Button>\n        <Button type=\"primary\" htmlType=\"submit\" loading={loading} className=\"w-full\">\n          保存配置\n        </Button>\n      </Form>\n    </Modal>\n  );\n}\n\nconst tabConfig = {\n  env: {\n    label: '环境配置',\n    getList: getEnvConfigListAPI,\n    update: async (item: Config, value: object) => updateEnvConfigDataAPI({ ...item, value }),\n    modalTitle: '编辑配置',\n  },\n  page: {\n    label: '页面配置',\n    getList: getPageConfigListAPI,\n    update: async (item: Config, value: object) => updatePageConfigDataAPI(Number(item.id), value),\n    modalTitle: '编辑页面配置',\n  },\n};\n\nexport default () => {\n  // 合并状态\n  const [activeTab, setActiveTab] = useState<'env' | 'page'>('env');\n  const [data, setData] = useState<{ [key: string]: Config[] }>({ env: [], page: [] });\n  const [loading, setLoading] = useState<{ [key: string]: boolean }>({ env: false, page: false });\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n  const [editItem, setEditItem] = useState<Config | null>(null);\n  const [isModalOpen, setIsModalOpen] = useState(false);\n  const [jsonError, setJsonError] = useState<string | null>(null);\n  const [jsonValue, setJsonValue] = useState('');\n  const [btnLoading, setBtnLoading] = useState(false);\n  const formRef = useRef<{ [key: string]: FormInstance[] }>({ env: Form.useForm(), page: Form.useForm() });\n\n  // 获取配置列表\n  const fetchList = async (type: 'env' | 'page') => {\n    // 如果是第一次加载，使用 initialLoading\n    if (isFirstLoadRef.current) {\n      setInitialLoading(true);\n    } else {\n      setLoading((l) => ({ ...l, [type]: true }));\n    }\n\n    try {\n      const { data: list } = await tabConfig[type].getList();\n      setData((d) => ({ ...d, [type]: list }));\n      isFirstLoadRef.current = false;\n    } catch (e) {\n      console.error(e);\n    } finally {\n      setInitialLoading(false);\n      setLoading((l) => ({ ...l, [type]: false }));\n    }\n  };\n\n  useEffect(() => {\n    fetchList(activeTab);\n  }, [activeTab]);\n\n  // 打开编辑弹窗\n  const handleEdit = (item: Config) => {\n    setEditItem(item);\n    setIsModalOpen(true);\n    const str = JSON.stringify(item.value, null, 2);\n    setJsonValue(str);\n    formRef.current[activeTab][0].setFieldsValue({ value: str });\n    setJsonError(null);\n  };\n\n  // 保存编辑\n  const handleSave = async () => {\n    try {\n      setBtnLoading(true);\n      const values = await formRef.current[activeTab][0].validateFields();\n      let parsed;\n      try {\n        parsed = JSON.parse(values.value);\n      } catch (e) {\n        console.error(e);\n        message.error('请输入合法的JSON格式');\n        setBtnLoading(false);\n        return;\n      }\n      await tabConfig[activeTab].update(editItem!, parsed);\n      message.success('保存成功');\n      fetchList(activeTab);\n      setIsModalOpen(false);\n      setEditItem(null);\n      setBtnLoading(false);\n    } catch (e) {\n      console.error(e);\n      setBtnLoading(false);\n    }\n  };\n\n  // JSON 输入变更时校验\n  const handleJsonChange = (value: string) => {\n    setJsonValue(value);\n    formRef.current[activeTab][0].setFieldsValue({ value });\n    try {\n      JSON.parse(value);\n    } catch (error) {\n      console.error(error);\n    }\n  };\n\n  // 格式化 JSON\n  const handleFormatJson = () => {\n    try {\n      const formatted = JSON.stringify(JSON.parse(jsonValue), null, 2);\n      setJsonValue(formatted);\n      formRef.current[activeTab][0].setFieldsValue({ value: formatted });\n      setJsonError(null);\n    } catch (error) {\n      console.error(error);\n    }\n  };\n\n  const columns: ColumnsType<Config> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      align: 'center' as const,\n      width: 120,\n    },\n    {\n      title: '名称',\n      dataIndex: 'name',\n      key: 'name',\n      width: 150,\n    },\n    {\n      title: '备注',\n      dataIndex: 'notes',\n      key: 'notes',\n      width: 150,\n    },\n    {\n      title: '配置内容',\n      dataIndex: 'value',\n      key: 'value',\n      render: (value: object) => <>{activeTab === 'page' ? <span className=\"text-sm text-gray-500\">内容过多，不易展示</span> : <pre className=\"min-w-[200px] whitespace-pre-wrap break-all bg-slate-50 dark:bg-slate-800 p-2 rounded-sm text-xs overflow-auto\">{JSON.stringify(value, null, 2)}</pre>}</>,\n    },\n    {\n      title: '操作',\n      key: 'action',\n      align: 'center',\n      width: 100,\n      fixed: 'right',\n      render: (_: unknown, record: Config) => <Button type=\"text\" icon={<FormOutlined className=\"text-primary\" />} onClick={() => handleEdit(record)} />,\n    },\n  ];\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2\">\n          <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n        </Card>\n\n        {/* Tabs 和表格骨架屏 */}\n        <Card className={`${titleSty} min-h-[calc(100vh-200px)] [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!`}>\n          {/* Tabs 骨架屏 */}\n          <div className=\"flex justify-center space-x-4 mb-6\">\n            <Skeleton.Button active size=\"default\" style={{ width: 100, height: 40 }} />\n            <Skeleton.Button active size=\"default\" style={{ width: 100, height: 40 }} />\n          </div>\n\n          {/* 表格骨架屏 */}\n          <div className=\"mb-4\">\n            {/* 表格行骨架屏 - 模拟多行 */}\n            {[1, 2, 3, 4, 5, 6, 7, 8].map((item) => (\n              <div key={item} className=\"flex items-center gap-4 mb-2 py-2 border-b border-gray-100\">\n                <Skeleton.Input active size=\"small\" style={{ width: 60, height: 40 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 150, height: 40 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 200, height: 40, flex: 1 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 150, height: 40 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 200, height: 40 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 100, height: 40 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 300, height: 40 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 200, height: 40 }} />\n              </div>\n            ))}\n          </div>\n\n          {/* 分页骨架屏 */}\n          <div className=\"flex justify-center my-5\">\n            <Skeleton.Input active size=\"default\" style={{ width: 300, height: 32 }} />\n          </div>\n        </Card>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"项目配置\" />\n\n      {/* <Alert type=\"warning\" message=\"必看教程：https://docs.liuyuyang.net/docs/项目部署/API/人机验证.html\" showIcon closable className=\"mb-2\" /> */}\n\n      <Card className={`${titleSty} min-h-[calc(100vh-200px)]`}>\n        <Tabs\n          activeKey={activeTab}\n          onChange={(key) => setActiveTab(key as 'env' | 'page')}\n          items={Object.keys(tabConfig).map((key) => ({\n            key,\n            label: tabConfig[key as 'env' | 'page'].label,\n            children: <Table rowKey=\"id\" dataSource={data[key]} columns={columns} scroll={{ x: '1000px' }} loading={loading[key]} pagination={false} />,\n          }))}\n          className=\"[&_.ant-tabs-nav]:mb-0 [&_.ant-tabs-nav-wrap]:justify-center\"\n        />\n      </Card>\n\n      <ConfigEditModal key={activeTab} open={isModalOpen} onCancel={() => setIsModalOpen(false)} onSave={handleSave} value={jsonValue} error={jsonError} onChange={handleJsonChange} onFormat={handleFormatJson} loading={btnLoading} title={editItem ? tabConfig[activeTab].modalTitle : ''} form={formRef.current[activeTab][0]} />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/create/components/Editor/index.scss",
    "content": "@use \"./markdown.scss\";\n@reference \"../../../../styles/index.css\";\n\n.bytemd {\n    height: calc(100vh - 200px);\n    border: none;\n    z-index: 99999;\n    background-color: #fff;\n    color: #000;\n    .dark & {\n        background-color: var(--color-boxdark);\n        color: #fff;\n    }\n\n    .bytemd-toolbar {\n        background-color: transparent;\n        .dark & {\n            border-color: var(--color-strokedark);\n        }\n    }\n\n    .bytemd-preview {\n        .dark & {\n            border-color: var(--color-strokedark);\n        }\n    }\n\n    .bytemd-status {\n        .dark & {\n            border-color: var(--color-strokedark);\n        }\n    }\n\n    .CodeMirror {\n        background-color: #fff;\n        color: #000;\n        .dark & {\n            background-color: var(--color-boxdark);\n            color: #fff;\n        }\n    }\n\n    .icon {\n        .dark & {\n            fill: #fff;\n        }\n    }\n}"
  },
  {
    "path": "src/pages/create/components/Editor/index.tsx",
    "content": "import { useState, useEffect } from 'react';\nimport { Spin } from 'antd';\nimport axios from 'axios';\n\nimport { Editor } from '@bytemd/react';\nimport plugins from './plugins';\nimport 'highlight.js/styles/vs2015.css';\nimport 'bytemd/dist/index.css';\nimport zh from 'bytemd/lib/locales/zh_Hans.json';\n\nimport { baseURL } from '@/utils/request';\nimport { useUserStore } from '@/stores';\nimport Material from '@/components/Material';\n\nimport './index.scss';\n\ninterface Props {\n  value: string;\n  onChange: (value: string) => void;\n}\n\nconst EditorMD = ({ value, onChange }: Props) => {\n  const store = useUserStore();\n  const [loading, setLoading] = useState(false);\n  const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);\n  const [currentCtx, setCurrentCtx] = useState<{ appendBlock: (block: string) => void }>();\n\n  useEffect(() => {\n    const handleOpenMaterialModal = (event: CustomEvent) => {\n      setCurrentCtx(event.detail.ctx);\n      setIsMaterialModalOpen(true);\n    };\n\n    window.addEventListener('openMaterialModal', handleOpenMaterialModal as EventListener);\n\n    return () => {\n      window.removeEventListener('openMaterialModal', handleOpenMaterialModal as EventListener);\n    };\n  }, []);\n\n  const uploadImages = async (files: File[]) => {\n    try {\n      setLoading(true);\n      // 处理成后端需要的格式\n      const formData = new FormData();\n      formData.append('dir', 'article');\n      for (let i = 0; i < files.length; i++) formData.append('files', files[i]);\n\n      const {\n        data: { data },\n      } = await axios.post(`${baseURL}/file`, formData, {\n        headers: {\n          Authorization: `Bearer ${store.token}`,\n          'Content-Type': 'multipart/form-data',\n        },\n      });\n\n      setLoading(false);\n\n      // 返回图片信息数组\n      return data.map((url: string) => ({ url }));\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  return (\n    <>\n      <Spin spinning={loading} tip=\"图片上传中...\">\n        <Editor value={value} plugins={plugins} onChange={onChange} locale={zh} uploadImages={uploadImages} />\n      </Spin>\n\n      <Material\n        open={isMaterialModalOpen}\n        onClose={() => setIsMaterialModalOpen(false)}\n        onSelect={(urls) => {\n          if (currentCtx) {\n            // 在光标位置插入图片\n            urls.forEach((url) => {\n              currentCtx.appendBlock(`![图片](${url})`);\n            });\n          }\n        }}\n      />\n    </>\n  );\n};\n\nexport default EditorMD;\n"
  },
  {
    "path": "src/pages/create/components/Editor/markdown.scss",
    "content": ".markdown-body {\n     pre {\n         margin: 15px 0;\n\n         code.hljs {\n             border-radius: 10px;\n             font-weight: 400;\n         }\n     }\n\n     h1,\n     h2,\n     h3,\n     h4,\n     h5,\n     h6 {\n         @apply text-black dark:text-[#EFF4FB] transition-colors;\n     }\n\n     h1 {\n         @apply text-2xl my-6 pb-3 border-b;\n         border-color: var(--color-stroke);\n         .dark & {\n             border-color: var(--color-strokedark);\n         }\n\n         // &::before {\n         //     content: \"✨️\";\n         //     @apply pr-3;\n         // }\n     }\n\n     h2 {\n         @apply relative text-lg my-6;\n\n         // &::before {\n         //     content: \"\";\n         //     @apply absolute left-0 top-[50%] -translate-y-1/2 w-2 h-full bg-primary;\n         // }\n     }\n\n     h3 {\n         @apply relative text-lg my-5;\n\n         // &::before {\n         //     content: \"#\";\n         //     @apply absolute left-0 top-[50%] -translate-y-1/2 text-primary;\n         // }\n     }\n\n     h4,\n     h5,\n     h6 {\n         @apply relative text-lg my-3;\n     }\n\n     hr {\n         @apply my-5 transition-colors;\n         border-color: var(--color-stroke);\n         .dark & {\n             border-color: var(--color-strokedark);\n         }\n     }\n\n     p code,\n     ul code {\n         @apply bg-[rgba(13,110,253,0.1)] dark:bg-[#334052] text-[#0d6efd] rounded-md py-1 px-2 text-sm transition-colors;\n     }\n\n     // 任务列表\n     li.task-list-item {\n         @apply my-2.5;\n     }\n\n     li:not(.task-list-item) {\n         @apply my-2.5;\n     }\n\n     // 无序列表\n     ul:not(.contains-task-list) {\n         @apply list-disc ml-6;\n     }\n\n     // 有序列表\n     ol:not([start]) {\n         counter-reset: counter;\n     }\n\n     ol>li:not([id^=\"user-content-\"]) {\n\n         &::before {\n             @apply inline-block w-4 h-4 mt-1 mr-1 leading-none rounded-full text-center text-sm border border-[#11181C] dark:border-[#EFF4FB];\n\n             counter-increment: counter;\n             content: counter(counter);\n         }\n\n         & ol>li::before {\n             @apply inline-block ml-5 border-0 text-base mt-0 leading-normal;\n\n             content: counter(counter) \".\";\n         }\n     }\n\n     // 引用\n     blockquote {\n         @apply my-5 pl-4 bg-[rgba(246,248,250)] border-l-[4px] border-[#11181C] dark:bg-[rgba(246,248,250,0.1)];\n     }\n\n     // 脚注\n     .sr-only {\n         @apply text-[#EAB308] w-full overflow-visible my-10 before:content-[''];\n\n         &::before {\n             @apply block w-full h-[1px] bg-[#EFF4FB] mb-2;\n         }\n     }\n\n     ol>li[id^=\"user-content-\"] {\n         @apply list-decimal ml-3;\n     }\n\n    // 高亮标记\n    mark {\n      @apply bg-[#dbfdad] dark:bg-[#9db47e];\n    }\n\n     // 提示块\n     .callout-content {\n         @apply pt-1;\n\n         & > p {\n             @apply mb-0;\n         }\n     }\n\n     // 数学公式\n     .katex {\n         @apply text-base;\n     }\n\n     a {\n         color: var(--color-primary);\n     }\n\n     p {\n         @apply leading-9 mb-2;\n     }\n\n     img {\n         @apply rounded-xl cursor-pointer transition-all mt-2;\n     }\n\n     strong {\n         @apply text-base;\n     }\n\n     table {\n         @apply w-full;\n\n         th {\n             @apply bg-[#f1f7fd] dark:bg-[#334052];\n         }\n\n         tr,\n         th,\n         td {\n             @apply border p-[10px_20px];\n         }\n     }\n\n     input[type=\"checkbox\"] {\n         width: 16px;\n         height: 16px;\n         border-radius: 4px;\n         position: relative;\n         cursor: not-allowed;\n     }\n\n     .douyin {\n        min-width: 320px;\n        min-height: 720px;\n        border-radius: 10px;\n        margin: 10px 0;\n    }\n }"
  },
  {
    "path": "src/pages/create/components/Editor/plugins.tsx",
    "content": "import gemoji from '@bytemd/plugin-gemoji';\nimport gfm from '@bytemd/plugin-gfm';\nimport highlight from '@bytemd/plugin-highlight';\nimport math from '@bytemd/plugin-math';\nimport type { BytemdPlugin } from 'bytemd';\nimport 'highlight.js/styles/vs2015.css';\nimport 'katex/dist/katex.css';\nimport rehypeCallouts from 'rehype-callouts';\nimport 'rehype-callouts/theme/obsidian';\nimport { remarkMark } from 'remark-mark-highlight';\nimport type { Plugin } from 'unified';\nimport { visit } from 'unist-util-visit';\nimport type { Element, Root } from 'hast';\nimport { Modal, Input, message } from 'antd';\nimport hljs from 'highlight.js/lib/core';\nimport dos from 'highlight.js/lib/languages/dos';\n\nimport videoSvg from './icon/video.svg?raw';\nimport markerSvg from './icon/marker.svg?raw';\nimport calloutSvg from './icon/callout.svg?raw';\nimport noteSvg from './icon/note.svg?raw';\nimport tipSvg from './icon/tip.svg?raw';\nimport warningSvg from './icon/warning.svg?raw';\nimport checkSvg from './icon/check.svg?raw';\nimport dangerSvg from './icon/danger.svg?raw';\nimport imageSvg from './icon/image.svg?raw';\n\n// 注册 batch 语言支持\nhljs.registerLanguage('batch', dos);\nhljs.registerLanguage('bat', dos);\nhljs.registerLanguage('cmd', dos);\n\nconst rehypeDouyinVideo: Plugin<[], Root> = () => {\n  return (tree) => {\n    visit(tree, 'element', (node: Element) => {\n      if (node.tagName === 'p') {\n        const link = node.children[0];\n        if (\n          link.type === 'element' &&\n          link.tagName === 'a' &&\n          link.properties?.href &&\n          typeof link.properties.href === 'string'\n        ) {\n          const match = /(?:ixigua\\.com|douyin\\.com)\\/(\\d+)/.exec(link.properties.href);\n          if (match) {\n            const videoId = match[1];\n            const wrapperDiv = {\n              type: 'element',\n              tagName: 'div',\n              properties: {\n                className: 'flex justify-center'\n              },\n              children: [{\n                type: 'element',\n                tagName: 'iframe',\n                properties: {\n                  src: `https://open.douyin.com/player/video?vid=${videoId}&autoplay=0`,\n                  referrerPolicy: 'unsafe-url',\n                  allowFullScreen: true,\n                  className: 'douyin'\n                },\n                children: []\n              }]\n            };\n            \n            Object.assign(node, wrapperDiv);\n          }\n        }\n      }\n    });\n  };\n};\n\nconst videos = (): BytemdPlugin => {\n  return {\n    rehype: (processor) => processor.use(rehypeDouyinVideo),\n    actions: [\n      {\n        title: '视频',\n        icon: videoSvg,\n        handler: {\n          type: 'action',\n          click: (ctx) => {\n            let videoId = '';\n\n            Modal.info({\n              title: '插入抖音视频',\n              content: (\n                <div>\n                  <div className=\"mb-2 text-xs\">目前仅支持插入抖音视频</div>\n                  <Input placeholder=\"请输入抖音视频ID\" onChange={(e) => videoId = e.target.value.trim()} />\n                </div>\n              ),\n              cancelText: '取消',\n              okText: '确认',\n              onOk: () => {\n                if (!videoId) {\n                  message.error('请输入抖音视频ID');\n                  return Promise.reject();\n                }\n\n                ctx.appendBlock(`[douyin-video](${videoId})`);\n              },\n              maskClosable: true,\n              keyboard: true\n            });\n          }\n        }\n      }\n    ]\n  }\n}\n\nconst markers = (): BytemdPlugin => {\n  return {\n    remark: (processor) => processor.use(remarkMark),\n    actions: [\n      {\n        title: '标记',\n        icon: markerSvg,\n        handler: {\n          type: 'action',\n          click: (ctx) => {\n            ctx.wrapText('==', '==');\n          }\n        }\n      }\n    ]\n  }\n}\n\nconst callouts = (): BytemdPlugin => {\n  const calloutTypes = [\n    { title: 'Note', icon: noteSvg, blockType: '[!NOTE]' },\n    { title: 'Tip', icon: tipSvg, blockType: '[!TIP]' },\n    { title: 'Warning', icon: warningSvg, blockType: '[!WARNING]' },\n    { title: 'Check', icon: checkSvg, blockType: '[!CHECK]' },\n    { title: 'Danger', icon: dangerSvg, blockType: '[!DANGER]' }\n  ];\n\n  return {\n    rehype: (processor) => processor.use(rehypeCallouts),\n    actions: [\n      {\n        icon: calloutSvg,\n        handler: {\n          type: 'dropdown',\n          actions: calloutTypes.map(({ title, icon, blockType }) => ({\n            title,\n            icon,\n            handler: {\n              type: 'action',\n              click: (ctx) => {\n                ctx.appendBlock(`> ${blockType} ${title}\\n> `);\n              }\n            }\n          }))\n        }\n      }\n    ]\n  }\n}\n\nconst material = (): BytemdPlugin => {\n  return {\n    actions: [\n      {\n        title: '素材库',\n        icon: imageSvg,\n        handler: {\n          type: 'action',\n          click: (ctx) => {\n            // 触发图片选择弹窗\n            const event = new CustomEvent('openMaterialModal', {\n              detail: { ctx }\n            });\n            window.dispatchEvent(event);\n          }\n        }\n      }\n    ]\n  }\n}\n\nexport default [\n  videos(),\n  gfm({ singleTilde: false }),\n  markers(),\n  gemoji(),\n  math(),\n  highlight(),\n  callouts(),\n  material()\n];"
  },
  {
    "path": "src/pages/create/components/PublishForm/index.scss",
    "content": "// .ant-drawer-content-wrapper {\n//     width: 50% !important;\n// }"
  },
  {
    "path": "src/pages/create/components/PublishForm/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router-dom';\n\nimport { Form, Input, Button, Select, DatePicker, Cascader, message, Switch, Radio } from 'antd';\nimport TextArea from 'antd/es/input/TextArea';\nimport { RuleObject } from 'antd/es/form';\nimport dayjs from 'dayjs';\nimport { CloudUploadOutlined, PictureOutlined } from '@ant-design/icons';\n\nimport { addArticleDataAPI, editArticleDataAPI } from '@/api/article';\nimport { getCateListAPI } from '@/api/cate';\nimport useAssistant from '@/hooks/useAssistant';\nimport { addTagDataAPI, getTagListAPI } from '@/api/tag';\n\nimport { Cate } from '@/types/app/cate';\nimport { Tag } from '@/types/app/tag';\nimport { Article, Status } from '@/types/app/article';\n\nimport Material from '@/components/Material';\n\ninterface Props {\n  data: Article;\n  closeModel: () => void;\n}\n\ninterface FieldType {\n  title: string;\n  createTime: number;\n  cateIds: number[];\n  tagIds: (number | string)[];\n  cover: string;\n  description: string;\n  config: {\n    top: boolean;\n    status: Status;\n    password: string;\n    isEncrypt: number;\n  };\n}\n\ninterface AssistantResponse {\n  choices?: Array<{\n    message?: {\n      content?: string;\n    };\n  }>;\n}\n\nconst PublishForm = ({ data, closeModel }: Props) => {\n  const [params] = useSearchParams();\n  const id = +params.get('id')!;\n  const isDraftParams = Boolean(params.get('draft'));\n\n  const [btnLoading, setBtnLoading] = useState(false);\n\n  const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);\n\n  const [form] = Form.useForm();\n  const navigate = useNavigate();\n\n  const [cateList, setCateList] = useState<Cate[]>([]);\n  const [tagList, setTagList] = useState<Tag[]>([]);\n  const [isEncryptEnabled, setIsEncryptEnabled] = useState(false);\n\n  useEffect(() => {\n    if (!id) return form.resetFields();\n\n    // 把数据处理成[[1], [4, 5], [4, 6]]格式\n    const cateIds = data?.cateList?.flatMap((item) => {\n      if (item?.children?.length) {\n        return item.children.map((child) => [item.id, child.id]);\n      } else {\n        return [[item.id]];\n      }\n    });\n\n    console.log(data,data.tagList);\n    \n    const tagIds = data?.tagList!.map((item: Tag) => item.id);\n\n    const formValues = {\n      ...data,\n      status: data.config.status,\n      password: data.config.password,\n      isEncrypt: !!data.config.isEncrypt,\n      cateIds,\n      tagIds,\n      createTime: dayjs(+data.createTime!),\n    };\n\n    form.setFieldsValue(formValues);\n    // 设置初始的加密状态\n    setIsEncryptEnabled(!!formValues.isEncrypt);\n  }, [data, id]);\n\n  const getCateList = async () => {\n    const { data } = await getCateListAPI();\n    setCateList(data.result.filter((item: Cate) => item.type === 'cate'));\n  };\n\n  const getTagList = async () => {\n    const { data } = await getTagListAPI();\n    setTagList(data as Tag[]);\n  };\n\n  useEffect(() => {\n    getCateList();\n    getTagList();\n  }, []);\n\n  // 校验文章封面\n  const validateURL = (_: RuleObject, value: string) => {\n    return !value || /^(https?:\\/\\/)/.test(value) ? Promise.resolve() : Promise.reject(new Error('请输入有效的封面链接'));\n  };\n\n  const onSubmit = async (values: FieldType, isDraft?: boolean) => {\n    setBtnLoading(true);\n\n    values.config.isEncrypt = values.config.isEncrypt ? 1 : 0;\n\n    try {\n      // 如果是文章标签，则先判断是否存在，如果不存在则添加\n      const tagIds: number[] = [];\n      for (const item of values.tagIds ? values.tagIds : []) {\n        if (typeof item === 'string') {\n          // 如果已经有这个标签了，就没必要再创建一个了\n          // 先转换为大写进行查找，否则会出现大小写不匹配问题\n          const tag1 = tagList.find((t) => t.name.toUpperCase() === item.toUpperCase())?.id;\n\n          if (tag1) {\n            tagIds.push(tag1);\n            continue;\n          }\n\n          await addTagDataAPI({ name: item });\n          const { data: list } = await getTagListAPI();\n          // 添加成功后查找对应的标签id\n          const tag2 = list.find((t) => t.name === item)?.id;\n          if (tag2) tagIds.push(tag2);\n        } else {\n          tagIds.push(item);\n        }\n      }\n\n      values.createTime = values.createTime.valueOf();\n      values.cateIds = [...new Set(values.cateIds?.flat())];\n\n      if (id && !isDraftParams) {\n        await editArticleDataAPI({\n          id,\n          ...values,\n          content: data.content,\n          tagIds,\n          createTime: values.createTime.toString(),\n          config: {\n            isDraft: 0,\n            isDel: 0,\n            ...values.config,\n          },\n        } as Article);\n        message.success('🎉 编辑成功');\n      } else {\n        if (!isDraftParams) {\n          await addArticleDataAPI({\n            id,\n            ...values,\n            content: data.content,\n            tagIds,\n            config: {\n              isDraft: isDraft ? 1 : 0,\n              isDel: 0,\n              ...values.config,\n            },\n            createTime: values.createTime.toString(),\n          });\n\n          if (isDraft) {\n            message.success('🎉 保存为草稿成功');\n          } else {\n            message.success('🎉 发布成功');\n          }\n        } else {\n          // 修改草稿状态为发布文章\n          await editArticleDataAPI({\n            id,\n            ...values,\n            content: data.content,\n            tagIds,\n            createTime: values.createTime.toString(),\n            config: {\n              isDraft: isDraft ? 1 : 0,\n              isDel: 0,\n              ...values.config,\n            },\n          } as Article);\n        }\n      }\n\n      // 关闭弹框\n      closeModel();\n      // 清除本地持久化的数据\n      localStorage.removeItem('article_content');\n      // 如果是草稿就跳转到草稿页，否则文章页\n      if (isDraft) {\n        navigate('/draft');\n      } else {\n        navigate('/article');\n      }\n      // 初始化表单\n      form.resetFields();\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n\n    setBtnLoading(false);\n  };\n\n  // 初始表单数据\n  const initialValues = {\n    config: {\n      top: false,\n      status: 'default',\n      password: '',\n      isEncrypt: 0,\n    },\n    createTime: dayjs(new Date()),\n  };\n\n  const { callAssistant } = useAssistant();\n  const [generating, setGenerating] = useState(false);\n\n  // 调用助手API生成标题和简介\n  const generateTitleAndDescription = async () => {\n    try {\n      setGenerating(true);\n\n      const content = data.content || '';\n      if (!content) {\n        message.error('请先输入文章内容');\n        return;\n      }\n\n      const prompt = `请根据以下文章内容生成一个合适的标题和简短的简介：\n文章内容：\n${content}\n\n要求：\n1. 标题要简洁有力，不超过20个字\n2. 简介要概括文章主要内容，不超过100字\n3. 返回格式为JSON对象，包含title和description字段`;\n\n      const response = await callAssistant(\n        [\n          {\n            role: 'system',\n            content: '你是 Kimi，由 Moonshot AI 提供的人工智能助手，你更擅长中文和英文的对话。你会为用户提供安全，有帮助，准确的回答。',\n          },\n          { role: 'user', content: prompt },\n        ],\n        { max_tokens: 200, temperature: 0.3 },\n      );\n\n      if (response) {\n        const result = (response as AssistantResponse).choices?.[0]?.message?.content?.trim();\n        if (result) {\n          try {\n            let jsonStr = result;\n            if (jsonStr.startsWith('```json')) {\n              jsonStr = jsonStr\n                .replace(/```json/g, '')\n                .replace(/```/g, '')\n                .trim();\n            }\n\n            const { title, description } = JSON.parse(jsonStr);\n            form.setFieldsValue({\n              title: title || '',\n              description: description || '',\n            });\n            message.success('标题和简介生成成功');\n          } catch (e) {\n            console.error('Failed to parse response:', e);\n            message.error('解析生成结果失败，请检查助手返回格式');\n          }\n        } else {\n          message.error('生成失败，请重试');\n        }\n      }\n    } catch (error) {\n      console.error(error);\n      message.error('调用助手失败');\n    } finally {\n      setGenerating(false);\n    }\n  };\n\n  // 文件上传\n  const UploadBtn = () => <CloudUploadOutlined className=\"text-xl cursor-pointer\" onClick={() => setIsMaterialModalOpen(true)} />;\n\n  return (\n    <div>\n      <Form form={form} name=\"basic\" size=\"large\" layout=\"vertical\" onFinish={onSubmit} autoComplete=\"off\" initialValues={initialValues}>\n        <Form.Item label=\"文章标题\" name=\"title\" rules={[{ required: true, message: '请输入文章标题' }]}>\n          <Input placeholder=\"请输入文章标题\" />\n        </Form.Item>\n\n        <Form.Item label=\"文章简介\" name=\"description\">\n          <TextArea autoSize={{ minRows: 2, maxRows: 5 }} showCount placeholder=\"请输入文章简介\" />\n        </Form.Item>\n\n        <Form.Item>\n          <Button type=\"primary\" onClick={generateTitleAndDescription} loading={generating}>\n            一键生成标题和简介\n          </Button>\n        </Form.Item>\n\n        <Form.Item label=\"文章封面\" name=\"cover\" rules={[{ validator: validateURL }]}>\n          <Input placeholder=\"请输入文章封面\" prefix={<PictureOutlined />} addonAfter={<UploadBtn />} className=\"customizeAntdInputAddonAfter\" />\n        </Form.Item>\n\n        <Form.Item label=\"选择分类\" name=\"cateIds\" rules={[{ required: true, message: '请选择文章分类' }]}>\n          <Cascader options={cateList} maxTagCount=\"responsive\" multiple fieldNames={{ label: 'name', value: 'id' }} placeholder=\"请选择文章分类\" className=\"w-full\" />\n        </Form.Item>\n\n        <Form.Item label=\"选择标签\" name=\"tagIds\">\n          <Select allowClear mode=\"tags\" options={tagList} fieldNames={{ label: 'name', value: 'id' }} filterOption={(input, option) => !!option?.name.includes(input)} placeholder=\"请选择文章标签\" className=\"w-full\" />\n        </Form.Item>\n\n        <Form.Item label=\"选择发布时间\" name=\"createTime\">\n          <DatePicker showTime placeholder=\"选择文章发布时间\" className=\"w-full\" />\n        </Form.Item>\n\n        {/* <Form.Item label=\"是否置顶\" name={[\"config\", \"top\"]} valuePropName=\"checked\">\n          <Switch />\n        </Form.Item> */}\n\n        <Form.Item label=\"状态\" name={['config', 'status']}>\n          <Radio.Group>\n            <Radio value=\"default\">正常</Radio>\n            <Radio value=\"no_home\">不在首页显示</Radio>\n            <Radio value=\"hide\">全站隐藏</Radio>\n          </Radio.Group>\n        </Form.Item>\n\n        <Form.Item label=\"是否加密\" name={['config', 'isEncrypt']} valuePropName=\"checked\">\n          <Switch onChange={(checked: boolean) => setIsEncryptEnabled(checked)} />\n        </Form.Item>\n\n        {isEncryptEnabled && (\n          <Form.Item label=\"访问密码\" name={['config', 'password']} rules={[{ required: isEncryptEnabled, message: '请输入访问密码' }]}>\n            <Input.Password placeholder=\"请输入访问密码\" />\n          </Form.Item>\n        )}\n\n        <Form.Item className=\"mb-0!\">\n          <Button type=\"primary\" htmlType=\"submit\" loading={btnLoading} className=\"w-full\">\n            {id && !isDraftParams ? '编辑文章' : '发布文章'}\n          </Button>\n        </Form.Item>\n\n        {/* 草稿和编辑状态下不再显示保存草稿按钮 */}\n        {((isDraftParams && id) || !id) && (\n          <Form.Item className=\"mt-2! mb-0!\">\n            <Button className=\"w-full\" onClick={() => form.validateFields().then((values) => onSubmit(values, true))}>\n              {isDraftParams ? '保存' : '保存为草稿'}\n            </Button>\n          </Form.Item>\n        )}\n      </Form>\n\n      <Material\n        // multiple\n        open={isMaterialModalOpen}\n        onClose={() => setIsMaterialModalOpen(false)}\n        onSelect={(url) => {\n          form.setFieldValue('cover', url[0]);\n          form.validateFields(['cover']); // 手动触发 image 字段的校验\n        }}\n      />\n    </div>\n  );\n};\n\nexport default PublishForm;\n"
  },
  {
    "path": "src/pages/create/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { Button, Card, Dropdown, MenuProps, message, Spin } from 'antd';\nimport { BiSave } from 'react-icons/bi';\nimport { AiOutlineEdit, AiOutlineSend } from 'react-icons/ai';\n\nimport Title from '@/components/Title';\nimport Drawer from '@/components/Drawer';\nimport useAssistant from '@/hooks/useAssistant';\nimport { Article } from '@/types/app/article';\nimport { getArticleDataAPI } from '@/api/article';\nimport { titleSty } from '@/styles/sty';\n\nimport Editor from './components/Editor';\nimport PublishForm from './components/PublishForm';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n\n  const [params] = useSearchParams();\n  const id = +params.get('id')!;\n  const isDraftParams = Boolean(params.get('draft'));\n\n  const [data, setData] = useState<Article>({} as Article);\n  const [content, setContent] = useState('');\n  const [publishOpen, setPublishOpen] = useState(false);\n\n  // 下一步\n  const nextBtn = () => {\n    if (content.trim().length >= 1) {\n      setPublishOpen(true);\n    } else {\n      message.error('请输入文章内容');\n    }\n  };\n\n  // 获取文章数据\n  const getArticleData = async () => {\n    try {\n      setLoading(true);\n\n      const { data } = await getArticleDataAPI(id);\n      setData(data);\n      setContent(data.content);\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  // 回显数据\n  useEffect(() => {\n    setPublishOpen(false);\n\n    // 有Id就回显指定的数据\n    if (id) {\n      getArticleData();\n      return;\n    }\n\n    // 没有就回显本地保存的数据\n    const content = localStorage.getItem('article_content');\n\n    if (content) {\n      setData({ ...data, content });\n      setContent(content);\n    }\n  }, [id]);\n\n  // 保存文章\n  const saveBtn = () => {\n    if (content.trim().length >= 1) {\n      // 将文章内容持久化存储到本地\n      localStorage.setItem('article_content', content);\n      message.success('内容已保存');\n    } else {\n      message.error('请输入文章内容');\n    }\n  };\n\n  useEffect(() => {\n    setData({ ...data, content });\n\n    // 点击快捷键保存文章\n    const handleKeyDown = (event: KeyboardEvent) => {\n      if ((event.ctrlKey || event.metaKey) && event.key === 's') {\n        event.preventDefault(); // 阻止默认的保存行为\n        saveBtn();\n      }\n    };\n\n    window.addEventListener('keydown', handleKeyDown);\n\n    return () => {\n      window.removeEventListener('keydown', handleKeyDown);\n    };\n  }, [content]);\n\n  const { list, assistant, callAssistant } = useAssistant();\n\n  // 助手功能菜单\n  const items: MenuProps['items'] = [\n    {\n      key: '1',\n      label: '续写',\n      onClick: async () => {\n        try {\n          setLoading(true);\n          const reader = await callAssistant(\n            [\n              {\n                role: 'system',\n                content: '你是 Kimi，由 Moonshot AI 提供的人工智能助手，你更擅长中文和英文的对话。你会为用户提供安全，有帮助，准确的回答。',\n              },\n              {\n                role: 'user',\n                content: `帮我续写：${content}`,\n              },\n            ],\n            { stream: true, temperature: 0.3 },\n          );\n\n          if (!reader) return;\n\n          let fullResponse = '';\n          const decoder = new TextDecoder();\n\n          while (true) {\n            const { done, value } = await reader.read();\n            if (done) break;\n\n            const chunk = decoder.decode(value);\n            const lines = chunk.split('\\n').filter((line) => line.trim());\n\n            for (const line of lines) {\n              if (line.startsWith('data: ') && !line.includes('[DONE]')) {\n                try {\n                  const data = JSON.parse(line.replace('data: ', ''));\n                  if (data.choices[0]?.delta?.content) {\n                    fullResponse += data.choices[0].delta.content;\n                    setContent(content + fullResponse);\n                  }\n                } catch (error) {\n                  console.error(error);\n                  message.error('调用助手失败');\n                }\n              }\n            }\n          }\n        } catch (error) {\n          console.error(error);\n          message.error('调用助手失败');\n        } finally {\n          setLoading(false);\n        }\n      },\n    },\n    {\n      key: '2',\n      label: '优化',\n      onClick: async () => {\n        try {\n          setLoading(true);\n          const reader = await callAssistant(\n            [\n              {\n                role: 'system',\n                content: '你是 Kimi，由 Moonshot AI 提供的人工智能助手，你更擅长中文和英文的对话。你会为用户提供安全，有帮助，准确的回答。',\n              },\n              {\n                role: 'user',\n                content: `帮我优化该文章，意思不变：${content}`,\n              },\n            ],\n            { stream: true, temperature: 0.3 },\n          );\n\n          if (!reader) return;\n\n          let fullResponse = '';\n          const decoder = new TextDecoder();\n\n          while (true) {\n            const { done, value } = await reader.read();\n            if (done) break;\n\n            const chunk = decoder.decode(value);\n            const lines = chunk.split('\\n').filter((line) => line.trim());\n\n            for (const line of lines) {\n              if (line.startsWith('data: ') && !line.includes('[DONE]')) {\n                try {\n                  const data = JSON.parse(line.replace('data: ', ''));\n                  if (data.choices[0]?.delta?.content) {\n                    fullResponse += data.choices[0].delta.content;\n                    setContent(fullResponse);\n                  }\n                } catch (error) {\n                  console.error(error);\n                  message.error('调用助手失败');\n                }\n              }\n            }\n          }\n        } catch (error) {\n          console.error(error);\n          message.error('调用助手失败');\n        } finally {\n          setLoading(false);\n        }\n      },\n    },\n  ];\n\n  return (\n    <div>\n      <Title value=\"创作\">\n        <div className=\"flex items-center space-x-4 w-[365px]\">\n          <Dropdown.Button\n            menu={{ items }}\n            onClick={() => {\n              if (list.length === 0) {\n                message.error('请先在助手管理中添加助手');\n              }\n            }}\n          >\n            <AiOutlineEdit className=\"text-base\" />\n            {assistant ? list.find((a) => a.id === Number(assistant))?.name || '选择助手' : '选择助手'}\n          </Dropdown.Button>\n\n          <Button className=\"w-full flex justify-between\" onClick={saveBtn}>\n            <BiSave className=\"text-base\" /> 保存\n          </Button>\n\n          <Button size=\"large\" type=\"primary\" className=\"w-full flex justify-between\" onClick={nextBtn}>\n            <AiOutlineSend className=\"text-2xl\" /> 发布\n          </Button>\n        </div>\n      </Title>\n\n      <Spin spinning={loading}>\n        <Card className={`${titleSty} overflow-hidden rounded-2xl! min-h-[calc(100vh-160px)]`}>\n          <Editor value={content} onChange={(value) => setContent(value)} />\n\n          <Drawer title={id && !isDraftParams ? '编辑文章' : '发布文章'} open={publishOpen} onClose={() => setPublishOpen(false)}>\n            <div className=\"max-w-5xl mx-auto\">\n              <PublishForm data={data} closeModel={() => setPublishOpen(false)} />\n            </div>\n          </Drawer>\n        </Card>\n      </Spin>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/create_record/index.scss",
    "content": ".create_record_page {\n  .ant-input:focus {\n    box-shadow: none !important;\n  }\n  \n  .image-container {\n    &.aspect-square {\n      position: relative;\n      overflow: hidden;\n\n      .ant-image-img {\n        object-fit: cover;\n        width: 100%;\n        height: 100%;\n        min-width: 100%;\n        min-height: 100%;\n        display: block;\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "src/pages/create_record/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router-dom';\nimport { Button, Dropdown, Image, Input, message, Modal, Spin, Tooltip } from 'antd';\nimport type { MenuProps } from 'antd';\nimport { BiLogoTelegram, BiLink } from 'react-icons/bi';\nimport { LuImagePlus } from 'react-icons/lu';\nimport { RiDeleteBinLine, RiLoader4Line } from 'react-icons/ri';\nimport Material from '@/components/Material';\nimport { addRecordDataAPI, editRecordDataAPI, getRecordDataAPI } from '@/api/record';\nimport './index.scss';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n  const [content, setContent] = useState('');\n\n  const [params] = useSearchParams();\n  const id = +params.get('id')!;\n  const navigate = useNavigate();\n\n  const [imageList, setImageList] = useState<string[]>([]);\n  const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);\n\n  // 删除图片\n  const handleDelImage = (data: string) => {\n    setImageList(imageList.filter((item) => item !== data));\n  };\n\n  const onSubmit = async () => {\n    try {\n      if (!content.trim().length) {\n        message.warning('写点什么再发布吧...');\n        return;\n      }\n      setLoading(true);\n\n      const data = {\n        content: content,\n        images: JSON.stringify(imageList),\n        createTime: new Date().getTime().toString(),\n      };\n\n      if (id) {\n        await editRecordDataAPI({ id, content: data.content, images: data.images });\n        message.success('想法已更新');\n      } else {\n        await addRecordDataAPI(data);\n        message.success('闪念已发布');\n      }\n\n      setLoading(false);\n      navigate('/record');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  const getRecordData = async () => {\n    try {\n      setLoading(true);\n      const { data } = await getRecordDataAPI(id);\n      setContent(data.content);\n      setImageList(JSON.parse(data.images as string));\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    if (id) getRecordData();\n  }, [id]);\n\n  // 处理链接输入\n  const handleLinkInput = () => {\n    if (imageList.length >= 4) {\n      message.warning('最多只能上传 4 张图片');\n      return;\n    }\n    let inputUrl = '';\n    Modal.confirm({\n      title: '添加网络图片',\n      icon: <BiLink className=\"text-blue-500 mr-2\" />,\n      content: (\n        <Input\n          className=\"mt-4\"\n          placeholder=\"https://example.com/image.png\"\n          onChange={(e) => {\n            inputUrl = e.target.value;\n          }}\n        />\n      ),\n      okText: '添加',\n      cancelText: '取消',\n      centered: true,\n      onOk: () => {\n        if (!inputUrl.startsWith('http://') && !inputUrl.startsWith('https://')) {\n          message.error('请输入有效的 HTTP/HTTPS 链接');\n          return Promise.reject();\n        }\n        setImageList([...imageList, inputUrl]);\n        return Promise.resolve();\n      },\n    });\n  };\n\n  // 下拉菜单配置\n  const dropdownItems: MenuProps = {\n    items: [\n      {\n        key: 'upload',\n        label: <span>从素材库选择</span>,\n        icon: <LuImagePlus className=\"text-base!\" />,\n        onClick: () => {\n          if (imageList.length >= 4) return message.warning('最多只能上传 4 张图片');\n          setIsMaterialModalOpen(true);\n        },\n      },\n      {\n        key: 'input',\n        label: <span>输入图片链接</span>,\n        icon: <BiLink className=\"text-base!\" />,\n        onClick: handleLinkInput,\n      },\n    ],\n  };\n\n  return (\n    <div className=\"create_record_page min-h-screen p-4 md:p-6 lg:p-10 transition-colors duration-300\">\n      <div className=\"max-w-3xl mx-auto space-y-6\">\n        <Spin spinning={loading} indicator={<RiLoader4Line className=\"text-3xl animate-spin text-blue-500\" />}>\n          {/* 主编辑器卡片 */}\n          <div className=\"bg-white dark:bg-gray-800 rounded-3xl shadow-xl shadow-gray-200/50 dark:shadow-black/20 overflow-hidden border dark:border-gray-700 transition-all duration-300 hover:shadow-2xl\">\n            <div className=\"p-3 md:p-6\">\n              <Input.TextArea value={content} onChange={(e) => setContent(e.target.value)} placeholder=\"此刻你在想什么？...\" autoSize={{ minRows: 3, maxRows: 10 }} variant=\"filled\" className=\"p-4! text-lg md:text-xl text-gray-700 dark:text-gray-200 placeholder:text-gray-300 dark:placeholder:text-gray-600 px-0 resize-none bg-transparent! dark:bg-transparent! border-none! shadow-none! focus:shadow-none\" />\n            </div>\n\n            {/* 图片预览网格区*/}\n            {imageList.length > 0 && (\n              <div className=\"px-6 md:px-8 pb-6 animate-fade-in\">\n                {imageList.length === 3 ? (\n                  // 微信朋友圈风格的三图布局：左大右小双排\n                  <div className=\"grid grid-cols-3 gap-2\">\n                    <div key={0} className=\"group relative aspect-auto col-span-2 row-span-1 rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-700 border border-gray-100 dark:border-gray-600 flex items-center justify-center image-container\">\n                      <Image src={imageList[0]} className=\"object-cover w-full h-full min-w-full min-h-full transition-transform duration-500 group-hover:scale-110\" wrapperClassName=\"w-full h-full\" preview={true} />\n                      <div className=\"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center backdrop-blur-[2px]\">\n                        <Tooltip title=\"移除图片\">\n                          <button\n                            onClick={(e) => {\n                              e.stopPropagation();\n                              handleDelImage(imageList[0]);\n                            }}\n                            className=\"bg-white/20 hover:bg-red-500 text-white p-2.5 rounded-full backdrop-blur-md transition-all duration-200 transform scale-90 group-hover:scale-100 hover:rotate-90\"\n                          >\n                            <RiDeleteBinLine size={20} />\n                          </button>\n                        </Tooltip>\n                      </div>\n                    </div>\n                    <div className=\"space-y-4\">\n                      <div key={1} className=\"group relative aspect-square rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-700 border border-gray-100 dark:border-gray-600 flex items-center justify-center image-container\">\n                        <Image src={imageList[1]} className=\"object-cover w-full h-full min-w-full min-h-full transition-transform duration-500 group-hover:scale-110\" wrapperClassName=\"w-full h-full\" preview={true} />\n                        <div className=\"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center backdrop-blur-[2px]\">\n                          <Tooltip title=\"移除图片\">\n                            <button\n                              onClick={(e) => {\n                                e.stopPropagation();\n                                handleDelImage(imageList[1]);\n                              }}\n                              className=\"bg-white/20 hover:bg-red-500 text-white p-2.5 rounded-full backdrop-blur-md transition-all duration-200 transform scale-90 group-hover:scale-100 hover:rotate-90\"\n                            >\n                              <RiDeleteBinLine size={20} />\n                            </button>\n                          </Tooltip>\n                        </div>\n                      </div>\n                      <div key={2} className=\"group relative aspect-square rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-700 border border-gray-100 dark:border-gray-600 flex items-center justify-center image-container\">\n                        <Image src={imageList[2]} className=\"object-cover w-full h-full min-w-full min-h-full transition-transform duration-500 group-hover:scale-110\" wrapperClassName=\"w-full h-full\" preview={true} />\n                        <div className=\"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center backdrop-blur-[2px]\">\n                          <Tooltip title=\"移除图片\">\n                            <button\n                              onClick={(e) => {\n                                e.stopPropagation();\n                                handleDelImage(imageList[2]);\n                              }}\n                              className=\"bg-white/20 hover:bg-red-500 text-white p-2.5 rounded-full backdrop-blur-md transition-all duration-200 transform scale-90 group-hover:scale-100 hover:rotate-90\"\n                            >\n                              <RiDeleteBinLine size={20} />\n                            </button>\n                          </Tooltip>\n                        </div>\n                      </div>\n                    </div>\n                  </div>\n                ) : (\n                  <div className={`grid gap-4 ${imageList.length === 1 ? 'grid-cols-1' : imageList.length === 2 ? 'grid-cols-2' : 'grid-cols-2 md:grid-cols-4'}`}>\n                    {imageList.map((item, index) => (\n                      <div key={index} className=\"group relative aspect-square rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-700 border border-gray-100 dark:border-gray-600 flex items-center justify-center image-container\">\n                        {/* 图片主体 */}\n                        <Image src={item} className=\"object-cover w-full h-full min-w-full min-h-full transition-transform duration-500 group-hover:scale-110\" wrapperClassName=\"w-full h-full\" preview={true} />\n\n                        {/* 删除遮罩层 */}\n                        <div className=\"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center backdrop-blur-[2px]\">\n                          <Tooltip title=\"移除图片\">\n                            <button\n                              onClick={(e) => {\n                                e.stopPropagation();\n                                handleDelImage(item);\n                              }}\n                              className=\"bg-white/20 hover:bg-red-500 text-white p-2.5 rounded-full backdrop-blur-md transition-all duration-200 transform scale-90 group-hover:scale-100 hover:rotate-90\"\n                            >\n                              <RiDeleteBinLine size={20} />\n                            </button>\n                          </Tooltip>\n                        </div>\n                      </div>\n                    ))}\n                  </div>\n                )}\n              </div>\n            )}\n\n            {/* 底部工具栏 */}\n            <div className=\"bg-gray-50/80 dark:bg-gray-700/30 backdrop-blur-xs px-6 py-4 flex items-center justify-between border-t border-gray-100 dark:border-gray-700\">\n              {/* 左侧：功能按钮 */}\n              <div className=\"flex items-center space-x-2\">\n                <Dropdown menu={dropdownItems} placement=\"topLeft\" trigger={['click']}>\n                  <Button type=\"text\" icon={<LuImagePlus size={22} />} className=\"flex items-center text-gray-500 hover:text-blue-600 dark:text-gray-400 dark:hover:text-blue-400 bg-transparent hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-xl h-12 px-4 border-none transition-all\">\n                    <span className=\"ml-1 hidden sm:inline\">添加图片</span>\n                    <span className=\"ml-1 text-xs bg-gray-200 dark:bg-gray-600 px-1.5 py-0.5 rounded-md text-gray-500 dark:text-gray-300\">{imageList.length}/4</span>\n                  </Button>\n                </Dropdown>\n              </div>\n\n              {/* 右侧：提交按钮 */}\n              <Button type=\"primary\" size=\"large\" onClick={onSubmit} loading={loading} icon={!loading && <BiLogoTelegram size={20} />} className=\"h-12 px-5 rounded-xl bg-blue-400 hover:bg-blue-500 shadow-lg shadow-blue-500/30 border-none font-medium text-base flex items-center gap-2 transition-all hover:-translate-y-0.5\">\n                {id ? '更新' : '发布'}\n              </Button>\n            </div>\n          </div>\n        </Spin>\n      </div>\n\n      {/* 素材库弹窗 */}\n      <Material\n        maxCount={4 - imageList.length}\n        open={isMaterialModalOpen}\n        onClose={() => setIsMaterialModalOpen(false)}\n        onSelect={(url) => {\n          setImageList([...imageList, ...url]);\n        }}\n      />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/dashboard/components/HeaderInfo/index.tsx",
    "content": "\nimport { useUserStore } from '@/stores';\n\nconst HeaderInfo = () => {\n  const { user } = useUserStore();\n\n  return (\n    <div className=\"flex justify-between items-center xs:px-6 container mx-auto\">\n      <div className=\"flex items-center\">\n        {/* 头像 */}\n        <img src={user?.avatar || 'https://q1.qlogo.cn/g?b=qq&nk=3311118881&s=640'} alt=\"avatar\" className=\"w-16 xs:w-24 h-16 xs:h-24 rounded-full mr-4 transition-transform duration-300 transform hover:scale-125 avatar-animation\" />\n\n        {/* 信息 */}\n        <div className=\"info\">\n          <div className=\"font-medium text-gradient\">\n            <div className=\"text-2xl\">\n              Hello <span className=\"pr-4\">{user?.name || '未命名'}!</span>\n            </div>\n            <div className=\"text-base xsm:text-lg xs:mt-2.5\">欢迎使用 ThriveX 现代化博客管理系统</div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n};\n\nexport default HeaderInfo;\n"
  },
  {
    "path": "src/pages/dashboard/components/Info/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { getCommentListAPI } from '@/api/comment';\nimport { getWallListAPI } from '@/api/wall';\nimport { getLinkListAPI } from '@/api/web';\n\nexport default function InfoCard() {\n  const navigate = useNavigate()\n  const [commentCount, setCommentCount] = useState<number>(0);\n  const [linkCount, setLinkCount] = useState<number>(0);\n  const [wallCount, setWallCount] = useState<number>(0);\n\n  const getData = async () => {\n    const { data: commentList } = await getCommentListAPI({ query: { status: 0 }, pattern: 'list' });\n    const { data: linkList } = await getLinkListAPI({ query: { status: 0 } });\n    const { data: wallList } = await getWallListAPI({ query: { status: 0 } });\n\n    setCommentCount(commentList.length);\n    setLinkCount(linkList.length);\n    setWallCount(wallList.length);\n  };\n\n  useEffect(() => {\n    getData();\n  }, []);\n\n  return (\n    <div className=\"bg-primary rounded-md p-6 sm:p-10 flex flex-col justify-center h-[170px] relative overflow-hidden mb-4\">\n      {/* 右侧弧形背景装饰 */}\n      <div\n        className=\"absolute right-[-60px] top-[-40px] w-[300px] h-[300px] bg-blue-300 opacity-40 z-0\"\n        style={{\n          borderRadius: '60% 40% 60% 40% / 60% 60% 40% 40%',\n        }}\n      />\n\n      <div className=\"relative z-10\">\n        <h1 className=\"text-white text-xl font-bold sm:text-2xl\">\n          欢迎使用 ThriveX 现代化博客管理系统\n        </h1>\n\n        <p className=\"text-white text-sm mt-2 mb-3\">\n          当前有 <span className=\"text-white text-2xl font-bold\">{commentCount}</span> 条评论，<span className=\"text-white text-2xl font-bold\">{linkCount}</span> 条友链，<span className=\"text-white text-2xl font-bold\">{wallCount}</span> 条留言。\n        </p>\n\n        <button className=\"bg-white text-blue-400 font-bold py-1 px-4 rounded-sm transition-transform hover:scale-105 cursor-pointer\" onClick={() => navigate('/work')}>\n          去处理\n        </button>\n      </div>\n    </div>\n  );\n}"
  },
  {
    "path": "src/pages/dashboard/components/Stats/components/NewOldVisitors/index.tsx",
    "content": "import { ApexOptions } from 'apexcharts';\nimport { useEffect, useState } from 'react';\nimport ReactApexChart from 'react-apexcharts';\nimport dayjs from 'dayjs';\nimport { Spin } from 'antd';\nimport { getStatisAPI } from '@/api/statis';\nimport { StatisResponse } from '../VisitorsStatisChat/type';\n\ninterface ChartThreeState {\n  series: number[];\n}\n\nconst options: ApexOptions = {\n  chart: {\n    fontFamily: 'Satoshi, sans-serif',\n    type: 'donut',\n  },\n  colors: ['#91C8EA', '#60a5fa'],\n  labels: ['新访客', '老访客'],\n  legend: {\n    show: false,\n    position: 'bottom',\n  },\n  plotOptions: {\n    pie: {\n      donut: {\n        size: '65%',\n        background: 'transparent',\n      },\n    },\n  },\n  dataLabels: {\n    enabled: false,\n  },\n  responsive: [\n    {\n      breakpoint: 2600,\n      options: {\n        chart: {\n          width: 380,\n        },\n      },\n    },\n    {\n      breakpoint: 640,\n      options: {\n        chart: {\n          width: 200,\n        },\n      },\n    },\n  ],\n};\n\nexport default () => {\n  const [loading, setLoading] = useState(true);\n\n  const [result, setResult] = useState({ newVisitors: 0, oldVisitors: 0 });\n  const date = dayjs(new Date()).format('YYYY/MM/DD');\n\n  const [state, setState] = useState<ChartThreeState>({\n    series: [0, 0],\n  });\n\n  const getDataList = async () => {\n    setLoading(true);\n\n    try {\n      const { data } = await getStatisAPI('new-visitor', date, date);\n      if (!data) return setLoading(false);\n      const { result } = data as StatisResponse;\n\n      const newVisitors = result.items[1][0][1] !== '--' ? Number(Number(result.items[1][0][1]).toFixed(2)) : 0;\n      const oldVisitors = result.items[1][0][1] !== '--' ? Number((100 - Number(result.items[1][0][1])).toFixed(2)) : 0;\n\n      setState({ series: [newVisitors, oldVisitors] });\n      setResult({ newVisitors, oldVisitors });\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n\n    setLoading(false);\n  };\n\n  useEffect(() => {\n    getDataList();\n  }, []);\n\n  return (\n    <div className=\"sm:px-7 col-span-12 rounded-md border border-stroke bg-light-gradient dark:bg-dark-gradient px-5 pb-4 pt-7 shadow-default dark:border-transparent xl:col-span-4\">\n      <Spin spinning={loading}>\n        <div className=\"mb-3 justify-between gap-4 sm:flex\">\n          <div>\n            <h5 className=\"text-xl font-semibold text-black dark:text-white\">新老访客</h5>\n          </div>\n        </div>\n\n        <div className=\"mb-2\">\n          <div id=\"chartThree\" className=\"mx-auto flex justify-center\">\n            <ReactApexChart options={options} series={state.series} type=\"donut\" />\n          </div>\n        </div>\n\n        <div className=\"-mx-8 mt-8 flex flex-wrap items-center justify-center gap-y-3\">\n          <div className=\"sm:w-1/2 w-full px-8\">\n            <div className=\"flex w-full items-center\">\n              <span className=\"mr-2 block h-3 w-full max-w-3 rounded-full bg-[#91C8EA]\"></span>\n              <p className=\"flex w-full justify-between text-sm font-medium text-black dark:text-white\">\n                <span className=\"text-black dark:text-strokedark\"> 新访客 </span>\n                <span> {result.newVisitors.toFixed(2)}% </span>\n              </p>\n            </div>\n          </div>\n\n          <div className=\"sm:w-1/2 w-full px-8\">\n            <div className=\"flex w-full items-center\">\n              <span className=\"mr-2 block h-3 w-full max-w-3 rounded-full bg-primary\"></span>\n              <p className=\"flex w-full justify-between text-sm font-medium text-black dark:text-white\">\n                <span className=\"text-black dark:text-strokedark\"> 老访客 </span>\n                <span> {result.oldVisitors.toFixed(2)}% </span>\n              </p>\n            </div>\n          </div>\n        </div>\n      </Spin>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/dashboard/components/Stats/components/VisitorsStatisChat/index.tsx",
    "content": "import { useEffect, useState, useMemo } from 'react';\nimport { Spin } from 'antd';\nimport { ApexOptions } from 'apexcharts';\nimport dayjs from 'dayjs';\nimport { getStatisAPI } from '@/api/statis';\nimport ReactECharts from 'echarts-for-react';\nimport { EChartsParams, Result, StatisResponse } from './type';\nimport { useConfigStore } from '@/stores';\n\nexport default () => {\n  const colorMode = useConfigStore((state) => state.colorMode);\n\n  const [loading, setLoading] = useState<boolean>(false);\n\n  const [result, setResult] = useState<Result | null>(null);\n  const [scope, setScope] = useState<'day' | 'month' | 'year'>('day');\n  const [startDate, setStartDate] = useState(dayjs(new Date()).subtract(7, 'day').format('YYYYMMDD'));\n  const endDate = dayjs(new Date()).format('YYYYMMDD');\n\n  // 图表相关配置\n  const [options, setOptions] = useState<ApexOptions>({\n    legend: {\n      show: false,\n      position: 'top',\n      horizontalAlign: 'left',\n    },\n    colors: ['#60a5fa', '#80CAEE'],\n    chart: {\n      fontFamily: 'Satoshi, sans-serif',\n      height: 335,\n      type: 'area',\n      dropShadow: {\n        enabled: true,\n        color: '#623CEA14',\n        top: 10,\n        blur: 4,\n        left: 0,\n        opacity: 0.1,\n      },\n      toolbar: {\n        show: false,\n      },\n    },\n    responsive: [\n      {\n        breakpoint: 1024,\n        options: {\n          chart: {\n            height: 300,\n          },\n        },\n      },\n      {\n        breakpoint: 1366,\n        options: {\n          chart: {\n            height: 350,\n          },\n        },\n      },\n    ],\n    stroke: {\n      width: [2, 2],\n      curve: 'straight',\n    },\n    grid: {\n      xaxis: {\n        lines: {\n          show: true,\n        },\n      },\n      yaxis: {\n        lines: {\n          show: true,\n        },\n      },\n    },\n    dataLabels: {\n      enabled: false,\n    },\n    markers: {\n      size: 4,\n      colors: '#fff',\n      strokeColors: ['#60a5fa', '#80CAEE'],\n      strokeWidth: 3,\n      strokeOpacity: 0.9,\n      strokeDashArray: 0,\n      fillOpacity: 1,\n      discrete: [],\n      hover: {\n        size: undefined,\n        sizeOffset: 5,\n      },\n    },\n    xaxis: {\n      type: 'category',\n      categories: [],\n      axisBorder: {\n        show: false,\n      },\n      axisTicks: {\n        show: false,\n      },\n    },\n    yaxis: {\n      title: {\n        style: {\n          fontSize: '0px',\n        },\n      },\n    },\n  });\n\n  // 获取统计数据\n  useEffect(() => {\n    const fetchData = async () => {\n      try {\n        setLoading(true);\n        const { data } = await getStatisAPI('basic-overview', startDate, endDate);\n        if (!data) return setLoading(false);\n        const { result } = data as StatisResponse;\n        setResult(result);\n        setLoading(false);\n      } catch (error) {\n        console.error(error);\n        setLoading(false);\n      }\n    };\n    fetchData();\n  }, [startDate, endDate]);\n\n  // 切换不同范围的数据\n  const scopeData = useMemo(() => {\n    setLoading(true);\n\n    if (!result?.items?.length) return { categories: [], series: [[], []] };\n\n    let categories: string[] = [];\n    let pvList: number[] = [];\n    let ipList: number[] = [];\n\n    const now = dayjs();\n    const currentYear = now.year();\n    const currentMonth = now.month() + 1; // month() 从0开始\n\n    switch (scope) {\n      case 'day': {\n        // 只生成本月1号到今天\n        const today = now.date();\n        categories = Array.from({ length: today }, (_, i) => `${currentMonth}/${(i + 1).toString().padStart(2, '0')}`);\n        // 过滤本月数据\n        const dateArr: string[][] = result.items[0];\n        const valueArr: (string | number)[][] = result.items[1];\n        const dayMap: Record<string, { pv: number; ip: number }> = {};\n        dateArr.forEach((dateArray, idx) => {\n          const date = dateArray[0]; // 格式: YYYY/MM/DD\n          const d = dayjs(date, 'YYYY/MM/DD');\n          if (d.year() === currentYear && d.month() + 1 === currentMonth) {\n            const key = `${currentMonth}/${d.date().toString().padStart(2, '0')}`;\n            const pair = valueArr[idx];\n            dayMap[key] = {\n              pv: Number(pair[0]) || 0,\n              ip: Number(pair[1]) || 0,\n            };\n          }\n        });\n        pvList = categories.map((day) => dayMap[day]?.pv || 0);\n        ipList = categories.map((day) => dayMap[day]?.ip || 0);\n        break;\n      }\n      case 'month': {\n        // 生成1-12月，全部用两位数\n        categories = Array.from({ length: 12 }, (_, i) => (i + 1).toString().padStart(2, '0'));\n        // 过滤本年数据\n        const dateArr: string[][] = result.items[0];\n        const valueArr: (string | number)[][] = result.items[1];\n        const monthMap: Record<string, { pv: number; ip: number }> = {};\n        dateArr.forEach((dateArray, idx) => {\n          const date = dateArray[0]; // 格式: YYYY/MM/DD\n          const d = dayjs(date, 'YYYY/MM/DD');\n          if (d.year() === currentYear) {\n            const m = (d.month() + 1).toString().padStart(2, '0');\n            if (!monthMap[m]) monthMap[m] = { pv: 0, ip: 0 };\n            const pair = valueArr[idx];\n            monthMap[m].pv += Number(pair[0]) || 0;\n            monthMap[m].ip += Number(pair[1]) || 0;\n          }\n        });\n        pvList = categories.map((m) => monthMap[m]?.pv || 0);\n        ipList = categories.map((m) => monthMap[m]?.ip || 0);\n        break;\n      }\n      case 'year': {\n        // 统计所有年\n        const dateArr: string[][] = result.items[0];\n        const valueArr: (string | number)[][] = result.items[1];\n        const yearMap: Record<string, { pv: number; ip: number }> = {};\n        dateArr.forEach((dateArray, idx) => {\n          const date = dateArray[0]; // 格式: YYYY/MM/DD\n          const d = dayjs(date, 'YYYY/MM/DD');\n          const y = d.year().toString();\n          if (!yearMap[y]) yearMap[y] = { pv: 0, ip: 0 };\n          const pair = valueArr[idx];\n          yearMap[y].pv += Number(pair[0]) || 0;\n          yearMap[y].ip += Number(pair[1]) || 0;\n        });\n        categories = Object.keys(yearMap).sort();\n        pvList = categories.map((y) => yearMap[y]?.pv || 0);\n        ipList = categories.map((y) => yearMap[y]?.ip || 0);\n        break;\n      }\n    }\n\n    return { categories, series: [pvList, ipList] };\n  }, [result, scope]);\n\n  // 当数据发生变化时，更新图表选项和状态\n  useEffect(() => {\n    setLoading(true);\n\n    setOptions((data) => ({\n      ...data,\n      xaxis: { ...options.xaxis, categories: scopeData.categories || [] },\n    }));\n\n    setLoading(false);\n  }, [scopeData]);\n\n  // 处理范围变更并相应地更新日期范围\n  const handleScopeChange = (newScope: 'day' | 'month' | 'year') => {\n    setScope(newScope);\n    const now = dayjs();\n    switch (newScope) {\n      case 'day': {\n        // 本月1号到本月最后一天\n        setStartDate(now.startOf('month').format('YYYY/MM/DD'));\n        break;\n      }\n      case 'month': {\n        // 本年1月1日到12月31日\n        setStartDate(now.startOf('year').format('YYYY/MM/DD'));\n        break;\n      }\n      case 'year': {\n        // 近五年（含今年），起始时间为五年前的1月1日\n        const startYear = now.year() - 4;\n        setStartDate(dayjs(`${startYear}-01-01`).format('YYYY/MM/DD'));\n        break;\n      }\n    }\n  };\n\n  return (\n    <div className=\"col-span-12 rounded-md border border-stroke px-5 pt-7 pb-5 shadow-default dark:border-transparent bg-light-gradient dark:bg-dark-gradient sm:px-7 xl:col-span-8\">\n      <div className=\"flex w-full justify-between items-center mb-2\">\n        <h3 className=\"text-xl font-bold text-slate-800 dark:text-white\">访客统计</h3>\n\n        <div className=\"inline-flex items-center rounded-md bg-whiter p-1.5 space-x-1\">\n          <button className={`rounded-sm py-1 px-3 text-xs font-medium text-black hover:bg-white hover:shadow-card dark:text-white dark:hover:bg-boxdark ${scope === 'day' ? 'bg-white dark:bg-[#4e5969]! shadow-card' : ''}`} onClick={() => handleScopeChange('day')}>\n            天\n          </button>\n\n          <button className={`rounded-sm py-1 px-3 text-xs font-medium text-black hover:bg-white hover:shadow-card dark:text-white dark:hover:bg-boxdark ${scope === 'month' ? 'bg-white dark:bg-[#4e5969]! shadow-card' : ''}`} onClick={() => handleScopeChange('month')}>\n            月\n          </button>\n\n          <button className={`rounded-sm py-1 px-3 text-xs font-medium text-black hover:bg-white hover:shadow-card dark:text-white dark:hover:bg-boxdark ${scope === 'year' ? 'bg-white dark:bg-[#4e5969]! shadow-card' : ''}`} onClick={() => handleScopeChange('year')}>\n            年\n          </button>\n        </div>\n      </div>\n\n      <Spin spinning={loading}>\n        <div id=\"chartOne\" className=\"-ml-5\">\n          <ReactECharts\n            option={{\n              tooltip: {\n                trigger: 'axis',\n                backgroundColor: colorMode === 'dark' ? '#334459' : '#fff',\n                borderColor: colorMode === 'dark' ? '#475f7d' : '#e5eaf3',\n                borderWidth: 1,\n                textStyle: {\n                  color: colorMode === 'dark' ? '#e0e0e0' : '#1a2757',\n                  fontSize: 14,\n                },\n                padding: 16,\n                extraCssText: colorMode === 'dark' ? 'box-shadow: 0 4px 24px rgba(0,0,0,0.3); border-radius: 10px;' : 'box-shadow: 0 4px 24px rgba(0,0,0,0.08); border-radius: 10px;',\n                formatter: function (params: EChartsParams[]) {\n                  let str = `<div style=\"font-weight:700;margin-bottom:8px;\">${params[0].axisValue}${scope === 'month' ? '月' : scope === 'year' ? '年' : ''}</div>`;\n                  params.forEach((item: EChartsParams) => {\n                    let color;\n                    if (item.seriesName === '访客') {\n                      color = '#6a8eff';\n                    } else if (item.seriesName === 'IP') {\n                      color = '#4fc3ff';\n                    }\n                    str += `\\n          <div style=\"display:flex;align-items:center;justify-content:space-between;margin-bottom:2px;\">\\n            <span style=\"display:inline-flex;align-items:center;\">\\n              <span style=\"display:inline-block;width:10px;height:10px;border-radius:50%;background:${color};margin-right:6px;\"></span>\\n              ${item.seriesName}：\\n            </span>\\n            <span style=\"font-weight:700;margin-left:16px;\">${item.data}</span>\\n          </div>\\n        `;\n                  });\n                  return str;\n                },\n              },\n              legend: {\n                data: [\n                  { name: '访客', icon: 'circle', itemStyle: { color: '#6a8eff' } },\n                  { name: 'IP', icon: 'circle', itemStyle: { color: '#4fc3ff' } },\n                ],\n                bottom: 0,\n                left: 'center',\n                itemWidth: 18,\n                itemHeight: 18,\n                itemGap: 32,\n                textStyle: {\n                  fontSize: 14,\n                  color: colorMode === 'dark' ? '#e0e0e0' : '#1a2757',\n                  margin: 30,\n                },\n              },\n              grid: {\n                left: 50,\n                right: 20,\n                top: 20,\n                bottom: 60,\n              },\n              xAxis: {\n                type: 'category',\n                boundaryGap: false,\n                data: scopeData.categories,\n                axisLine: { show: false }, // 隐藏x轴轴线\n                axisTick: { show: false }, // 隐藏x轴刻度线\n                axisLabel: {\n                  fontSize: 12,\n                  color: colorMode === 'dark' ? '#475f7d' : '#1a2757',\n                },\n              },\n              yAxis: {\n                type: 'value',\n                min: 0,\n                splitNumber: 5,\n                axisLine: { show: false },\n                axisLabel: {\n                  fontSize: 12,\n                  color: colorMode === 'dark' ? '#475f7d' : '#1a2757',\n                },\n                splitLine: {\n                  lineStyle: {\n                    type: 'dashed',\n                    color: colorMode === 'dark' ? '#475f7d' : '#f0f4fa',\n                  },\n                },\n              },\n              series: [\n                {\n                  name: '访客',\n                  type: 'line',\n                  smooth: false,\n                  symbol: 'circle',\n                  symbolSize: 8,\n                  itemStyle: {\n                    color: '#fff',\n                    borderColor: '#6a8eff',\n                    borderWidth: 3,\n                  },\n                  emphasis: {\n                    itemStyle: {\n                      borderColor: '#6a8eff',\n                      borderWidth: 5,\n                    },\n                  },\n                  lineStyle: {\n                    width: 3,\n                    color: '#6a8eff', // 纯色\n                  },\n                  areaStyle: {\n                    color: {\n                      type: 'linear',\n                      x: 0,\n                      y: 0,\n                      x2: 0,\n                      y2: 1,\n                      colorStops: [\n                        { offset: 0, color: 'rgba(106,142,255,0.25)' },\n                        { offset: 1, color: 'rgba(106,142,255,0)' },\n                      ],\n                    },\n                  },\n                  data: scopeData.series[0],\n                },\n                {\n                  name: 'IP',\n                  type: 'line',\n                  smooth: false,\n                  symbol: 'circle',\n                  symbolSize: 8,\n                  itemStyle: {\n                    color: '#fff',\n                    borderColor: '#4fc3ff',\n                    borderWidth: 3,\n                  },\n                  emphasis: {\n                    itemStyle: {\n                      borderColor: '#4fc3ff',\n                      borderWidth: 5,\n                    },\n                  },\n                  lineStyle: {\n                    width: 3,\n                    color: '#4fc3ff', // 纯色\n                  },\n                  areaStyle: {\n                    color: {\n                      type: 'linear',\n                      x: 0,\n                      y: 0,\n                      x2: 0,\n                      y2: 1,\n                      colorStops: [\n                        { offset: 0, color: 'rgba(79,195,255,0.18)' },\n                        { offset: 1, color: 'rgba(79,195,255,0)' },\n                      ],\n                    },\n                  },\n                  data: scopeData.series[1],\n                },\n              ],\n            }}\n            style={{ height: 400, width: '100%' }}\n          />\n        </div>\n      </Spin>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/dashboard/components/Stats/components/VisitorsStatisChat/type.d.ts",
    "content": "export interface StatisResult {\n  timeSpan: string[];\n  fields: string[];\n  items: [\n      string[][],\n      (string | number)[][],\n      unknown[],\n      unknown[]\n  ];\n}\n\nexport interface StatisResponse {\n  result: StatisResult;\n}\n\nexport interface EChartsParams {\n  axisValue: string;\n  seriesName: string;\n  data: number;\n}\n\nexport interface Result {\n  timeSpan: string[];\n  fields: string[];\n  items: [\n      string[][],\n      (string | number)[][],\n      unknown[],\n      unknown[]\n  ];\n}"
  },
  {
    "path": "src/pages/dashboard/components/Stats/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { Spin } from 'antd';\nimport VisitorsStatisChat from './components/VisitorsStatisChat';\nimport NewOldVisitors from './components/NewOldVisitors';\nimport CardDataStats from '@/components/CardDataStats';\n\nimport { AiOutlineEye, AiOutlineMeh, AiOutlineStock, AiOutlineFieldTime } from 'react-icons/ai';\nimport dayjs from 'dayjs';\nimport { getStatisAPI } from '@/api/statis';\nimport { StatisResponse } from './components/VisitorsStatisChat/type';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n\n  const [stats, setStats] = useState({\n    pv: 0,\n    ip: 0,\n    bounce: 0,\n    avgTime: '',\n  });\n\n  const date = dayjs(new Date()).format('YYYY/MM/DD');\n\n  const formatTime = (seconds: number) => {\n    // 四舍五入到最接近的整数\n    const roundedSeconds = Math.round(seconds);\n\n    const h = Math.floor(roundedSeconds / 3600)\n      .toString()\n      .padStart(2, '0');\n    const m = Math.floor((roundedSeconds % 3600) / 60)\n      .toString()\n      .padStart(2, '0');\n    const s = (roundedSeconds % 60).toString().padStart(2, '0');\n    return `${h}:${m}:${s}`;\n  };\n\n  // 获取统计数据\n  const getDataList = async () => {\n    try {\n      setLoading(true);\n\n      const { data } = await getStatisAPI('overview', date, date);\n      if (!data) return setLoading(false);\n      const { result } = data as StatisResponse;\n\n      let pv = 0;\n      let ip = 0;\n      let bounce = 0;\n      let avgTime = 0;\n      let count = 0;\n\n      result.items[1].forEach((item: (string | number)[]) => {\n        if (!Number(item[0])) return;\n\n        // 检查并累加 pv\n        if (!isNaN(Number(item[0]))) {\n          pv += Number(item[0]);\n        }\n\n        // 检查并累加 ip\n        if (!isNaN(Number(item[1]))) {\n          ip += Number(item[1]);\n        }\n\n        // 检查并累加 bounce\n        if (!isNaN(Number(item[2]))) {\n          bounce += Number(item[2]);\n        }\n\n        // 检查并累加 avgTime\n        if (!isNaN(Number(item[3]))) {\n          avgTime += Number(item[3]);\n        }\n\n        // 只有第三个和第四个数据都有值时才增加 count\n        if (!isNaN(Number(item[2])) && !isNaN(Number(item[3]))) {\n          count++;\n        }\n      });\n\n      setStats({\n        pv,\n        ip,\n        bounce: count !== 0 ? bounce / count : 0,\n        avgTime: count !== 0 ? formatTime(avgTime / count) : '00:00:00',\n      });\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getDataList();\n  }, []);\n\n  return (\n    <Spin spinning={loading}>\n      {/* 基本数据 */}\n      <div className=\"mt-2 grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-4\">\n        <CardDataStats title=\"今日浏览量\" total={stats.pv + ''}>\n          <AiOutlineEye className=\"fill-primary dark:fill-white text-2xl\" />\n        </CardDataStats>\n\n        <CardDataStats title=\"今日访客\" total={stats.ip + ''}>\n          <AiOutlineMeh className=\"fill-primary dark:fill-white text-2xl\" />\n        </CardDataStats>\n\n        <CardDataStats title=\"跳出率\" total={stats.bounce.toFixed(2) + '%'}>\n          <AiOutlineStock className=\"fill-primary dark:fill-white text-2xl\" />\n        </CardDataStats>\n\n        <CardDataStats title=\"平均访问时长\" total={stats.avgTime || '00:00:00'}>\n          <AiOutlineFieldTime className=\"fill-primary dark:fill-white text-2xl\" />\n        </CardDataStats>\n      </div>\n\n      <div className=\"rounded-lg mt-2 grid grid-cols-12 gap-2\">\n        <VisitorsStatisChat />\n        <NewOldVisitors />\n      </div>\n    </Spin>\n  );\n};\n"
  },
  {
    "path": "src/pages/dashboard/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Skeleton, Card } from 'antd';\nimport InfoCard from './components/Info';\nimport Stats from './components/Stats';\nimport SystemNotification, { shouldShowLoginNotification } from '@/components/SystemNotification';\n\nexport default () => {\n  const [showNotification, setShowNotification] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  useEffect(() => {\n    // 检查是否需要显示登录通知\n    if (shouldShowLoginNotification()) {\n      setShowNotification(true);\n    }\n\n    // 模拟初始加载，等待子组件加载完成\n    if (isFirstLoadRef.current) {\n      const timer = setTimeout(() => {\n        setInitialLoading(false);\n        isFirstLoadRef.current = false;\n      }, 500);\n      return () => clearTimeout(timer);\n    }\n  }, []);\n\n  return (\n    <div>\n      {initialLoading ? (\n        <>\n          {/* InfoCard 骨架屏 */}\n          <div className=\"bg-primary rounded-md p-6 sm:p-10 flex flex-col justify-center h-[170px] relative overflow-hidden mb-4\">\n            <div className=\"relative z-10 w-full flex flex-col\">\n              <Skeleton.Input active size=\"large\" style={{ width: '500px', height: 40, marginBottom: 10, background: 'rgba(255,255,255,0.3)' }} />\n              <Skeleton.Input active size=\"large\" style={{ width: '300px', height: 30, marginBottom: 10, background: 'rgba(255,255,255,0.3)' }} />\n              <Skeleton.Input active size=\"large\" style={{ width: '100px', height: 20, marginBottom: 10, background: 'rgba(255,255,255,0.3)' }} />\n            </div>\n          </div>\n\n          {/* 统计卡片骨架屏 */}\n          <div className=\"mt-2 grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-4\">\n            {[1, 2, 3, 4].map((item) => (\n              <Card key={item} className=\"border-stroke [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex-1\">\n                    <Skeleton.Input active size=\"small\" style={{ width: 100, height: 20, marginBottom: 8 }} />\n                    <Skeleton.Input active size=\"large\" style={{ width: 80, height: 32 }} />\n                  </div>\n                  <Skeleton.Avatar active size={40} shape=\"square\" />\n                </div>\n              </Card>\n            ))}\n          </div>\n\n          {/* 图表骨架屏 */}\n          <div className=\"rounded-lg mt-2 grid grid-cols-12 gap-2\">\n            {/* 访客统计图表 */}\n            <Card className=\"col-span-12 xl:col-span-8 border-stroke [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n              <Skeleton.Input active size=\"default\" style={{ width: 150, height: 24, marginBottom: 16 }} />\n              <Skeleton active paragraph={{ rows: 10 }} />\n            </Card>\n\n            {/* 新老访客图表 */}\n            <Card className=\"col-span-12 xl:col-span-4 border-stroke [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n              <Skeleton.Input active size=\"default\" style={{ width: 120, height: 24, marginBottom: 16 }} />\n              <Skeleton active paragraph={{ rows: 10 }} />\n            </Card>\n          </div>\n        </>\n      ) : (\n        <>\n          <InfoCard />\n          <Stats />\n        </>\n      )}\n\n      <SystemNotification open={showNotification} onClose={() => setShowNotification(false)} />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/decycle/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Table, Button, Tag, notification, Popconfirm, Form, Tooltip, Popover, Space, Divider } from 'antd';\nimport { DeleteOutlined, UndoOutlined, EyeOutlined, CommentOutlined } from '@ant-design/icons';\nimport dayjs from 'dayjs';\n\nimport Title from '@/components/Title';\nimport { delArticleDataAPI, getArticlePagingAPI, reductionArticleDataAPI } from '@/api/article';\nimport { useWebStore } from '@/stores';\nimport type { Tag as ArticleTag } from '@/types/app/tag';\nimport type { Cate } from '@/types/app/cate';\nimport type { Article } from '@/types/app/article';\nimport { ColumnType } from 'antd/es/table';\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const navigate = useNavigate();\n  const web = useWebStore((state) => state.web);\n\n  const [current, setCurrent] = useState<number>(1);\n  const [articleList, setArticleList] = useState<Article[]>([]);\n\n  const [form] = Form.useForm();\n\n  const getArticleList = async () => {\n    try {\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n      const { data } = await getArticlePagingAPI({ isDel: 1, page: 1, size: 8 });\n      setArticleList(data.result);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getArticleList();\n  }, []);\n\n  const delArticleData = async (id: number) => {\n    try {\n      setLoading(true);\n      await delArticleDataAPI(id);\n      await getArticlePagingAPI({ page: 1, size: 8 });\n      form.resetFields();\n      setCurrent(1);\n      notification.success({ message: '🎉 删除文章成功' });\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const reductionArticleData = async (id: number) => {\n    try {\n      setLoading(true);\n      await reductionArticleDataAPI(id);\n      notification.success({ message: '🎉 恢复文章成功' });\n      navigate('/article');\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // 分类/标签：与文章管理一致，柔和色系 + 收纳展示\n  const tagColors = ['default', 'processing', 'success', 'warning', 'cyan'] as const;\n  const VISIBLE_TAG_COUNT = 1;\n\n  const renderCollapsibleTags = <T extends { id?: number; name: string }>(list: T[], keyPrefix: string) => {\n    const items = list || [];\n    if (items.length === 0) return null;\n    const visible = items.slice(0, VISIBLE_TAG_COUNT);\n    const restCount = items.length - VISIBLE_TAG_COUNT;\n    const tagList = (\n      <div className=\"flex flex-wrap gap-1.5 max-w-[280px]\">\n        {items.map((item, index) => (\n          <Tag key={item.id ?? index} color={tagColors[index % tagColors.length]} className=\"m-0! border-0!\">\n            {item.name}\n          </Tag>\n        ))}\n      </div>\n    );\n    return (\n      <div className=\"flex flex-wrap items-center gap-1.5 justify-start\">\n        {visible.map((item, index) => (\n          <Tag key={`${keyPrefix}-${item.id ?? index}`} color={tagColors[index % tagColors.length]} className=\"m-0! border-0!\">\n            {item.name}\n          </Tag>\n        ))}\n        {restCount > 0 && (\n          <Popover content={tagList} trigger=\"hover\" placement=\"topLeft\" overlayClassName=\"article-tags-popover\">\n            <span\n              className=\"inline-flex items-center justify-center min-w-[28px] h-6 px-1.5 rounded-md text-xs font-medium cursor-default 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\"\n              role=\"button\"\n              tabIndex={0}\n            >\n              +{restCount}\n            </span>\n          </Popover>\n        )}\n      </div>\n    );\n  };\n\n  const columns: ColumnType<Article>[] = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      align: 'center',\n      width: 80,\n      render: (text: number) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '标题',\n      dataIndex: 'title',\n      key: 'title',\n      width: 280,\n      render: (text: string, record: Article) => (\n        <a href={`${web.url}/article/${record.id}`} target=\"_blank\" className=\"hover:text-primary! line-clamp-1 text-gray-700! dark:text-gray-200! font-medium\" rel=\"noreferrer\">\n          {text || <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无标题</span>}\n        </a>\n      ),\n    },\n    {\n      title: '摘要',\n      dataIndex: 'description',\n      key: 'description',\n      width: 320,\n      render: (text: string) => (\n        <div className=\"line-clamp-2 text-gray-600 dark:text-gray-300\">{text || <span className=\"text-gray-400 dark:text-gray-500 italic\">该文章暂未设置文章摘要</span>}</div>\n      ),\n    },\n    {\n      title: '分类',\n      dataIndex: 'cateList',\n      key: 'cateList',\n      width: 140,\n      render: (cates: Cate[] = []) => renderCollapsibleTags(cates, 'cate'),\n    },\n    {\n      title: '标签',\n      dataIndex: 'tagList',\n      key: 'tagList',\n      width: 160,\n      render: (tags: ArticleTag[] = []) => (\n        <div>\n          {\n            tags.length > 0 ? (\n              renderCollapsibleTags(tags, 'tag')\n            ) : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无标签</span>\n            )\n          }\n        </div>\n      ),\n    },\n    {\n      title: '浏览量',\n      dataIndex: 'view',\n      key: 'view',\n      width: 100,\n      align: 'center',\n      render: (v: number) => (\n        <span className=\"inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums\">\n          <EyeOutlined className=\"text-gray-400 dark:text-gray-500 text-xs\" />\n          <span className=\"font-medium\">{v ?? 0}</span>\n        </span>\n      ),\n      sorter: (a: Article, b: Article) => (a.view ?? 0) - (b.view ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '评论',\n      dataIndex: 'comment',\n      key: 'comment',\n      width: 90,\n      align: 'center',\n      render: (v: number) => (\n        <span className=\"inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums\">\n          <CommentOutlined className=\"text-gray-400 dark:text-gray-500 text-xs\" />\n          <span className=\"font-medium\">{v ?? 0}</span>\n        </span>\n      ),\n      sorter: (a: Article, b: Article) => (a.comment ?? 0) - (b.comment ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '发布时间',\n      dataIndex: 'createTime',\n      key: 'createTime',\n      width: 180,\n      align: 'left',\n      render: (text: string) => {\n        const d = dayjs(+text);\n        return (\n          <div className=\"flex flex-col gap-0.5\">\n            <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{d.format('YYYY-MM-DD')}</span>\n            <span className=\"text-sm text-gray-500 dark:text-gray-400\">{d.format('HH:mm:ss')}</span>\n          </div>\n        );\n      },\n      sorter: (a: Article, b: Article) => +a.createTime! - +b.createTime!,\n      showSorterTooltip: false,\n    },\n    {\n      title: '操作',\n      key: 'action',\n      fixed: 'right',\n      align: 'center',\n      width: 130,\n      render: (_: string, record: Article) => (\n        <Space split={<Divider type=\"vertical\" />}>\n          <Popconfirm title=\"警告\" description=\"点击恢复文章\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => reductionArticleData(record.id!)}>\n            <Tooltip title=\"恢复\">\n              <Button type=\"text\" icon={<UndoOutlined className=\"text-green-500\" />} />\n            </Tooltip>\n          </Popconfirm>\n\n          <Popconfirm title=\"警告\" description=\"点击彻底删除文章且无法恢复\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delArticleData(record.id!)}>\n            <Tooltip title=\"彻底删除\">\n              <Button type=\"text\" danger icon={<DeleteOutlined />} />\n            </Tooltip>\n          </Popconfirm>\n        </Space>\n      ),\n    },\n  ];\n\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"回收站\" />\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <Table\n          rowKey=\"id\"\n          dataSource={articleList}\n          columns={columns}\n          loading={loading}\n          scroll={{ x: 1400 }}\n          pagination={{\n            position: ['bottomRight'],\n            current,\n            pageSize: 8,\n            total: articleList.length,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                共 {totalCount} 条数据\n              </div>\n            ),\n            onChange: (page) => setCurrent(page),\n            className: 'px-6! py-4!',\n          }}\n          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!\"\n        />\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/draft/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Table, Button, Tag, notification, Popconfirm, Form, Tooltip, Popover, Space, Divider } from 'antd';\nimport { Link } from 'react-router-dom';\nimport { DeleteOutlined, FormOutlined, EyeOutlined, CommentOutlined } from '@ant-design/icons';\nimport dayjs from 'dayjs';\n\nimport Title from '@/components/Title';\nimport { delArticleDataAPI, getArticlePagingAPI } from '@/api/article';\nimport { useWebStore } from '@/stores';\nimport type { Tag as ArticleTag } from '@/types/app/tag';\nimport type { Cate } from '@/types/app/cate';\nimport type { Article } from '@/types/app/article';\nimport { ColumnsType } from 'antd/es/table';\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const web = useWebStore((state) => state.web);\n\n  const [current, setCurrent] = useState<number>(1);\n  const [articleList, setArticleList] = useState<Article[]>([]);\n\n  const [form] = Form.useForm();\n\n  const getArticleList = async () => {\n    try {\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n      const { data } = await getArticlePagingAPI({ isDraft: 1, page: 1, size: 8 });\n      setArticleList(data.result);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getArticleList();\n  }, []);\n\n  const delArticleData = async (id: number) => {\n    try {\n      setLoading(true);\n      await delArticleDataAPI(id);\n      await getArticlePagingAPI({ page: 1, size: 8 });\n      form.resetFields();\n      setCurrent(1);\n      notification.success({ message: '🎉 删除文章成功' });\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // 分类/标签：与文章管理一致，柔和色系 + 收纳展示（默认显示前 1 个，其余 +N，悬停展示全部）\n  const tagColors = ['default', 'processing', 'success', 'warning', 'cyan'] as const;\n  const VISIBLE_TAG_COUNT = 1;\n\n  const renderCollapsibleTags = <T extends { id?: number; name: string }>(list: T[], keyPrefix: string) => {\n    const items = list || [];\n    if (items.length === 0) return null;\n    const visible = items.slice(0, VISIBLE_TAG_COUNT);\n    const restCount = items.length - VISIBLE_TAG_COUNT;\n    const tagList = (\n      <div className=\"flex flex-wrap gap-1.5 max-w-[280px]\">\n        {items.map((item, index) => (\n          <Tag key={item.id ?? index} color={tagColors[index % tagColors.length]} className=\"m-0! border-0!\">\n            {item.name}\n          </Tag>\n        ))}\n      </div>\n    );\n    return (\n      <div className=\"flex flex-wrap items-center gap-1.5 justify-start\">\n        {visible.map((item, index) => (\n          <Tag key={`${keyPrefix}-${item.id ?? index}`} color={tagColors[index % tagColors.length]} className=\"m-0! border-0!\">\n            {item.name}\n          </Tag>\n        ))}\n        {restCount > 0 && (\n          <Popover content={tagList} trigger=\"hover\" placement=\"topLeft\" overlayClassName=\"article-tags-popover\">\n            <span\n              className=\"inline-flex items-center justify-center min-w-[28px] h-6 px-1.5 rounded-md text-xs font-medium cursor-default 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\"\n              role=\"button\"\n              tabIndex={0}\n            >\n              +{restCount}\n            </span>\n          </Popover>\n        )}\n      </div>\n    );\n  };\n\n  const columns: ColumnsType<Article> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      align: 'center',\n      width: 80,\n      render: (text: number) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '标题',\n      dataIndex: 'title',\n      key: 'title',\n      width: 280,\n      render: (text: string, record: Article) => (\n        <a href={`${web.url}/article/${record.id}`} target=\"_blank\" className=\"hover:text-primary! line-clamp-1 text-gray-700! dark:text-gray-200! font-medium\" rel=\"noreferrer\">\n          {text || <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无标题</span>}\n        </a>\n      ),\n    },\n    {\n      title: '摘要',\n      dataIndex: 'description',\n      key: 'description',\n      width: 320,\n      render: (text: string) => (\n        <div className=\"line-clamp-2 text-gray-600 dark:text-gray-300\">{text || <span className=\"text-gray-400 dark:text-gray-500 italic\">该文章暂未设置文章摘要</span>}</div>\n      ),\n    },\n    {\n      title: '分类',\n      dataIndex: 'cateList',\n      key: 'cateList',\n      width: 140,\n      render: (cates: Cate[] = []) => renderCollapsibleTags(cates, 'cate'),\n    },\n    {\n      title: '标签',\n      dataIndex: 'tagList',\n      key: 'tagList',\n      width: 160,\n      render: (tags: ArticleTag[] = []) => (\n        <div>\n          {\n            tags.length > 0 ? (\n              renderCollapsibleTags(tags, 'tag')\n            ) : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无标签</span>\n            )\n          }\n        </div>\n      ),\n    },\n    {\n      title: '浏览量',\n      dataIndex: 'view',\n      key: 'view',\n      width: 100,\n      align: 'center',\n      render: (v: number) => (\n        <span className=\"inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums\">\n          <EyeOutlined className=\"text-gray-400 dark:text-gray-500 text-xs\" />\n          <span className=\"font-medium\">{v ?? 0}</span>\n        </span>\n      ),\n      sorter: (a: Article, b: Article) => (a.view ?? 0) - (b.view ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '评论',\n      dataIndex: 'comment',\n      key: 'comment',\n      width: 90,\n      align: 'center',\n      render: (v: number) => (\n        <span className=\"inline-flex items-center justify-center gap-1.5 text-gray-600 dark:text-gray-300 tabular-nums\">\n          <CommentOutlined className=\"text-gray-400 dark:text-gray-500 text-xs\" />\n          <span className=\"font-medium\">{v ?? 0}</span>\n        </span>\n      ),\n      sorter: (a: Article, b: Article) => (a.comment ?? 0) - (b.comment ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '创建时间',\n      dataIndex: 'createTime',\n      key: 'createTime',\n      width: 180,\n      align: 'left',\n      render: (text: string) => {\n        if (!text) return <span className=\"text-gray-400 dark:text-gray-500\">-</span>;\n        const d = dayjs(+text);\n        return (\n          <div className=\"flex flex-col gap-0.5\">\n            <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{d.format('YYYY-MM-DD')}</span>\n            <span className=\"text-sm text-gray-500 dark:text-gray-400\">{d.format('HH:mm:ss')}</span>\n          </div>\n        );\n      },\n      sorter: (a: Article, b: Article) => +(a.createTime ?? 0) - +(b.createTime ?? 0),\n      showSorterTooltip: false,\n    },\n    {\n      title: '操作',\n      key: 'action',\n      fixed: 'right',\n      align: 'center',\n      width: 130,\n      render: (_: string, record: Article) => (\n        <Space split={<Divider type=\"vertical\" />}>\n          <Tooltip title=\"编辑\">\n            <Link to={`/create?id=${record.id}&draft=true`}>\n              <Button type=\"text\" icon={<FormOutlined className=\"text-primary\" />} />\n            </Link>\n          </Tooltip>\n          <Popconfirm title=\"警告\" description=\"你确定要删除吗\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delArticleData(record.id!)}>\n            <Tooltip title=\"删除\">\n              <Button type=\"text\" danger icon={<DeleteOutlined />} />\n            </Tooltip>\n          </Popconfirm>\n        </Space>\n      ),\n    },\n  ];\n\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"草稿箱\" />\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <Table\n          rowKey=\"id\"\n          dataSource={articleList}\n          columns={columns}\n          loading={loading}\n          scroll={{ x: 1400 }}\n          pagination={{\n            position: ['bottomRight'],\n            current,\n            pageSize: 8,\n            total: articleList.length,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                共 {totalCount} 条数据\n              </div>\n            ),\n            onChange: (page) => setCurrent(page),\n            className: 'px-6! py-4!',\n          }}\n          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!\"\n        />\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/file/index.scss",
    "content": ".FilePage {\n    .ant-image {\n        display: block;\n        width: 100%;\n\n        .ant-image-img {\n            width: 100%;\n            height: auto;\n            display: block;\n        }\n    }\n}\n\n// 自定义图片预览样式\n.customAntdPreviewsItem {\n    overflow: hidden;\n    background: #fff;\n    border-radius: 10px;\n\n    .anticon {\n        font-size: 20px;\n        color: #5d5d5d;\n        padding: 10px;\n\n        &:hover {\n            color: #60a5fa;\n        }\n    }\n}"
  },
  {
    "path": "src/pages/file/index.tsx",
    "content": "import { useEffect, useState, useRef } from 'react';\nimport { Image, Card, Space, Spin, message, Popconfirm, Button, Drawer, Divider, Skeleton } from 'antd';\nimport { PiKeyReturnFill } from 'react-icons/pi';\nimport { DeleteOutlined, DownloadOutlined, RotateLeftOutlined, RotateRightOutlined, SwapOutlined, UndoOutlined, ZoomInOutlined, ZoomOutOutlined } from '@ant-design/icons';\nimport Masonry from 'react-masonry-css';\n\nimport Title from '@/components/Title';\nimport FileUpload from '@/components/FileUpload';\nimport { delFileDataAPI, getDirListAPI, getFileListAPI } from '@/api/file';\nimport { File, FileDir } from '@/types/app/file';\nimport fileSvg from './image/file.svg';\nimport errorImg from './image/error.png';\nimport './index.scss';\n\n// Masonry布局的响应式断点配置\nconst breakpointColumnsObj = {\n  default: 4,\n  1100: 3,\n  700: 2,\n  500: 1,\n};\n\nexport default () => {\n  // 加载状态\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n  // 按钮加载状态\n  const [btnLoading, setBtnLoading] = useState(false);\n  // 下载加载状态\n  const [downloadLoading, setDownloadLoading] = useState(false);\n  // 当前页码\n  const [page, setPage] = useState(1);\n  // 是否还有更多数据\n  const [hasMore, setHasMore] = useState(true);\n  // 防止重复加载的引用\n  const loadingRef = useRef(false);\n\n  // 弹窗状态\n  const [openUploadModalOpen, setOpenUploadModalOpen] = useState(false);\n  const [openFileInfoDrawer, setOpenFileInfoDrawer] = useState(false);\n  const [openFilePreviewDrawer, setOpenFilePreviewDrawer] = useState(false);\n\n  // 目录和文件列表数据\n  const [dirList, setDirList] = useState<FileDir[]>([]);\n  const [fileList, setFileList] = useState<File[]>([]);\n\n  // 当前选中的目录和文件\n  const [dirName, setDirName] = useState('');\n  const [file, setFile] = useState<File>({} as File);\n\n  /**\n   * 获取目录列表\n   */\n  const getDirList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getDirListAPI();\n\n      const dirList = ['default', 'equipment', 'record', 'article', 'footprint', 'swiper', 'album'];\n      dirList.forEach((dir) => {\n        if (!data.some((item: FileDir) => item.name === dir)) {\n          data.push({ name: dir, path: '' });\n        }\n      });\n\n      setDirList(data);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  /**\n   * 获取指定目录的文件列表\n   * @param dir 目录名称\n   * @param isLoadMore 是否为加载更多\n   */\n  const getFileList = async (dir: string, isLoadMore = false) => {\n    // 防止重复加载\n    if (loadingRef.current) return;\n    try {\n      loadingRef.current = true;\n      setLoading(true);\n\n      // 请求文件列表数据，如果是加载更多则页码+1\n      const { data } = await getFileListAPI(dir, { page: isLoadMore ? page + 1 : 1, size: 15 });\n\n      // 根据是否是加载更多来决定是替换还是追加数据\n      if (!isLoadMore) {\n        setFileList(data.result);\n        setPage(1);\n      } else {\n        setFileList((prev) => [...prev, ...data.result]);\n        setPage((prev) => prev + 1);\n      }\n\n      // 判断是否还有更多数据\n      setHasMore(data.result.length === 15);\n\n      setLoading(false);\n      loadingRef.current = false;\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n      loadingRef.current = false;\n    }\n  };\n\n  /**\n   * 删除图片\n   * @param data 要删除的文件数据\n   */\n  const onDeleteImage = async (data: File) => {\n    try {\n      setBtnLoading(true);\n      await delFileDataAPI(data.url);\n      await getFileList(dirName);\n      message.success('🎉 删除图片成功');\n      setFile({} as File);\n      setOpenFileInfoDrawer(false);\n      setOpenFilePreviewDrawer(false);\n      setBtnLoading(false);\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n  };\n\n  /**\n   * 下载图片\n   * @param data 要下载的文件数据\n   */\n  const onDownloadImage = (data: File) => {\n    try {\n      setDownloadLoading(true);\n      fetch(data.url)\n        .then((response) => response.blob())\n        .then((blob) => {\n          const url = URL.createObjectURL(new Blob([blob]));\n          const link = document.createElement<'a'>('a');\n          link.href = url;\n          link.download = data.name;\n          document.body.appendChild(link);\n          link.click();\n          URL.revokeObjectURL(url);\n          link.remove();\n        });\n      setDownloadLoading(false);\n    } catch (error) {\n      console.error(error);\n      setDownloadLoading(false);\n    }\n  };\n\n  /**\n   * 处理滚动事件，实现下拉加载更多\n   * @param e 滚动事件对象\n   */\n  const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {\n    const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;\n    // 当滚动到底部（距离底部小于50px）且还有更多数据时，触发加载更多\n    if (scrollHeight - scrollTop - clientHeight < 50 && hasMore && !loading) {\n      getFileList(dirName, true);\n    }\n  };\n\n  /**\n   * 打开目录\n   * @param dir 目录名称\n   */\n  const openDir = (dir: string) => {\n    setDirName(dir);\n    getFileList(dir);\n  };\n\n  // 组件挂载时获取目录列表\n  useEffect(() => {\n    getDirList();\n  }, []);\n\n  /**\n   * 查看文件信息\n   * @param record 文件数据\n   */\n  const viewOpenFileInfo = (record: File) => {\n    setOpenFileInfoDrawer(true);\n    setFile(record);\n  };\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2\">\n          <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n        </Card>\n\n        <Card className=\"FilePage border-stroke mt-2 min-h-[calc(100vh-160px)] [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n          {/* 操作栏骨架屏 */}\n          <div className=\"flex justify-between my-4 px-4\">\n            <Skeleton.Button active size=\"default\" style={{ width: 100, height: 32 }} />\n          </div>\n\n          {/* 目录/文件列表骨架屏 */}\n          <div className=\"flex flex-wrap justify-start md:justify-normal\">\n            {[1, 2, 3, 4, 5, 6, 7, 8].map((item) => (\n              <div key={item} className=\"w-20 flex flex-col items-center mx-8 my-2\">\n                <Skeleton.Avatar active size={80} shape=\"square\" />\n                <Skeleton.Input active size=\"small\" style={{ width: 50, height: 25, marginTop: 8 }} />\n              </div>\n            ))}\n          </div>\n        </Card>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"文件管理\" />\n\n      <Card className=\"FilePage border-stroke mt-2 min-h-[calc(100vh-160px)]\">\n        <div className=\"flex justify-between mb-4 px-4\">\n          {!fileList.length && !dirName ? (\n            <PiKeyReturnFill className=\"text-4xl text-[#E0DFDF] cursor-pointer\" />\n          ) : (\n            <PiKeyReturnFill\n              className=\"text-4xl text-primary cursor-pointer\"\n              onClick={() => {\n                setFileList([]);\n                setDirName('');\n              }}\n            />\n          )}\n\n          {dirName && (\n            <Button type=\"primary\" onClick={() => setOpenUploadModalOpen(true)}>\n              上传文件\n            </Button>\n          )}\n        </div>\n\n        {/* 文件列表 */}\n        <Spin spinning={loading}>\n          <div className={`flex flex-wrap ${dirName ? 'justify-center!' : 'justify-start!'} md:justify-normal overflow-y-auto max-h-[calc(100vh-300px)]`} onScroll={handleScroll}>\n            {fileList.length || (!fileList.length && dirName) ? (\n              <Masonry breakpointCols={breakpointColumnsObj} className=\"masonry-grid\" columnClassName=\"masonry-grid_column\">\n                {fileList.map((item, index) => (\n                  <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 ${file.url === item.url ? 'border-primary' : 'border-gray-100'}`} onClick={() => viewOpenFileInfo(item)}>\n                    <Image src={item.url} className=\"w-full rounded-md\" loading=\"lazy\" preview={false} fallback={errorImg} />\n                  </div>\n                ))}\n              </Masonry>\n            ) : (\n              dirList.map((item, index) => (\n                <div key={index} className=\"group w-20 flex flex-col items-center cursor-pointer mx-4 my-2\" onClick={() => openDir(item.name)}>\n                  <img src={fileSvg} alt=\"\" />\n                  <p className=\"group-hover:text-primary transition-colors\">{item.name}</p>\n                </div>\n              ))\n            )}\n          </div>\n        </Spin>\n      </Card>\n\n      {/* 文件上传弹窗 */}\n      <FileUpload multiple dir={dirName} open={openUploadModalOpen} onSuccess={() => getFileList(dirName)} onCancel={() => setOpenUploadModalOpen(false)} />\n\n      {/* 文件信息抽屉 */}\n      <Drawer\n        width={600}\n        title=\"图片信息\"\n        placement=\"right\"\n        open={openFileInfoDrawer}\n        onClose={() => {\n          setOpenFileInfoDrawer(false);\n          setFile({} as File);\n        }}\n      >\n        <div className=\"flex flex-col\">\n          <div className=\"flex\">\n            <span className=\"min-w-20 font-bold\">文件名称</span>\n            <span className=\"text-[#333] dark:text-white\">{file.name}</span>\n          </div>\n\n          <div className=\"flex\">\n            <span className=\"min-w-20 font-bold\">文件类型</span>\n            <span className=\"text-[#333] dark:text-white\">{file.type}</span>\n          </div>\n\n          <div className=\"flex\">\n            <span className=\"min-w-20 font-bold\">文件大小</span>\n            <span className=\"text-[#333] dark:text-white\">{(file.size / 1048576).toFixed(2)}MB</span>\n          </div>\n\n          <div className=\"flex\">\n            <span className=\"min-w-20  font-bold\">文件链接</span>\n            <span\n              className=\"text-[#333] dark:text-white hover:text-primary cursor-pointer transition\"\n              onClick={async () => {\n                await navigator.clipboard.writeText(file.url);\n                message.success('🎉 复制成功');\n              }}\n            >\n              {file.url}\n            </span>\n          </div>\n        </div>\n\n        <Divider orientation=\"center\">图片预览</Divider>\n        <Image\n          src={file.url}\n          className=\"rounded-md object-cover object-center\"\n          fallback={errorImg}\n          preview={{\n            onVisibleChange: (visible) => setOpenFilePreviewDrawer(visible),\n            visible: openFilePreviewDrawer,\n            toolbarRender: (_, { transform: { scale }, actions: { onFlipY, onFlipX, onRotateLeft, onRotateRight, onZoomOut, onZoomIn, onReset } }) => (\n              <Space className=\"toolbar-wrapper flex-col\">\n                <div className=\"customAntdPreviewsItem\">\n                  <Popconfirm title=\"警告\" description=\"删除后无法恢复，确定要删除吗\" onConfirm={() => onDeleteImage(file)} okText=\"删除\" cancelText=\"取消\">\n                    <DeleteOutlined />\n                  </Popconfirm>\n\n                  <DownloadOutlined onClick={() => onDownloadImage(file)} />\n                  <SwapOutlined rotate={90} onClick={onFlipY} />\n                  <SwapOutlined onClick={onFlipX} />\n                  <RotateLeftOutlined onClick={onRotateLeft} />\n                  <RotateRightOutlined onClick={onRotateRight} />\n                  <ZoomOutOutlined disabled={scale === 1} onClick={onZoomOut} />\n                  <ZoomInOutlined disabled={scale === 50} onClick={onZoomIn} />\n                  <UndoOutlined onClick={onReset} />\n                </div>\n              </Space>\n            ),\n          }}\n        />\n\n        <Divider orientation=\"center\">图片操作</Divider>\n        <Button type=\"primary\" loading={downloadLoading} onClick={() => onDownloadImage(file)} className=\"w-full mb-2\">\n          下载图片\n        </Button>\n        <Popconfirm title=\"警告\" description=\"删除后无法恢复，确定要删除吗\" onConfirm={() => onDeleteImage(file)} okText=\"删除\" cancelText=\"取消\">\n          <Button type=\"primary\" danger loading={btnLoading} className=\"w-full\">\n            删除图片\n          </Button>\n        </Popconfirm>\n      </Drawer>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/footprint/index.tsx",
    "content": "import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Button, DatePicker, Divider, Form, Input, message, Modal, notification, Popconfirm, Space, Spin, Table, Tag, Tooltip } from 'antd';\nimport type { ColumnType } from 'antd/es/table';\nimport axios from 'axios';\nimport dayjs from 'dayjs';\nimport type { Dayjs } from 'dayjs';\nimport { ClearOutlined, CloudUploadOutlined, DeleteOutlined, FormOutlined, SearchOutlined } from '@ant-design/icons';\nimport { GiPositionMarker } from 'react-icons/gi';\nimport { IoSearch } from 'react-icons/io5';\n\nimport { addFootprintDataAPI, delFootprintDataAPI, editFootprintDataAPI, getFootprintDataAPI, getFootprintListAPI } from '@/api/footprint';\nimport { getEnvConfigDataAPI } from '@/api/config';\nimport Material from '@/components/Material';\nimport Title from '@/components/Title';\nimport type { FilterForm, Footprint } from '@/types/app/footprint';\n\ntype ListQuery = { key?: string; startDate?: string; endDate?: string };\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState(true);\n  const [btnLoading, setBtnLoading] = useState(false);\n  const [searchLoading, setSearchLoading] = useState(false);\n  const [detailLoading, setDetailLoading] = useState(false);\n  const isFirstLoadRef = useRef(true);\n  const detailRequestSeqRef = useRef(0);\n\n  const [gaodeApKey, setGaodeApKey] = useState('');\n  const [footprintList, setFootprintList] = useState<Footprint[]>([]);\n\n  const [isModelOpen, setIsModelOpen] = useState(false);\n  const [modalMode, setModalMode] = useState<'create' | 'edit'>('create');\n  const [editingId, setEditingId] = useState<number | null>(null);\n\n  const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);\n  const [listQuery, setListQuery] = useState<ListQuery>({});\n\n  const [form] = Form.useForm();\n  const [filterForm] = Form.useForm();\n\n  const { RangePicker } = DatePicker;\n\n  const getEnvConfigData = useCallback(async () => {\n    const { data } = await getEnvConfigDataAPI('gaode_coordinate');\n    setGaodeApKey((data.value as { key: string }).key);\n  }, []);\n\n  const getFootprintList = useCallback(\n    async (query?: ListQuery) => {\n      const finalQuery = query ?? listQuery;\n      try {\n        if (isFirstLoadRef.current) setInitialLoading(true);\n        else setLoading(true);\n\n        const { data } = await getFootprintListAPI({ query: finalQuery });\n        setFootprintList(data as Footprint[]);\n        isFirstLoadRef.current = false;\n      } catch (error) {\n        console.error(error);\n      } finally {\n        setInitialLoading(false);\n        setLoading(false);\n      }\n    },\n    [listQuery],\n  );\n\n  useEffect(() => {\n    getEnvConfigData();\n    getFootprintList({});\n  }, [getEnvConfigData, getFootprintList]);\n\n  const closeModal = useCallback(() => {\n    detailRequestSeqRef.current += 1; // 使未完成的编辑请求失效，避免回填\n    setIsModelOpen(false);\n    setModalMode('create');\n    setEditingId(null);\n    setDetailLoading(false);\n    form.resetFields();\n  }, [form]);\n\n  const openCreate = useCallback(() => {\n    detailRequestSeqRef.current += 1; // 使未完成的编辑请求失效，避免回填\n    setModalMode('create');\n    setEditingId(null);\n    setIsModelOpen(true);\n    setDetailLoading(false);\n    form.resetFields();\n  }, [form]);\n\n  const openEdit = useCallback(\n    (id: number) => {\n      setModalMode('edit');\n      setEditingId(id);\n      setIsModelOpen(true);\n      setDetailLoading(true);\n      form.resetFields(); // 先清空，避免看到旧值闪一下\n    },\n    [form],\n  );\n\n  useEffect(() => {\n    const run = async () => {\n      if (!isModelOpen || modalMode !== 'edit' || !editingId) return;\n      const reqSeq = (detailRequestSeqRef.current += 1);\n      try {\n        setDetailLoading(true);\n        const { data } = await getFootprintDataAPI(editingId);\n        if (reqSeq !== detailRequestSeqRef.current) return;\n\n        const normalized: Partial<Footprint> = {\n          ...data,\n          images: Array.isArray(data.images) ? (data.images as string[]).join('\\n') : (data.images as string),\n          createTime: data.createTime ? dayjs(+data.createTime) : undefined,\n        };\n\n        form.setFieldsValue(normalized);\n      } catch (error) {\n        console.error(error);\n      } finally {\n        if (reqSeq === detailRequestSeqRef.current) setDetailLoading(false);\n      }\n    };\n\n    run();\n  }, [editingId, form, isModelOpen, modalMode]);\n\n  const onFilterReset = useCallback(() => {\n    filterForm.resetFields();\n    setListQuery({});\n    getFootprintList({});\n  }, [filterForm, getFootprintList]);\n\n  const onFilterSubmit = useCallback(\n    async (values: FilterForm) => {\n      const query: ListQuery = {\n        key: values.address,\n        startDate: values.createTime?.[0]?.valueOf()?.toString(),\n        endDate: values.createTime?.[1]?.valueOf()?.toString(),\n      };\n      setListQuery(query);\n      await getFootprintList(query);\n    },\n    [getFootprintList],\n  );\n\n  const delFootprintData = useCallback(\n    async (id: number) => {\n      try {\n        setLoading(true);\n        await delFootprintDataAPI(id);\n        notification.success({ message: '🎉 删除足迹成功' });\n        await getFootprintList();\n      } catch (error) {\n        console.error(error);\n      } finally {\n        setLoading(false);\n      }\n    },\n    [getFootprintList],\n  );\n\n  const onSubmit = useCallback(async () => {\n    try {\n      setBtnLoading(true);\n      const values = (await form.validateFields()) as Footprint;\n\n      const payload: Footprint = {\n        ...(values as Footprint),\n        createTime: (values.createTime as Dayjs | undefined)?.valueOf?.() ?? values.createTime,\n        images: values.images ? (values.images as string).split('\\n').map((s) => s.trim()).filter(Boolean) : [],\n      };\n\n      if (modalMode === 'edit') {\n        if (!editingId) throw new Error('缺少 editingId');\n        await editFootprintDataAPI({ ...payload, id: editingId } as Footprint);\n        message.success('🎉 修改足迹成功');\n      } else {\n        await addFootprintDataAPI(payload);\n        message.success('🎉 新增足迹成功');\n      }\n\n      await getFootprintList();\n      closeModal();\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setBtnLoading(false);\n    }\n  }, [closeModal, editingId, form, getFootprintList, modalMode]);\n\n  const getGeocode = useCallback(async () => {\n    try {\n      const address = form.getFieldValue('address');\n      if (!address) {\n        message.warning('请先输入地址');\n        return;\n      }\n\n      setSearchLoading(true);\n      const { data } = await axios.get('https://restapi.amap.com/v3/geocode/geo', {\n        params: {\n          address,\n          key: gaodeApKey,\n        },\n      });\n\n      if (data?.infocode === '10001') {\n        message.error('请确保高德API密钥正确');\n        return;\n      }\n\n      if (data.geocodes.length > 0) {\n        const location = data.geocodes[0].location;\n        form.setFieldValue('position', location);\n        form.validateFields(['position']);\n        return location;\n      }\n\n      message.warning('未找到该地址的经纬度');\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setSearchLoading(false);\n    }\n  }, [form, gaodeApKey]);\n\n  const columns: ColumnType<Footprint>[] = useMemo(\n    () => [\n      {\n        title: 'ID',\n        dataIndex: 'id',\n        key: 'id',\n        align: 'center',\n        width: 80,\n        render: (text: number) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n      },\n      {\n        title: '标题',\n        dataIndex: 'title',\n        key: 'title',\n        width: 180,\n        render: (text: string) => <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{text || '-'}</span>,\n      },\n      {\n        title: '地址',\n        dataIndex: 'address',\n        key: 'address',\n        width: 220,\n        ellipsis: true,\n        render: (text: string) => (\n          <div>\n            {text ? (\n              <Tooltip title={text}>\n                <div className=\"max-w-[220px] truncate text-gray-700 dark:text-gray-200 hover:text-primary cursor-pointer\">{text}</div>\n              </Tooltip>\n            ) : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无地址</span>\n            )}\n          </div>\n        ),\n      },\n      {\n        title: '内容',\n        dataIndex: 'content',\n        key: 'content',\n        width: 320,\n        render: (value: string) => (\n          <div>\n            {value ? (\n              <Tooltip title={value}>\n                <div className=\"max-w-[320px] truncate text-gray-700 dark:text-gray-200 hover:text-primary cursor-pointer\">{value}</div>\n              </Tooltip>\n            ) : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无内容</span>\n            )}\n          </div>\n        ),\n      },\n      {\n        title: '坐标',\n        dataIndex: 'position',\n        key: 'position',\n        align: 'center',\n        width: 160,\n        render: (value: string) => <Tag className=\"m-0!\">{value || '-'}</Tag>,\n      },\n      {\n        title: '发布时间',\n        dataIndex: 'createTime',\n        key: 'createTime',\n        width: 140,\n        render: (text: string) => (\n          <div className=\"flex flex-col\">\n            <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{dayjs(+text).format('YYYY-MM-DD')}</span>\n            <span className=\"text-gray-400 dark:text-gray-500 text-xs\">{dayjs(+text).format('HH:mm:ss')}</span>\n          </div>\n        ),\n      },\n      {\n        title: '操作',\n        key: 'action',\n        fixed: 'right',\n        align: 'center',\n        width: 130,\n        render: (_: string, record: Footprint) => (\n          <Space split={<Divider type=\"vertical\" />}>\n            <Tooltip title=\"编辑\">\n              <Button type=\"text\" onClick={() => openEdit(record.id!)} icon={<FormOutlined className=\"text-primary\" />} />\n            </Tooltip>\n\n            <Tooltip title=\"删除\">\n              <Popconfirm title=\"警告\" description=\"你确定要删除吗\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delFootprintData(record.id!)}>\n                <Button type=\"text\" danger icon={<DeleteOutlined />} />\n              </Popconfirm>\n            </Tooltip>\n          </Space>\n        ),\n      },\n    ],\n    [delFootprintData, openEdit],\n  );\n\n  // 初始加载时显示骨架屏（与 article 一致）\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"flex justify-between mb-6\">\n            <div className=\"flex gap-4 flex-wrap\">\n              <div className=\"skeleton h-9\" style={{ width: 200 }} />\n              <div className=\"skeleton h-9\" style={{ width: 280 }} />\n            </div>\n            <div className=\"flex gap-2\">\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n            </div>\n          </div>\n\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"足迹管理\">\n        <Button type=\"primary\" onClick={openCreate}>\n          新增足迹\n        </Button>\n      </Title>\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <div className=\"p-5 border-b border-gray-100 dark:border-strokedark bg-gray-50/30 dark:bg-boxdark-2/50 space-y-4\">\n          <Form form={filterForm} layout=\"inline\" onFinish={onFilterSubmit} className=\"flex! flex-wrap! items-center! gap-y-2.5!\">\n            <Form.Item name=\"address\" className=\"mb-0!\">\n              <Input\n                prefix={<SearchOutlined className=\"text-gray-400 dark:text-gray-500\" />}\n                placeholder=\"搜索地址...\"\n                className=\"w-[220px]!\"\n                allowClear\n              />\n            </Form.Item>\n            <Form.Item name=\"createTime\" className=\"mb-0!\">\n              <RangePicker\n                className=\"w-[260px]!\"\n                placeholder={['开始日期', '结束日期']}\n                disabledDate={(current) => current && current > dayjs().endOf('day')}\n              />\n            </Form.Item>\n\n            <div className=\"flex gap-2\">\n              <Button type=\"primary\" htmlType=\"submit\" icon={<SearchOutlined />}>\n                查询\n              </Button>\n              <Button icon={<ClearOutlined />} onClick={onFilterReset}>\n                重置\n              </Button>\n            </div>\n          </Form>\n        </div>\n\n        <Table\n          rowKey=\"id\"\n          dataSource={footprintList}\n          columns={columns}\n          loading={loading}\n          scroll={{ x: 1200 }}\n          pagination={{\n            position: ['bottomRight'],\n            pageSize: 8,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                共 {totalCount} 条数据\n              </div>\n            ),\n            className: 'px-6! py-4!',\n          }}\n          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!\"\n        />\n      </div>\n\n      <Modal title={modalMode === 'edit' ? '编辑足迹' : '新增足迹'} open={isModelOpen} onCancel={closeModal} destroyOnClose footer={null}>\n        <Spin spinning={detailLoading || searchLoading}>\n          <Form form={form} layout=\"vertical\" size=\"large\" preserve={false} className=\"mt-6\">\n            <Form.Item label=\"标题\" name=\"title\" rules={[{ required: true, message: '标题不能为空' }]}>\n              <Input placeholder=\"请输入标题\" />\n            </Form.Item>\n\n            <Form.Item label=\"地址\" name=\"address\" rules={[{ required: true, message: '地址不能为空' }]}>\n              <Input placeholder=\"请输入地址\" />\n            </Form.Item>\n\n            <Form.Item label=\"坐标纬度\" name=\"position\" rules={[{ required: true, message: '坐标纬度不能为空' }]}>\n              <Input placeholder=\"请输入坐标纬度\" prefix={<GiPositionMarker />} addonAfter={<IoSearch onClick={getGeocode} className=\"cursor-pointer\" />} />\n            </Form.Item>\n\n            <div className=\"relative\">\n              <Form.Item label=\"图片\" name=\"images\">\n                <Input.TextArea autoSize={{ minRows: 2, maxRows: 10 }} placeholder=\"请输入图片链接\" />\n              </Form.Item>\n\n              <div onClick={() => setIsMaterialModalOpen(true)} className=\"absolute bottom-2 right-2 bg-white rounded-full border border-stroke cursor-pointer\">\n                <CloudUploadOutlined className=\"text-xl hover:text-primary transition-colors p-2\" />\n              </div>\n            </div>\n\n            <Form.Item label=\"内容\" name=\"content\">\n              <Input.TextArea autoSize={{ minRows: 5, maxRows: 10 }} placeholder=\"请输入内容\" />\n            </Form.Item>\n\n            <Form.Item label=\"时间\" name=\"createTime\" rules={[{ required: true, message: '时间不能为空' }]} className=\"mb-4!\">\n              <DatePicker showTime placeholder=\"请选择时间\" className=\"w-full\" />\n            </Form.Item>\n\n            <Form.Item className=\"mb-0! w-full\">\n              <Button type=\"primary\" onClick={onSubmit} loading={btnLoading} className=\"w-full\">\n                确定\n              </Button>\n            </Form.Item>\n          </Form>\n        </Spin>\n      </Modal>\n\n      <Material\n        multiple\n        open={isMaterialModalOpen}\n        onClose={() => setIsMaterialModalOpen(false)}\n        onSelect={(url) => {\n          form.setFieldValue('images', url.join('\\n'));\n          form.validateFields(['images']);\n        }}\n      />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/iterative/index.tsx",
    "content": "import React, { useEffect, useState, useRef } from 'react';\nimport GitHubCalendar from 'react-github-calendar';\nimport dayjs from 'dayjs';\nimport { Select } from 'antd';\nimport {\n  FiLayout,\n  FiServer,\n  FiGlobe,\n  FiCalendar,\n  FiLoader,\n} from 'react-icons/fi';\nimport { useConfigStore } from '@/stores';\n\ninterface Commit {\n  commit: {\n    author: { date: string };\n    message: string;\n  };\n}\n\ninterface TimelineItem {\n  label: string;\n  children: React.ReactNode;\n}\n\ntype TimelineCardIcon = React.ComponentType<{ size?: number; className?: string }>;\n\n// 骨架屏（与图一卡片风格一致）\nconst ProjectSkeleton = () => (\n  <div className=\"bg-slate-100 dark:bg-boxdark-2 rounded-2xl border border-slate-200/80 dark:border-strokedark shadow-sm h-full transition-colors overflow-hidden\">\n    <div className=\"flex items-center gap-3 p-4 border-b border-slate-200/60 dark:border-strokedark\">\n      <div className=\"w-10 h-10 rounded-xl bg-slate-200 dark:bg-strokedark animate-pulse shrink-0\" />\n      <div className=\"h-5 w-28 bg-slate-200 dark:bg-strokedark rounded animate-pulse\" />\n    </div>\n    <div className=\"p-4 space-y-6 bg-white/60 dark:bg-boxdark/60\">\n      {[1, 2, 3, 4].map((i) => (\n        <div key={i} className=\"flex gap-4\">\n          <div className=\"flex flex-col items-center\">\n            <div className=\"w-3 h-3 rounded-full bg-slate-200 dark:bg-strokedark animate-pulse\" />\n            <div className=\"w-0.5 flex-1 bg-slate-100 dark:bg-strokedark mt-1\" />\n          </div>\n          <div className=\"flex-1 space-y-2 pb-4\">\n            <div className=\"h-4 w-24 bg-slate-200 dark:bg-strokedark rounded animate-pulse\" />\n            <div className=\"h-4 w-full bg-slate-200 dark:bg-strokedark rounded animate-pulse\" />\n          </div>\n        </div>\n      ))}\n    </div>\n  </div>\n);\n\n// 图一风格：图标背景色与图标色\nconst CARD_STYLES = [\n  { iconBg: 'bg-blue-100 dark:bg-blue-900/30', iconColor: 'text-blue-600 dark:text-blue-400' },\n  { iconBg: 'bg-amber-100 dark:bg-amber-900/30', iconColor: 'text-amber-600 dark:text-amber-400' },\n  { iconBg: 'bg-red-100 dark:bg-red-900/30', iconColor: 'text-red-600 dark:text-red-400' },\n] as const;\n\n// 自定义时间轴（图一：圆角浅灰卡片 + 左侧彩色圆形图标 + 右侧粗体标题）\nconst ProjectTimelineCard = ({\n  title,\n  icon: Icon,\n  data,\n  colorIndex,\n}: {\n  title: string;\n  icon: TimelineCardIcon;\n  data: TimelineItem[];\n  colorIndex: 0 | 1 | 2;\n}) => {\n  const { iconBg, iconColor } = CARD_STYLES[colorIndex];\n  return (\n    <div className=\"bg-slate-100 dark:bg-boxdark-2 rounded-2xl border border-slate-200/80 dark:border-strokedark shadow-sm hover:shadow-md transition-all duration-300 flex flex-col h-full overflow-hidden group\">\n      <div className=\"bg-white dark:bg-boxdark p-4 flex items-center gap-3 border-b border-slate-200/60 dark:border-strokedark\">\n        <div className={`flex items-center justify-center w-10 h-10 rounded-xl shrink-0 ${iconBg} ${iconColor}`}>\n          <Icon size={22} className={iconColor} />\n        </div>\n        <h3 className=\"font-bold text-slate-800 dark:text-slate-100 text-base tracking-tight\">{title}</h3>\n      </div>\n\n      <div className=\"p-4 overflow-y-auto max-h-[500px] scrollbar-thin scrollbar-thumb-slate-200 dark:scrollbar-thumb-strokedark scrollbar-track-transparent bg-white/60 dark:bg-boxdark/60 rounded-b-2xl\">\n        {data.length === 0 ? (\n          <div className=\"text-center py-10 text-slate-400 dark:text-slate-500 text-sm\">暂无提交记录</div>\n        ) : (\n          <div className=\"relative pl-2\">\n            {/* 贯穿线 */}\n            <div className=\"absolute top-2 left-[6.5px] bottom-0 w-[2px] bg-slate-100 dark:bg-strokedark\" />\n\n            {data.map((item, index) => (\n              <div key={index} className=\"relative flex gap-4 mb-6 last:mb-0 group/item\">\n                {/* 装饰点 */}\n                <div className={`\n                  relative z-10 w-3.5 h-3.5 ml-[-7px] rounded-full border-2 border-white dark:border-boxdark shadow-xs mt-1.5 shrink-0\n                  ${index === 0 ? 'bg-green-500 ring-2 ring-green-100 dark:ring-green-900/50' : 'bg-slate-300 dark:bg-strokedark group-hover/item:bg-indigo-400 dark:group-hover/item:bg-indigo-500'}\n                  transition-colors duration-300\n                `} />\n\n                {/* 内容 */}\n                <div className=\"flex-1\">\n                  <time className=\"text-xs font-medium text-slate-400 dark:text-slate-500 mb-1 block font-mono\">\n                    {item.label}\n                  </time>\n                  <p className=\"text-sm text-slate-700 dark:text-slate-300 leading-relaxed break-all bg-slate-50 dark:bg-boxdark-2 p-3 rounded-lg border border-slate-100 dark:border-strokedark group-hover/item:border-slate-200 dark:group-hover/item:border-strokedark transition-colors\">\n                    {item.children}\n                  </p>\n                </div>\n              </div>\n            ))}\n          </div>\n        )}\n      </div>\n    </div>\n  );\n};\n\nconst IterativePage = () => {\n  const theme = useConfigStore((state) => state.colorMode);\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [year, setYear] = useState<number>(new Date().getFullYear());\n  const [yearList, setYearList] = useState<{ value: number; label: string }[]>([]);\n\n  const [blogData, setBlogData] = useState<TimelineItem[]>([]);\n  const [adminData, setAdminData] = useState<TimelineItem[]>([]);\n  const [serverData, setServerData] = useState<TimelineItem[]>([]);\n\n  const getCommitData = async (project: string) => {\n    try {\n      if (isFirstLoadRef.current) setInitialLoading(true);\n      else setLoading(true);\n\n      const res = await fetch(`https://api.github.com/repos/LiuYuYang01/${project}/commits?per_page=10`);\n      const data = await res.json();\n      const result = data?.map((item: Commit) => ({\n        label: dayjs(item.commit.author.date).format('YYYY-MM-DD HH:mm'), // 优化了日期格式\n        children: item.commit.message,\n      }));\n\n      switch (project) {\n        case 'ThriveX-Blog':\n          sessionStorage.setItem('blog_project_iterative', JSON.stringify(result));\n          setBlogData(result);\n          break;\n        case 'ThriveX-Admin':\n          sessionStorage.setItem('admin_project_iterative', JSON.stringify(result));\n          setAdminData(result);\n          break;\n        case 'ThriveX-Server':\n          sessionStorage.setItem('server_project_iterative', JSON.stringify(result));\n          setServerData(result);\n          break;\n      }\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  type SetTimelineData = React.Dispatch<React.SetStateAction<TimelineItem[]>>;\n\n  const loadData = (key: string, setter: SetTimelineData, project: string) => {\n    const cached: TimelineItem[] = JSON.parse(sessionStorage.getItem(key) ?? '[]');\n    if (cached.length > 0) {\n      setter(cached);\n    } else {\n      getCommitData(project);\n    }\n  };\n\n  useEffect(() => {\n    const currentYear = dayjs().year();\n    const list = Array.from({ length: 5 }, (_, i) => currentYear - i);\n    setYearList(list.map((value) => ({ value, label: String(value) })));\n\n    loadData('blog_project_iterative', setBlogData, 'ThriveX-Blog');\n    loadData('admin_project_iterative', setAdminData, 'ThriveX-Admin');\n    loadData('server_project_iterative', setServerData, 'ThriveX-Server');\n\n    const timer = setTimeout(() => setInitialLoading(false), 500);\n    return () => clearTimeout(timer);\n  }, []);\n\n  return (\n    <div className=\"p-4 font-sans text-slate-600 dark:text-slate-300 transition-colors\">\n      <div className=\"max-w-7xl mx-auto mb-4\">\n        <div className=\"relative flex flex-col md:flex-row md:items-center justify-center gap-4 bg-white dark:bg-boxdark px-6 py-3 rounded-2xl shadow-xs border border-slate-100 dark:border-strokedark transition-colors\">\n          <h1 className=\"flex items-center gap-4 font-extrabold text-slate-800 dark:text-slate-100\">\n            <img src=\"/logo.png\" alt=\"\" className=\"w-8 h-8\" />\n            <span className=\"text-xl font-extrabold text-slate-800 dark:text-slate-100\">不断改善、成为最佳</span>\n          </h1>\n\n          <div className=\"absolute right-6 top-1/2 -translate-y-1/2 flex items-center gap-3 bg-slate-50 dark:bg-boxdark-2 px-4 py-1 rounded-xl border border-slate-100 dark:border-strokedark transition-colors\">\n            <span className=\"text-slate-500 dark:text-slate-400 text-sm font-medium flex items-center gap-2\">\n              <FiCalendar size={16} />\n              年份视图:\n            </span>\n\n            <Select\n              variant=\"borderless\"\n              defaultValue={year}\n              options={yearList}\n              onChange={setYear}\n              className=\"min-w-[100px] font-bold! text-slate-700 dark:text-slate-200 [&_.ant-select-selector]:bg-transparent!\"\n              dropdownStyle={{ borderRadius: '12px', padding: '8px' }}\n            />\n          </div>\n        </div>\n      </div>\n\n      <div className=\"max-w-7xl mx-auto mb-4\">\n        <div className=\"bg-white dark:bg-boxdark p-6 md:p-8 rounded-2xl shadow-xs border border-slate-100 dark:border-strokedark flex flex-col items-center justify-center relative overflow-hidden group transition-colors\">\n          {/* 背景装饰 */}\n          <div className=\"absolute top-0 right-0 w-64 h-64 bg-green-50 dark:bg-green-900/20 rounded-full blur-3xl opacity-50 -translate-y-1/2 translate-x-1/2 pointer-events-none\" />\n\n          <div className=\"relative z-10 w-full overflow-x-auto pb-2 flex justify-center\">\n            <GitHubCalendar\n              username=\"liuyuyang01\"\n              year={year}\n              fontSize={12}\n              blockSize={13}\n              blockMargin={4}\n              colorScheme={theme}\n              theme={{\n                light: ['#f0f2f5', '#9be9a8', '#40c463', '#30a14e', '#216e39'],\n                dark: ['#1e293b', '#166534', '#15803d', '#16a34a', '#22c55e'],\n              }}\n            />\n          </div>\n        </div>\n      </div>\n\n      <div className=\"max-w-7xl mx-auto\">\n        {initialLoading ? (\n          <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-6 h-[600px]\">\n            <ProjectSkeleton />\n            <ProjectSkeleton />\n            <ProjectSkeleton />\n          </div>\n        ) : (\n          <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-6 relative\">\n            {loading && (\n              <div className=\"absolute inset-0 z-20 bg-white/60 dark:bg-boxdark/80 backdrop-blur-[1px] rounded-3xl flex items-center justify-center transition-colors\">\n                <div className=\"bg-white dark:bg-boxdark-2 p-4 rounded-full shadow-lg border border-slate-100 dark:border-strokedark\">\n                  <FiLoader className=\"animate-spin text-indigo-600 dark:text-indigo-400\" size={32} />\n                </div>\n              </div>\n            )}\n\n            <ProjectTimelineCard\n              title=\"ThriveX Blog\"\n              icon={FiGlobe}\n              colorIndex={0}\n              data={blogData}\n            />\n\n            <ProjectTimelineCard\n              title=\"ThriveX Admin\"\n              icon={FiLayout}\n              colorIndex={1}\n              data={adminData}\n            />\n\n            <ProjectTimelineCard\n              title=\"ThriveX Server\"\n              icon={FiServer}\n              colorIndex={2}\n              data={serverData}\n            />\n          </div>\n        )}\n      </div>\n    </div>\n  );\n};\n\nexport default IterativePage;\n"
  },
  {
    "path": "src/pages/login/index.tsx",
    "content": "import { useState } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { useForm } from 'antd/es/form/Form';\nimport { Button, Form, Input, notification } from 'antd';\nimport { UserOutlined, LockOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons';\n\nimport { loginDataAPI } from '@/api/user';\nimport { useUserStore } from '@/stores';\nimport { setShowLoginNotification } from '@/components/SystemNotification';\n\nexport default () => {\n  const navigate = useNavigate();\n  const location = useLocation();\n  const store = useUserStore();\n\n  const [loading, setLoading] = useState(false);\n\n  const [form] = useForm();\n\n  const [isPassVisible, setIsPassVisible] = useState(false);\n  const returnUrl = new URLSearchParams(location.search).get('returnUrl') || '/';\n\n  const onSubmit = async () => {\n    try {\n      setLoading(true);\n\n      const values = await form.validateFields();\n      const { data } = await loginDataAPI(values);\n\n      // 将用户信息和token保存起来\n      store.setToken(data.token);\n      store.setUser(data.user);\n      store.setRole(data.role);\n\n      // 设置显示登录通知的标记\n      setShowLoginNotification();\n\n      notification.success({\n        message: '🎉 登录成功',\n        description: `Hello ${data.user.name} 欢迎回来`,\n      });\n\n      setLoading(false);\n      navigate(returnUrl);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  return (\n    <div className=\"relative min-h-screen flex items-center justify-center bg-[#F8FAFC] p-4 sm:p-8 selection:bg-blue-500 selection:text-white\">\n      <div className=\"absolute inset-0 z-0 pointer-events-none overflow-hidden\">\n        {/* 点阵网格背景 */}\n        <div\n          className=\"absolute inset-0 opacity-[0.03]\"\n          style={{ backgroundImage: 'radial-gradient(#000 1px, transparent 1px)', backgroundSize: '24px 24px' }}\n        />\n        <div className=\"absolute -top-[20%] -left-[10%] w-[70%] h-[70%] rounded-full bg-blue-400/20 blur-[120px]\" />\n        <div className=\"absolute -bottom-[20%] -right-[10%] w-[60%] h-[60%] rounded-full bg-purple-400/15 blur-[120px]\" />\n      </div>\n\n      <div className=\"relative z-10 w-full max-w-md\">\n        <div className=\"bg-[rgba(255,255,255,0.5)] backdrop-blur-xs rounded-3xl shadow-2xl p-8 border border-white/20\">\n          <div className=\"flex justify-center space-x-4 mb-8\">\n            <img src=\"/logo.png\" alt=\"\" className=\"w-12 h-12\" />\n            <div className=\"flex flex-col\">\n              <h1 className=\"font-bold text-lg text-slate-700\">ThriveX</h1>\n              <p className=\"text-slate-400 text-sm\">现代化博客管理系统</p>\n            </div>\n          </div>\n\n          <Form form={form} size=\"large\" layout=\"vertical\" onFinish={onSubmit} className=\"space-y-1\">\n            <Form.Item name=\"username\" label={<span className=\"text-gray-700 font-medium\">账号</span>} rules={[{ required: true, message: '请输入账号' }]}>\n              <Input prefix={<UserOutlined className=\"text-gray-400\" />} placeholder=\"请输入用户名\" className=\"h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors\" />\n            </Form.Item>\n\n            <Form.Item name=\"password\" label={<span className=\"text-gray-700 font-medium\">密码</span>} rules={[{ required: true, message: '请输入密码' }]}>\n              <Input.Password prefix={<LockOutlined className=\"text-gray-400\" />} type={isPassVisible ? 'text' : 'password'} placeholder=\"请输入密码\" className=\"h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors\" iconRender={(visible) => (visible ? <EyeOutlined onClick={() => setIsPassVisible(!isPassVisible)} /> : <EyeInvisibleOutlined onClick={() => setIsPassVisible(!isPassVisible)} />)} />\n            </Form.Item>\n\n            <Form.Item className=\"mb-6\">\n              <Button type=\"primary\" htmlType=\"submit\" loading={loading} className=\"w-full h-12 mt-4 rounded-xl shadow-lg hover:shadow-xl font-medium text-base\" block>\n                {loading ? '登录中...' : '登录'}\n              </Button>\n            </Form.Item>\n          </Form>\n        </div>\n\n        <div className=\"text-center mt-4\">\n          <p className=\"text-gray-500 text-sm\">再小的个体，也有自己的品牌</p>\n        </div>\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/page/my.tsx",
    "content": "export default () => {\n  return <h1>Hello</h1>\n}"
  },
  {
    "path": "src/pages/record/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Link } from 'react-router-dom';\nimport {\n  Table, Button, Image, notification, Popconfirm, Popover,\n  Form, Input, DatePicker, Tooltip, Space, Divider,\n} from 'antd';\nimport type { ColumnsType } from 'antd/es/table';\nimport dayjs from 'dayjs';\nimport {\n  DeleteOutlined,\n  FormOutlined,\n  SearchOutlined,\n} from '@ant-design/icons';\n\nimport Title from '@/components/Title';\nimport { delRecordDataAPI, getRecordListAPI } from '@/api/record';\nimport type { Record } from '@/types/app/record';\nimport { FilterForm } from '@/types/app/comment';\n\nconst { RangePicker } = DatePicker;\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState<number | null>(null); // 存储当前正在删除的ID\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [recordList, setRecordList] = useState<Record[]>([]);\n  const [form] = Form.useForm();\n  const [currentPage, setCurrentPage] = useState<number>(1);\n  const [pageSize, setPageSize] = useState<number>(10);\n\n  // 获取数据\n  const fetchData = async (queryParams = {}) => {\n    try {\n      if (isFirstLoadRef.current) setInitialLoading(true);\n      else setLoading(true);\n      const { data } = await getRecordListAPI(queryParams);\n      setRecordList(data as Record[]);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    fetchData();\n  }, []);\n\n  // 删除逻辑\n  const handleDelete = async (id: number) => {\n    try {\n      setBtnLoading(id);\n      await delRecordDataAPI(id);\n      await fetchData(); // 重新获取数据\n      notification.success({ message: '删除成功' });\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setBtnLoading(null);\n    }\n  };\n\n  // 筛选提交\n  const onFilterSubmit = (values: FilterForm) => {\n    const query = {\n      key: values.content,\n      startDate: values.createTime?.[0]?.valueOf(),\n      endDate: values.createTime?.[1]?.valueOf(),\n    };\n    fetchData({ query });\n  };\n\n  // 表格列定义\n  const columns: ColumnsType<Record> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      width: 80,\n      align: 'center',\n      render: (text) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '内容',\n      dataIndex: 'content',\n      width: 400,\n      render: (text) => (\n        <Tooltip title={text} placement=\"topLeft\">\n          <div className=\"max-w-[400px] truncate text-gray-700 dark:text-gray-200 font-medium cursor-pointer\">\n            {text || <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无文字内容</span>}\n          </div>\n        </Tooltip>\n      ),\n    },\n    {\n      title: '图片',\n      dataIndex: 'images',\n      width: 170,\n      render: (text) => {\n        const list: string[] = JSON.parse(text || '[]');\n        if (list.length === 0) return <span className=\"text-gray-300 dark:text-gray-500 text-xs\">无图片</span>;\n\n        const trigger = (\n          <div className=\"record-images-collapse flex items-center gap-2\">\n            <div\n              className=\"relative overflow-hidden rounded-lg border border-gray-100 dark:border-strokedark shadow-xs record-image-container group/img\"\n              style={{ width: 60, height: 60 }}\n            >\n              <Image\n                src={list[0]}\n                width={60}\n                height={60}\n                className=\"object-cover transition-transform duration-300 group-hover/img:scale-110\"\n                style={{ display: 'block', width: '100%', height: '100%', objectFit: 'cover' }}\n                preview={{ mask: '预览' }}\n              />\n            </div>\n            {list.length > 1 && (\n              <div\n                className=\"flex items-center justify-center rounded-lg border border-gray-100 dark:border-strokedark bg-gray-100 dark:bg-boxdark-2 text-gray-500 dark:text-gray-400 text-sm font-medium shrink-0 cursor-pointer\"\n                style={{ width: 60, height: 60 }}\n              >\n                +{list.length - 1}\n              </div>\n            )}\n          </div>\n        );\n\n        if (list.length <= 1) {\n          return (\n            <Image.PreviewGroup>\n              {trigger}\n            </Image.PreviewGroup>\n          );\n        }\n\n        return (\n          <Popover\n            trigger=\"hover\"\n            placement=\"bottomLeft\"\n            overlayClassName=\"record-images-popover\"\n            content={\n              <Image.PreviewGroup>\n                <div className=\"flex items-center gap-1.5 flex-wrap\" style={{ maxWidth: 280 }}>\n                  {list.map((src, idx) => (\n                    <div\n                      key={idx}\n                      className=\"overflow-hidden rounded-sm border border-gray-100 dark:border-strokedark record-image-container shrink-0\"\n                      style={{ width: 56, height: 56 }}\n                    >\n                      <Image\n                        src={src}\n                        width={56}\n                        height={56}\n                        className=\"object-cover\"\n                        style={{ display: 'block', width: '100%', height: '100%', objectFit: 'cover' }}\n                        preview={{ mask: '预览' }}\n                      />\n                    </div>\n                  ))}\n                </div>\n              </Image.PreviewGroup>\n            }\n          >\n            <span className=\"inline-block\">\n              <Image.PreviewGroup>\n                {trigger}\n              </Image.PreviewGroup>\n            </span>\n          </Popover>\n        );\n      },\n    },\n    {\n      title: '发布时间',\n      dataIndex: 'createTime',\n      render: (text) => (\n        <div className=\"flex flex-col\">\n          <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{dayjs(+text).format('YYYY-MM-DD')}</span>\n          <span className=\"text-gray-400 dark:text-gray-500 text-xs\">{dayjs(+text).format('HH:mm:ss')}</span>\n        </div>\n      ),\n    },\n    {\n      title: '操作',\n      key: 'action',\n      fixed: 'right',\n      width: 120,\n      align: 'center',\n      render: (_, record) => (\n        <Space split={<Divider type=\"vertical\" />}>\n          <Tooltip title=\"编辑\">\n            <Link to={`/create_record?id=${record.id}`}>\n              <Button\n                type=\"text\"\n                size=\"small\"\n                icon={<FormOutlined className=\"text-blue-500\" />}\n                className=\"text-blue-500 dark:text-gray-300 dark:hover:text-blue-500! hover:bg-blue-50 dark:hover:bg-blue-900/20\"\n              />\n            </Link>\n          </Tooltip>\n\n          <Tooltip title=\"删除\">\n            <Popconfirm\n              title=\"删除确认\"\n              description=\"该操作无法撤销，确定删除吗？\"\n              okText=\"删除\"\n              okButtonProps={{ danger: true }}\n              cancelText=\"取消\"\n              onConfirm={() => handleDelete(record.id!)}\n            >\n              <Button\n                type=\"text\"\n                size=\"small\"\n                danger\n                loading={btnLoading === record.id}\n                icon={<DeleteOutlined />}\n                className=\"hover:bg-red-50 dark:hover:bg-red-900/20\"\n              />\n            </Popconfirm>\n          </Tooltip>\n        </Space>\n      ),\n    },\n  ];\n\n  // 骨架屏\n  if (initialLoading) return (\n    <div className=\"space-y-2\">\n      <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n        <div className=\"skeleton h-8\" style={{ width: 200 }} />\n      </div>\n\n      <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n        <div className=\"flex justify-between mb-6\">\n          <div className=\"flex gap-4\">\n            <div className=\"skeleton h-9\" style={{ width: 200 }} />\n            <div className=\"skeleton h-9\" style={{ width: 300 }} />\n          </div>\n          <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n        </div>\n\n        {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n          <div key={i} className=\"flex gap-4 mb-4 items-center\">\n            <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n            <div className=\"flex-1 space-y-2 min-w-0\">\n              <div className=\"skeleton h-4 w-full rounded-sm\" />\n              <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n            </div>\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n\n  return (\n    <>\n      <style>{`\n        .record-image-container .ant-image,\n        .record-image-container .ant-image-img,\n        .record-image-container .ant-image-mask {\n          width: 100% !important;\n          height: 100% !important;\n        }\n        .record-image-container .ant-image {\n          display: block !important;\n        }\n        .record-image-container .ant-image-img {\n          object-fit: cover !important;\n        }\n        .record-images-popover.ant-popover .ant-popover-inner {\n          padding: 10px;\n          border-radius: 10px;\n          box-shadow: 0 6px 16px rgba(0,0,0,0.12);\n        }\n      `}</style>\n\n      <div className=\"mx-auto\">\n        <Title value=\"说说管理\" />\n\n        <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n          <div className=\"p-5 border-b border-gray-100 dark:border-strokedark bg-gray-50/30 dark:bg-boxdark-2/50\">\n            <Form form={form} layout=\"inline\" onFinish={onFilterSubmit} className=\"gap-y-3\">\n              <Form.Item name=\"content\" className=\"mb-0! w-full sm:w-auto\">\n                <Input\n                  prefix={<SearchOutlined className=\"text-gray-400 dark:text-gray-500\" />}\n                  placeholder=\"搜索说说内容...\"\n                  className=\"w-full sm:w-[240px]\"\n                  allowClear\n                />\n              </Form.Item>\n\n              <Form.Item name=\"createTime\" className=\"mb-0! w-full sm:w-auto\">\n                <RangePicker\n                  className=\"w-full sm:w-[280px]\"\n                  placeholder={['开始日期', '结束日期']}\n                  disabledDate={(current) => current && current > dayjs().endOf('day')}\n                />\n              </Form.Item>\n\n              <div className=\"flex gap-2\">\n                <Button type=\"primary\" htmlType=\"submit\" icon={<SearchOutlined />}>\n                  查询\n                </Button>\n              </div>\n            </Form>\n          </div>\n\n          <Table\n            rowKey=\"id\"\n            dataSource={recordList}\n            columns={columns}\n            loading={loading}\n            pagination={{\n              position: ['bottomRight'],\n              current: currentPage,\n              pageSize: pageSize,\n              showTotal: (total) => (\n                <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                  当前第 {currentPage} / {Math.ceil(total / (pageSize || 8))} 页 | 共 {total} 条数据\n                </div>\n              ),\n              onChange: (page, size) => {\n                setCurrentPage(page);\n                if (size !== pageSize) {\n                  setPageSize(size);\n                }\n              },\n              onShowSizeChange: (_current, size) => {\n                setCurrentPage(1);\n                setPageSize(size);\n              },\n              className: 'px-6! py-4!'\n            }}\n            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!\"\n            scroll={{ x: 1030 }}\n          />\n        </div>\n      </div>\n    </>\n  );\n};"
  },
  {
    "path": "src/pages/setup/components/My/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { Form, Input, Button, message } from 'antd';\n\nimport { useUserStore } from '@/stores';\nimport { editUserDataAPI, getUserDataAPI } from '@/api/user';\nimport { User } from '@/types/app/user';\n\ninterface UserForm {\n  name: string;\n  email: string;\n  avatar: string;\n  info: string;\n}\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n\n  const [form] = Form.useForm<UserForm>();\n  const store = useUserStore();\n\n  const getUserData = async () => {\n    try {\n      setLoading(true);\n\n      const { data } = await getUserDataAPI(store.user?.id);\n      store.setUser(data);\n      form.setFieldsValue(data);\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getUserData();\n  }, []);\n\n  const onSubmit = async (values: UserForm) => {\n    try {\n      setLoading(true);\n\n      await editUserDataAPI({\n        id: store.user.id,\n        ...values,\n        role: undefined,\n      });\n\n      getUserData();\n      message.success('🎉 修改用户信息成功');\n      store.setUser(values as User);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  return (\n    <div>\n      <h2 className=\"text-xl pb-4\">个人配置</h2>\n\n      <Form form={form} size=\"large\" layout=\"vertical\" onFinish={onSubmit} className=\"w-full lg:w-[500px] md:ml-10\">\n        <Form.Item label=\"名称\" name=\"name\" rules={[{ required: true, message: '名称不能为空' }]}>\n          <Input placeholder=\"宇阳\" />\n        </Form.Item>\n\n        <Form.Item label=\"邮箱\" name=\"email\" rules={[{ required: true, message: '邮箱不能为空' }]}>\n          <Input placeholder=\"liuyuyang1024@yeah.net\" />\n        </Form.Item>\n\n        <Form.Item label=\"头像\" name=\"avatar\" rules={[{ required: true, message: '头像不能为空' }]}>\n          <Input placeholder=\"https://liuyuyang.net/logo.png\" />\n        </Form.Item>\n\n        <Form.Item label=\"介绍\" name=\"info\" rules={[{ required: true, message: '介绍不能为空' }]}>\n          <Input placeholder=\"互联网从不缺乏天才, 而努力才是最终的入场劵\" />\n        </Form.Item>\n\n        <Form.Item>\n          <Button type=\"primary\" htmlType=\"submit\" loading={loading} className=\"w-full\">\n            确定\n          </Button>\n        </Form.Item>\n      </Form>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/components/Other/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { Form, Input, Button, message } from 'antd';\nimport { editWebConfigDataAPI, getWebConfigDataAPI } from '@/api/config';\nimport { Other, Web } from '@/types/app/config';\nimport dayjs from 'dayjs';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n\n  const [form] = Form.useForm();\n\n  const getConfigData = async () => {\n    try {\n      setLoading(true);\n      const { data } = await getWebConfigDataAPI<{ value: Other }>('other');\n      form.setFieldsValue(data.value);\n      setLoading(false);\n    } catch (error) {\n      setLoading(false);\n      console.error(error);\n    }\n  };\n\n  useEffect(() => {\n    getConfigData();\n  }, []);\n\n  const onSubmit = async (values: Web) => {\n    setLoading(true);\n\n    try {\n      // 将日期转换为时间戳\n      const submitData = {\n        ...values,\n        create_time: values.create_time ? values.create_time.valueOf() : undefined,\n      };\n\n      await editWebConfigDataAPI('other', submitData);\n      message.success('🎉 编辑配置成功');\n\n      // 使用新的 submitData 来更新表单值\n      const newInitialValues = {\n        ...submitData,\n        create_time: submitData.create_time ? dayjs(Number(submitData.create_time)) : undefined,\n      };\n      form.setFieldsValue(newInitialValues);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n\n    setLoading(false);\n  };\n\n  const Label = ({ title, url }: { title: string; url: string }) => {\n    return (\n      <div className=\"w-full flex items-center justify-between\">\n        <span>{title}</span>\n        <a href={url} target=\"_blank\" rel=\"noreferrer\" className=\"hover:text-primary text-xs text-gray-400\">配置教程</a>\n      </div>\n    );\n  };\n\n  return (\n    <div>\n      <h2 className=\"text-xl pb-4\">其他配置</h2>\n\n      <Form form={form} size=\"large\" layout=\"vertical\" onFinish={onSubmit} className=\"w-full lg:w-[500px] md:ml-10\">\n        <Form.Item label={<Label title=\"百度统计 Token\" url=\"https://docs.liuyuyang.net/docs/项目部署/API/百度统计.html\" />} name=\"baidu_token\" className=\"[&_label]:w-full\">\n          <Input placeholder=\"e5bf799a3e49312141c8b677b7bec1c2\" />\n        </Form.Item>\n\n        <Form.Item label={<Label title=\"HCaptcha Key\" url=\"https://docs.liuyuyang.net/docs/项目部署/API/人机验证.html\" />} name=\"hcaptcha_key\" rules={[{ required: true, message: 'HCaptcha Key 不能为空' }]} className=\"[&_label]:w-full\">\n          <Input placeholder=\"bfb82d04-e46a-4da0-9b6e-9adc052672c8\" />\n        </Form.Item>\n\n        <Form.Item>\n          <Button type=\"primary\" htmlType=\"submit\" loading={loading} block>\n            确定\n          </Button>\n        </Form.Item>\n      </Form>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/components/System/index.tsx",
    "content": "import { Form, Input, Button, Modal } from 'antd';\nimport { useState } from 'react';\n\nimport { useUserStore } from '@/stores';\nimport { editAdminPassAPI } from '@/api/user';\nimport { EditUser } from '@/types/app/user';\n\nconst { confirm } = Modal;\n\nexport default () => {\n  const store = useUserStore();\n\n  const [loading, setLoading] = useState(false);\n\n  const [form] = Form.useForm<EditUser>();\n\n  const initialValues: EditUser = {\n    newUsername: store.user?.username || '',\n    oldPassword: '',\n    newPassword: '',\n  } as EditUser;\n\n  const rules = {\n    newUsername: [\n      { required: true, message: '管理员账号不能为空' },\n      { min: 5, max: 16, message: '账号限制在5 ~ 16个字符' },\n    ],\n    oldPassword: [\n      { required: true, message: '管理员旧密码不能为空' },\n      { min: 6, max: 16, message: '密码限制在6 ~ 16个字符' },\n    ],\n    newPassword: [\n      { required: true, message: '管理员新密码不能为空' },\n      { min: 6, max: 16, message: '密码限制在6 ~ 16个字符' },\n    ],\n  };\n\n  const handleSubmit = async (values: EditUser) => {\n    try {\n      setLoading(true);\n\n      await editAdminPassAPI({ ...values, oldUsername: store.user?.username || '' });\n\n      confirm({\n        title: '提示',\n        content: '🔒️ 修改成功，请重新登录',\n        okText: '确定',\n        onOk: store.quitLogin,\n        cancelButtonProps: { style: { display: 'none' } },\n      });\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  return (\n    <div>\n      <h2 className=\"text-xl pb-4\">账户配置</h2>\n\n      <Form form={form} initialValues={initialValues} size=\"large\" layout=\"vertical\" onFinish={handleSubmit} className=\"w-full lg:w-[500px] md:ml-10\">\n        <Form.Item label=\"管理员账号\" name=\"newUsername\" rules={rules.newUsername}>\n          <Input placeholder=\"请输入账号\" />\n        </Form.Item>\n\n        <Form.Item label=\"管理员旧密码\" name=\"oldPassword\" rules={rules.oldPassword}>\n          <Input.Password placeholder=\"请输入旧密码\" />\n        </Form.Item>\n\n        <Form.Item label=\"管理员新密码\" name=\"newPassword\" rules={rules.newPassword}>\n          <Input.Password placeholder=\"请输入新密码\" />\n        </Form.Item>\n\n        <Form.Item>\n          <Button type=\"primary\" htmlType=\"submit\" loading={loading} className=\"w-full\">\n            确定\n          </Button>\n        </Form.Item>\n      </Form>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/components/Theme/components/RecordTheme/index.tsx",
    "content": "import { useEffect, useState } from 'react';\nimport { Form, notification, Input, Button } from 'antd';\n\nimport { Theme } from '@/types/app/config';\nimport { editWebConfigDataAPI, getWebConfigDataAPI } from '@/api/config';\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [theme, setTheme] = useState<Theme>({} as Theme);\n\n  const [form] = Form.useForm();\n\n  const getLayoutData = async () => {\n    try {\n      setLoading(true);\n\n      const { data } = await getWebConfigDataAPI<{ value: Theme }>('theme');\n\n      const theme = data.value;\n\n      setTheme(theme);\n\n      form.setFieldsValue({\n        record_name: theme.record_name,\n        record_info: theme.record_info,\n      });\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getLayoutData();\n  }, []);\n\n  const editThemeData = async (values: { record_name: string; record_info: string }) => {\n    try {\n      setLoading(true);\n\n      await editWebConfigDataAPI('theme', {\n        ...theme,\n        record_name: values.record_name,\n        record_info: values.record_info,\n      });\n\n      notification.success({\n        message: '成功',\n        description: '🎉 修改主题成功',\n      });\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  return (\n    <div>\n      <h2 className=\"text-xl py-4 pl-10\">闪念配置</h2>\n\n      <div className=\"w-full lg:w-[500px] md:ml-10\">\n        <Form form={form} onFinish={editThemeData} layout=\"vertical\">\n          <Form.Item name=\"record_name\" label=\"个人名称\">\n            <Input size=\"large\" placeholder=\"请输入个人名称\" />\n          </Form.Item>\n\n          <Form.Item name=\"record_info\" label=\"个人介绍\">\n            <Input.TextArea size=\"large\" autoSize={{ minRows: 2, maxRows: 4 }} placeholder=\"请输入个人介绍\" />\n          </Form.Item>\n\n          <Button type=\"primary\" size=\"large\" className=\"w-full mt-4\" htmlType=\"submit\" loading={loading}>\n            确定\n          </Button>\n        </Form>\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/components/Theme/components/SynthesisTheme/index.tsx",
    "content": "import { useEffect, useState } from 'react';\n\nimport { Alert, Button, Checkbox, Divider, Form, Input, notification } from 'antd';\nimport { CloudUploadOutlined, PictureOutlined } from '@ant-design/icons';\n\nimport { Theme } from '@/types/app/config';\nimport { editWebConfigDataAPI, getWebConfigDataAPI } from '@/api/config';\nimport Material from '@/components/Material';\nimport { ThemeFormValues } from './type';\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n\n  const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);\n  const [theme, setTheme] = useState<Theme>({} as Theme);\n\n  const [form] = Form.useForm();\n\n  const [currentUploadType, setCurrentUploadType] = useState<string>('');\n\n  const getLayoutData = async () => {\n    try {\n      setLoading(true);\n\n      const { data } = await getWebConfigDataAPI<{ value: Theme }>('theme');\n\n      const theme = data.value;\n\n      setTheme(theme);\n\n      form.setFieldsValue({\n        ...theme,\n        social: theme.social.map((item) => JSON.stringify(item)).join('\\n'),\n        swiper_text: theme.swiper_text.join('\\n'),\n        covers: theme.covers.join('\\n'),\n        reco_article: theme.reco_article.join('\\n'),\n      });\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getLayoutData();\n  }, []);\n\n  const editThemeData = async (values: ThemeFormValues) => {\n    try {\n      setLoading(true);\n\n      const updatedLayout = {\n        ...theme,\n        ...values,\n        social: values.social.split('\\n').map((item: string) => JSON.parse(item)),\n        swiper_text: values.swiper_text.split('\\n'),\n        covers: values.covers.split('\\n'),\n        reco_article: values.reco_article.split('\\n').map((item: string) => Number(item)),\n      };\n\n      await editWebConfigDataAPI('theme', updatedLayout);\n\n      notification.success({\n        message: '成功',\n        description: '🎉 修改主题成功',\n      });\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  const getFile = (name: string) => {\n    return new URL(`../../image/${name}.png`, import.meta.url).href;\n  };\n\n  const UploadBtn = ({ type }: { type: string }) => (\n    <CloudUploadOutlined\n      className=\"text-xl cursor-pointer\"\n      onClick={() => {\n        setCurrentUploadType(type);\n        setIsMaterialModalOpen(true);\n      }}\n    />\n  );\n\n  return (\n    <div>\n      <h2 className=\"text-xl py-4\">综合配置</h2>\n\n      <div className=\"w-full lg:w-[500px]\">\n        <Form form={form} onFinish={editThemeData} layout=\"vertical\">\n          <Divider>亮色主题 Logo</Divider>\n          <Form.Item name=\"light_logo\" label=\"亮色主题 Logo\">\n            <Input prefix={<PictureOutlined />} addonAfter={<UploadBtn type=\"light_logo\" />} size=\"large\" placeholder=\"请输入亮色Logo地址\" />\n          </Form.Item>\n          <img src={form.getFieldValue('light_logo')} alt=\"\" className=\"w-1/3 mt-4 rounded-sm\" />\n\n          <Divider>暗色主题 Logo</Divider>\n          <Form.Item name=\"dark_logo\" label=\"暗色主题 Logo\">\n            <Input prefix={<PictureOutlined />} addonAfter={<UploadBtn type=\"dark_logo\" />} size=\"large\" placeholder=\"请输入暗色Logo地址\" />\n          </Form.Item>\n          <img src={form.getFieldValue('dark_logo')} alt=\"\" className=\"w-1/3 mt-4 rounded-sm\" />\n\n          <Divider>首页背景图</Divider>\n          <Form.Item name=\"swiper_image\" label=\"首页背景图\">\n            <Input prefix={<PictureOutlined />} addonAfter={<UploadBtn type=\"swiper_image\" />} size=\"large\" placeholder=\"请输入背景图地址\" />\n          </Form.Item>\n          <img src={form.getFieldValue('swiper_image')} alt=\"\" className=\"w-1/3 mt-4 rounded-sm\" />\n\n          <Divider>打字机文本</Divider>\n          <Form.Item name=\"swiper_text\" label=\"打字机文本\">\n            <Input.TextArea autoSize={{ minRows: 2, maxRows: 4 }} size=\"large\" placeholder=\"请输入打字机文本\" />\n          </Form.Item>\n          <Alert message=\"以换行分隔，每行表示一段文本\" type=\"info\" className=\"mt-2\" />\n\n          <Divider>社交网站</Divider>\n          <Form.Item name=\"social\" label=\"社交网站\">\n            <Input.TextArea autoSize={{ minRows: 2, maxRows: 4 }} size=\"large\" placeholder=\"请输入社交网站\" />\n          </Form.Item>\n          <Alert message=\"请务必确保每一项格式正确，否则会导致网站无法访问\" type=\"info\" className=\"mt-2\" />\n\n          <Divider>文章随机封面</Divider>\n          <Form.Item name=\"covers\" label=\"文章随机封面\">\n            <Input.TextArea autoSize={{ minRows: 2, maxRows: 4 }} size=\"large\" placeholder=\"请输入文章随机封面\" />\n          </Form.Item>\n          <Alert message=\"以换行分隔，每行表示一段文本\" type=\"info\" className=\"mt-2\" />\n\n          <Divider>作者推荐文章</Divider>\n          <Form.Item name=\"reco_article\" label=\"作者推荐文章\">\n            <Input.TextArea autoSize={{ minRows: 2, maxRows: 4 }} size=\"large\" placeholder=\"请输入作者推荐文章ID\" />\n          </Form.Item>\n          <Alert message=\"以换行分隔，每行表示一段文本\" type=\"info\" className=\"mt-2\" />\n\n          <Divider>侧边栏</Divider>\n          <Checkbox.Group\n            value={theme.right_sidebar}\n            onChange={(right_sidebar) => {\n              setTheme({ ...theme, right_sidebar });\n            }}\n          >\n            <div className=\"grid grid-cols-4 gap-2\">\n              <Checkbox value=\"author\">作者信息模块</Checkbox>\n              <Checkbox value=\"runTime\">站点时间模块</Checkbox>\n              <Checkbox value=\"randomArticle\">随机推荐模块</Checkbox>\n              <Checkbox value=\"newComments\">最新评论模块</Checkbox>\n              <Checkbox value=\"hotArticle\">作者推荐模块</Checkbox>\n              <Checkbox value=\"study\">装饰模块</Checkbox>\n            </div>\n          </Checkbox.Group>\n\n          <Divider>文章布局</Divider>\n          <div className=\"overflow-auto w-full\">\n            <div className=\"article flex w-[650px]\">\n              {['classics', 'card', 'waterfall'].map((item) => (\n                <div key={item} onClick={() => setTheme({ ...theme, is_article_layout: item })} className={`item flex flex-col items-center p-4 m-4 border-2 rounded-sm cursor-pointer ${theme.is_article_layout === item ? 'border-primary' : 'border-stroke'}`}>\n                  <p className={`text-center ${theme.is_article_layout === item ? 'text-primary' : ''}`}>{item === 'classics' ? '经典布局' : item === 'card' ? '卡片布局' : '瀑布流布局'}</p>\n\n                  <img src={`${getFile(item)}`} alt=\"\" className=\"w-[200px] mt-4 rounded-sm\" />\n                </div>\n              ))}\n            </div>\n          </div>\n\n          <Button type=\"primary\" size=\"large\" className=\"w-full mt-4\" htmlType=\"submit\" loading={loading}>\n            确定\n          </Button>\n        </Form>\n      </div>\n\n      <Material\n        open={isMaterialModalOpen}\n        onClose={() => {\n          setIsMaterialModalOpen(false);\n          setCurrentUploadType('');\n        }}\n        onSelect={(url: string[]) => {\n          if (currentUploadType) {\n            form.setFieldValue(currentUploadType, url[0]);\n            form.validateFields([currentUploadType]);\n            setTheme({ ...theme, [currentUploadType]: url[0] });\n          }\n        }}\n      />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/components/Theme/components/SynthesisTheme/type.d.ts",
    "content": "export interface ThemeFormValues {\n  light_logo: string;\n  dark_logo: string;\n  swiper_image: string;\n  swiper_text: string;\n  social: string;\n  covers: string;\n  reco_article: string;\n}"
  },
  {
    "path": "src/pages/setup/components/Theme/index.tsx",
    "content": "import { useState } from 'react';\nimport { Segmented } from 'antd';\nimport SynthesisTheme from './components/SynthesisTheme';\nimport RecordTheme from './components/RecordTheme';\n\nexport default () => {\n  const [current, setCurrent] = useState<string>('综合配置');\n\n  return (\n    <div>\n      <Segmented<string> size=\"large\" options={['综合配置', '说说配置']} onChange={setCurrent} className=\"md:ml-10 mb-4\" />\n      {current === '综合配置' && <SynthesisTheme />}\n      {current === '说说配置' && <RecordTheme />}\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/components/Web/index.tsx",
    "content": "import { useState } from 'react';\nimport { Form, Input, Button, message, DatePicker } from 'antd';\nimport { editWebConfigDataAPI } from '@/api/config';\nimport { Web } from '@/types/app/config';\nimport { useWebStore } from '@/stores';\nimport dayjs from 'dayjs';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n\n  const [form] = Form.useForm();\n\n  const web = useWebStore((state) => state.web);\n  const setWeb = useWebStore((state) => state.setWeb);\n\n  // 处理初始值，将时间戳转换为 dayjs 对象\n  const initialValues = {\n    ...web,\n    create_time: web.create_time ? dayjs(Number(web.create_time)) : undefined,\n  };\n\n  const onSubmit = async (values: Web) => {\n    setLoading(true);\n\n    try {\n      // 将日期转换为时间戳\n      const submitData = {\n        ...values,\n        create_time: values.create_time ? values.create_time.valueOf() : undefined,\n      };\n\n      await editWebConfigDataAPI('web', submitData);\n      message.success('🎉 编辑网站成功');\n      setWeb(submitData);\n\n      // 使用新的 submitData 来更新表单值\n      const newInitialValues = {\n        ...submitData,\n        create_time: submitData.create_time ? dayjs(Number(submitData.create_time)) : undefined,\n      };\n      form.setFieldsValue(newInitialValues);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n\n    setLoading(false);\n  };\n\n  return (\n    <div>\n      <h2 className=\"text-xl pb-4\">网站配置</h2>\n\n      <Form form={form} size=\"large\" layout=\"vertical\" onFinish={onSubmit} initialValues={initialValues} className=\"w-full lg:w-[500px] md:ml-10\">\n        <Form.Item label=\"网站名称\" name=\"title\" rules={[{ required: true, message: '网站名称不能为空' }]}>\n          <Input placeholder=\"ThriveX\" />\n        </Form.Item>\n\n        <Form.Item label=\"网站副标题\" name=\"subhead\" rules={[{ required: true, message: '网站副标题不能为空' }]}>\n          <Input placeholder=\"花有重开日, 人无再少年\" />\n        </Form.Item>\n\n        <Form.Item label=\"网站链接\" name=\"url\" rules={[{ required: true, message: '网站链接不能为空' }]}>\n          <Input placeholder=\"https://liuyuyang.net/\" />\n        </Form.Item>\n\n        <Form.Item label=\"网站图标\" name=\"favicon\">\n          <Input placeholder=\"https://liuyuyang.net/favicon.ico\" />\n        </Form.Item>\n\n        <Form.Item label=\"网站描述\" name=\"description\" rules={[{ required: true, message: '网站描述不能为空' }]}>\n          <Input placeholder=\"记录前端、Python、Java点点滴滴\" />\n        </Form.Item>\n\n        <Form.Item label=\"网站关键词\" name=\"keyword\" rules={[{ required: true, message: '网站关键词不能为空' }]}>\n          <Input placeholder=\"Java,前端,Python\" />\n        </Form.Item>\n\n        <Form.Item label=\"底部信息\" name=\"footer\" rules={[{ required: true, message: '网站底部信息不能为空' }]}>\n          <Input placeholder=\"记录前端、Python、Java点点滴滴\" />\n        </Form.Item>\n\n        <Form.Item label=\"ICP 备案号\" name=\"icp\">\n          <Input placeholder=\"豫ICP备2020031040号-1\" />\n        </Form.Item>\n\n        <Form.Item label=\"网站创建时间\" name=\"create_time\">\n          <DatePicker className=\"w-full\" />\n        </Form.Item>\n\n        <Form.Item>\n          <Button type=\"primary\" htmlType=\"submit\" loading={loading} block>\n            确定\n          </Button>\n        </Form.Item>\n      </Form>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/setup/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { useSearchParams } from 'react-router-dom';\n\nimport { Card, Skeleton } from 'antd';\nimport { AiOutlineSetting } from 'react-icons/ai';\nimport { BiGlobe, BiLayout, BiShieldQuarter, BiUser } from 'react-icons/bi';\n\nimport Title from '@/components/Title';\nimport My from './components/My';\nimport System from './components/System';\nimport Theme from './components/Theme';\nimport Web from './components/Web';\nimport Other from './components/Other';\n\ninterface Setup {\n  title: string;\n  description: string;\n  icon: React.ReactNode;\n  key: string;\n}\n\nexport default () => {\n  const [params, setParams] = useSearchParams();\n  const tabFromUrl = params.get('tab');\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  // 验证 tab 值是否有效，有效配置项的 key 列表\n  const validKeys = ['system', 'web', 'theme', 'my', 'other'];\n  const initialActive = tabFromUrl && validKeys.includes(tabFromUrl) ? tabFromUrl : 'system';\n\n  const [active, setActive] = useState(initialActive);\n\n  // 模拟加载完成\n  useEffect(() => {\n    if (isFirstLoadRef.current) {\n      const timer = setTimeout(() => {\n        setInitialLoading(false);\n        isFirstLoadRef.current = false;\n      }, 300);\n      return () => clearTimeout(timer);\n    }\n  }, []);\n\n  // 监听 URL 参数变化，更新激活的 tab\n  useEffect(() => {\n    if (tabFromUrl && validKeys.includes(tabFromUrl)) {\n      setActive(tabFromUrl);\n    }\n  }, [tabFromUrl]);\n\n  // 处理配置项点击，同时更新状态和 URL\n  const handleTabClick = (key: string) => {\n    setActive(key);\n    setParams({ tab: key });\n  };\n\n  const iconSty = 'w-5 h-8 mr-1';\n\n  const list: Setup[] = [\n    {\n      title: '账户配置',\n      description: '配置管理员账号、密码等',\n      icon: <BiShieldQuarter className={iconSty} />,\n      key: 'system',\n    },\n    {\n      title: '网站配置',\n      description: '配置网站标题、LOGO、描述、SEO等',\n      icon: <BiGlobe className={iconSty} />,\n      key: 'web',\n    },\n    {\n      title: '主题配置',\n      description: '配置网站主题风格',\n      icon: <BiLayout className={iconSty} />,\n      key: 'theme',\n    },\n    {\n      title: '个人配置',\n      description: '配置个人信息等',\n      icon: <BiUser className={iconSty} />,\n      key: 'my',\n    },\n    {\n      title: '其他设置',\n      description: '杂七八乱的各种配置',\n      icon: <AiOutlineSetting className={iconSty} />,\n      key: 'other',\n    },\n  ];\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2\">\n          <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n        </Card>\n\n        <Card className=\"border-stroke mt-2 min-h-[calc(100vh-160px)] [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n          <div className=\"flex flex-col md:flex-row\">\n            {/* 左侧菜单骨架屏 */}\n            <ul className=\"w-full md:w-[20%] md:mr-5 mb-10 md:mb-0 border-b-0 md:border-r border-stroke dark:border-strokedark divide-y divide-solid divide-[#F6F6F6] dark:divide-strokedark\">\n              {[1, 2, 3, 4, 5].map((item) => (\n                <li key={item} className=\"p-3 pl-5\">\n                  <div className=\"flex items-center mb-2\">\n                    <Skeleton.Avatar active size={20} shape=\"square\" style={{ marginRight: 8 }} />\n                    <Skeleton.Input active size=\"small\" style={{ width: 100, height: 20 }} />\n                  </div>\n                  <Skeleton.Input active size=\"small\" style={{ width: 120, height: 16 }} />\n                </li>\n              ))}\n            </ul>\n\n            {/* 右侧内容骨架屏 */}\n            <div className=\"w-full md:w-[80%] px-0 md:px-8 mt-4\">\n              <Skeleton active paragraph={{ rows: 8 }} />\n            </div>\n          </div>\n        </Card>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"系统配置\" />\n\n      <Card className=\"border-stroke mt-2 min-h-[calc(100vh-160px)]\">\n        <div className=\"flex flex-col md:flex-row\">\n          <ul className=\"w-full md:w-[20%] md:mr-5 mb-10 md:mb-0 border-b-0 md:border-r border-stroke dark:border-strokedark divide-y divide-solid divide-[#F6F6F6] dark:divide-strokedark\">\n            {list.map((item) => (\n              <li key={item.key} className={`relative p-3 pl-5 before:content-[''] before:absolute before:top-1/2 before:left-0 before:-translate-y-1/2 before:w-[3.5px] before:h-[0%] before:bg-primary cursor-pointer transition-all ${active === item.key ? 'bg-[#f7f7f8] dark:bg-[#3c5370] before:h-full' : ''}`} onClick={() => handleTabClick(item.key)}>\n                <h3 className=\"flex items-center text-base dark:text-white\">\n                  {item.icon} {item.title}\n                </h3>\n\n                <p className=\"text-[13px] text-gray-500 mt-1\">{item.description}</p>\n              </li>\n            ))}\n          </ul>\n\n          <div className=\"w-full md:w-[80%] px-0 md:px-8\">\n            {active === 'system' && <System />}\n            {active === 'web' && <Web />}\n            {active === 'theme' && <Theme />}\n            {active === 'my' && <My />}\n            {active === 'other' && <Other />}\n          </div>\n        </div>\n      </Card>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/storage/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Button, Form, Input, Popconfirm, message, Card, Modal, Select, Skeleton, Switch, Tooltip } from 'antd';\nimport {\n  DeleteOutlined,\n  EditOutlined,\n  LinkOutlined,\n  GlobalOutlined,\n  CloudOutlined,\n  PlusOutlined,\n  CloudServerOutlined,\n  HddOutlined,\n} from '@ant-design/icons';\nimport { BsDatabase } from 'react-icons/bs';\n\nimport Title from '@/components/Title';\nimport type { Oss } from '@/types/app/oss';\nimport { addOssDataAPI, delOssDataAPI, editOssDataAPI, getOssListAPI, enableOssDataAPI, disableOssDataAPI, getOssDataAPI, getOssPlatformListAPI } from '@/api/oss';\nimport StatusTag from '@/components/StatusTag';\n\nexport default () => {\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState(false);\n  const [editLoading, setEditLoading] = useState(false);\n  const [isModalOpen, setIsModalOpen] = useState(false);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [oss, setOss] = useState<Oss>({} as Oss);\n  const [ossList, setOssList] = useState<Oss[]>([]);\n  const [platformList, setPlatformList] = useState<{ label: string; value: string; disabled: boolean }[]>([]);\n  const [form] = Form.useForm();\n  const [testingMap, setTestingMap] = useState<Record<number, boolean>>({});\n  const [switchLoadingMap, setSwitchLoadingMap] = useState<Record<number, boolean>>({});\n\n  // 获取平台图标\n  const getPlatformIcon = (platform: string) => {\n    switch (platform.toLowerCase()) {\n      case 'local':\n        return <BsDatabase className=\"text-4xl text-yellow-500!\" />;\n      case 'webdav':\n        return <GlobalOutlined className=\"text-4xl text-red-500!\" />;\n      case 'minio':\n        return <HddOutlined className=\"text-4xl text-red-600!\" />;\n      case 'qiniu':\n        return <CloudServerOutlined className=\"text-4xl text-blue-500!\" />;\n      case 'tencent':\n        return <CloudOutlined className=\"text-4xl text-blue-700!\" />;\n      case 'aliyun':\n        return <CloudOutlined className=\"text-4xl text-orange-500!\" />;\n      default:\n        return <CloudOutlined className=\"text-4xl text-blue-500!\" />;\n    }\n  };\n\n  // 测试连接\n  const testConnection = async (record: Oss) => {\n    setTestingMap((prev) => ({ ...prev, [record.id!]: true }));\n    try {\n      // TODO: 实现测试连接的 API 调用\n      // 这里暂时模拟测试\n      await new Promise((resolve) => setTimeout(resolve, 1000));\n      message.success('测试连接成功');\n    } catch {\n      message.error('测试连接失败');\n    } finally {\n      setTestingMap((prev) => ({ ...prev, [record.id!]: false }));\n    }\n  };\n\n  // 获取支持的平台列表\n  const getOssPlatformList = async () => {\n    // 获取已经使用的平台（排除当前正在编辑的平台）\n    const selectPlatformList = ossList\n      .filter((item) => !oss.id || item.id !== oss.id) // 编辑模式下，排除当前编辑项\n      .map((item) => item.platform);\n\n    const { data } = await getOssPlatformListAPI();\n    setPlatformList(\n      data.map((item) => {\n        return (\n          {\n            label: item.name,\n            value: item.value,\n            // 已添加的平台禁用\n            disabled: selectPlatformList.includes(item.value),\n          }\n        )\n      }),\n    );\n  };\n\n  const getOssList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      }\n\n      const { data } = await getOssListAPI();\n      setOssList(data);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getOssList();\n  }, []);\n\n  useEffect(() => {\n    getOssPlatformList();\n  }, [ossList]);\n\n  const enableOssData = async (id: number) => {\n    try {\n      setSwitchLoadingMap((prev) => ({ ...prev, [id]: true }));\n\n      await enableOssDataAPI(id);\n      await getOssList();\n      message.success('启用成功');\n    } catch (error) {\n      console.error(error);\n      message.error('启用失败');\n    } finally {\n      setSwitchLoadingMap((prev) => ({ ...prev, [id]: false }));\n    }\n  };\n\n  const disableOssData = async (id: number) => {\n    try {\n      setSwitchLoadingMap((prev) => ({ ...prev, [id]: true }));\n\n      await disableOssDataAPI(id);\n      await getOssList();\n      message.success('禁用成功');\n    } catch (error) {\n      console.error(error);\n      message.error('禁用失败');\n    } finally {\n      setSwitchLoadingMap((prev) => ({ ...prev, [id]: false }));\n    }\n  };\n\n  const editOssData = async (record: Oss) => {\n    try {\n      setEditLoading(true);\n\n      setIsModalOpen(true);\n\n      const { data } = await getOssDataAPI(record.id);\n      setOss(data);\n      form.setFieldsValue(data);\n\n      setEditLoading(false);\n    } catch (error) {\n      console.error(error);\n      setEditLoading(false);\n    }\n  };\n\n  const delOssData = async (id: number) => {\n    try {\n      await delOssDataAPI(id);\n      await getOssList();\n      await getOssPlatformList();\n      message.success('🎉 删除成功');\n    } catch (error) {\n      console.error(error);\n    }\n  };\n\n  const addOssData = () => {\n    setOss({} as Oss);\n    form.resetFields();\n    form.setFieldsValue({});\n    setIsModalOpen(true);\n  };\n\n  const handleCancel = () => {\n    setIsModalOpen(false);\n    form.resetFields();\n    setOss({} as Oss);\n  };\n\n  const onSubmit = async () => {\n    try {\n      setBtnLoading(true);\n\n      const values = await form.validateFields();\n\n      if (oss.id) {\n        await editOssDataAPI({ ...oss, ...values });\n        message.success('🎉 编辑成功');\n      } else {\n        await addOssDataAPI(values);\n        message.success('🎉 新增成功');\n      }\n\n      await getOssList();\n      await getOssPlatformList();\n      setIsModalOpen(false);\n      form.resetFields();\n\n      setBtnLoading(false);\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n  };\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        <Title value=\"存储管理\" />\n        <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 mt-2\">\n          {[1, 2, 3, 4, 5, 6].map((item) => (\n            <Card key={item} className=\"shadow-md dark:bg-boxdark dark:border-strokedark rounded-xl\">\n              <Skeleton active paragraph={{ rows: 4 }} />\n            </Card>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"存储管理\" />\n\n      <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 mt-2\">\n        {/* 存储配置卡片 */}\n        {ossList.map((record) => (\n          <div\n            key={record.id}\n            className={`relative p-5 rounded-xl shadow-xs hover:shadow-md transition-all duration-300 overflow-hidden ${record.isEnable\n              ? 'border-2 border-blue-500 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-blue-500'\n              : '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'\n              }`}\n          >\n            {/* 背景装饰元素 */}\n            <div className=\"absolute top-0 right-0 w-32 h-32 opacity-20 dark:opacity-10\">\n              <div className=\"absolute top-4 right-4 w-16 h-16 rounded-full bg-linear-to-br from-blue-200 to-purple-200 dark:from-blue-500/30 dark:to-purple-500/30 blur-xl\"></div>\n              <div className=\"absolute top-8 right-8 w-8 h-8 rounded-full bg-linear-to-br from-pink-200 to-orange-200 dark:from-pink-500/30 dark:to-orange-500/30 blur-lg\"></div>\n            </div>\n            <div className=\"absolute bottom-0 left-0 w-24 h-24 opacity-15 dark:opacity-10\">\n              <div className=\"absolute bottom-4 left-4 w-12 h-12 rounded-full bg-linear-to-br from-cyan-200 to-blue-200 dark:from-cyan-500/30 dark:to-blue-500/30 blur-xl\"></div>\n            </div>\n\n            {/* 小装饰点 */}\n            <div className=\"absolute top-6 right-6 w-2 h-2 rounded-full bg-blue-300 dark:bg-blue-500/40 opacity-40\"></div>\n            <div className=\"absolute top-12 right-12 w-1.5 h-1.5 rounded-full bg-purple-300 dark:bg-purple-500/40 opacity-40\"></div>\n            <div className=\"absolute bottom-8 left-8 w-1.5 h-1.5 rounded-full bg-cyan-300 dark:bg-cyan-500/40 opacity-40\"></div>\n\n            {/* 内容区域 - 添加相对定位以确保内容在装饰元素之上 */}\n            <div className=\"relative z-10\">\n              {/* 标题区域 */}\n              <div className=\"flex items-start justify-between mb-4\">\n                <div className=\"flex items-center gap-3\">\n                  {getPlatformIcon(record.platform)}\n                  <div>\n                    <div className=\"font-semibold text-lg dark:text-white\">\n                      {record.platform === 'local'\n                        ? '本地存储'\n                        : (record.platformName || record.platform)}\n                    </div>\n                    <div className=\"text-sm text-gray-500 dark:text-gray-400 mt-1\">\n                      {record.platform === 'local'\n                        ? '本地存储'\n                        : (record.platform === 'webdav' ? 'WebDAV' : record.platformName || '云存储')}\n                    </div>\n                  </div>\n                </div>\n\n                <div className=\"flex items-center gap-1\">\n                  <StatusTag status={record.isEnable} flash={record.isEnable ? true : false} />\n                </div>\n              </div>\n\n              {/* 内容区域 */}\n              <div className=\"mb-4 space-y-2\">\n                <div>\n                  <div className=\"text-xs text-gray-600 dark:text-gray-400 mb-2\">存储路径</div>\n                  <div className=\"text-sm font-mono bg-white/60 dark:bg-boxdark-2/60 backdrop-blur-xs p-2 rounded-sm break-all border border-gray-100 dark:border-strokedark dark:text-gray-300\">{record.basePath || '/uploads'}</div>\n                </div>\n              </div>\n\n              {/* 操作按钮区域 */}\n              <div className=\"flex items-center justify-between pt-4 border-t border-gray-200/50 dark:border-strokedark/50\">\n                <div className=\"flex items-center gap-2\">\n                  <Tooltip title=\"测试连接\">\n                    <Button\n                      icon={<LinkOutlined />}\n                      loading={testingMap[record.id!]}\n                      onClick={() => testConnection(record)}\n                      className=\"flex items-center\"\n                    >\n                      测试\n                    </Button>\n                  </Tooltip>\n\n                  <Tooltip title=\"编辑配置\">\n                    <Button\n                      color=\"primary\"\n                      icon={<EditOutlined />}\n                      onClick={() => editOssData(record)}\n                      className=\"flex items-center\"\n                    >\n                      编辑\n                    </Button>\n                  </Tooltip>\n\n                  <Popconfirm\n                    title=\"警告\"\n                    description=\"你确定要删除吗\"\n                    okText=\"确定\"\n                    cancelText=\"取消\"\n                    onConfirm={() => delOssData(record.id!)}\n                  >\n                    <Tooltip title=\"编辑配置\">\n                      <Button\n                        danger\n                        icon={<DeleteOutlined />}\n                        className=\"flex items-center\"\n                      >\n                        删除\n                      </Button>\n                    </Tooltip>\n                  </Popconfirm>\n                </div>\n\n                <div className=\"flex items-center gap-2\">\n                  <Switch\n                    checked={!!record.isEnable}\n                    loading={switchLoadingMap[record.id!]}\n                    onChange={(checked) => {\n                      if (checked) {\n                        enableOssData(record.id!);\n                      } else {\n                        disableOssData(record.id!);\n                      }\n                    }}\n                  />\n                </div>\n              </div>\n            </div>\n          </div>\n        ))}\n\n        {/* 添加存储配置卡片 */}\n        <div\n          className=\"group flex flex-col justify-center items-center text-gray-400 dark:text-gray-500 bg-white dark:bg-boxdark p-5 rounded-xl shadow-xs hover:shadow-md transition-shadow border-2 border-dashed border-gray-300 dark:border-strokedark cursor-pointer hover:border-primary dark:hover:border-primary\"\n          onClick={addOssData}\n        >\n          <PlusOutlined className=\"text-2xl text-gray-400 dark:text-gray-500 mb-2 group-hover:text-primary dark:group-hover:text-primary\" />\n          <div className=\"text-sm font-medium mb-2 group-hover:text-primary dark:group-hover:text-primary\">添加新存储</div>\n        </div>\n      </div>\n\n      <Modal loading={editLoading} title={oss.id ? '编辑存储' : '新增存储'} open={isModalOpen} onCancel={handleCancel} footer={null}>\n        <Form form={form} layout=\"vertical\" onFinish={onSubmit} size=\"large\" className=\"mt-6\">\n          {!oss.id && (\n            <Form.Item label=\"选择平台\" name=\"platform\" rules={[{ required: true, message: '平台不能为空' }]} className=\"w-full\">\n              <Select options={platformList} placeholder=\"请选择平台\" allowClear />\n            </Form.Item>\n          )}\n\n          <Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.platform !== currentValues.platform || oss.platform !== currentValues.platform}>\n            {({ getFieldValue }) => {\n              const platform = getFieldValue('platform') || oss.platform;\n              return platform !== 'local' ? (\n                <>\n                  <Form.Item\n                    label=\"Access Key\"\n                    name=\"accessKey\"\n                    rules={[\n                      { required: true, message: 'Access Key 不能为空' },\n                      { min: 10, max: 50, message: 'Access Key 限制在10~50个字符' },\n                    ]}\n                  >\n                    <Input placeholder=\"请输入Access Key\" autoComplete=\"off\" />\n                  </Form.Item>\n\n                  <Form.Item label=\"SecretKey\" name=\"secretKey\" rules={[{ required: true, message: 'SecretKey不能为空' }]}>\n                    <Input.Password placeholder=\"请输入SecretKey\" autoComplete=\"new-password\" />\n                  </Form.Item>\n\n                  <Form.Item label=\"地域\" name=\"endPoint\" rules={[{ required: true, message: '地域不能为空' }]}>\n                    <Input placeholder=\"请输入地域\" />\n                  </Form.Item>\n\n                  <Form.Item label=\"存储桶\" name=\"bucketName\" rules={[{ required: true, message: '存储桶不能为空' }]}>\n                    <Input placeholder=\"请输入存储桶\" />\n                  </Form.Item>\n                </>\n              ) : null;\n            }}\n          </Form.Item>\n\n          <Form.Item label=\"域名\" name=\"domain\" rules={[{ required: true, message: '域名不能为空' }]}>\n            <Input placeholder=\"请输入域名\" />\n          </Form.Item>\n\n          <Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.platform !== currentValues.platform || oss.platform !== currentValues.platform}>\n            {({ getFieldValue }) => {\n              const platform = getFieldValue('platform') || oss.platform;\n              return (\n                <Form.Item\n                  label={platform === 'local' ? '存储路径' : '文件目录'}\n                  name=\"basePath\"\n                  rules={[{ required: true, message: platform === 'local' ? '存储路径不能为空' : '文件目录不能为空' }]}\n                >\n                  <Input placeholder={platform === 'local' ? '请输入存储路径，如：/uploads' : '请输入文件目录'} />\n                </Form.Item>\n              );\n            }}\n          </Form.Item>\n\n          <Form.Item className=\"mb-0\">\n            <Button type=\"primary\" htmlType=\"submit\" loading={btnLoading} className=\"w-full\">\n              确定\n            </Button>\n          </Form.Item>\n        </Form>\n      </Modal>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/swiper/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Table, Button, Image, Form, Input, Tabs, Popconfirm, message, Spin, Tooltip, Divider, Space } from 'antd';\nimport { getSwiperListAPI, addSwiperDataAPI, editSwiperDataAPI, delSwiperDataAPI, getSwiperDataAPI } from '@/api/swiper';\nimport { Swiper } from '@/types/app/swiper';\nimport Title from '@/components/Title';\nimport { ColumnsType } from 'antd/es/table';\nimport { CloudUploadOutlined, DeleteOutlined, FormOutlined, PictureOutlined } from '@ant-design/icons';\nimport Material from '@/components/Material';\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState(false);\n  const [editLoading, setEditLoading] = useState(false);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [form] = Form.useForm();\n\n  const [swiper, setSwiper] = useState<Swiper>({} as Swiper);\n  const [list, setList] = useState<Swiper[]>([]);\n  const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);\n  const [tab, setTab] = useState<string>('list');\n\n  const columns: ColumnsType<Swiper> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      align: 'center',\n      width: 80,\n      render: (text: number) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '图片',\n      dataIndex: 'image',\n      key: 'image',\n      width: 200,\n      align: 'center',\n      render: (url: string) => <Image width={180} src={url} className=\"w-full rounded-sm cursor-pointer\" alt=\"\" />,\n    },\n    {\n      title: '标题',\n      dataIndex: 'title',\n      key: 'title',\n      width: 230,\n      render: (text: string) => (\n        <Tooltip title={text}>\n          <span className=\"line-clamp-1 text-gray-700 dark:text-gray-200 font-medium hover:text-primary cursor-pointer\">{text}</span>\n        </Tooltip>\n      ),\n    },\n    {\n      title: '描述',\n      dataIndex: 'description',\n      key: 'description',\n      width: 300,\n      render: (text: string) => (\n        <>\n          {text ? (\n            <Tooltip title={text}>\n              <span className=\"line-clamp-1 text-gray-600 dark:text-gray-300 hover:text-primary cursor-pointer\">{text}</span>\n            </Tooltip>\n          ) : (\n            <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无描述</span>\n          )}\n        </>\n      ),\n    },\n    {\n      title: '操作',\n      key: 'action',\n      align: 'center',\n      fixed: 'right',\n      width: 130,\n      render: (_: string, record: Swiper) => (\n        <Space split={<Divider type=\"vertical\" />}>\n          <Tooltip title=\"编辑\">\n            <Button type=\"text\" onClick={() => editSwiperData(record)} icon={<FormOutlined className=\"text-blue-500\" />} />\n          </Tooltip>\n\n          <Tooltip title=\"删除\">\n            <Popconfirm title=\"警告\" description=\"你确定要删除吗\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delSwiperData(record.id!)}>\n              <Button type=\"text\" danger icon={<DeleteOutlined />} />\n            </Popconfirm>\n          </Tooltip>\n        </Space>\n      ),\n    },\n  ];\n\n  const getSwiperList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getSwiperListAPI();\n      setList(data as Swiper[]);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getSwiperList();\n  }, []);\n\n  const editSwiperData = async (record: Swiper) => {\n    try {\n      setEditLoading(true);\n      setTab('operate');\n\n      const { data } = await getSwiperDataAPI(record.id);\n      setSwiper(data);\n      form.setFieldsValue(record);\n\n      setEditLoading(false);\n    } catch (error) {\n      console.error(error);\n      setEditLoading(false);\n    }\n  };\n\n  const delSwiperData = async (id: number) => {\n    try {\n      setBtnLoading(true);\n      await delSwiperDataAPI(id);\n      getSwiperList();\n      message.success('🎉 删除轮播图成功');\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setBtnLoading(false);\n    }\n  };\n\n  const onSubmit = async () => {\n    try {\n      setBtnLoading(true);\n      await form.validateFields().then(async (values: Swiper) => {\n        if (swiper.id) {\n          await editSwiperDataAPI({ ...swiper, ...values });\n          message.success('🎉 编辑轮播图成功');\n        } else {\n          await addSwiperDataAPI({ ...swiper, ...values });\n          message.success('🎉 新增轮播图成功');\n        }\n\n        getSwiperList();\n        setTab('list');\n        form.resetFields();\n        setSwiper({} as Swiper);\n      });\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setBtnLoading(false);\n    }\n  };\n\n  const handleTabChange = (key: string) => {\n    setTab(key);\n    form.resetFields();\n    setSwiper({} as Swiper);\n  };\n\n  // 文件上传\n  const UploadBtn = () => <CloudUploadOutlined className=\"text-xl cursor-pointer\" onClick={() => setIsMaterialModalOpen(true)} />;\n\n  const tabItems = [\n    {\n      label: '轮播图列表',\n      key: 'list',\n      children: (\n        <Table\n          rowKey=\"id\"\n          dataSource={list}\n          columns={columns}\n          loading={loading}\n          scroll={{ x: 900 }}\n          pagination={{\n            position: ['bottomRight'],\n            pageSize: 8,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                共 {totalCount} 条数据\n              </div>\n            ),\n            className: 'px-6! py-4!',\n          }}\n          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! w-full\"\n        />\n      ),\n    },\n    {\n      label: swiper.id ? '编辑轮播图' : '新增轮播图',\n      key: 'operate',\n      children: (\n        <Spin spinning={editLoading}>\n          <h2 className=\"text-xl pb-4 pt-8 text-center text-gray-800 dark:text-gray-100\">{swiper.id ? '编辑轮播图' : '新增轮播图'}</h2>\n\n          <Form form={form} layout=\"vertical\" initialValues={swiper} onFinish={onSubmit} size=\"large\" className=\"max-w-md mx-auto px-6 pb-6\">\n            <Form.Item label=\"标题\" name=\"title\" rules={[{ required: true, message: '轮播图标题不能为空' }]}>\n              <Input placeholder=\"要么沉沦 要么巅峰!\" />\n            </Form.Item>\n\n            <Form.Item label=\"描述\" name=\"description\">\n              <Input placeholder=\"Either sink or peak!\" />\n            </Form.Item>\n\n            <Form.Item label=\"链接\" name=\"url\">\n              <Input placeholder=\"https://liuyuyang.net/\" />\n            </Form.Item>\n\n            <Form.Item label=\"图片\" name=\"image\" rules={[{ required: true, message: '轮播图地址不能为空' }]}>\n              <Input placeholder=\"https://liuyuyang.net/swiper.jpg\" prefix={<PictureOutlined />} addonAfter={<UploadBtn />} className=\"customizeAntdInputAddonAfter\" />\n            </Form.Item>\n\n            <Form.Item>\n              <Button type=\"primary\" htmlType=\"submit\" loading={btnLoading} className=\"w-full\">\n                确定\n              </Button>\n            </Form.Item>\n          </Form>\n        </Spin>\n      ),\n    },\n  ];\n\n  // 初始加载时显示骨架屏（与 article 一致）\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"flex gap-4 mb-6\">\n            <div className=\"skeleton h-9 rounded-md\" style={{ width: 120 }} />\n            <div className=\"skeleton h-9 rounded-md\" style={{ width: 140 }} />\n          </div>\n\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"轮播图管理\" />\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <Tabs activeKey={tab} onChange={handleTabChange} items={tabItems} className=\"[&_.ant-tabs-nav]:mb-0 [&_.ant-tabs-nav]:px-6 [&_.ant-tabs-nav]:pt-4 [&_.ant-tabs-nav]:bg-gray-50/30 dark:[&_.ant-tabs-nav]:bg-boxdark-2/50 [&_.ant-tabs-content]:pt-0\" />\n      </div>\n\n      <Material\n        // multiple\n        open={isMaterialModalOpen}\n        onClose={() => setIsMaterialModalOpen(false)}\n        onSelect={(url) => {\n          form.setFieldValue('image', url.join('\\n'));\n          form.validateFields(['image']); // 手动触发 image 字段的校验\n        }}\n      />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/tag/index.tsx",
    "content": "import { useState, useEffect, useRef } from 'react';\nimport { Table, Button, Form, Input, Popconfirm, message, Card, Spin, Skeleton, Tooltip } from 'antd';\nimport { getTagListAPI, addTagDataAPI, editTagDataAPI, delTagDataAPI, getTagDataAPI } from '@/api/tag';\nimport { Tag } from '@/types/app/tag';\nimport Title from '@/components/Title';\nimport { ColumnsType } from 'antd/es/table';\nimport { DeleteOutlined, FormOutlined } from '@ant-design/icons';\n\nexport default () => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState(false);\n  const [editLoading, setEditLoading] = useState(false);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [form] = Form.useForm();\n\n  const [tag, setTag] = useState<Tag>({} as Tag);\n  const [list, setList] = useState<Tag[]>([]);\n\n  const columns: ColumnsType<Tag> = [\n    {\n      title: 'ID',\n      width: 100,\n      key: 'id',\n      dataIndex: 'id',\n      align: 'center',\n    },\n    {\n      title: '标签名称',\n      key: 'name',\n      dataIndex: 'name',\n      width: 200,\n      align: 'center',\n      render: (text: string) => (\n        <Tooltip title={text}>\n          <div className=\"max-w-[200px] truncate text-gray-700 dark:text-gray-200 hover:text-primary cursor-pointer\">\n            {text}\n          </div>\n        </Tooltip>\n      ),\n    },\n    {\n      title: '文章数量',\n      key: 'count',\n      dataIndex: 'count',\n    },\n    {\n      title: '操作',\n      key: 'action',\n      align: 'center',\n      width: 130,\n      render: (_: string, record: Tag) => (\n        <div className=\"space-x-2\">\n          <Tooltip title=\"编辑\">\n            <Button type=\"text\" onClick={() => editTagData(record)} icon={<FormOutlined className=\"text-blue-500\" />} />\n          </Tooltip>\n\n          <Tooltip title=\"删除\">\n            <Popconfirm title=\"警告\" description=\"你确定要删除吗\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delTagData(record.id!)}>\n              <Button type=\"text\" danger icon={<DeleteOutlined />} />\n            </Popconfirm>\n          </Tooltip>\n        </div>\n      ),\n    },\n  ];\n\n  const getTagList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      // 否则使用 loading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getTagListAPI();\n      setList(data as Tag[]);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    getTagList();\n  }, []);\n\n  const editTagData = async (record: Tag) => {\n    try {\n      setEditLoading(true);\n\n      const { data } = await getTagDataAPI(record.id);\n      setTag(data);\n      form.setFieldsValue(data);\n\n      setEditLoading(false);\n    } catch (error) {\n      console.error(error);\n      setEditLoading(false);\n    }\n  };\n\n  const delTagData = async (id: number) => {\n    try {\n      setLoading(true);\n\n      await delTagDataAPI(id);\n      getTagList();\n      message.success('🎉 删除标签成功');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  const onSubmit = async () => {\n    try {\n      setLoading(true);\n      setBtnLoading(true);\n\n      form.validateFields().then(async (values: Tag) => {\n        if (tag.id) {\n          await editTagDataAPI({ ...tag, ...values });\n          message.success('🎉 编辑标签成功');\n        } else {\n          await addTagDataAPI(values);\n          \n          message.success('🎉 新增标签成功');\n        }\n\n        getTagList();\n        form.resetFields();\n        form.setFieldsValue({ name: '' });\n        setTag({} as Tag);\n      });\n\n      setLoading(false);\n      setBtnLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n      setBtnLoading(false);\n    }\n  };\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2\">\n          <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n        </Card>\n\n        <div className=\"flex md:justify-between flex-col md:flex-row mx-auto mt-2 h-[calc(100vh-180px)]\">\n          {/* 左侧表单卡片骨架屏 */}\n          <div className=\"w-full md:w-[40%]\">\n            <Card className=\"border-stroke w-full h-46 [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n              <Skeleton style={{ width: '100%', height: 30 }} />\n            </Card>\n          </div>\n\n          {/* 右侧表格卡片骨架屏 */}\n          <Card className=\"border-stroke w-full md:w-[59%] [&>.ant-card-body]:p-0! mt-2 md:mt-0\">\n            {/* 表格行骨架屏 - 模拟多行 */}\n            {[1, 2, 3, 4, 5, 6, 7, 8].map((item) => (\n              <div key={item} className=\"flex items-center gap-4 mb-2 py-2 px-4 border-b border-gray-100\">\n                <Skeleton.Input active size=\"small\" style={{ width: 60, height: 20 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 150, height: 20, flex: 1 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 100, height: 20 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 80, height: 20 }} />\n                <Skeleton.Input active size=\"small\" style={{ width: 110, height: 20 }} />\n              </div>\n            ))}\n            {/* 分页骨架屏 */}\n            <div className=\"flex justify-center my-5\">\n              <Skeleton.Input active size=\"default\" style={{ width: 300, height: 32 }} />\n            </div>\n          </Card>\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"标签管理\" />\n\n      <div className=\"flex md:justify-between flex-col md:flex-row mx-auto mt-2 h-[calc(100vh-180px)]\">\n        <div className=\"w-full md:w-[40%]\">\n          <Spin spinning={editLoading}>\n            <Card className=\"border-stroke w-full h-46\">\n              <Form form={form} layout=\"vertical\" initialValues={tag} onFinish={onSubmit} size=\"large\">\n                <Form.Item label=\"标签名称\" name=\"name\" rules={[{ required: true, message: '标签名称不能为空' }]}>\n                  <Input placeholder=\"请输入标签名称\" />\n                </Form.Item>\n\n                <Form.Item>\n                  <Button type=\"primary\" htmlType=\"submit\" loading={btnLoading} className=\"w-full\">\n                    {tag.id ? '编辑标签' : '新增标签'}\n                  </Button>\n                </Form.Item>\n              </Form>\n            </Card>\n          </Spin>\n        </div>\n\n        <Card className=\"border-stroke w-full md:w-[59%] [&>.ant-card-body]:p-0! mt-2 md:mt-0\">\n          <Table\n            rowKey=\"id\"\n            dataSource={list}\n            columns={columns}\n            scroll={{ x: 'max-content' }}\n            pagination={{\n              position: ['bottomCenter'],\n              pageSize: 8,\n            }}\n            loading={loading}\n          />\n        </Card>\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/wall/index.tsx",
    "content": "import { useEffect, useState, useRef } from 'react';\n\nimport { Button, DatePicker, Form, Input, Modal, Popconfirm, Select, Table, Tag, message, Tooltip } from 'antd';\nimport dayjs from 'dayjs';\nimport TextArea from 'antd/es/input/TextArea';\nimport { DeleteOutlined, SendOutlined, StarFilled, StarOutlined, SearchOutlined, ClearOutlined } from '@ant-design/icons';\n\nimport { getWallListAPI, delWallDataAPI, getWallCateListAPI, updateChoiceAPI } from '@/api/wall';\nimport { sendReplyWallEmailAPI } from '@/api/email';\nimport Title from '@/components/Title';\nimport { useWebStore } from '@/stores';\nimport type { Cate, Wall, FilterForm, FilterWall } from '@/types/app/wall';\nimport { ColumnsType } from 'antd/es/table';\n\nexport default () => {\n  const web = useWebStore((state) => state.web);\n\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [wall, setWall] = useState<Wall>({} as Wall);\n  const [list, setList] = useState<Wall[]>([]);\n\n  const [replyInfo, setReplyInfo] = useState('');\n  const [isReplyModalOpen, setIsReplyModalOpen] = useState(false);\n\n  const getWallList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getWallListAPI();\n      setList(data);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  const delWallData = async (id: number) => {\n    setLoading(true);\n\n    try {\n      await delWallDataAPI(id);\n      getWallList();\n      message.success('🎉 删除留言成功');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n\n    setLoading(false);\n  };\n\n  // 获取留言的分类列表\n  const [cateList, setCateList] = useState<Cate[]>([]);\n  const getCateList = async () => {\n    const { data } = await getWallCateListAPI();\n    setCateList((data as Cate[]).filter((item) => item.id !== 1));\n  };\n\n  useEffect(() => {\n    getWallList();\n    getCateList();\n  }, []);\n\n  const [filterForm] = Form.useForm();\n\n  const onFilterReset = () => {\n    filterForm.resetFields();\n    getWallList();\n  };\n\n  const columns: ColumnsType<Wall> = [\n    {\n      title: 'ID',\n      dataIndex: 'id',\n      key: 'id',\n      align: 'center',\n      width: 80,\n      render: (text: number) => <span className=\"text-gray-400 dark:text-gray-500 font-mono\">#{text}</span>,\n    },\n    {\n      title: '分类',\n      dataIndex: 'cate',\n      key: 'cate',\n      width: 100,\n      render: ({ name }: { name: string }, { color }: Wall) => (\n        <Tag bordered={false} color={color} className=\"text-[#565656]! dark:text-white! m-0!\">\n          {name}\n        </Tag>\n      ),\n    },\n    {\n      title: '名称',\n      dataIndex: 'name',\n      key: 'name',\n      width: 120,\n      render: (text: string) => <span className=\"text-gray-700 dark:text-gray-200 font-medium\">{text || '-'}</span>,\n    },\n    {\n      title: '内容',\n      dataIndex: 'content',\n      key: 'content',\n      width: 320,\n      render: (text: string, record: Wall) => (\n        <>\n          {text ? (\n            <Tooltip\n              title={text}\n            >\n              <span className=\"hover:text-primary cursor-pointer line-clamp-1 text-gray-700 dark:text-gray-200\"\n                onClick={() => {\n                  setWall(record);\n                }}>{text}</span>\n            </Tooltip>\n          )\n            : (\n              <span className=\"text-gray-300 dark:text-gray-500 italic\">暂无内容</span>\n            )\n          }\n        </>\n      ),\n    },\n    {\n      title: '邮箱',\n      dataIndex: 'email',\n      key: 'email',\n      width: 180,\n      render: (text: string) => <span className=\"text-gray-500 dark:text-gray-400\">{text || '暂无邮箱'}</span>,\n    },\n    {\n      title: '留言时间',\n      dataIndex: 'createTime',\n      key: 'createTime',\n      width: 180,\n      render: (date: string) => <span className=\"text-gray-500 dark:text-gray-400\">{dayjs(+date).format('YYYY-MM-DD HH:mm:ss')}</span>,\n      sorter: (a: Wall, b: Wall) => +a.createTime! - +b.createTime!,\n      showSorterTooltip: false,\n    },\n    {\n      title: '操作',\n      key: 'action',\n      fixed: 'right',\n      align: 'center',\n      width: 130,\n      render: (_: string, record: Wall) => (\n        <div className=\"flex justify-center space-x-2\">\n          <Tooltip title={record.isChoice === 1 ? '取消精选' : '设为精选'}>\n            <Button\n              type=\"text\"\n              onClick={async () => {\n                try {\n                  setLoading(true);\n                  await updateChoiceAPI(record.id);\n                  message.success('🎉 操作成功');\n                  getWallList();\n                } catch (error) {\n                  console.error(error);\n                } finally {\n                  setLoading(false);\n                }\n              }}\n              icon={record.isChoice === 1 ? <StarFilled className=\"text-yellow-400\" /> : <StarOutlined />}\n            />\n          </Tooltip>\n\n          <Tooltip title=\"回复\">\n            <Button\n              type=\"text\"\n              onClick={() => {\n                setWall(record);\n                setIsReplyModalOpen(true);\n              }}\n              icon={<SendOutlined className=\"text-primary\" />}\n            />\n          </Tooltip>\n\n          <Popconfirm title=\"警告\" description=\"你确定要删除吗\" okText=\"确定\" cancelText=\"取消\" onConfirm={() => delWallData(record.id)}>\n            <Tooltip title=\"删除\">\n              <Button type=\"text\" danger icon={<DeleteOutlined />} />\n            </Tooltip>\n          </Popconfirm>\n        </div>\n      ),\n    },\n  ];\n\n  const { RangePicker } = DatePicker;\n\n  const onFilterSubmit = async (values: FilterForm) => {\n    try {\n      setLoading(true);\n\n      const query: FilterWall = {\n        key: values.content,\n        cateId: values.cateId,\n        startDate: values.createTime?.[0]?.valueOf()?.toString(),\n        endDate: values.createTime?.[1]?.valueOf()?.toString(),\n      };\n\n      const { data } = await getWallListAPI({ query });\n      setList(data);\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // 回复留言\n  const onHandleReply = async () => {\n    try {\n      setLoading(true);\n\n      await sendReplyWallEmailAPI({\n        to: wall?.email,\n        recipient: wall?.name,\n        your_content: wall?.content,\n        reply_content: replyInfo,\n        time: dayjs(+wall?.createTime).format('YYYY-MM-DD HH:mm:ss'),\n        url: web.url + '/wall/all',\n      });\n\n      message.success('🎉 回复留言成功');\n      setIsReplyModalOpen(false);\n      setReplyInfo('');\n      getWallList();\n\n      setLoading(false);\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  // 初始加载时显示骨架屏（与 article 一致）\n  if (initialLoading) {\n    return (\n      <div className=\"space-y-2\">\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"skeleton h-8\" style={{ width: 200 }} />\n        </div>\n\n        <div className=\"px-6 py-3 bg-white dark:bg-boxdark rounded-xl shadow-xs border border-gray-100 dark:border-strokedark\">\n          <div className=\"flex justify-between mb-6\">\n            <div className=\"flex gap-4 flex-wrap\">\n              <div className=\"skeleton h-9\" style={{ width: 200 }} />\n              <div className=\"skeleton h-9\" style={{ width: 180 }} />\n              <div className=\"skeleton h-9\" style={{ width: 180 }} />\n              <div className=\"skeleton h-9\" style={{ width: 280 }} />\n            </div>\n            <div className=\"flex gap-2\">\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n              <div className=\"skeleton h-9 rounded-md\" style={{ width: 80 }} />\n            </div>\n          </div>\n\n          {[1, 2, 3, 4, 5, 6, 7, 8].map((i) => (\n            <div key={i} className=\"flex gap-4 mb-4 items-center\">\n              <div className=\"skeleton shrink-0 rounded-lg\" style={{ width: 56, height: 56 }} />\n              <div className=\"flex-1 space-y-2 min-w-0\">\n                <div className=\"skeleton h-4 w-full rounded-sm\" />\n                <div className=\"skeleton h-3 rounded-sm\" style={{ width: '60%' }} />\n              </div>\n            </div>\n          ))}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"mx-auto\">\n      <Title value=\"留言管理\" />\n\n      <div className=\"bg-white dark:bg-boxdark rounded-2xl shadow-xs border border-gray-100 dark:border-strokedark overflow-hidden\">\n        <div className=\"p-5 border-b border-gray-100 dark:border-strokedark bg-gray-50/30 dark:bg-boxdark-2/50 space-y-4\">\n          <Form form={filterForm} layout=\"inline\" onFinish={onFilterSubmit} className=\"flex! flex-wrap! items-center! gap-y-2.5!\">\n            <Form.Item name=\"content\" className=\"mb-0!\">\n              <Input\n                prefix={<SearchOutlined className=\"text-gray-400 dark:text-gray-500\" />}\n                placeholder=\"搜索留言内容...\"\n                className=\"w-[220px]!\"\n                allowClear\n              />\n            </Form.Item>\n            <Form.Item name=\"cateId\" className=\"mb-0!\">\n              <Select\n                allowClear\n                options={cateList}\n                fieldNames={{ label: 'name', value: 'id' }}\n                placeholder=\"选择分类\"\n                className=\"w-[160px]!\"\n              />\n            </Form.Item>\n            <Form.Item name=\"createTime\" className=\"mb-0!\">\n              <RangePicker\n                className=\"w-[260px]!\"\n                placeholder={['开始日期', '结束日期']}\n                disabledDate={(current) => current && current > dayjs().endOf('day')}\n              />\n            </Form.Item>\n\n            <div className=\"flex gap-2\">\n              <Button type=\"primary\" htmlType=\"submit\" icon={<SearchOutlined />}>\n                查询\n              </Button>\n              <Button icon={<ClearOutlined />} onClick={onFilterReset}>\n                重置\n              </Button>\n            </div>\n          </Form>\n        </div>\n\n        <Table\n          rowKey=\"id\"\n          dataSource={list}\n          columns={columns}\n          loading={loading}\n          scroll={{ x: 1200 }}\n          pagination={{\n            position: ['bottomRight'],\n            defaultPageSize: 8,\n            showTotal: (totalCount) => (\n              <div className=\"mt-[9px] text-xs text-gray-500 dark:text-gray-400\">\n                共 {totalCount} 条数据\n              </div>\n            ),\n            className: 'px-6! py-4!',\n          }}\n          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!\"\n        />\n      </div>\n\n      <Modal title=\"回复留言\" open={isReplyModalOpen} footer={null} onCancel={() => setIsReplyModalOpen(false)}>\n        <TextArea value={replyInfo} onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => setReplyInfo(e.target.value)} placeholder=\"请输入回复内容\" autoSize={{ minRows: 3, maxRows: 5 }} />\n\n        <div className=\"flex space-x-4\">\n          <Button className=\"w-full mt-2\" onClick={() => setIsReplyModalOpen(false)}>\n            取消\n          </Button>\n          <Button type=\"primary\" loading={loading} onClick={onHandleReply} className=\"w-full mt-2\">\n            确定\n          </Button>\n        </div>\n      </Modal>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/web/index.tsx",
    "content": "import { useEffect, useState, useRef } from 'react';\n\nimport { Button, Card, Empty, Form, Input, Popconfirm, Select, Spin, Modal, message, Skeleton } from 'antd';\nimport { SearchOutlined } from '@ant-design/icons';\n\nimport { getLinkListAPI, addLinkDataAPI, editLinkDataAPI, delLinkDataAPI, getWebTypeListAPI } from '@/api/web';\nimport Title from '@/components/Title';\nimport { WebType, Web } from '@/types/app/web';\nimport { RuleObject } from 'antd/es/form';\n\nimport GroupSvg from './assets/svg/group.svg';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const [btnLoading, setBtnLoading] = useState(false);\n  const [editLoading, setEditLoading] = useState(false);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const [form] = Form.useForm();\n\n  const [list, setList] = useState<{ [key: string]: Web[] }>({});\n  const [listTemp, setListTemp] = useState<Web[]>([]);\n  const [typeList, setTypeList] = useState<WebType[]>([]);\n  const [search, setSearch] = useState<string>('');\n  const [link, setLink] = useState<Web>({} as Web);\n  const [modalVisible, setModalVisible] = useState<boolean>(false);\n\n  // 区分新增或编辑\n  const [isMethod, setIsMethod] = useState<'create' | 'edit'>('create');\n\n  // 获取网站列表\n  const getLinkList = async () => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      const { data } = await getLinkListAPI();\n      data.sort((a, b) => a.order - b.order);\n      data.sort((a, b) => a.type.order - b.type.order);\n\n      const grouped = data.reduce(\n        (acc, item) => {\n          const groupName = item.type.name;\n          if (!acc[groupName]) {\n            acc[groupName] = [];\n          }\n          acc[groupName].push(item);\n          return acc;\n        },\n        {} as { [key: string]: Web[] },\n      );\n\n      setList(grouped);\n      setListTemp(data);\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  // 获取网站类型列表\n  const getWebTypeList = async () => {\n    const { data } = await getWebTypeListAPI();\n    setTypeList(data);\n  };\n\n  useEffect(() => {\n    getLinkList();\n    getWebTypeList();\n  }, []);\n\n  useEffect(() => {\n    // 过滤出符合搜索条件的网站\n    const filteredList = listTemp.filter((item) => item.title.includes(search) || item.description.includes(search));\n\n    // 按类型分组\n    const grouped = filteredList.reduce(\n      (acc, item) => {\n        const groupName = item.type.name;\n        if (!acc[groupName]) {\n          acc[groupName] = [];\n        }\n        acc[groupName].push(item);\n        return acc;\n      },\n      {} as { [key: string]: Web[] },\n    );\n\n    setList(grouped);\n  }, [search, listTemp]);\n\n  const deleteLinkData = async (id: number) => {\n    try {\n      setLoading(true);\n\n      await delLinkDataAPI(id);\n      getLinkList();\n      message.success('🎉 删除网站成功');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  const editLinkData = async (record: Web) => {\n    try {\n      setEditLoading(true);\n      setIsMethod('edit');\n      setLink(record);\n      form.setFieldsValue(record);\n      setModalVisible(true);\n      setEditLoading(false);\n    } catch (error) {\n      console.error(error);\n      setEditLoading(false);\n    }\n  };\n\n  // 做一些初始化的事情\n  const reset = () => {\n    form.resetFields(); // 重置表单字段\n    setLink({} as Web);\n    setIsMethod('create');\n    setModalVisible(false);\n  };\n\n  // 打开新增网站弹框\n  const openAddModal = () => {\n    reset();\n    setIsMethod('create');\n    setModalVisible(true);\n  };\n\n  // 校验网站链接\n  const validateURL = (_: RuleObject, value: string) => {\n    return !value || /^(https?:\\/\\/)/.test(value) ? Promise.resolve() : Promise.reject(new Error('请输入有效的链接'));\n  };\n\n  const onSubmit = async () => {\n    try {\n      setBtnLoading(true);\n\n      form.validateFields().then(async (values: Web) => {\n        if (isMethod === 'edit') {\n          await editLinkDataAPI({ ...link, ...values });\n          message.success('🎉 编辑网站成功');\n        } else {\n          await addLinkDataAPI({ ...values, createTime: new Date().getTime().toString() });\n          message.success('🎉 新增网站成功');\n        }\n\n        await getLinkList();\n        reset();\n      });\n\n      setBtnLoading(false);\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n  };\n\n  const { Option } = Select;\n\n  const toHref = (url: string) => {\n    window.open(url, '_blank');\n  };\n\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n          <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n        </Card>\n\n        {/* 内容骨架屏 */}\n        <Card className=\"WebPage border-stroke min-h-[calc(100vh-160px)] [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n          {/* 搜索框骨架屏 */}\n          <div className=\"flex justify-center w-full mb-3\">\n            <Skeleton.Input active size=\"large\" style={{ width: 300, height: 50 }} />\n          </div>\n\n          {/* 分组卡片骨架屏 */}\n          <div className=\"space-y-10\">\n            {[1, 2, 3].map((group) => (\n              <div key={group} className=\"space-y-6\">\n                {/* 分组标题骨架屏 */}\n                <div className=\"flex items-center gap-3 px-4 py-3 rounded-xl bg-white/60 dark:bg-boxdark/60 backdrop-blur-md border border-white/20 dark:border-strokedark/30\">\n                  <Skeleton.Avatar active size={20} shape=\"square\" />\n                  <Skeleton.Input active size=\"default\" style={{ width: 150, height: 24 }} />\n                </div>\n\n                {/* 网站项骨架屏 */}\n                <div className=\"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-6\">\n                  {[1, 2, 3, 4, 5, 6].map((item) => (\n                    <div key={item} className=\"flex flex-col items-center p-6 rounded-2xl bg-white/70 dark:bg-boxdark/70 backdrop-blur-lg border border-white/30 dark:border-strokedark/40 shadow-xs\">\n                      <Skeleton.Avatar active size={80} shape=\"circle\" className=\"mb-4\" />\n                      <Skeleton.Input active size=\"default\" style={{ width: '100%', height: 24, marginBottom: 8 }} />\n                      <Skeleton.Input active size=\"small\" style={{ width: '100%', height: 20, marginBottom: 16 }} />\n                      <Skeleton.Input active size=\"small\" style={{ width: 80, height: 24, borderRadius: 12 }} />\n                    </div>\n                  ))}\n                </div>\n              </div>\n            ))}\n          </div>\n        </Card>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"网站管理\">\n        <Button type=\"primary\" onClick={openAddModal}>\n          新增网站\n        </Button>\n      </Title>\n\n      <Card className=\"WebPage border-stroke min-h-[calc(100vh-160px)] [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n        <div className=\"flex justify-center w-full mt-1 mb-2\">\n          <Input placeholder=\"请输入网站名称或描述信息进行查询\" prefix={<SearchOutlined />} value={search} onChange={(e) => setSearch(e.target.value)} className=\"w-[300px]\" />\n        </div>\n\n        <Spin spinning={loading}>\n          <div className=\"space-y-10\">\n            {Object.keys(list).map((key, index1) => (\n              <div key={index1} className=\"space-y-6\">\n                <div className=\"flex items-center gap-3 px-4 py-3 rounded-xl bg-white/60 dark:bg-boxdark/60 backdrop-blur-md border border-white/20 dark:border-strokedark/30 shadow-xs shadow-primary/5\">\n                  <img src={GroupSvg} alt=\"分组图标\" className=\"w-5 h-5 opacity-80\" />\n                  <span className=\"text-base font-semibold text-gray-800 dark:text-gray-200\">{key}</span>\n                </div>\n\n                {Object.values(list[key]).length ? (\n                  <div className=\"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-6\">\n                    {Object.values(list[key]).map((item, index2) => (\n                      <div\n                        key={index2}\n                        className=\"group relative flex flex-col items-center p-6 pb-0 rounded-3xl bg-linear-to-br from-white/80 via-white/70 to-white/60 dark:from-boxdark/80 dark:via-boxdark/70 dark:to-boxdark/60 backdrop-blur-xl border border-white/40 dark:border-strokedark/50 shadow-lg hover:shadow-2xl hover:shadow-primary/20 transition-all duration-300 hover:-translate-y-2 cursor-pointer overflow-hidden\"\n                      >\n                        <div className=\"absolute inset-0 bg-linear-to-br from-primary/5 via-transparent to-blue-500/5 dark:from-primary/10 dark:to-blue-500/10 opacity-0 group-hover:opacity-100 transition-opacity duration-300\"></div>\n\n                        <div className=\"absolute top-0 left-0 right-0 h-24 bg-linear-to-br from-primary/30 via-primary/15 to-transparent dark:from-primary/40 dark:via-primary/20 rounded-t-3xl\"></div>\n\n                        <div className=\"absolute top-4 right-4 w-20 h-20 bg-primary/10 dark:bg-primary/20 rounded-full blur-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-300\"></div>\n                        <div className=\"absolute bottom-4 left-4 w-16 h-16 bg-blue-500/10 dark:bg-blue-500/20 rounded-full blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-700\"></div>\n\n                        <div className=\"relative z-10 flex items-center justify-center w-24 h-24 mt-3 mb-5 rounded-full bg-linear-to-br from-white to-gray-50 dark:from-boxdark-2 dark:to-boxdark shadow-2xl ring-4 ring-white/60 dark:ring-strokedark/40 ring-offset-2 ring-offset-white/50 dark:ring-offset-boxdark/50 transition-transform duration-300 group-hover:scale-110 group-hover:ring-primary/30 group-hover:shadow-primary/30\">\n                          <div className=\"absolute inset-0 rounded-full bg-linear-to-br from-primary/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300\"></div>\n                          <img\n                            src={item.image}\n                            alt={item.title}\n                            className=\"relative z-10 w-[88%] h-[88%] rounded-full object-cover transition-transform duration-300 group-hover:scale-105 group-hover:rotate-3\"\n                          />\n                          <div className=\"absolute inset-0 rounded-full border-2 border-primary/0 group-hover:border-primary/30 transition-all duration-300\"></div>\n                        </div>\n\n                        <h3 className=\"relative z-10 mb-2 text-lg font-bold text-gray-900 dark:text-white text-center transition-all duration-300 group-hover:text-primary group-hover:scale-105 line-clamp-1\">\n                          {item.title}\n                        </h3>\n\n                        <p className=\"relative z-10 mb-4 text-sm text-gray-600 dark:text-gray-300 text-center line-clamp-2 leading-relaxed min-h-10 px-2 transition-colors duration-300 group-hover:text-gray-700 dark:group-hover:text-gray-200\">\n                          {item.description}\n                        </p>\n\n                        <div className=\"relative z-10 mb-4 px-4 py-2 rounded-full bg-linear-to-r from-primary/15 via-primary/10 to-primary/5 dark:from-primary/25 dark:via-primary/20 dark:to-primary/15 text-primary dark:text-primary/90 text-xs font-semibold transition-all duration-300 group-hover:bg-linear-to-r group-hover:from-primary/25 group-hover:via-primary/20 group-hover:to-primary/15 dark:group-hover:from-primary/35 dark:group-hover:via-primary/30 dark:group-hover:to-primary/25 group-hover:scale-105 group-hover:shadow-md group-hover:shadow-primary/20 border border-primary/20 dark:border-primary/30\">\n                          <span className=\"flex items-center gap-1.5\">\n                            <span className=\"w-1.5 h-1.5 rounded-full bg-primary animate-pulse\"></span>\n                            {item.type.name}\n                          </span>\n                        </div>\n\n                        <div className=\"absolute z-50 inset-x-0 bottom-0 flex flex-col gap-3 py-5 px-3 bg-linear-to-t from-white/98 via-white/95 to-white/90 dark:from-boxdark/98 dark:via-boxdark/95 dark:to-boxdark/90 backdrop-blur-xl border-t border-gray-200/60 dark:border-strokedark/60 shadow-[0_-8px_24px_rgba(0,0,0,0.08)] dark:shadow-[0_-8px_24px_rgba(0,0,0,0.3)] transform translate-y-full group-hover:translate-y-0 transition-all duration-300 ease-out\">\n                          <div className=\"absolute top-0 left-6 right-6 h-[2px] bg-linear-to-r from-transparent via-primary/40 to-transparent dark:via-primary/50\"></div>\n\n                          <div className=\"flex gap-2\">\n                            <button\n                              onClick={(e) => {\n                                e.stopPropagation();\n                                editLinkData(item);\n                              }}\n                              className=\"flex-1 px-3 py-2.5 text-sm font-semibold text-white bg-linear-to-r from-emerald-500 via-emerald-500 to-emerald-600 hover:from-emerald-600 hover:via-emerald-600 hover:to-emerald-700 rounded-xl transition-all duration-300 shadow-lg hover:shadow-xl hover:shadow-emerald-500/40 active:scale-95 transform flex items-center justify-center gap-1.5\"\n                            >\n                              <svg className=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                                <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\" />\n                              </svg>\n                              修改\n                            </button>\n\n                            <Popconfirm\n                              title=\"删除确认\"\n                              description=\"确定要删除这个网站吗？此操作不可恢复。\"\n                              okText=\"确定\"\n                              cancelText=\"取消\"\n                              okButtonProps={{ danger: true }}\n                              onConfirm={(e) => {\n                                e?.stopPropagation();\n                                deleteLinkData(item.id!);\n                              }}\n                            >\n                              <button\n                                onClick={(e) => e.stopPropagation()}\n                                className=\"flex-1 px-3 py-2.5 text-sm font-semibold text-white bg-linear-to-r from-red-500 via-red-500 to-red-600 hover:from-red-600 hover:via-red-600 hover:to-red-700 rounded-xl transition-all duration-300 shadow-lg hover:shadow-xl hover:shadow-red-500/40 active:scale-95 transform flex items-center justify-center gap-1.5\"\n                              >\n                                <svg className=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                                  <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\" />\n                                </svg>\n                                删除\n                              </button>\n                            </Popconfirm>\n                          </div>\n\n                          {/* 第二行：前往该网站按钮 */}\n                          <button\n                            onClick={(e) => {\n                              e.stopPropagation();\n                              toHref(item.url);\n                            }}\n                            className=\"w-full px-4 py-3 text-sm font-semibold text-white bg-linear-to-r from-primary via-primary to-primary/90 hover:from-primary/90 hover:via-primary hover:to-primary rounded-xl transition-all duration-300 shadow-lg hover:shadow-xl hover:shadow-primary/50 active:scale-95 transform flex items-center justify-center gap-2 group/btn\"\n                          >\n                            <svg className=\"w-4 h-4 transition-transform duration-300 group-hover/btn:translate-x-0.5\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                              <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M13 7l5 5m0 0l-5 5m5-5H6\" />\n                            </svg>\n                            <span>前往该网站</span>\n                            <svg className=\"w-4 h-4 transition-transform duration-300 group-hover/btn:translate-x-1\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                              <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M9 5l7 7-7 7\" />\n                            </svg>\n                          </button>\n                        </div>\n\n                        <div className=\"absolute bottom-0 left-0 right-0 h-1 bg-linear-to-r from-transparent via-primary/30 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300\"></div>\n                      </div>\n                    ))}\n                  </div>\n                ) : (\n                  <Empty description=\"暂无数据\" className=\"my-7\" />\n                )}\n              </div>\n            ))}\n          </div>\n        </Spin>\n      </Card>\n\n      <Modal\n        title={isMethod === 'edit' ? '编辑网站' : '新增网站'}\n        open={modalVisible}\n        onCancel={reset}\n        width={600}\n        footer={null}\n      >\n        <Spin spinning={editLoading}>\n          <Form form={form} layout=\"vertical\" size=\"large\" initialValues={link} onFinish={onSubmit}>\n            <Form.Item label=\"网站标题\" name=\"title\" rules={[{ required: true, message: '网站标题不能为空' }]}>\n              <Input placeholder=\"ThriveX\" />\n            </Form.Item>\n\n            <Form.Item label=\"网站描述\" name=\"description\" rules={[{ required: true, message: '网站描述不能为空' }]}>\n              <Input placeholder=\"记录前端、Python、Java点点滴滴\" />\n            </Form.Item>\n\n            <Form.Item label=\"站长邮箱\" name=\"email\">\n              <Input placeholder=\"3311118881@qq.com\" />\n            </Form.Item>\n\n            <Form.Item label=\"网站图标\" name=\"image\" rules={[{ required: true, message: '网站图标不能为空' }]}>\n              <Input placeholder=\"https://liuyuyang.net/logo.png\" />\n            </Form.Item>\n\n            <Form.Item label=\"网站链接\" name=\"url\" rules={[{ required: true, message: '网站链接不能为空' }, { validator: validateURL }]}>\n              <Input placeholder=\"https://liuyuyang.net/\" />\n            </Form.Item>\n\n            <Form.Item label=\"订阅地址\" name=\"rss\" rules={[{ validator: validateURL }]}>\n              <Input placeholder=\"https://liuyuyang.net/api/rss\" />\n            </Form.Item>\n\n            <Form.Item name=\"typeId\" label=\"网站类型\" rules={[{ required: true, message: '网站类型不能为空' }]}>\n              <Select placeholder=\"请选择网站类型\" allowClear>\n                {typeList.map((item) => (\n                  <Option key={item.id} value={item.id}>\n                    {item.name}\n                  </Option>\n                ))}\n              </Select>\n            </Form.Item>\n\n            <Form.Item label=\"顺序\" name=\"order\">\n              <Input placeholder=\"请输入网站顺序（值越小越靠前）\" />\n            </Form.Item>\n\n            <Form.Item className=\"mb-0\">\n              <Button type=\"primary\" htmlType=\"submit\" loading={btnLoading} className=\"w-full\">\n                确定\n              </Button>\n            </Form.Item>\n          </Form>\n        </Spin>\n      </Modal >\n    </div >\n  );\n};\n"
  },
  {
    "path": "src/pages/work/components/List/index.tsx",
    "content": "import { useState } from 'react';\n\nimport { Button, Dropdown, message, Modal } from 'antd';\nimport dayjs from 'dayjs';\n\nimport { auditCommentDataAPI, delCommentDataAPI, addCommentDataAPI } from '@/api/comment';\nimport { auditWallDataAPI, delWallDataAPI } from '@/api/wall';\nimport { delLinkDataAPI, auditWebDataAPI } from '@/api/web';\nimport { sendDismissEmailAPI, sendReplyWallEmailAPI } from '@/api/email';\n\nimport RandomAvatar from '@/components/RandomAvatar';\nimport { useUserStore, useWebStore } from '@/stores';\nimport TextArea from 'antd/es/input/TextArea';\n\ntype Menu = 'comment' | 'link' | 'wall';\n\ninterface ListItemProps {\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  item: any;\n  type: Menu;\n  fetchData: (type: Menu) => void;\n  setLoading: (loading: boolean) => void;\n}\n\nexport default ({ item, type, fetchData, setLoading }: ListItemProps) => {\n  const [btnLoading, setBtnLoading] = useState<boolean>(false);\n\n  const web = useWebStore((state) => state.web);\n  const user = useUserStore((state) => state.user);\n\n  const [btnType, setBtnType] = useState<'reply' | 'dismiss' | string>('');\n\n  // 通过\n  const handleApproval = async () => {\n    setLoading(true);\n\n    try {\n      if (type === 'link') {\n        await auditWebDataAPI(item.id);\n      } else if (type === 'comment') {\n        await auditCommentDataAPI(item.id);\n      } else if (type === 'wall') {\n        await auditWallDataAPI(item.id);\n      }\n\n      await fetchData(type);\n      if (btnType !== 'reply') message.success('🎉 审核成功');\n    } catch (error) {\n      console.error(error);\n      setLoading(false);\n    }\n  };\n\n  // 回复\n  const [isModalOpen, setIsModalOpen] = useState(false);\n  const [replyInfo, setReplyInfo] = useState('');\n  const handleReply = async () => {\n    setBtnLoading(true);\n\n    try {\n      // 审核通过\n      await handleApproval();\n\n      if (type === 'comment') {\n        // 发送回复内容\n        await addCommentDataAPI({\n          avatar: user.avatar,\n          url: web.url,\n          content: replyInfo,\n          commentId: item.id!,\n          auditStatus: 1,\n          email: user.email ? user.email : null,\n          name: user.name,\n          articleId: item.articleId!,\n          createTime: new Date().getTime().toString(),\n        });\n      }\n\n      if (type === 'wall') {\n        await sendReplyWallEmailAPI({\n          to: item.email!,\n          recipient: item.name!,\n          your_content: item.content!,\n          reply_content: replyInfo,\n          time: dayjs(+item.createTime!).format('YYYY-MM-DD HH:mm:ss'),\n          url: web.url + '/wall/all',\n        });\n      }\n\n      await fetchData(type);\n      message.success('🎉 回复成功');\n      setReplyInfo('');\n      setBtnType('');\n      setIsModalOpen(false);\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n\n    setBtnLoading(false);\n  };\n\n  // 驳回\n  const [dismissInfo, setDismissInfo] = useState('');\n  const handleDismiss = async () => {\n    setBtnLoading(true);\n\n    try {\n      if (type === 'link') {\n        await delLinkDataAPI(item.id);\n      } else if (type === 'comment') {\n        await delCommentDataAPI(item.id);\n      } else if (type === 'wall') {\n        await delWallDataAPI(item.id);\n      }\n\n      // 有内容就发送驳回通知邮件，反之直接删除\n      if (dismissInfo.trim().length) await sendDismissEmail();\n\n      await fetchData(type);\n      message.success('🎉 驳回成功');\n      setDismissInfo('');\n      setBtnType('');\n      setIsModalOpen(false);\n    } catch (error) {\n      console.error(error);\n      setBtnLoading(false);\n    }\n\n    setBtnLoading(false);\n  };\n\n  // 发送驳回通知邮件\n  const sendDismissEmail = async () => {\n    // 类型名称\n    let email_info = {\n      name: '',\n      type: '',\n      url: '',\n    };\n\n    switch (type) {\n      case 'link':\n        email_info = {\n          name: item.title,\n          type: '友链',\n          url: `${web.url}/friend`,\n        };\n        break;\n      case 'comment':\n        email_info = {\n          name: item.name,\n          type: '评论',\n          url: `${web.url}/article/${item.articleId}`,\n        };\n        break;\n      case 'wall':\n        email_info = {\n          name: item.name,\n          type: '留言',\n          url: `${web.url}/wall/all`,\n        };\n        break;\n    }\n\n    // 有邮箱才会邮件通知\n    // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n    item.email != null &&\n      (await sendDismissEmailAPI({\n        to: item.email,\n        content: dismissInfo,\n        recipient: email_info.name,\n        subject: `${email_info.type}驳回通知`,\n        time: dayjs(Date.now()).format('YYYY年MM月DD日 HH:mm'),\n        type: email_info.type,\n        url: email_info.url,\n      }));\n  };\n\n  return (\n    <div key={item.id}>\n      <div className=\"text-center text-xs text-[#e0e0e0]\">{dayjs(+item.createTime!).format('YYYY-MM-DD HH:mm:ss')}</div>\n\n      <div className=\"flex justify-between md:p-7 pt-3! rounded-md transition-colors\">\n        <div className=\"flex\">\n          {item.avatar || item.image ? <img src={item.avatar || item.image} alt=\"\" className=\"w-12 h-12 p-0.5 border border-stroke rounded-full\" /> : <RandomAvatar className=\"w-12 h-12 p-0.5 border border-stroke rounded-full\" />}\n\n          <div className=\"flex flex-col justify-center ml-4 px-4 py-2 min-w-[300px] text-xs md:text-sm bg-[#F9F9FD] dark:bg-[#4e5969] rounded-md\">\n            {type === 'link' ? (\n              <>\n                <div>名称：{item.title}</div>\n                <div>介绍：{item.description}</div>\n                <div>类型：{item.type.name}</div>\n                <div>\n                  网站：\n                  {item?.url ? (\n                    <a href={item?.url} target=\"_blank\" className=\"hover:text-primary font-bold\" rel=\"noreferrer\">\n                      {item?.url}\n                    </a>\n                  ) : (\n                    '无网站'\n                  )}\n                </div>\n              </>\n            ) : type === 'comment' ? (\n              <>\n                <div>名称：{item.name}</div>\n                <div>内容：{item.content}</div>\n                <div>\n                  网站：\n                  {item?.url ? (\n                    <a href={item?.url} target=\"_blank\" className=\"hover:text-primary font-bold transition-none\" rel=\"noreferrer\">\n                      {item?.url}\n                    </a>\n                  ) : (\n                    '无网站'\n                  )}\n                </div>\n                <div>\n                  所属文章：\n                  <a href={`${web.url}/article/${item.articleId}`} target=\"_blank\" className=\"hover:text-primary transition-none\" rel=\"noreferrer\">\n                    {item.articleTitle || '暂无'}\n                  </a>\n                </div>\n              </>\n            ) : (\n              <>\n                <div>名称：{item.name}</div>\n                <div>内容：{item.content}</div>\n              </>\n            )}\n\n            <div>邮箱：{item.email || '暂无'}</div>\n          </div>\n        </div>\n\n        <div className=\"flex items-end ml-15\">\n          <Dropdown\n            menu={{\n              items:\n                type === 'comment' || type === 'wall'\n                  ? [\n                      { key: 'ok', label: '通过', onClick: handleApproval },\n                      { key: 'reply', label: '回复', onClick: () => [setIsModalOpen(true), setBtnType('reply')] },\n                      { key: 'dismiss', label: '驳回', onClick: () => [setIsModalOpen(true), setBtnType('dismiss')] },\n                    ]\n                  : [\n                      { key: 'ok', label: '通过', onClick: handleApproval },\n                      { key: 'dismiss', label: '驳回', onClick: () => [setIsModalOpen(true), setBtnType('dismiss')] },\n                    ],\n            }}\n          >\n            <div className=\"flex justify-evenly items-center bg-[#F9F9FD] dark:bg-[#4e5969] w-10 h-5 mb-2 rounded-md cursor-pointer\">\n              <span className=\"inline-block w-2 h-2 bg-[#b5c2d3] rounded-full\"></span>\n              <span className=\"inline-block w-2 h-2 bg-[#b5c2d3] rounded-full\"></span>\n            </div>\n          </Dropdown>\n        </div>\n      </div>\n\n      <Modal title={btnType === 'reply' ? '回复内容' : '驳回原因'} open={isModalOpen} footer={null} onCancel={() => setIsModalOpen(false)}>\n        <TextArea value={btnType === 'reply' ? replyInfo : dismissInfo} onChange={(e) => (btnType === 'reply' ? setReplyInfo(e.target.value) : setDismissInfo(e.target.value))} placeholder={btnType === 'reply' ? '请输入回复内容' : '请输入驳回原因'} autoSize={{ minRows: 3, maxRows: 5 }} />\n\n        <div className=\"flex space-x-4\">\n          <Button className=\"w-full mt-2\" onClick={() => setIsModalOpen(false)}>\n            取消\n          </Button>\n          <Button type=\"primary\" onClick={btnType === 'reply' ? handleReply : handleDismiss} loading={btnLoading} className=\"w-full mt-2\">\n            确定\n          </Button>\n        </div>\n      </Modal>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/pages/work/index.tsx",
    "content": "import { useEffect, useState, useRef } from 'react';\n\nimport { Card, Spin, Skeleton } from 'antd';\n\nimport { getCommentListAPI } from '@/api/comment';\nimport { getLinkListAPI } from '@/api/web';\nimport { getWallListAPI } from '@/api/wall';\n\nimport { Wall } from '@/types/app/wall';\nimport { Web } from '@/types/app/web';\nimport { Comment as CommentType } from '@/types/app/comment';\n\nimport Empty from '@/components/Empty';\nimport Title from '@/components/Title';\nimport List from './components/List';\n\nimport comment from './image/comment.svg';\nimport info from './image/message.svg';\nimport link from './image/link.svg';\n\ntype Menu = 'comment' | 'link' | 'wall';\n\nexport default () => {\n  const [loading, setLoading] = useState(false);\n  const [initialLoading, setInitialLoading] = useState<boolean>(true);\n  const isFirstLoadRef = useRef<boolean>(true);\n\n  const activeSty = 'bg-[#f9f9ff] dark:bg-[#3c5370] text-primary';\n  const [active, setActive] = useState<Menu>('comment');\n  const [commentList, setCommentList] = useState<CommentType[]>([]);\n  const [linkList, setLinkList] = useState<Web[]>([]);\n  const [wallList, setWallList] = useState<Wall[]>([]);\n\n  // 重新获取最新数据\n  const fetchData = async (type: Menu) => {\n    try {\n      // 如果是第一次加载，使用 initialLoading\n      if (isFirstLoadRef.current) {\n        setInitialLoading(true);\n      } else {\n        setLoading(true);\n      }\n\n      if (type === 'comment') {\n        const { data } = await getCommentListAPI({ query: { status: 0 }, pattern: 'list' });\n        setCommentList(data);\n      } else if (type === 'link') {\n        const { data } = await getLinkListAPI({ query: { status: 0 } });\n        setLinkList(data);\n      } else if (type === 'wall') {\n        const { data } = await getWallListAPI({ query: { status: 0 } });\n        setWallList(data);\n      }\n\n      isFirstLoadRef.current = false;\n    } catch (error) {\n      console.error(error);\n    } finally {\n      setInitialLoading(false);\n      setLoading(false);\n    }\n  };\n\n  useEffect(() => {\n    fetchData(active);\n  }, [active]);\n\n  const renderList = (list: CommentType[] | Web[] | Wall[], type: Menu) => {\n    if (list.length === 0) {\n      return <Empty />;\n    }\n    return list.map((item) => <List key={item.id} item={item} type={type} fetchData={(type) => fetchData(type)} setLoading={setLoading} />);\n  };\n\n  // 初始加载时显示骨架屏\n  if (initialLoading) {\n    return (\n      <div>\n        {/* Title 骨架屏 */}\n        <Card className=\"[&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5! mb-2\">\n          <Skeleton.Input active size=\"large\" style={{ width: 150, height: 32 }} />\n        </Card>\n\n        <Card className=\"border-stroke mt-2 min-h-[calc(100vh-160px)] [&>.ant-card-body]:py-2! [&>.ant-card-body]:px-5!\">\n          <div className=\"flex flex-col md:flex-row w-full\">\n            {/* 左侧菜单骨架屏 */}\n            <div className=\"w-full min-w-[200px] md:w-2/12 md:min-h-96 mb-5 md:mb-0 pr-4 md:border-b-transparent md:border-r border-stroke dark:border-strokedark\">\n              <ul className=\"space-y-1\">\n                {[1, 2, 3].map((item) => (\n                  <li key={item} className=\"flex items-center w-full py-3 px-4\">\n                    <Skeleton.Avatar active size={32} shape=\"square\" style={{ marginRight: 16 }} />\n                    <Skeleton.Input active size=\"small\" style={{ width: 60, height: 20 }} />\n                  </li>\n                ))}\n              </ul>\n            </div>\n\n            {/* 右侧内容骨架屏 */}\n            <div className=\"w-full md:w-10/12 md:pl-6 py-4 space-y-10\">\n              {[1, 2, 3, 4, 5].map((item) => (\n                <div key={item} className=\"border-b border-gray-100 pb-4\">\n                  <Skeleton active paragraph={{ rows: 2 }} />\n                </div>\n              ))}\n            </div>\n          </div>\n        </Card>\n      </div>\n    );\n  }\n\n  return (\n    <div>\n      <Title value=\"工作台\" />\n\n      <Card className=\"border-stroke mt-2 min-h-[calc(100vh-160px)]\">\n        <div className=\"flex flex-col md:flex-row w-full\">\n          <div className=\"w-full min-w-[200px] md:w-2/12 md:min-h-96 mb-5 md:mb-0 pr-4 md:border-b-transparent md:border-r border-stroke dark:border-strokedark\">\n            <ul className=\"space-y-1\">\n              {(['comment', 'link', 'wall'] as Menu[]).map((menu) => (\n                <li key={menu} className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] dark:hover:bg-[#3c5370] hover:text-primary ${active === menu ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`} onClick={() => setActive(menu)}>\n                  <img src={menu === 'comment' ? comment : menu === 'link' ? link : info} alt=\"\" className=\"w-8 mr-4\" />\n                  <span>{menu === 'comment' ? '评论' : menu === 'link' ? '友联' : '留言'}</span>\n                </li>\n              ))}\n            </ul>\n          </div>\n\n          <Spin spinning={loading}>\n            <div className=\"w-full md:w-10/12 md:pl-6 py-4 space-y-10\">\n              {active === 'link' && renderList(linkList, 'link')}\n              {active === 'comment' && renderList(commentList, 'comment')}\n              {active === 'wall' && renderList(wallList, 'wall')}\n            </div>\n          </Spin>\n        </div>\n      </Card>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/services/assistant.ts",
    "content": "import { message } from 'antd';\nimport { Assistant } from '@/types/app/assistant';\n\n/**\n * 将用户输入的通用模型名（不区分大小写）映射为实际 API 使用的模型名\n */\nexport const getModelName = (rawModel: string): string => {\n  const key = rawModel.toLowerCase().trim();\n\n  const modelMap: Record<string, string> = {\n    // === OpenAI ===\n    'gpt-3.5': 'gpt-3.5-turbo',\n    'gpt-3.5-16k': 'gpt-3.5-turbo-16k',\n    'gpt-4': 'gpt-4',\n    'gpt-4-32k': 'gpt-4-32k',\n    'gpt-4o': 'gpt-4o',\n    'gpt-4-turbo': 'gpt-4-turbo',\n\n    // === Moonshot ===\n    moonshot: 'moonshot-v1-8k',\n    'moonshot-8k': 'moonshot-v1-8k',\n    'moonshot-32k': 'moonshot-v1-32k',\n\n    // === DeepSeek ===\n    deepseek: 'deepseek-chat',\n    'deepseek-coder': 'deepseek-coder',\n\n    // === Kimi（Moonshot）===\n    kimi: 'moonshot-v1-8k',\n\n    // === Claude（Anthropic）兼容 OpenAI 接口时的别名 ===\n    claude: 'claude-3-opus-20240229',\n    'claude-3': 'claude-3-opus-20240229',\n    'claude-opus': 'claude-3-opus-20240229',\n    'claude-sonnet': 'claude-3-sonnet-20240229',\n    'claude-haiku': 'claude-3-haiku-20240307',\n\n    // === MiniMax ===\n    minimax: 'abab5.5s-chat',\n    'minimax-5.5': 'abab5.5s-chat',\n    'minimax-pro': 'abab6-chat',\n\n    // === 通义 Qwen（阿里）===\n    qwen: 'qwen-max',\n    'qwen-plus': 'qwen-plus',\n    'qwen-max': 'qwen-max',\n    'qwen-turbo': 'qwen-turbo',\n\n    // === 智谱 AI ===\n    glm: 'glm-4',\n    'glm-3': 'glm-3-turbo',\n    'glm-4': 'glm-4',\n    chatglm: 'glm-3-turbo',\n    chatglm3: 'glm-3-turbo',\n    chatglm4: 'glm-4',\n\n    // === 百川 Baichuan ===\n    baichuan: 'baichuan2-53b',\n    baichuan2: 'baichuan2-53b',\n    'baichuan-13b': 'baichuan2-13b-chat',\n    'baichuan-53b': 'baichuan2-53b',\n\n    // === 01.AI（Yi）===\n    yi: 'yi-34b-chat',\n    'yi-6b': 'yi-6b-chat',\n    'yi-34b': 'yi-34b-chat',\n\n    // === 上海 AI 实验室 InternLM ===\n    internlm: 'internlm2-chat-20b',\n    internlm2: 'internlm2-chat-20b',\n\n    // === Mistral / Mixtral ===\n    mistral: 'mistral-7b-instruct',\n    mixtral: 'mixtral-8x7b-instruct',\n\n    // === Command R (by Cohere) ===\n    'command-r': 'command-r',\n    'command-r+': 'command-r-plus',\n    'command-r-plus': 'command-r-plus',\n\n    // === Google Gemini（如通过 proxy 接 OpenAI 格式）===\n    gemini: 'gemini-pro',\n    'gemini-pro': 'gemini-pro',\n\n    // === 豆包（字节）===\n    doubao: 'doubao-2', // 通用别名\n    'doubao-2': 'doubao-2', // 官方 API 兼容模型\n    'doubao-lite': 'doubao-lite',\n    'doubao-pro': 'doubao-pro',\n  };\n\n  return modelMap[key] || rawModel;\n};\n\n/**\n * 测试助手连接是否正常\n */\nexport const testAssistantConnection = async (assistant: Assistant): Promise<boolean> => {\n  try {\n    const baseUrl = assistant.url || 'https://api.deepseek.com/v1';\n    const apiKey = assistant.key.trim();\n\n    const response = await fetch(`${baseUrl}/chat/completions`, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n        Authorization: `Bearer ${apiKey}`,\n        Accept: 'application/json',\n      },\n      body: JSON.stringify({\n        model: getModelName(assistant.model),\n        messages: [\n          {\n            role: 'system',\n            content: '你是一个 AI 助手，致力于为用户提供安全、准确、有帮助的中文和英文服务。',\n          },\n          {\n            role: 'user',\n            content: '测试连接',\n          },\n        ],\n        temperature: 0.3,\n      }),\n    });\n\n    if (response.ok) {\n      message.success('测试连接成功');\n      return true;\n    } else {\n      const json = await response.json().catch(() => null);\n      const errMsg = json?.error?.message || response.statusText;\n      message.error(`测试连接失败：${errMsg}`);\n      return false;\n    }\n  } catch (error) {\n    console.error(`测试连接异常：${error}`);\n    return false;\n  }\n};\n\n/**\n * 调用助手接口获取响应（支持流式和非流式）\n */\nexport const callAssistantAPI = async (\n  assistant: Assistant,\n  messages: Array<{ role: string; content: string }>,\n  options: {\n    stream?: boolean;\n    temperature?: number;\n    max_tokens?: number;\n  } = {},\n): Promise<ReadableStreamDefaultReader<Uint8Array>> => {\n  try {\n    const baseUrl = assistant.url || 'https://api.deepseek.com/v1';\n    const apiKey = assistant.key.trim();\n\n    const response = await fetch(`${baseUrl}/chat/completions`, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n        Authorization: `Bearer ${apiKey}`,\n        Accept: 'application/json',\n      },\n      body: JSON.stringify({\n        model: getModelName(assistant.model),\n        messages,\n        stream: options.stream ?? false,\n        temperature: options.temperature ?? 0.3,\n        max_tokens: options.max_tokens,\n      }),\n    });\n\n    if (!response.ok) {\n      const json = await response.json().catch(() => null);\n      const errMsg = json?.error?.message || response.statusText;\n      throw new Error(`助手 API 调用失败：${errMsg}`);\n    }\n\n    if (options.stream) {\n      return response.body?.getReader(); // 由上层组件处理事件流\n    }\n\n    return await response.json();\n  } catch (error) {\n    console.error(error);\n    throw error;\n  }\n};\n"
  },
  {
    "path": "src/stores/index.ts",
    "content": "import useWebStore from './modules/web';\nimport useUserStore from './modules/user';\nimport useConfigStore from './modules/config';\nimport useTabsStore from './modules/tabs';\n\nexport { useUserStore, useWebStore, useConfigStore, useTabsStore };\n"
  },
  {
    "path": "src/stores/modules/config.ts",
    "content": "import { create } from 'zustand';\nimport { persist } from 'zustand/middleware';\n\ntype ColorMode = 'light' | 'dark';\n\ninterface ConfigStore {\n  colorMode: ColorMode;\n  setColorMode: (data: ColorMode) => void;\n}\n\nexport default create(\n  persist<ConfigStore>(\n    (set) => ({\n      colorMode: 'light',\n      setColorMode: (colorMode: ColorMode) => set(() => ({ colorMode })),\n    }),\n    {\n      name: 'config_storage',\n      getStorage: () => localStorage,\n    },\n  ),\n);\n"
  },
  {
    "path": "src/stores/modules/tabs.ts",
    "content": "import { create } from 'zustand';\nimport { persist } from 'zustand/middleware';\n\nexport interface TabItem {\n  path: string;\n  title: string;\n  icon?: string;\n}\n\ninterface TabsStore {\n  tabs: TabItem[];\n  activeTab: string;\n\n  // 添加标签\n  addTab: (tab: TabItem) => void;\n\n  // 移除标签\n  removeTab: (path: string) => void;\n\n  // 设置激活标签\n  setActiveTab: (path: string) => void;\n\n  // 关闭其他标签\n  closeOtherTabs: (path: string) => void;\n\n  // 关闭所有标签\n  closeAllTabs: () => void;\n}\n\nexport default create(\n  persist<TabsStore>(\n    (set) => ({\n      tabs: [{ path: '/', title: '首页' }],\n      activeTab: '/',\n\n      addTab: (tab: TabItem) =>\n        set((state) => {\n          // 如果标签已存在，不重复添加\n          if (state.tabs.some((t) => t.path === tab.path)) {\n            return { activeTab: tab.path };\n          }\n\n          return {\n            tabs: [...state.tabs, tab],\n            activeTab: tab.path,\n          };\n        }),\n\n      removeTab: (path: string) =>\n        set((state) => {\n          if (state.tabs.length <= 1) {\n            // 至少保留一个标签\n            return state;\n          }\n\n          const newTabs = state.tabs.filter((t) => t.path !== path);\n          const currentIndex = state.tabs.findIndex((t) => t.path === path);\n\n          // 如果关闭的是当前激活的标签，激活相邻的标签\n          let newActiveTab = state.activeTab;\n          if (state.activeTab === path) {\n            if (currentIndex > 0) {\n              newActiveTab = state.tabs[currentIndex - 1].path;\n            } else {\n              newActiveTab = newTabs[0].path;\n            }\n          }\n\n          return {\n            tabs: newTabs,\n            activeTab: newActiveTab,\n          };\n        }),\n\n      setActiveTab: (path: string) =>\n        set(() => ({\n          activeTab: path,\n        })),\n\n      closeOtherTabs: (path: string) =>\n        set((state) => ({\n          tabs: state.tabs.filter((t) => t.path === path),\n          activeTab: path,\n        })),\n\n      closeAllTabs: () =>\n        set(() => ({\n          tabs: [{ path: '/', title: '首页' }],\n          activeTab: '/',\n        })),\n    }),\n    {\n      name: 'tabs_storage',\n      getStorage: () => localStorage,\n    },\n  ),\n);\n"
  },
  {
    "path": "src/stores/modules/user.ts",
    "content": "import { Permission } from '@/types/app/permission';\nimport { Role } from '@/types/app/role';\nimport { User } from '@/types/app/user';\nimport { create } from 'zustand';\nimport { persist } from 'zustand/middleware';\n\ninterface UserStore {\n  token: string;\n  setToken: (data: string) => void;\n\n  user: User;\n  setUser: (data: User) => void;\n\n  role: Role;\n  setRole: (data: Role) => void;\n\n  permission: Permission[];\n  setPermission: (permission: Permission[]) => void;\n\n  quitLogin: () => void;\n}\n\nexport default create(\n  persist<UserStore>(\n    (set) => ({\n      token: '',\n      setToken: (token: string) => set(() => ({ token })),\n\n      user: {} as User,\n      setUser: (data: User) => set(() => ({ user: data })),\n\n      role: {} as Role,\n      setRole: (data: Role) => set(() => ({ role: data })),\n\n      permission: [] as Permission[],\n      setPermission: (permission: Permission[]) => set(() => ({ permission })),\n\n      // 退出登录\n      quitLogin: () =>\n        set(() => {\n          localStorage.clear();\n          sessionStorage.clear();\n          location.href = '/login';\n\n          return { token: '', user: {} as User, role: {} as Role };\n        }),\n    }),\n    {\n      name: 'user_storage',\n      getStorage: () => localStorage,\n      // 定义需要持久化存储的数据，默认表示全部持久化\n      // partialize: (state) => ({ token: state.token, user: state.user }),\n    },\n  ),\n);\n"
  },
  {
    "path": "src/stores/modules/web.ts",
    "content": "import { Web } from '@/types/app/config';\nimport { create } from 'zustand';\n\ninterface WebStore {\n  web: Web;\n  setWeb: (data: Web) => void;\n}\n\nexport default create<WebStore>((set) => ({\n  web: {} as Web,\n  setWeb: (data: Web) => set(() => ({ web: data })),\n}));\n"
  },
  {
    "path": "src/styles/antd.scss",
    "content": "/* ------------------ 自定义Antd组件样式开始 ------------------ */\n\n// 只取消颜色相关的过渡效果, 其他过渡保持正常 (暗色切换时颜色变化不一致会导致效果不好)\n* {\n    transition-property:\n        opacity, transform, translate, scale, box-shadow, filter, width, height, min-width, min-height, max-width,\n        max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right,\n        padding-bottom, padding-left, left, right, top, bottom, inset, font-size, font-weight, letter-spacing,\n        line-height, text-indent, text-shadow, border-width, border-radius, outline-width, outline-offset, flex,\n        flex-grow, flex-shrink, flex-basis, gap, row-gap, column-gap, visibility, z-index, clip-path, backdrop-filter,\n        border-style, outline-style !important;\n}\n\na {\n    color: inherit;\n    \n    &:hover {\n        color: var(--color-primary) !important;\n    }\n}\n\n/* 表单获取焦点时的阴影效果 */\n.ant-input:focus,\n.ant-input-focused,\n.ant-input-number:focus,\n.ant-input-number-focused,\n.ant-select-focused .ant-select-selector,\n.ant-picker-focused,\n.ant-textarea:focus,\n.ant-input-affix-wrapper-focused {\n    box-shadow: 0 0 0 4px rgba(5, 72, 255, 0.06) !important;\n}\n\n/* 表单校验失败时的阴影效果 */\n.ant-input-status-error:focus,\n.ant-input-status-error.ant-input-focused,\n.ant-input-number-status-error:focus,\n.ant-input-number-status-error.ant-input-number-focused,\n.ant-select-status-error.ant-select-focused .ant-select-selector,\n.ant-picker-status-error.ant-picker-focused,\n.ant-textarea-status-error:focus,\n.ant-input-affix-wrapper-status-error.ant-input-affix-wrapper-focused {\n    box-shadow: 0 0 0 4px rgba(255, 77, 79, 0.1) !important;\n}\n\n// 自定义input后置按钮样式\n.customizeAntdInputAddonAfter {\n    .ant-input-group-addon {\n        padding: 0;\n\n        > span {\n            padding: 8px 10px;\n        }\n    }\n}\n\n.ant-form-inline {\n    margin-inline-end: 10px;\n}\n\n.ant-tabs-nav {\n    padding-top: 0 !important;\n    margin-bottom: 0 !important;\n}\n/* ------------------ 自定义Antd组件样式结束 ------------------ */\n\n// ------------------ Antd组件暗色适配 开始 ------------------\n// 使用 CSS 变量而非 @apply 自定义颜色，避免 antd.scss 单独编译时 Tailwind 无法识别 index.css 中的 @theme\n.ant-card {\n    @apply overflow-hidden;\n}\n\n.ant-card-body,\n.ant-pagination-item,\n.ant-drawer-header,\n.ant-drawer-body,\n.ant-table-cell::before {\n    .dark & {\n        background-color: var(--color-boxdark);\n    }\n}\n\n.ant-pagination-item:hover,\n.ant-table-cell,\n.ant-table-row:hover .ant-table-cell,\n.ant-card {\n    .dark & {\n        background-color: var(--color-boxdark) !important;\n        border-color: var(--color-strokedark) !important;\n    }\n}\n\n.ant-input,\n.ant-input-affix-wrapper,\n.ant-picker-outlined,\n.ant-picker-panel-layout,\n.ant-picker-range-arrow::before,\n.ant-select,\n.ant-select-selector,\n.ant-modal-content {\n    .dark & {\n        background-color: var(--color-boxdark-2) !important;\n        border-color: var(--color-strokedark) !important;\n    }\n}\n\n.ant-modal-header {\n    .dark & {\n        background: transparent;\n    }\n}\n\n.ant-transfer-list {\n    .dark & {\n        border-color: var(--color-strokedark);\n    }\n}\n\n/* 暗色下标签统一为柔和样式，提升对比度与一致性 */\n.dark .ant-tag {\n    border: 1px solid var(--tw-stroke-dark, #475f7d) !important;\n    background: rgba(71, 95, 125, 0.25) !important;\n    color: rgba(226, 232, 240, 0.95) !important;\n}\n.dark .ant-tag:hover {\n    background: rgba(71, 95, 125, 0.4) !important;\n    border-color: rgba(71, 95, 125, 0.7) !important;\n}\n// ------------------ Antd组件暗色适配 结束 ------------------\n"
  },
  {
    "path": "src/styles/custom.scss",
    "content": "// 编辑器样式\n.vditor .vditor-reset {\n    .dark & {\n        color: #fff;\n    }\n}\n\n/* 文本渐变 */\n.text-gradient {\n    display: inline-block;\n    color: #8f75da;\n    background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#177df8), to(#60a5fa));\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n\n// 头像动画\n.avatar-animation {\n    animation: 5s linear infinite miniShape;\n}\n\n@keyframes miniShape {\n    0%,\n    to {\n        border-radius: 42% 58% 70% 30%/45% 45% 55% 55%;\n        transform: translateZ(0) rotate(.01deg)\n    }\n\n    34% {\n        border-radius: 70% 30% 46% 54%/30% 29% 71% 70%;\n        transform: translate3d(0, 5px, 0) rotate(.01deg)\n    }\n\n    50% {\n        transform: translateZ(0) rotate(.01deg)\n    }\n\n    67% {\n        border-radius: 100% 60% 60% 100%/100% 100% 60% 60%;\n        transform: translate3d(0, -3px, 0) rotate(.01deg)\n    }\n}\n\n// 瀑布流布局\n.masonry-grid {\n    display: -webkit-box;\n    display: -ms-flexbox;\n    display: flex;\n    width: auto;\n}\n\n.masonry-grid_column {\n    padding-left: 10px;\n    background-clip: padding-box;\n}\n\n// 自定义骨架屏 - 闪光动画\n@keyframes skeleton-shimmer {\n    0% {\n        background-position: -200% 0;\n    }\n    100% {\n        background-position: 200% 0;\n    }\n}\n\n.skeleton {\n    background: linear-gradient(\n        90deg,\n        #e5e7eb 0%,\n        #f3f4f6 50%,\n        #e5e7eb 100%\n    );\n    background-size: 200% 100%;\n    animation: skeleton-shimmer 1.5s ease-in-out infinite;\n    border-radius: 4px;\n}\n\n.dark .skeleton {\n    background: linear-gradient(\n        90deg,\n        #374151 0%,\n        #4b5563 50%,\n        #374151 100%\n    );\n    background-size: 200% 100%;\n}"
  },
  {
    "path": "src/styles/index.css",
    "content": "@import \"tailwindcss/theme.css\" layer(theme);\n@import \"tailwindcss/preflight.css\" layer(custom-base);\n@import \"tailwindcss/utilities.css\" layer(custom-utilities);\n@import url(\"./custom.scss\") layer(custom-base);\n\n@layer theme, custom-base, custom-utilities;\n\n@source './custom.scss';\n\n@custom-variant dark (&:is(.dark *));\n\n@theme {\n  --color-stroke: #e2e8f0;\n  --color-black: #1c2434;\n  --color-black-2: #010101;\n  --color-primary: #60a5fa;\n  --color-boxdark: #334459;\n  --color-boxdark-2: #263444;\n  --color-strokedark: #475f7d;\n\n  --shadow-default: 0px 8px 13px -3px rgba(0, 0, 0, 0.07);\n\n  --background-image-light-gradient:\n    radial-gradient(\n      at 13.814868431089122% 36.55432836575234%,\n      hsla(33.33333333333323, 100%, 98.23529411764707%, 1) 0%,\n      hsla(33.33333333333323, 100%, 98.23529411764707%, 0) 100%\n    ),\n    radial-gradient(\n      at 26.757512289394448% 14.55716430928402%,\n      hsla(201.99999999999997, 100%, 94.11764705882352%, 1) 0%,\n      hsla(201.99999999999997, 100%, 94.11764705882352%, 0) 100%\n    ),\n    radial-gradient(\n      at 71.81123062379334% 73.35997062171711%,\n      hsla(201.99999999999997, 100%, 94.11764705882352%, 1) 0%,\n      hsla(201.99999999999997, 100%, 94.11764705882352%, 0) 100%\n    ),\n    radial-gradient(\n      at 80.67571417506147% 77.36934613667599%,\n      hsla(33.33333333333323, 100%, 98.23529411764707%, 1) 0%,\n      hsla(33.33333333333323, 100%, 98.23529411764707%, 0) 100%\n    );\n  --background-image-dark-gradient: radial-gradient(\n    at 50% 50%,\n    hsla(210, 29%, 27%, 0.8) 0%,\n    hsla(210, 29%, 27%, 0) 100%\n  );\n}\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer custom-base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nbody {\n  position: relative;\n  z-index: 10;\n  font-weight: 400;\n  font-size: 16px;\n  color: #64748b;\n  background-color: #f1f5f9;\n}\n\n::-webkit-scrollbar {\n  width: 0;\n  height: 0;\n}\n"
  },
  {
    "path": "src/styles/sty.ts",
    "content": "export const titleSty = 'border-stroke dark:border-strokedark [&>.ant-card-head]:border-stroke dark:[&>.ant-card-head]:border-strokedark dark:bg-boxdark [&>.ant-card-body]:p-0!'"
  },
  {
    "path": "src/styles/var.scss",
    "content": "$color: #60a5fa;"
  },
  {
    "path": "src/types/app/album.d.ts",
    "content": "export interface AlbumCate {\n  id?: number;\n  name: string;\n  cover: string;\n  images: string[];\n  count: number;\n}\n\nexport interface AlbumImage {\n  id?: number;\n  name: string;\n  description: string;\n  image: string;\n  cateId: number;\n  createTime: number;\n}\n"
  },
  {
    "path": "src/types/app/article.d.ts",
    "content": "import { Cate } from './cate';\nimport { Tag } from './tag';\n\nexport type Status = 'default' | 'no_home' | 'hide';\n\nexport interface Config {\n  id?: number;\n  articleId?: number;\n  status: Status;\n  password: string;\n  isEncrypt: number;\n  isDraft: number;\n  isDel: number;\n}\n\nexport interface Article {\n  id?: number;\n  title: string;\n  description: string;\n  content: string;\n  cover: string;\n  cateIds: number[];\n  cateList?: Cate[];\n  tagIds: number[];\n  tagList?: Tag[];\n  view?: number;\n  comment?: number;\n  config: Config;\n  createTime?: string;\n}\n\nexport interface ArticleFilterDataForm {\n  title?: string;\n  cateId?: number;\n  tagId?: number;\n  createTime: Date[];\n}\n\nexport interface ArticleFilterQueryParams extends Page {\n  key?: string;\n  cateId?: number;\n  tagId?: number;\n  isDraft?: number;\n  isDel?: number;\n  startDate?: string;\n  endDate?: string;\n}\n"
  },
  {
    "path": "src/types/app/assistant.d.ts",
    "content": "export interface Assistant {\n  id: number;\n  name: string;\n  url: string;\n  key: string;\n  model: string;\n  isDefault: number;\n}\n"
  },
  {
    "path": "src/types/app/brand.d.ts",
    "content": "export type BRAND = {\n  logo: string;\n  name: string;\n  visitors: number;\n  revenues: string;\n  sales: number;\n  conversion: number;\n};\n"
  },
  {
    "path": "src/types/app/cate.d.ts",
    "content": "export interface Cate {\n  id?: number;\n  name: string;\n  mark: string;\n  url: string;\n  icon: string;\n  level: number;\n  order: number;\n  type: string;\n  children?: Cate[];\n\n  parent_id?: number[];\n}\n\nexport interface CateFilterQueryParams extends Page {\n  pattern?: 'list' | 'tree';\n}"
  },
  {
    "path": "src/types/app/chat.d.ts",
    "content": "export type Chat = {\n  avatar: string;\n  name: string;\n  text: string;\n  time: number;\n  textCount: number;\n  color: string;\n};\n"
  },
  {
    "path": "src/types/app/comment.d.ts",
    "content": "export interface Comment {\n  id?: number;\n  name: string;\n  avatar: string;\n  email: string | null;\n  url: string;\n  content: string;\n  articleId: number;\n  articleTitle?: string;\n  commentId: number;\n  auditStatus: number;\n  createTime: string;\n}\n\nexport interface Info {\n  tab: string;\n  loading: boolean;\n  list: Comment[];\n  paginate: Page;\n}\n\nexport interface FilterForm {\n  title?: string;\n  content?: string;\n  createTime: Date[];\n}\n"
  },
  {
    "path": "src/types/app/config.d.ts",
    "content": "// 网站配置类型\nexport type WebConfigType = 'web' | 'theme' | 'other';\n\nexport interface Social {\n  name: string;\n  url: string;\n}\n\n// 系统信息\nexport interface System {\n  osName: string;\n  osVersion: string;\n  totalMemory: number;\n  availableMemory: number;\n  memoryUsage: number;\n}\n\n// 网站信息\nexport interface Web {\n  url: string;\n  title: string;\n  subhead: string;\n  favicon: string;\n  description: string;\n  keyword: string;\n  footer: string;\n  icp?: string;\n  create_time?: number;\n}\n\nexport type ArticleLayout = 'classics' | 'card' | 'waterfall' | '';\nexport type RightSidebar = 'author' | 'hotArticle' | 'randomArticle' | 'newComments';\n\n// 主题配置\nexport interface Theme {\n  is_article_layout: string;\n  right_sidebar: string[];\n  light_logo: string;\n  dark_logo: string;\n  swiper_image: string;\n  swiper_text: string[];\n  reco_article: string[];\n  social: string[];\n  covers: string[];\n  record_name: string;\n  record_info: string;\n}\n\n// 其他配置\nexport interface Other {\n  email: string;\n}\n\nexport type EnvConfigName = 'baidu_statis' | 'email' | 'gaode_map' | 'gaode_coordinate';\n\nexport interface Config {\n  id: string;\n  name: string;\n  // value: string,\n  value: object;\n  notes: string;\n}\n"
  },
  {
    "path": "src/types/app/email.d.ts",
    "content": "export interface Email {\n  /*邮件接收者 */\n  to?: string;\n  /*邮件标题 */\n  subject: string;\n  /*邮件接收者 */\n  recipient: string;\n}\n\nexport interface CommentEmail extends Email {\n  content: string;\n  time: string;\n  title: string;\n  url: string;\n}\n\nexport interface DismissEmail extends Email {\n  content: string;\n  time: string;\n  type: string;\n  url: string;\n}\n\nexport interface ReplyWallEmail extends Omit<Email, 'subject'> {\n  /*你的留言 */\n  your_content: string;\n  /*回复留言 */\n  reply_content: string;\n  /*留言时间 */\n  time: string;\n  /*留言链接 */\n  url: string;\n}\n"
  },
  {
    "path": "src/types/app/file.d.ts",
    "content": "export type DirList = 'default' | 'article' | 'swiper' | string;\n\nexport interface File {\n  name: string;\n  size: number;\n  type: string;\n  url: string;\n  createTime: number;\n}\n\nexport interface FileDir {\n  path: string;\n  name: string;\n  icon?: string;\n}\n"
  },
  {
    "path": "src/types/app/footprint.d.ts",
    "content": "export interface Footprint {\n  id: number;\n  title: string;\n  address: string;\n  content: string;\n  position: string;\n  images: string | string[];\n  createTime?: string | Dayjs;\n}\n\nexport interface FilterForm {\n  address?: string;\n  createTime: Date[];\n}\n"
  },
  {
    "path": "src/types/app/oss.d.ts",
    "content": "export interface Oss {\n  id?: number;\n  platform: string;\n  platformName?: string;\n  accessKey: string;\n  secretKey: string;\n  endPoint: string;\n  bucketName: string;\n  domain: string;\n  basePath: string;\n  isEnable: number;\n}\n"
  },
  {
    "path": "src/types/app/package.d.ts",
    "content": "export type Package = {\n  name: string;\n  price: number;\n  invoiceDate: string;\n  status: string;\n};\n"
  },
  {
    "path": "src/types/app/permission.d.ts",
    "content": "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",
    "content": "export type Product = {\n  image: string;\n  name: string;\n  category: string;\n  price: number;\n  sold: number;\n  profit: number;\n};\n"
  },
  {
    "path": "src/types/app/record.d.ts",
    "content": "export interface Record {\n  id?: number;\n  content: string;\n  images: string | string[];\n  createTime?: string | Dayjs;\n}\n"
  },
  {
    "path": "src/types/app/role.d.ts",
    "content": "export interface Role {\n  id: number;\n  name: string;\n  mark: string;\n  description: string;\n}\n"
  },
  {
    "path": "src/types/app/route.d.ts",
    "content": "export interface Route {\n  id?: number;\n  path: string;\n  description: string;\n}\n"
  },
  {
    "path": "src/types/app/rss.d.ts",
    "content": "import { Web } from './web';\n\nexport interface Rss extends Omit<Web, 'id' | 'type' | 'typeId' | 'rss'> {\n  type: string;\n}\n"
  },
  {
    "path": "src/types/app/swiper.d.ts",
    "content": "export interface Swiper {\n  id?: number;\n  title: string;\n  description: string;\n  url: string;\n  image: string;\n  createtime?: string;\n}\n"
  },
  {
    "path": "src/types/app/tag.d.ts",
    "content": "export interface Tag {\n  id?: number;\n  name: string;\n}\n"
  },
  {
    "path": "src/types/app/user.d.ts",
    "content": "export interface Login {\n  username: string;\n  password: string;\n}\n\nexport interface UserInfo {\n  id?: number;\n  name: string;\n  email: string;\n  avatar: string;\n  info: string;\n  role: Role;\n  roleId?: number;\n}\n\nexport type User = Login & UserInfo & { createTime?: string };\n\nexport interface LoginReturn {\n  token: string;\n  user: User;\n  role: Role;\n}\n\nexport interface EditUser {\n  oldUsername: string;\n  newUsername: string;\n  oldPassword: string;\n  newPassword: string;\n}\n\nexport interface FilterForm {\n  name?: string;\n  role?: number;\n  createTime: Date[];\n}\n\nexport interface FilterUser extends FilterQueryParams {\n  name?: string;\n  roleId?: number;\n}\n"
  },
  {
    "path": "src/types/app/wall.d.ts",
    "content": "export interface Cate {\n  id: number;\n  name: string;\n  mark: string;\n  order: number;\n}\n\nexport interface Wall {\n  id: number;\n  name: string;\n  cateId: number;\n  cate: Category;\n  color: string;\n  content: string;\n  email: string;\n  auditStatus: number;\n  isChoice: number;\n  createTime: string;\n}\n\nexport interface FilterForm {\n  content?: string;\n  cateId?: number;\n  createTime: Date[];\n}\n\nexport interface FilterWall extends FilterQueryParams {\n  content?: string;\n  cateId?: number;\n}\n"
  },
  {
    "path": "src/types/app/web.d.ts",
    "content": "export interface WebType {\n  id: number;\n  name: string;\n  order: number;\n  isAdmin: number;\n}\n\nexport interface Web {\n  id: number;\n  title: string;\n  description: string;\n  email: string;\n  image: string;\n  url: string;\n  rss: string;\n  order: number;\n  typeId: number;\n  type: WebType;\n  auditStatus: number;\n  createTime?: string;\n}\n"
  },
  {
    "path": "src/types/env.d.ts",
    "content": "interface ImportMetaEnv {\n  readonly VITE_PROJECT_API: string;\n\n  readonly VITE_BAIDU_TONGJI_SITE_ID: string;\n  readonly VITE_BAIDU_TONGJI_ACCESS_TOKEN: string;\n\n  readonly VITE_AI_APIPASSWORD: string;\n  readonly VITE_AI_MODEL: string;\n\n  readonly VITE_GAODE_WEB_API: string;\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv;\n}\n"
  },
  {
    "path": "src/types/global.d.ts",
    "content": "declare module '*.png';\ndeclare module '*.svg';\ndeclare module '*.jpeg';\ndeclare module '*.jpg';\n\ndeclare module '*.svg?raw' {\n  const content: string;\n  export default content;\n}\n\ndeclare module '*.svg' {\n  const content: string;\n  export default content;\n}\n"
  },
  {
    "path": "src/types/response.d.ts",
    "content": "interface Response<T> {\n  code: number;\n  message: string;\n  data: T;\n}\n\ninterface Paginate<T> {\n  next: boolean;\n  prev: boolean;\n  page: number;\n  size: number;\n  pages: number;\n  total: number;\n  result: T;\n}\n\ninterface Page {\n  page?: number;\n  size?: number;\n}\n\ninterface FilterQueryParams {\n  key?: string;\n  content?: string;\n  status?: 0 | 1;\n  startDate?: string;\n  endDate?: string;\n  createTime?: Date[];\n}\n\ninterface QueryData<T = FilterQueryParams> {\n  // 通用的\n  sort?: 'asc' | 'desc';\n  pattern?: 'list' | 'recursion';\n  query?: T;\n\n  // 文件相关\n  dir?: 'all' | string;\n}\n"
  },
  {
    "path": "src/utils/index.ts",
    "content": "// 对象转url参数\nexport const ObjectToUrlParam = (obj: object): string => {\n    return obj && new URLSearchParams(\n        Object.keys(obj).reduce((acc, key) => {\n            acc[key] = String(obj[key as keyof object]);\n            return acc;\n        }, {} as Record<string, string>)\n    ).toString();\n}"
  },
  {
    "path": "src/utils/permission.ts",
    "content": "import { Permission } from '@/types/app/permission';\n\n// 判断是否有权限\nexport const useHasPermission = (code: string) => {\n    const permission = JSON.parse(localStorage.getItem('user_storage') || '{}')?.state?.permission;\n    return permission?.some((permission: Permission) => permission.name === code);\n}\n\nexport default {\n    user: {\n        add: useHasPermission('user:add'),\n        del: useHasPermission('user:del'),\n        edit: useHasPermission('user:edit'),\n        info: useHasPermission('user:info'),\n        list: useHasPermission('user:list'),\n        pass: useHasPermission('user:pass')\n    },\n    data: {\n        add: useHasPermission('data:add'),\n        del: useHasPermission('data:del')\n    },\n    article: {\n        add: useHasPermission('article:add'),\n        del: useHasPermission('article:del'),\n        reduction: useHasPermission('article:reduction'),\n        edit: useHasPermission('article:edit')\n    },\n    cate: {\n        add: useHasPermission('cate:add'),\n        del: useHasPermission('cate:del'),\n        edit: useHasPermission('cate:edit')\n    },\n    comment: {\n        del: useHasPermission('comment:del'),\n        edit: useHasPermission('comment:edit'),\n        audit: useHasPermission('comment:audit')\n    },\n    config: {\n        edit: useHasPermission('config:edit')\n    },\n    email: {\n        dismiss: useHasPermission('email:dismiss')\n    },\n    file: {\n        info: useHasPermission('file:info'),\n        dir: useHasPermission('file:dir'),\n        list: useHasPermission('file:list'),\n        add: useHasPermission('file:add'),\n        del: useHasPermission('file:del')\n    },\n    oss: {\n        add: useHasPermission('oss:add'),\n        del: useHasPermission('oss:del'),\n        edit: useHasPermission('oss:edit'),\n        info: useHasPermission('oss:info'),\n        list: useHasPermission('oss:list'),\n        enable: useHasPermission('oss:enable'),\n        getEnableOss: useHasPermission('oss:getEnableOss'),\n        getPlatform: useHasPermission('oss:getPlatform')\n    },\n    record: {\n        add: useHasPermission('record:add'),\n        del: useHasPermission('record:del'),\n        edit: useHasPermission('record:edit')\n    },\n    role: {\n        add: useHasPermission('role:add'),\n        del: useHasPermission('role:del'),\n        edit: useHasPermission('role:edit'),\n        info: useHasPermission('role:info'),\n        list: useHasPermission('role:list'),\n        bindingRoute: useHasPermission('role:bindingRoute')\n    },\n    route: {\n        add: useHasPermission('route:add'),\n        del: useHasPermission('route:del'),\n        edit: useHasPermission('route:edit'),\n        info: useHasPermission('route:info'),\n        list: useHasPermission('route:list')\n    },\n    swiper: {\n        add: useHasPermission('swiper:add'),\n        del: useHasPermission('swiper:del'),\n        edit: useHasPermission('swiper:edit')\n    },\n    tag: {\n        add: useHasPermission('tag:add'),\n        del: useHasPermission('tag:del'),\n        edit: useHasPermission('tag:edit')\n    },\n    wall: {\n        del: useHasPermission('wall:del'),\n        edit: useHasPermission('wall:edit'),\n        audit: useHasPermission('wall:audit')\n    },\n    permission: {\n        add: useHasPermission('permission:add'),\n        del: useHasPermission('permission:del'),\n        edit: useHasPermission('permission:edit'),\n        info: useHasPermission('permission:info'),\n        list: useHasPermission('permission:list')\n    }\n}"
  },
  {
    "path": "src/utils/request.ts",
    "content": "import axios, { AxiosError, AxiosResponse, InternalAxiosRequestConfig } from 'axios';\nimport { Modal, notification } from 'antd';\nimport { useUserStore } from '@/stores';\n\n// 配置项目API域名\n// 最新调整：在本地 .env 文件配置你的后端API地址\nexport const baseURL = import.meta.env.VITE_PROJECT_API;\n\n// 创建 axios 实例\nexport const instance = axios.create({\n    // 项目API根路径\n    baseURL,\n    // 请求超时的时间\n    timeout: 10000,\n});\n\n// 用于取消请求\nconst CancelToken = axios.CancelToken;\nconst source = CancelToken.source();\n\n// 标记是否已经处理过401错误\nlet isHandling401Error = false;\n\n// 请求拦截\ninstance.interceptors.request.use(\n    (config: InternalAxiosRequestConfig) => {\n        // 获取token\n        const token = JSON.parse(localStorage.getItem('user_storage') || '{}')?.state.token\n\n        // 如果有token就把赋值给请求头\n        if (token) config.headers['Authorization'] = `Bearer ${token}`;\n\n        return config;\n    },\n    (err: AxiosError) => {\n        notification.error({\n            message: '请求异常',\n            description: err.message,\n        })\n\n        return Promise.reject(err);\n    }\n);\n\n// 响应拦截\ninstance.interceptors.response.use(\n    (res: AxiosResponse) => {\n        if (res.data?.code === 600) return res.data\n\n        // 只要code不等于200, 就相当于响应失败\n        if (res.data?.code !== 200) {\n            notification.error({\n                message: '响应异常',\n                description: res.data?.message || '未知错误',\n            })\n\n            return Promise.reject(res.data);\n        }\n\n        return res.data;\n    },\n    (err: AxiosError) => {\n        if (isHandling401Error) return;\n\n        // 如果code为401就证明认证失败\n        if (err.response?.status === 401) {\n            isHandling401Error = true; // 标记为正在处理401错误\n\n            Modal.error({\n                title: '暂无权限',\n                content: '🔒️ 登录已过期，请重新登录?',\n                okText: '去登录',\n                onOk: () => {\n                    const store = useUserStore.getState()\n                    store.quitLogin()\n                    isHandling401Error = false; // 重置标记\n                }\n            });\n\n            // 取消后续的所有请求\n            source.cancel('认证失败，取消所有请求');\n\n            return Promise.reject(err.response?.data);\n        }\n\n        notification.error({\n            message: '程序异常',\n            description: err.message || '未知错误',\n        })\n\n        return Promise.reject(err);\n    }\n);\n\nconst request = <T>(method: string, url: string, reqParams?: object) => {\n    return instance.request<Response<T>, Response<T>>({\n        method,\n        url,\n        ...reqParams,\n        cancelToken: source.token\n    });\n};\n\nexport default request;"
  },
  {
    "path": "src/utils/route.tsx",
    "content": "import { BiEditAlt, BiFolderOpen, BiHomeSmile, BiSliderAlt, BiCategoryAlt, BiBug } from 'react-icons/bi';\nimport { TbBrandAirtable } from 'react-icons/tb';\nimport React from 'react';\n\n// 路由配置接口\nexport interface RouteConfig {\n  path: string;\n  title: string;\n  icon?: React.ReactNode;\n}\n\n// 路由配置映射\nconst routeConfigMap: Record<string, RouteConfig> = {\n  '/': {\n    path: '/',\n    title: '首页',\n    icon: <BiHomeSmile className=\"text-base\" />,\n  },\n  '/create': {\n    path: '/create',\n    title: '发挥灵感',\n    icon: <BiEditAlt className=\"text-base\" />,\n  },\n  '/create_record': {\n    path: '/create_record',\n    title: '闪念',\n    icon: <BiEditAlt className=\"text-base\" />,\n  },\n  '/draft': {\n    path: '/draft',\n    title: '草稿箱',\n    icon: <BiEditAlt className=\"text-base\" />,\n  },\n  '/recycle': {\n    path: '/recycle',\n    title: '回收站',\n    icon: <BiEditAlt className=\"text-base\" />,\n  },\n  '/cate': {\n    path: '/cate',\n    title: '导航管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/article': {\n    path: '/article',\n    title: '文章管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/record': {\n    path: '/record',\n    title: '说说管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/tag': {\n    path: '/tag',\n    title: '标签管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/comment': {\n    path: '/comment',\n    title: '评论管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/wall': {\n    path: '/wall',\n    title: '留言管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/web': {\n    path: '/web',\n    title: '网站管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/swiper': {\n    path: '/swiper',\n    title: '轮播图管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/footprint': {\n    path: '/footprint',\n    title: '足迹管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/storage': {\n    path: '/storage',\n    title: '存储管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/setup': {\n    path: '/setup',\n    title: '项目配置',\n    icon: <BiSliderAlt className=\"text-base\" />,\n  },\n  '/file': {\n    path: '/file',\n    title: '文件管理',\n    icon: <BiFolderOpen className=\"text-base\" />,\n  },\n  '/iter': {\n    path: '/iter',\n    title: '项目更新记录',\n    icon: <BiBug className=\"text-base\" />,\n  },\n  '/work': {\n    path: '/work',\n    title: '工作台',\n    icon: <TbBrandAirtable className=\"text-base\" />,\n  },\n  '/assistant': {\n    path: '/assistant',\n    title: '助手管理',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n  '/config': {\n    path: '/config',\n    title: '项目配置',\n    icon: <BiCategoryAlt className=\"text-base\" />,\n  },\n};\n\n/**\n * 根据路径获取路由配置\n */\nexport const getRouteConfig = (pathname: string): RouteConfig | null => {\n  // 精确匹配\n  if (routeConfigMap[pathname]) {\n    return routeConfigMap[pathname];\n  }\n\n  // 模糊匹配（用于带参数的路由）\n  for (const [path, config] of Object.entries(routeConfigMap)) {\n    if (pathname.startsWith(path) && path !== '/') {\n      return config;\n    }\n  }\n\n  return null;\n};\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ESNext\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"src/*\"]\n    },\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\",\n\n    /* Linting */\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true\n  },\n  \"include\": [\"src\", \"src/types/app/lib.d.ts\"],\n  \"references\": [{ \"path\": \"./tsconfig.node.json\" }]\n}\n"
  },
  {
    "path": "tsconfig.node.json",
    "content": "{\n  \"compilerOptions\": {\n    \"composite\": true,\n    \"skipLibCheck\": true,\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"bundler\",\n    \"allowSyntheticDefaultImports\": true\n  },\n  \"include\": [\"vite.config.ts\"]\n}\n"
  },
  {
    "path": "vercel.json",
    "content": "{\n    \"rewrites\": [\n        {\n            \"source\": \"/:path*\",\n            \"destination\": \"/index.html\"\n        }\n    ]\n}"
  },
  {
    "path": "vite.config.js",
    "content": "/* eslint-disable no-undef */\nimport { defineConfig } from 'vite'\nimport sassDts from 'vite-plugin-sass-dts';\nimport react from '@vitejs/plugin-react'\nimport path from 'path';\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [react(), sassDts()],\n  // 配置快捷路径\n  resolve: {\n    alias: {\n      '@': path.resolve(__dirname, './src'),\n      '~': path.resolve(__dirname, 'src')\n    },\n  },\n  // 配置scss样式自动引入\n  css: {\n    preprocessorOptions: {\n      scss: {\n        loadPaths: [path.resolve(__dirname, 'src/styles')],\n        additionalData: `@use \"var.scss\" as *;`\n      }\n    }\n  },\n  server: {\n    port: 9100,\n  },\n})\n"
  }
]