refactor!: 升级 @nuxt/ui@3,重构所有页面和组件,调整配置,移除不在需求中的页面
This commit is contained in:
@@ -63,7 +63,7 @@ function onSubmit(form: req.user.Login) {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: res.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -72,7 +72,7 @@ function onSubmit(form: req.user.Login) {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: res.msg || '账号或密码错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -81,7 +81,7 @@ function onSubmit(form: req.user.Login) {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: res.msg || '无法获取登录状态',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -104,7 +104,7 @@ function onSubmit(form: req.user.Login) {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: err.msg || '网络错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
})
|
||||
@@ -116,7 +116,7 @@ function onSubmit(form: req.user.Login) {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: err.msg || '网络错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
})
|
||||
@@ -138,7 +138,7 @@ const obtainSmsCode = () => {
|
||||
toast.add({
|
||||
title: '验证码发送失败',
|
||||
description: res.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -148,7 +148,7 @@ const obtainSmsCode = () => {
|
||||
sms_counting_down.value = 60 // TODO: save timestamp to localstorage
|
||||
toast.add({
|
||||
title: '短信验证码已发送',
|
||||
color: 'indigo',
|
||||
color: 'primary',
|
||||
icon: 'i-tabler-circle-check',
|
||||
})
|
||||
const interval = setInterval(() => {
|
||||
@@ -162,7 +162,7 @@ const obtainSmsCode = () => {
|
||||
toast.add({
|
||||
title: '验证码发送失败',
|
||||
description: err.msg || '网络错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
})
|
||||
@@ -183,7 +183,7 @@ const handle_sms_verify = (e: string[]) => {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: res.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -193,7 +193,7 @@ const handle_sms_verify = (e: string[]) => {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: res.msg || '无法获取登录状态',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -216,7 +216,7 @@ const handle_sms_verify = (e: string[]) => {
|
||||
toast.add({
|
||||
title: '登录失败',
|
||||
description: err.msg || '网络错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
})
|
||||
@@ -259,7 +259,7 @@ const obtainForgetSmsCode = () => {
|
||||
toast.add({
|
||||
title: '验证码发送失败',
|
||||
description: res.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -269,7 +269,7 @@ const obtainForgetSmsCode = () => {
|
||||
sms_counting_down.value = 60 // TODO: save timestamp to localstorage
|
||||
toast.add({
|
||||
title: '短信验证码已发送',
|
||||
color: 'indigo',
|
||||
color: 'primary',
|
||||
icon: 'i-tabler-circle-check',
|
||||
})
|
||||
const interval = setInterval(() => {
|
||||
@@ -283,7 +283,7 @@ const obtainForgetSmsCode = () => {
|
||||
toast.add({
|
||||
title: '验证码发送失败',
|
||||
description: err.msg || '网络错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
})
|
||||
@@ -307,7 +307,7 @@ const onForgetPasswordSubmit = (
|
||||
toast.add({
|
||||
title: '重置密码失败',
|
||||
description: res.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
return
|
||||
@@ -315,7 +315,7 @@ const onForgetPasswordSubmit = (
|
||||
toast.add({
|
||||
title: '重置密码成功',
|
||||
description: '请您继续登录',
|
||||
color: 'green',
|
||||
color: 'success',
|
||||
icon: 'i-tabler-circle-check',
|
||||
})
|
||||
currentTab.value = 1
|
||||
@@ -324,7 +324,7 @@ const onForgetPasswordSubmit = (
|
||||
toast.add({
|
||||
title: '重置密码失败',
|
||||
description: err.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
})
|
||||
@@ -353,7 +353,7 @@ onMounted(() => {
|
||||
toast.add({
|
||||
title: '认证失败',
|
||||
description: err.msg || 'Token 或 UserID 无效',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-circle-x',
|
||||
})
|
||||
router.replace('/')
|
||||
@@ -377,10 +377,10 @@ onMounted(() => {
|
||||
<div class="flex flex-col items-center">
|
||||
<UTabs
|
||||
:items="items"
|
||||
class="w-full sm:w-[400px]"
|
||||
class="w-full sm:w-100"
|
||||
v-model="currentTab"
|
||||
>
|
||||
<template #default="{ item, index, selected }">
|
||||
<!-- <template #default="{ item, index, selected }">
|
||||
<div class="flex items-center gap-2 relative truncate">
|
||||
<span class="truncate">{{ item.label }}</span>
|
||||
<span
|
||||
@@ -388,8 +388,8 @@ onMounted(() => {
|
||||
class="absolute -right-4 w-2 h-2 rounded-full bg-primary-500 dark:bg-primary-400"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #item="{ item }">
|
||||
</template> -->
|
||||
<template #content="{ item }">
|
||||
<UCard @submit.prevent="() => onSubmit(accountForm)">
|
||||
<template #header>
|
||||
<p
|
||||
@@ -406,7 +406,7 @@ onMounted(() => {
|
||||
v-if="item.key === 'account'"
|
||||
class="space-y-3"
|
||||
>
|
||||
<UFormGroup
|
||||
<UFormField
|
||||
label="用户名"
|
||||
name="username"
|
||||
required
|
||||
@@ -416,8 +416,8 @@ onMounted(() => {
|
||||
:disabled="final_loading"
|
||||
required
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="密码"
|
||||
name="password"
|
||||
required
|
||||
@@ -428,14 +428,14 @@ onMounted(() => {
|
||||
type="password"
|
||||
required
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="item.key === 'sms'"
|
||||
class="space-y-3"
|
||||
>
|
||||
<UFormGroup
|
||||
<UFormField
|
||||
label="手机号"
|
||||
name="mobile"
|
||||
required
|
||||
@@ -464,10 +464,11 @@ onMounted(() => {
|
||||
:loading="sms_sending"
|
||||
:disabled="!!sms_counting_down || final_loading"
|
||||
class="text-xs font-bold"
|
||||
color="gray"
|
||||
color="neutral"
|
||||
variant="outline"
|
||||
/>
|
||||
</UButtonGroup>
|
||||
</UFormGroup>
|
||||
</UFormField>
|
||||
<Transition name="pin-root">
|
||||
<div
|
||||
v-if="sms_triggered"
|
||||
@@ -512,7 +513,7 @@ onMounted(() => {
|
||||
:state="forgetPasswordState"
|
||||
@submit="onForgetPasswordSubmit"
|
||||
>
|
||||
<UFormGroup
|
||||
<UFormField
|
||||
label="手机号"
|
||||
name="mobile"
|
||||
required
|
||||
@@ -540,11 +541,11 @@ onMounted(() => {
|
||||
:loading="sms_sending"
|
||||
:disabled="!!sms_counting_down"
|
||||
class="text-xs font-bold"
|
||||
color="gray"
|
||||
color="neutral"
|
||||
/>
|
||||
</UButtonGroup>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="验证码"
|
||||
name="sms_code"
|
||||
required
|
||||
@@ -555,8 +556,8 @@ onMounted(() => {
|
||||
class="w-full"
|
||||
:disabled="final_loading"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="新密码"
|
||||
name="password"
|
||||
required
|
||||
@@ -566,7 +567,7 @@ onMounted(() => {
|
||||
type="password"
|
||||
:disabled="final_loading"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormField>
|
||||
|
||||
<div>
|
||||
<UButton
|
||||
@@ -586,14 +587,14 @@ onMounted(() => {
|
||||
<div class="flex items-center justify-between">
|
||||
<UButton
|
||||
type="submit"
|
||||
color="black"
|
||||
color="neutral"
|
||||
:loading="final_loading"
|
||||
>
|
||||
登录
|
||||
</UButton>
|
||||
<UButton
|
||||
variant="link"
|
||||
color="gray"
|
||||
color="neutral"
|
||||
@click="currentTab = 2"
|
||||
>
|
||||
忘记密码
|
||||
@@ -606,7 +607,7 @@ onMounted(() => {
|
||||
</div>
|
||||
<div class="pt-4">
|
||||
<UButton
|
||||
color="gray"
|
||||
color="neutral"
|
||||
variant="ghost"
|
||||
class="text-gray-500!"
|
||||
@click="
|
||||
|
||||
@@ -48,7 +48,7 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
toast.add({
|
||||
title: '注册成功',
|
||||
description: '请联系客服激活账号后登录',
|
||||
color: 'green',
|
||||
color: 'success',
|
||||
icon: 'i-tabler-check',
|
||||
})
|
||||
router.push('/user/authenticate')
|
||||
@@ -59,7 +59,7 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
toast.add({
|
||||
title: '注册失败',
|
||||
description: err.message || '注册失败,请稍后再试',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-alert-triangle',
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
<div class="flex flex-col items-center">
|
||||
<UCard
|
||||
@submit.prevent="() => onSubmit(registerState)"
|
||||
class="w-full sm:w-[400px]"
|
||||
class="w-full sm:w-100"
|
||||
>
|
||||
<!-- <template #header>
|
||||
<p
|
||||
@@ -92,7 +92,7 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
</template> -->
|
||||
|
||||
<div class="space-y-3">
|
||||
<UFormGroup
|
||||
<UFormField
|
||||
label="姓名"
|
||||
name="username"
|
||||
help="请使用姓名作为用户名,将用于登录"
|
||||
@@ -103,8 +103,8 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
:disabled="final_loading"
|
||||
required
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="密码"
|
||||
name="password"
|
||||
required
|
||||
@@ -115,8 +115,8 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
type="password"
|
||||
required
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="手机号"
|
||||
name="mobile"
|
||||
required
|
||||
@@ -126,8 +126,8 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
:disabled="final_loading"
|
||||
required
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="公司/单位"
|
||||
name="company"
|
||||
required
|
||||
@@ -137,14 +137,14 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
:disabled="final_loading"
|
||||
required
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex items-center justify-between">
|
||||
<UButton
|
||||
type="submit"
|
||||
color="black"
|
||||
color="neutral"
|
||||
:loading="final_loading"
|
||||
>
|
||||
注册
|
||||
@@ -155,7 +155,7 @@ const onSubmit = (form: RegisterSchema) => {
|
||||
</div>
|
||||
<div class="pt-4">
|
||||
<UButton
|
||||
color="gray"
|
||||
color="neutral"
|
||||
variant="ghost"
|
||||
class="text-gray-500!"
|
||||
@click="
|
||||
|
||||
Reference in New Issue
Block a user