fix[创建问卷]: 问卷底部按钮无法选中的问题
- 添加 activeActionButton 来计算按钮是否处于激活状态
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { showConfirmDialog } from 'vant';
|
||||
import { getQuestionList, getCheckSurvey } from '@/api/survey';
|
||||
import { getQuestionList } from '@/api/survey';
|
||||
import { QUESTION_TYPE } from '@/layouts/config3d.constant.js';
|
||||
import { loopingAvailable } from '@/layouts/logic.js';
|
||||
import { getDomText } from '@/utils/utils';
|
||||
import utils from '@/assets/js/common';
|
||||
// /**
|
||||
// * 统一的弹窗
|
||||
// * @param options
|
||||
@@ -36,8 +35,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题目未完成设置,请设置价格区间后投放';
|
||||
@@ -68,8 +67,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题目未完成设置,请生成设计后投放';
|
||||
@@ -114,8 +113,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) {
|
||||
@@ -145,15 +144,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) => {
|
||||
@@ -209,8 +208,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)) {
|
||||
@@ -305,8 +304,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}"`
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -385,11 +384,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
|
||||
);
|
||||
})
|
||||
) {
|
||||
@@ -431,6 +430,7 @@ export const canPlanetPublish = async function(sn, publishType) {
|
||||
if (!canPublishRandom(data?.data, parsedPublishType)) return false;
|
||||
if (!isLoopingLogicValid(data?.data, parsedPublishType)) return false;
|
||||
|
||||
/* eslint-disable */
|
||||
// if (parsedPublishType === 2) {
|
||||
// const qrcodeRes = await getCheckSurvey(sn);
|
||||
// if (qrcodeRes?.data?.data?.show_test_button) {
|
||||
@@ -478,6 +478,6 @@ export const canPlanetPublish = async function(sn, publishType) {
|
||||
// if (!res) return;
|
||||
// }
|
||||
// }
|
||||
|
||||
/* eslint-enable */
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -109,12 +109,36 @@
|
||||
<!-- <span>投放设置</span>-->
|
||||
<!-- </div>-->
|
||||
<div class="survey-action_btn">
|
||||
<van-button size="small" plain type="primary" @click="saveAs">保存</van-button>
|
||||
<van-button size="small" plain type="primary" @click="previewQuestion">预览</van-button>
|
||||
<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>
|
||||
<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>
|
||||
@@ -355,6 +379,9 @@ const activeId = ref(0);
|
||||
const showSetting = ref(false);
|
||||
const timePickerModel = ref(false);
|
||||
|
||||
const activeActionButton = computed<boolean>(() => {
|
||||
return questionInfo.value.questions.length === 0;
|
||||
});
|
||||
const openSettingAction = () => {
|
||||
showSetting.value = true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user