Parcourir la source

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/FD_Pano

任一存 il y a 3 ans
Parent
commit
db1da7bc08

+ 4 - 3
.env.prod

@@ -1,5 +1,6 @@
 VUE_APP_MAIN_COLOR=''
 VUE_APP_MAIN_COLOR=''
 VUE_APP_STATIC_DIR=static
 VUE_APP_STATIC_DIR=static
-VUE_APP_INNERNET=https://vr-mc01.fcb.com.cn
-VUE_APP_CDN=https://vr-oss01.fcb.com.cn
-VUE_APP_PROXY_URL=''
+VUE_APP_INNERNET=https://fcb.intranet.4dkankan.com
+VUE_APP_CDN=https://4dkk.4dage.com
+VUE_APP_PROXY_URL='http://www.4dkankan.com/qjkankan/'
+VUE_APP_URL_FILL=/qjkankan

+ 2 - 2
package.json

@@ -4,10 +4,10 @@
   "private": true,
   "private": true,
   "scripts": {
   "scripts": {
     "serve": "vue-cli-service serve",
     "serve": "vue-cli-service serve",
-    "serve-uat": "vue-cli-service serve --mode uat",
+    "serve-prod": "vue-cli-service serve --mode prod",
     "serve-local": "vue-cli-service serve --mode bendi",
     "serve-local": "vue-cli-service serve --mode bendi",
     "build": "vue-cli-service build",
     "build": "vue-cli-service build",
-    "build-uat": "vue-cli-service build --mode uat",
+    "build-prod": "vue-cli-service build --mode prod",
     "lint": "vue-cli-service lint"
     "lint": "vue-cli-service lint"
   },
   },
   "dependencies": {
   "dependencies": {

+ 1 - 1
public/showMobile.html

@@ -9,7 +9,7 @@
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfont/iconfont.css"/>
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfont/iconfont.css"/>
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontQJ1.1.0/iconfont.css"/>
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontQJ1.1.0/iconfont.css"/>
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontVR/iconfont.css"/>
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontVR/iconfont.css"/>
-    <link rel="stylesheet" href="//at.alicdn.com/t/font_2410347_4htx35g8w1b.css"/>
+    <link rel="stylesheet" href="//at.alicdn.com/t/font_2947721_fdnuf7rzr.css"/>
     <link rel="stylesheet" href="//at.alicdn.com/t/font_1064953_6ikt2gc1snb.css"/>
     <link rel="stylesheet" href="//at.alicdn.com/t/font_1064953_6ikt2gc1snb.css"/>
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/animate/animate.min.css" />
     <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/animate/animate.min.css" />
     <link rel="icon" href="./favicon.ico" />
     <link rel="icon" href="./favicon.ico" />

+ 4 - 2
src/api/index.js

@@ -18,7 +18,9 @@ const CLIENT_CODE =  config.client_code
 const URL_FILL =  config.urlFill
 const URL_FILL =  config.urlFill
 
 
 
 
+let ossUrl = config.CDN
 
 
+// https://ossxiaoan.4dage.com/720yun_fd_manage
 
 
 
 
 /**
 /**
@@ -28,8 +30,7 @@ const URL_FILL =  config.urlFill
  * @param {*} no 
  * @param {*} no 
  */
  */
  export function getPanoInfo(data, ok, no) {
  export function getPanoInfo(data, ok, no) {
-    let ossUrl = `https://ossxiaoan.4dage.com/720yun_fd_manage`
-    return http.get(`${ossUrl}/${data||number()}/someData.json?_=${Math.random()}`, {}, ok, no)
+    return http.get(`${ossUrl}/720yun_fd_manage/${data||number()}/someData.json?_=${Math.random()}`, {}, ok, no)
 }
 }
 
 
 
 
@@ -560,6 +561,7 @@ export function setListSort(data, ok, no) {
  */
  */
  export function saveWorks(data, ok, no) {
  export function saveWorks(data, ok, no) {
     data.id = number()
     data.id = number()
+
     return http.postJson(`${URL_FILL}/manage/work/edit`, data, ok, no)
     return http.postJson(`${URL_FILL}/manage/work/edit`, data, ok, no)
 }
 }
 
 

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


+ 4 - 3
src/components/audio/index.vue

@@ -224,13 +224,13 @@ export default {
   text-overflow: ellipsis;
   text-overflow: ellipsis;
   overflow: hidden;
   overflow: hidden;
   white-space: nowrap;
   white-space: nowrap;
-  flex: 2;
+  flex: 3;
   margin-right: 10px;
   margin-right: 10px;
 }
 }
 
 
 .audio-right {
 .audio-right {
   height: 100%;
   height: 100%;
-  flex: 1;
+  flex: 2;
 
 
 }
 }
 
 
@@ -262,6 +262,7 @@ export default {
   background-size: contain;
   background-size: contain;
   background-image: url('~@/assets/images/icons/icon-music@2x.png');
   background-image: url('~@/assets/images/icons/icon-music@2x.png');
   width: 44px;
   width: 44px;
+  min-width: 44px;
   height: 50px;
   height: 50px;
   cursor: pointer;
   cursor: pointer;
   &:hover, &--playing {
   &:hover, &--playing {
@@ -311,7 +312,7 @@ export default {
 .namecon{
 .namecon{
   margin-left: 20px;
   margin-left: 20px;
   display: flex;
   display: flex;
-  width: 100%;
+  width: calc(100% - 60px);
   justify-content: space-between;
   justify-content: space-between;
   align-items: center;
   align-items: center;
 }
 }

+ 3 - 2
src/components/select.vue

@@ -147,18 +147,19 @@ components: {tabList},
       childTab:[],
       childTab:[],
       scenes:[],
       scenes:[],
       filterScenes:[],
       filterScenes:[],
+      isClickSearch:'',
       key: ""
       key: ""
     };
     };
   },
   },
 
 
   methods: {
   methods: {
     search(){
     search(){
-      this.filterScenes = this.scenes.filter(item=>{
-        console.log(item.sceneTitle);
+      let tmp = this.scenes.filter(item=>{
         if (item.sceneTitle.indexOf(this.key)>-1) {
         if (item.sceneTitle.indexOf(this.key)>-1) {
           return item
           return item
         }
         }
       })
       })
+      this.filterScenes = tmp.sort((a,b)=>a.weight-b.weight)
     },
     },
     getTabSceneList(catalogId=null){
     getTabSceneList(catalogId=null){
       if (!catalogId) {
       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);
     retCtx.drawImage(canvas, 0, 0, w, h, 0, 0, width, height);
     return retCanvas;
     return retCanvas;
   }
   }
+  
   getDataURL (canvas, type, width, height) {
   getDataURL (canvas, type, width, height) {
     let cas = this.scaleCanvas(canvas, width, height);
     let cas = this.scaleCanvas(canvas, width, height);
     return cas.toDataURL(type, 1);
     return cas.toDataURL(type, 1);
@@ -173,10 +174,14 @@ export default class Utils {
    */
    */
 
 
   initHotspot(krpano,someData,type){
   initHotspot(krpano,someData,type){
+
     if (!someData) {
     if (!someData) {
       return 
       return 
     }
     }
-    let mysd = JSON.parse(someData)
+    let mysd = someData
+    if (typeof someData == 'string') {
+      mysd =  JSON.parse(someData)
+    }
     mysd.hotspots.forEach(item => {
     mysd.hotspots.forEach(item => {
       this.addhotspot(krpano,item,type)
       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 { mapGetters } from "vuex";
 // import config from '@/config'
 // import config from '@/config'
 import preview from "@/components/preview";
 import preview from "@/components/preview";
+let hhhreg = /\\\\\\\\/g
 
 
 export default {
 export default {
   name: "app-head",
   name: "app-head",
@@ -85,6 +86,13 @@ export default {
         return;
         return;
       }
       }
       this.fixData()
       this.fixData()
+      this.info.scenes = this.info.scenes.map(item=>{
+        if (typeof item.someData == 'string') {
+          item.someData =  item.someData.replace(hhhreg,'')
+        }
+        return item
+      })
+
       saveWorks(
       saveWorks(
         {
         {
           password: this.info.password,
           password: this.info.password,
@@ -175,6 +183,15 @@ export default {
         return;
         return;
       }
       }
       this.fixData();
       this.fixData();
+
+
+      this.info.scenes = this.info.scenes.map(item=>{
+        if (typeof item.someData == 'string') {
+          item.someData =  item.someData.replace(hhhreg,'')
+        }
+        return item
+      })
+
       saveWorks(
       saveWorks(
         {
         {
           password: this.info.password,
           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) => {
       this.showInfo.catalogRoot = rootmp.map((item) => {
         let temp = [];
         let temp = [];
         item.children = this.$unique(item.children)
         item.children = this.$unique(item.children)
@@ -335,6 +332,7 @@ export default {
     },
     },
     activeItem: {
     activeItem: {
       handler(newVal) {
       handler(newVal) {
+        this.currentHotspot = ''
         $("#pano").empty();
         $("#pano").empty();
         window.vrInitFn = () => {
         window.vrInitFn = () => {
           $smallWaiting.hide()
           $smallWaiting.hide()
@@ -383,8 +381,12 @@ export default {
     window.__krfn = __krfn;
     window.__krfn = __krfn;
 
 
     this.$bus.on("clickHotspot", (data) => {
     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);
       let idx = someData.hotspots.findIndex((item) => item.name == data);
+
       this.currentHotspot = someData.hotspots[idx];
       this.currentHotspot = someData.hotspots[idx];
     });
     });
     this.getSceneInfo();
     this.getSceneInfo();

+ 2 - 2
src/framework/show/list.vue

@@ -7,7 +7,7 @@
             <li class="swiper-slide" :title="item.sceneTitle" @click="handleVR(item,i)" v-for="(item, i) in scenes" :key="i">
             <li class="swiper-slide" :title="item.sceneTitle" @click="handleVR(item,i)" v-for="(item, i) in scenes" :key="i">
               <div :class="{ active: selected.sceneCode == item.sceneCode }">
               <div :class="{ active: selected.sceneCode == item.sceneCode }">
                 <img :src="item.icon + `?${Math.random()}`" alt="" />
                 <img :src="item.icon + `?${Math.random()}`" alt="" />
-                <i class="iconfont iconedit_type_3d" :class="{ iconedit_type_panorama: item.type !== '4dkk' }"></i>
+                <i class="iconfont icon-edit_type_3d" :class="{ iconedit_type_panorama: item.type !== '4dkk' }"></i>
                 <rollName :offset="20" :active="selected.sceneCode == item.sceneCode" class="pic-name" :myref="'subw' + item.id" :name="item.sceneTitle" />
                 <rollName :offset="20" :active="selected.sceneCode == item.sceneCode" class="pic-name" :myref="'subw' + item.id" :name="item.sceneTitle" />
               </div>
               </div>
             </li>
             </li>
@@ -32,7 +32,7 @@
       </div>
       </div>
 
 
       <div class="clip-scroller" ref="sw2" v-swiper:mySwiperb="swiperOptions" v-if="showInfo.catalogRoot.length > 0 && showInfo.catalogs.length > 1">
       <div class="clip-scroller" ref="sw2" v-swiper:mySwiperb="swiperOptions" v-if="showInfo.catalogRoot.length > 0 && showInfo.catalogs.length > 1">
-        <ul class="tap  swiper-wrapper" v-if="showInfo.catalogRoot.length > 1">
+        <ul class="tap swiper-wrapper" v-if="showInfo.catalogRoot.length > 1">
           <li  class="swiper-slide" @click="handleTabone(item,i)" :class="{ active: item.id == taboneActive.id }" v-for="(item, i) in showInfo.catalogRoot" :key="i">
           <li  class="swiper-slide" @click="handleTabone(item,i)" :class="{ active: item.id == taboneActive.id }" v-for="(item, i) in showInfo.catalogRoot" :key="i">
             <rollName
             <rollName
               :offset="30"
               :offset="30"

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

@@ -7,6 +7,7 @@
 
 
 <script>
 <script>
 import Header from "./ui/Show.Header";
 import Header from "./ui/Show.Header";
+import browser from "@/utils/browser"
 
 
 export default {
 export default {
   props:['url'],
   props:['url'],
@@ -27,6 +28,20 @@ export default {
           this.$bus.emit('guideRoomsData',e.data.params)
           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") {
         // if (e.data.event == "guide-status") {
         // }
         // }
 
 

+ 27 - 7
src/framework/showMobile/index.vue

@@ -3,9 +3,13 @@
     <template v-if="showInfo">
     <template v-if="showInfo">
       <v-ifr
       <v-ifr
         v-if="activeItem.type == '4dkk'"
         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 v-show="activeItem.type != '4dkk'" id="pano"></div>
       
       
       <div
       <div
@@ -83,7 +87,7 @@
       </popup>
       </popup>
 
 
       <div v-if="audioUrl" class="audio-btn" @click="audioUrl = ''">
       <div v-if="audioUrl" class="audio-btn" @click="audioUrl = ''">
-        <i class="iconfont iconedit_soundview"></i>
+        <i class="iconfont icon-edit_soundview"></i>
         停止播放
         停止播放
         <v-audio
         <v-audio
           v-if="audioUrl"
           v-if="audioUrl"
@@ -164,19 +168,30 @@ export default {
       currentHotspot: "",
       currentHotspot: "",
       list: [],
       list: [],
       loadFinish: false,
       loadFinish: false,
+      embeM:null,
+      otherLink:null,
+      rnd:null,
       aside: [
       aside: [
         {
         {
           id: "about",
           id: "about",
-          icon: "icontool_about",
+          icon: "icon-tool_about",
         },
         },
         {
         {
           id: "vr",
           id: "vr",
-          icon: "icontool_vr",
+          icon: "icon-tool_vr",
         },
         },
       ],
       ],
     };
     };
   },
   },
   methods: {
   methods: {
+    handleOther(data){
+      this.otherLink=data
+      this.rnd = Math.random()
+    },
+    handleChange(data){
+      this.embeM=data
+      this.rnd = Math.random()
+    },
     getSceneInfomation(){
     getSceneInfomation(){
       getSceneInfomation({id:this.activeItem.sceneCode}, (data) => {
       getSceneInfomation({id:this.activeItem.sceneCode}, (data) => {
         this.mapvisit = data.data.mapVisi
         this.mapvisit = data.data.mapVisi
@@ -386,6 +401,8 @@ export default {
       handler(newVal) {
       handler(newVal) {
         this.$nextTick(() => {
         this.$nextTick(() => {
           if (newVal.type == "4dkk") {
           if (newVal.type == "4dkk") {
+            this.embeM = null;
+            this.otherLink = null;
             removepano("#pano");
             removepano("#pano");
             $("#pano").empty();
             $("#pano").empty();
             this.getSceneInfomation()
             this.getSceneInfomation()
@@ -435,7 +452,10 @@ export default {
   mounted() {
   mounted() {
     window.__krfn = __krfn;
     window.__krfn = __krfn;
     this.$bus.on("clickHotspot", (data) => {
     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);
       let idx = someData.hotspots.findIndex((item) => item.name == data);
       this.currentHotspot = someData.hotspots[idx];
       this.currentHotspot = someData.hotspots[idx];
     });
     });
@@ -511,7 +531,7 @@ export default {
       border: 1px solid #0076F6;
       border: 1px solid #0076F6;
       color: #0076F6;
       color: #0076F6;
     }
     }
-    .iconedit_soundview{
+    .icon-edit_soundview{
       color: #0076F6;
       color: #0076F6;
       margin-right: 10px;
       margin-right: 10px;
     }
     }

+ 15 - 13
src/framework/showMobile/list.vue

@@ -8,7 +8,7 @@
             <li class="swiper-slide" @click="handleVR(item,i)" v-for="(item,i) in scenes" :key="i">
             <li class="swiper-slide" @click="handleVR(item,i)" v-for="(item,i) in scenes" :key="i">
               <div :class="{active:selected.sceneCode==item.sceneCode}">
               <div :class="{active:selected.sceneCode==item.sceneCode}">
                 <img :src="item.icon+`?${Math.random()}`" alt="" />
                 <img :src="item.icon+`?${Math.random()}`" alt="" />
-                <i class="iconfont" :class="item.type!='4dkk'?'iconedit_type_panorama':'iconedit_type_3d'"></i>
+                <i class="iconfont" :class="item.type!='4dkk'?'icon-edit_type_panorama':'icon-edit_type_3d'"></i>
                 <rollName :offset="20" :active="selected.sceneCode==item.sceneCode" class="pic-name" :myref="'subw'+item.id" :name="item.sceneTitle"/>
                 <rollName :offset="20" :active="selected.sceneCode==item.sceneCode" class="pic-name" :myref="'subw'+item.id" :name="item.sceneTitle"/>
               </div>
               </div>
             </li>
             </li>
@@ -37,12 +37,12 @@
 
 
     <div v-if="selected.type=='4dkk' && isShowDL" class="menu">
     <div v-if="selected.type=='4dkk' && isShowDL" class="menu">
         <div  @click="handleDL" v-if="isShowDL">
         <div  @click="handleDL" v-if="isShowDL">
-            <i class="iconfont" :class="isDaolan?'iconshow_suspension':'iconshow_playback'"></i>
+            <i class="iconfont" :class="isDaolan?'icon-show_suspension':'icon-show_playback'"></i>
         </div>
         </div>
     </div>
     </div>
 
 
     <div class="btn dl" :class="{deepbg:showList}" v-if="!(showInfo.catalogRoot.length == 1 && scenes.length == 1 && showInfo.catalogs.length == 1)" @click="showList = !showList">
     <div class="btn dl" :class="{deepbg:showList}" v-if="!(showInfo.catalogRoot.length == 1 && scenes.length == 1 && showInfo.catalogs.length == 1)" @click="showList = !showList">
-      <i class="iconfont " :class="showList?'iconnav_scene_down':'iconnav_scene_up'"></i>场景导航
+      <i class="iconfont " :class="showList?'icon-nav_scene_down':'icon-nav_scene_up'"></i>场景导航
     </div>
     </div>
 
 
   
   
@@ -67,20 +67,20 @@ export default {
     let menu = [{
     let menu = [{
       id:'pano',
       id:'pano',
       name:'漫游',
       name:'漫游',
-      icon:'iconshow_roaming_normal',
-      active:'iconshow_roaming_selected',
+      icon:'icon-show_roaming_normal',
+      active:'icon-show_roaming_selected',
       params:'pano'
       params:'pano'
     },{
     },{
       id:'2d',
       id:'2d',
       name:'平面',
       name:'平面',
-      icon:'iconshow_plane_normal',
-      active:'iconshow_plane_selected',
+      icon:'icon-show_plane_normal',
+      active:'icon-show_plane_selected',
       params:'2d'
       params:'2d'
     },{
     },{
       id:'3d',
       id:'3d',
       name:'三维',
       name:'三维',
-      icon:'iconshow_3d_normal',
-      active:'iconshow_3d_selected',
+      icon:'icon-show_3d_normal',
+      active:'icon-show_3d_selected',
       params:'3d'
       params:'3d'
     }]
     }]
     return{
     return{
@@ -164,7 +164,6 @@ export default {
      fixPosit(ref,i,prenum,nexnum){
      fixPosit(ref,i,prenum,nexnum){
          if (i!==null) {
          if (i!==null) {
         let acidx = this.$refs[ref].swiper.activeIndex
         let acidx = this.$refs[ref].swiper.activeIndex
-        console.log(this.$refs[ref].swiper.activeIndex);
         if (i - acidx > nexnum ) {
         if (i - acidx > nexnum ) {
           this.$refs[ref].swiper.slideNext()
           this.$refs[ref].swiper.slideNext()
         }
         }
@@ -251,9 +250,12 @@ export default {
     selected:{
     selected:{
       handler:function (newVal) {
       handler:function (newVal) {
         this.handleVR(newVal)
         this.handleVR(newVal)
-        // if (newVal.type == '4dkk') {
-        //   this.showList = false
-        // }
+        if (newVal.type == '4dkk') {
+          this.showList = true
+          setTimeout(() => {
+            this.showList = false
+          }, 800);
+        }
       }
       }
     }
     }
   }
   }

+ 1 - 1
src/framework/showMobile/ui/Show.Header.vue

@@ -15,7 +15,7 @@
                 <span>
                 <span>
                     {{params.title}}
                     {{params.title}}
                 </span>
                 </span>
-                <i class="iconfont iconshow_drop-down"></i>
+                <i class="iconfont icon-show_drop-down"></i>
             </div>
             </div>
         </div>
         </div>
         <div
         <div

+ 19 - 0
src/utils/browser.js

@@ -228,6 +228,25 @@ var browser = {
           return false
           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 
    * @param {String} key 

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

@@ -91,9 +91,25 @@ export default {
       immediate: true,
       immediate: true,
       handler: function(newVal) {
       handler: function(newVal) {
         this.someData = newVal.someData || "";
         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) {
     showPanel(newVal) {
@@ -168,7 +184,7 @@ export default {
         this.someData.hotspots[idx] = data
         this.someData.hotspots[idx] = data
       }
       }
 
 
-      this.activeItem.someData = JSON.stringify(this.someData);
+      this.activeItem.someData = this.someData;
       this.$msg.success(this.editTitle + "成功")
       this.$msg.success(this.editTitle + "成功")
 
 
       let iidx = this.info.scenes.findIndex(item=>this.activeItem.sceneCode == item.sceneCode)
       let iidx = this.info.scenes.findIndex(item=>this.activeItem.sceneCode == item.sceneCode)
@@ -187,7 +203,7 @@ export default {
         1
         1
       );
       );
       this.deleteKRHotspot(data);
       this.deleteKRHotspot(data);
-      this.activeItem.someData = JSON.stringify(this.someData);
+      this.activeItem.someData = this.someData;
       this.updateInfo()
       this.updateInfo()
       this.$msg.success("删除成功")
       this.$msg.success("删除成功")
     },
     },

+ 46 - 24
src/views/material/popup/share.vue

@@ -1,9 +1,6 @@
 <template>
 <template>
   <popup v-if="show">
   <popup v-if="show">
-    <div
-      class="ui-message ui-message-confirm message-material"
-      style="width: 500px"
-    >
+    <div class="ui-message ui-message-confirm message-material" style="width: 500px">
       <div class="ui-message-header header-material">
       <div class="ui-message-header header-material">
         <span>分享</span>
         <span>分享</span>
         <span @click="$emit('close')">
         <span @click="$emit('close')">
@@ -14,15 +11,7 @@
         <ul>
         <ul>
           <li>
           <li>
             <span>作品链接</span>
             <span>作品链接</span>
-            <input
-              :title="item.share"
-              class="ui-input"
-              disabled
-              type="text"
-              maxlength="15"
-              placeholder="输入名字"
-              v-model="item.share"
-            />
+            <input :title="item.share" class="ui-input" disabled type="text" maxlength="15" placeholder="输入名字" v-model="item.share" />
           </li>
           </li>
           <li>
           <li>
             <span>作品二维码</span>
             <span>作品二维码</span>
@@ -30,7 +19,7 @@
           </li>
           </li>
         </ul>
         </ul>
       </div>
       </div>
-      
+
       <div class="ui-message-footer footer-material">
       <div class="ui-message-footer footer-material">
         <button @click="downloadImg(item)" class="ui-button">
         <button @click="downloadImg(item)" class="ui-button">
           下载二维码
           下载二维码
@@ -46,6 +35,18 @@
 <script>
 <script>
 import Popup from "@/components/shared/popup";
 import Popup from "@/components/shared/popup";
 
 
+let dataUrlToBold = function(url) {
+  let arr = url.split(","),
+    mime = arr[0].match(/:(.*?);/)[1],
+    bStr = atob(arr[1]),
+    n = bStr.length,
+    u8arr = new Uint8Array(n);
+  while (n--) {
+    u8arr[n] = bStr.charCodeAt(n);
+  }
+  return new Blob([u8arr], { type: mime });
+};
+
 export default {
 export default {
   props: ["show", "item"],
   props: ["show", "item"],
   components: {
   components: {
@@ -59,11 +60,34 @@ export default {
   mounted() {},
   mounted() {},
   methods: {
   methods: {
     downloadImg(workItem) {
     downloadImg(workItem) {
-      var a = document.createElement("a");
-      var event = new MouseEvent("click");
-      a.download = workItem.name;
-      a.href = workItem.qrCode;
-      a.dispatchEvent(event);
+      let val = workItem.qrCode
+      // var a = document.createElement("a");
+      // a.download = 'qrcode';
+      // a.href = 'https://4dkk.4dage.com/720yun_fd_manage/620/qrCode.jpg';
+      // a.target
+      // console.log(workItem,11222);
+      // val 为传入的图片地址
+      let _type_index = val.lastIndexOf(".");
+      let _type = val.substr(_type_index + 1); //原始图片类型
+      let image = new Image();
+      image.setAttribute("crossOrigin", "anonymous"); //消除跨域
+      image.src = val;
+      image.onload = function() {
+        //借助canvas实现 消除 图片地址会先直接窗口打开图片地址
+        let canvas = document.createElement("canvas");
+        canvas.width = image.width;
+        canvas.height = image.height;
+        let context = canvas.getContext("2d");
+        context.drawImage(image, 0, 0, image.width, image.height);
+        let url = canvas.toDataURL("image/" + _type);
+        let blob = dataUrlToBold(url);
+        let obj_url = URL.createObjectURL(blob); // 消除Chrome下文件太大 导致下载失败(网络失败)的问题
+        let a = document.createElement("a");
+        let event = new MouseEvent("click");
+        a.download = workItem.name || "qrcode";
+        a.href = obj_url;
+        a.dispatchEvent(event);
+      };
     },
     },
     copy(text) {
     copy(text) {
       var textArea = document.createElement("textarea");
       var textArea = document.createElement("textarea");
@@ -85,11 +109,9 @@ export default {
       textArea.select();
       textArea.select();
 
 
       try {
       try {
-        document.execCommand("copy")
-          ? this.$msg.success("复制成功")
-          : this.$msg.error("复制失败");
+        document.execCommand("copy") ? this.$msg.success("复制成功") : this.$msg.error("复制失败");
       } catch (err) {
       } catch (err) {
-        this.$msg.error("复制失败")
+        this.$msg.error("复制失败");
       }
       }
 
 
       document.body.removeChild(textArea);
       document.body.removeChild(textArea);
@@ -125,7 +147,7 @@ export default {
         }
         }
         > img {
         > img {
           width: 120px;
           width: 120px;
-          border: 1px solid #EBEDF0;
+          border: 1px solid #ebedf0;
           border-radius: 4px;
           border-radius: 4px;
         }
         }
         .ui-input {
         .ui-input {