Skip to content

Commit 95e9487

Browse files
committed
fix: adapt to leporidae image aspect
1 parent 74754b7 commit 95e9487

File tree

9 files changed

+22
-24
lines changed

9 files changed

+22
-24
lines changed

app/components/image/image-card.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ const representativeLabels = computed(() => {
7575
})
7676
7777
const skeletonAspectRatio = computed(() => {
78-
const width = props.imageAspect.ratioWidthUnit
79-
const height = props.imageAspect.ratioHeightUnit
78+
const width = props.imageAspect.ratio_width_unit
79+
const height = props.imageAspect.ratio_height_unit
8080
8181
return `${width} / ${height}`
8282
})

app/components/image/image-selector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ watch([activeSecondary], async () => {
166166
{{ title }}
167167
</h2>
168168
<p v-if="aspect" class="text-sm text-base-content/70">
169-
比例:{{ aspect.name }} · {{ `${aspect.ratioWidthUnit}:${aspect.ratioHeightUnit}` }}
169+
比例:{{ aspect.name }} · {{ `${aspect.ratio_width_unit}:${aspect.ratio_height_unit}` }}
170170
</p>
171171
</div>
172172
</header>

app/components/image/image-uploader.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const metadata = reactive({
3232
3333
const cropRatio = computed(() => {
3434
if (props.aspect) {
35-
return [props.aspect.ratioWidthUnit || 1, props.aspect.ratioHeightUnit || 1]
35+
return [props.aspect.ratio_width_unit || 1, props.aspect.ratio_height_unit || 1]
3636
}
3737
return [4, 3]
3838
})
@@ -42,9 +42,9 @@ const cropBox = computed(() => {
4242
return { width: 300, height: 225 }
4343
}
4444
const base = 320
45-
const total = props.aspect.ratioWidthUnit + props.aspect.ratioHeightUnit
46-
const width = (props.aspect.ratioWidthUnit / total) * base * 2
47-
const height = (props.aspect.ratioHeightUnit / total) * base * 2
45+
const total = props.aspect.ratio_width_unit + props.aspect.ratio_height_unit
46+
const width = (props.aspect.ratio_width_unit / total) * base * 2
47+
const height = (props.aspect.ratio_height_unit / total) * base * 2
4848
return { width, height }
4949
})
5050

app/composables/useImageList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function useImageList(options: UseImageListOptions) {
9898
await refresh()
9999
}
100100

101-
const customImages = computed(() => images.value.filter(image => image.visibility === 'PRIVATE'))
101+
const customImages = computed(() => images.value.filter(image => image.visibility === ImageVisibility.PRIVATE))
102102

103103
const representativeLabels = computed(() => {
104104
const allLabels = [...availableLabels.value, ...activeFilters.value ?? []]

app/pages/auth/login.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const { loggedIn, fetch: fetchUser, user } = useUserSession()
1010
const shouldCompleteProfile = computed(() => (user.value?.email?.trim()?.length ?? 0) === 0)
1111
1212
const strategyOptions: Array<{ value: AuthStrategy, name: string, desc: string, passwordLabel: string, usernameLabel?: string }> = [
13-
{ value: 0, name: 'UsagiLab 通行证', desc: '使用 UsagiLab 统一认证(原兔卡账号)登录', passwordLabel: '密码', usernameLabel: '用户名' },
14-
{ value: 1, name: '水鱼 · DIVING_FISH', desc: '使用绑定的 DivingFish 账号密码登录', passwordLabel: '密码', usernameLabel: '用户名' },
15-
{ value: 2, name: '落雪 · LXNS', desc: '使用绑定的 LXNS 个人 API 密钥登录', passwordLabel: '个人密钥', usernameLabel: undefined },
13+
{ value: AuthStrategy.LOCAL, name: 'UsagiLab 通行证', desc: '使用 UsagiLab 统一认证(原兔卡账号)登录', passwordLabel: '密码', usernameLabel: '用户名' },
14+
{ value: AuthStrategy.DIVING_FISH, name: '水鱼 · DIVING_FISH', desc: '使用绑定的 DivingFish 账号密码登录', passwordLabel: '密码', usernameLabel: '用户名' },
15+
{ value: AuthStrategy.LXNS, name: '落雪 · LXNS', desc: '使用绑定的 LXNS 个人 API 密钥登录', passwordLabel: '个人密钥', usernameLabel: undefined },
1616
]
1717
1818
// Redirect if already logged in
@@ -41,7 +41,7 @@ interface LoginForm {
4141
const form = reactive<LoginForm>({
4242
username: '',
4343
password: '',
44-
strategy: 0,
44+
strategy: AuthStrategy.LOCAL,
4545
})
4646
4747
const { validate, ve } = useFormValidation(loginSchema, form)
@@ -50,15 +50,13 @@ async function handleLogin() {
5050
if (!validate())
5151
return
5252
53-
const body: Record<string, string | number> = {
54-
username: form.username,
55-
password: form.password,
56-
strategy: form.strategy,
57-
}
58-
5953
await useNuxtApp().$leporid('/api/nuxt/auth/login', {
6054
method: 'POST',
61-
body,
55+
body: {
56+
username: form.username,
57+
password: form.password,
58+
strategy: form.strategy,
59+
},
6260
showSuccessToast: true,
6361
successMessage: '登录成功!',
6462
})
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* 图片可见性枚举
33
*/
44
export enum ImageVisibility {
5-
DELETED = 'DELETED',
6-
PRIVATE = 'PRIVATE',
7-
PUBLIC = 'PUBLIC',
5+
DELETED = -1,
6+
PRIVATE = 0,
7+
PUBLIC = 1,
88
}
99

1010
/**
@@ -44,8 +44,8 @@ export interface ImageAspect {
4444
id: string
4545
name: string
4646
description?: string
47-
ratioWidthUnit: number
48-
ratioHeightUnit: number
47+
ratio_width_unit: number
48+
ratio_height_unit: number
4949
}
5050

5151
/**

0 commit comments

Comments
 (0)