更新登录功能

This commit is contained in:
Eamon
2026-08-13 18:28:20 +08:00
parent 115ee3bfeb
commit 4235458bea
25 changed files with 1900 additions and 873 deletions

View File

@@ -17,6 +17,7 @@ import {
} from "lucide-react"
import { type ReactNode, useState } from "react"
import { Link } from "react-router-dom"
import ProfileOrLogin from "@/components/profileOrLogin"
import { Button } from "@/components/ui/button"
import {
Tooltip,
@@ -100,22 +101,12 @@ export function Header() {
<AdminNavMenu />
<div className="flex-none flex items-center justify-end pr-4 max-md:hidden gap-3">
{/* <Link
to="/"
className="flex-none h-16 flex items-center justify-center text-sm"
>
返回首页
</Link> */}
<UserCenter />
<ProfileOrLogin />
</div>
</header>
)
}
function UserCenter() {
return <div className="flex items-center gap-2">用户</div>
}
export function Navbar() {
const { navbar } = useLayout()

View File

@@ -1,6 +1,7 @@
import { useCallback, useRef, useState } from "react"
import { createPortal } from "react-dom"
import { NavLink, useNavigate } from "react-router-dom"
import { NavLink } from "react-router-dom"
import ProductDropdown from "@/components/productDropdown"
import { cn } from "@/lib/utils"
export function AdminNavMenu() {
@@ -8,7 +9,7 @@ export function AdminNavMenu() {
<nav className="flex-auto flex items-center justify-center gap-1 max-lg:hidden">
<AdminNavItem to="/">首页</AdminNavItem>
<AdminMenuItem text="产品购买">
<ProductDropdown />
<ProductDropdown size="sm" />
</AdminMenuItem>
<AdminNavItem to="/ipline">IP线路表</AdminNavItem>
<AdminNavItem to="/softdownload">软件下载</AdminNavItem>
@@ -138,110 +139,3 @@ function AdminMenuItem({
</div>
)
}
function ProductDropdown() {
const navigate = useNavigate()
const handleClick = (path: string) => {
navigate(path)
}
return (
<div className="space-y-3">
<div className="grid grid-cols-3 gap-3">
<ProductCard
title="动静态IP"
desc="千万级动态短效IP,自动去重,高并发采集"
tag="热门"
onClick={() => handleClick("/product?tab=short")}
/>
<ProductCard
title="新HTTP/S5"
desc="IP可用时长从数小时到365天全覆盖"
tag="稳定"
onClick={() => window.open("https://lanhuip.com", "_blank")}
/>
<ProductCard
title="HTTP/S5"
desc="海量全球住宅优质IP,4G/5G真实手机IP"
tag="全球"
onClick={() => handleClick("/product?tab=http")}
/>
<ProductCard
title="软路由成本价"
desc="云端自动切换IP,更易于调用与开发"
onClick={() => handleClick("/product?tab=tunnel")}
/>
<ProductCard
title="动态Vps"
desc="IP独享,高带宽,灵活控制存活周期"
onClick={() => window.open("http://vps.juip.com", "_blank")}
/>
</div>
<div className="flex items-center flex-wrap gap-2 pt-2 border-t border-gray-100">
<span className="text-xs font-medium text-gray-400">热门推荐:</span>
<button
onClick={() => handleClick("/product?tab=short")}
className="text-xs text-blue-600 hover:underline whitespace-nowrap"
>
短效代理
</button>
<button
onClick={() => handleClick("/product?tab=global")}
className="text-xs text-blue-600 hover:underline whitespace-nowrap"
>
海外代理
</button>
<button
onClick={() => handleClick("/product?tab=tunnel")}
className="text-xs text-blue-600 hover:underline whitespace-nowrap"
>
隧道代理
</button>
<span className="text-xs text-gray-300">|</span>
<button
onClick={() => handleClick("/product")}
className="text-xs text-orange-500 hover:underline font-medium whitespace-nowrap"
>
业务定制 →
</button>
</div>
</div>
)
}
function ProductCard({
title,
desc,
tag,
onClick,
}: {
title: string
desc: string
tag?: string
onClick: () => void
}) {
return (
<button
onClick={onClick}
className="group flex items-start gap-2 p-2 rounded-lg hover:bg-gray-50 transition-all cursor-pointer border border-transparent hover:border-blue-200 text-left w-full"
>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-1.5 flex-wrap">
<span className="font-medium text-gray-800 group-hover:text-blue-600 transition-colors text-xs whitespace-nowrap">
{title}
</span>
{tag && (
<span className="text-[10px] bg-blue-100 text-blue-600 px-1.5 py-0.5 rounded-full shrink-0">
{tag}
</span>
)}
</div>
<p className="text-[11px] text-gray-500 mt-0.5 leading-relaxed line-clamp-2">
{desc}
</p>
</div>
</button>
)
}