feat:试销验证部分功能
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
<template>
|
||||
<ConfigBaseItem class="config-content-type">
|
||||
<ConfigBaseItem
|
||||
class="config-content-type"
|
||||
:class="{ 'config-content-type-disable': disable }"
|
||||
>
|
||||
<span class="flex-none">内容限制</span>
|
||||
<a-select
|
||||
v-model:value="selected"
|
||||
:get-popup-container="(current) => current.parentNode"
|
||||
:disabled="disable"
|
||||
class="custom-select"
|
||||
style="width: 128px"
|
||||
>
|
||||
@@ -39,6 +43,7 @@ export default defineComponent({
|
||||
props: {
|
||||
value: { type: [Number, String], default: 0 },
|
||||
nameQues: { type: Boolean, default: false },
|
||||
disable: { type: [Boolean, Number], default: false },
|
||||
},
|
||||
emits: ["update:value"],
|
||||
setup(props, context) {
|
||||
@@ -69,6 +74,11 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.config-content-type {
|
||||
&-disable {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
}
|
||||
.flex-none {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,34 @@
|
||||
<template>
|
||||
<ConfigBaseItem class="config-require">
|
||||
<ConfigBaseItem
|
||||
class="config-require"
|
||||
:class="{ 'config-require-disable': disable }"
|
||||
>
|
||||
<span>{{ title }}</span>
|
||||
<a-switch
|
||||
v-bind="$attrs"
|
||||
v-model:checked="isChecked"
|
||||
:disabled="disable"
|
||||
class="custom-switch"
|
||||
/>
|
||||
</ConfigBaseItem>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, watch } from 'vue';
|
||||
import { defineComponent, ref, watch } from "vue";
|
||||
|
||||
import ConfigBaseItem from './ConfigBaseItem.vue';
|
||||
import ConfigBaseItem from "./ConfigBaseItem.vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConfigRequire',
|
||||
name: "ConfigRequire",
|
||||
components: {
|
||||
ConfigBaseItem
|
||||
ConfigBaseItem,
|
||||
},
|
||||
props: {
|
||||
checked: { type: [Boolean, Number], default: true },
|
||||
title: { type: [String], default: () => '此题必答' }
|
||||
title: { type: [String], default: () => "此题必答" },
|
||||
disable: { type: [Boolean, Number], default: false },
|
||||
},
|
||||
emits: ['update:checked'],
|
||||
emits: ["update:checked"],
|
||||
setup(props, context) {
|
||||
const isChecked = ref(true);
|
||||
|
||||
@@ -41,16 +46,25 @@ export default defineComponent({
|
||||
if (!cur === !prev) {
|
||||
return;
|
||||
}
|
||||
context.emit('update:checked', cur ? 1 : 0);
|
||||
context.emit("update:checked", cur ? 1 : 0);
|
||||
});
|
||||
const titles = ref(props.title);
|
||||
return {
|
||||
isChecked,
|
||||
titles
|
||||
titles,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.config-require {
|
||||
&-disable {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
&::v-deep .ant-switch-disabled {
|
||||
background-color: #d5ebc3;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
:disabled="copyInfo.question_type == 23"
|
||||
></question-tinymce>
|
||||
<div class="card-icon">
|
||||
<div class="card-icon-item">
|
||||
<div class="card-icon-item" v-if="!disableMoveBtn">
|
||||
<a-tooltip title="移动" :mouseEnterDelay="1" placement="top">
|
||||
<i class="iconfont moverQues defaultIcon"></i>
|
||||
</a-tooltip>
|
||||
@@ -67,7 +67,7 @@
|
||||
<i class="iconfont defaultIcon" @click="openModal"></i>
|
||||
</a-tooltip>
|
||||
</div> -->
|
||||
<div class="card-icon-item">
|
||||
<div class="card-icon-item" v-if="!disableCopyBtn">
|
||||
<a-tooltip title="复制" :mouseEnterDelay="1" placement="top">
|
||||
<i class="iconfont defaultIcon" @click.stop="copyHandle(copyInfo)"
|
||||
></i
|
||||
@@ -89,7 +89,7 @@
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
<div class="card-icon-item">
|
||||
<div class="card-icon-item" v-if="!disableDelBtn">
|
||||
<a-tooltip title="删除" :mouseEnterDelay="1" placement="top">
|
||||
<i class="iconfont defaultIcon" @click.stop="deleteHandle"
|
||||
></i
|
||||
@@ -277,6 +277,15 @@ export default {
|
||||
return ![104, 105].includes(props.info.question_type);
|
||||
});
|
||||
|
||||
const disableMoveBtn = computed(() => {
|
||||
return copyInfo.value.permissions?.disable_update || false;
|
||||
});
|
||||
const disableCopyBtn = computed(() => {
|
||||
return copyInfo.value.permissions?.disable_copy || false;
|
||||
});
|
||||
const disableDelBtn = computed(() => {
|
||||
return copyInfo.value.permissions?.disable_delete || false;
|
||||
});
|
||||
const store = useStore();
|
||||
const stemEdit = ref(false);
|
||||
const inputRef = ref(null);
|
||||
@@ -408,6 +417,9 @@ export default {
|
||||
showQues,
|
||||
open3DIcon,
|
||||
inputRef,
|
||||
disableMoveBtn,
|
||||
disableCopyBtn,
|
||||
disableDelBtn,
|
||||
|
||||
quesBankVisible,
|
||||
checkGroupInfo,
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<template>
|
||||
<ConfigTitle :quiz-index="copyConfig.title" :title="title" />
|
||||
<div class="choice-config">
|
||||
<div class="choice-config-inline">
|
||||
<div
|
||||
class="choice-config-inline"
|
||||
:class="{ 'choice-config-inline-disable': disableUpdateBtn }"
|
||||
>
|
||||
<span class="choice-config-label">此题必答</span>
|
||||
<a-switch
|
||||
v-model:checked="copyConfig.config.is_required"
|
||||
:checkedValue="1"
|
||||
:unCheckedValue="0"
|
||||
:disabled="disableUpdateBtn"
|
||||
@change="switchChange"
|
||||
/>
|
||||
</div>
|
||||
@@ -31,6 +35,9 @@ export default {
|
||||
const copyConfig = computed(() => {
|
||||
return reactive(JSON.parse(JSON.stringify(props.config)));
|
||||
});
|
||||
const disableUpdateBtn = computed(() => {
|
||||
return props.config.permissions?.disable_update || false;
|
||||
});
|
||||
const title = computed(() => {
|
||||
const type = copyConfig.value?.config.quick_type || 0;
|
||||
const str =
|
||||
@@ -42,6 +49,7 @@ export default {
|
||||
};
|
||||
return {
|
||||
copyConfig,
|
||||
disableUpdateBtn,
|
||||
title,
|
||||
switchChange,
|
||||
};
|
||||
@@ -62,6 +70,13 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
&-disable {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
&::v-deep .ant-switch-disabled {
|
||||
background-color: #d5ebc3;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
&-label {
|
||||
font-weight: bold;
|
||||
|
||||
@@ -139,6 +139,7 @@
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<a-button
|
||||
v-if="!disableUpdateBtn"
|
||||
type="text"
|
||||
class="custom-button"
|
||||
@click="addOptionHandle(optionList.length - 1)"
|
||||
@@ -148,10 +149,13 @@
|
||||
<span style="margin-left: 6px">添加选项</span>
|
||||
</div>
|
||||
</a-button>
|
||||
<related-option :info="info" />
|
||||
<option-show :info="info" />
|
||||
<related-option v-if="!disableUpdateBtn" :info="info" />
|
||||
<option-show v-if="!disableUpdateBtn" :info="info" />
|
||||
<logical :info="info" />
|
||||
<BatchManageOptions :info="info"></BatchManageOptions>
|
||||
<BatchManageOptions
|
||||
v-if="!disableUpdateBtn"
|
||||
:info="info"
|
||||
></BatchManageOptions>
|
||||
</template>
|
||||
</QuesBaseItem>
|
||||
</template>
|
||||
@@ -207,6 +211,9 @@ export default {
|
||||
}
|
||||
return info;
|
||||
});
|
||||
const disableUpdateBtn = computed(() => {
|
||||
return props.info.permissions?.disable_update || false;
|
||||
});
|
||||
const optionList = ref([]);
|
||||
const checkGroups = ref([]);
|
||||
/** 修改选项 */
|
||||
@@ -356,6 +363,7 @@ export default {
|
||||
);
|
||||
return {
|
||||
copyInfo,
|
||||
disableUpdateBtn,
|
||||
optionList,
|
||||
checkGroups,
|
||||
editChange,
|
||||
|
||||
@@ -13,7 +13,10 @@
|
||||
:checked="copyConfig.config.select_random"
|
||||
@update:checked="update('select_random', $event)"
|
||||
/>
|
||||
<ConfigBaseItem v-if="copyConfig.config.is_show.includes('question_type')" class="block">
|
||||
<ConfigBaseItem
|
||||
v-if="copyConfig.config.is_show.includes('question_type')"
|
||||
class="block"
|
||||
>
|
||||
<div class="title">选择题型</div>
|
||||
<div class="row">
|
||||
<a-radio-group
|
||||
@@ -36,7 +39,10 @@
|
||||
@update:min="update('min_select', $event)"
|
||||
@update:max="update('max_select', $event)"
|
||||
/>
|
||||
<ConfigBaseItem v-if="copyConfig.config.is_show.includes('each_number')" class="block">
|
||||
<ConfigBaseItem
|
||||
v-if="copyConfig.config.is_show.includes('each_number')"
|
||||
class="block"
|
||||
>
|
||||
<div class="row">
|
||||
<span class="choice-config-label">每行列数</span>
|
||||
<a-tooltip title="最大为3列">
|
||||
@@ -56,25 +62,39 @@
|
||||
<template v-else>
|
||||
<ConfigRequire
|
||||
:checked="copyConfig.config.is_required"
|
||||
:disable="disableUpdateBtn"
|
||||
@update:checked="update('is_required', $event)"
|
||||
/>
|
||||
<ConfigRequire
|
||||
title="选项随机"
|
||||
:checked="copyConfig.config.select_random"
|
||||
:disable="disableUpdateBtn"
|
||||
@update:checked="update('select_random', $event)"
|
||||
/>
|
||||
<ConfigBaseItem class="block">
|
||||
<div class="title">选择题型</div>
|
||||
<div class="title" :class="{ 'disable-btn': disableUpdateBtn }">
|
||||
选择题型
|
||||
</div>
|
||||
<div class="row">
|
||||
<a-radio-group
|
||||
v-model:value="copyConfig.question_type"
|
||||
name="radioGroup"
|
||||
:disabled="disableUpdateBtn"
|
||||
@change="radioChange"
|
||||
>
|
||||
<a-radio style="margin-right: 32px" class="custom-radio" :value="1"
|
||||
>单选题</a-radio
|
||||
>
|
||||
<a-radio class="custom-radio" :value="2">多选题</a-radio>
|
||||
<a-radio
|
||||
style="margin-right: 32px"
|
||||
class="custom-radio"
|
||||
:class="{ 'disable-btn': disableUpdateBtn }"
|
||||
:value="1"
|
||||
>单选题
|
||||
</a-radio>
|
||||
<a-radio
|
||||
class="custom-radio"
|
||||
:class="{ 'disable-btn': disableUpdateBtn }"
|
||||
:value="2"
|
||||
>多选题
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
</ConfigBaseItem>
|
||||
@@ -113,8 +133,8 @@ import ConfigRequire from "../../components/config/ConfigRequire.vue";
|
||||
import ConfigBaseItem from "../../components/config/ConfigBaseItem.vue";
|
||||
import { useStore } from "vuex";
|
||||
import { newQuesConfig } from "../../mode/index";
|
||||
import ConfigOptionCount from '../../components/config/ConfigOptionCount.vue';
|
||||
import { quickQuesTypeList } from '../../../../../utils/common.js';
|
||||
import ConfigOptionCount from "../../components/config/ConfigOptionCount.vue";
|
||||
import { quickQuesTypeList } from "../../../../../utils/common.js";
|
||||
export default {
|
||||
name: "ChoiceConfig",
|
||||
components: { ConfigTitle, ConfigRequire, ConfigBaseItem, ConfigOptionCount },
|
||||
@@ -130,6 +150,9 @@ export default {
|
||||
const copyConfig = computed(() => {
|
||||
return reactive(JSON.parse(JSON.stringify(props.config)));
|
||||
});
|
||||
const disableUpdateBtn = computed(() => {
|
||||
return props.config.permissions?.disable_update || false;
|
||||
});
|
||||
const title = computed(() => {
|
||||
const type = store.state?.common?.activeQuestion?.config.quick_type || 0;
|
||||
const str =
|
||||
@@ -177,6 +200,7 @@ export default {
|
||||
};
|
||||
return {
|
||||
copyConfig,
|
||||
disableUpdateBtn,
|
||||
title,
|
||||
radioChange,
|
||||
update,
|
||||
@@ -196,4 +220,7 @@ export default {
|
||||
margin-left: 16px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.disable-btn {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<ConfigRequire
|
||||
v-if="is_show.includes('is_required')"
|
||||
:checked="is_required"
|
||||
:disable="disableUpdateBtn"
|
||||
@update:checked="update('is_required', $event)"
|
||||
/>
|
||||
<ConfigContentType
|
||||
@@ -25,8 +26,20 @@
|
||||
:type="text_type"
|
||||
:text="[1, 2].includes(text_type) ? '数值限制' : '字数限制'"
|
||||
:hide-suffix="[1, 2].includes(text_type)"
|
||||
:minParseType="[2].includes(text_type) ? 'float' : ([1].includes(text_type) ? 'int' : 'uint')"
|
||||
:maxParseType="[2].includes(text_type) ? 'float' : ([1].includes(text_type) ? 'int' : 'uint')"
|
||||
:minParseType="
|
||||
[2].includes(text_type)
|
||||
? 'float'
|
||||
: [1].includes(text_type)
|
||||
? 'int'
|
||||
: 'uint'
|
||||
"
|
||||
:maxParseType="
|
||||
[2].includes(text_type)
|
||||
? 'float'
|
||||
: [1].includes(text_type)
|
||||
? 'int'
|
||||
: 'uint'
|
||||
"
|
||||
@update:blurMin="update('min', $event)"
|
||||
@update:blurMax="update('max', $event)"
|
||||
/>
|
||||
@@ -41,7 +54,7 @@
|
||||
:max="4"
|
||||
class="custom-input-number"
|
||||
style="width: 98px"
|
||||
:parser="val => Math.floor(val)"
|
||||
:parser="(val) => Math.floor(val)"
|
||||
@blur="update('decimal_few', decimal_few)"
|
||||
/>
|
||||
</ConfigBaseItem>
|
||||
@@ -81,8 +94,20 @@
|
||||
:type="text_type"
|
||||
:text="[1, 2].includes(text_type) ? '数值限制' : '字数限制'"
|
||||
:hide-suffix="[1, 2].includes(text_type)"
|
||||
:minParseType="[2].includes(text_type) ? 'float' : ([1].includes(text_type) ? 'int' : 'uint')"
|
||||
:maxParseType="[2].includes(text_type) ? 'float' : ([1].includes(text_type) ? 'int' : 'uint')"
|
||||
:minParseType="
|
||||
[2].includes(text_type)
|
||||
? 'float'
|
||||
: [1].includes(text_type)
|
||||
? 'int'
|
||||
: 'uint'
|
||||
"
|
||||
:maxParseType="
|
||||
[2].includes(text_type)
|
||||
? 'float'
|
||||
: [1].includes(text_type)
|
||||
? 'int'
|
||||
: 'uint'
|
||||
"
|
||||
@update:blurMin="update('min', $event)"
|
||||
@update:blurMax="update('max', $event)"
|
||||
/>
|
||||
@@ -94,7 +119,7 @@
|
||||
:max="4"
|
||||
class="custom-input-number"
|
||||
style="width: 98px"
|
||||
:parser="val => Math.floor(val)"
|
||||
:parser="(val) => Math.floor(val)"
|
||||
@blur="update('decimal_few', decimal_few)"
|
||||
/>
|
||||
</ConfigBaseItem>
|
||||
@@ -214,7 +239,9 @@ export default defineComponent({
|
||||
const is_show = computed(() => {
|
||||
return store.state?.common?.activeQuestion?.config?.is_show || [];
|
||||
});
|
||||
|
||||
const disableUpdateBtn = computed(() => {
|
||||
return props.config.permissions?.disable_update || false;
|
||||
});
|
||||
const decimal_few = ref(0);
|
||||
const line_type = ref(0);
|
||||
const line_height = ref(1);
|
||||
@@ -264,6 +291,7 @@ export default defineComponent({
|
||||
update,
|
||||
inputNumberBlur,
|
||||
is_show,
|
||||
disableUpdateBtn,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user