jinx 1 год назад
Родитель
Сommit
4ee64da7e6

+ 5 - 0
scene/src/store/index.js

@@ -5,12 +5,16 @@ Vue.use(Vuex);
 
 const store = new Vuex.Store({
   state: {
+    panoId: 0,
     points: null,
   },
   getters: {
     points(state) {
       return state.points;
     },
+    panoId(state) {
+      return state.panoId;
+    },
   },
   mutations: {
     setData(state, payload) {
@@ -19,6 +23,7 @@ const store = new Vuex.Store({
       }
     },
     setPanoOver(state, id) {
+      state.panoId = id;
       if (state.points && !state.points[id]?.over) {
         state.points[id].over = true;
       }

+ 2 - 1
scene/src/views/gui/components/layerMap.vue

@@ -109,12 +109,13 @@ export default {
   // props: ["points"],
   data() {
     //这里存放数据
-    return { unit: 0, mapScale: 1, panoId: player.currentPano.id };
+    return { unit: 0, mapScale: 1 };
   },
   //监听属性 类似于data概念
   computed: {
     ...mapGetters({
       points: "points",
+      panoId: "panoId",
     }),
   },
   //监控data中的数据变化

+ 5 - 2
scene/src/views/gui/components/tourList.vue

@@ -7,7 +7,7 @@
     </div>
     <div class="swcon" v-swiper:mySwiper="swiperOption">
       <ul class="swiper-wrapper swiper-wrapper-n">
-        <div class="swiper-slide" v-for="(i, index) in tourList">
+        <div class="swiper-slide" v-for="(i, index) in tourList" :class="{ active: i.heroLocations[0].panoId == panoId }">
           <img :src="i.heroLocations[0].thumbUrl" alt="" />
           <div class="sl-item" :data-v="JSON.stringify(i)">
             <span>{{ i.heroLocations[0].name }}</span>
@@ -22,6 +22,7 @@
 import ClickOutside from "vue-click-outside";
 import { directive } from "vue-awesome-swiper";
 import "swiper/css/swiper.css";
+import { mapGetters, mapMutations } from "vuex";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
@@ -33,6 +34,9 @@ export default {
   },
   //监听属性 类似于data概念
   computed: {
+    ...mapGetters({
+      panoId: "panoId",
+    }),
     swiperOption() {
       let that = this;
       return {
@@ -68,7 +72,6 @@ export default {
   //方法集合
   methods: {
     goScene(item) {
-      console.error(1);
       // let { panoId, quaternion } = heroLocation;
       // // player.model.heroLocations里的那些item
       // player.flyToPano({ pano: player.model.panos.get(panoId), quaternion });