Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions apps/consumer/web/app/components/galgame/rate/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,12 @@
<div class="flex flex-col gap-[22px] px-6 pb-6">
<GalgameRateStatusPills />
<GalgameRateScore />
<FormItem v-slot="{ id, field }" name="time_to_finish_hours" label="玩了多久">
<FormItem v-slot="{ id }" name="time_to_finish_hours" label="玩了多久">
<div class="flex items-center gap-2">
<InputNumber
:input-id="id"
:model-value="field.value"
:min="0"
:max="9999"
:max-fraction-digits="1"
fluid
@update:model-value="value => field.props.onInput({ value })"
/>
<span class="shrink-0 text-[13px] text-surface-500">小时</span>
</div>
Expand All @@ -104,13 +100,11 @@
/>
</FormItem>

<FormItem v-slot="{ id, field }" name="is_spoiler">
<FormItem v-slot="{ id }" name="is_spoiler">
<div class="flex items-center gap-2.5">
<Checkbox
:input-id="id"
:model-value="field.value as boolean"
binary
@update:model-value="value => field.props.onInput({ value })"
/>
<label
:for="id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,11 @@
/>
</FormItem>

<FormItem v-slot="{ id, field }" name="is_spoiler">
<FormItem v-slot="{ id }" name="is_spoiler">
<div class="flex items-center gap-2.5">
<Checkbox
:input-id="id"
:model-value="field.value as boolean"
binary
@update:model-value="value => field.props.onInput({ value })"
/>
<label
:for="id"
Expand Down
10 changes: 2 additions & 8 deletions apps/consumer/web/app/components/light-novel/rate/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,12 @@
<div class="flex flex-col gap-[22px] px-6 pb-6">
<LightNovelRateStatusPills />
<LightNovelRateScore />
<FormItem v-slot="{ id, field }" name="time_to_finish_hours" label="读了多久">
<FormItem v-slot="{ id }" name="time_to_finish_hours" label="读了多久">
<div class="flex items-center gap-2">
<InputNumber
:input-id="id"
:model-value="field.value"
:min="0"
:max="9999"
:max-fraction-digits="1"
fluid
@update:model-value="value => field.props.onInput({ value })"
/>
<span class="shrink-0 text-[13px] text-surface-500">小时</span>
</div>
Expand All @@ -104,13 +100,11 @@
/>
</FormItem>

<FormItem v-slot="{ id, field }" name="is_spoiler">
<FormItem v-slot="{ id }" name="is_spoiler">
<div class="flex items-center gap-2.5">
<Checkbox
:input-id="id"
:model-value="field.value as boolean"
binary
@update:model-value="value => field.props.onInput({ value })"
/>
<label
:for="id"
Expand Down
4 changes: 1 addition & 3 deletions apps/consumer/web/app/components/manga/rate/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@
/>
</FormItem>

<FormItem v-slot="{ id, field }" name="is_spoiler">
<FormItem v-slot="{ id }" name="is_spoiler">
<div class="flex items-center gap-2.5">
<Checkbox
:input-id="id"
:model-value="field.value as boolean"
binary
@update:model-value="value => field.props.onInput({ value })"
/>
<label
:for="id"
Expand Down
44 changes: 37 additions & 7 deletions apps/consumer/web/app/features/galgame/schemas/rate.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ import { valibotResolver } from '@primevue/forms/resolvers/valibot'
import * as v from 'valibot'

const dimension = v.nullish(
v.pipe(
v.number('维度评分应为数字'),
v.integer('维度评分需为整数'),
v.minValue(1, '维度评分需 1-10'),
v.maxValue(10, '维度评分需 1-10'),
),
v.union([
v.pipe(
v.number('维度评分应为数字'),
v.integer('维度评分需为整数'),
v.minValue(1, '维度评分需 1-10'),
v.maxValue(10, '维度评分需 1-10'),
),
v.pipe(
v.string(),
v.trim(),
v.transform(val => (val === '' ? null : Number(val))),
v.check(
val =>
val === null ||
(typeof val === 'number' && !isNaN(val) && Number.isInteger(val) && val >= 1 && val <= 10),
'维度评分需 1-10 整数',
),
),
v.null_(),
]),
null,
)

Expand All @@ -25,7 +39,23 @@ export const galgameRateSchema = v.object({
v.maxLength(2000, '短评不能超过 2000 字'),
),
time_to_finish_hours: v.nullish(
v.pipe(v.number('时长应为数字'), v.minValue(0, '时长不能为负'), v.maxValue(9999, '时长过大')),
v.union([
v.pipe(
v.number('时长应为数字'),
v.minValue(0, '时长不能为负'),
v.maxValue(9999, '时长不能超过 9999 小时'),
),
v.pipe(
v.string(),
v.trim(),
v.transform(val => (val === '' ? null : Number(val))),
v.check(
val => val === null || (typeof val === 'number' && !isNaN(val) && val >= 0 && val <= 9999),
'时长不能为负且需在 9999 小时内',
),
),
v.null_(),
]),
null,
),
is_spoiler: v.optional(v.boolean(), false),
Expand Down
44 changes: 37 additions & 7 deletions apps/consumer/web/app/features/light-novel/schemas/rate.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ import { valibotResolver } from '@primevue/forms/resolvers/valibot'
import * as v from 'valibot'

const dimension = v.nullish(
v.pipe(
v.number('维度评分应为数字'),
v.integer('维度评分需为整数'),
v.minValue(1, '维度评分需 1-10'),
v.maxValue(10, '维度评分需 1-10'),
),
v.union([
v.pipe(
v.number('维度评分应为数字'),
v.integer('维度评分需为整数'),
v.minValue(1, '维度评分需 1-10'),
v.maxValue(10, '维度评分需 1-10'),
),
v.pipe(
v.string(),
v.trim(),
v.transform(val => (val === '' ? null : Number(val))),
v.check(
val =>
val === null ||
(typeof val === 'number' && !isNaN(val) && Number.isInteger(val) && val >= 1 && val <= 10),
'维度评分需 1-10 整数',
),
),
v.null_(),
]),
null,
)

Expand All @@ -25,7 +39,23 @@ export const lightNovelRateSchema = v.object({
v.maxLength(2000, '短评不能超过 2000 字'),
),
time_to_finish_hours: v.nullish(
v.pipe(v.number('时长应为数字'), v.minValue(0, '时长不能为负'), v.maxValue(9999, '时长过大')),
v.union([
v.pipe(
v.number('时长应为数字'),
v.minValue(0, '时长不能为负'),
v.maxValue(9999, '时长不能超过 9999 小时'),
),
v.pipe(
v.string(),
v.trim(),
v.transform(val => (val === '' ? null : Number(val))),
v.check(
val => val === null || (typeof val === 'number' && !isNaN(val) && val >= 0 && val <= 9999),
'时长不能为负且需在 9999 小时内',
),
),
v.null_(),
]),
null,
),
is_spoiler: v.optional(v.boolean(), false),
Expand Down
2 changes: 1 addition & 1 deletion apps/consumer/web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default defineNuxtConfig({

css: [
'@bprogress/core/css',
'./app/assets/css/main.css',
'~/assets/css/main.css',
'notivue/notification.css',
'notivue/animations.css',
],
Expand Down
Loading
Loading