Skip to content

Commit

Permalink
feat: added checkbox control
Browse files Browse the repository at this point in the history
xixiIBN5100 committed Dec 4, 2024
1 parent 9cc32a5 commit fb9ebd6
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Modal/index.vue
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<span class="text-3xl font-bold">
<slot name="title" ></slot>
</span>
<div class="flex items-center my-20 text-lg">
<div class=" my-20 text-lg flex-warp ">
<slot></slot>
</div>
<div class="modal-action flex justify-end gap-10" :class="[centerBtn ? 'flex justify-center' : undefined]">
20 changes: 14 additions & 6 deletions src/pages/DetailInfo/checkbox.vue
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@
<textarea type="text" placeholder="Describe" class="dark:bg-customGray_more_shallow textarea textarea-bordered shadow-md w-full h-70 " v-model="localDescribe"/>
</div>
<span class="my-10 flex justify-between">
<span>最大多选数<input type="text" class="dark:bg-customGray_more_shallow input shadow-md w-45 h-40 ml-10" v-model="localMax"/></span>
<span>最小多选数<input type="text" class="dark:bg-customGray_more_shallow input shadow-md w-45 h-40 ml-10" v-model="localMin"/></span>
<span>最大多选数<input type="text" class="dark:bg-customGray_more_shallow input shadow-md w-55 h-40 ml-10" v-model.number="localMax"/></span>
<span>最小多选数<input type="text" class="dark:bg-customGray_more_shallow input shadow-md w-55 h-40 ml-10" v-model.number="localMin"/></span>
</span>
</div>
<div class="flex-col justify-center items-center">
@@ -67,8 +67,8 @@ const props = defineProps<{
unique: boolean,
otherOption: boolean,
describe: string,
max: number,
min: number,
maximum_option: number,
minimum_option: number,
options?: {
content: string;
img: string;
@@ -86,8 +86,8 @@ const localUnique = ref<boolean>(props.unique);
const localOtherOption = ref<boolean>(props.otherOption);
const localDescribe = ref<string>(props.describe || '');
const localOptions = ref(props.options );
const localMax = ref(props.max)
const localMin = ref(props.min)
const localMax = ref(props.maximum_option)
const localMin = ref(props.minimum_option)
const handleFileChange = async (event, serial_num: number) => {
@@ -174,6 +174,14 @@ watch(localUnique, (newUnique) => {
watch(localDescribe, (newLocalDescribe) => {
emits('update:describe', newLocalDescribe);
});
watch(localMin, (newMin) => {
emits('update:minimum_option', Number(newMin));
});
watch(localMax, (newMax) => {
emits('update:maximum_option', Number(newMax));
});
watch(localOtherOption, (newOtherOption) => {
emits('update:otherOption', newOtherOption);
4 changes: 2 additions & 2 deletions src/pages/DetailInfo/index.vue
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@
</div>

<div class="flex items-center my-15 gap-40">
<span class="flex items-center gap-15">每日最多提交<input type="text" class="input input-bordered dark:bg-customGray_shallow w-50" /></span><span class="flex items-center gap-20">是否统一登录<input type="checkbox" class="checkbox-sm my-5" /></span>
<span class="flex items-center gap-15">每日最多提交<input type="text" v-model.number="submitData.day_limit" class="input input-bordered dark:bg-customGray_shallow w-50" /></span><span class="flex items-center gap-20">是否统一登录<input type="checkbox" class="checkbox-sm my-5" v-model="submitData.verify" /></span>
</div>
<div class="flex gap-20 items-center my-15">
<span >问卷截止时间</span>
@@ -133,7 +133,7 @@
<skeleton-card></skeleton-card>
</template>
<template #default>
<checkbox v-model:title="q.subject" v-model:options="q.options" v-model:serial_num="q.serial_num" @on-click="deleteQuestion(q.serial_num)" v-model:unique="q.unique" v-model:option-choose="q.required" v-model:other-option="q.other_option" v-model:describe="q.description"></checkbox>
<checkbox v-model:title="q.subject" v-model:options="q.options" v-model:serial_num="q.serial_num" @on-click="deleteQuestion(q.serial_num)" v-model:unique="q.unique" v-model:option-choose="q.required" v-model:other-option="q.other_option" v-model:describe="q.description" v-model:maximum_option="q.maximum_option" v-model:minimum_option="q.minimum_option"></checkbox>
</template>
</el-skeleton>
</div>

0 comments on commit fb9ebd6

Please sign in to comment.