From b2f6edcd0504184f1a83e7a452331b1f2e8f417f Mon Sep 17 00:00:00 2001 From: Zylan Date: Mon, 17 Mar 2025 20:49:27 +0800 Subject: [PATCH] redirection --- components/calculator.tsx | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/components/calculator.tsx b/components/calculator.tsx index c5fb7fa..477e884 100644 --- a/components/calculator.tsx +++ b/components/calculator.tsx @@ -1,9 +1,20 @@ "use client"; -import React, { useState, useCallback } from 'react'; +import React, { useState, useCallback, useEffect } from 'react'; import { Wallet, Github} from 'lucide-react'; // 保留需要的组件 const SalaryCalculator = () => { + // 添加自动重定向逻辑 + useEffect(() => { + // 在所有环境中执行重定向 + if (typeof window !== 'undefined') { + const hostname = window.location.hostname; + if (hostname !== 'jobworth.zippland.com' && hostname !== 'localhost' && !hostname.includes('127.0.0.1')) { + window.location.href = 'https://jobworth.zippland.com' + window.location.pathname; + } + } + }, []); + const [formData, setFormData] = useState({ annualSalary: '', // 年薪 pppFactor: '4.19', // 购买力平价转换因子,默认为中国大陆 @@ -124,24 +135,6 @@ const SalaryCalculator = () => { 这b班上得值不值·测算版 - {/* 添加域名信息 */} -
- - - - - 国内域名: - - jobworth.zippland.com - - -
- {/* GitHub 链接和访问量计数 */}
{/* 第一排: GitHub、Email、小红书 */}