Add WeChat in-app JSAPI recharge for g2.tkmind.cn.

Use JSAPI with bound openid inside WeChat instead of QR long-press, and include related auth redirect and admin UX fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-16 16:20:04 +08:00
parent bb70634a96
commit f818dd0307
15 changed files with 260 additions and 32 deletions
+12 -4
View File
@@ -1,4 +1,5 @@
import { Navigate } from 'react-router-dom';
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import type { PortalUser } from '../types';
export function RequireAdmin({
@@ -8,8 +9,15 @@ export function RequireAdmin({
user: PortalUser | null;
children: React.ReactNode;
}) {
if (user?.role !== 'admin') {
return <Navigate to="/" replace />;
}
const navigate = useNavigate();
const allowed = user?.role === 'admin';
useEffect(() => {
if (!allowed) {
navigate('/', { replace: true });
}
}, [allowed, navigate]);
if (!allowed) return null;
return children;
}