From 1b801801029d55501e201203fddc21fd571a3492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E9=BE=99?= Date: Thu, 28 Aug 2025 16:30:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/layout.tsx | 2 +- components/ChatInputBox/ChatInputBox.tsx | 8 +- components/pages/home-page2.tsx | 134 ++++++++++++++--------- 3 files changed, 90 insertions(+), 54 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index e1618c5..d43e8ed 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -33,7 +33,7 @@ export default function RootLayout({ }} > - + {/* */}
{children}
diff --git a/components/ChatInputBox/ChatInputBox.tsx b/components/ChatInputBox/ChatInputBox.tsx index 76ef8d1..2e9677c 100644 --- a/components/ChatInputBox/ChatInputBox.tsx +++ b/components/ChatInputBox/ChatInputBox.tsx @@ -173,8 +173,8 @@ const RenderTemplateStoryMode = ({ // 模板列表渲染 const templateListRender = () => { return ( -
-
+
+
{templateStoryList.map((template, index) => (
-
+
{/* 弹窗头部 */}

@@ -576,7 +576,7 @@ const RenderTemplateStoryMode = ({

-
+
{templateListRender()}
{storyEditorRender()}
diff --git a/components/pages/home-page2.tsx b/components/pages/home-page2.tsx index 0bf9d83..e34fd81 100644 --- a/components/pages/home-page2.tsx +++ b/components/pages/home-page2.tsx @@ -31,14 +31,42 @@ import { fetchSubscriptionPlans, SubscriptionPlan } from "@/lib/stripe"; export function HomePage2() { const [hPading, setHPading] = useState(0); useEffect(() => { - // 为兼容不同屏幕的padding进行三次方处理 - setHPading(((window as any).Scale?.hScale || 1)**3 * 10); + // 获取当前窗口尺寸 + const currentWidth = window.innerWidth; + const currentHeight = window.innerHeight; + // 计算缩放比例 (1920x1080) + const wScale = currentWidth / 1920; + const hScale = currentHeight / 1080; + + // 检查app节点是否存在 + const homePage = document.getElementById("home-page"); + if (!homePage) { + console.error("未找到app节点"); + return; + } + // setHPading((hScale || 1) * 10); + // 创建样式元素 + const style = document.createElement("style"); + + // 设置CSS样式 + style.textContent = ` + #home-page { + transform-origin: top left; + transform: scale(${wScale}, ${hScale}); + width: 1920px; + height: 1080px; + } + `; + + // 将样式添加到head + document.head.appendChild(style); }, []); return ( //
@@ -54,7 +82,7 @@ export function HomePage2() { function HomeModule1() { const router = useRouter(); return ( -
+
-

+

Ideas Become Movies

@@ -87,19 +115,19 @@ function HomeModule1() { /**核心价值 */ function HomeModule2() { const videoList = [ - { - title: "Text to Movie", - video: "/assets/module2 (1).mp4", - }, - { - title: "Image to Movie", - video: "/assets/module2 (2).mp4", - }, - { - title: "Template to Movie", - video: "/assets/module2 (3).mp4", - } - ] + { + title: "Text to Movie", + video: "/assets/module2 (1).mp4", + }, + { + title: "Image to Movie", + video: "/assets/module2 (2).mp4", + }, + { + title: "Template to Movie", + video: "/assets/module2 (3).mp4", + }, + ]; return (

))} -
); @@ -197,15 +224,16 @@ function HomeModule3() { data-alt="vertical-grid-shadow" className="grid grid-cols-3 gap-[1rem] w-full h-[64rem] px-[5rem] relative" > - {/* 上方阴影遮罩 - 使用 mask 实现真正的渐变模糊,加重黑色 */} + {/* 上方阴影遮罩 - 使用 mask 实现真正的渐变模糊,加重黑色 */}
@@ -213,11 +241,12 @@ function HomeModule3() {
{videoList.map((column, columnIndex) => ( @@ -375,12 +404,10 @@ function HomeModule4() { } /**价格方案 */ function HomeModule5() { - const [billingType, setBillingType] = useState<'month' | 'year'>( - "month" - ); + const [billingType, setBillingType] = useState<"month" | "year">("month"); const [plans, setPlans] = useState([]); - const pathname = usePathname() + const pathname = usePathname(); // 从后端获取订阅计划数据 useEffect(() => { const loadPlans = async () => { @@ -388,24 +415,29 @@ function HomeModule5() { const plansData = await fetchSubscriptionPlans(); setPlans(plansData); } catch (err) { - console.error('加载订阅计划失败:', err); + console.error("加载订阅计划失败:", err); } }; loadPlans(); }, []); - const pricingPlans = useMemo<{ - title: string; - price: number; - credits: string; - buttonText: string; - features: string[]; - }[]>(() => { + const pricingPlans = useMemo< + { + title: string; + price: number; + credits: string; + buttonText: string; + features: string[]; + }[] + >(() => { return plans.map((plan) => { return { title: plan.display_name || plan.name, - price: billingType === "month" ? plan.price_month/100 : plan.price_year/100, + price: + billingType === "month" + ? plan.price_month / 100 + : plan.price_year / 100, credits: plan.description, buttonText: plan.is_free ? "Try For Free" : "Subscribe Now", features: plan.features || [], @@ -414,13 +446,15 @@ function HomeModule5() { }, [plans, billingType]); const handleSubscribe = async (planName: string) => { - if (planName === 'hobby') { + if (planName === "hobby") { return; } - localStorage.setItem('callBackUrl', pathname) + localStorage.setItem("callBackUrl", pathname); try { // 使用新的Checkout Session方案(更简单!) - const { createCheckoutSession, redirectToCheckout } = await import('@/lib/stripe'); + const { createCheckoutSession, redirectToCheckout } = await import( + "@/lib/stripe" + ); // 从localStorage获取当前用户信息 const User = JSON.parse(localStorage.getItem("currentUser") || "{}"); @@ -433,7 +467,7 @@ function HomeModule5() { const result = await createCheckoutSession({ user_id: String(User.id), plan_name: planName, - billing_cycle: billingType + billing_cycle: billingType, }); if (!result.successful || !result.data) { @@ -442,7 +476,6 @@ function HomeModule5() { // 2. 直接跳转到Stripe托管页面(就这么简单!) redirectToCheckout(result.data.checkout_url); - } catch (error) { throw new Error("create checkout session failed, please try again later"); } @@ -504,7 +537,10 @@ function HomeModule5() {

{plan.credits}

-