fix: 被访者答题组件开发

This commit is contained in:
wanganmao
2022-10-12 14:49:04 +08:00
parent bb8399fdba
commit 5f02838ea6
4 changed files with 199 additions and 44 deletions

View File

@@ -2,10 +2,12 @@ NODE_ENV = 'development'
VUE_APP_CURRENTMODE = 'dev'
VUE_APP_BASEOSS = 'https://diaoyan-files.automark.cc'
VUE_APP_BASEURL = 'http://planetg-java.test.automark.cc/'
#VUE_APP_BASEURL = 'http://planetg-java.test.automark.cc/'
VUE_APP_BASEURL = 'http://ylst-api-uat.dctest.digitalyili.com/'
VUE_APP_DELiVERY_BASEURL='https://javaxq.test.automark.cc/'
VUE_APP_MESSAGE_CENTER ='http://gtech-gateway.dcin-test.digitalyili.com/apigtech/message-send-center/';
VUE_APP_SOCKETURL = 'wss://planetg-java.test.automark.cc/survey_sync'
#VUE_APP_SOCKETURL = 'wss://planetg-java.test.automark.cc/survey_sync'
VUE_APP_SOCKETURL = 'wss://ylst-api-uat.dctest.digitalyili.com/survey_sync'
VUE_APP_JSONPURL = 'https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken'

View File

@@ -275,6 +275,8 @@
v-model:answer="question.answer"
:hideOptions="question.hideOptions"
@changeAnswer="onRelation($event, question)"
@previous="previous"
@next="next"
/>
<!-- 热区题-喜欢 -->
<q-heat-like
@@ -285,6 +287,8 @@
v-model:answer="question.answer"
:hideOptions="question.hideOptions"
@changeAnswer="onRelation($event, question)"
@previous="previous"
@next="next"
/>
<!-- 高级题型-PSM -->
<QPSM

View File

@@ -1,46 +1,8 @@
<template>
<!-- 邮箱手机号身份证号 -->
<a-input
v-if="[5, 6, 7].includes(config.text_type)"
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
:addonBefore="config.left_prompt"
@change="changeValue"
:disabled="disabled"
/>
<!-- 整数小数 -->
<a-input
v-else-if="config.text_type === 1 || config.text_type === 2"
type="number"
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
:addonBefore="config.left_prompt"
:step="config.text_type === 1 ? 1 : 1 / Math.pow(10, config.decimal_few || 0)"
@change="changeValue"
@blur="imposeNum"
:disabled="disabled"
/>
<!-- 其他 -->
<div v-else>
<!-- 多行 -->
<a-textarea
v-if="config.line_type"
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
:addonBefore="config.left_prompt"
@change="changeValue"
:disabled="disabled"
:auto-size="{
minRows: config.line_height,
maxRows: config.line_height,
}"
/>
<!-- 单行 -->
<AnswerViewer :config="config" @next="$emit('next')" @previous="$emit('previous')">
<!-- 邮箱手机号身份证号 -->
<a-input
v-else
v-if="[5, 6, 7].includes(config.text_type)"
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
@@ -48,14 +10,58 @@
@change="changeValue"
:disabled="disabled"
/>
</div>
<!-- 整数小数 -->
<a-input
v-else-if="config.text_type === 1 || config.text_type === 2"
type="number"
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
:addonBefore="config.left_prompt"
:step="config.text_type === 1 ? 1 : 1 / Math.pow(10, config.decimal_few || 0)"
@change="changeValue"
@blur="imposeNum"
:disabled="disabled"
/>
<!-- 其他 -->
<div v-else>
<!-- 多行 -->
<a-textarea
v-if="config.line_type"
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
:addonBefore="config.left_prompt"
@change="changeValue"
:disabled="disabled"
:auto-size="{
minRows: config.line_height,
maxRows: config.line_height,
}"
/>
<!-- 单行 -->
<a-input
v-else
:value="value"
:placeholder="config.placeholder"
:addonAfter="config.right_prompt"
:addonBefore="config.left_prompt"
@change="changeValue"
:disabled="disabled"
/>
</div>
</AnswerViewer>
</template>
<script>
import { defineComponent, ref } from "vue";
import { message } from "ant-design-vue";
import AnswerViewer from "./components/AnswerViewer";
export default defineComponent({
components: {
AnswerViewer
},
props: {
// 配置
config: {

View File

@@ -0,0 +1,143 @@
<template>
<div v-if="config.is_three_dimensions" class="answerviewer">
<SceneSurveyViewer v-if="shopData"
:shopData="shopData"
:page="page"
@onLoadingCompletion="onLoadingCompletion"/>
<div class="page pageNext" @click="next">
<i class="iconfont">&#xe680;</i>
</div>
<div class="page pagePre" @click="previous">
<i class="iconfont">&#xe67f;</i>
</div>
<div class="q-content">
<slot></slot>
</div>
</div>
<div v-else>
<slot></slot>
</div>
</template>
<script>
import { defineComponent } from "vue";
import SceneSurveyViewer from "@/views/planetDesign/Design/components/config/Viewer3D/SceneSurveyViewer";
import { buildShopDataDemo } from "@/views/planetDesign/Design/components/config/config3d.utils";
export default defineComponent({
components: {
SceneSurveyViewer
},
props: {
// 配置
config: {
type: Object,
default: () => {},
},
},
computed: {
scenes() {
return this.config.scene_information.scenes;
},
scene() {
return this.scenes.find(
(x) => x.planetid == this.config.scene_information.scene
);
},
shelves() {
if (!this.scene) return [];
return this.scene.shelves;
},
shelf() {
return this.shelves.find(
(x) => x.planetid == this.config.scene_information.shelf
);
},
wares() {
if (!this.scene) return [];
return this.scene.wares;
},
ware() {
return this.wares.find(
(x) => x.planetid == this.config.scene_information.ware
);
},
},
data(){
return {
shopData: null,
page: null
};
},
mounted() {
this.$emit("update:answer", {});
this.shopData = buildShopDataDemo(this.scene);
},
methods: {
next(){
this.$emit("next");
},
previous(){
this.$emit("previous");
},
onLoadingCompletion(){
if(this.config.scene_information.arrangeType == "col"){
this.page = {
cells: this.shelf.cells.map((cell, index) => {
return {
...cell,
...this.wares[index % this.wares.length]
}
})
};
}
},
}
});
</script>
<style lang="scss" scoped>
.answerviewer {
top: 0;
left: 0;
width: 100vw;
height: 100vh;
position: fixed;
background-color: #fff;
z-index: 99;
.page{
cursor: pointer;
width: 92px;
height: 92px;
line-height: 92px;
text-align: center;
border-radius: 46px;
background: rgba(0,0,0,0.5);
opacity: 1;
color: #fff;
.iconfont{
font-size: 40px;
}
}
.pageNext{
position: absolute;
right: 72px;
top: 50%;
transform: translate(0, -50%);
}
.pagePre{
position: absolute;
left: 72px;
top: 50%;
transform: translate(0, -50%);
}
.q-content{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: inline-block;
z-index: 999;
}
}
</style>