tremble 4 lat temu
rodzic
commit
0f6b9800c3

+ 26 - 1
src/api/index.js

@@ -54,7 +54,7 @@ export function uploadPano(data, type, ok, no) {
  * @param {*} no 
  */
 export function saveUseHots(data, ok, no) {
-    return http.get(`/fcb/pano/scene/save/useHots/${data.id}/${data.sceneCodes}`, '', ok, no)
+    return http.postJson(`/fcb/pano/scene/save/useHots`, data, ok, no)
 }
 
 
@@ -169,6 +169,20 @@ export function saveHouse(data, ok, no) {
     return http.postJson(`/fcb/pano/scene/saveVrModel`, data, ok, no)
 }
 
+/**
+ * 保存户型
+ * @param {*} data 
+ * @param {*} ok 
+ * @param {*} no 
+ */
+export function savePanoHouse(data, ok, no) {
+    data.houseId = number()
+    data.hengdaId = HDNumber()
+    data.byType = data.byType ||'garden'
+
+    return http.postJson(`/fcb/pano/scene/saveGardenVrModel`, data, ok, no)
+}
+
 
 /**
  * 保存全景图配置信息
@@ -215,6 +229,17 @@ export function getPanoList(data, ok, no) {
     return http.postJson('/fcb/pano/scene/list', data, ok, no)
 }
 
+/**
+ * 获取全景图列表(搜索)
+ * @param {*} data 
+ * @param {*} ok 
+ * @param {*} no 
+ */
+export function getSearchPanoList(data, ok, no) {
+    data.houseId = number()
+    return http.postJson('/fcb/pano/scene/searchUnion', data, ok, no)
+}
+
 
 /**
  * 删除全景图

+ 4 - 1
src/components/paging.vue

@@ -112,7 +112,10 @@ export default {
       this.$emit('changeCurrent', this.current)
     },
     paging() {
-      Object.keys(this.paging).forEach(k => this[k] = this.paging[k])
+        Object.keys(this.paging).forEach(k => this[k] = this.paging[k])
+    },
+    'paging.total':function () {
+        Object.keys(this.paging).forEach(k => this[k] = this.paging[k])
     }
   }
 }

+ 28 - 5
src/components/select.vue

@@ -19,6 +19,8 @@
          <slot name="list" :data="item"></slot>
        </li>
      </ul>
+      <div class="nodata" v-if="panos.length==0">暂无数据</div>
+     
    </div>
 
    <template v-if="name=='table'">
@@ -51,7 +53,7 @@
           </td>
           <td width="500px">
             <div class="list-img">
-              <img :src="item.thumb" alt="">
+              <img :key="item.goodsId" :src="`${item.thumb}?rnd=${Math.random()}`" alt="">
             </div>
           </td>
           <td>{{item.sceneName}}</td>
@@ -73,7 +75,7 @@
     </div>
    </template>
 
-    <div class="btns" :class="{disable:!current&&!houseSelect}">
+    <div class="btns" :class="{disable:disable}">
       <a @click="$emit('submit', houseSelect)" >确定</a>
       <a v-if="showCancle" @click="$emit('cancle')">取消</a>
     </div>
@@ -123,7 +125,21 @@ props:{
     Paging
   },
   watch:{
-    houseSelect(){
+    houseSelect(newVal){
+      console.log(newVal);
+    }
+  },
+  computed:{
+    disable(){
+      let tmp =''
+      this.panos.forEach(item=>{
+         if (!tmp) {
+          tmp = item.arr.find(i=>{
+            return i.id == this.current.id
+          })
+         }
+      })
+      return !tmp&&!this.houseSelect
     }
   },
   data () {
@@ -132,6 +148,7 @@ props:{
       houseSelect:'',
       allSelect: false,
       key:'',
+      tmppaging:{...this.paging}
     }
   },
 
@@ -232,6 +249,13 @@ props:{
   min-height: 400px;
   max-height: 60vh;
   overflow-y: auto;
+  position: relative;
+  .nodata{
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-50%,-50%);
+  }
 }
 
 .table-layer {
@@ -339,12 +363,11 @@ props:{
     cursor: pointer;
     color: #fff;
     display: inline-block;
-
     &:nth-child(1) {
       background-color: #00C8AF;
-      margin-right: 20px;
     }
     &:nth-child(2) {
+      margin-left: 20px;
       border:1px solid rgba(112,112,112,1);
     }
   }

+ 3 - 1
src/components/shared/Combox.vue

@@ -101,7 +101,9 @@ export default {
         height: auto;
         border-top-left-radius: 0;
         border-top-right-radius: 0;
-        overflow: hidden;
+        overflow-x: hidden;
+        overflow-y: auto;
+        max-height: 130px;
         background: #000;
         box-shadow: 0 5px 5px rgba(0, 0, 0, 0.3);
         z-index: 10000;

+ 6 - 3
src/framework/Toolbar.vue

@@ -92,10 +92,13 @@ export default {
             type: this.type,
             status:3
           },async data=>{
-            this.list = data.data.list
+            let temp = data.data.list.filter(item=>{
+              return item.type != 'house'
+            })
+            this.list = temp
             localStorage.initImg=''
             ListDetector.valid();
-            this.$store.commit("SetVrList", data.data.list);
+            this.$store.commit("SetVrList", temp);
             this.activeItem = this.list[0]
             localStorage.initImg = this.activeItem && this.activeItem.icon
           })
@@ -242,7 +245,7 @@ export default {
   .unable{
     &::before{
       content: '';
-      z-index: 2;
+      z-index: 22;
       position: absolute;
       width: 100%;
       top: -32px;

+ 1 - 1
src/framework/core/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="pano-body">
-    <div class="none-center" v-show="!activeItem">请先上传或添加场景素材</div>
+    <div class="none-center" v-show="!activeItem">请先上传全景图</div>
 
     <div v-show="activeItem" id="pano"></div>
     <template v-if="showSnapshot&&activeItem">

+ 40 - 2
src/views/hotspot/Setting.vue

@@ -35,7 +35,7 @@
 </template>
 <script>
 import EidtPanel from "./EditPanel";
-import { saveSomeData } from "@/api";
+import { saveSomeData,saveUseHots } from "@/api";
 import { mapGetters } from "vuex";
 
 // import ConfirmPanel from "./ConfirmPanel";
@@ -53,6 +53,7 @@ export default {
     data(){
         return {
             editData:'',
+            editLink:'',
             showPanel:false,
             someData:{hotspots:[]},
             deleIndex:-1,
@@ -105,7 +106,9 @@ export default {
             let HV = window.__krfn.utils.getHotspotHV(krpano,data.name);
             data.ath = HV.ath
             data.atv = HV.atv
+            let type = 'edit'
             if (this.someData.hotspots.findIndex(item => item.name === data.name)<=-1) {
+                type = 'add'
                 this.someData.hotspots.push(data)
             }
             saveSomeData({
@@ -115,6 +118,24 @@ export default {
             },()=>{
                 this.activeItem.someData = JSON.stringify(this.someData)
                 this.$tips({content:this.editTitle+'成功',icon:'ok'})
+
+                let tmp = JSON.parse(this.activeItem.useHots || '{"data":[]}')
+                if (type=='add') {
+                    tmp.data.push(data.link)
+                }else{
+                    let idx = tmp.data.findIndex(item => item == this.editLink)
+                    if (idx>-1) {
+                        tmp.data[idx] = data.link
+                    }
+                 
+                }
+
+                saveUseHots({
+                    id:this.activeItem.id,
+                    sceneCodes: tmp.data
+                },()=>{
+                    this.activeItem.useHots = JSON.stringify(tmp)
+                })
             })
         },
         deleteHot(data){
@@ -127,13 +148,27 @@ export default {
                 this.deleteKRHotspot(data)
                 this.activeItem.someData = JSON.stringify(this.someData)
                 this.$tips({content:'删除成功',icon:'ok'})
+
+                
+                let tmp = JSON.parse(this.activeItem.useHots || '{"data":[]}')
+                let idx = tmp.data.findIndex(item=>item==data.link)
+                tmp.data.splice(idx,1);
+
+                saveUseHots({
+                    id:this.activeItem.id,
+                    sceneCodes: tmp.data
+                },()=>{
+                    this.activeItem.useHots = JSON.stringify(tmp)
+                })
             })
         },
         open(data){
             this.showPanel = true;
             this.editTitle = '新增'
             this.editData = data
+
             if (data) {
+                this.editLink = data.link
                 this.editTitle = '编辑'
                 var krpano = document.getElementById('krpanoSWFObject');
                 window.__krfn.utils.looktohotspot(krpano,data.name);
@@ -179,7 +214,10 @@ export default {
         width: 100%;
         height: 100%;
         ul {
-            width: calc(100% - 10px);
+            width: 100%;
+            max-height: 100%;
+            overflow-y: auto;
+            overflow-x: hidden;
         }
         li {
             cursor: pointer;

+ 1 - 1
src/views/hotspot/Toolbar.vue

@@ -158,7 +158,7 @@ export default {
   .unable{
     &::before{
       content: '';
-      z-index: 2;
+      z-index: 22;
       position: absolute;
       width: 100%;
       top: -32px;

+ 12 - 7
src/views/hotspot/index.vue

@@ -23,7 +23,7 @@
                 :key="i"
               >
                 <div class="typeli">
-                  <i class="iconfont iconscene_map_3d" :class="{'iconjump':item.type!=='house'}"></i>
+                  <i class="iconfont iconscene_map_3d" :class="{'iconjump':item.type!=='house'&&item.byType!='garden'}"></i>
                 </div>
                 <div class="img">
                   <img :src="item.icon" alt="">
@@ -42,7 +42,7 @@
 <script>
 import Setting from "./Setting";
 import Select from "@/components/select";
-import { getPanoList } from "@/api";
+import { getSearchPanoList } from "@/api";
 
 export default {
   name: "home",
@@ -57,12 +57,16 @@ export default {
     show(newVal){
       if (newVal) {
         this.searchKey = ''
-        this.activeItem = ''
         this.getPanoList();
       }
+      else{
+        this.activeWebsite = ''
+      }
     },
-    activeWebsite(newVal){
-      if (!newVal.sceneCode) {
+    activeWebsite:{
+      deep:true,
+      handler:function (newVal) {
+        if (!newVal||!newVal.sceneCode) {
         return
       }
       let tmp = ''
@@ -73,8 +77,9 @@ export default {
           })
         }
       })
-      this.activeItem = tmp
 
+      this.activeItem = tmp || this.activeItem
+      }
     }
   },
   data(){
@@ -96,7 +101,7 @@ export default {
       this.show=true
     },
    getPanoList() {
-      getPanoList(
+      getSearchPanoList(
         {
           pageNum: 1,
           pageSize: 1000,

+ 7 - 4
src/views/information/Toolbar.vue

@@ -23,13 +23,13 @@
                 <ul>
                   <template v-if="item.status==3">
                     <li v-if="type!='house'" @click="$emit('rename',item)">重命名</li>
-                    <li v-else @click="$emit('addVR',item)">编辑</li>
+                    <li v-else @click="$emit('addVR',{type,data:item})">编辑</li>
                   </template>
                   <li v-if="item.status!=1" @click="del(item)">删除</li>
                 </ul>
               </div>
               <div class="ui-title">
-                <span>{{item.type=='house'?item.roomName:item.sceneTitle}}</span>
+                <span>{{type=='house'?item.roomName:item.sceneTitle}}</span>
               </div>
             </li>
           </draggable>
@@ -43,8 +43,8 @@
                 <upload ref="uploadFile" :failString="'请上传jpg格式的全景图'" accept-type="image/jpeg" media-type="image" :limit="120"  @file-change="onFileChange"></upload>
                 <!-- multiple="multiple" -->
           </button>
-          <button v-else class="ui-button submit" @click="$emit('addVR')" >
-            <i class="iconfont icon_plus"></i>添加户型
+          <button v-if="type=='house'||type=='garden'" class="ui-button submit" @click="$emit('addVR',{type})" >
+            <i class="iconfont icon_plus"></i>{{type=='garden'?'添加VR模型':'添加户型'}}
           </button>
         </div>
       </div>
@@ -228,6 +228,9 @@ export default {
       }
       .add-btn{
         z-index: 20;
+        .ui-button{
+          margin: 0 5px;
+        }
       }
     }
   }

+ 114 - 65
src/views/information/index.vue

@@ -25,14 +25,16 @@
                 <div class="typeli">
                   <i
                     class="iconfont iconscene_map_3d"
-                    :class="{ iconjump: item.type !== 'house' }"
+                    :class="{ iconjump: item.type != 'house'&&item.byType!='garden' }"
                   ></i>
                 </div>
                 <div class="img">
-                  <img :src="item.icon" alt="">
+                  <img :key="i" :src="`${item.icon}?rnd=${Math.random()}`" alt="" />
                 </div>
                 <div class="ui-title">
-                  <span>{{item.type=='house'?item.roomName:item.sceneTitle}}</span>
+                  <span>{{
+                    item.type == "house" ? item.roomName : item.sceneTitle
+                  }}</span>
                 </div>
               </li>
             </ul>
@@ -41,7 +43,7 @@
       </Select>
     </div>
 
-    <div class="dialog" style="z-index:2000" v-if="huxingshow">
+    <div class="dialog" style="z-index: 2000" v-if="huxingshow">
       <Select
         :houseList="houseList"
         @updateList="updateHX"
@@ -138,10 +140,11 @@ import Combox from "@/components/shared/Combox";
 
 import {
   saveSomeData,
-  getPanoList,
+  getSearchPanoList,
   getHouseNameList,
   getHouseList,
   saveHouse,
+  savePanoHouse,
 } from "@/api";
 
 export default {
@@ -168,11 +171,15 @@ export default {
       houseActive: 0,
       houseDataActive: "",
       houseList: [],
-      hasChange:false,
+      hasChange: false,
       huxing: {
         sceneName: "",
         roomId: "",
       },
+      gardenHX: {
+        sceneName: "",
+        roomId: "",
+      },
       reNameItem: {
         id: "",
         reName: "",
@@ -186,6 +193,7 @@ export default {
         showSize: 8,
         current: 1,
       },
+      type: "",
     };
   },
   mounted() {
@@ -206,7 +214,7 @@ export default {
       });
       this.activeItem = tmp;
     },
-    "paging.pageNum": function() {
+    "paging.pageNum": function () {
       this.getHouseList();
     },
     showAddHouse(newVal) {
@@ -217,14 +225,12 @@ export default {
             size: 1000,
           },
           (res) => {
-            this.houseNameList = res.data
-              ? res.data.records
-              : [];
+            this.houseNameList = res.data ? res.data.records : [];
             if (this.huxing.roomId) {
               this.houseActive = this.houseNameList.findIndex(
                 (item) => this.huxing.roomId == item.id
               );
-            } 
+            }
             this.houseDataActive = this.houseNameList[this.houseActive];
           }
         );
@@ -234,6 +240,8 @@ export default {
       if (newVal) {
         this.searchKey = "";
         this.getPanoList();
+      } else {
+        this.activeId = "";
       }
     },
     huxingshow(newVal) {
@@ -245,12 +253,12 @@ export default {
     },
   },
   methods: {
-    updateHX(data){
-      this.hxsearchKey = data
+    updateHX(data) {
+      this.hxsearchKey = data;
       this.getHouseList();
     },
-    updateScene(data){
-      this.searchKey = data
+    updateScene(data) {
+      this.searchKey = data;
       this.getPanoList();
     },
     handleShow(data) {
@@ -261,20 +269,27 @@ export default {
       this.paging.pageNum = data;
     },
     handleAddvr(data) {
-      this.showAddHouse = true;
+      this.type = data.type;
       this.currentId = "";
-      this.huxing = {
-        sceneName: "",
-        roomId: "",
-      };
-
-      if (data) {
-        this.huxing.roomId = data.roomId;
-        this.huxing.sceneName = data.sceneTitle;
-        this.huxing.id = data.vrModelId;
-        this.huxing.webSite = data.webSite;
-        this.huxing.num = data.sceneCode;
-        this.currentId = data.id;
+      if (data.type == "house") {
+        this.showAddHouse = true;
+        this.huxing = {
+          sceneName: "",
+          roomId: "",
+        };
+        if (data.data) {
+          this.huxing.roomId = data.data.roomId;
+          this.huxing.sceneName = data.data.sceneTitle;
+          this.huxing.id = data.data.vrModelId;
+          this.huxing.webSite = data.data.webSite;
+          this.huxing.num = data.data.sceneCode;
+          this.currentId = data.data.id;
+        }
+      } else {
+        this.huxingshow = true;
+        if (data.data) {
+          this.currentId = data.data.id;
+        }
       }
     },
     getHouseList() {
@@ -295,7 +310,7 @@ export default {
     onHouseChange(data, index) {
       this.houseActive = index;
       this.houseDataActive = data;
-      this.hasChange = true
+      this.hasChange = true;
     },
     onRename(data) {
       this.reNameItem.id = data.id;
@@ -320,58 +335,92 @@ export default {
     },
 
     handleHouse() {
-        
-        if (!this.huxing.id||!(this.houseDataActive&&this.houseDataActive.id)) {
-          return this.$alert({ content: "请选择样板间名称和VR模型" });
-        }
+      if (
+        !this.huxing.id ||
+        !(this.houseDataActive && this.houseDataActive.id)
+      ) {
+        return this.$alert({ content: "请选择样板间名称和VR模型" });
+      }
 
-        if (!this.hasChange) {
-          return this.showAddHouse = false;
+      if (!this.hasChange) {
+        return (this.showAddHouse = false);
+      }
+
+      saveHouse(
+        {
+          icon: this.huxing.thumb,
+          roomId: this.houseDataActive && this.houseDataActive.id,
+          roomName: this.houseDataActive && this.houseDataActive.name,
+          id: this.currentId || null,
+          sceneTitle: this.huxing.sceneName,
+          vrModelId: this.huxing.id,
+          webSite: this.huxing.webSite,
+          sceneCode: this.huxing.num,
+        },
+        (res) => {
+          if (res.code == 0) {
+            this.$tips({
+              content: this.currentId ? "修改成功" : "添加成功",
+              icon: "ok",
+            });
+            this.hasChange = false;
+            this.huxingshow = false;
+            this.showAddHouse = false;
+            this.$bus.emit("refresh");
+          } else {
+            return this.$alert({ content: res.msg });
+          }
         }
-      
-        saveHouse(
-          {
-            icon: this.huxing.thumb,
-            roomId: (this.houseDataActive&&this.houseDataActive.id),
-            roomName: (this.houseDataActive&&this.houseDataActive.name),
-            id: this.currentId || null,
-            sceneTitle: this.huxing.sceneName,
-            vrModelId: this.huxing.id,
-            webSite: this.huxing.webSite,
-            sceneCode: this.huxing.num,
-          },
-          (res) => {
-            if (res.code == 0) {
-              this.$tips({
-                content: this.currentId ? "修改成功" : "添加成功",
-                icon: "ok",
-              });
-              this.hasChange = false
-              this.huxingshow = false;
-              this.showAddHouse = false;
-              this.$bus.emit("refresh");
-            } else {
-              return this.$alert({ content: res.msg });
-            }
+      );
+    },
+
+    handlePanoHouse() {
+      savePanoHouse(
+        {
+          icon: this.gardenHX.thumb,
+          fileName: this.gardenHX.sceneName,
+          id: this.currentId || null,
+          sceneTitle: this.gardenHX.sceneName,
+          vrModelId: this.gardenHX.id,
+          sceneCode: this.gardenHX.num,
+        },
+        (res) => {
+          if (res.code == 0) {
+            this.$tips({
+              content: this.currentId ? "修改成功" : "添加成功",
+              icon: "ok",
+            });
+            this.hasChange = false;
+            this.huxingshow = false;
+            this.$bus.emit("refresh");
+          } else {
+            return this.$alert({ content: res.msg });
           }
-        );
+        }
+      );
     },
     selectHX(data) {
-      this.hasChange = true
-      this.huxing = data;
+      this.hasChange = true;
       this.huxingshow = false;
+      if (this.type == "house") {
+        this.huxing = data;
+      } else {
+        this.gardenHX = data;
+        this.handlePanoHouse()
+      }
     },
+
     handelSelect() {
       this.$bus.emit("updateParams", {
         id: this.activeItem.id,
         isIndex: 1,
       });
-      this.$bus.emit('initScene',this.activeItem)
+      this.$bus.emit("initScene", this.activeItem);
       this.$bus.emit("getInitScene", this.activeItem);
       this.show = false;
     },
     getPanoList() {
-      getPanoList(
+      getSearchPanoList(
         {
           pageNum: 1,
           pageSize: 1000,