微信SDK接通

This commit is contained in:
2026-07-01 19:56:44 +08:00
parent a1cbfc7241
commit aea1513836
38 changed files with 1610 additions and 92 deletions
+7 -1
View File
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { request } from '../lib/api';
function formatAmount(n: number) {
@@ -8,6 +8,7 @@ function formatAmount(n: number) {
export default function RedeemConfirmPage() {
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const [token, setToken] = useState('');
const [msg, setMsg] = useState('');
const [loading, setLoading] = useState(false);
@@ -20,6 +21,11 @@ export default function RedeemConfirmPage() {
.catch(() => setStoreName('当前门店'));
}, []);
useEffect(() => {
const scanned = searchParams.get('token');
if (scanned) setToken(scanned);
}, [searchParams]);
async function confirm() {
if (!token.trim()) {
setMsg('请在开发者选项中输入核销码');