增加微信内浏览器支付

This commit is contained in:
yezian 2024-02-20 15:06:07 +08:00
parent adb6af505a
commit 6c2743a2bf
2 changed files with 38 additions and 4 deletions

View File

@ -14,10 +14,12 @@ export default function Weixin({ params }) {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
useEffect(() => { useEffect(() => {
var QRCode = require("qrcode"); var QRCode = require("qrcode");
const weixinUrl = decodeURIComponent(params.weixin); QRCode.toDataURL(
QRCode.toDataURL(weixinUrl, function (err, url) { `https://tiefen.fun/pay/inweixin/${params.weixin}`,
function (err, url) {
setQrcodeUrl(url); setQrcodeUrl(url);
}); }
);
// //
const base = webviewBaseRequest(); const base = webviewBaseRequest();
if (base?.b_dt === 1) setDevice(1); if (base?.b_dt === 1) setDevice(1);

View File

@ -0,0 +1,32 @@
"use client";
import React, { useEffect } from "react";
import { useRouter } from "next/navigation";
export default function SafePay({ params }) {
const router = useRouter();
useEffect(() => {
const weixinUrl = decodeURIComponent(params.weixin);
router.push(weixinUrl);
}, []);
return (
<section className="flex flex-1 flex-col container bg-white">
<div className="flex flex-col">
<p className="text-center text-black text-lg font-medium py-2">
微信安全支付
</p>
<hr className="bg-secondary" />
</div>
<div className="flex flex-col items-center">
<svg viewBox="0 0 1024 1024" width="100" height="100">
<path
d="M512 85.333333a426.666667 426.666667 0 1 0 426.666667 426.666667A426.666667 426.666667 0 0 0 512 85.333333z m42.666667 597.333334a42.666667 42.666667 0 0 1-85.333334 0v-213.333334a42.666667 42.666667 0 0 1 85.333334 0z m-42.666667-298.666667a42.666667 42.666667 0 1 1 42.666667-42.666667 42.666667 42.666667 0 0 1-42.666667 42.666667z"
fill="#5fc157"
></path>
</svg>
<p className="text-sm text-[#5fc157]">正在跳转...</p>
</div>
</section>
);
}