Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c5eb0841
authored
Jun 02, 2024
by
vben
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: new interface button parameters, control function display
1 parent
f95cc808
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
135 additions
and
40 deletions
apps/antd-view/src/apis/modules/user.ts
apps/antd-view/src/forward/index.ts
apps/antd-view/src/forward/request.ts → apps/antd-view/src/forward/request/index.ts
apps/antd-view/src/views/_essential/authentication/login.vue
packages/business/common-ui/src/authentication/code-login.vue
packages/business/common-ui/src/authentication/forget-password.vue
packages/business/common-ui/src/authentication/index.ts
packages/business/common-ui/src/authentication/login.vue
packages/business/common-ui/src/authentication/qrcode-login.vue
packages/business/common-ui/src/authentication/register.vue
packages/business/common-ui/src/authentication/color-toggle.vue → packages/business/common-ui/src/authentication/widgets/color-toggle.vue
packages/business/common-ui/src/authentication/layout-toggle.vue → packages/business/common-ui/src/authentication/widgets/layout-toggle.vue
apps/antd-view/src/apis/modules/user.ts
View file @
c5eb084
import
type
{
UserApiType
}
from
'@/apis/types'
;
import
type
{
UserApiType
}
from
'@/apis/types'
;
import
type
{
UserInfo
}
from
'@vben/types'
;
import
type
{
UserInfo
}
from
'@vben/types'
;
import
{
request
}
from
'@/forward
/request
'
;
import
{
request
}
from
'@/forward'
;
/**
/**
* 登录
* 登录
...
...
apps/antd-view/src/forward/index.ts
0 → 100644
View file @
c5eb084
export
*
from
'./request'
;
apps/antd-view/src/forward/request.ts
→
apps/antd-view/src/forward/request
/index
.ts
View file @
c5eb084
File moved
apps/antd-view/src/views/_essential/authentication/login.vue
View file @
c5eb084
...
@@ -67,5 +67,10 @@ const loginLoading = computed(() => {
...
@@ -67,5 +67,10 @@ const loginLoading = computed(() => {
</
script
>
</
script
>
<
template
>
<
template
>
<AuthenticationLogin
:loading=
"loginLoading"
@
submit=
"handleLogin"
/>
<AuthenticationLogin
username-placeholder=
"vben"
password-placeholder=
"123456"
:loading=
"loginLoading"
@
submit=
"handleLogin"
/>
</
template
>
</
template
>
packages/business/common-ui/src/authentication/code-login.vue
View file @
c5eb084
...
@@ -14,14 +14,19 @@ interface Props {
...
@@ -14,14 +14,19 @@ interface Props {
* @zh_CN 是否处于加载处理状态
* @zh_CN 是否处于加载处理状态
*/
*/
loading
?:
boolean
;
loading
?:
boolean
;
/**
* @zh_CN 登陆路径
*/
loginPath
?:
string
;
}
}
defineOptions
({
defineOptions
({
name
:
'AuthenticationCodeLogin'
,
name
:
'AuthenticationCodeLogin'
,
});
});
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
loading
:
false
,
loading
:
false
,
loginPath
:
'/auth/login'
,
});
});
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
@@ -76,8 +81,8 @@ function handleSubmit() {
...
@@ -76,8 +81,8 @@ function handleSubmit() {
});
});
}
}
function
handleGo
(
path
:
string
)
{
function
goLogin
(
)
{
router
.
push
(
path
);
router
.
push
(
p
rops
.
loginP
ath
);
}
}
async
function
handleSendCode
()
{
async
function
handleSendCode
()
{
...
@@ -145,11 +150,7 @@ onBeforeUnmount(() => {
...
@@ -145,11 +150,7 @@ onBeforeUnmount(() => {
<VbenButton
:loading=
"loading"
class=
"mt-2 w-full"
@
click=
"handleSubmit"
>
<VbenButton
:loading=
"loading"
class=
"mt-2 w-full"
@
click=
"handleSubmit"
>
{{ $t('common.login') }}
{{ $t('common.login') }}
</VbenButton>
</VbenButton>
<VbenButton
<VbenButton
class=
"mt-4 w-full"
variant=
"outline"
@
click=
"goLogin()"
>
class=
"mt-4 w-full"
variant=
"outline"
@
click=
"handleGo('/auth/login')"
>
{{ $t('common.back') }}
{{ $t('common.back') }}
</VbenButton>
</VbenButton>
</div>
</div>
...
...
packages/business/common-ui/src/authentication/forget-password.vue
View file @
c5eb084
...
@@ -12,14 +12,19 @@ interface Props {
...
@@ -12,14 +12,19 @@ interface Props {
* @zh_CN 是否处于加载处理状态
* @zh_CN 是否处于加载处理状态
*/
*/
loading
?:
boolean
;
loading
?:
boolean
;
/**
* @zh_CN 登陆路径
*/
loginPath
?:
string
;
}
}
defineOptions
({
defineOptions
({
name
:
'AuthenticationForgetPassword'
,
name
:
'AuthenticationForgetPassword'
,
});
});
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
loading
:
false
,
loading
:
false
,
loginPath
:
'/auth/login'
,
});
});
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
@@ -44,8 +49,8 @@ function handleSubmut() {
...
@@ -44,8 +49,8 @@ function handleSubmut() {
emit
(
'submit'
,
formState
.
email
);
emit
(
'submit'
,
formState
.
email
);
}
}
function
handleGo
(
path
:
string
)
{
function
goLogin
(
)
{
router
.
push
(
path
);
router
.
push
(
p
rops
.
loginP
ath
);
}
}
</
script
>
</
script
>
...
@@ -73,11 +78,7 @@ function handleGo(path: string) {
...
@@ -73,11 +78,7 @@ function handleGo(path: string) {
<VbenButton
class=
"mt-2 w-full"
@
click=
"handleSubmut"
>
<VbenButton
class=
"mt-2 w-full"
@
click=
"handleSubmut"
>
{{ $t('authentication.send-reset-link') }}
{{ $t('authentication.send-reset-link') }}
</VbenButton>
</VbenButton>
<VbenButton
<VbenButton
class=
"mt-4 w-full"
variant=
"outline"
@
click=
"goLogin()"
>
class=
"mt-4 w-full"
variant=
"outline"
@
click=
"handleGo('/auth/login')"
>
{{ $t('common.back') }}
{{ $t('common.back') }}
</VbenButton>
</VbenButton>
</div>
</div>
...
...
packages/business/common-ui/src/authentication/index.ts
View file @
c5eb084
export
{
default
as
AuthenticationCodeLogin
}
from
'./code-login.vue'
;
export
{
default
as
AuthenticationCodeLogin
}
from
'./code-login.vue'
;
export
{
default
as
AuthenticationColorToggle
}
from
'./color-toggle.vue'
;
export
{
default
as
AuthenticationForgetPassword
}
from
'./forget-password.vue'
;
export
{
default
as
AuthenticationForgetPassword
}
from
'./forget-password.vue'
;
export
{
default
as
AuthenticationLayoutToggle
}
from
'./layout-toggle.vue'
;
export
{
default
as
AuthenticationLogin
}
from
'./login.vue'
;
export
{
default
as
AuthenticationLogin
}
from
'./login.vue'
;
export
{
default
as
AuthenticationQrCodeLogin
}
from
'./qrcode-login.vue'
;
export
{
default
as
AuthenticationQrCodeLogin
}
from
'./qrcode-login.vue'
;
export
{
default
as
AuthenticationRegister
}
from
'./register.vue'
;
export
{
default
as
AuthenticationRegister
}
from
'./register.vue'
;
export
type
{
LoginAndRegisterParams
,
LoginCodeParams
}
from
'./typings'
;
export
type
{
LoginAndRegisterParams
,
LoginCodeParams
}
from
'./typings'
;
export
{
default
as
AuthenticationColorToggle
}
from
'./widgets/color-toggle.vue'
;
export
{
default
as
AuthenticationLayoutToggle
}
from
'./widgets/layout-toggle.vue'
;
packages/business/common-ui/src/authentication/login.vue
View file @
c5eb084
...
@@ -17,9 +17,64 @@ import type { LoginEmits } from './typings';
...
@@ -17,9 +17,64 @@ import type { LoginEmits } from './typings';
interface
Props
{
interface
Props
{
/**
/**
* @zh_CN 验证码登录路径
*/
codeLoginPath
?:
string
;
/**
* @zh_CN 忘记密码路径
*/
forgetPasswordPath
?:
string
;
/**
* @zh_CN 是否处于加载处理状态
* @zh_CN 是否处于加载处理状态
*/
*/
loading
?:
boolean
;
loading
?:
boolean
;
/**
* @zh_CN 密码占位符
*/
passwordPlaceholder
?:
string
;
/**
* @zh_CN 二维码登录路径
*/
qrCodeLoginPath
?:
string
;
/**
* @zh_CN 注册路径
*/
registerPath
?:
string
;
/**
* @zh_CN 是否显示验证码登录
*/
showCodeLogin
?:
boolean
;
/**
* @zh_CN 是否显示忘记密码
*/
showForgetPassword
?:
boolean
;
/**
* @zh_CN 是否显示二维码登录
*/
showQrcodeLogin
?:
boolean
;
/**
* @zh_CN 是否显示注册按钮
*/
showRegister
?:
boolean
;
/**
* @zh_CN 是否显示第三方登录
*/
showThirdPartyLogin
?:
boolean
;
/**
* @zh_CN 用户名占位符
*/
usernamePlaceholder
?:
string
;
}
}
defineOptions
({
defineOptions
({
...
@@ -27,7 +82,18 @@ defineOptions({
...
@@ -27,7 +82,18 @@ defineOptions({
});
});
withDefaults
(
defineProps
<
Props
>
(),
{
withDefaults
(
defineProps
<
Props
>
(),
{
codeLoginPath
:
'/auth/code-login'
,
forgetPasswordPath
:
'/auth/forget-password'
,
loading
:
false
,
loading
:
false
,
passwordPlaceholder
:
''
,
qrCodeLoginPath
:
'/auth/qrcode-login'
,
registerPath
:
'/auth/register'
,
showCodeLogin
:
true
,
showForgetPassword
:
true
,
showQrcodeLogin
:
true
,
showRegister
:
true
,
showThirdPartyLogin
:
true
,
usernamePlaceholder
:
''
,
});
});
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
@@ -39,6 +105,7 @@ const router = useRouter();
...
@@ -39,6 +105,7 @@ const router = useRouter();
const
REMEMBER_ME_KEY
=
'REMEMBER_ME_USERNAME'
;
const
REMEMBER_ME_KEY
=
'REMEMBER_ME_USERNAME'
;
const
localUsername
=
localStorage
.
getItem
(
REMEMBER_ME_KEY
)
||
''
;
const
localUsername
=
localStorage
.
getItem
(
REMEMBER_ME_KEY
)
||
''
;
const
formState
=
reactive
({
const
formState
=
reactive
({
password
:
''
,
password
:
''
,
rememberMe
:
!!
localUsername
,
rememberMe
:
!!
localUsername
,
...
@@ -81,7 +148,7 @@ function handleGo(path: string) {
...
@@ -81,7 +148,7 @@ function handleGo(path: string) {
</
script
>
</
script
>
<
template
>
<
template
>
<div
@
keypress
.
enter=
"handleSubmit"
>
<div
@
keypress
.
enter
.
prevent
=
"handleSubmit"
>
<Title>
<Title>
{{
$t
(
'authentication.welcome-back'
)
}}
👋🏻
{{
$t
(
'authentication.welcome-back'
)
}}
👋🏻
<template
#
desc
>
<template
#
desc
>
...
@@ -97,7 +164,7 @@ function handleGo(path: string) {
...
@@ -97,7 +164,7 @@ function handleGo(path: string) {
:error-tip=
"$t('authentication.username-tip')"
:error-tip=
"$t('authentication.username-tip')"
:label=
"$t('authentication.username')"
:label=
"$t('authentication.username')"
name=
"username"
name=
"username"
:placeholder=
"$t('authentication.username')"
:placeholder=
"
usernamePlaceholder ||
$t('authentication.username')"
type=
"text"
type=
"text"
required
required
:autofocus=
"false"
:autofocus=
"false"
...
@@ -108,7 +175,7 @@ function handleGo(path: string) {
...
@@ -108,7 +175,7 @@ function handleGo(path: string) {
:error-tip=
"$t('authentication.password-tip')"
:error-tip=
"$t('authentication.password-tip')"
:label=
"$t('authentication.password')"
:label=
"$t('authentication.password')"
name=
"password"
name=
"password"
:placeholder=
"$t('authentication.password')"
:placeholder=
"
passwordPlaceholder ||
$t('authentication.password')"
required
required
type=
"password"
type=
"password"
/>
/>
...
@@ -121,8 +188,9 @@ function handleGo(path: string) {
...
@@ -121,8 +188,9 @@ function handleGo(path: string) {
</div>
</div>
<span
<span
v-if=
"showForgetPassword"
class=
"text-primary hover:text-primary/80 cursor-pointer text-sm font-normal"
class=
"text-primary hover:text-primary/80 cursor-pointer text-sm font-normal"
@
click=
"handleGo(
'/auth/forget-password'
)"
@
click=
"handleGo(
forgetPasswordPath
)"
>
>
{{ $t('authentication.forget-password') }}
{{ $t('authentication.forget-password') }}
</span>
</span>
...
@@ -136,16 +204,18 @@ function handleGo(path: string) {
...
@@ -136,16 +204,18 @@ function handleGo(path: string) {
<div
class=
"mb-2 mt-4 flex items-center justify-between"
>
<div
class=
"mb-2 mt-4 flex items-center justify-between"
>
<VbenButton
<VbenButton
v-if=
"showCodeLogin"
variant=
"outline"
variant=
"outline"
class=
"w-1/2"
class=
"w-1/2"
@
click=
"handleGo(
'/auth/code-login'
)"
@
click=
"handleGo(
codeLoginPath
)"
>
>
{{ $t('authentication.mobile-login') }}
{{ $t('authentication.mobile-login') }}
</VbenButton>
</VbenButton>
<VbenButton
<VbenButton
v-if=
"showQrcodeLogin"
variant=
"outline"
variant=
"outline"
class=
"ml-4 w-1/2"
class=
"ml-4 w-1/2"
@
click=
"handleGo(
'/auth/qrcode-login'
)"
@
click=
"handleGo(
qrCodeLoginPath
)"
>
>
{{ $t('authentication.qrcode-login') }}
{{ $t('authentication.qrcode-login') }}
</VbenButton>
</VbenButton>
...
@@ -160,13 +230,13 @@ function handleGo(path: string) {
...
@@ -160,13 +230,13 @@ function handleGo(path: string) {
</div>
</div>
<!-- 第三方登录 -->
<!-- 第三方登录 -->
<ThirdPartyLogin
/>
<ThirdPartyLogin
v-if=
"showThirdPartyLogin"
/>
<div
class=
"text-center text-sm"
>
<div
v-if=
"showRegister"
class=
"text-center text-sm"
>
{{ $t('authentication.account-tip') }}
{{ $t('authentication.account-tip') }}
<span
<span
class=
"text-primary hover:text-primary/80 cursor-pointer text-sm font-normal"
class=
"text-primary hover:text-primary/80 cursor-pointer text-sm font-normal"
@
click=
"handleGo(
'/auth/register'
)"
@
click=
"handleGo(
registerPath
)"
>
>
{{ $t('authentication.create-account') }}
{{ $t('authentication.create-account') }}
</span>
</span>
...
...
packages/business/common-ui/src/authentication/qrcode-login.vue
View file @
c5eb084
...
@@ -8,10 +8,26 @@ import { useRouter } from 'vue-router';
...
@@ -8,10 +8,26 @@ import { useRouter } from 'vue-router';
import
Title
from
'./auth-title.vue'
;
import
Title
from
'./auth-title.vue'
;
interface
Props
{
/**
* @zh_CN 是否处于加载处理状态
*/
loading
?:
boolean
;
/**
* @zh_CN 登陆路径
*/
loginPath
?:
string
;
}
defineOptions
({
defineOptions
({
name
:
'AuthenticationQrCodeLogin'
,
name
:
'AuthenticationQrCodeLogin'
,
});
});
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
loading
:
false
,
loginPath
:
'/auth/login'
,
});
const
router
=
useRouter
();
const
router
=
useRouter
();
const
text
=
ref
(
'https://vben.vvbin.cn'
);
const
text
=
ref
(
'https://vben.vvbin.cn'
);
...
@@ -21,8 +37,8 @@ const qrcode = useQRCode(text, {
...
@@ -21,8 +37,8 @@ const qrcode = useQRCode(text, {
margin
:
4
,
margin
:
4
,
});
});
function
handleGo
(
path
:
string
)
{
function
goLogin
(
)
{
router
.
push
(
path
);
router
.
push
(
p
rops
.
loginP
ath
);
}
}
</
script
>
</
script
>
...
@@ -44,11 +60,7 @@ function handleGo(path: string) {
...
@@ -44,11 +60,7 @@ function handleGo(path: string) {
</p>
</p>
</div>
</div>
<VbenButton
<VbenButton
class=
"mt-4 w-full"
variant=
"outline"
@
click=
"goLogin()"
>
class=
"mt-4 w-full"
variant=
"outline"
@
click=
"handleGo('/auth/login')"
>
{{ $t('common.back') }}
{{ $t('common.back') }}
</VbenButton>
</VbenButton>
</div>
</div>
...
...
packages/business/common-ui/src/authentication/register.vue
View file @
c5eb084
...
@@ -19,14 +19,19 @@ interface Props {
...
@@ -19,14 +19,19 @@ interface Props {
* @zh_CN 是否处于加载处理状态
* @zh_CN 是否处于加载处理状态
*/
*/
loading
?:
boolean
;
loading
?:
boolean
;
/**
* @zh_CN 登陆路径
*/
loginPath
?:
string
;
}
}
defineOptions
({
defineOptions
({
name
:
'RegisterForm'
,
name
:
'RegisterForm'
,
});
});
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
loading
:
false
,
loading
:
false
,
loginPath
:
'/auth/login'
,
});
});
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
@@ -72,8 +77,8 @@ function handleSubmit() {
...
@@ -72,8 +77,8 @@ function handleSubmit() {
});
});
}
}
function
handleGo
(
path
:
string
)
{
function
goLogin
(
)
{
router
.
push
(
path
);
router
.
push
(
p
rops
.
loginP
ath
);
}
}
</
script
>
</
script
>
...
@@ -154,7 +159,7 @@ function handleGo(path: string) {
...
@@ -154,7 +159,7 @@ function handleGo(path: string) {
{{ $t('authentication.already-account') }}
{{ $t('authentication.already-account') }}
<span
<span
class=
"text-primary hover:text-primary/80 cursor-pointer text-sm font-normal"
class=
"text-primary hover:text-primary/80 cursor-pointer text-sm font-normal"
@
click=
"
handleGo('/auth/login'
)"
@
click=
"
goLogin(
)"
>
>
{{ $t('authentication.go-login') }}
{{ $t('authentication.go-login') }}
</span>
</span>
...
...
packages/business/common-ui/src/authentication/color-toggle.vue
→
packages/business/common-ui/src/authentication/
widgets/
color-toggle.vue
View file @
c5eb084
File moved
packages/business/common-ui/src/authentication/layout-toggle.vue
→
packages/business/common-ui/src/authentication/
widgets/
layout-toggle.vue
View file @
c5eb084
File moved
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment