tremble hace 3 años
padre
commit
d0814a63b0

+ 1 - 0
src/api/index.js

@@ -561,6 +561,7 @@ export function setListSort(data, ok, no) {
  */
  export function saveWorks(data, ok, no) {
     data.id = number()
+
     return http.postJson(`${URL_FILL}/manage/work/edit`, data, ok, no)
 }
 

BIN
src/assets/images/default/img_logoshow@2x.png


+ 3 - 2
src/components/select.vue

@@ -147,18 +147,19 @@ components: {tabList},
       childTab:[],
       scenes:[],
       filterScenes:[],
+      isClickSearch:'',
       key: ""
     };
   },
 
   methods: {
     search(){
-      this.filterScenes = this.scenes.filter(item=>{
-        console.log(item.sceneTitle);
+      let tmp = this.scenes.filter(item=>{
         if (item.sceneTitle.indexOf(this.key)>-1) {
           return item
         }
       })
+      this.filterScenes = tmp.sort((a,b)=>a.weight-b.weight)
     },
     getTabSceneList(catalogId=null){
       if (!catalogId) {

+ 6 - 1
src/core/utils.js

@@ -41,6 +41,7 @@ export default class Utils {
     retCtx.drawImage(canvas, 0, 0, w, h, 0, 0, width, height);
     return retCanvas;
   }
+  
   getDataURL (canvas, type, width, height) {
     let cas = this.scaleCanvas(canvas, width, height);
     return cas.toDataURL(type, 1);
@@ -173,10 +174,14 @@ export default class Utils {
    */
 
   initHotspot(krpano,someData,type){
+
     if (!someData) {
       return 
     }
-    let mysd = JSON.parse(someData)
+    let mysd = someData
+    if (typeof someData == 'string') {
+      mysd =  JSON.parse(someData)
+    }
     mysd.hotspots.forEach(item => {
       this.addhotspot(krpano,item,type)
     });

+ 17 - 0
src/framework/Head.vue

@@ -28,6 +28,7 @@ import { saveWorks, getPanoInfo, checkLogin } from "@/api";
 import { mapGetters } from "vuex";
 // import config from '@/config'
 import preview from "@/components/preview";
+let hhhreg = /\\\\\\\\/g
 
 export default {
   name: "app-head",
@@ -85,6 +86,13 @@ export default {
         return;
       }
       this.fixData()
+      this.info.scenes = this.info.scenes.map(item=>{
+        if (typeof item.someData == 'string') {
+          item.someData =  item.someData.replace(hhhreg,'')
+        }
+        return item
+      })
+
       saveWorks(
         {
           password: this.info.password,
@@ -175,6 +183,15 @@ export default {
         return;
       }
       this.fixData();
+
+
+      this.info.scenes = this.info.scenes.map(item=>{
+        if (typeof item.someData == 'string') {
+          item.someData =  item.someData.replace(hhhreg,'')
+        }
+        return item
+      })
+
       saveWorks(
         {
           password: this.info.password,

+ 6 - 4
src/framework/show/index.vue

@@ -217,9 +217,6 @@ export default {
       })
 
 
-      console.log(rootmp,666666);
-
-
       this.showInfo.catalogRoot = rootmp.map((item) => {
         let temp = [];
         item.children = this.$unique(item.children)
@@ -335,6 +332,7 @@ export default {
     },
     activeItem: {
       handler(newVal) {
+        this.currentHotspot = ''
         $("#pano").empty();
         window.vrInitFn = () => {
           $smallWaiting.hide()
@@ -383,8 +381,12 @@ export default {
     window.__krfn = __krfn;
 
     this.$bus.on("clickHotspot", (data) => {
-      let someData = JSON.parse(this.activeItem.someData);
+      let someData = this.activeItem.someData
+      if (typeof someData == 'string') {
+        someData = JSON.parse(this.activeItem.someData);
+      }
       let idx = someData.hotspots.findIndex((item) => item.name == data);
+
       this.currentHotspot = someData.hotspots[idx];
     });
     this.getSceneInfo();

+ 15 - 0
src/framework/showMobile/iframe.vue

@@ -7,6 +7,7 @@
 
 <script>
 import Header from "./ui/Show.Header";
+import browser from "@/utils/browser"
 
 export default {
   props:['url'],
@@ -27,6 +28,20 @@ export default {
           this.$bus.emit('guideRoomsData',e.data.params)
         }
 
+          if (e.data.event == "link-click") {
+            if (e.data.params.url.indexOf('https://www.4dkankan.com/spc.html?')>-1
+            ||e.data.params.url.indexOf('https://www.4dkankan.com/smobile.html?')>-1
+            ||e.data.params.url.indexOf('https://test.4dkankan.com/spc.html?')>-1
+            ||e.data.params.url.indexOf('https://test.4dkankan.com/smobile.html?')>-1) {
+              let m = browser.urlHasValueFromUrl('m',e.data.params.url)
+              console.log(m);
+              this.$emit('changeUrl',m)
+            } else{
+              this.$emit('otherUrl',e.data.params.url)
+            }
+
+        }
+
         // if (e.data.event == "guide-status") {
         // }
 

+ 23 - 3
src/framework/showMobile/index.vue

@@ -3,9 +3,13 @@
     <template v-if="showInfo">
       <v-ifr
         v-if="activeItem.type == '4dkk'"
-        :key="activeItem.sceneCode"
-        :url="`/embed.html?from=mingyuan&m=${activeItem.sceneCode}&lang=zh`"
+        @changeUrl="handleChange"
+        @otherUrl="handleOther"
+        :key="embeM||activeItem.sceneCode"
+        :url="otherLink?otherLink:`/embed.html?from=mingyuan&m=${embeM||activeItem.sceneCode}&lang=zh&scene-link=1&rnd=${rnd}`"
       />
+        <!-- -->
+
       <div v-show="activeItem.type != '4dkk'" id="pano"></div>
       
       <div
@@ -164,6 +168,9 @@ export default {
       currentHotspot: "",
       list: [],
       loadFinish: false,
+      embeM:null,
+      otherLink:null,
+      rnd:null,
       aside: [
         {
           id: "about",
@@ -177,6 +184,14 @@ export default {
     };
   },
   methods: {
+    handleOther(data){
+      this.otherLink=data
+      this.rnd = Math.random()
+    },
+    handleChange(data){
+      this.embeM=data
+      this.rnd = Math.random()
+    },
     getSceneInfomation(){
       getSceneInfomation({id:this.activeItem.sceneCode}, (data) => {
         this.mapvisit = data.data.mapVisi
@@ -386,6 +401,8 @@ export default {
       handler(newVal) {
         this.$nextTick(() => {
           if (newVal.type == "4dkk") {
+            this.embeM = null;
+            this.otherLink = null;
             removepano("#pano");
             $("#pano").empty();
             this.getSceneInfomation()
@@ -435,7 +452,10 @@ export default {
   mounted() {
     window.__krfn = __krfn;
     this.$bus.on("clickHotspot", (data) => {
-      let someData = JSON.parse(this.activeItem.someData);
+       let someData = this.activeItem.someData
+      if (typeof someData == 'string') {
+        someData = JSON.parse(this.activeItem.someData);
+      }
       let idx = someData.hotspots.findIndex((item) => item.name == data);
       this.currentHotspot = someData.hotspots[idx];
     });

+ 6 - 4
src/framework/showMobile/list.vue

@@ -164,7 +164,6 @@ export default {
      fixPosit(ref,i,prenum,nexnum){
          if (i!==null) {
         let acidx = this.$refs[ref].swiper.activeIndex
-        console.log(this.$refs[ref].swiper.activeIndex);
         if (i - acidx > nexnum ) {
           this.$refs[ref].swiper.slideNext()
         }
@@ -251,9 +250,12 @@ export default {
     selected:{
       handler:function (newVal) {
         this.handleVR(newVal)
-        // if (newVal.type == '4dkk') {
-        //   this.showList = false
-        // }
+        if (newVal.type == '4dkk') {
+          this.showList = true
+          setTimeout(() => {
+            this.showList = false
+          }, 800);
+        }
       }
     }
   }

+ 19 - 0
src/utils/browser.js

@@ -228,6 +228,25 @@ var browser = {
           return false
       }
   },
+
+  urlHasValueFromUrl: function(paraName,url) {
+    // 如果url中有特殊字符则需要进行一下解码
+    url = decodeURI(url)
+    var arrObj = url.split("?");
+    if (arrObj.length > 1) {
+        var arrPara = arrObj[1].split("&");
+        var arr;
+        for (var i = 0; i < arrPara.length; i++) {
+            arr = arrPara[i].split("=");
+            if (arr != null && arr[0] == paraName) {
+            return decodeURIComponent(arr[1]);
+            }
+        }
+        return "";
+    } else {
+        return "";
+    }
+    },
   /**
    * 获取查询参数的值
    * @param {String} key 

+ 21 - 5
src/views/hotspot/Setting.vue

@@ -91,9 +91,25 @@ export default {
       immediate: true,
       handler: function(newVal) {
         this.someData = newVal.someData || "";
-        this.someData = this.someData
-          ? JSON.parse(this.someData)
-          : { hotspots: [] };
+
+        if (this.someData) {
+          if (typeof this.someData == 'string') {
+       
+              try {
+                  this.someData = JSON.parse(this.someData)
+              } catch(e) {
+                  console.log(e);
+                  return false;
+              }
+          }
+          if (!this.someData.hotspots) {
+            this.someData.hotspots = []
+          }
+        }
+        else{
+          this.someData = { hotspots: [] }
+        }
+        console.log(this.someData.hotspots,111111);
       },
     },
     showPanel(newVal) {
@@ -168,7 +184,7 @@ export default {
         this.someData.hotspots[idx] = data
       }
 
-      this.activeItem.someData = JSON.stringify(this.someData);
+      this.activeItem.someData = this.someData;
       this.$msg.success(this.editTitle + "成功")
 
       let iidx = this.info.scenes.findIndex(item=>this.activeItem.sceneCode == item.sceneCode)
@@ -187,7 +203,7 @@ export default {
         1
       );
       this.deleteKRHotspot(data);
-      this.activeItem.someData = JSON.stringify(this.someData);
+      this.activeItem.someData = this.someData;
       this.updateInfo()
       this.$msg.success("删除成功")
     },