fix: 预览逻辑bug

This commit is contained in:
steven
2022-11-08 15:30:52 +08:00
parent f2814211d7
commit f075cdab97
5 changed files with 65 additions and 17 deletions

View File

@@ -222,12 +222,15 @@ const toPage = (path, title) => {
document.title = title; document.title = title;
}; };
const toPreview = () => { const toPreview = async () => {
router.push({ var res = await canPlanetPublish(route.query.sn);
path: "/preview", if (res) {
query: route.query, router.push({
}); path: "/preview",
document.title = name; query: route.query,
});
document.title = name;
}
}; };
const openPublishModal = async () => { const openPublishModal = async () => {
@@ -238,7 +241,7 @@ const openPublishModal = async () => {
visible.value = true; visible.value = true;
return; return;
} }
// //console.log(); // //console.log();
// // return; // // return;
// let isFb = true; // let isFb = true;

View File

@@ -70,13 +70,24 @@
</div> </div>
<!-- 预览-pc --> <!-- 预览-pc -->
<a-spin v-show="current === 'pc'" :spinning="loading"> <a-spin v-show="current === 'pc'" :spinning="loading">
<questions-pc /> <div v-if="questionsData.action?.code === 20013" class="action">
<img src="@/assets/img/answer/actions/suspend.png" />
<div class="msg">感谢您的反馈期待您下次参与</div>
</div>
<questions-pc v-else />
</a-spin> </a-spin>
<!-- 预览-mob --> <!-- 预览-mob -->
<!-- 手机模拟器 --> <!-- 手机模拟器 -->
<phone v-show="current === 'mobile'" :title="title"> <phone v-show="current === 'mobile'" :title="title">
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<questions-mob /> <div
v-if="questionsData.action?.code === 20013"
class="action"
>
<img src="@/assets/img/answer/actions/suspend.png" />
<div class="msg">感谢您的反馈期待您下次参与</div>
</div>
<questions-mob v-else />
</a-spin> </a-spin>
</phone> </phone>
<!-- 展开 --> <!-- 展开 -->
@@ -538,6 +549,27 @@ export default defineComponent({
} }
} }
.action {
padding-top: 99px;
text-align: center;
background-size: 224px 118px;
background-repeat: no-repeat;
background-position: calc(100% - 10px) 24px;
background-image: url("../../../assets/img/answer/pc-bg.png");
img {
width: 200px;
height: 150px;
margin-bottom: 12px;
}
.msg {
font-size: 16px;
color: #70b936;
line-height: 24px;
}
}
.container { .container {
height: 100%; height: 100%;
} }

View File

@@ -1,5 +1,4 @@
import getlogicStatus from "./logical"; import getlogicStatus from "./logical";
const questions = {}
// 更新code // 更新code
function updateCode(action, skipQuestionIndex) { function updateCode(action, skipQuestionIndex) {
@@ -103,5 +102,14 @@ export default function answerMock(questionsData, page) {
data.action.code = 20011; data.action.code = 20011;
data.action.msg = "成功结束页"; data.action.msg = "成功结束页";
} }
// 拒绝知情同意书
const refuseIndex = questionsData.questions.findIndex(
(question) => question.question_type === 23 && question.answer.value === "2"
);
if (refuseIndex !== -1) {
data.action.code = 20013;
data.action.msg = "不同意继续参与,已结束作答";
}
// 返回数据
return data; return data;
} }

View File

@@ -12,7 +12,12 @@
<a-button v-if="!config.is_hide" key="back" :loading="loading" @click="refuse">{{ <a-button v-if="!config.is_hide" key="back" :loading="loading" @click="refuse">{{
config.disagree_button_text config.disagree_button_text
}}</a-button> }}</a-button>
<a-button key="submit" type="primary" :loading="loading" :disabled="time" @click="agree" <a-button
key="submit"
type="primary"
:loading="loading"
:disabled="time ? true : false"
@click="agree"
>{{ config.agree_button_text }}<span v-if="time" class="time">({{ time }}s)</span></a-button >{{ config.agree_button_text }}<span v-if="time" class="time">({{ time }}s)</span></a-button
> >
</template> </template>

View File

@@ -320,12 +320,12 @@ export default defineComponent({
// 下一页 // 下一页
function next() { function next() {
// 作答模式下不进行选择判断 // 作答模式下不进行选择判断
if (!props.isAnswer) { // if (!props.isAnswer) {
if (page.value === pages.value) { // if (page.value === pages.value) {
return context.emit("next"); // return context.emit("next");
} // }
return (page.value += 1); // return (page.value += 1);
} // }
// 当前页答案 // 当前页答案
const currentOptions = allOptions.value[page.value - 1]; const currentOptions = allOptions.value[page.value - 1];
if (currentOptions.findIndex((option) => option.value === "b") === -1) { if (currentOptions.findIndex((option) => option.value === "b") === -1) {