feat:初始化业务目录
This commit is contained in:
24
src/app/admin/(shell)/draws/page.tsx
Normal file
24
src/app/admin/(shell)/draws/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { drawsModuleMeta } from "@/modules/draws/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: drawsModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminDrawsPage() {
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={drawsModuleMeta.title}
|
||||
description={drawsModuleMeta.description}
|
||||
>
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
业务组件请放在{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 font-mono text-xs dark:bg-zinc-800">
|
||||
src/modules/draws
|
||||
</code>{" "}
|
||||
下。
|
||||
</p>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
9
src/app/admin/(shell)/layout.tsx
Normal file
9
src/app/admin/(shell)/layout.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { AdminShell } from "@/components/admin/admin-shell";
|
||||
|
||||
export default function AdminShellLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return <AdminShell>{children}</AdminShell>;
|
||||
}
|
||||
54
src/app/admin/(shell)/page.tsx
Normal file
54
src/app/admin/(shell)/page.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { getAdminPing } from "@/lib/admin-http";
|
||||
import { dashboardModuleMeta } from "@/modules/dashboard/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "总览",
|
||||
};
|
||||
|
||||
export default async function AdminDashboardPage() {
|
||||
const ping = await getAdminPing();
|
||||
const apiReady = process.env.NEXT_PUBLIC_LOTTERY_API_BASE_URL?.trim() !== "";
|
||||
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={dashboardModuleMeta.title}
|
||||
description={dashboardModuleMeta.description}
|
||||
>
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<div className="rounded-xl border border-black/10 bg-white p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900">
|
||||
<h2 className="text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">
|
||||
API 基底
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-foreground">
|
||||
{apiReady ? (
|
||||
<span className="font-medium text-emerald-600 dark:text-emerald-400">
|
||||
已配置 NEXT_PUBLIC_LOTTERY_API_BASE_URL
|
||||
</span>
|
||||
) : (
|
||||
<span className="font-medium text-amber-600 dark:text-amber-400">
|
||||
未配置环境变量,无法在服务端探测 Laravel
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
<p className="mt-3 text-xs leading-relaxed text-zinc-500 dark:text-zinc-400">
|
||||
与玩家端一致,指向 Laravel 根地址(会自动请求{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 dark:bg-zinc-800">
|
||||
/api/v1/admin/ping
|
||||
</code>
|
||||
)。
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-xl border border-black/10 bg-white p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900">
|
||||
<h2 className="text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">
|
||||
Admin Ping
|
||||
</h2>
|
||||
<p className="mt-2 font-mono text-sm text-foreground">
|
||||
{!apiReady ? "—" : ping ? JSON.stringify(ping) : "请求失败或未返回信封"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
24
src/app/admin/(shell)/players/page.tsx
Normal file
24
src/app/admin/(shell)/players/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { playersModuleMeta } from "@/modules/players/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: playersModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminPlayersPage() {
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={playersModuleMeta.title}
|
||||
description={playersModuleMeta.description}
|
||||
>
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
业务组件请放在{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 font-mono text-xs dark:bg-zinc-800">
|
||||
src/modules/players
|
||||
</code>{" "}
|
||||
下。
|
||||
</p>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
24
src/app/admin/(shell)/risk/page.tsx
Normal file
24
src/app/admin/(shell)/risk/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { riskModuleMeta } from "@/modules/risk/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: riskModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminRiskPage() {
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={riskModuleMeta.title}
|
||||
description={riskModuleMeta.description}
|
||||
>
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
业务组件请放在{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 font-mono text-xs dark:bg-zinc-800">
|
||||
src/modules/risk
|
||||
</code>{" "}
|
||||
下。
|
||||
</p>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
24
src/app/admin/(shell)/settings/page.tsx
Normal file
24
src/app/admin/(shell)/settings/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { settingsModuleMeta } from "@/modules/settings/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: settingsModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminSettingsPage() {
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={settingsModuleMeta.title}
|
||||
description={settingsModuleMeta.description}
|
||||
>
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
业务组件请放在{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 font-mono text-xs dark:bg-zinc-800">
|
||||
src/modules/settings
|
||||
</code>{" "}
|
||||
下。
|
||||
</p>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
24
src/app/admin/(shell)/tickets/page.tsx
Normal file
24
src/app/admin/(shell)/tickets/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { ticketsModuleMeta } from "@/modules/tickets/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: ticketsModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminTicketsPage() {
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={ticketsModuleMeta.title}
|
||||
description={ticketsModuleMeta.description}
|
||||
>
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
业务组件请放在{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 font-mono text-xs dark:bg-zinc-800">
|
||||
src/modules/tickets
|
||||
</code>{" "}
|
||||
下。
|
||||
</p>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
24
src/app/admin/(shell)/wallet/page.tsx
Normal file
24
src/app/admin/(shell)/wallet/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ModuleScaffold } from "@/components/admin/module-scaffold";
|
||||
import { walletModuleMeta } from "@/modules/wallet/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: walletModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminWalletPage() {
|
||||
return (
|
||||
<ModuleScaffold
|
||||
title={walletModuleMeta.title}
|
||||
description={walletModuleMeta.description}
|
||||
>
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
业务组件请放在{" "}
|
||||
<code className="rounded bg-zinc-100 px-1 py-0.5 font-mono text-xs dark:bg-zinc-800">
|
||||
src/modules/wallet
|
||||
</code>{" "}
|
||||
下。
|
||||
</p>
|
||||
</ModuleScaffold>
|
||||
);
|
||||
}
|
||||
9
src/app/admin/layout.tsx
Normal file
9
src/app/admin/layout.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export default function AdminSegmentLayout({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return <div className="flex min-h-full flex-1 flex-col">{children}</div>;
|
||||
}
|
||||
32
src/app/admin/login/page.tsx
Normal file
32
src/app/admin/login/page.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { authModuleMeta } from "@/modules/auth/meta";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: authModuleMeta.title,
|
||||
};
|
||||
|
||||
export default function AdminLoginPage() {
|
||||
return (
|
||||
<div className="flex min-h-full flex-1 flex-col items-center justify-center px-4 py-16">
|
||||
<div className="w-full max-w-md rounded-2xl border border-black/10 bg-white p-8 shadow-sm dark:border-white/10 dark:bg-zinc-900">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{authModuleMeta.title}
|
||||
</h1>
|
||||
<p className="mt-2 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
{authModuleMeta.description}
|
||||
</p>
|
||||
<p className="mt-6 text-sm text-zinc-500 dark:text-zinc-400">
|
||||
接入管理端鉴权后,在此放置表单与回调;当前为路由占位。
|
||||
</p>
|
||||
<Link
|
||||
href="/admin"
|
||||
className="mt-8 inline-flex text-sm font-medium text-foreground underline-offset-4 hover:underline"
|
||||
>
|
||||
返回工作台
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,26 +1,130 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import "shadcn/tailwind.css";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
}
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--font-heading: var(--font-sans);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--radius-sm: calc(var(--radius) * 0.6);
|
||||
--radius-md: calc(var(--radius) * 0.8);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) * 1.4);
|
||||
--radius-2xl: calc(var(--radius) * 1.8);
|
||||
--radius-3xl: calc(var(--radius) * 2.2);
|
||||
--radius-4xl: calc(var(--radius) * 2.6);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
html {
|
||||
@apply font-sans;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
|
||||
import { Providers } from "@/components/providers";
|
||||
import "./globals.css";
|
||||
|
||||
const geistSans = Geist({
|
||||
@@ -13,8 +15,11 @@ const geistMono = Geist_Mono({
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: {
|
||||
template: "%s · 彩票后台",
|
||||
default: "彩票后台",
|
||||
},
|
||||
description: "Lottery 管理端",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
@@ -24,10 +29,13 @@ export default function RootLayout({
|
||||
}>) {
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
lang="zh-Hans"
|
||||
suppressHydrationWarning
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col">{children}</body>
|
||||
<body className="flex min-h-full flex-col">
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,65 +1,6 @@
|
||||
import Image from "next/image";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
/** 本站即管理端,根路径直接进入工作台 */
|
||||
export default function RootPage() {
|
||||
redirect("/admin");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user