引入 husky,并全局重新格式化

This commit is contained in:
2025-06-07 11:49:57 +08:00
parent 05fce179c9
commit c7527177b0
89 changed files with 2140 additions and 1899 deletions

View File

@@ -14,7 +14,7 @@ function generateCaptchaText(length: number = 4): string {
}
// 哈希验证码文本并使用随机盐值
function hashCaptcha(text: string): { hash: string, salt: string } {
function hashCaptcha(text: string): {hash: string, salt: string} {
const salt = crypto.randomBytes(16).toString('hex')
const hash = crypto
.createHmac('sha256', salt)

View File

@@ -63,7 +63,7 @@ export default function Captcha(props: CaptchaProps) {
<Input
placeholder="请输入图形验证码"
value={captchaCode}
onChange={(e) => setCaptchaCode(e.target.value)}
onChange={e => setCaptchaCode(e.target.value)}
className="w-full"
/>
</div>

View File

@@ -1,6 +1,5 @@
import { ReactNode } from 'react'
import { Metadata } from 'next'
import {ReactNode} from 'react'
import {Metadata} from 'next'
export async function generateMetadata(): Promise<Metadata> {
return {
@@ -9,9 +8,9 @@ export async function generateMetadata(): Promise<Metadata> {
}
export type LoginLayoutProps = {
children: ReactNode
children: ReactNode
}
export default async function LoginLayout(props: LoginLayoutProps) {
return props.children
}
}

View File

@@ -193,7 +193,7 @@ export default function LoginPage(props: LoginPageProps) {
const params = useSearchParams()
const redirect = params.get('redirect')
const refreshProfile = useProfileStore(store=>store.refreshProfile)
const refreshProfile = useProfileStore(store => store.refreshProfile)
// ======================
// render
@@ -205,9 +205,9 @@ export default function LoginPage(props: LoginPageProps) {
`h-screen w-screen xl:pr-64 bg-cover bg-left`,
`flex justify-center xl:justify-end items-center`,
)}>
<Image src={bg} alt={`背景图`} fill priority className={`absolute -z-10 object-cover`}/>
<Image src={bg} alt="背景图" fill priority className="absolute -z-10 object-cover"/>
<Image src={logo} alt={`logo`} priority height={64} className={`absolute top-8 left-8`}/>
<Image src={logo} alt="logo" priority height={64} className="absolute top-8 left-8"/>
{/* 登录表单 */}
<Card className="w-96 mx-4 shadow-lg">
@@ -215,9 +215,9 @@ export default function LoginPage(props: LoginPageProps) {
<CardTitle className="text-2xl">/</CardTitle>
</CardHeader>
<CardContent className={`px-8`}>
<CardContent className="px-8">
<Form<FormValues> className="space-y-6" onSubmit={onSubmit} form={form}>
<FormField name="username" label={`手机号码`}>
<FormField name="username" label="手机号码">
{({id, field}) => (
<Input
{...field}
@@ -229,7 +229,7 @@ export default function LoginPage(props: LoginPageProps) {
)}
</FormField>
<FormField name="password" label={`验证码`}>
<FormField name="password" label="验证码">
{({id, field}) => (
<div className="flex space-x-4">
<Input
@@ -277,7 +277,10 @@ export default function LoginPage(props: LoginPageProps) {
</Button>
<p className="text-xs text-center text-gray-500">
<a href="#" className="text-blue-600 hover:text-blue-500"></a><a href="#" className="text-blue-600 hover:text-blue-500"></a>
<a href="#" className="text-blue-600 hover:text-blue-500"></a>
<a href="#" className="text-blue-600 hover:text-blue-500"></a>
</p>
</div>
</Form>