This commit is contained in:
zhangjianjun 2026-07-09 16:17:33 +08:00
commit 8d1bf90ba3
45 changed files with 2945 additions and 0 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
VITE_BASE_URL=http://twin.batiao8.com
VITE_APP_ID=10063

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

8
.oxlintrc.json Normal file
View File

@ -0,0 +1,8 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}

32
README.md Normal file
View File

@ -0,0 +1,32 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the Oxlint configuration
If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
```
See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>app-twins</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "app-twins",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "oxlint",
"preview": "vite preview"
},
"dependencies": {
"bowser": "^2.14.1",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-router-dom": "^7.18.1"
},
"devDependencies": {
"@types/node": "^24.13.2",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.3",
"oxlint": "^1.71.0",
"typescript": "~6.0.2",
"vite": "^8.1.1"
}
}

867
pnpm-lock.yaml Normal file
View File

@ -0,0 +1,867 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
dependencies:
bowser:
specifier: ^2.14.1
version: 2.14.1
react:
specifier: ^19.2.7
version: 19.2.7
react-dom:
specifier: ^19.2.7
version: 19.2.7(react@19.2.7)
react-router-dom:
specifier: ^7.18.1
version: 7.18.1(react-dom@19.2.7(react@19.2.7))(react@19.2.7)
devDependencies:
'@types/node':
specifier: ^24.13.2
version: 24.13.2
'@types/react':
specifier: ^19.2.17
version: 19.2.17
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/react@19.2.17)
'@vitejs/plugin-react':
specifier: ^6.0.3
version: 6.0.3(vite@8.1.2(@types/node@24.13.2))
oxlint:
specifier: ^1.71.0
version: 1.72.0
typescript:
specifier: ~6.0.2
version: 6.0.3
vite:
specifier: ^8.1.1
version: 8.1.2(@types/node@24.13.2)
packages:
'@emnapi/core@1.11.1':
resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==}
'@emnapi/runtime@1.11.1':
resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==}
'@emnapi/wasi-threads@1.2.2':
resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==}
'@napi-rs/wasm-runtime@1.1.6':
resolution: {integrity: sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==}
peerDependencies:
'@emnapi/core': ^1.7.1
'@emnapi/runtime': ^1.7.1
'@oxc-project/types@0.137.0':
resolution: {integrity: sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==}
'@oxlint/binding-android-arm-eabi@1.72.0':
resolution: {integrity: sha512-zhCmvn+1Mj3UchAc/90i99S0t7jJUsHmFVSPg4UWrjO8b8eaSGwscgO6QAUtvHBstkjQwBttQNswEnAF1mIQdA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [android]
'@oxlint/binding-android-arm64@1.72.0':
resolution: {integrity: sha512-mtH+aY/ozv1eZoCUC2owjFAtyNBKHpJHygKeEu9zXXnQGW1Q2/qOpvx+I+Lf23+TvTz66F4iiXUbl2cGvoLPCQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [android]
'@oxlint/binding-darwin-arm64@1.72.0':
resolution: {integrity: sha512-EvnajNPDtfknB3ZieeOOyDTwJn9QXDiwfnF4ZDQqART6RG6hjY4WigQcZdGoK2dkB3e1vrmEzN9aYbQCUkh/gQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [darwin]
'@oxlint/binding-darwin-x64@1.72.0':
resolution: {integrity: sha512-ZkCdEa/G80A7vEHfeCDz/+L3m33DE73v32mDKhgOIgz8Uwf0DFcK7+uu6qC+7LEhmz5fpOe1osWKyjSNMydFIQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [darwin]
'@oxlint/binding-freebsd-x64@1.72.0':
resolution: {integrity: sha512-NroXv2vh+sxVY1uya/rM5pjhx1hm8BzlYpx9q67QP0Xhw5MH2bf5GJylpvLEC+781p1Xli/317EoV9AlGwViag==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [freebsd]
'@oxlint/binding-linux-arm-gnueabihf@1.72.0':
resolution: {integrity: sha512-0NDywYgfj279Ou/BcQuCYSj7NJwBfmWn5qc5uGO/Ny7fUWmXyIpvawqX/8acQlWG6IXelJsJhj+JAy6sjsKj0A==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [linux]
'@oxlint/binding-linux-arm-musleabihf@1.72.0':
resolution: {integrity: sha512-4vpXB06h65Ezsy4hRyrGjGrfa1SkVPii09yaajiYhmVpgsFiLD+KNxIx/BNAY+XiO+i1yqp9HHdwqM8VTqa5XQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [linux]
'@oxlint/binding-linux-arm64-gnu@1.72.0':
resolution: {integrity: sha512-immaN4g2ZGFiOkKrvRX9LvzZdd2GkQM5wR+UyzYyUuyhUTXGQ4HKUJH18xp4G8OfhCVaVAJfKZxwE1r8+4hhaQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@oxlint/binding-linux-arm64-musl@1.72.0':
resolution: {integrity: sha512-JGHS9Mnr7iWyyLDxgCv1MhzVpAckgptg00F2gnxt/GD7lQ2SW1BRcxHqhSTaSdDpjWRrBkBxMMh4+Hn3aVtExg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
libc: [musl]
'@oxlint/binding-linux-ppc64-gnu@1.72.0':
resolution: {integrity: sha512-AOYgBZqxNshrg83P9v0RYv+m8s10Cqkj4/PxXFDhcS3k7FqsIG5+CxErshZCIN7G8iy4Y+VGfAsuEdar8AcbBg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@oxlint/binding-linux-riscv64-gnu@1.72.0':
resolution: {integrity: sha512-QMybPS5ij3/vrKG67mqzHwW++91sYxK/PPUVi6SBtNCEzW4niS52fVBdXbQ6nou0wWbUPEpx8Sl/ZjtgE3clXA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@oxlint/binding-linux-riscv64-musl@1.72.0':
resolution: {integrity: sha512-gOc3W7JV0PXRpIL7stUlLe3Wa9Gp0Kdlup87IT3gHDvPKck2xNgMIl/Gs2lldYY2lyXZDC4rWi3hmoLUobkgbQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [riscv64]
os: [linux]
libc: [musl]
'@oxlint/binding-linux-s390x-gnu@1.72.0':
resolution: {integrity: sha512-rpGxph+FjjHcYI5q6uxB3Az+tnfmEnDbSA8+PK9ZE/VzyUAkvBOMeuY7ZQMhu5mpZH7YQDsTdW6Cx4kV/msc6w==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@oxlint/binding-linux-x64-gnu@1.72.0':
resolution: {integrity: sha512-WND+uhf/Ko13SLqQMWQUgsZuLvYYEvL0ZKgg0tgGYfLqxG7l8Ju123fHDMJyYSDl5E3bUbpFUuii/OvMreFQzw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
libc: [glibc]
'@oxlint/binding-linux-x64-musl@1.72.0':
resolution: {integrity: sha512-SrpbrUL70nG9vh6zP4/oKHWgLuHquwsr7MW9XOn0olBVgh10Uqr8qscKhQoBGEn6olK/IUpn5GSKcdQ5AjUhGA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
libc: [musl]
'@oxlint/binding-openharmony-arm64@1.72.0':
resolution: {integrity: sha512-qkrsEn6NmgFKr7U/QnezQMb+q/vzAy0Dd9Y95gQGQTyjzDLN+HRZMuM5u70iyH4nBLCfKBzhjMsYCehKay2jyg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [openharmony]
'@oxlint/binding-win32-arm64-msvc@1.72.0':
resolution: {integrity: sha512-LWR6ZlFZph+KPjXv8opgZsXRDCdrdQe8VL8Cg9zxCoBS73h6znzZpydVgmdnwj8mB9AuSM5jxEgDJDpQkjboeg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [win32]
'@oxlint/binding-win32-ia32-msvc@1.72.0':
resolution: {integrity: sha512-yt6HEh7IsHvtjRWtmeZRX134eaXKHq5Gnqlf1xBJdJl1JtdoRUEJw3nAxpZoUDS860cX/foKbztO441anVBtVQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ia32]
os: [win32]
'@oxlint/binding-win32-x64-msvc@1.72.0':
resolution: {integrity: sha512-b2eKFD2hX7tIwmo/cyH6TDq8vzWRZ2qNHrzoGntUTmq0h3zQh/uX3eTSHCwI8OB/ADQfJCRelLItK8BsxuucDA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [win32]
'@rolldown/binding-android-arm64@1.1.3':
resolution: {integrity: sha512-DT6Z3PhvioeHMvxo+xHc3KtqggrI7CCTXCmC2h/5zUlp5jVitv7XEy+9q5/7v8IolhlioawpMo8Kg0EEBy7J0g==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [android]
'@rolldown/binding-darwin-arm64@1.1.3':
resolution: {integrity: sha512-0NwgwsjM7LrsuVnXMK3koTpagBNOhloc/BNjKqZjv4V5zI5r13qx69uVhRx+o5Z0yy4Hzq+lpy7TAgUG/ocvrw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [darwin]
'@rolldown/binding-darwin-x64@1.1.3':
resolution: {integrity: sha512-YtiBp4disu6V560loT6PjMdiRaWmVvDNrUunAalbiFx2ggeJwxdAsgZMcoGP17uyAsTwAj5V1niksxlHnVQ1Sw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [darwin]
'@rolldown/binding-freebsd-x64@1.1.3':
resolution: {integrity: sha512-yD3EkEdXk2LypPxnf/kSZHirarsI8gcPzc62SukhR9VJTyvV+F9Q/GxWNuCojc7sXyuVC4DxRGhdDK4X8VSsbw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [freebsd]
'@rolldown/binding-linux-arm-gnueabihf@1.1.3':
resolution: {integrity: sha512-c+8vieQbsD7HNAHKIA34w0GJ9FedFFuJGD+7E6vz7Q3uqAIugL5p45fhlsj4UaAsHpcmlqugBWMhA0/j7o0sIg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [linux]
'@rolldown/binding-linux-arm64-gnu@1.1.3':
resolution: {integrity: sha512-50jD0uUwLvur7Zz9LHz17kaAdTPjn5wN93hEgjvmYFRZwiR7ZJYovTd5ipyWJDAnXKvZ+wgc+/Ika6dwSF5OcA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@rolldown/binding-linux-arm64-musl@1.1.3':
resolution: {integrity: sha512-BO9+oPL8K9poZJBfYPsXNtYjPE5uM3qeehT3aFcW4LITOl+iSqhp0abzjR2nWBUNjIZeKXjAEWBZ64WjNoHd6w==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
libc: [musl]
'@rolldown/binding-linux-ppc64-gnu@1.1.3':
resolution: {integrity: sha512-f3VpLB1vQ0Eo6ecr/6cekLnvYMFF4YBFoVGkfkvPLq1bAkbAwHYQPZKoAmG6OJyTcxxoC+AvezGx/S1obNC0Mw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@rolldown/binding-linux-s390x-gnu@1.1.3':
resolution: {integrity: sha512-AmurZ26Pqx/RI9N1gzEOCklkKXl927yjfXWUUS0O7Puh8ARM/Ob8qfrD3qnWksScdw6cSrW5PSHE9DyLu7+PtA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@rolldown/binding-linux-x64-gnu@1.1.3':
resolution: {integrity: sha512-JJpqs8bRGITDOdbkNKnlojzBabbOHrqjSvDr0IVsZObE1lBcPjxItUEY9eWIDbxaJ3cGrXPWGfGkIxFijg/URg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
libc: [glibc]
'@rolldown/binding-linux-x64-musl@1.1.3':
resolution: {integrity: sha512-rSJcdjPxzA/by/6/rYs+v+bXU7UjvnbUWz8MJb6kh6+knqB1dCrtHg0uu7C/4haqJvqdkYHQ5IGn+tCH9GLW/g==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
libc: [musl]
'@rolldown/binding-openharmony-arm64@1.1.3':
resolution: {integrity: sha512-hQ3/PYkDJICgevvyNcVrihVeqq7k1Pp3VZ9lY+dauAYUJKO+auqApvANhvR1An9BhmqYKvW2Mu1F9u4DXSMLxQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [openharmony]
'@rolldown/binding-wasm32-wasi@1.1.3':
resolution: {integrity: sha512-Elcv/BtML9lXrV6JuKITc/grN2kYV9gjsQpW8Jfw4ioK0TOkjBjye0nnyqQNy9STNaI20lXNaQBRrD5gSgR0Yg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [wasm32]
'@rolldown/binding-win32-arm64-msvc@1.1.3':
resolution: {integrity: sha512-2DrEfhluH9yhiaFApmsjsjwrSYbNcY1oFTzYSP1a535jDbV98zCFanA/96TBUd0iDFcxGmw9QRExwGCXz3U+/g==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [win32]
'@rolldown/binding-win32-x64-msvc@1.1.3':
resolution: {integrity: sha512-OL4OMk7UPXOeVGGd3qo5zJyPIljf4AFgk5QAkPPS+OoLuOOozhuaQGC18MxVTnw/06q93gShAJzlwnSCY9YtqA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [win32]
'@rolldown/pluginutils@1.0.1':
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
'@tybys/wasm-util@0.10.3':
resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}
'@types/node@24.13.2':
resolution: {integrity: sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA==}
'@types/react-dom@19.2.3':
resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==}
peerDependencies:
'@types/react': ^19.2.0
'@types/react@19.2.17':
resolution: {integrity: sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==}
'@vitejs/plugin-react@6.0.3':
resolution: {integrity: sha512-vmFvco5/QuC2f9Oj+wTk0+9XeDFkHxSamwZKYc7MxYwKICfvUvlMhqKI0VuICPltGqh1neqBKDvO4kes1ya8vg==}
engines: {node: ^20.19.0 || >=22.12.0}
peerDependencies:
'@rolldown/plugin-babel': ^0.1.7 || ^0.2.0
babel-plugin-react-compiler: ^1.0.0
vite: ^8.0.0
peerDependenciesMeta:
'@rolldown/plugin-babel':
optional: true
babel-plugin-react-compiler:
optional: true
bowser@2.14.1:
resolution: {integrity: sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==}
cookie@1.1.1:
resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==}
engines: {node: '>=18'}
csstype@3.2.3:
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
detect-libc@2.1.2:
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
engines: {node: '>=8'}
fdir@6.5.0:
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
engines: {node: '>=12.0.0'}
peerDependencies:
picomatch: ^3 || ^4
peerDependenciesMeta:
picomatch:
optional: true
fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
lightningcss-android-arm64@1.32.0:
resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [android]
lightningcss-darwin-arm64@1.32.0:
resolution: {integrity: sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [darwin]
lightningcss-darwin-x64@1.32.0:
resolution: {integrity: sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [darwin]
lightningcss-freebsd-x64@1.32.0:
resolution: {integrity: sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [freebsd]
lightningcss-linux-arm-gnueabihf@1.32.0:
resolution: {integrity: sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==}
engines: {node: '>= 12.0.0'}
cpu: [arm]
os: [linux]
lightningcss-linux-arm64-gnu@1.32.0:
resolution: {integrity: sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
libc: [glibc]
lightningcss-linux-arm64-musl@1.32.0:
resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
libc: [musl]
lightningcss-linux-x64-gnu@1.32.0:
resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
libc: [glibc]
lightningcss-linux-x64-musl@1.32.0:
resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
libc: [musl]
lightningcss-win32-arm64-msvc@1.32.0:
resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [win32]
lightningcss-win32-x64-msvc@1.32.0:
resolution: {integrity: sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [win32]
lightningcss@1.32.0:
resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==}
engines: {node: '>= 12.0.0'}
nanoid@3.3.15:
resolution: {integrity: sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
oxlint@1.72.0:
resolution: {integrity: sha512-1rhdZIP/EvoI91ABIwNU5Q8+bWf8mjrS5UzIOZld4d4bXxJvtlUhlQvaoTogIGin/qdErMOrwaIJvCSIAKTLhA==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
peerDependencies:
oxlint-tsgolint: '>=0.22.1'
vite-plus: '*'
peerDependenciesMeta:
oxlint-tsgolint:
optional: true
vite-plus:
optional: true
picocolors@1.1.1:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
picomatch@4.0.4:
resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==}
engines: {node: '>=12'}
postcss@8.5.16:
resolution: {integrity: sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==}
engines: {node: ^10 || ^12 || >=14}
react-dom@19.2.7:
resolution: {integrity: sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==}
peerDependencies:
react: ^19.2.7
react-router-dom@7.18.1:
resolution: {integrity: sha512-KaZh+X/6UtEp28x51AUYZDMg9NGoz2ja3dNHa+ta/tk40vCzKhQ/RypCWBMLbmDr6//E24Vv5uPsrqXFozdkAg==}
engines: {node: '>=20.0.0'}
peerDependencies:
react: '>=18'
react-dom: '>=18'
react-router@7.18.1:
resolution: {integrity: sha512-GDLgg3i3uM0aeJO3Fm+TCS+sDQ7gu12T6x0qdTEzcwqEfleci7JwugVNIF3U//0FWKnJT7ptG+20B2jfDqnZAg==}
engines: {node: '>=20.0.0'}
peerDependencies:
react: '>=18'
react-dom: '>=18'
peerDependenciesMeta:
react-dom:
optional: true
react@19.2.7:
resolution: {integrity: sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==}
engines: {node: '>=0.10.0'}
rolldown@1.1.3:
resolution: {integrity: sha512-1F1eEtUBtFvcGm1HQ9TiUIUHPQG7mSAODrhIzjxoUEFuo8OcbrGLiVLkevNgj84TE4lnHvnumwFjhJO5Eu135g==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
scheduler@0.27.0:
resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==}
set-cookie-parser@2.7.2:
resolution: {integrity: sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==}
source-map-js@1.2.1:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
tinyglobby@0.2.17:
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
engines: {node: '>=12.0.0'}
tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
typescript@6.0.3:
resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
engines: {node: '>=14.17'}
hasBin: true
undici-types@7.18.2:
resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==}
vite@8.1.2:
resolution: {integrity: sha512-6YYPbRXTxx6bRXmOn7XdnQAy5DQNHhDgtjhDHI13oe4pY93kkcdGJWxpGwOm++/Wh0QpQhDrpIoVMrmrsI5AGQ==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
peerDependencies:
'@types/node': ^20.19.0 || >=22.12.0
'@vitejs/devtools': ^0.3.0
esbuild: ^0.27.0 || ^0.28.0
jiti: '>=1.21.0'
less: ^4.0.0
sass: ^1.70.0
sass-embedded: ^1.70.0
stylus: '>=0.54.8'
sugarss: ^5.0.0
terser: ^5.16.0
tsx: ^4.8.1
yaml: ^2.4.2
peerDependenciesMeta:
'@types/node':
optional: true
'@vitejs/devtools':
optional: true
esbuild:
optional: true
jiti:
optional: true
less:
optional: true
sass:
optional: true
sass-embedded:
optional: true
stylus:
optional: true
sugarss:
optional: true
terser:
optional: true
tsx:
optional: true
yaml:
optional: true
snapshots:
'@emnapi/core@1.11.1':
dependencies:
'@emnapi/wasi-threads': 1.2.2
tslib: 2.8.1
optional: true
'@emnapi/runtime@1.11.1':
dependencies:
tslib: 2.8.1
optional: true
'@emnapi/wasi-threads@1.2.2':
dependencies:
tslib: 2.8.1
optional: true
'@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)':
dependencies:
'@emnapi/core': 1.11.1
'@emnapi/runtime': 1.11.1
'@tybys/wasm-util': 0.10.3
optional: true
'@oxc-project/types@0.137.0': {}
'@oxlint/binding-android-arm-eabi@1.72.0':
optional: true
'@oxlint/binding-android-arm64@1.72.0':
optional: true
'@oxlint/binding-darwin-arm64@1.72.0':
optional: true
'@oxlint/binding-darwin-x64@1.72.0':
optional: true
'@oxlint/binding-freebsd-x64@1.72.0':
optional: true
'@oxlint/binding-linux-arm-gnueabihf@1.72.0':
optional: true
'@oxlint/binding-linux-arm-musleabihf@1.72.0':
optional: true
'@oxlint/binding-linux-arm64-gnu@1.72.0':
optional: true
'@oxlint/binding-linux-arm64-musl@1.72.0':
optional: true
'@oxlint/binding-linux-ppc64-gnu@1.72.0':
optional: true
'@oxlint/binding-linux-riscv64-gnu@1.72.0':
optional: true
'@oxlint/binding-linux-riscv64-musl@1.72.0':
optional: true
'@oxlint/binding-linux-s390x-gnu@1.72.0':
optional: true
'@oxlint/binding-linux-x64-gnu@1.72.0':
optional: true
'@oxlint/binding-linux-x64-musl@1.72.0':
optional: true
'@oxlint/binding-openharmony-arm64@1.72.0':
optional: true
'@oxlint/binding-win32-arm64-msvc@1.72.0':
optional: true
'@oxlint/binding-win32-ia32-msvc@1.72.0':
optional: true
'@oxlint/binding-win32-x64-msvc@1.72.0':
optional: true
'@rolldown/binding-android-arm64@1.1.3':
optional: true
'@rolldown/binding-darwin-arm64@1.1.3':
optional: true
'@rolldown/binding-darwin-x64@1.1.3':
optional: true
'@rolldown/binding-freebsd-x64@1.1.3':
optional: true
'@rolldown/binding-linux-arm-gnueabihf@1.1.3':
optional: true
'@rolldown/binding-linux-arm64-gnu@1.1.3':
optional: true
'@rolldown/binding-linux-arm64-musl@1.1.3':
optional: true
'@rolldown/binding-linux-ppc64-gnu@1.1.3':
optional: true
'@rolldown/binding-linux-s390x-gnu@1.1.3':
optional: true
'@rolldown/binding-linux-x64-gnu@1.1.3':
optional: true
'@rolldown/binding-linux-x64-musl@1.1.3':
optional: true
'@rolldown/binding-openharmony-arm64@1.1.3':
optional: true
'@rolldown/binding-wasm32-wasi@1.1.3':
dependencies:
'@emnapi/core': 1.11.1
'@emnapi/runtime': 1.11.1
'@napi-rs/wasm-runtime': 1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)
optional: true
'@rolldown/binding-win32-arm64-msvc@1.1.3':
optional: true
'@rolldown/binding-win32-x64-msvc@1.1.3':
optional: true
'@rolldown/pluginutils@1.0.1': {}
'@tybys/wasm-util@0.10.3':
dependencies:
tslib: 2.8.1
optional: true
'@types/node@24.13.2':
dependencies:
undici-types: 7.18.2
'@types/react-dom@19.2.3(@types/react@19.2.17)':
dependencies:
'@types/react': 19.2.17
'@types/react@19.2.17':
dependencies:
csstype: 3.2.3
'@vitejs/plugin-react@6.0.3(vite@8.1.2(@types/node@24.13.2))':
dependencies:
'@rolldown/pluginutils': 1.0.1
vite: 8.1.2(@types/node@24.13.2)
bowser@2.14.1: {}
cookie@1.1.1: {}
csstype@3.2.3: {}
detect-libc@2.1.2: {}
fdir@6.5.0(picomatch@4.0.4):
optionalDependencies:
picomatch: 4.0.4
fsevents@2.3.3:
optional: true
lightningcss-android-arm64@1.32.0:
optional: true
lightningcss-darwin-arm64@1.32.0:
optional: true
lightningcss-darwin-x64@1.32.0:
optional: true
lightningcss-freebsd-x64@1.32.0:
optional: true
lightningcss-linux-arm-gnueabihf@1.32.0:
optional: true
lightningcss-linux-arm64-gnu@1.32.0:
optional: true
lightningcss-linux-arm64-musl@1.32.0:
optional: true
lightningcss-linux-x64-gnu@1.32.0:
optional: true
lightningcss-linux-x64-musl@1.32.0:
optional: true
lightningcss-win32-arm64-msvc@1.32.0:
optional: true
lightningcss-win32-x64-msvc@1.32.0:
optional: true
lightningcss@1.32.0:
dependencies:
detect-libc: 2.1.2
optionalDependencies:
lightningcss-android-arm64: 1.32.0
lightningcss-darwin-arm64: 1.32.0
lightningcss-darwin-x64: 1.32.0
lightningcss-freebsd-x64: 1.32.0
lightningcss-linux-arm-gnueabihf: 1.32.0
lightningcss-linux-arm64-gnu: 1.32.0
lightningcss-linux-arm64-musl: 1.32.0
lightningcss-linux-x64-gnu: 1.32.0
lightningcss-linux-x64-musl: 1.32.0
lightningcss-win32-arm64-msvc: 1.32.0
lightningcss-win32-x64-msvc: 1.32.0
nanoid@3.3.15: {}
oxlint@1.72.0:
optionalDependencies:
'@oxlint/binding-android-arm-eabi': 1.72.0
'@oxlint/binding-android-arm64': 1.72.0
'@oxlint/binding-darwin-arm64': 1.72.0
'@oxlint/binding-darwin-x64': 1.72.0
'@oxlint/binding-freebsd-x64': 1.72.0
'@oxlint/binding-linux-arm-gnueabihf': 1.72.0
'@oxlint/binding-linux-arm-musleabihf': 1.72.0
'@oxlint/binding-linux-arm64-gnu': 1.72.0
'@oxlint/binding-linux-arm64-musl': 1.72.0
'@oxlint/binding-linux-ppc64-gnu': 1.72.0
'@oxlint/binding-linux-riscv64-gnu': 1.72.0
'@oxlint/binding-linux-riscv64-musl': 1.72.0
'@oxlint/binding-linux-s390x-gnu': 1.72.0
'@oxlint/binding-linux-x64-gnu': 1.72.0
'@oxlint/binding-linux-x64-musl': 1.72.0
'@oxlint/binding-openharmony-arm64': 1.72.0
'@oxlint/binding-win32-arm64-msvc': 1.72.0
'@oxlint/binding-win32-ia32-msvc': 1.72.0
'@oxlint/binding-win32-x64-msvc': 1.72.0
picocolors@1.1.1: {}
picomatch@4.0.4: {}
postcss@8.5.16:
dependencies:
nanoid: 3.3.15
picocolors: 1.1.1
source-map-js: 1.2.1
react-dom@19.2.7(react@19.2.7):
dependencies:
react: 19.2.7
scheduler: 0.27.0
react-router-dom@7.18.1(react-dom@19.2.7(react@19.2.7))(react@19.2.7):
dependencies:
react: 19.2.7
react-dom: 19.2.7(react@19.2.7)
react-router: 7.18.1(react-dom@19.2.7(react@19.2.7))(react@19.2.7)
react-router@7.18.1(react-dom@19.2.7(react@19.2.7))(react@19.2.7):
dependencies:
cookie: 1.1.1
react: 19.2.7
set-cookie-parser: 2.7.2
optionalDependencies:
react-dom: 19.2.7(react@19.2.7)
react@19.2.7: {}
rolldown@1.1.3:
dependencies:
'@oxc-project/types': 0.137.0
'@rolldown/pluginutils': 1.0.1
optionalDependencies:
'@rolldown/binding-android-arm64': 1.1.3
'@rolldown/binding-darwin-arm64': 1.1.3
'@rolldown/binding-darwin-x64': 1.1.3
'@rolldown/binding-freebsd-x64': 1.1.3
'@rolldown/binding-linux-arm-gnueabihf': 1.1.3
'@rolldown/binding-linux-arm64-gnu': 1.1.3
'@rolldown/binding-linux-arm64-musl': 1.1.3
'@rolldown/binding-linux-ppc64-gnu': 1.1.3
'@rolldown/binding-linux-s390x-gnu': 1.1.3
'@rolldown/binding-linux-x64-gnu': 1.1.3
'@rolldown/binding-linux-x64-musl': 1.1.3
'@rolldown/binding-openharmony-arm64': 1.1.3
'@rolldown/binding-wasm32-wasi': 1.1.3
'@rolldown/binding-win32-arm64-msvc': 1.1.3
'@rolldown/binding-win32-x64-msvc': 1.1.3
scheduler@0.27.0: {}
set-cookie-parser@2.7.2: {}
source-map-js@1.2.1: {}
tinyglobby@0.2.17:
dependencies:
fdir: 6.5.0(picomatch@4.0.4)
picomatch: 4.0.4
tslib@2.8.1:
optional: true
typescript@6.0.3: {}
undici-types@7.18.2: {}
vite@8.1.2(@types/node@24.13.2):
dependencies:
lightningcss: 1.32.0
picomatch: 4.0.4
postcss: 8.5.16
rolldown: 1.1.3
tinyglobby: 0.2.17
optionalDependencies:
'@types/node': 24.13.2
fsevents: 2.3.3

1
public/favicon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

24
public/icons.svg Normal file
View File

@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol>
<symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol>
<symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol>
<symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol>
<symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

50
src/App.css Normal file
View File

@ -0,0 +1,50 @@
.page-shell {
min-height: 100svh;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
box-sizing: border-box;
}
.placeholder-card {
width: min(100%, 520px);
padding: 32px;
border: 1px solid var(--border);
border-radius: 24px;
background: var(--panel-bg);
box-shadow: var(--shadow);
text-align: left;
}
.placeholder-path {
display: inline-flex;
margin-bottom: 20px;
padding: 6px 12px;
border-radius: 999px;
border: 1px solid var(--accent-border);
background: var(--accent-bg);
color: var(--text-h);
font-family: var(--mono);
font-size: 14px;
}
.placeholder-card h1 {
margin: 0 0 12px;
}
.placeholder-card p {
font-size: 16px;
line-height: 1.7;
}
@media (max-width: 640px) {
.page-shell {
padding: 16px;
}
.placeholder-card {
padding: 24px;
border-radius: 20px;
}
}

57
src/App.tsx Normal file
View File

@ -0,0 +1,57 @@
import { Navigate, Route, Routes, useNavigate, useSearchParams } from 'react-router-dom'
import './App.css'
import { useEffect, useState } from 'react'
import PayPage from './pages/PayPage.tsx'
import PayResultPage from './pages/PayResultPage.tsx'
import Twins from './pages/Twins.tsx'
import PlaceholderPage from './components/PlaceholderPage.tsx'
// http://localhost:5173?token=c3f52a99-c519-427a-af05-364c5f3e59cc
function App() {
const [isConfigReady, setIsConfigReady] = useState(false)
const [searchParams] = useSearchParams()
const navigate = useNavigate()
const [initialToken] = useState(() => searchParams.get('token'))
useEffect(() => {
let isMounted = true
async function initConfig() {
if (initialToken) {
window.localStorage.setItem('token', initialToken || '')
} else if(!window.localStorage.getItem('token')) {
navigate('/404', { replace: true })
}
if (isMounted) {
setIsConfigReady(true)
}
}
initConfig()
return () => {
isMounted = false
}
}, [initialToken, navigate])
if (!isConfigReady) {
return null;
}
return (
<Routes>
<Route path="/" element={<Navigate to="/pay" replace />} />
<Route path="/pay" element={<PayPage />} />
<Route path="/pay-result" element={<PayResultPage />} />
<Route path="/twins" element={<Twins />} />
<Route
path="/404"
element={<PlaceholderPage path="/404" title="404" description="页面不存在" />}
/>
<Route path="*" element={<Navigate to="/pay" replace />} />
</Routes>
)
}
export default App

49
src/api/pay.ts Normal file
View File

@ -0,0 +1,49 @@
import { get, post, type ApiResponse } from '../utils/request'
export type GoodsItem = {
checked: boolean
goods_id: string
goods_name: string
origin_price: string
pay_type: string
price: string
sign_value: string
weixinMpOriId: string
}
export type OrderPayload = Record<string, unknown> & {
goods_id: string
pay_type: string
source: string
pay_source: string
extra: Record<string, unknown>
}
export type OrderResult = {
appId?: string
orderId?: string
outTradeNo?: string
payFee?: string
payParam?: string
payType?: string
unifyOrderId?: string
}
export type OrderStatus = {
status?: string
[key: string]: unknown
}
// goods
export function getGoods() {
return get<ApiResponse<GoodsItem[]>>('/api/order/goods')
}
// order
export function order(payload: OrderPayload) {
return post<ApiResponse<OrderResult>>('/api/order', payload)
}
export function checkOrder(orderId: string) {
return get<ApiResponse<OrderStatus>>('/api/order', { order_id: orderId })
}

11
src/api/user.ts Normal file
View File

@ -0,0 +1,11 @@
import { get, type ApiResponse } from '../utils/request'
export type UserConfig = {
token?: string
[key: string]: unknown
}
// goods
export function getConfig() {
return get<ApiResponse<UserConfig>>('/api/user/config')
}

BIN
src/assets/hero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

1
src/assets/react.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

1
src/assets/vite.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -0,0 +1,19 @@
type PlaceholderPageProps = {
path: string
title: string
description: string
}
function PlaceholderPage({ path, title, description }: PlaceholderPageProps) {
return (
<main className="page-shell">
<section className="placeholder-card">
<span className="placeholder-path">{path}</span>
<h1>{title}</h1>
<p>{description}</p>
</section>
</main>
)
}
export default PlaceholderPage

710
src/index.css Normal file
View File

@ -0,0 +1,710 @@
:root {
--text: #6b6375;
--text-h: #08060d;
--bg: #fff;
--panel-bg: rgba(255, 255, 255, 0.88);
--border: #e5e4e7;
--code-bg: #f4f3ec;
--accent: #aa3bff;
--accent-bg: rgba(170, 59, 255, 0.1);
--accent-border: rgba(170, 59, 255, 0.5);
--social-bg: rgba(244, 243, 236, 0.5);
--shadow:
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
--mono: ui-monospace, Consolas, monospace;
font: 18px/145% var(--sans);
letter-spacing: 0.18px;
color-scheme: light dark;
color: var(--text);
background: var(--bg);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@media (max-width: 1024px) {
font-size: 16px;
}
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
@media (prefers-color-scheme: dark) {
:root {
--text: #9ca3af;
--text-h: #f3f4f6;
--bg: #16171d;
--panel-bg: rgba(31, 32, 40, 0.88);
--border: #2e303a;
--code-bg: #1f2028;
--accent: #c084fc;
--accent-bg: rgba(192, 132, 252, 0.15);
--accent-border: rgba(192, 132, 252, 0.5);
--social-bg: rgba(47, 48, 58, 0.5);
--shadow:
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
}
}
#root {
min-height: 100svh;
}
body {
margin: 0;
min-width: 320px;
background:
radial-gradient(circle at top, rgba(170, 59, 255, 0.12), transparent 35%),
var(--bg);
}
h1,
h2 {
font-family: var(--heading);
font-weight: 500;
color: var(--text-h);
}
h1 {
font-size: 56px;
letter-spacing: -1.68px;
margin: 32px 0;
@media (max-width: 1024px) {
font-size: 36px;
margin: 20px 0;
}
}
h2 {
font-size: 24px;
line-height: 118%;
letter-spacing: -0.24px;
margin: 0 0 8px;
@media (max-width: 1024px) {
font-size: 20px;
}
}
p {
margin: 0;
}
#PayPage {
min-height: 100svh;
padding-bottom: 84px;
.header {
width: 100%;
height: 248px;
background: url('./images/pay/header-bg.png') no-repeat;
background-size: 100% 100%;
padding: 0 16px;
display: flex;
flex-direction: column;
.tips {
padding-top: 44px;
.tip {
height: 20px;
background: #CDF6E0;
border-radius: 6px 6px 6px 6px;
padding: 3px 10px;
width: 70px;
height: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 10px;
color: #07994D;
line-height: 14px;
text-align: left;
font-style: normal;
text-transform: none;
}
.date {
margin-left: 6px;
width: 84px;
height: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 10px;
color: #222222;
line-height: 14px;
text-align: left;
font-style: normal;
text-transform: none;
}
}
.title {
margin-top: 14px;
height: 34px;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
font-size: 26px;
color: #222222;
line-height: 34px;
text-align: left;
font-style: normal;
text-transform: none;
.lock {
color: #00B85C;
}
}
}
.plan {
position: relative;
width: 100%;
height: 162px;
margin-top: -62px;
overflow: hidden;
touch-action: pan-y;
user-select: none;
-webkit-user-select: none;
.plan-track {
position: relative;
width: min(100%, 360px);
height: 100%;
margin: 0 auto;
}
.plan-item {
position: absolute;
top: 18px;
left: 50%;
width: 98px;
height: 118px;
background: #FFFFFF;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
border: 1px solid transparent;
border-radius: 8px 8px 8px 8px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 6px;
padding: 0;
appearance: none;
cursor: pointer;
transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 320ms ease, box-shadow 320ms ease, background-color 320ms ease, border-color 320ms ease;
transform: translateX(-50%);
opacity: 0.58;
z-index: 1;
.plan-price-symbol {
font-size: 10px;
transition: color 320ms ease;
}
.plan-name {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #222222;
line-height: 20px;
text-align: left;
font-style: normal;
text-transform: none;
margin-bottom: 7px;
transition: color 320ms ease, font-size 320ms ease, font-weight 320ms ease, line-height 320ms ease;
}
.plan-price {
font-family: D-DIN-PRO, D-DIN-PRO;
font-weight: 500;
font-size: 22px;
color: #222222;
line-height: 26px;
text-align: left;
font-style: normal;
text-transform: none;
transition: color 320ms ease, font-size 320ms ease, font-weight 320ms ease, line-height 320ms ease;
}
.plan-origin-price {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 12px;
color: #999999;
line-height: 16px;
text-align: center;
font-style: normal;
text-decoration-line: line-through;
text-transform: none;
transition: color 320ms ease, font-size 320ms ease, line-height 320ms ease;
}
}
.plan-item.is-left {
transform: translateX(calc(-50% - 122px));
opacity: 0.74;
z-index: 1;
}
.plan-item.is-right {
transform: translateX(calc(-50% + 122px));
opacity: 0.74;
z-index: 1;
}
.plan-item.selected {
top: 7px;
width: 120px;
height: 140px;
background: #F7FEFA;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
border-color: #00B85C;
transform: translateX(-50%);
opacity: 1;
z-index: 2;
.plan-price-symbol {
font-size: 10px;
color: #FF2D2D;
}
.plan-name {
font-weight: 500;
font-size: 18px;
color: #00B85C;
line-height: 26px;
}
.plan-price {
font-weight: 600;
font-size: 28px;
color: #FF2D2D;
line-height: 32px;
}
.plan-origin-price {
font-weight: 400;
font-size: 13px;
color: #A2A2A2;
line-height: 16px;
}
}
}
.pay-method {
padding: 0 16px;
.pay-method-title {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 14px;
color: #222222;
line-height: 20px;
text-align: left;
font-style: normal;
text-transform: none;
margin-bottom: 16px;
}
.pay-method-list {
display: flex;
flex-direction: column;
border-radius: 8px;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
.pay-method-item {
height: 60px;
border-radius: 0px 0px 0px 0px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 12px;
}
.pay-method-item:first-child {
border-bottom: 1px solid #E5E4E7;
}
.pay-method-info {
display: flex;
flex-direction: row;
gap: 10px;
}
.pay-method-icon {
width: 26px;
height: 26px;
}
.pay-method-name {
font-family: PingFang SC, PingFang SC;
font-weight: normal;
font-size: 16px;
color: #1A1A1A;
line-height: 22px;
text-align: left;
font-style: normal;
text-transform: none;
}
.pay-method-selected-icon {
width: 18px;
height: 18px;
}
}
}
.pay-button {
position: fixed;
left: 16px;
right: 16px;
bottom: 6px;
width: calc(100% - 32px);
max-width: 343px;
height: 52px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
background: #00B85C;
border: none;
border-radius: 921px 921px 921px 921px;
box-shadow: 0px 10px 24px 0px rgba(0, 184, 92, 0.24);
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 17px;
color: #FFFFFF;
line-height: 24px;
text-align: center;
font-style: normal;
text-transform: none;
cursor: pointer;
transition: opacity 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}
.pay-button:active {
transform: scale(0.98);
}
.pay-button:disabled {
opacity: 0.72;
cursor: not-allowed;
box-shadow: none;
}
.contact-us {
position: absolute;
right: 15px;
bottom: 95px;
width: 50px;
height: 50px;
background: #FFFFFF;
box-shadow: 0px 0px 11px 0px rgba(0, 150, 75, 0.2);
border: 1px solid #00B85C;
border-radius: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
img {
width: 20px;
height: 20px;
}
span {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 10px;
color: #222222;
line-height: 14px;
text-align: justify;
font-style: normal;
text-transform: none;
}
}
}
#PayResultPage {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 70px;
.result {
margin-top: 80px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 26px;
img {
width: 96px;
height: 96px;
}
.result-title {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 18px;
color: #1A1A1A;
line-height: 26px;
text-align: center;
font-style: normal;
text-transform: none;
}
}
.btn {
border: none;
width: 158px;
height: 52px;
background: #E7E7E7;
border-radius: 921px 921px 921px 921px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 17px;
color: #666666;
line-height: 24px;
text-align: center;
font-style: normal;
text-transform: none;
}
.failed-btn {
background: #00B85C;
color: #FFFFFF;
}
}
#Twins {
height: 100svh;
.header {
height: 248px;
background: url('./images/app-twins/bg.png') no-repeat;
background-size: 100% 100%;
padding: 30px 16px;
.row-1 {
font-family: Alimama ShuHeiTi, Alimama ShuHeiTi;
font-weight: 700;
font-size: 26px;
color: #222222;
line-height: 32px;
text-align: left;
font-style: normal;
text-transform: none;
}
.row-2 {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #222222;
line-height: 20px;
text-align: left;
font-style: normal;
text-transform: none;
margin-top: 8px;
margin-bottom: 16px;
}
.row-3 {
display: flex;
flex-direction: row;
align-items: center;
gap: 16px;
.item {
display: flex;
flex-direction: row;
align-items: center;
gap: 6px;
}
img {
width: 18px;
height: 18px;
}
span {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 13px;
color: #46524C;
line-height: 18px;
text-align: left;
font-style: normal;
text-transform: none;
}
}
}
.card {
height: calc(100dvh - 178px);
padding: 20px 16px;
border-radius: 30px 30px 0px 0px;
background: #FFFFFF;
overflow: hidden;
margin-top: -85px;
.card-title {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 18px;
color: #222222;
line-height: 26px;
text-align: left;
font-style: normal;
text-transform: none;
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
img {
width: 56px;
height: 10px;
}
}
.card-steps {
margin-top: 20px;
display: flex;
flex-direction: column;
gap: 20px;
.step-item {
height: 210px;
background: #FFFFFF;
border-radius: 12px 12px 12px 12px;
box-shadow: 0px 0px 10px 0px rgba(0, 150, 75, 0.2);
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center;
padding: 14px 12px;
display: flex;
flex-direction: column;
gap: 10px;
.step-item-label {
width: 52px;
height: 22px;
border-radius: 3px 3px 3px 3px;
border: 1px solid #00B85C;
display: inline-flex;
align-items: center;
justify-content: center;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 12px;
color: #00B85C;
line-height: 16px;
text-align: left;
font-style: normal;
text-transform: none;
}
.step-item-title {
font-family: PingFang SC, PingFang SC;
font-weight: 600;
font-size: 16px;
color: #222222;
line-height: 22px;
text-align: left;
font-style: normal;
text-transform: none;
}
.step-item-desc {
width: 53.29%;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 13px;
color: #666666;
line-height: 20px;
text-align: left;
font-style: normal;
text-transform: none;
}
.step-item-link {
width: 136px;
height: 32px;
background: #00B85C;
border-radius: 117px 117px 117px 117px;
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 14px;
color: #FFFFFF;
line-height: 20px;
text-align: left;
font-style: normal;
text-transform: none;
}
}
}
.contact-us {
width: 115px;
height: 54px;
background: #FFFFFF;
box-shadow: 0px 0px 10px 0px rgba(0, 150, 75, 0.2);
border-radius: 11px 11px 11px 11px;
border: 1px solid #07994D;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 6px;
position: absolute;
right: 10px;
bottom: 17px;
img {
width: 26px;
height: 26px;
}
span {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 14px;
color: #00B85C;
line-height: 20px;
text-align: center;
font-style: normal;
text-transform: none;
}
}
}
}
.green {
color: #00B85C;
}

13
src/main.tsx Normal file
View File

@ -0,0 +1,13 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { BrowserRouter } from 'react-router-dom'
import './index.css'
import App from './App.tsx'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>,
)

496
src/pages/PayPage.tsx Normal file
View File

@ -0,0 +1,496 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { checkOrder, getGoods, order, type GoodsItem } from '@/api/pay'
const PAY_METHOD_LIST = [
{ code: 'weixin', icon: '/images/pay/icon-wechatpay.png', name: '微信支付' },
{ code: 'alipay', icon: '/images/pay/icon-alipay.png', name: '支付宝' },
]
const ORDER_POLLING_INTERVAL = 2000
const ORDER_POLLING_MAX_COUNT = 60
type PayMethodInfo = (typeof PAY_METHOD_LIST)[number]
function getSupportedPayMethods(goods?: GoodsItem) {
if (!goods?.pay_type) {
return []
}
const supportedPayTypes = new Set(
goods.pay_type
.split(',')
.map((payType) => payType.trim())
.filter(Boolean),
)
return PAY_METHOD_LIST.filter((method) => supportedPayTypes.has(method.code))
}
function PayPage() {
const navigate = useNavigate()
const [goodsList, setGoodsList] = useState<GoodsItem[]>([])
const [currentIndex, setCurrentIndex] = useState(0)
const [selectedPayType, setSelectedPayType] = useState('')
const [isPaying, setIsPaying] = useState(false)
const pollingTimerRef = useRef<number | null>(null)
const pollingCountRef = useRef(0)
const pollingSessionRef = useRef(0)
const paymentAttemptRef = useRef(0)
const previousSelectionRef = useRef({ planId: '', payType: '' })
const isMountedRef = useRef(true)
const selectedPlan = goodsList[currentIndex]
const selectedPlanId = selectedPlan?.goods_id ?? ''
const supportedPayMethods = useMemo(() => getSupportedPayMethods(selectedPlan), [selectedPlan])
const stopOrderPolling = useCallback(() => {
pollingSessionRef.current += 1
if (pollingTimerRef.current !== null) {
window.clearTimeout(pollingTimerRef.current)
pollingTimerRef.current = null
}
pollingCountRef.current = 0
}, [])
const cancelPaymentFlow = useCallback(() => {
paymentAttemptRef.current += 1
stopOrderPolling()
if (isMountedRef.current) {
setIsPaying(false)
}
}, [stopOrderPolling])
useEffect(() => {
let isMounted = true
async function initGoods() {
try {
const { data } = await getGoods()
const nextGoodsList = Array.isArray(data) ? data : []
const checkedIndex = nextGoodsList.findIndex((goods) => goods.checked)
if (!isMounted) {
return
}
setGoodsList(nextGoodsList)
setCurrentIndex(checkedIndex >= 0 ? checkedIndex : 0)
} catch {
if (isMounted) {
setGoodsList([])
setCurrentIndex(0)
}
}
}
initGoods()
return () => {
isMounted = false
}
}, [])
useEffect(() => {
return () => {
isMountedRef.current = false
stopOrderPolling()
}
}, [stopOrderPolling])
useEffect(() => {
setSelectedPayType((currentPayType) => {
if (supportedPayMethods.some((method) => method.code === currentPayType)) {
return currentPayType
}
return supportedPayMethods[0]?.code ?? ''
})
}, [supportedPayMethods])
useEffect(() => {
const previousSelection = previousSelectionRef.current
const hasSelectionChanged =
previousSelection.planId !== selectedPlanId || previousSelection.payType !== selectedPayType
if (isPaying && hasSelectionChanged) {
cancelPaymentFlow()
}
previousSelectionRef.current = {
planId: selectedPlanId,
payType: selectedPayType,
}
}, [cancelPaymentFlow, isPaying, selectedPayType, selectedPlanId])
const startOrderPolling = useCallback(
(orderId: string) => {
stopOrderPolling()
const sessionId = pollingSessionRef.current
const pollOrder = async () => {
if (pollingSessionRef.current !== sessionId) {
return
}
pollingCountRef.current += 1
try {
const { data } = await checkOrder(orderId)
if (pollingSessionRef.current !== sessionId) {
return
}
if (data.status === '2') {
stopOrderPolling()
navigate('/pay-result?success=true')
return
}
} catch {
if (pollingSessionRef.current !== sessionId) {
return
}
stopOrderPolling()
if (isMountedRef.current) {
setIsPaying(false)
}
return
}
if (pollingCountRef.current >= ORDER_POLLING_MAX_COUNT) {
stopOrderPolling()
if (isMountedRef.current) {
setIsPaying(false)
}
return
}
if (pollingSessionRef.current !== sessionId) {
return
}
pollingTimerRef.current = window.setTimeout(pollOrder, ORDER_POLLING_INTERVAL)
}
pollingTimerRef.current = window.setTimeout(pollOrder, ORDER_POLLING_INTERVAL)
},
[navigate, stopOrderPolling],
)
const handlePay = useCallback(async () => {
if (isPaying || !selectedPlan || !selectedPayType) {
return
}
const alipayWindow = selectedPayType === 'alipay' ? window.open('', '_blank') : null
const paymentAttemptId = paymentAttemptRef.current + 1
paymentAttemptRef.current = paymentAttemptId
setIsPaying(true)
try {
const { data } = await order({
goods_id: selectedPlan.goods_id,
pay_type: selectedPayType,
source: '',
pay_source: 'h5',
extra: {},
})
if (paymentAttemptRef.current !== paymentAttemptId) {
alipayWindow?.close()
return
}
if (selectedPayType === 'alipay') {
if (!data.orderId || !data.payParam) {
alipayWindow?.close()
window.alert('支付信息获取失败,请稍后重试')
throw new Error('Missing Alipay orderId or payParam')
}
if (alipayWindow) {
alipayWindow.location.href = data.payParam
} else if (!window.open(data.payParam, '_blank')) {
window.alert('支付宝页面打开失败,请允许浏览器弹窗后重试')
throw new Error('Failed to open Alipay window')
}
startOrderPolling(data.orderId)
return
}
navigate('/pay-result?success=true')
} catch {
alipayWindow?.close()
if (isMountedRef.current && paymentAttemptRef.current === paymentAttemptId) {
setIsPaying(false)
}
}
}, [isPaying, navigate, selectedPayType, selectedPlan, startOrderPolling])
const handleCurrentIndexChange = useCallback(
(nextIndex: number | ((prevIndex: number) => number)) => {
cancelPaymentFlow()
setCurrentIndex(nextIndex)
},
[cancelPaymentFlow],
)
const handleSelectPayType = useCallback(
(payType: string) => {
if (payType !== selectedPayType) {
cancelPaymentFlow()
}
setSelectedPayType(payType)
},
[cancelPaymentFlow, selectedPayType],
)
return (
<div id="PayPage">
<Header />
<Plan
canPay={Boolean(selectedPlan && selectedPayType)}
currentIndex={currentIndex}
goodsList={goodsList}
isPaying={isPaying}
onCurrentIndexChange={handleCurrentIndexChange}
onPay={handlePay}
selectedPlan={selectedPlan}
/>
<PayMethod
methods={supportedPayMethods}
onSelectPayType={handleSelectPayType}
selectedPayType={selectedPayType}
/>
<ContactUs />
</div>
)
}
function Header() {
return (
<div className="header">
<div className="tips">
<span className="tip"></span>
<span className="date">2026-06-26 </span>
</div>
<div className="title">
<div>
<span className="lock"></span>
</div>
<div>使</div>
</div>
</div>
)
}
type PlanProps = {
canPay: boolean
currentIndex: number
goodsList: GoodsItem[]
isPaying: boolean
onCurrentIndexChange: (nextIndex: number | ((prevIndex: number) => number)) => void
onPay: () => void
selectedPlan?: GoodsItem
}
function Plan({
canPay,
currentIndex,
goodsList,
isPaying,
onCurrentIndexChange,
onPay,
selectedPlan,
}: PlanProps) {
const [isAnimating, setIsAnimating] = useState(false)
const touchStartXRef = useRef<number | null>(null)
const touchStartYRef = useRef<number | null>(null)
const touchDeltaXRef = useRef(0)
const animationTimerRef = useRef<number | null>(null)
const goodsCount = goodsList.length
useEffect(() => {
return () => {
if (animationTimerRef.current !== null) {
window.clearTimeout(animationTimerRef.current)
}
}
}, [])
const lockAnimation = () => {
setIsAnimating(true)
if (animationTimerRef.current !== null) {
window.clearTimeout(animationTimerRef.current)
}
animationTimerRef.current = window.setTimeout(() => {
setIsAnimating(false)
animationTimerRef.current = null
}, 320)
}
const changePlan = (direction: 'prev' | 'next') => {
if (isAnimating || goodsCount === 0) {
return
}
lockAnimation()
onCurrentIndexChange((prevIndex) => {
if (direction === 'prev') {
return (prevIndex - 1 + goodsCount) % goodsCount
}
return (prevIndex + 1) % goodsCount
})
}
const getPositionClassName = (index: number) => {
if (goodsCount === 0) {
return ''
}
const distance = (index - currentIndex + goodsCount) % goodsCount
if (distance === 0) {
return 'is-center selected'
}
if (distance === 1) {
return 'is-right'
}
return 'is-left'
}
const handlePlanClick = (index: number) => {
if (index === currentIndex || isAnimating || goodsCount === 0) {
return
}
const distance = (index - currentIndex + goodsCount) % goodsCount
changePlan(distance === 1 ? 'next' : 'prev')
}
const handleTouchStart = (event: React.TouchEvent<HTMLDivElement>) => {
const touch = event.touches[0]
touchStartXRef.current = touch.clientX
touchStartYRef.current = touch.clientY
touchDeltaXRef.current = 0
}
const handleTouchMove = (event: React.TouchEvent<HTMLDivElement>) => {
if (touchStartXRef.current === null || touchStartYRef.current === null) {
return
}
const touch = event.touches[0]
const deltaX = touch.clientX - touchStartXRef.current
const deltaY = touch.clientY - touchStartYRef.current
if (Math.abs(deltaX) > Math.abs(deltaY)) {
touchDeltaXRef.current = deltaX
event.preventDefault()
}
}
const handleTouchEnd = () => {
const swipeThreshold = 36
const deltaX = touchDeltaXRef.current
touchStartXRef.current = null
touchStartYRef.current = null
touchDeltaXRef.current = 0
if (Math.abs(deltaX) < swipeThreshold || isAnimating || goodsCount === 0) {
return
}
changePlan(deltaX < 0 ? 'next' : 'prev')
}
return (
<>
<div
className="plan"
onTouchEnd={handleTouchEnd}
onTouchMove={handleTouchMove}
onTouchStart={handleTouchStart}
>
<div className="plan-track">
{goodsList.map((plan, index) => (
<button
className={`plan-item ${getPositionClassName(index)}`}
key={plan.goods_id}
onClick={() => handlePlanClick(index)}
type="button"
>
<div className="plan-name">{plan.goods_name}</div>
<div className="plan-price">
<span className="plan-price-symbol"></span>
{plan.price}
</div>
<div className="plan-origin-price">
<span></span>
{plan.origin_price}
</div>
</button>
))}
</div>
</div>
<button className="pay-button" disabled={isPaying || !canPay} onClick={onPay} type="button">
{isPaying ? '支付处理中...' : selectedPlan ? `立即支付 ¥${selectedPlan.price}` : '暂无可支付商品'}
</button>
</>
)
}
type PayMethodProps = {
methods: PayMethodInfo[]
onSelectPayType: (payType: string) => void
selectedPayType: string
}
function PayMethod({ methods, onSelectPayType, selectedPayType }: PayMethodProps) {
return (
<div className="pay-method">
<div className="pay-method-title"></div>
{methods.length > 0 && (
<div className="pay-method-list">
{methods.map((method) => (
<div
className={`pay-method-item ${selectedPayType === method.code ? 'selected' : ''}`}
key={method.code}
onClick={() => onSelectPayType(method.code)}
>
<div className="pay-method-info">
<img className="pay-method-icon" src={method.icon} alt={method.name} />
<div className="pay-method-name">{method.name}</div>
</div>
<img
className="pay-method-selected-icon"
src={selectedPayType === method.code ? '/images/pay/icon-checked.png' : '/images/pay/icon-uncheck.png'}
alt="选中"
/>
</div>
))}
</div>
)}
</div>
)
}
function ContactUs() {
return (
<div className="contact-us">
<img src="/images/pay/icon-concat.png" alt="" />
<span></span>
</div>
)
}
export default PayPage

View File

@ -0,0 +1,24 @@
import { useMemo } from 'react'
import { useNavigate, useSearchParams } from 'react-router-dom'
function PayResultPage() {
const navigate = useNavigate()
const [searchParams] = useSearchParams()
const isSuccess = useMemo(() => searchParams.get("success") === "true", [searchParams])
return (
<div id="PayResultPage">
<div className="result">
<img src={`./images/pay-result/pay-${isSuccess ? 'success' : 'fail'}.png`} alt="" />
<div className="result-title">
{isSuccess ? "支付成功" : "抱歉,订单支付失败"}
</div>
</div>
<button className={`btn ${!isSuccess ? 'failed-btn' : ''}`} onClick={() => navigate("/")}>
{isSuccess ? "返回" : "重新支付"}
</button>
</div>
)
}
export default PayResultPage

95
src/pages/Twins.tsx Normal file
View File

@ -0,0 +1,95 @@
function Twins() {
return (
<div id="Twins">
<Header />
<Card />
</div>
)
}
function Header() {
return (
<div className="header">
<div className="row-1">
iPhone<span className="green"></span>
</div>
<div className="row-2">
TestFlight | <br /> |
</div>
<div className="row-3">
<div className="item">
<img src="./images/app-twins/icon-safe.png" alt="安全问题"></img>
<span></span>
</div>
<div className="item">
<img src="./images/app-twins/icon-minus.png" alt="无封号风险"></img>
<span></span>
</div>
</div>
</div>
)
}
function Card() {
const steps = [
{
label: '步骤一',
title: "下载 TestFlight 应用",
desc: [
"· 若已安装,请跳过此步;",
"· 未安装请点击下方按钮前往App Store下载",
],
linkName: "前往下载",
linkUrl: "",
sideBg: "./images/app-twins/step1-side.png"
},
{
label: '步骤二',
title: "安装双开微信",
desc: [
"· 点击下方按钮,自动跳转安装您的专属微信",
"· 下载完成后,桌重会出现第二个微信围标;",
],
linkName: "前往安装",
linkUrl: "",
sideBg: "./images/app-twins/step2-side.png"
}
]
return (
<div className="card">
<div className="card-title">
<img src="./images/app-twins/line-left.png"></img>
<div>
<span className="green"></span> · 30
</div>
<img src="./images/app-twins/line-right.png"></img>
</div>
<div className="card-steps">
{
steps.map((step, index) => (
<div className="step-item" key={index} style={{ backgroundImage: `url(${step.sideBg})` }}>
<div className="step-item-label">{step.label}</div>
<div className="step-item-title">{step.title}</div>
<div className="step-item-desc">
{
step.desc.map((descItem, descIndex) => (
<div key={descIndex}>{descItem}</div>
))
}
</div>
<a className="step-item-link" target="_blank" href={step.linkUrl}>{step.linkName}</a>
</div>
))
}
</div>
<div className="contact-us">
<img src="./images/app-twins/icon-concat.png" alt="客服1对1指导安装"></img>
<span>11<br/></span>
</div>
</div>
)
}
export default Twins

316
src/utils/request.ts Normal file
View File

@ -0,0 +1,316 @@
import Bowser from 'bowser'
type RequestPrimitive = string | number | boolean | null | undefined
type RequestValue = RequestPrimitive | RequestPrimitive[]
type RequestParams = Record<string, RequestValue>
type RequestOptions = Omit<RequestInit, 'body' | 'method'> & {
body?: BodyInit | Record<string, unknown> | null
}
type ApiResponseLike = {
code?: unknown
message?: unknown
}
export type ApiResponse<T> = {
code: number
message: string
data: T
}
type ClientSysInfo = {
version?: RequestPrimitive
platform?: RequestPrimitive
deviceId?: RequestPrimitive
brand?: RequestPrimitive
model?: RequestPrimitive
channel?: RequestPrimitive
bd_vid?: RequestPrimitive
}
declare global {
interface Window {
sysInfo?: ClientSysInfo
}
}
const SYS_INFO_STORAGE_KEY = 'sysInfo'
function isRecord(value: unknown): value is Record<string, RequestPrimitive> {
return Object.prototype.toString.call(value) === '[object Object]'
}
function readStoredSysInfo(): Partial<ClientSysInfo> {
if (typeof window === 'undefined') {
return {}
}
try {
const rawSysInfo = window.localStorage.getItem(SYS_INFO_STORAGE_KEY)
if (!rawSysInfo) {
return {}
}
const sysInfo: unknown = JSON.parse(rawSysInfo)
return isRecord(sysInfo) ? sysInfo : {}
} catch {
return {}
}
}
function writeStoredSysInfo(sysInfo: Partial<ClientSysInfo>) {
if (typeof window === 'undefined') {
return
}
try {
window.localStorage.setItem(SYS_INFO_STORAGE_KEY, JSON.stringify(sysInfo))
} catch {
// localStorage can be blocked in private mode; headers can still use in-memory values.
}
}
function createDeviceId() {
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
return crypto.randomUUID()
}
if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
const bytes = crypto.getRandomValues(new Uint8Array(16))
bytes[6] = (bytes[6] & 0x0f) | 0x40
bytes[8] = (bytes[8] & 0x3f) | 0x80
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0'))
return `${hex.slice(0, 4).join('')}-${hex.slice(4, 6).join('')}-${hex.slice(6, 8).join('')}-${hex
.slice(8, 10)
.join('')}-${hex.slice(10, 16).join('')}`
}
return `${Date.now()}-${Math.random().toString(16).slice(2)}`
}
function getDeviceId(storedSysInfo: Partial<ClientSysInfo>) {
const storedDeviceId = storedSysInfo.deviceId
if (storedDeviceId) {
return String(storedDeviceId)
}
const deviceId = createDeviceId()
writeStoredSysInfo({ ...storedSysInfo, deviceId })
return deviceId
}
function mergeDefinedSysInfo(baseInfo: ClientSysInfo, overrideInfo: ClientSysInfo) {
const mergedInfo = { ...baseInfo }
Object.entries(overrideInfo).forEach(([key, value]) => {
if (value !== undefined && value !== null && value !== '') {
mergedInfo[key as keyof ClientSysInfo] = value
}
})
return mergedInfo
}
export function getBrowserInfo(): ClientSysInfo {
const storedSysInfo = readStoredSysInfo()
const userAgent = typeof navigator === 'undefined' ? '' : navigator.userAgent
const browserInfo = userAgent ? Bowser.parse(userAgent) : undefined
const brand = browserInfo?.platform.vendor || browserInfo?.browser.name || ''
const model = browserInfo?.platform.model || browserInfo?.browser.version || ''
return {
version: __APP_VERSION__,
platform: 'web',
channel: 'web',
deviceId: getDeviceId(storedSysInfo),
brand,
model,
bd_vid: storedSysInfo.bd_vid,
}
}
function getSearchParams() {
if (typeof window === 'undefined') {
return new URLSearchParams()
}
return new URLSearchParams(window.location.search)
}
function getClientSysInfo() {
if (typeof window === 'undefined') {
return {}
}
return window.sysInfo ?? {}
}
function toHeaderValue(value: RequestPrimitive) {
return value === undefined || value === null ? '' : String(value)
}
function setCommonHeaders(headers: Headers) {
const params = getSearchParams()
const sysInfo = mergeDefinedSysInfo(getBrowserInfo(), getClientSysInfo())
headers.set('x-version', toHeaderValue(sysInfo.version ?? __APP_VERSION__))
headers.set('x-platform', toHeaderValue(sysInfo.platform))
headers.set('x-device-id', toHeaderValue(sysInfo.deviceId))
headers.set('x-mobile-brand', toHeaderValue(sysInfo.brand))
headers.set('x-mobile-model', toHeaderValue(sysInfo.model))
headers.set('x-channel', toHeaderValue(sysInfo.channel))
headers.set('x-click-id', toHeaderValue(params.get('bd_vid') ?? sysInfo.bd_vid ?? ''))
headers.set('x-app-id', toHeaderValue(__APP_ID__))
const token = window.localStorage.getItem("token")
if(token){
headers.set('x-token', token)
}
}
function buildQueryString(params?: RequestParams) {
if (!params) {
return ''
}
const searchParams = new URLSearchParams()
Object.entries(params).forEach(([key, value]) => {
if (value === undefined || value === null) {
return
}
if (Array.isArray(value)) {
value.forEach((item) => {
if (item !== undefined && item !== null) {
searchParams.append(key, String(item))
}
})
return
}
searchParams.append(key, String(value))
})
const queryString = searchParams.toString()
return queryString ? `?${queryString}` : ''
}
function isPlainObject(value: RequestOptions['body']): value is Record<string, unknown> {
return Object.prototype.toString.call(value) === '[object Object]'
}
function isApiResponseLike(value: unknown): value is ApiResponseLike {
return Object.prototype.toString.call(value) === '[object Object]' && 'code' in (value as Record<string, unknown>)
}
let toastTimer: number | null = null
function showToast(message: string) {
if (typeof document === 'undefined') {
return
}
const existingToast = document.getElementById('request-error-toast')
if (existingToast) {
existingToast.remove()
}
if (toastTimer !== null) {
window.clearTimeout(toastTimer)
}
const toast = document.createElement('div')
toast.id = 'request-error-toast'
toast.textContent = message
toast.setAttribute('role', 'alert')
toast.style.position = 'fixed'
toast.style.left = '50%'
toast.style.top = '50%'
toast.style.zIndex = '9999'
toast.style.maxWidth = 'calc(100vw - 48px)'
toast.style.padding = '10px 16px'
toast.style.borderRadius = '8px'
toast.style.background = 'rgba(0, 0, 0, 0.78)'
toast.style.color = '#fff'
toast.style.fontSize = '14px'
toast.style.lineHeight = '20px'
toast.style.textAlign = 'center'
toast.style.transform = 'translate(-50%, -50%)'
toast.style.boxShadow = '0 8px 24px rgba(0, 0, 0, 0.18)'
toast.style.pointerEvents = 'none'
document.body.appendChild(toast)
toastTimer = window.setTimeout(() => {
toast.remove()
toastTimer = null
}, 2200)
}
function getBusinessErrorMessage(message: unknown) {
if (typeof message !== 'string') {
return '请求失败'
}
const errorMessage = message.split(/[,]/)[0]?.trim()
return errorMessage || message || '请求失败'
}
async function request<T>(url: string, method: string, options: RequestOptions = {}) {
const { body, headers, ...restOptions } = options
const requestHeaders = new Headers(headers)
setCommonHeaders(requestHeaders)
let requestBody: BodyInit | null | undefined
if (isPlainObject(body)) {
if (!requestHeaders.has('Content-Type')) {
requestHeaders.set('Content-Type', 'application/json')
}
requestBody = JSON.stringify(body)
} else {
requestBody = body
}
const response = await fetch(url, {
...restOptions,
method,
headers: requestHeaders,
body: requestBody,
})
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`)
}
const responseData: unknown = await response.json()
if (isApiResponseLike(responseData) && responseData.code !== 0) {
const errorMessage = getBusinessErrorMessage(responseData.message)
showToast(errorMessage)
throw new Error(errorMessage)
}
return responseData as T
}
export function get<T>(url: string, params?: RequestParams, options?: Omit<RequestOptions, 'body'>) {
return request<T>(`${url}${buildQueryString(params)}`, 'GET', options)
}
export function post<T>(url: string, body?: RequestOptions['body'], options?: Omit<RequestOptions, 'body'>) {
return request<T>(url, 'POST', { ...options, body })
}
export function put<T>(url: string, body?: RequestOptions['body'], options?: Omit<RequestOptions, 'body'>) {
return request<T>(url, 'PUT', { ...options, body })
}
export function del<T>(url: string, body?: RequestOptions['body'], options?: Omit<RequestOptions, 'body'>) {
return request<T>(url, 'DELETE', { ...options, body })
}
export { del as delete }

4
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
/// <reference types="vite/client" />
declare const __APP_ID__: string
declare const __APP_VERSION__: string

29
tsconfig.app.json Normal file
View File

@ -0,0 +1,29 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023", "DOM"],
"module": "esnext",
"types": ["vite/client"],
"paths": {
"@/*": ["./src/*"]
},
"allowArbitraryExtensions": true,
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}

7
tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

23
tsconfig.node.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023"],
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"module": "nodenext",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}

42
vite.config.ts Normal file
View File

@ -0,0 +1,42 @@
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import { readFileSync } from 'node:fs'
type PackageConfig = {
appId?: string
name?: string
version?: string
}
const packageConfig = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8')) as PackageConfig
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const baseURL = env.VITE_BASE_URL?.trim()
const appId = env.VITE_APP_ID?.trim() || packageConfig.appId || packageConfig.name || ''
return {
plugins: [react()],
define: {
__APP_ID__: JSON.stringify(appId),
__APP_VERSION__: JSON.stringify(packageConfig.version || ''),
},
server: baseURL
? {
proxy: {
'/api': {
target: baseURL,
changeOrigin: true,
},
},
}
: undefined,
// alias
resolve: {
alias: {
'@': `${process.cwd()}/src`,
},
},
}
})