fix[创建问卷]: 问卷底部按钮无法选中的问题
- 添加 activeActionButton 来计算按钮是否处于激活状态
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import { showConfirmDialog } from 'vant';
|
import { showConfirmDialog } from 'vant';
|
||||||
import { getQuestionList, getCheckSurvey } from '@/api/survey';
|
import { getQuestionList } from '@/api/survey';
|
||||||
import { QUESTION_TYPE } from '@/layouts/config3d.constant.js';
|
import { QUESTION_TYPE } from '@/layouts/config3d.constant.js';
|
||||||
import { loopingAvailable } from '@/layouts/logic.js';
|
import { loopingAvailable } from '@/layouts/logic.js';
|
||||||
import { getDomText } from '@/utils/utils';
|
import { getDomText } from '@/utils/utils';
|
||||||
import utils from '@/assets/js/common';
|
|
||||||
// /**
|
// /**
|
||||||
// * 统一的弹窗
|
// * 统一的弹窗
|
||||||
// * @param options
|
// * @param options
|
||||||
@@ -36,8 +35,8 @@ const canPlanetPublishPSM = function(data) {
|
|||||||
let message = '';
|
let message = '';
|
||||||
let title = '题目设置未完成';
|
let title = '题目设置未完成';
|
||||||
const incompleteQuestionList = [];
|
const incompleteQuestionList = [];
|
||||||
data.questions
|
data.questions &&
|
||||||
&& data.questions.forEach((s) => {
|
data.questions.forEach((s) => {
|
||||||
if (s.question_type === 101 && s.config.price_gradient.length <= 0) {
|
if (s.question_type === 101 && s.config.price_gradient.length <= 0) {
|
||||||
isFb = false;
|
isFb = false;
|
||||||
message = 'psm题目未完成设置,请设置价格区间后投放';
|
message = 'psm题目未完成设置,请设置价格区间后投放';
|
||||||
@@ -68,8 +67,8 @@ const canPlanetPublishMxdAndHotArea = function(data) {
|
|||||||
const incompleteQuestionList = [];
|
const incompleteQuestionList = [];
|
||||||
let type = 0;
|
let type = 0;
|
||||||
let title = '题目设置未完成';
|
let title = '题目设置未完成';
|
||||||
data.questions
|
data.questions &&
|
||||||
&& data.questions.forEach((s) => {
|
data.questions.forEach((s) => {
|
||||||
if (s.question_type === 105 && s.config.design_version <= 0) {
|
if (s.question_type === 105 && s.config.design_version <= 0) {
|
||||||
isFb = false;
|
isFb = false;
|
||||||
message = 'maxdiff题目未完成设置,请生成设计后投放';
|
message = 'maxdiff题目未完成设置,请生成设计后投放';
|
||||||
@@ -114,8 +113,8 @@ const canPlanetPublish3D = function(data) {
|
|||||||
let message = '';
|
let message = '';
|
||||||
const qSteams = [];
|
const qSteams = [];
|
||||||
let title = '';
|
let title = '';
|
||||||
data.questions
|
data.questions &&
|
||||||
&& data.questions.forEach((s) => {
|
data.questions.forEach((s) => {
|
||||||
if (QUESTION_TYPE.contains(s.question_type)) {
|
if (QUESTION_TYPE.contains(s.question_type)) {
|
||||||
try {
|
try {
|
||||||
if (s.config.is_three_dimensions && !s.config.scene) {
|
if (s.config.is_three_dimensions && !s.config.scene) {
|
||||||
@@ -145,15 +144,15 @@ const canPlanetPublish3D = function(data) {
|
|||||||
let message = '';
|
let message = '';
|
||||||
const qSteams = [];
|
const qSteams = [];
|
||||||
let title = '';
|
let title = '';
|
||||||
data.questions
|
data.questions &&
|
||||||
&& data.questions.forEach((s) => {
|
data.questions.forEach((s) => {
|
||||||
if (QUESTION_TYPE.contains(s.question_type)) {
|
if (QUESTION_TYPE.contains(s.question_type)) {
|
||||||
try {
|
try {
|
||||||
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
|
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
|
||||||
const wares = [];
|
const wares = [];
|
||||||
const _sceneInformation = s.config.scene_information;
|
const _sceneInformation = s.config.scene_information;
|
||||||
const sceneInformation
|
const sceneInformation =
|
||||||
= typeof _sceneInformation === 'string'
|
typeof _sceneInformation === 'string'
|
||||||
? JSON.parse(_sceneInformation)
|
? JSON.parse(_sceneInformation)
|
||||||
: _sceneInformation;
|
: _sceneInformation;
|
||||||
sceneInformation.shelves.forEach((shelf) => {
|
sceneInformation.shelves.forEach((shelf) => {
|
||||||
@@ -209,8 +208,8 @@ const canPlanetPublishImage = function(data) {
|
|||||||
let message = '';
|
let message = '';
|
||||||
const qSteams = [];
|
const qSteams = [];
|
||||||
let title = '';
|
let title = '';
|
||||||
data.questions
|
data.questions &&
|
||||||
&& data.questions.forEach((s) => {
|
data.questions.forEach((s) => {
|
||||||
if (s.question_type === 13) {
|
if (s.question_type === 13) {
|
||||||
try {
|
try {
|
||||||
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
|
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
|
||||||
@@ -305,8 +304,8 @@ function canPublishRandom(data, publishType) {
|
|||||||
if (!isValidated) {
|
if (!isValidated) {
|
||||||
errors.push({
|
errors.push({
|
||||||
message:
|
message:
|
||||||
field.message
|
field.message ||
|
||||||
|| `请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"`
|
`请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -385,11 +384,11 @@ function isLoopingLogicValid(data, publishType) {
|
|||||||
if (
|
if (
|
||||||
(data?.cycle_pages || []).every((i) => {
|
(data?.cycle_pages || []).every((i) => {
|
||||||
return (
|
return (
|
||||||
i.question_index
|
i.question_index &&
|
||||||
&& i.relation_type !== undefined
|
i.relation_type !== undefined &&
|
||||||
&& i.relation_type !== null
|
i.relation_type !== null &&
|
||||||
&& i.first_page
|
i.first_page &&
|
||||||
&& i.last_page
|
i.last_page
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
@@ -431,6 +430,7 @@ export const canPlanetPublish = async function(sn, publishType) {
|
|||||||
if (!canPublishRandom(data?.data, parsedPublishType)) return false;
|
if (!canPublishRandom(data?.data, parsedPublishType)) return false;
|
||||||
if (!isLoopingLogicValid(data?.data, parsedPublishType)) return false;
|
if (!isLoopingLogicValid(data?.data, parsedPublishType)) return false;
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
// if (parsedPublishType === 2) {
|
// if (parsedPublishType === 2) {
|
||||||
// const qrcodeRes = await getCheckSurvey(sn);
|
// const qrcodeRes = await getCheckSurvey(sn);
|
||||||
// if (qrcodeRes?.data?.data?.show_test_button) {
|
// if (qrcodeRes?.data?.data?.show_test_button) {
|
||||||
@@ -478,6 +478,6 @@ export const canPlanetPublish = async function(sn, publishType) {
|
|||||||
// if (!res) return;
|
// if (!res) return;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
/* eslint-enable */
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -109,12 +109,36 @@
|
|||||||
<!-- <span>投放设置</span>-->
|
<!-- <span>投放设置</span>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<div class="survey-action_btn">
|
<div class="survey-action_btn">
|
||||||
<van-button size="small" plain type="primary" @click="saveAs">保存</van-button>
|
<van-button
|
||||||
<van-button size="small" plain type="primary" @click="previewQuestion">预览</van-button>
|
:key="1"
|
||||||
|
size="small"
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
:disabled="activeActionButton"
|
||||||
|
@click="saveAs"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</van-button>
|
||||||
|
<van-button
|
||||||
|
size="small"
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
:disabled="activeActionButton"
|
||||||
|
@click="previewQuestion"
|
||||||
|
>
|
||||||
|
预览
|
||||||
|
</van-button>
|
||||||
<van-button size="small" plain type="success" @click="openSettingAction">
|
<van-button size="small" plain type="success" @click="openSettingAction">
|
||||||
投放设置
|
投放设置
|
||||||
</van-button>
|
</van-button>
|
||||||
<van-button size="small" icon="guide-o" @click="publishQuestion">立即投放</van-button>
|
<van-button
|
||||||
|
size="small"
|
||||||
|
icon="guide-o"
|
||||||
|
:disabled="activeActionButton"
|
||||||
|
@click="publishQuestion"
|
||||||
|
>
|
||||||
|
立即投放
|
||||||
|
</van-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -355,6 +379,9 @@ const activeId = ref(0);
|
|||||||
const showSetting = ref(false);
|
const showSetting = ref(false);
|
||||||
const timePickerModel = ref(false);
|
const timePickerModel = ref(false);
|
||||||
|
|
||||||
|
const activeActionButton = computed<boolean>(() => {
|
||||||
|
return questionInfo.value.questions.length === 0;
|
||||||
|
});
|
||||||
const openSettingAction = () => {
|
const openSettingAction = () => {
|
||||||
showSetting.value = true;
|
showSetting.value = true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user