Merge branch 'feature-creative-center' into feature-creative-center-v2

This commit is contained in:
wanganmao
2022-12-06 09:34:12 +08:00
20 changed files with 1166 additions and 101 deletions

View File

@@ -25,7 +25,7 @@ export default {
state.guideOtherNeed = false; state.guideOtherNeed = false;
}, },
[GUIDE_SELECT_NEED](state) { [GUIDE_SELECT_NEED](state) {
state.guideOtherNeed = false; state.guideSelectNeed = false;
}, },
}, },

View File

@@ -46,5 +46,33 @@ class Common {
} }
return sColor; return sColor;
} }
/**
* 获取富文本的文本内容
*/
static rtxGetText(tx) {
return cheerio.load(tx).text().replace(/\s*/g, "").replaceAll("\n", "");
}
/**
* 判断富文本是否相等
*/
static rtxEqual(tx1, tx2){
if(tx1.includes("img") || tx2.includes("img")){
return tx1 == tx2;
}
const $old = this.rtxGetText(tx1);
const $new = this.rtxGetText(tx2);
return $old === $new;
}
/**
* 判断富文本是否为空
*/
static rtxIsEmpty(tx) {
if(tx.includes("img") ) return false;
return this.rtxEqual(tx, '')
}
} }
export default Common export default Common

View File

@@ -34,7 +34,7 @@ export default defineComponent({
}; };
const isMobile = browser.versions.mobile && !browser.versions.iPad; const isMobile = browser.versions.mobile && !browser.versions.iPad;
try { try {
localStorage.setItem("plantIp", returnCitySN["cip"]); localStorage.setItem("plantIp", window.returnCitySN?window.returnCitySN["cip"]:"127.0.0.1");
} catch (error) { } catch (error) {
localStorage.setItem("plantIp", ""); localStorage.setItem("plantIp", "");
} }

View File

@@ -193,9 +193,6 @@
v-model:answer="question.answer" v-model:answer="question.answer"
@changeAnswer="onRelation($event, question)" @changeAnswer="onRelation($event, question)"
isMobile isMobile
:answerSn="questionsData.answer.sn"
:answerSurveySn="questionsData.answer.survey_sn"
:question="question"
/> />
<!-- 矩阵打分题 --> <!-- 矩阵打分题 -->
<matrix-rate <matrix-rate

View File

@@ -21,7 +21,7 @@
<Remark :title="label + '介绍语评论'" :type="2" v-if="!isAnswer" /> <Remark :title="label + '介绍语评论'" :type="2" v-if="!isAnswer" />
</div> </div>
</div> </div>
<SceneSurveyViewer v-if="shopData" :shopData="shopData" :surveyId="surveyId" :hidden="true"/> <SceneSurveyViewer v-if="shopData" :shopData="shopData" :surveyId="surveyId" :hidden="true" @onLoadingCompletion="onLoadingCompletion" :page="page" />
</div> </div>
</template> </template>
@@ -79,6 +79,7 @@ export default defineComponent({
const shopData = ref(null); const shopData = ref(null);
const surveyId = ref(null); const surveyId = ref(null);
const page = ref(null);
watch(() => props.questions, (arr) => { watch(() => props.questions, (arr) => {
@@ -95,7 +96,38 @@ export default defineComponent({
} }
}) })
return { themeColor, shopData, surveyId }; const onLoadingCompletion = () => {
// 3D资源预获取
try{
var target = props.questions.find(question => question?.config?.scene_information);
if(!target) return;
var scene = target.config.scene_information;
if(!scene) return;
var shelf = scene.shelves.find(shelf => shelf.planetid == target.config.shelf);
if(!shelf) return;
var wares = shelf.wares;
page.value = {
cells: shelf.cells.map((cell, index) => {
return {
...cell,
...wares[index % wares.length],
showSign: !!target.config.is_price_tag,
showLogo: false,
};
}),
};
}
catch(e) {
console.warn(e);
}
}
return { themeColor, shopData, surveyId, onLoadingCompletion, page };
}, },
}); });
</script> </script>

View File

@@ -61,8 +61,9 @@ import BrowsingRecordApi from "./api.js";
import { QUESTION_TYPE } from "@/views/planetDesign/Design/components/config/config3d.constant.js"; import { QUESTION_TYPE } from "@/views/planetDesign/Design/components/config/config3d.constant.js";
import SceneGuidance from "./SceneGuidance.vue"; import SceneGuidance from "./SceneGuidance.vue";
import { debounce } from 'lodash-es';
const no3dPages = ["/survey/analyse/data-particulars", "/preview"]; const no3dPages = ["/survey/analyse/data-particulars", "/preview", "/home/market"];
export default defineComponent({ export default defineComponent({
components: { components: {
@@ -81,7 +82,7 @@ export default defineComponent({
// 配置 // 配置
config: { config: {
type: Object, type: Object,
default: () => {}, default: () => ({}),
}, },
// 样本SN // 样本SN
answerSn: { answerSn: {
@@ -114,9 +115,9 @@ export default defineComponent({
surveyId() { surveyId() {
return this.config.scene; return this.config.scene;
}, },
scene() { // scene() {
return this.config.scene_information; // return this.config.scene_information;
}, // },
shelves() { shelves() {
if (!this.scene) return []; if (!this.scene) return [];
return this.scene.shelves; return this.scene.shelves;
@@ -161,38 +162,99 @@ export default defineComponent({
}, },
data() { data() {
return { return {
scene: null,
shopData: null, shopData: null,
page: null, page: null,
sceneAction: null, sceneAction: null,
elCart: null, elCart: null,
hold: null, hold: null,
// 用于控制下一页点击
pager: {
// 判断能否点击
activate: false,
timeoutId: 0,
// 初始化点击延迟
init(time = 4000) {
this.activate = false;
if(this.timeoutId) {
clearTimeout(this.timeoutId);
this.timeoutId = 0
}
this.timeoutId = setTimeout(() => {
this.activate = true;
}, time);
},
// 清空延迟
clear() {
if(this.timeoutId) {
clearTimeout(this.timeoutId);
this.timeoutId = 0
}
}
},
showTimeTimeoutId: 0,
}; };
}, },
mounted() { beforeUnmount() {
this.pager.clear();
if(this.showTimeTimeoutId) clearTimeout(this.showTimeTimeoutId);
},
async mounted() {
if(!this.canUse3D) return;
this.pager.init();
this.scene = this.config.scene_information;
// 解决缓存问题,答卷时加载场景信息
if(!this.scene) {
var res = await BrowsingRecordApi.getSurveysScene({
sn: this.$route.query.sn,
question_index: this.question.question_index
});
this.scene = res.data?.scene_information;
}
this.shopData = buildShopDataDemo(this.scene); this.shopData = buildShopDataDemo(this.scene);
if(this.config.is_show_time && this.config.show_time){ if(this.config.is_show_time && this.config.show_time){
setTimeout(() => this.$emit("next"), this.config.show_time * 1000) this.showTimeTimeoutId = setTimeout(() => {
this.showTimeTimeoutId = 0;
this.$emit("next");
}, this.config.show_time * 1000)
} }
if(this.config.is_three_dimensions) { if(this.config.is_three_dimensions) {
if(this.config.is_binding_goods) { if(this.config.is_binding_goods) {
this.$refs.SceneGuidance.show({ this.$refs.SceneGuidance?.show({
isSelect: true, isSelect: true,
isMobile: this.isMobile isMobile: this.isMobile
}); });
return; return;
} }
this.$refs.SceneGuidance.show({ this.$refs.SceneGuidance?.show({
isSelect: false, isSelect: false,
isMobile: this.isMobile isMobile: this.isMobile
}); });
} }
}, },
methods: { methods: {
next() { next() {
console.log(this.pager.activate);
if(!this.pager.activate) {
return;
}
this.pager.init();
this.$emit("next", () => new Promise((resolve) => { this.$emit("next", () => new Promise((resolve) => {
this.sceneAction = { this.sceneAction = {
action: "hold_to_shelf", action: "hold_to_shelf",
@@ -201,6 +263,12 @@ export default defineComponent({
})); }));
}, },
previous() { previous() {
if(!this.pager.activate) {
return;
}
this.pager.init();
this.sceneAction = { this.sceneAction = {
action: "hold_to_shelf", action: "hold_to_shelf",
}; };

View File

@@ -10,6 +10,7 @@
:freezeRotY="!!config.is_default_perspective" :freezeRotY="!!config.is_default_perspective"
@onLoadingCompletion="onLoadingCompletion" @onLoadingCompletion="onLoadingCompletion"
@onFromSceneHoldToShelf="onFromSceneHoldToShelf" @onFromSceneHoldToShelf="onFromSceneHoldToShelf"
@onPageCompletion="onPageCompletion"
@onBehaviorFlush="onBehaviorFlush" @onBehaviorFlush="onBehaviorFlush"
/> />
<div :class="isMobile?'mobile':'pc'"> <div :class="isMobile?'mobile':'pc'">
@@ -41,8 +42,9 @@ import { message } from "ant-design-vue";
import { matrixInputValidate } from "./questionValidate"; import { matrixInputValidate } from "./questionValidate";
import SceneGuidance from "./SceneGuidance.vue"; import SceneGuidance from "./SceneGuidance.vue";
import { debounce } from 'lodash-es';
const no3dPages = ["/survey/analyse/data-particulars", "/preview"]; const no3dPages = ["/survey/analyse/data-particulars", "/preview", "/home/market"];
export default defineComponent({ export default defineComponent({
components: { components: {
@@ -105,9 +107,9 @@ export default defineComponent({
surveyId() { surveyId() {
return this.config.scene; return this.config.scene;
}, },
scene() { // scene() {
return this.config.scene_information; // return this.config.scene_information;
}, // },
shelves() { shelves() {
if (!this.scene) return []; if (!this.scene) return [];
return this.scene.shelves; return this.scene.shelves;
@@ -133,25 +135,76 @@ export default defineComponent({
}, },
data(){ data(){
return { return {
scene: null,
shopData: null, shopData: null,
page: null, page: null,
rowIndex: 0, rowIndex: 0,
sceneAction: null sceneAction: null,
// 用于控制下一页点击
pager: {
// 判断能否点击
activate: false,
timeoutId: 0,
// 初始化点击延迟
init(time = 4000) {
this.activate = false;
if(this.timeoutId) {
clearTimeout(this.timeoutId);
this.timeoutId = 0
}
this.timeoutId = setTimeout(() => {
this.activate = true;
}, time);
},
// 清空延迟
clear() {
if(this.timeoutId) {
clearTimeout(this.timeoutId);
this.timeoutId = 0
}
}
},
}; };
}, },
mounted() { beforeUnmount() {
this.pager.clear();
},
async mounted() {
if(!this.canUse3D) return;
this.pager.init();
this.scene = this.config.scene_information;
// 解决缓存问题,答卷时加载场景信息
if(!this.scene) {
var res = await BrowsingRecordApi.getSurveysScene({
sn: this.$route.query.sn,
question_index: this.question.question_index
});
this.scene = res.data?.scene_information;
}
this.shopData = buildShopDataDemo(this.scene);
this.$emit("update:answer", {}); this.$emit("update:answer", {});
this.shopData = buildShopDataDemo(this.scene); this.shopData = buildShopDataDemo(this.scene);
this.rowIndex = 0; this.rowIndex = 0;
if(this.config.is_three_dimensions) { if(this.config.is_three_dimensions) {
this.$refs.SceneGuidance.show({ this.$refs.SceneGuidance?.show({
isSelect: false, isSelect: false,
isMobile: this.isMobile isMobile: this.isMobile
}); });
} }
}, },
methods: { methods: {
next() { next() {
// 矩阵填空题判断逻辑 // 矩阵填空题判断逻辑
@@ -185,6 +238,13 @@ export default defineComponent({
} }
if(this.rowIndex + 1 >= this.row.length){ if(this.rowIndex + 1 >= this.row.length){
console.log(this.pager.activate);
if(!this.pager.activate) {
return;
}
this.pager.init();
this.$emit("next", () => new Promise((resolve) => { this.$emit("next", () => new Promise((resolve) => {
this.sceneAction = { this.sceneAction = {
action: "hold_to_shelf", action: "hold_to_shelf",
@@ -196,7 +256,14 @@ export default defineComponent({
this.rowIndex += 1; this.rowIndex += 1;
}, },
previous(){ previous(){
if(this.rowIndex <= 0){ if(this.rowIndex <= 0){
if(!this.pager.activate) {
return;
}
this.pager.init();
this.sceneAction = { this.sceneAction = {
action: "hold_to_shelf", action: "hold_to_shelf",
}; };
@@ -227,6 +294,8 @@ export default defineComponent({
// action: "hold_to_shelf", // action: "hold_to_shelf",
// } // }
}, },
onPageCompletion() {
},
// 用户行为记录 // 用户行为记录
onBehaviorFlush(data) { onBehaviorFlush(data) {

View File

@@ -25,7 +25,7 @@ export default {
onEventTrigger: () => {}, onEventTrigger: () => {},
// 是否为选择购物车模式 // 是否为选择购物车模式
isSelect: true, types: [],
// 当前提示页 // 当前提示页
current: 0, current: 0,
@@ -33,22 +33,22 @@ export default {
// 提示数据 // 提示数据
stepsData: [ stepsData: [
{ {
isSelect: false, type: "other",
urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-1.png", urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-1.png",
urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-1.png", urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-1.png",
}, },
{ {
isSelect: false, type: "other",
urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-2.png", urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-2.png",
urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-2.png", urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-2.png",
}, },
{ {
isSelect: false, type: "other",
urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-3.png", urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-3.png",
urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-3.png", urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-3.png",
}, },
{ {
isSelect: true, type: "select",
urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-4.png", urlPC: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/pc-4.png",
urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-4.png", urlMb: "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/guide/mobile-4.png",
}, },
@@ -58,7 +58,7 @@ export default {
computed: { computed: {
steps(){ steps(){
return this.stepsData.filter(x => x.isSelect == this.isSelect).map(x => ({ url: x[this.deviceType]})); return this.stepsData.filter(x => this.types.includes(x.type)).map(x => ({ url: x[this.deviceType]}));
}, },
}, },
mounted(){ mounted(){
@@ -92,17 +92,28 @@ export default {
// 展示提示 // 展示提示
show({isSelect, isMobile}) { show({isSelect, isMobile}) {
var types = [];
if(isSelect){ if(isSelect){
if(!this.$store.state.answer.guideSelectNeed) return; if(this.$store.state.answer.guideSelectNeed) {
this.$store.commit("answer/GUIDE_SELECT_NEED") this.$store.commit("answer/GUIDE_SELECT_NEED");
types.push("select");
}
if(this.$store.state.answer.guideOtherNeed) {
this.$store.commit("answer/GUIDE_OTHER_NEED");
types.push("other");
}
} }
else{ else{
if(!this.$store.state.answer.guideOtherNeed) return; if(this.$store.state.answer.guideOtherNeed) {
this.$store.commit("answer/GUIDE_OTHER_NEED") this.$store.commit("answer/GUIDE_OTHER_NEED");
types.push("other");
}
} }
if(types.length <= 0) return;
// //
this.isSelect = !!isSelect; this.types = types;
this.steps = 0; this.steps = 0;
this.visible = true; this.visible = true;
}, },
@@ -118,6 +129,8 @@ export default {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
z-index: 9999; z-index: 9999;
background-color: #FFFFFF;
user-select: none;
.step{ .step{
width: 100%; width: 100%;
height: 100%; height: 100%;

View File

@@ -8,5 +8,12 @@ export default class BrowsingRecordApi {
data: params.data, data: params.data,
}) })
} }
/* 获取3D资源 */
static getSurveysScene(params) {
return request({
method: 'get',
url: `/answer/surveys/${params.sn}/scene?question_index=${params.question_index}`,
})
}
} }

View File

@@ -13,6 +13,7 @@
color: #fff; color: #fff;
z-index: 999; z-index: 999;
padding: 0; padding: 0;
user-select: none;
} }
.pc .page .iconfont { .pc .page .iconfont {
@@ -41,13 +42,13 @@
.pc .pageNext::before{ .pc .pageNext::before{
content: "下一页"; content: "下一页";
padding-right: 10px; padding-right: 10px;
line-height: 52px; line-height: 50px;
vertical-align: top; vertical-align: top;
} }
.pc .pagePre::after{ .pc .pagePre::after{
content: "上一页"; content: "上一页";
padding-left: 10px; padding-left: 10px;
line-height: 52px; line-height: 50px;
vertical-align: top; vertical-align: top;
} }
@@ -89,6 +90,7 @@
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
display: inline-block; display: inline-block;
z-index: 998; z-index: 998;
text-align: center;
} }
.pc .q-content-top { .pc .q-content-top {
@@ -101,7 +103,7 @@
line-height: 30px; line-height: 30px;
padding: 10px 20px; padding: 10px 20px;
top: 40px; top: 0;
z-index: 997; z-index: 997;
} }
@@ -110,7 +112,7 @@
} }
.pc .q-content-top>*:nth-child(2) { .pc .q-content-top>*:nth-child(2) {
margin-top: 10px; /*margin-top: 10px;*/
} }
.pc .q-content-top .ant-radio { .pc .q-content-top .ant-radio {
@@ -172,14 +174,14 @@
.mobile .pageNext::before{ .mobile .pageNext::before{
content: "下一页"; content: "下一页";
padding-right: 10px; padding-right: 10px;
line-height: 42px; line-height: 43px;
vertical-align: top; vertical-align: top;
} }
.mobile .pagePre::after{ .mobile .pagePre::after{
content: "上一页"; content: "上一页";
padding-left: 10px; padding-left: 10px;
line-height: 42px; line-height: 43px;
vertical-align: top; vertical-align: top;
} }
@@ -235,7 +237,7 @@
line-height: 30px; line-height: 30px;
padding: 10px 20px; padding: 10px 20px;
top: 40px; top: 20px;
width: 90%; width: 90%;
@@ -246,7 +248,7 @@
} }
.mobile .q-content-top>*:nth-child(2) { .mobile .q-content-top>*:nth-child(2) {
margin-top: 10px; /*margin-top: 10px;*/
} }
.mobile .q-content-top .ant-radio { .mobile .q-content-top .ant-radio {
@@ -264,9 +266,14 @@
/* 公共样式 - 开始 */ /* 公共样式 - 开始 */
.q-content-top .radio-group{
margin-bottom: 0!important;
}
.q-content-top .radio-group>.radio { .q-content-top .radio-group>.radio {
width: auto !important; width: auto !important;
color: #fff !important; color: #fff !important;
margin-bottom: 0!important;
margin-right: 16px!important;
} }
.q-content-top .ant-radio-inner { .q-content-top .ant-radio-inner {

View File

@@ -47,7 +47,7 @@
</a-select> </a-select>
</div> </div>
<div style="width: 100%; height: 400px; position: relative;"> <div style="width: 100%; height: 400px; position: relative;">
<div :ref="scene.planet_id" style="width: 100%; height: 100%;"></div> <div :ref="scene.chart_ref" style="width: 100%; height: 100%;"></div>
<div v-show="!scene.data.length" class="no-result"> <div v-show="!scene.data.length" class="no-result">
<img :src="require('@/assets/img/publish/no-data.png')" alt="" class="empty-img"/> <img :src="require('@/assets/img/publish/no-data.png')" alt="" class="empty-img"/>
<div class="empty-text">暂无分析结果</div> <div class="empty-text">暂无分析结果</div>
@@ -111,7 +111,8 @@ export default {
}, },
async mounted() { async mounted() {
var res = await browsingRecordScenes({ sn: this.$route.query.sn }); var res = await browsingRecordScenes({ sn: this.$route.query.sn });
res.data.scenes.forEach((scene) => { res.data.scenes.forEach((scene, index) => {
scene.chart_ref = "q3d_chart_" + index;
scene.selectedQuestionIndex = []; scene.selectedQuestionIndex = [];
scene.columns = columns; scene.columns = columns;
scene.data = []; scene.data = [];
@@ -179,6 +180,11 @@ export default {
*/ */
onQuestionIndexChange: debounce(async function(scene) { onQuestionIndexChange: debounce(async function(scene) {
if(scene.selectedQuestionIndex.length <= 0) {
scene.data = [];
return;
}
scene.spinning = true; scene.spinning = true;
var res = await tdsceneAnalysis({ var res = await tdsceneAnalysis({
sn: this.$route.query.sn, sn: this.$route.query.sn,
@@ -192,7 +198,7 @@ export default {
scene.data = data; scene.data = data;
charts[scene.planet_id].setOption({ charts[scene.chart_ref].setOption({
title: { title: {
show: false, show: false,
}, },
@@ -244,10 +250,10 @@ export default {
}); });
}, 500), }, 500),
init(scene) { init(scene) {
var el = this.$refs[scene.planet_id]; var el = this.$refs[scene.chart_ref];
if (el instanceof Array) el = el[0]; if (el instanceof Array) el = el[0];
charts[scene.planet_id] = echarts.init(el); charts[scene.chart_ref] = echarts.init(el);
charts[scene.planet_id].setOption({ charts[scene.chart_ref].setOption({
title: { title: {
text: '暂无数据', text: '暂无数据',
x: 'center', x: 'center',

View File

@@ -18,6 +18,7 @@ import { computed, defineComponent, ref } from "vue";
import { jsonp } from "vue-jsonp"; import { jsonp } from "vue-jsonp";
import { loginIn } from "../Login/api.js"; import { loginIn } from "../Login/api.js";
import { jsonpUrl } from "../../config.js"; import { jsonpUrl } from "../../config.js";
import { message } from "ant-design-vue";
export default defineComponent({ export default defineComponent({
components: { components: {
Avatar, Avatar,
@@ -35,7 +36,7 @@ export default defineComponent({
} }
const token = computed(() => store.state.common.token); const token = computed(() => store.state.common.token);
try { try {
localStorage.setItem("plantIp", returnCitySN["cip"]); localStorage.setItem("plantIp", window.returnCitySN?window.returnCitySN["cip"]:"127.0.0.1");
} catch (error) { } catch (error) {
localStorage.setItem("plantIp", ""); localStorage.setItem("plantIp", "");
} }
@@ -56,7 +57,7 @@ export default defineComponent({
localStorage.setItem("plantUserInfo", JSON.stringify(data)); localStorage.setItem("plantUserInfo", JSON.stringify(data));
localStorage.setItem("plantId", JSON.stringify(data.id)); localStorage.setItem("plantId", JSON.stringify(data.id));
} catch (error) { } catch (error) {
this.$message.error( message.error(
error.data?.message || error.message || "服务器错误" error.data?.message || error.message || "服务器错误"
); );
} }
@@ -66,7 +67,7 @@ export default defineComponent({
spinningLoading.value = true; spinningLoading.value = true;
jsonp(jsonpUrl, { jsonp(jsonpUrl, {
appId: "yip", appId: "yip",
remoteIp: returnCitySN["cip"], remoteIp: window.returnCitySN?window.returnCitySN["cip"]:"127.0.0.1",
callbackQuery: "jsonpCallback", callbackQuery: "jsonpCallback",
}) })
.then((res) => { .then((res) => {

View File

@@ -20,7 +20,8 @@
@change="(val) => { @change="(val) => {
configTemp.shelf = null; configTemp.shelf = null;
configTemp.ware = null; configTemp.ware = null;
onUpdate(val); configTemp.material_sn = null;
onSceneChange(val);
}" }"
allowClear allowClear
placeholder="请选择场景" placeholder="请选择场景"
@@ -189,6 +190,8 @@
:max="100000" :max="100000"
:value="configTemp.show_time" :value="configTemp.show_time"
@update:value="(val) => configTemp.show_time = Number(val).toFixed(0)" @update:value="(val) => configTemp.show_time = Number(val).toFixed(0)"
:formatter="value => `${value}秒`"
:parser="value => value.replace('秒', '')"
style="width: 80px; border-radius: 4px;" style="width: 80px; border-radius: 4px;"
@change="onUpdate" @change="onUpdate"
/> />
@@ -331,6 +334,9 @@ export default {
shelves() { shelves() {
if (!this.configTemp.scene) return []; if (!this.configTemp.scene) return [];
if (!this.scene) return []; if (!this.scene) return [];
if (this.configTemp.scene_information) {
return this.configTemp.scene_information.shelves;
}
return this.scene.shelves; return this.scene.shelves;
}, },
shelf() { shelf() {
@@ -350,7 +356,6 @@ export default {
}, },
// 权限-是否展示3D // 权限-是否展示3D
permission3D() { permission3D() {
return true;
try{ try{
return !!this.$store.state.common.questionInfo.survey.is_three_d_permissions; return !!this.$store.state.common.questionInfo.survey.is_three_d_permissions;
} }
@@ -388,8 +393,11 @@ export default {
}; };
}, },
async mounted() { async mounted() {
// 环境类型
var type0 = process.env.VUE_APP_CURRENTMODE == "prod" ? "prod" : "test";
var type1 = process.env.VUE_APP_CURRENTMODE == "prod" ? "prod" : "uat";
// 默认的模型接口 // 默认的模型接口
var res = await fetch("https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/shelves/scenes_data/yili.json").then(res => res.json()); var res = await fetch(`https://${type0}-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/${type1}-yls/3D/shelves/scenes_data/yili.json`).then(res => res.json());
this.scenes = res; this.scenes = res;
}, },
methods: { methods: {
@@ -405,14 +413,16 @@ export default {
this.onUpdate(); this.onUpdate();
}, },
onUpdate() { onSceneChange(){
if (this.scene) { if (this.scene) {
this.configTemp.scene_information = JSON.parse( this.configTemp.scene_information = JSON.parse(
JSON.stringify(this.scene) JSON.stringify(this.scene)
); );
} }
this.onUpdate();
},
onUpdate() {
this.$emit("update:config", this.configTemp); this.$emit("update:config", this.configTemp);
this.$emit("changeConfig", this.configTemp); this.$emit("changeConfig", this.configTemp);
}, },

View File

@@ -48,6 +48,7 @@ export default {
}; };
}, },
beforeUnmount(){ beforeUnmount(){
if(!target) return;
target.style.zIndex = -1; target.style.zIndex = -1;
window.removeEventListener('message', this.handler); window.removeEventListener('message', this.handler);
}, },
@@ -56,6 +57,9 @@ export default {
// 获取根元素 // 获取根元素
target = document.getElementById("__3d__"); target = document.getElementById("__3d__");
// 未知页面不做处理
if(!target) return;
// 隐藏模式加载 // 隐藏模式加载
if(!this.hidden){ if(!this.hidden){
target.style.zIndex = 99; target.style.zIndex = 99;

View File

@@ -1,9 +1,11 @@
<template> <template>
<div class="container-viewer-1-"></div> <div class="container-viewer-1-">
<div v-if="freezeRotY" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0;"></div>
</div>
</template> </template>
<script> <script>
import { SurveyViewer } from "@/views/planetDesign/SceneSurveyViewerPage/shelves.module.js"; import { SurveyViewer } from "./shelves.module.js";
export default { export default {
props: ["surveyId", "shopData", "page", "sceneAction", "elCart", "defaultWare", "isLocked", "freezeRotY"], props: ["surveyId", "shopData", "page", "sceneAction", "elCart", "defaultWare", "isLocked", "freezeRotY"],
@@ -49,6 +51,10 @@ export default {
page(newVal, oldVal) { page(newVal, oldVal) {
// console.log('page ........', newVal, oldVal) // console.log('page ........', newVal, oldVal)
if (this.viewer_) { if (this.viewer_) {
this.viewer_.flyAnimation = !(this.defaultWare?.planetid && this.isLocked);
this.viewer_.frostFarScene = this.isLocked;
this.viewer_.arrange(newVal).then(() => { this.viewer_.arrange(newVal).then(() => {
this.$emit("onPageCompletion"); this.$emit("onPageCompletion");
@@ -58,8 +64,7 @@ export default {
this.viewer_.hold({ this.viewer_.hold({
wareId: this.defaultWare?.planetid, wareId: this.defaultWare?.planetid,
keepHold: this.isLocked, keepHold: this.isLocked,
frostFarScene: this.isLocked, // freezeRotY: this.freezeRotY ? "0" : undefined,
freezeRotY: this.freezeRotY ? "0" : undefined,
}) })
}); });
} }

File diff suppressed because one or more lines are too long

View File

@@ -171,6 +171,9 @@ import OptionShow from "../../components/OptionShow.vue";
import * as cheerio from "cheerio"; import * as cheerio from "cheerio";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { getOptionName } from "../../js/util.js"; import { getOptionName } from "../../js/util.js";
import common from "@/utils/methods/Common.js"
export default { export default {
name: "Choice", name: "Choice",
components: { components: {
@@ -284,17 +287,18 @@ export default {
const optionSet = (optionList, element, index) => { const optionSet = (optionList, element, index) => {
const findIndex = optionList.findIndex((opt, fIndex) => { const findIndex = optionList.findIndex((opt, fIndex) => {
if (fIndex !== index) { if (fIndex !== index) {
const $old = cheerio // const $old = cheerio
.load(opt.option) // .load(opt.option)
.text() // .text()
.replace(/\s*/g, "") // .replace(/\s*/g, "")
.replaceAll("\n", ""); // .replaceAll("\n", "");
const $new = cheerio // const $new = cheerio
.load(element.option) // .load(element.option)
.text() // .text()
.replace(/\s*/g, "") // .replace(/\s*/g, "")
.replaceAll("\n", ""); // .replaceAll("\n", "");
return $old === $new; // return $old === $new;
return common.rtxEqual(opt.option, element.option);
} }
}); });
if (findIndex !== -1) { if (findIndex !== -1) {

View File

@@ -100,7 +100,7 @@
</div> </div>
</ConfigBaseItem> </ConfigBaseItem>
<!-- 3D 相关配置 --> <!-- 3D 相关配置 -->
<Config3D :key="copyConfig.question_index&&copyConfig.question_type" v-model:config="copyConfig.config" @changeConfig="() => updateConfig(copyConfig)" :questionType="copyConfig.question_type" :question="copyConfig"/> <Config3D :key="copyConfig.question_index*copyConfig.question_type" v-model:config="copyConfig.config" @changeConfig="() => updateConfig(copyConfig)" :questionType="copyConfig.question_type" :question="copyConfig"/>
<ConfigRequire <ConfigRequire
title="选项随机" title="选项随机"

View File

@@ -5,6 +5,7 @@
<div v-if="spinning" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-color: #fff;"> <div v-if="spinning" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-color: #fff;">
<a-spin style="position: absolute; left: 50%; top: 50%;"/> <a-spin style="position: absolute; left: 50%; top: 50%;"/>
</div> </div>
<div v-if="freezeRotY" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0;"></div>
</div> </div>
</template> </template>
@@ -121,6 +122,10 @@ export default {
page(newVal, oldVal) { page(newVal, oldVal) {
// console.log('page ........', newVal, oldVal) // console.log('page ........', newVal, oldVal)
if (this.viewer_) { if (this.viewer_) {
this.viewer_.flyAnimation = !(this.defaultWare?.planetid && this.isLocked);
this.viewer_.frostFarScene = this.isLocked;
this.viewer_.arrange(newVal).then(() => { this.viewer_.arrange(newVal).then(() => {
// this.$emit("onPageCompletion"); // this.$emit("onPageCompletion");
setTimeout(() => { setTimeout(() => {
@@ -134,8 +139,8 @@ export default {
this.viewer_.hold({ this.viewer_.hold({
wareId: this.defaultWare?.planetid, wareId: this.defaultWare?.planetid,
keepHold: this.isLocked, keepHold: this.isLocked,
frostFarScene: this.isLocked, // 组件内置的固定角度有问题,单独通过遮罩实现
freezeRotY: this.freezeRotY ? "0" : undefined, // freezeRotY: this.freezeRotY ? "0" : undefined,
}) })
}); });
} }

File diff suppressed because one or more lines are too long