diff --git a/src/views/Answer/questions/components/AnswerViewer.vue b/src/views/Answer/questions/components/AnswerViewer.vue index 8af16c38..e277de4a 100644 --- a/src/views/Answer/questions/components/AnswerViewer.vue +++ b/src/views/Answer/questions/components/AnswerViewer.vue @@ -115,9 +115,9 @@ export default defineComponent({ surveyId() { return this.config.scene; }, - scene() { - return this.config.scene_information; - }, + // scene() { + // return this.config.scene_information; + // }, shelves() { if (!this.scene) return []; return this.scene.shelves; @@ -162,6 +162,9 @@ export default defineComponent({ }, data() { return { + + scene: null, + shopData: null, page: null, sceneAction: null, @@ -197,10 +200,21 @@ export default defineComponent({ beforeUnmount() { this.pager.clear(); }, - mounted() { + async mounted() { 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); if(this.config.is_show_time && this.config.show_time){ diff --git a/src/views/Answer/questions/components/AnswerViewerMatrix.vue b/src/views/Answer/questions/components/AnswerViewerMatrix.vue index 180908b8..a074d54f 100644 --- a/src/views/Answer/questions/components/AnswerViewerMatrix.vue +++ b/src/views/Answer/questions/components/AnswerViewerMatrix.vue @@ -107,9 +107,9 @@ export default defineComponent({ surveyId() { return this.config.scene; }, - scene() { - return this.config.scene_information; - }, + // scene() { + // return this.config.scene_information; + // }, shelves() { if (!this.scene) return []; return this.scene.shelves; @@ -135,6 +135,9 @@ export default defineComponent({ }, data(){ return { + + scene: null, + shopData: null, page: null, rowIndex: 0, @@ -170,9 +173,22 @@ export default defineComponent({ beforeUnmount() { this.pager.clear(); }, - mounted() { + async mounted() { 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.shopData = buildShopDataDemo(this.scene); diff --git a/src/views/Answer/questions/components/api.js b/src/views/Answer/questions/components/api.js index 50397047..de8729b3 100644 --- a/src/views/Answer/questions/components/api.js +++ b/src/views/Answer/questions/components/api.js @@ -8,5 +8,12 @@ export default class BrowsingRecordApi { data: params.data, }) } + /* 获取3D资源 */ + static getSurveysScene(params) { + return request({ + method: 'get', + url: `/answer/surveys/${params.sn}/scene?question_index=${params.question_index}`, + }) + } }