Commit d354fd4d by heheer Committed by GitHub

fix: price page back button display (#6060)

parent bdee2db7
...@@ -21,7 +21,7 @@ const PriceBox = () => { ...@@ -21,7 +21,7 @@ const PriceBox = () => {
const router = useRouter(); const router = useRouter();
const backButtonRef = useRef<HTMLButtonElement>(null); const backButtonRef = useRef<HTMLButtonElement>(null);
const [isButtonInView, setIsButtonInView] = useState(true); const [isButtonInView, setIsButtonInView] = useState(false);
const { data: teamSubPlan } = useRequest2(getTeamPlanStatus, { const { data: teamSubPlan } = useRequest2(getTeamPlanStatus, {
manual: false, manual: false,
...@@ -30,6 +30,11 @@ const PriceBox = () => { ...@@ -30,6 +30,11 @@ const PriceBox = () => {
// TODO: 封装成一个 hook 来判断滚动态 // TODO: 封装成一个 hook 来判断滚动态
useEffect(() => { useEffect(() => {
if (!teamSubPlan?.standard?.teamId) {
setIsButtonInView(false);
return;
}
const observer = new IntersectionObserver( const observer = new IntersectionObserver(
([entry]) => { ([entry]) => {
setIsButtonInView(entry.isIntersecting); setIsButtonInView(entry.isIntersecting);
...@@ -50,7 +55,7 @@ const PriceBox = () => { ...@@ -50,7 +55,7 @@ const PriceBox = () => {
} }
observer.disconnect(); observer.disconnect();
}; };
}, []); }, [teamSubPlan?.standard?.teamId]);
const onPaySuccess = () => { const onPaySuccess = () => {
setTimeout(() => { setTimeout(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment