From ab2e31f01affe637550d2b2d5e0ec7c5697bcaf5 Mon Sep 17 00:00:00 2001 From: chenpei Date: Tue, 7 Jul 2026 19:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=80=83=E6=A0=B8=E8=B0=83?= =?UTF-8?q?=E7=A0=94=E7=A7=BB=E5=8A=A8=E7=AB=AF=E9=97=AE=E5=8D=B7=E4=BD=93?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/dingtalk/callback/route.ts | 66 ++- app/api/dingtalk/h5-login/route.ts | 85 ++-- app/api/dingtalk/session-ticket/route.ts | 70 +++- app/dingtalk-entry/DingtalkEntryClient.tsx | 61 ++- app/performance-survey/[[...path]]/page.tsx | 421 ++++++++++++++------ 5 files changed, 535 insertions(+), 168 deletions(-) diff --git a/app/api/dingtalk/callback/route.ts b/app/api/dingtalk/callback/route.ts index a2dcecd..b9f53dc 100644 --- a/app/api/dingtalk/callback/route.ts +++ b/app/api/dingtalk/callback/route.ts @@ -6,6 +6,61 @@ import { buildDingtalkAutoLoginPath } from '@/lib/safe-redirect' export const runtime = 'nodejs' export const dynamic = 'force-dynamic' +const SURVEY_OPENING_PAGE_STYLE = ` + html,body{margin:0;min-height:100%;background:#f7fbff;color:#111827;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif} + body{min-height:100vh;min-height:100dvh;overflow:hidden} + .topbar{height:56px;display:flex;align-items:center;justify-content:space-between;padding:0 20px;color:#fff;background:linear-gradient(90deg,#1677ff,#4f9cff);box-shadow:0 10px 24px rgba(22,119,255,.18)} + .topbar span:first-child{font-size:28px;line-height:1} + .topbar span:nth-child(2){font-size:15px;font-weight:600} + .topbar span:last-child{font-size:20px;line-height:1} + main{box-sizing:border-box;width:min(390px,100%);margin:0 auto;padding:48px 28px 0} + .brand{text-align:center} + .brand img{width:42px;height:42px;border-radius:10px;object-fit:cover} + .brand h1{margin:12px 0 0;font-size:23px;font-weight:600;line-height:1} + .brand p{margin:8px 0 0;color:#8a94a6;font-size:14px;font-weight:500} + .open-pill{min-height:58px;margin-top:40px;padding:0 20px;display:flex;align-items:center;justify-content:space-between;border-radius:999px;background:#fff;box-shadow:0 12px 30px rgba(15,23,42,.12)} + .open-pill strong{display:flex;align-items:center;gap:12px;font-size:16px;font-weight:600} + .open-pill em{font-style:normal;color:#1677ff;font-size:15px;font-weight:600} + .spinner{width:28px;height:28px;border:4px solid #d7e8ff;border-top-color:#1677ff;border-radius:999px;animation:spin .85s linear infinite} + .message{margin:28px 0 0;text-align:center;color:#8a94a6;font-size:13px;font-weight:500;line-height:1.7} + .ghost-card{margin-top:44px;padding:20px;border-radius:18px;background:rgba(255,255,255,.9);box-shadow:0 18px 42px rgba(15,23,42,.08)} + .ghost-title{font-size:15px;font-weight:600;color:#7b8494} + .ghost-line{height:12px;border-radius:999px;background:#eef3f9} + .ghost-line.one{margin-top:24px} + .ghost-line.two{width:74%;margin-top:12px} + .ghost-list{margin-top:32px;display:grid;gap:20px} + .ghost-row{display:flex;align-items:center;gap:12px} + .ghost-dot{width:16px;height:16px;border-radius:999px;border:1px solid #e3eaf3} + .ghost-row .ghost-line{flex:1;margin:0} + .ghost-row:last-child .ghost-line{flex:.67} + @keyframes spin{to{transform:rotate(360deg)}} + ` + +const SURVEY_OPENING_PAGE_MARKUP = ` +
‹素材库•••
+
+
+ 素材库 +

素材库

+

内部素材协作平台

+
+
+ 正在打开问卷 + 马上进入 +
+

正在打开问卷...

+ +
` + function appendLoginSetCookie(target: NextResponse, source: Response) { const getSetCookie = (source.headers as any).getSetCookie const cookies = typeof getSetCookie === 'function' @@ -42,17 +97,10 @@ function createCookieLandingResponse(redirectPath: string, loginResponse: Respon 正在打开问卷 - + -
-

正在打开问卷

-

正在打开问卷...

-
+${SURVEY_OPENING_PAGE_MARKUP} diff --git a/app/api/dingtalk/h5-login/route.ts b/app/api/dingtalk/h5-login/route.ts index c63f423..0bbc54f 100644 --- a/app/api/dingtalk/h5-login/route.ts +++ b/app/api/dingtalk/h5-login/route.ts @@ -10,6 +10,61 @@ import { normalizeInternalRedirectPath } from '@/lib/safe-redirect' export const runtime = 'nodejs' export const dynamic = 'force-dynamic' +const SURVEY_OPENING_PAGE_STYLE = ` + html,body{margin:0;min-height:100%;background:#f7fbff;color:#111827;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif} + body{min-height:100vh;min-height:100dvh;overflow:hidden} + .topbar{height:56px;display:flex;align-items:center;justify-content:space-between;padding:0 20px;color:#fff;background:linear-gradient(90deg,#1677ff,#4f9cff);box-shadow:0 10px 24px rgba(22,119,255,.18)} + .topbar span:first-child{font-size:28px;line-height:1} + .topbar span:nth-child(2){font-size:15px;font-weight:600} + .topbar span:last-child{font-size:20px;line-height:1} + main{box-sizing:border-box;width:min(390px,100%);margin:0 auto;padding:48px 28px 0} + .brand{text-align:center} + .brand img{width:42px;height:42px;border-radius:10px;object-fit:cover} + .brand h1{margin:12px 0 0;font-size:23px;font-weight:600;line-height:1} + .brand p{margin:8px 0 0;color:#8a94a6;font-size:14px;font-weight:500} + .open-pill{min-height:58px;margin-top:40px;padding:0 20px;display:flex;align-items:center;justify-content:space-between;border-radius:999px;background:#fff;box-shadow:0 12px 30px rgba(15,23,42,.12)} + .open-pill strong{display:flex;align-items:center;gap:12px;font-size:16px;font-weight:600} + .open-pill em{font-style:normal;color:#1677ff;font-size:15px;font-weight:600} + .spinner{width:28px;height:28px;border:4px solid #d7e8ff;border-top-color:#1677ff;border-radius:999px;animation:spin .85s linear infinite} + #message{margin:28px 0 0;text-align:center;color:#8a94a6;font-size:13px;font-weight:500;line-height:1.7} + .ghost-card{margin-top:44px;padding:20px;border-radius:18px;background:rgba(255,255,255,.9);box-shadow:0 18px 42px rgba(15,23,42,.08)} + .ghost-title{font-size:15px;font-weight:600;color:#7b8494} + .ghost-line{height:12px;border-radius:999px;background:#eef3f9} + .ghost-line.one{margin-top:24px} + .ghost-line.two{width:74%;margin-top:12px} + .ghost-list{margin-top:32px;display:grid;gap:20px} + .ghost-row{display:flex;align-items:center;gap:12px} + .ghost-dot{width:16px;height:16px;border-radius:999px;border:1px solid #e3eaf3} + .ghost-row .ghost-line{flex:1;margin:0} + .ghost-row:last-child .ghost-line{flex:.67} + @keyframes spin{to{transform:rotate(360deg)}} + ` + +const SURVEY_OPENING_PAGE_MARKUP = ` +
‹素材库•••
+
+
+ 素材库 +

素材库

+

内部素材协作平台

+
+
+ 正在打开问卷 + 马上进入 +
+

正在打开问卷...

+ +
` + function getLoginSetCookies(source: Response): string[] { const getSetCookie = (source.headers as any).getSetCookie const cookies = typeof getSetCookie === 'function' @@ -78,21 +133,10 @@ function createSessionTicketTransferPage({ 正在打开问卷 - + -
- -

正在打开问卷

-

正在打开问卷...

-
+${SURVEY_OPENING_PAGE_MARKUP}