fix:文件上传数量校验
This commit is contained in:
@@ -96,7 +96,7 @@
|
||||
<!-- </van-field>-->
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, defineEmits, onMounted, ref } from 'vue';
|
||||
import { computed, defineEmits, onMounted, ref, watch } from 'vue';
|
||||
// import YLCascader from '@/components/YLCascader.vue';
|
||||
|
||||
import { getFileType } from './Api/Index.js';
|
||||
@@ -178,6 +178,83 @@ const getFileTypeList = () => {
|
||||
onMounted(() => {
|
||||
getFileTypeList();
|
||||
});
|
||||
watch(
|
||||
() => actionQuestion.value.config.min_number,
|
||||
(minVal) => {
|
||||
console.log(minVal);
|
||||
minVal = Number(minVal);
|
||||
console.log(typeof minVal);
|
||||
let max_number = Number(actionQuestion.value.config.max_number);
|
||||
if (minVal > 1000) {
|
||||
actionQuestion.value.config.max_number = 9999;
|
||||
actionQuestion.value.config.min_number = 9999;
|
||||
} else {
|
||||
if (minVal > max_number || minVal === max_number) {
|
||||
actionQuestion.value.config.max_number = minVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => actionQuestion.value.config.max_number,
|
||||
(maxVal) => {
|
||||
maxVal = Number(maxVal);
|
||||
let min_number = Number(actionQuestion.value.config.min_number);
|
||||
if (maxVal > 1000) {
|
||||
actionQuestion.value.config.max_number = 9999;
|
||||
actionQuestion.value.config.min_number = 9999;
|
||||
} else {
|
||||
if (maxVal < min_number || maxVal === min_number) {
|
||||
actionQuestion.value.config.min_number = maxVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => actionQuestion.value.config.min_size,
|
||||
(minVal) => {
|
||||
console.log(minVal);
|
||||
minVal = Number(minVal);
|
||||
console.log(typeof minVal);
|
||||
let max_number = Number(actionQuestion.value.config.max_size);
|
||||
if (minVal > 1024) {
|
||||
actionQuestion.value.config.max_size = 1024;
|
||||
actionQuestion.value.config.min_size = 1024;
|
||||
} else {
|
||||
if (minVal > max_number || minVal === max_number) {
|
||||
actionQuestion.value.config.max_size = minVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => actionQuestion.value.config.max_size,
|
||||
(maxVal) => {
|
||||
maxVal = Number(maxVal);
|
||||
let min_number = Number(actionQuestion.value.config.min_size);
|
||||
if (maxVal > 1024) {
|
||||
actionQuestion.value.config.max_size = 1024;
|
||||
actionQuestion.value.config.min_size = 1024;
|
||||
} else {
|
||||
if (maxVal < min_number || maxVal === min_number) {
|
||||
actionQuestion.value.config.min_size = maxVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.action-field {
|
||||
|
||||
@@ -145,6 +145,8 @@ function emitInfo() {
|
||||
function intervalChange(value) {
|
||||
console.log(value);
|
||||
// localConfig.value.score_interval = value === 0 ? 1 : value;
|
||||
|
||||
localConfig.value = JSON.parse(JSON.stringify(localConfig.value));
|
||||
setDefaultMax();
|
||||
emitInfo();
|
||||
}
|
||||
@@ -155,6 +157,7 @@ function intervalChange(value) {
|
||||
*/
|
||||
const minChange = (value) => {
|
||||
localConfig.value.min = value ? value : 1;
|
||||
localConfig.value = JSON.parse(JSON.stringify(localConfig.value));
|
||||
setDefaultMax();
|
||||
emitInfo();
|
||||
};
|
||||
@@ -164,6 +167,7 @@ const minChange = (value) => {
|
||||
* @param value {number} 当数值改变之后的值
|
||||
*/
|
||||
function maxChange(value) {
|
||||
localConfig.value = JSON.parse(JSON.stringify(localConfig.value));
|
||||
// 如果当前变化的值小于最低分,取消赋值
|
||||
if (value < localConfig.value.min) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user