Sfoglia il codice sorgente

顶楼展示修改

haojianlong 4 anni fa
parent
commit
c576975d0d
2 ha cambiato i file con 48 aggiunte e 12 eliminazioni
  1. 3 3
      package.json
  2. 45 9
      src/components/floorMap/index.vue

+ 3 - 3
package.json

@@ -12,10 +12,10 @@
     "dependencies": {
         "@mapbox/geojson-merge": "^1.1.1",
         "@saga-web/base": "2.1.25",
-        "@saga-web/big": "1.0.105",
+        "@saga-web/big": "1.0.106",
         "@saga-web/draw": "2.1.106",
-        "@saga-web/feng-map": "1.0.35",
-        "@saga-web/graph": "2.1.121",
+        "@saga-web/feng-map": "1.0.36",
+        "@saga-web/graph": "2.1.122",
         "ant-design-vue": "^1.4.10",
         "axios": "^0.19.2",
         "core-js": "^3.4.4",

+ 45 - 9
src/components/floorMap/index.vue

@@ -81,7 +81,7 @@
     </div>
 </template>
 <script>
-import { SFengParser } from '@saga-web/feng-map'
+import { SFengParser, ProjectRf } from '@saga-web/feng-map'
 import { SFloorParser, ItemOrder, ItemColor, SPolygonItem } from '@saga-web/big'
 import { FloorView } from '@/lib/FloorView'
 import { FloorScene } from '@/lib/FloorScene'
@@ -128,7 +128,8 @@ export default {
                 pointData: []
             },
             activeItem: null,
-            showBtnWell: false
+            showBtnWell: false,
+            count: 0, // 顶楼为多张图时计数器
         }
     },
     props: {
@@ -281,14 +282,40 @@ export default {
             if (floor == 'g80') {
                 // 屋顶
                 if (window.fengmapData.frImg) {
-                    let imgItem = new SImageItem(null, `${this.mapServerURL}/webtheme/${this.fmapID}/${window.fengmapData.frImg}`)
-                    imgItem.showType = SImageShowType.AutoFit
-                    imgItem.connect('imgLoadOver', this, () => {
-                        this.readGraph()
-                    })
-                    this.scene.addItem(imgItem)
-                    this.view.scene = this.scene
+                    const pj = this.urlMsg.fmapID.split('_')[0]
+                    // 单张图片
+                    if (!ProjectRf[pj]) {
+                        let imgItem = new SImageItem(null, `${this.mapServerURL}/webtheme/${this.fmapID}/${window.fengmapData.frImg}`)
+                        imgItem.showType = SImageShowType.AutoFit
+                        imgItem.connect('imgLoadOver', this, () => {
+                            this.readGraph()
+                        })
+                        this.scene.addItem(imgItem)
+                        this.view.scene = this.scene
                     // this.view.fitSceneToView()
+                    } else {
+                      // 多张图
+                      try {
+                        // 初始化0
+                        this.count = 0;
+                        ProjectRf[pj].forEach(t => {
+                          const item = new SImageItem(
+                            null,
+                            `${this.mapServerURL}/webtheme/${this.urlMsg.fmapID}/${t.name}`
+                          );
+                          item.width = t.width
+                          item.height = t.width
+                          item.moveTo(t.x, t.y)
+                          item.connect("imgLoadOver", this, () => {
+                            this.countRf(ProjectRf[pj].length);
+                          });
+                          this.scene.addItem(item);
+                        })
+                        this.view.scene = this.scene;
+                      } catch(e) {
+                        console.log(e);
+                      }
+                    }
                 } else {
                     // 屋顶图不为图片
                     this.readBaseMap(floor);
@@ -445,6 +472,15 @@ export default {
                     this.loading = false
                 })
         },
+        // 顶楼为多张图时计数器
+        countRf(len) {
+            this.count++
+            if (len == this.count) {
+                this.readGraph();
+            } else {
+                console.log('所有图片未加载完成');
+            }
+        },
         clearGraphy() {
             if (this.view) {
                 this.view.scene = null