修复问题

This commit is contained in:
al 2024-07-23 20:08:51 +08:00
parent ae2d164b84
commit a090c7063f
4 changed files with 33 additions and 22 deletions

View File

@ -11,8 +11,7 @@ export default function BillDetail({ params }) {
const [data, setData] = useState([]);
const [isFetching, setIsFetching] = useState(true);
const searchParams = useSearchParams();
const webviewBase = webviewBaseRequest()
const base = useMemo(()=>{
const getBase = useCallback((webviewBase)=>{
let searchParamsObj=null;
if(searchParams.get("b_mid")){
searchParamsObj={};
@ -27,7 +26,7 @@ export default function BillDetail({ params }) {
searchParamsObj.b_ts=searchParams.get("b_ts");
}
return searchParamsObj || webviewBase;
},[searchParams,webviewBase]);
},[searchParams]);
useEffect(() => {
const getData = async () => {
let type;
@ -48,6 +47,8 @@ export default function BillDetail({ params }) {
break;
}
try {
const webviewBase = webviewBaseRequest();
const base = getBase(webviewBase);
const signature = generateSignature({
type: type,
offset: 0,
@ -115,7 +116,10 @@ export default function BillDetail({ params }) {
return (
<section className="flex flex-1 flex-col">
{params.type == "income" && (
<Link className="flex flex-col mt-4 btn bg-[#FF61B030] items-center text-base font-medium" href={"income/income_querry"}>
<Link
className="flex flex-col mt-4 btn bg-[#FF61B030] items-center text-base font-medium"
href={"income/income_querry"}
>
<p className="text-primary">查看近一周收益情况</p>
</Link>
)}

View File

@ -44,8 +44,7 @@ export default function Pay() {
//
const [isFetching, setIsFetching] = useState(true);
const webviewBase = webviewBaseRequest()
const base = useMemo(()=>{
const getBase = useCallback((webviewBase)=>{
let searchParamsObj=null;
if(searchParams.get("b_mid")){
searchParamsObj={};
@ -60,10 +59,11 @@ export default function Pay() {
searchParamsObj.b_ts=searchParams.get("b_ts");
}
return searchParamsObj || webviewBase;
},[searchParams,webviewBase]);
},[searchParams]);
useEffect(() => {
const getData = async () => {
const webviewBase = webviewBaseRequest();
const base = getBase(webviewBase);
const body = { ...base };
const signature = generateSignature(body);
try {
@ -108,7 +108,8 @@ export default function Pay() {
});
return;
}
const webviewBase = webviewBaseRequest();
const base = getBase(webviewBase);
const body = {
...base,

View File

@ -1,6 +1,6 @@
"use client";
import React, { useState, useEffect, useMemo } from "react";
import React, { useState, useEffect, useMemo, useCallback } from "react";
import { generateSignature } from "@/utils/crypto";
import webviewBaseRequest from "@/utils/webviewBaseRequest";
import Link from "next/link";
@ -23,8 +23,8 @@ export default function Vip() {
const [isVip, setIsVip] = useState(false);
const [name, setName] = useState("");
const [isFetching, setIsFetching] = useState(true);
const webviewBase = webviewBaseRequest()
const base = useMemo(()=>{
const getBase = useCallback((webviewBase)=>{
let searchParamsObj=null;
if(searchParams.get("b_mid")){
searchParamsObj={};
@ -39,8 +39,10 @@ export default function Vip() {
searchParamsObj.b_ts=searchParams.get("b_ts");
}
return searchParamsObj || webviewBase;
},[searchParams,webviewBase]);
},[searchParams]);
const getUserData = async () => {
const webviewBase = webviewBaseRequest();
let base = getBase(webviewBase)
try {
const signature = generateSignature({
...base,
@ -78,15 +80,17 @@ export default function Vip() {
setTimeout(() => {
getUserData();
}, 500);
const intervalId = setInterval(() => {
getUserData();
}, 2000);
// const intervalId = setInterval(() => {
// getUserData();
// }, 2000);
return () => clearInterval(intervalId);
}, []);
//
const [isLoading, setIsLoading] = useState(false);
const createOrder = async (type = "alipay_h5") => {
const webviewBase = webviewBaseRequest();
let base = getBase(webviewBase)
const body = {
...base,
product_id: "membership",

View File

@ -6,7 +6,7 @@ import Link from "next/link";
import { Toast, Switch } from "antd-mobile";
import { generateSignature } from "@/utils/crypto";
import webviewBaseRequest from "@/utils/webviewBaseRequest";
import { useRouter,useSearchParams } from "next/navigation";
import { useRouter, useSearchParams } from "next/navigation";
export default function Pay({ params }) {
const router = useRouter();
@ -16,8 +16,7 @@ export default function Pay({ params }) {
//
const [superfanshipData, setSuperfanshipData] = useState();
const [isFetching, setIsFetching] = useState(true);
const webviewBase = webviewBaseRequest()
const base = useMemo(()=>{
const getBase = useCallback((webviewBase)=>{
let searchParamsObj=null;
if(searchParams.get("b_mid")){
searchParamsObj={};
@ -32,10 +31,12 @@ export default function Pay({ params }) {
searchParamsObj.b_ts=searchParams.get("b_ts");
}
return searchParamsObj || webviewBase;
},[searchParams,webviewBase]);
},[searchParams]);
//
const getData = async () => {
try {
const webviewBase = webviewBaseRequest();
const base = getBase(webviewBase);
const body = {
zid: parseInt(params.zid),
moment_id: parseInt(params.moment_id),
@ -70,7 +71,8 @@ export default function Pay({ params }) {
//
const getSuperfanshipData = async () => {
try {
const base = webviewBaseRequest();
const webviewBase = webviewBaseRequest();
const base = getBase(webviewBase);
const body = {
zid: parseInt(params.zid),
product_id: "h5_zone_superfanship",