update:问卷UI修改
This commit is contained in:
1
components.d.ts
vendored
1
components.d.ts
vendored
@@ -32,6 +32,7 @@ declare module 'vue' {
|
||||
VanGrid: typeof import('vant/es')['Grid']
|
||||
VanGridItem: typeof import('vant/es')['GridItem']
|
||||
VanIcon: typeof import('vant/es')['Icon']
|
||||
VanList: typeof import('vant/es')['List']
|
||||
VanNavBar: typeof import('vant/es')['NavBar']
|
||||
VanPicker: typeof import('vant/es')['Picker']
|
||||
VanPopup: typeof import('vant/es')['Popup']
|
||||
|
||||
@@ -85,9 +85,9 @@ export default class CommonApi {
|
||||
};
|
||||
/* eslint-disable no-useless-escape */
|
||||
const reg = /\\|\/|\?|\?|\*|"|“|”|'|‘|’|<|>|{|}|\[|\]|\【|\】|:|:|、|\^|\$|!|~|`|\s|\+/g;
|
||||
name
|
||||
= name
|
||||
|| getRandomFileName(file?.name?.replace(reg, '') ?? '' ?? `${new Date().getTime()}.png`);
|
||||
name =
|
||||
name ||
|
||||
getRandomFileName(file?.name?.replace(reg, '') ?? '' ?? `${new Date().getTime()}.png`);
|
||||
const res = await CommonApi.getOssInfo();
|
||||
/* eslint-enable no-useless-escape */
|
||||
|
||||
|
||||
@@ -65,3 +65,11 @@ export function deleteTemplate(sn) {
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
// 保存为模板
|
||||
export function saveTemplates(sn, data) {
|
||||
return request({
|
||||
url: `/console/surveys/${sn}/templates`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
@@ -224,3 +224,8 @@
|
||||
color: $theme-color;
|
||||
}
|
||||
}
|
||||
.el-dropdown-menu__item:not(.is-disabled):focus,
|
||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
||||
background-color: #fff !important;
|
||||
color: #2dc26b !important;
|
||||
}
|
||||
|
||||
BIN
src/assets/img/publish/edit.png
Normal file
BIN
src/assets/img/publish/edit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/img/publish/end.png
Normal file
BIN
src/assets/img/publish/end.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
BIN
src/assets/img/publish/publish.png
Normal file
BIN
src/assets/img/publish/publish.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
@@ -170,8 +170,8 @@ const getMaxDateLimit = computed(() => {
|
||||
props.format
|
||||
);
|
||||
const tempStr = '0000-12-31 23:59:59';
|
||||
const result
|
||||
= props.maxDate.length !== 0 && thisMax.length > props.maxDate.length
|
||||
const result =
|
||||
props.maxDate.length !== 0 && thisMax.length > props.maxDate.length
|
||||
? thisMax.slice(0, props.maxDate.length) + tempStr.slice(props.maxDate.length)
|
||||
: thisMax;
|
||||
return result.slice(0, props.format.length);
|
||||
@@ -194,8 +194,8 @@ function onChange({ selectedValues, columnIndex }) {
|
||||
renderMinuteColumns,
|
||||
renderSecondColumns
|
||||
];
|
||||
updateColumns[columnIndex]
|
||||
&& updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false);
|
||||
updateColumns[columnIndex] &&
|
||||
updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false);
|
||||
}
|
||||
|
||||
// 渲染全部列
|
||||
|
||||
@@ -376,39 +376,39 @@ export function isCross(range1, range2) {
|
||||
const isSibling = isLeft || isRight;
|
||||
|
||||
// 逻辑包含循环
|
||||
const contain
|
||||
= (isPlainSequence
|
||||
&& (((isNullish(start2) || isSequence(judge, start2, start1))
|
||||
&& (isNullish(end2) || isSequence(judge, end2, start1)))
|
||||
|| ((isNullish(start2) || isSequence(start1, start2, end1))
|
||||
&& (isNullish(end2) || isSequence(start1, end2, end1)))))
|
||||
|| (!isPlainSequence
|
||||
&& (judge < start1
|
||||
? ((isNullish(start2) || isSequence(judge, start2, start1))
|
||||
&& (isNullish(end2) || isSequence(judge, end2, start1)))
|
||||
|| ((isNullish(start2) || isSequence(start1, start2, end1))
|
||||
&& (isNullish(end2) || isSequence(start1, end2, end1)))
|
||||
: ((isNullish(start2) || isSequence(start1, start2, judge))
|
||||
&& (isNullish(end2) || isSequence(start1, end2, judge)))
|
||||
|| ((isNullish(start2) || isSequence(judge, start2, end1))
|
||||
&& (isNullish(end2) || isSequence(judge, end2, end1)))));
|
||||
const contain =
|
||||
(isPlainSequence &&
|
||||
(((isNullish(start2) || isSequence(judge, start2, start1)) &&
|
||||
(isNullish(end2) || isSequence(judge, end2, start1))) ||
|
||||
((isNullish(start2) || isSequence(start1, start2, end1)) &&
|
||||
(isNullish(end2) || isSequence(start1, end2, end1))))) ||
|
||||
(!isPlainSequence &&
|
||||
(judge < start1
|
||||
? ((isNullish(start2) || isSequence(judge, start2, start1)) &&
|
||||
(isNullish(end2) || isSequence(judge, end2, start1))) ||
|
||||
((isNullish(start2) || isSequence(start1, start2, end1)) &&
|
||||
(isNullish(end2) || isSequence(start1, end2, end1)))
|
||||
: ((isNullish(start2) || isSequence(start1, start2, judge)) &&
|
||||
(isNullish(end2) || isSequence(start1, end2, judge))) ||
|
||||
((isNullish(start2) || isSequence(judge, start2, end1)) &&
|
||||
(isNullish(end2) || isSequence(judge, end2, end1)))));
|
||||
// 循环存在封闭区间,并且循环包含逻辑
|
||||
const contained
|
||||
= !isNullish(start2)
|
||||
&& !isNullish(end2)
|
||||
const contained =
|
||||
!isNullish(start2) &&
|
||||
!isNullish(end2) &&
|
||||
// [judge, start1, end1];
|
||||
&& ((isPlainSequence && start2 <= judge && end1 <= end2)
|
||||
((isPlainSequence && start2 <= judge && end1 <= end2) ||
|
||||
// [judge, start1, end1];
|
||||
// [start1, judge, end1];
|
||||
|| (!isPlainSequence && start2 <= start1 && start2 <= judge && end1 <= end2));
|
||||
(!isPlainSequence && start2 <= start1 && start2 <= judge && end1 <= end2));
|
||||
// 循环不存在封闭区间
|
||||
const unCircled
|
||||
= (!isNullish(start2)
|
||||
&& isNullish(end2)
|
||||
&& ((isPlainSequence && start2 === judge) || (!isPlainSequence && judge < start1)
|
||||
const unCircled =
|
||||
(!isNullish(start2) &&
|
||||
isNullish(end2) &&
|
||||
((isPlainSequence && start2 === judge) || (!isPlainSequence && judge < start1)
|
||||
? start2 === judge
|
||||
: start2 === start1))
|
||||
|| (isNullish(start2) && !isNullish(end2) && end2 === end1);
|
||||
: start2 === start1)) ||
|
||||
(isNullish(start2) && !isNullish(end2) && end2 === end1);
|
||||
|
||||
return !(isSibling || contain || contained || unCircled);
|
||||
}
|
||||
@@ -428,8 +428,8 @@ function isSequence(s1, s2, s3, equal) {
|
||||
* @param store
|
||||
*/
|
||||
export function updateNewQuestionsByLoopingEffect(quesSaveParam, store) {
|
||||
const { questionInfoBeforeModified = {}, questionInfo = {} }
|
||||
= JSON.parse(JSON.stringify(store.state.common)) || {};
|
||||
const { questionInfoBeforeModified = {}, questionInfo = {} } =
|
||||
JSON.parse(JSON.stringify(store.state.common)) || {};
|
||||
|
||||
const oldPages = questionInfoBeforeModified.survey.pages;
|
||||
const newQuestions = questionInfo.questions;
|
||||
|
||||
@@ -48,8 +48,8 @@ const canPlanetPublishPSM = function(data) {
|
||||
let message = '';
|
||||
let title = '题目设置未完成';
|
||||
const incompleteQuestionList = [];
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
if (s.question_type === 101 && s.config.price_gradient.length <= 0) {
|
||||
isFb = false;
|
||||
message = 'psm题目未完成设置,请设置价格区间后投放';
|
||||
@@ -80,8 +80,8 @@ const canPlanetPublishMxdAndHotArea = function(data) {
|
||||
const incompleteQuestionList = [];
|
||||
let type = 0;
|
||||
let title = '题目设置未完成';
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
if (s.question_type === 105 && s.config.design_version <= 0) {
|
||||
isFb = false;
|
||||
message = 'maxdiff题目未完成设置,请生成设计后投放';
|
||||
@@ -126,8 +126,8 @@ const canPlanetPublish3D = function(data) {
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
let title = '';
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
if (QUESTION_TYPE.contains(s.question_type)) {
|
||||
try {
|
||||
if (s.config.is_three_dimensions && !s.config.scene) {
|
||||
@@ -157,15 +157,15 @@ const canPlanetPublish3D = function(data) {
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
let title = '';
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
if (QUESTION_TYPE.contains(s.question_type)) {
|
||||
try {
|
||||
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
|
||||
const wares = [];
|
||||
const _sceneInformation = s.config.scene_information;
|
||||
const sceneInformation
|
||||
= typeof _sceneInformation === 'string'
|
||||
const sceneInformation =
|
||||
typeof _sceneInformation === 'string'
|
||||
? JSON.parse(_sceneInformation)
|
||||
: _sceneInformation;
|
||||
sceneInformation.shelves.forEach((shelf) => {
|
||||
@@ -221,8 +221,8 @@ const canPlanetPublishImage = function(data) {
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
let title = '';
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
if (s.question_type === 13) {
|
||||
try {
|
||||
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
|
||||
@@ -317,8 +317,8 @@ function canPublishRandom(data, publishType) {
|
||||
if (!isValidated) {
|
||||
errors.push({
|
||||
message:
|
||||
field.message
|
||||
|| `请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"`
|
||||
field.message ||
|
||||
`请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"`
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -397,11 +397,11 @@ function isLoopingLogicValid(data, publishType) {
|
||||
if (
|
||||
(data?.cycle_pages || []).every((i) => {
|
||||
return (
|
||||
i.question_index
|
||||
&& i.relation_type !== undefined
|
||||
&& i.relation_type !== null
|
||||
&& i.first_page
|
||||
&& i.last_page
|
||||
i.question_index &&
|
||||
i.relation_type !== undefined &&
|
||||
i.relation_type !== null &&
|
||||
i.first_page &&
|
||||
i.last_page
|
||||
);
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export const surveyQuestion
|
||||
= 'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions';
|
||||
export const surveyQuestion =
|
||||
'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions';
|
||||
|
||||
@@ -39,10 +39,10 @@ service.interceptors.request.use(
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
if (
|
||||
response.status === 200
|
||||
|| response.status === 201
|
||||
|| response.status === 202
|
||||
|| response.status === 204
|
||||
response.status === 200 ||
|
||||
response.status === 201 ||
|
||||
response.status === 202 ||
|
||||
response.status === 204
|
||||
) {
|
||||
if (response.config.method === 'put') {
|
||||
// message.success('保存中...');
|
||||
|
||||
@@ -45,10 +45,10 @@ service.interceptors.request.use(
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
if (
|
||||
response.status === 200
|
||||
|| response.status === 201
|
||||
|| response.status === 202
|
||||
|| response.status === 204
|
||||
response.status === 200 ||
|
||||
response.status === 201 ||
|
||||
response.status === 202 ||
|
||||
response.status === 204
|
||||
) {
|
||||
if (response.config.method === 'put') {
|
||||
// message.success('保存中...');
|
||||
|
||||
@@ -108,9 +108,9 @@ function isSurplus() {
|
||||
return false;
|
||||
} else {
|
||||
return (
|
||||
parseFloat(((localConfig.value.max - localConfig.value.min) * 1000).toFixed(4, 10))
|
||||
% parseFloat((localConfig.value.score_interval * 1000).toFixed(4, 10))
|
||||
=== 0
|
||||
parseFloat(((localConfig.value.max - localConfig.value.min) * 1000).toFixed(4, 10)) %
|
||||
parseFloat((localConfig.value.score_interval * 1000).toFixed(4, 10)) ===
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
class="iconfont active-icon"
|
||||
:style="{ marginRight: isLastPage ? '0' : '16px' }"
|
||||
@click="activePage"
|
||||
></i>
|
||||
></i
|
||||
>
|
||||
<template v-if="!isLastPage">
|
||||
<i class="iconfont moverQues" style="margin-right: 16px"></i>
|
||||
<i class="iconfont" @click="deleteHandle"></i>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
<div v-for="item in 10" :key="item" class="template">
|
||||
<img src="https://picsum.photos/131/128" width="110" height="100" alt="" />
|
||||
<span>报名/签到模板</span>
|
||||
<span style="color: rgb(127, 127, 127)">报名签到 | 引用 {{ item }} 次 | 创建人: {{ '张三' }}</span>
|
||||
<span style="color: rgb(127, 127, 127)"
|
||||
>报名签到 | 引用 {{ item }} 次 | 创建人: {{ '张三' }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -36,7 +36,14 @@
|
||||
</el-space>
|
||||
</div>
|
||||
<div class="survey_item_status">
|
||||
<span class="survey_item_info_status_text">-{{ item.status_txt }}-</span>
|
||||
<img v-if="item.status === 0" src="../../assets/img/publish/edit.png" alt="" />
|
||||
<img
|
||||
v-else-if="item.status === 1"
|
||||
src="../../assets/img/publish/publish.png"
|
||||
alt=""
|
||||
/>
|
||||
<img v-else-if="item.status === 2" src="../../assets/img/publish/end.png" alt="" />
|
||||
<!-- <span class="survey_item_info_status_text">-{{ item.status_txt }}-</span>-->
|
||||
</div>
|
||||
</div>
|
||||
<!--问卷描述-->
|
||||
@@ -59,12 +66,16 @@
|
||||
<el-text style="color: white">开启投放</el-text>
|
||||
</el-button>
|
||||
</div>
|
||||
<el-dropdown placement="top-end" trigger="click" style="">
|
||||
<el-dropdown placement="top-end" trigger="click" active-color="#ee0a24">
|
||||
<Io5EllipsisHorizontalSharp />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>编辑</el-dropdown-item>
|
||||
<el-dropdown-item>存为模板</el-dropdown-item>
|
||||
<el-dropdown-menu
|
||||
active-color="#ee0a24"
|
||||
:close-on-click-overlay="false"
|
||||
:close-on-click-outside="false"
|
||||
>
|
||||
<el-dropdown-item @click="editItem(item)">编辑</el-dropdown-item>
|
||||
<el-dropdown-item @click="saveTemplate(item)">存为模板</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -77,9 +88,9 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { getSurveysPage, copySurveys, deleteSurveys } from '@/api/home/index.js';
|
||||
import { getSurveysPage, copySurveys, deleteSurveys, saveTemplates } from '@/api/home/index.js';
|
||||
import { Io5EllipsisHorizontalSharp } from 'vue-icons-plus/io5';
|
||||
import { showDialog, showFailToast, showSuccessToast, showToast } from 'vant';
|
||||
import { showDialog, showConfirmDialog, showFailToast, showSuccessToast, showToast } from 'vant';
|
||||
import { useRouter } from 'vue-router';
|
||||
const router = useRouter();
|
||||
const survey = ref([]);
|
||||
@@ -191,6 +202,34 @@ const toPublish = (item) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
const editItem = (item) => {
|
||||
router.push({
|
||||
path: '/create',
|
||||
query: {
|
||||
sn: item.sn
|
||||
}
|
||||
});
|
||||
};
|
||||
// 保存为模板
|
||||
const saveTemplate = async (item) => {
|
||||
const data = JSON.parse(JSON.stringify(item));
|
||||
const res = await saveTemplates(item.sn, data);
|
||||
if (res.data.code === 200 || res.data.code === 201) {
|
||||
showConfirmDialog({
|
||||
message: '模板保存成功,请前往模板市场查看!',
|
||||
showCancelButton: false
|
||||
})
|
||||
.then(() => {
|
||||
form.value.page = 1;
|
||||
fetchSurveys();
|
||||
})
|
||||
.catch(() => {
|
||||
// on cancel
|
||||
});
|
||||
} else {
|
||||
showFailToast(res.data);
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
// fetchSurveys();
|
||||
});
|
||||
@@ -199,6 +238,10 @@ onMounted(() => {
|
||||
<style scoped lang="scss">
|
||||
@import '@/assets/css/base';
|
||||
@import '@/assets/css/main';
|
||||
.el-dropdown-menu__item:not(.is-disabled):focus,
|
||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
.new-survey-container {
|
||||
min-height: calc(100vh - 100px);
|
||||
@@ -219,8 +262,8 @@ onMounted(() => {
|
||||
|
||||
.survey_item_status {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10px;
|
||||
top: -40px;
|
||||
right: -24px;
|
||||
padding: 28px 13px 19px 7px;
|
||||
background: url('https://lanhu-oss-2537-2.lanhuapp.com/SketchPngbb370d01215f9cedc28d567c637c011047f83a99fbb5e7ac348ebd0ef0015f32')
|
||||
100% no-repeat;
|
||||
|
||||
@@ -227,8 +227,8 @@ export default defineComponent({
|
||||
.map((option) => {
|
||||
return this.wares.find(
|
||||
(ware) =>
|
||||
ware.question_index === option.question_index
|
||||
&& ware.option_index === option.option_index
|
||||
ware.question_index === option.question_index &&
|
||||
ware.option_index === option.option_index
|
||||
);
|
||||
});
|
||||
wares = wares.filter((x) => x);
|
||||
|
||||
@@ -106,11 +106,11 @@ export default defineComponent({
|
||||
const isEndUrl = computed(() => {
|
||||
const code = props.action ? props.action.code : props.code;
|
||||
return (
|
||||
(code === 20004
|
||||
&& props.survey.screening_end_url_select
|
||||
&& props.survey.screening_end_url)
|
||||
|| (code === 20011 && props.survey.success_end_url_select && props.survey.success_end_url)
|
||||
|| (code === 20016 && props.survey.quota_end_url_select && props.survey.quota_end_url)
|
||||
(code === 20004 &&
|
||||
props.survey.screening_end_url_select &&
|
||||
props.survey.screening_end_url) ||
|
||||
(code === 20011 && props.survey.success_end_url_select && props.survey.success_end_url) ||
|
||||
(code === 20016 && props.survey.quota_end_url_select && props.survey.quota_end_url)
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -267,16 +267,16 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
if (
|
||||
!compareArrayByField(options.value, newOptions, 'option_key')
|
||||
|| !compareArrayByField(options.value, newOptions, 'option')
|
||||
!compareArrayByField(options.value, newOptions, 'option_key') ||
|
||||
!compareArrayByField(options.value, newOptions, 'option')
|
||||
) {
|
||||
options.value = newOptions;
|
||||
}
|
||||
|
||||
// 清空值和答案
|
||||
if (
|
||||
value.value
|
||||
&& options.value.findIndex((option) => option.option_key === value.value) === -1
|
||||
value.value &&
|
||||
options.value.findIndex((option) => option.option_key === value.value) === -1
|
||||
) {
|
||||
// 清空值
|
||||
value.value = '';
|
||||
@@ -294,8 +294,8 @@ export default defineComponent({
|
||||
() => options.value,
|
||||
(val, oldVal) => {
|
||||
if (
|
||||
compareArrayByField(val, oldVal || [], 'option_key')
|
||||
&& compareArrayByField(val, oldVal || [], 'option')
|
||||
compareArrayByField(val, oldVal || [], 'option_key') &&
|
||||
compareArrayByField(val, oldVal || [], 'option')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ export default defineComponent({
|
||||
// 替换文本
|
||||
let replacement = '';
|
||||
// 查找引用问题
|
||||
const question
|
||||
= props.questions.find((question) => {
|
||||
const question =
|
||||
props.questions.find((question) => {
|
||||
// 矩阵题
|
||||
if (question.question_type >= 8 && question.question_type <= 11) {
|
||||
return question.title === value.split('_R')[0].split('_C')[0];
|
||||
@@ -158,8 +158,8 @@ export default defineComponent({
|
||||
return question.title === value.split('_A')[0];
|
||||
}
|
||||
return question.title === value;
|
||||
})
|
||||
|| props.questions.find((question) => {
|
||||
}) ||
|
||||
props.questions.find((question) => {
|
||||
// 矩阵题
|
||||
if (question.question_type >= 8 && question.question_type <= 11) {
|
||||
return question.title === (value + cycleIndexStr).split('_R')[0].split('_C')[0];
|
||||
@@ -187,8 +187,8 @@ export default defineComponent({
|
||||
replacement = answer[option.option_key];
|
||||
}
|
||||
} else if (
|
||||
question.question_type === 2
|
||||
&& Object.keys(answer).length >= question.config.min_select
|
||||
question.question_type === 2 &&
|
||||
Object.keys(answer).length >= question.config.min_select
|
||||
) {
|
||||
// 查找引用选项(多选)
|
||||
options.forEach((option) => {
|
||||
|
||||
@@ -350,7 +350,7 @@ export const language = {
|
||||
zh: '请点击查看图片'
|
||||
},
|
||||
NoteCantViewAfterTimeLimit: {
|
||||
en: 'Note: Can\'t view after time limit',
|
||||
en: "Note: Can't view after time limit",
|
||||
zh: '注意:超过显示时间限制后将无法再次查看'
|
||||
},
|
||||
DisplayTimeLimitExceeded: {
|
||||
|
||||
@@ -250,10 +250,10 @@ function quesHandle(answer, logChild) {
|
||||
const matrixRateHandle = () => {
|
||||
// 如果配置的逻辑中参数为空,则代表没有配置逻辑匹配值,此时不做校验
|
||||
if (
|
||||
logChild.cell_index === 0
|
||||
|| logChild.row_index === 0
|
||||
|| !logChild.operator
|
||||
|| !logChild.value
|
||||
logChild.cell_index === 0 ||
|
||||
logChild.row_index === 0 ||
|
||||
!logChild.operator ||
|
||||
!logChild.value
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -265,10 +265,10 @@ function quesHandle(answer, logChild) {
|
||||
const matrixInputHandle = () => {
|
||||
// 如果配置的逻辑中参数为空,则代表没有配置逻辑匹配值,此时不做校验
|
||||
if (
|
||||
logChild.cell_index === 0
|
||||
|| logChild.row_index === 0
|
||||
|| !logChild.operator
|
||||
|| !logChild.value
|
||||
logChild.cell_index === 0 ||
|
||||
logChild.row_index === 0 ||
|
||||
!logChild.operator ||
|
||||
!logChild.value
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -519,10 +519,10 @@ function getlogicStatus(questionData) {
|
||||
// } else {
|
||||
// statusStr = statusStr + conditionStatus;
|
||||
// }
|
||||
statusStr
|
||||
= statusStr
|
||||
+ (logChild.logic === 'and' ? '&&' : logChild.logic === 'or' ? '||' : '')
|
||||
+ conditionStatus;
|
||||
statusStr =
|
||||
statusStr +
|
||||
(logChild.logic === 'and' ? '&&' : logChild.logic === 'or' ? '||' : '') +
|
||||
conditionStatus;
|
||||
});
|
||||
// eslint-disable-next-line no-eval
|
||||
logs.logicStatus = eval(statusStr);
|
||||
|
||||
@@ -105,8 +105,8 @@ export default function answerMock(questionsData, page) {
|
||||
} else if (logic.skip_type === 4) {
|
||||
// 只计算跳转后所在页面的隐藏逻辑,否则会出现只返回最后一道隐藏选项题目的情况,导致失效
|
||||
const toPage = page + 1;
|
||||
const hasHiddenLogicQuizPage
|
||||
= data.pages.findIndex((page) => page.includes(logic.question_index)) + 1;
|
||||
const hasHiddenLogicQuizPage =
|
||||
data.pages.findIndex((page) => page.includes(logic.question_index)) + 1;
|
||||
if (hasHiddenLogicQuizPage === toPage) {
|
||||
// 选项隐藏逻辑
|
||||
updateOptionHidden(data.hide_options, logic);
|
||||
|
||||
@@ -155,9 +155,9 @@ export default defineComponent({
|
||||
question.error = translatedText.value.ThisIsARequiredQuestion;
|
||||
}
|
||||
} else if (
|
||||
answer
|
||||
&& questionType === 1
|
||||
&& Object.keys(answer).findIndex((value) => !answer[value]) !== -1
|
||||
answer &&
|
||||
questionType === 1 &&
|
||||
Object.keys(answer).findIndex((value) => !answer[value]) !== -1
|
||||
) {
|
||||
// 单选题
|
||||
isError = true;
|
||||
@@ -303,9 +303,9 @@ export default defineComponent({
|
||||
} else if (answer && questionType === 12) {
|
||||
question.error = '';
|
||||
} else if (
|
||||
answer
|
||||
&& questionType === 14
|
||||
&& Object.keys(answer).length < config.min_select
|
||||
answer &&
|
||||
questionType === 14 &&
|
||||
Object.keys(answer).length < config.min_select
|
||||
) {
|
||||
// 图片多选题
|
||||
isError = true;
|
||||
@@ -343,8 +343,8 @@ export default defineComponent({
|
||||
switch (config.text_type) {
|
||||
// 字母
|
||||
case 3:
|
||||
isError
|
||||
= config.include_mark === 1
|
||||
isError =
|
||||
config.include_mark === 1
|
||||
? !/^[a-zA-Z·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
|
||||
newValue
|
||||
) || !newValue.length
|
||||
@@ -353,8 +353,8 @@ export default defineComponent({
|
||||
break;
|
||||
// 中文
|
||||
case 4:
|
||||
isError
|
||||
= config.include_mark === 1
|
||||
isError =
|
||||
config.include_mark === 1
|
||||
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
|
||||
newValue
|
||||
) || !newValue.length
|
||||
@@ -365,8 +365,8 @@ export default defineComponent({
|
||||
break;
|
||||
// 邮箱
|
||||
case 5:
|
||||
isError
|
||||
= !/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
|
||||
isError =
|
||||
!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
|
||||
value
|
||||
);
|
||||
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
|
||||
@@ -378,8 +378,8 @@ export default defineComponent({
|
||||
break;
|
||||
// 身份证号
|
||||
case 7:
|
||||
isError
|
||||
= !/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
|
||||
isError =
|
||||
!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
|
||||
value
|
||||
);
|
||||
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
|
||||
@@ -447,9 +447,9 @@ export default defineComponent({
|
||||
break;
|
||||
}
|
||||
if (
|
||||
!question.error
|
||||
&& value.length < config.min
|
||||
&& ![1, 2].includes(config.text_type)
|
||||
!question.error &&
|
||||
value.length < config.min &&
|
||||
![1, 2].includes(config.text_type)
|
||||
) {
|
||||
question.error = translatedText.value.PleaseEnterMoreThanOneCharacters(config.min);
|
||||
}
|
||||
@@ -825,8 +825,8 @@ export default defineComponent({
|
||||
const evt1 = {};
|
||||
|
||||
if ([1].includes(question.question_type)) {
|
||||
evt1.value
|
||||
= Object.keys(question.answer)
|
||||
evt1.value =
|
||||
Object.keys(question.answer)
|
||||
.map((key) => (question.answer[key] ? key : undefined))
|
||||
.filter((i) => !!i)?.[0] || undefined;
|
||||
evt1.options = question.list.flatMap((i) => i.options);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const successImg
|
||||
= 'https://files.axshare.com/gsc/DR6075/c7/5a/53/c75a534148d349f1bb8e185629f784ac/images/%E9%A2%84%E8%A7%88/u123.png?pageId=18fb9d8a-b9b7-465f-9bd7-625b1b78f72e';
|
||||
const successImg =
|
||||
'https://files.axshare.com/gsc/DR6075/c7/5a/53/c75a534148d349f1bb8e185629f784ac/images/%E9%A2%84%E8%A7%88/u123.png?pageId=18fb9d8a-b9b7-465f-9bd7-625b1b78f72e';
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user