Skip to content

Commit

Permalink
fix: 修复暗黑模式下的checkbox展示问题 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximu-Luya authored Mar 16, 2024
2 parents 5778f91 + 2e54873 commit 8056748
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 64 deletions.
57 changes: 30 additions & 27 deletions components/BuyReportForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ const { form, onSubmit } = useReportForm({
name: props.product.name,
targetCity: props.city.name
});
const changePricePercent = (type: 'add' | 'reduce') => {
const percent = form.values.percent?.[0] ?? 100;
if (type === 'add') {
form.setFieldValue('percent', [percent + 1]);
} else {
form.setFieldValue('percent', [percent - 1]);
}
}
</script>

<template>
Expand All @@ -51,25 +60,21 @@ const { form, onSubmit } = useReportForm({
</FormItem>
</FormField>

<!-- <FormField v-slot="{ componentField }" name="percent">
<FormItem>
<FormLabel>价位</FormLabel>
<FormControl>
<Input
type="number"
:placeholder="form.values.targetCity !== city.name ? '售出价位' : '买入价位'"
v-bind="componentField"
/>
</FormControl>
<FormDescription></FormDescription>
<FormMessage />
</FormItem>
</FormField> -->
<FormField v-slot="{ componentField }" name="percent">
<FormItem>
<FormLabel>价位</FormLabel>
<FormControl>
<Slider v-bind="componentField" :default-value="[100]" :max="199" :min="1" :step="1" />
<div class="flex items-center space-x-2">
<span class="i-icon-park-outline-reduce-one text-xl cursor-pointer" @click="changePricePercent('reduce')"></span>
<Slider
v-bind="componentField"
:default-value="[100]"
:max="130"
:min="70"
:step="1"
/>
<span class="i-icon-park-outline-add-one text-xl cursor-pointer" @click="changePricePercent('add')"></span>
</div>
<FormDescription class="flex justify-between">
<span
>{{ form.values.targetCity !== city.name ? '售出价位' : '买入价位' }}
Expand All @@ -83,27 +88,25 @@ const { form, onSubmit } = useReportForm({

<FormField v-slot="{ componentField }" type="radio" name="trend">
<FormItem class="space-y-3">
<FormLabel>趋势</FormLabel>
<FormLabel>涨跌趋势</FormLabel>

<FormControl>
<RadioGroup class="flex flex-col space-y-0" v-bind="componentField">
<FormItem class="flex items-center space-y-0 gap-x-3">
<RadioGroup class="flex space-x-4" v-bind="componentField">
<FormItem class="flex items-center space-y-0">
<FormControl>
<RadioGroupItem value="up" />
<FormLabel class="flex items-center font-normal text-xl text-green pl-2 cursor-pointer">
<span class="i-material-symbols-trending-up text-green"></span>
</FormLabel>
</FormControl>
<FormLabel class="font-normal text-green"></FormLabel>
</FormItem>
<FormItem class="flex items-center space-y-0 gap-x-3">
<FormControl>
<RadioGroupItem value="same" />
</FormControl>
<FormLabel class="font-normal">-</FormLabel>
</FormItem>
<FormItem class="flex items-center space-y-0 gap-x-3">
<FormItem class="flex items-center space-y-0">
<FormControl>
<RadioGroupItem value="down" />
<FormLabel class="flex items-center font-normal text-xl text-red pl-2 cursor-pointer">
<span class="i-material-symbols-trending-down text-red"></span>
</FormLabel>
</FormControl>
<FormLabel class="font-normal text-red"></FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
Expand Down
8 changes: 0 additions & 8 deletions components/City.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ const sortCitesByPercent = (filteredCities: CityInfo[], sourceCityName: string,
<TableHead class="border-r"><div class="w-30">原产地采购价</div></TableHead>
<TableHead :colspan="sellCities.length">城市售卖报价(按利润高低从左到右降序排序)</TableHead>
</template>
<!-- 操作列 -->
<TableHead class="w-[100px]">操作</TableHead>
</TableRow>
</TableHeader>
<TableBody>
Expand Down Expand Up @@ -127,12 +125,6 @@ const sortCitesByPercent = (filteredCities: CityInfo[], sourceCityName: string,
/>
</TableCell>
</template>
<!-- 操作单元格 -->
<TableCell>
<CreateLog :source-city-name="city.name" :product="product">
<Button variant="outline" size="sm">上报</Button>
</CreateLog>
</TableCell>
</TableRow>
</TableBody>
</Table>
Expand Down
2 changes: 1 addition & 1 deletion components/CreateLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const changePricePercent = (type: 'add' | 'reduce') => {
<form class="grid gap-4 py-4" @submit="onSubmit">
<div class="space-x-2 text-sm">
<span class="text-right font-bold">商品</span>
<span class="text-black">
<span class="text-base">
<span class="text-gray-400">{{ sourceCityName }}</span>
购买的
Expand Down
57 changes: 30 additions & 27 deletions components/SellReportForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ const { form, onSubmit } = useReportForm({
name: props.product.name,
targetCity: props.target.name
});
const changePricePercent = (type: 'add' | 'reduce') => {
const percent = form.values.percent?.[0] ?? 100;
if (type === 'add') {
form.setFieldValue('percent', [percent + 1]);
} else {
form.setFieldValue('percent', [percent - 1]);
}
}
</script>

<template>
Expand All @@ -53,25 +62,21 @@ const { form, onSubmit } = useReportForm({
</FormItem>
</FormField>

<!-- <FormField v-slot="{ componentField }" name="percent">
<FormItem>
<FormLabel>价位</FormLabel>
<FormControl>
<Input
type="number"
:placeholder="form.values.targetCity !== city.name ? '售出价位' : '买入价位'"
v-bind="componentField"
/>
</FormControl>
<FormDescription></FormDescription>
<FormMessage />
</FormItem>
</FormField> -->
<FormField v-slot="{ componentField }" name="percent">
<FormItem>
<FormLabel>价位</FormLabel>
<FormControl>
<Slider v-bind="componentField" :default-value="[100]" :max="199" :min="1" :step="1" />
<div class="flex items-center space-x-2">
<span class="i-icon-park-outline-reduce-one text-xl cursor-pointer" @click="changePricePercent('reduce')"></span>
<Slider
v-bind="componentField"
:default-value="[100]"
:max="130"
:min="70"
:step="1"
/>
<span class="i-icon-park-outline-add-one text-xl cursor-pointer" @click="changePricePercent('add')"></span>
</div>
<FormDescription class="flex justify-between">
<span>{{ '售出价位' }} {{ form.values.percent?.[0] ?? 100 }}%</span>
</FormDescription>
Expand All @@ -82,27 +87,25 @@ const { form, onSubmit } = useReportForm({

<FormField v-slot="{ componentField }" type="radio" name="trend">
<FormItem class="space-y-3">
<FormLabel>趋势</FormLabel>
<FormLabel>涨跌趋势</FormLabel>

<FormControl>
<RadioGroup class="flex flex-col space-y-0" v-bind="componentField">
<FormItem class="flex items-center space-y-0 gap-x-3">
<RadioGroup class="flex space-x-4" v-bind="componentField">
<FormItem class="flex items-center space-y-0">
<FormControl>
<RadioGroupItem value="up" />
<FormLabel class="flex items-center font-normal text-xl text-green pl-2 cursor-pointer">
<span class="i-material-symbols-trending-up text-green"></span>
</FormLabel>
</FormControl>
<FormLabel class="font-normal text-green"></FormLabel>
</FormItem>
<FormItem class="flex items-center space-y-0 gap-x-3">
<FormControl>
<RadioGroupItem value="same" />
</FormControl>
<FormLabel class="font-normal">-</FormLabel>
</FormItem>
<FormItem class="flex items-center space-y-0 gap-x-3">
<FormItem class="flex items-center space-y-0">
<FormControl>
<RadioGroupItem value="down" />
<FormLabel class="flex items-center font-normal text-xl text-red pl-2 cursor-pointer">
<span class="i-material-symbols-trending-down text-red"></span>
</FormLabel>
</FormControl>
<FormLabel class="font-normal text-red"></FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
Expand Down
2 changes: 1 addition & 1 deletion components/ui/radio-group/RadioGroupItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ const forwardedProps = useForwardProps(delegatedProps);
)
"
>
<RadioGroupIndicator class="flex items-center justify-center w-full h-full relative after:content-[''] after:block after:w-2 after:h-2 after:rounded-[50%] after:bg-black" />
<RadioGroupIndicator class="flex items-center justify-center w-full h-full relative after:content-[''] after:block after:w-2 after:h-2 after:rounded-[50%] after:bg-black dark:after:bg-white" />
</RadioGroupItem>
</template>

0 comments on commit 8056748

Please sign in to comment.