gemercheung 2 年之前
父節點
當前提交
0984a16ae0

+ 2 - 1
packages/qjkankan-editor/.env.eurtestprod

@@ -7,4 +7,5 @@ VUE_APP_PROXY_URL_ROOT='https://testeur.4dkankan.com'
 VUE_APP_PROXY_URL='https://testeur.4dkankan.com/qjkankan/'
 VUE_APP_ORIGIN=aws
 
-VUE_APP_URL_FILL=/qjkankan
+VUE_APP_URL_FILL=/qjkankan
+VUE_APP_DEBBUG_FLAG=0516-01

+ 238 - 238
packages/qjkankan-editor/public/static/template/static/js/vrshow.js

@@ -6,36 +6,36 @@ var _userList;
 var plugins_init_function = new Array();//接收显示时的init方法
 
 //krpano loadcomplete调用
-function showPanoBtns(sceneCount){
+function showPanoBtns(sceneCount) {
     if (sceneCount > 1) {
         $(".vrshow_container_3_min .img_desc_container_min:eq(0)").show();
-    }else{
+    } else {
         $(".vrshow_container_3_min .img_desc_container_min:eq(0)").hide();
     }
     $("#panoBtns").show();
 }
 
-function fullscreen(el){
+function fullscreen(el) {
     //krpano.call("switch(fullscreen);");
     //launchFullScreen(document.documentElement);
-    if($(el).hasClass('btn_fullscreen')){
+    if ($(el).hasClass('btn_fullscreen')) {
         launchFullScreen(document.getElementById('fullscreenid'));
         var krpano = document.getElementById('krpanoSWFObject');
         krpano.call("skin_showthumbs(false);");
-    }else{
+    } else {
         exitFullscreen();
     }
     toggleFullscreenBtn(el);
 }
 
 function launchFullScreen(element) {
-    if(element.requestFullscreen) {
+    if (element.requestFullscreen) {
         element.requestFullscreen();
-    } else if(element.mozRequestFullScreen) {
+    } else if (element.mozRequestFullScreen) {
         element.mozRequestFullScreen();
-    } else if(element.webkitRequestFullscreen) {
+    } else if (element.webkitRequestFullscreen) {
         element.webkitRequestFullscreen();
-    } else if(element.msRequestFullscreen) {
+    } else if (element.msRequestFullscreen) {
         element.msRequestFullscreen();
     }
 }
@@ -55,27 +55,27 @@ function exitFullscreen() {
     }
 }
 
-function toggleFullscreenBtn(el){
-    if($(el).hasClass("btn_fullscreen")){
+function toggleFullscreenBtn(el) {
+    if ($(el).hasClass("btn_fullscreen")) {
         $(el).removeClass("btn_fullscreen");
         $(el).addClass("btn_fullscreen_off");
-    }else{
+    } else {
         $(el).removeClass("btn_fullscreen_off");
         $(el).addClass("btn_fullscreen");
     }
 }
 
-function toggleBtns(flag){
-    if(flag){
+function toggleBtns(flag) {
+    if (flag) {
         $("#panoBtns").show();
-    }else{
+    } else {
         $("#panoBtns").hide();
         var krpano = document.getElementById('krpanoSWFObject');
         krpano.call('skin_showthumbs(false);');
     }
 }
 
-function showWebVR(){
+function showWebVR() {
     var krpano = document.getElementById('krpanoSWFObject');
     var webvr = krpano.get("webvr");
     webvr.entervr();
@@ -83,7 +83,7 @@ function showWebVR(){
 
 
 
-function showthumbs(){
+function showthumbs() {
     var krpano = document.getElementById('krpanoSWFObject');
     krpano.call("skin_showthumbs();");
 }
@@ -95,7 +95,7 @@ function hidePictext() {
     toggleBtns(true);
 }
 
-function showPictext(title,content) {
+function showPictext(title, content) {
     toggleBtns(false);
     //var data = $("body").data("panoData");
     // $('#pictextWorkName').text('');
@@ -107,7 +107,7 @@ function showPictext(title,content) {
 }
 
 //krpano调用 初始化高级设置
-function initAdvancedSetting(sceneName){
+function initAdvancedSetting(sceneName) {
     //initViewSetting(sceneName);
     initEffectSetting(sceneName);
     initHotspotSetting(sceneName);
@@ -117,271 +117,271 @@ function initAdvancedSetting(sceneName){
     // initAuthourInfo(sceneName);
 }
 
-function initTourGuideSetting(sceneName){
+function initTourGuideSetting(sceneName) {
     var krpano = document.getElementById('krpanoSWFObject');
     var tourGuideObj = $("body").data("panoData").tour_guide;
-    if(tourGuideObj.points.length > 0){
+    if (tourGuideObj.points.length > 0) {
         $('#pano .vrshow_tour_btn').show();
-    }else{
+    } else {
         $('#pano .vrshow_tour_btn').hide();
     }
 }
 
 var lsTourGuideObj = null;
-function startTourGuide(){
+function startTourGuide() {
     toggleBtns(false);
     lsTourGuideObj = $("body").data("panoData").tour_guide;
     var krpano = document.getElementById('krpanoSWFObject');
     //krpano.call('showlog(true)');
     var curSceneName = krpano.get('xml.scene');
     var firstPoint = lsTourGuideObj.points[0];
-    if(lsTourGuideObj.useStartImg){
-        krpano.call('show_tour_guide_alert('+lsTourGuideObj.startImgUrl+');');
+    if (lsTourGuideObj.useStartImg) {
+        krpano.call('show_tour_guide_alert(' + lsTourGuideObj.startImgUrl + ');');
     }
-    if(this.sceneName != curSceneName){
-        krpano.call('loadscene('+firstPoint.sceneName+', null, MERGE);');
+    if (this.sceneName != curSceneName) {
+        krpano.call('loadscene(' + firstPoint.sceneName + ', null, MERGE);');
     }
     var curfov = krpano.get('view.fov');
-    krpano.call('lookto('+firstPoint.ath+','+firstPoint.atv+','+curfov+',smooth(720,-720,720),true,true,js(looktoCallBack('+1+')));');
+    krpano.call('lookto(' + firstPoint.ath + ',' + firstPoint.atv + ',' + curfov + ',smooth(720,-720,720),true,true,js(looktoCallBack(' + 1 + ')));');
 }
 
-function looktoCallBack(idx){
+function looktoCallBack(idx) {
     var krpano = document.getElementById('krpanoSWFObject');
-    if(idx < lsTourGuideObj.points.length){
+    if (idx < lsTourGuideObj.points.length) {
         var pointObj = lsTourGuideObj.points[idx];
         var curSceneName = krpano.get('xml.scene');
         var curfov = krpano.get('view.fov');
-        if(pointObj.sceneName != curSceneName){
-            krpano.call('loadscene('+pointObj.sceneName+', null, MERGE);');
-            krpano.call('lookto('+pointObj.ath+','+pointObj.atv+','+curfov+',smooth(720,-720,720),true,true,js(looktoCallBack('+(parseInt(idx)+1)+')));');
-        }else{
-            krpano.call('lookto('+pointObj.ath+','+pointObj.atv+','+curfov+',tween(easeInOutQuad,'+parseInt(pointObj.moveTime)+'),true,true,js(looktoCallBack('+(parseInt(idx)+1)+')));');
+        if (pointObj.sceneName != curSceneName) {
+            krpano.call('loadscene(' + pointObj.sceneName + ', null, MERGE);');
+            krpano.call('lookto(' + pointObj.ath + ',' + pointObj.atv + ',' + curfov + ',smooth(720,-720,720),true,true,js(looktoCallBack(' + (parseInt(idx) + 1) + ')));');
+        } else {
+            krpano.call('lookto(' + pointObj.ath + ',' + pointObj.atv + ',' + curfov + ',tween(easeInOutQuad,' + parseInt(pointObj.moveTime) + '),true,true,js(looktoCallBack(' + (parseInt(idx) + 1) + ')));');
         }
-    }else{
-        if(lsTourGuideObj.useEndImg){
-            krpano.call('show_tour_guide_alert('+lsTourGuideObj.endImgUrl+');');
+    } else {
+        if (lsTourGuideObj.useEndImg) {
+            krpano.call('show_tour_guide_alert(' + lsTourGuideObj.endImgUrl + ');');
         }
         toggleBtns(true);
     }
 }
 
-function initSandTableSetting(sceneName){
+function initSandTableSetting(sceneName) {
     var krpano = document.getElementById('krpanoSWFObject');
     var sandTableObj = $("body").data("panoData").sand_table;
     var existFlag = false;
-    $(sandTableObj.sandTables).each(function(idx){
-        if(this.sceneOpt[sceneName]){
+    $(sandTableObj.sandTables).each(function (idx) {
+        if (this.sceneOpt[sceneName]) {
             //设置背景图片
-            krpano.set("layer[map].url",this.imgPath);
-            $.each(this.sceneOpt,function(sceneName,value){
-                var spotName = 'spot_'+sceneName;
-                addRadarSpot(spotName,value.krpLeft,value.krpTop);
+            krpano.set("layer[map].url", this.imgPath);
+            $.each(this.sceneOpt, function (sceneName, value) {
+                var spotName = 'spot_' + sceneName;
+                addRadarSpot(spotName, value.krpLeft, value.krpTop);
             });
             var hlookatIncre = krpano.get('view.hlookat') - this.sceneOpt[sceneName].hlookat;
-            krpano.call('activatespot('+(parseFloat(this.sceneOpt[sceneName].rotate)+parseFloat(hlookatIncre))+');');
+            krpano.call('activatespot(' + (parseFloat(this.sceneOpt[sceneName].rotate) + parseFloat(hlookatIncre)) + ');');
             existFlag = true;
             return false;
         }
     });
-    if(!existFlag){
+    if (!existFlag) {
         $('.vrshow_radar_btn').hide();
-        krpano.set('layer[mapcontainer].visible',false);
-    }else{
+        krpano.set('layer[mapcontainer].visible', false);
+    } else {
         $('.vrshow_radar_btn').show();
-        if(sandTableObj.isOpen){
-            krpano.set('layer[mapcontainer].visible',true);
+        if (sandTableObj.isOpen) {
+            krpano.set('layer[mapcontainer].visible', true);
         }
     }
 }
 
-function toggleKrpSandTable(){
+function toggleKrpSandTable() {
     var krpano = document.getElementById('krpanoSWFObject');
     var isVisible = krpano.get('layer[mapcontainer].visible');
-    if(isVisible){
-        krpano.set('layer[mapcontainer].visible',false);
-    }else{
-        krpano.set('layer[mapcontainer].visible',true);
+    if (isVisible) {
+        krpano.set('layer[mapcontainer].visible', false);
+    } else {
+        krpano.set('layer[mapcontainer].visible', true);
     }
 }
 
-function addRadarSpot(name,x,y){
+function addRadarSpot(name, x, y) {
     //console.log(x+','+y);
     var krpano = document.getElementById('krpanoSWFObject');
-    krpano.call('addlayer('+name+');');
-    krpano.set('layer['+name+'].style','spot');
-    krpano.set('layer['+name+'].x',x);
-    krpano.set('layer['+name+'].y',y);
-    krpano.set('layer['+name+'].parent','radarmask');
-    krpano.call('layer['+name+'].loadstyle(spot);');
+    krpano.call('addlayer(' + name + ');');
+    krpano.set('layer[' + name + '].style', 'spot');
+    krpano.set('layer[' + name + '].x', x);
+    krpano.set('layer[' + name + '].y', y);
+    krpano.set('layer[' + name + '].parent', 'radarmask');
+    krpano.call('layer[' + name + '].loadstyle(spot);');
     //krpano.set('layer['+name+'].keep','true');
     //krpano.set('layer['+name+'].visible','true');
 }
 
-function initHotspotSetting(sceneName){
+function initHotspotSetting(sceneName) {
     var krpano = document.getElementById('krpanoSWFObject');
     var hotspotObj = ($("body").data("panoData").hotspot)[sceneName];
-    if(hotspotObj){
-        $.each(hotspotObj,function(key,value){
-            if(key == 'scene'){
-                $(value).each(function(idx){
-                    krpano.call('addSceneChangeHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+this.linkedscene+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true)');
+    if (hotspotObj) {
+        $.each(hotspotObj, function (key, value) {
+            if (key == 'scene') {
+                $(value).each(function (idx) {
+                    krpano.call('addSceneChangeHotSpot("' + this.imgPath + '","' + (this.name) + '",' + this.linkedscene + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true)');
                 });
-            }else if(key == 'link'){
-                $(value).each(function(idx){
-                    krpano.call('addLinkHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+this.link+','+this.isShowSpotName+')');
+            } else if (key == 'link') {
+                $(value).each(function (idx) {
+                    krpano.call('addLinkHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + this.link + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'image'){
-                $(value).each(function(idx){
-                    krpano.call('addImgHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+this.galleryName+','+this.isShowSpotName+')');
+            } else if (key == 'image') {
+                $(value).each(function (idx) {
+                    krpano.call('addImgHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + this.galleryName + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'text'){
-                $(value).each(function(idx){
-                    krpano.call('addWordHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+html_encode(this.wordContent)+','+this.isShowSpotName+')');
+            } else if (key == 'text') {
+                $(value).each(function (idx) {
+                    krpano.call('addWordHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + html_encode(this.wordContent) + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'voice'){
-                $(value).each(function(idx){
-                    krpano.call('addVoiceHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+this.musicSrc+','+this.isShowSpotName+')');
+            } else if (key == 'voice') {
+                $(value).each(function (idx) {
+                    krpano.call('addVoiceHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + this.musicSrc + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'around'){
-                $(value).each(function(idx){
-                    krpano.call('addAroundHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+this.aroundPath+','+this.fileCount+','+this.isShowSpotName+')');
+            } else if (key == 'around') {
+                $(value).each(function (idx) {
+                    krpano.call('addAroundHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + this.aroundPath + ',' + this.fileCount + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'imgtext'){
-                $(value).each(function(idx){
-                    krpano.call('addImgTextHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+imgtext_encode(this.imgtext_wordContent)+','+this.isShowSpotName+')');
+            } else if (key == 'imgtext') {
+                $(value).each(function (idx) {
+                    krpano.call('addImgTextHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + imgtext_encode(this.imgtext_wordContent) + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'obj'){
-                $(value).each(function(idx){
-                    krpano.call('addObjHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+this.objid+','+this.isShowSpotName+')');
+            } else if (key == 'obj') {
+                $(value).each(function (idx) {
+                    krpano.call('addObjHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + this.objid + ',' + this.isShowSpotName + ')');
                 });
-            }else if(key == 'video'){
-                $(value).each(function(idx){
-                    krpano.call('addVideoHotSpot("'+this.imgPath+'","'+ (this.name) +'",'+html_encode(this.hotspotTitle)+','+(this.ath)+','+(this.atv)+','+this.isDynamic+',false,true,'+this.location+','+this.isShowSpotName+')');
+            } else if (key == 'video') {
+                $(value).each(function (idx) {
+                    krpano.call('addVideoHotSpot("' + this.imgPath + '","' + (this.name) + '",' + html_encode(this.hotspotTitle) + ',' + (this.ath) + ',' + (this.atv) + ',' + this.isDynamic + ',false,true,' + this.location + ',' + this.isShowSpotName + ')');
                 });
             }
         });
     }
 }
 
-function initEffectSetting(sceneName){
+function initEffectSetting(sceneName) {
     var krpano = document.getElementById('krpanoSWFObject');
     var effectObj = null;
     var effectData = $("body").data("panoData").special_effects;
-    $(effectData.effectSettings).each(function(idx){
-        if(this.sceneName == sceneName){
+    $(effectData.effectSettings).each(function (idx) {
+        if (this.sceneName == sceneName) {
             effectObj = this;
             return false;
         }
     });
-    if(effectObj){
-        if(effectObj.isOpen){
-            if(effectObj.effectType == 'sunshine'){
+    if (effectObj) {
+        if (effectObj.isOpen) {
+            if (effectObj.effectType == 'sunshine') {
                 //krpano.set('lensflares[obj].item[lensitemobj].scene',sceneName);
                 //krpano.set('lensflares[obj].item[lensitemobj].ath',effectObj.ath);
                 //krpano.set('lensflares[obj].item[lensitemobj].atv',effectObj.atv);
-                krpano.call('addLensflares('+effectObj.ath+','+effectObj.atv+')');
-            }else{
-                krpano.call('addEffect("'+effectObj.effectType+'","'+effectObj.effectImgPath+'")');
+                krpano.call('addLensflares(' + effectObj.ath + ',' + effectObj.atv + ')');
+            } else {
+                krpano.call('addEffect("' + effectObj.effectType + '","' + effectObj.effectImgPath + '")');
             }
         }
     }
 }
 
-function littlePlaneOpen(sceneName){
+function littlePlaneOpen(sceneName) {
     var krpano = document.getElementById('krpanoSWFObject');
     var lookatObj = null;
     var angleData = $("body").data("panoData").angle_of_view;
-    $(angleData.viewSettings).each(function(idx){
-        if(this.sceneName == sceneName){
+    $(angleData.viewSettings).each(function (idx) {
+        if (this.sceneName == sceneName) {
             lookatObj = this;
             return false;
         }
     });
-    if(lookatObj){
-        krpano.set('view.vlookat',lookatObj.vlookat);
-        krpano.set('view.hlookat',lookatObj.hlookat);
-        krpano.set('view.fov',lookatObj.fov);
-        krpano.set('view.fovmax',lookatObj.fovmax);
-        if(lookatObj.hlookatmin){
-            krpano.set('view.hlookatmin',lookatObj.hlookatmin);
+    if (lookatObj) {
+        krpano.set('view.vlookat', lookatObj.vlookat);
+        krpano.set('view.hlookat', lookatObj.hlookat);
+        krpano.set('view.fov', lookatObj.fov);
+        krpano.set('view.fovmax', lookatObj.fovmax);
+        if (lookatObj.hlookatmin) {
+            krpano.set('view.hlookatmin', lookatObj.hlookatmin);
         }
-        if(lookatObj.hlookatmax){
-            krpano.set('view.hlookatmax',lookatObj.hlookatmax);
+        if (lookatObj.hlookatmax) {
+            krpano.set('view.hlookatmax', lookatObj.hlookatmax);
         }
-        krpano.call('skin_setup_littleplanetintro('+lookatObj.fovmin+','+(-1*lookatObj.vlookatmax)+','+(-1*lookatObj.vlookatmin)+','+(lookatObj.keepView ? "off" : "0.0")+');');
-    }else{
+        krpano.call('skin_setup_littleplanetintro(' + lookatObj.fovmin + ',' + (-1 * lookatObj.vlookatmax) + ',' + (-1 * lookatObj.vlookatmin) + ',' + (lookatObj.keepView ? "off" : "0.0") + ');');
+    } else {
         krpano.call('skin_setup_littleplanetintro(5,-90,90,"0.0");');
     }
 }
 
 //场景载入时加载视角设置
-function initViewSetting(sceneName){
+function initViewSetting(sceneName) {
     var krpano = document.getElementById('krpanoSWFObject');
     var lookatObj = null;
     var angleData = $("body").data("panoData").angle_of_view;
-    $(angleData.viewSettings).each(function(idx){
-        if(this.sceneName == sceneName){
+    $(angleData.viewSettings).each(function (idx) {
+        if (this.sceneName == sceneName) {
             lookatObj = this;
             return false;
         }
     });
-    if(lookatObj){
-        krpano.set('view.vlookat',lookatObj.vlookat);
-        krpano.set('view.hlookat',lookatObj.hlookat);
-        krpano.set('view.fov',lookatObj.fov);
-        krpano.set('view.fovmin',lookatObj.fovmin);
-        krpano.set('view.fovmax',lookatObj.fovmax);
-        krpano.set('view.vlookatmin',-1*lookatObj.vlookatmax);
-        krpano.set('view.vlookatmax',-1*lookatObj.vlookatmin);
-        krpano.set('autorotate.horizon',lookatObj.keepView ? "off" : "0.0");
-        if(lookatObj.hlookatmin){
-            krpano.set('view.hlookatmin',lookatObj.hlookatmin);
+    if (lookatObj) {
+        krpano.set('view.vlookat', lookatObj.vlookat);
+        krpano.set('view.hlookat', lookatObj.hlookat);
+        krpano.set('view.fov', lookatObj.fov);
+        krpano.set('view.fovmin', lookatObj.fovmin);
+        krpano.set('view.fovmax', lookatObj.fovmax);
+        krpano.set('view.vlookatmin', -1 * lookatObj.vlookatmax);
+        krpano.set('view.vlookatmax', -1 * lookatObj.vlookatmin);
+        krpano.set('autorotate.horizon', lookatObj.keepView ? "off" : "0.0");
+        if (lookatObj.hlookatmin) {
+            krpano.set('view.hlookatmin', lookatObj.hlookatmin);
         }
-        if(lookatObj.hlookatmax){
-            krpano.set('view.hlookatmax',lookatObj.hlookatmax);
+        if (lookatObj.hlookatmax) {
+            krpano.set('view.hlookatmax', lookatObj.hlookatmax);
         }
     }
 }
 
-function loadGallery(){
+function loadGallery() {
     var krpano = document.getElementById('krpanoSWFObject');
     var hotspotObj = $("body").data("panoData").hotspot;
     //var xmlStr = '';
-    $.each(hotspotObj,function(sceneName,value){
-        if(value){
-            $(value.image).each(function(idx){
-                var xmlStr = '<gallery name="'+this.galleryName+'" title="">';
-                $(this.imgs).each(function(idx){
-                    xmlStr += '<img name="img'+idx+'" url="'+this.src+'" title="" />';
+    $.each(hotspotObj, function (sceneName, value) {
+        if (value) {
+            $(value.image).each(function (idx) {
+                var xmlStr = '<gallery name="' + this.galleryName + '" title="">';
+                $(this.imgs).each(function (idx) {
+                    xmlStr += '<img name="img' + idx + '" url="' + this.src + '" title="" />';
                 });
                 xmlStr += '</gallery>';
-                krpano.call('loadxml('+xmlStr+');');
+                krpano.call('loadxml(' + xmlStr + ');');
             });
         }
     });
 }
 
-function reloadGallery(gallery){
+function reloadGallery(gallery) {
     var krpano = document.getElementById('krpanoSWFObject');
     var ua = window.navigator.userAgent.toLowerCase();
-    if(typeof(wx)!='undefined' && ua.match(/MicroMessenger/i) == 'micromessenger'){
+    if (typeof (wx) != 'undefined' && ua.match(/MicroMessenger/i) == 'micromessenger') {
         //整合gallery的图片到数组 
         var urls = new Array();
-        for(var i=0; i<krpano.get('gallery['+gallery+'].img.count'); i++){
-            urls.push(krpano.get('gallery['+gallery+'].img['+i+'].url'));
+        for (var i = 0; i < krpano.get('gallery[' + gallery + '].img.count'); i++) {
+            urls.push(krpano.get('gallery[' + gallery + '].img[' + i + '].url'));
         }
         wx.previewImage({
-            current: krpano.get('gallery['+gallery+'].img[0].url'), // 当前显示图片的http链接
+            current: krpano.get('gallery[' + gallery + '].img[0].url'), // 当前显示图片的http链接
             urls: urls // 需要预览的图片http链接列表
-        }); 
+        });
     }
-    else{
+    else {
         toggleBtns();
-        krpano.call('show_gallery('+gallery+')');   
+        krpano.call('show_gallery(' + gallery + ')');
     }
 }
 
-function getWorkPrivacyFlag(){
+function getWorkPrivacyFlag() {
     var privacy_flag = '0';
 
     return privacy_flag;
@@ -389,74 +389,74 @@ function getWorkPrivacyFlag(){
 
 
 
-function initPano(){//TODO
-   
-   if(data.pk_works_main == undefined){
-       window.location.href = '/404.html';
-       return ;
-   }
-   //微信分享
-   // initWxConfig(data);
-   // initQQShare(data);
-   //存储作者的信息
-   // _user_view_uuid = data.user_view_uuid;
-   _user_view_uuid = "admin";
-
-   _name = data.name;
-   document.title = _name;
-   //$("#thumb_img").attr("src",data.absolutelocation);
-   //var descContent='';
-   //if(data.profile){
-   //    descContent = data.profile;
-   //}else{
-   //    descContent = data.name;
-   //}
-   //$("head").append('<meta name="description" content="'+descContent+'"/>');
-
-   $("body").data("panoData",data);
-   pk_works_main = data.pk_works_main;
-   var settings = {};
-   settings["events[skin_events].onloadcomplete"] = "skin_showloading(false);";
-   settings["onstart"] = '';
-   
-   //是否开始时弹出场景选择
-   if (data.scenechoose=='1') {
-       settings["events[skin_events].onloadcomplete"] += "open_show_scene_thumb();";
-   }
-   
-   //统计人气
-   if(data.browsing_num!='0'){
-       $("#user_viewNum").text(parseInt(data.browsing_num)+1);
-   }else{
-       $("#user_viewNum").text("1");
-   }
-   //启动画面
-   var loadingObj = data.loading_img;
-   if (loadingObj && loadingObj.useLoading) {
-       settings["onstart"] += "showloadingimg('" + loadingObj.loadingImgPathWebsite + "','" + loadingObj.loadingImgPathMobile + "');";
-   }
-   for(var i=0 ; i<plugins_init_function.length;i++){
-        plugins_init_function[i](data,settings);
-   }
-   if(data.scene_group.sceneGroups.length>0) {
-         $(".vrshow_container_3_min .img_desc_container_min:eq(0) img").attr('src',data.scene_group.sceneGroups[0].imgPath);
+function initPano() {
+    //TODO
+
+    if (data.pk_works_main == undefined) {
+        window.location.href = '/404.html';
+        return;
+    }
+    //微信分享
+    //    initWxConfig(data);
+    // initQQShare(data);
+    //存储作者的信息
+    // _user_view_uuid = data.user_view_uuid;
+    _user_view_uuid = "admin";
+
+    _name = data.name;
+    document.title = _name;
+    //$("#thumb_img").attr("src",data.absolutelocation);
+    //var descContent='';
+    //if(data.profile){
+    //    descContent = data.profile;
+    //}else{
+    //    descContent = data.name;
+    //}
+    //$("head").append('<meta name="description" content="'+descContent+'"/>');
+
+    $("body").data("panoData", data);
+    pk_works_main = data.pk_works_main;
+    var settings = {};
+    settings["events[skin_events].onloadcomplete"] = "skin_showloading(false);";
+    settings["onstart"] = '';
+
+    //是否开始时弹出场景选择
+    if (data.scenechoose == '1') {
+        settings["events[skin_events].onloadcomplete"] += "open_show_scene_thumb();";
+    }
+
+    //统计人气
+    if (data.browsing_num != '0') {
+        $("#user_viewNum").text(parseInt(data.browsing_num) + 1);
+    } else {
+        $("#user_viewNum").text("1");
+    }
+    //启动画面
+    var loadingObj = data.loading_img;
+    if (loadingObj && loadingObj.useLoading) {
+        settings["onstart"] += "showloadingimg('" + loadingObj.loadingImgPathWebsite + "','" + loadingObj.loadingImgPathMobile + "');";
+    }
+    for (var i = 0; i < plugins_init_function.length; i++) {
+        plugins_init_function[i](data, settings);
     }
-   settings['skin_settings.littleplanetintro'] = data.littleplanet=="1" ? true : false;
-
-   settings['autorotate.enabled'] = data.autorotate=="1" ? true : false;
-   embedpano({
-       swf: "tour.swf",
-       xml: "tour.xml",
-       target: "pano",
-       html5:'prefer',
-       //flash:'only',
-       wmode:'opaque-flash',
-       mobilescale:1,
-       vars: settings
-   });
-}
-function html_encode(str)
-  {
+    if (data.scene_group.sceneGroups.length > 0) {
+        $(".vrshow_container_3_min .img_desc_container_min:eq(0) img").attr('src', data.scene_group.sceneGroups[0].imgPath);
+    }
+    settings['skin_settings.littleplanetintro'] = data.littleplanet == "1" ? true : false;
+
+    settings['autorotate.enabled'] = data.autorotate == "1" ? true : false;
+    embedpano({
+        swf: "tour.swf",
+        xml: "tour.xml",
+        target: "pano",
+        html5: 'prefer',
+        //flash:'only',
+        wmode: 'opaque-flash',
+        mobilescale: 1,
+        vars: settings
+    });
+}
+function html_encode(str) {
     var s = "";
     if (str.length == 0) return "";
     s = str.replace(/\'/g, "&#39;");
@@ -465,54 +465,54 @@ function html_encode(str)
     s = s.replace(/\)/g, ")");
     s = s.replace(/,/g, ",");
     return s;
-  }
-function imgtext_encode(str){
-     var s = "";
+}
+function imgtext_encode(str) {
+    var s = "";
     if (str.length == 0) return "";
     s = str.replace(/\'/g, "&#39;");
     s = s.replace(/\"/g, "&quot;");
     s = s.replace(/\(/g, "(");
     s = s.replace(/\)/g, ")");
-    s = s.replace(/\,/g,"%2C");
+    s = s.replace(/\,/g, "%2C");
     return s;
 }
-function imgtext_decode(str){
-     var s = "";
+function imgtext_decode(str) {
+    var s = "";
     if (str.length == 0) return "";
     s = str.replace(/&quot;/g, "\"");
-     s = s.replace(/%2C/g,",");
+    s = s.replace(/%2C/g, ",");
     return s;
 }
 
-function showFullscreenBtn(){
+function showFullscreenBtn() {
     $(".btn_fullscreen").show();
 }
 
 
 
-function radarRotate(sceneName,hlookat){
+function radarRotate(sceneName, hlookat) {
 
 }
 
-function openSpeechVoiceBtn(){
+function openSpeechVoiceBtn() {
     var voiceOff = $('.btn_music_off');
     voiceOff.removeClass('btn_music_off');
     voiceOff.addClass('btn_music');
 }
-var player ;
-function playvideo(url){
-   var location = window.location.href;
-   url = location.substring(0,location.lastIndexOf("\/")+1)+url;
-   player = new prismplayer({
-      id: "J_prismPlayer", // 容器id
-      source:url,
-      autoplay: true,      // 自动播放
-      width: "100%",       // 播放器宽度
-      height: "400px"      // 播放器高度
+var player;
+function playvideo(url) {
+    var location = window.location.href;
+    url = location.substring(0, location.lastIndexOf("\/") + 1) + url;
+    player = new prismplayer({
+        id: "J_prismPlayer", // 容器id
+        source: url,
+        autoplay: true,      // 自动播放
+        width: "100%",       // 播放器宽度
+        height: "400px"      // 播放器高度
     });
-   $("#video_player_modal").modal('show');
+    $("#video_player_modal").modal('show');
 }
-function close_video_player(){
+function close_video_player() {
     player.pause();
     $("#video_player_modal").modal('hide');
 }

+ 4 - 1
packages/qjkankan-editor/src/core/utils.js

@@ -140,8 +140,11 @@ export default class Utils {
     if (stagex < 0 || stagex > panoW || stagey < 0 || stagey > panoH) {
       return
     }
-
     krpano.call('screentosphere(mouse.stagex, mouse.stagey, toh, tov)')
+    // const toh = krpano.get('toh');
+    // const tov = krpano.get('tov');
+    // console.log('toh', toh);
+    // console.log('tov', tov);
     krpano.set(`hotspot[${hotspotName}].ath`, krpano.get('toh'));
     krpano.set(`hotspot[${hotspotName}].atv`, krpano.get('tov'));
 

+ 1 - 1
packages/qjkankan-editor/src/framework/play/pano/index.vue

@@ -188,7 +188,7 @@ export default {
     isConfirmingPosi(newVal) {
       this.inter && clearInterval(this.inter);
       this.inter = null;
-      console.log(newVal, "isConfirmingPosiisConfirmingPosi");
+      console.log("isConfirmingPosi", newVal);
       if (newVal) {
         this.inter = setInterval(() => {
           __krfn.utils.getCurrentMousePosition(this.$getKrpano(), newVal);

+ 8 - 27
packages/qjkankan-editor/src/views/hotspot/HotSpotList.vue

@@ -178,10 +178,11 @@ export default {
       let hptarget = this.someData.hotspots.find(
         (item) => item.name.toLowerCase() == data.hpname.toLowerCase()
       );
-      // console.log(" this.someData.hotspots", this.someData.hotspots.length);
-      console.log("hptarget", hptarget);
-      hptarget.ath = data.ath;
-      hptarget.atv = data.atv;
+      if (hptarget) {
+        console.log("hptarget", hptarget);
+        hptarget.ath = data.ath;
+        hptarget.atv = data.atv;
+      }
     });
 
     this.$bus.on("openHotspot", (data) => {
@@ -190,9 +191,8 @@ export default {
       );
       // console.log(data);
       if (data == this.hotspot.name) {
-        window.__krfn.utils.looktohotspot(this.$getKrpano(), this.hotspot.name);
+        // window.__krfn.utils.looktohotspot(this.$getKrpano(), this.hotspot.name);
         if (!this.showPanel) {
-          // debugger
           this.open(this.someData.hotspots[idx]);
         }
         return;
@@ -348,27 +348,7 @@ export default {
             imageList: [],
             text: "",
             isApplyToAll: true,
-            audio: {
-              // ancestors: "",
-              // createTime: "2022-08-01 14:30",
-              // dirId: 1,
-              // dirName: "根目录",
-              // dpi: "0",
-              // fileName: "20220801_143047668.mp3",
-              // fileSize: "2.08MB",
-              // icon: "0",
-              // id: 2594,
-              // materialType: "audio",
-              // name: "谢海清 - 清平乐",
-              // ossPath: "https://ossxiaoan.4dage.com/720yun_fd_manage/fodder/20220801_143047668.mp3",
-              // previewIcon: "",
-              // sceneCode: "0",
-              // status: 0,
-              // tempId: "u_4zK9YIFW",
-              // type: "audio",
-              // updateTime: "2022-11-01 19:49",
-              // userId: "13825625448",
-            },
+            audio: {},
           },
           phoneInfo: {
             // 热点类型为电话时,对应数据
@@ -389,6 +369,7 @@ export default {
           "layer[tooltip_" + hotspotData.name + "].visible",
           true
         );
+        // debugger;
         setTimeout(() => {
           this.$store.commit("tags/setIsConfirmingPosi", hotspotData.name);
         }, 0);

+ 1 - 1
packages/qjkankan-editor/src/views/hotspot/hotspotIconType/system_icon.vue

@@ -38,7 +38,7 @@ export default {
     }
     //TODO 临时隐藏PDF
 
-    hotspotIconList.splice(14, 1);
+    // hotspotIconList.splice(14, 1);
 
     return {
       hotspotIconList,

+ 8 - 8
packages/qjkankan-editor/src/views/hotspot/hotspotTypeList.js

@@ -65,14 +65,14 @@ export default [
     isExperience: true,
   },
   //pdf暂时hide
-  // {
-  //   icon: require('@/assets/images/icons/hotspot-type/pdf.png'),
-  //   idxInSystemIconList: 15,
-  //   name: i18n.t('hotspot.pdf'),
-  //   id: 'pdf',
-  //   isExperience: true,
-  //   tip: i18n.t('hotspot.MB_limit', {value: '50'})
-  // },
+  {
+    icon: require('@/assets/images/icons/hotspot-type/pdf.png'),
+    idxInSystemIconList: 15,
+    name: i18n.t('hotspot.pdf'),
+    id: 'pdf',
+    isExperience: true,
+    tip: i18n.t('hotspot.MB_limit', {value: '50'})
+  },
   {
     icon: require('@/assets/images/icons/hotspot-type/phone.png'),
     idxInSystemIconList: 16,

+ 3 - 0
packages/qjkankan-view/.env.eurtestprod

@@ -4,3 +4,6 @@ VUE_APP_CDN=https://testeurs3.4dkankan.com
 VUE_APP_PROXY_URL_ROOT='https://testeur.4dkankan.com'
 VUE_APP_PROXY_URL='https://testeur.4dkankan.com/qjkankan/'
 VUE_APP_URL_FILL=/qjkankan
+# 接口请求地址
+VUE_APP_APIS_URL=https://testeur.4dkankan.com/
+VUE_APP_DEBBUG_FLAG=0516-03

+ 30 - 10
packages/qjkankan-view/public/show.html

@@ -1,16 +1,37 @@
 <!DOCTYPE html>
 <html lang="zh">
   <head>
-    <meta charset="utf-8">
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" />
-    <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/iconfontVR/iconfont.css"/>
-    <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontV1.2.0/iconfont.css"/>
-    <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/swiper/swiper-bundle.min.css" />
+    <meta charset="utf-8" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta
+      name="viewport"
+      content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no"
+    />
+    <meta name="description" content="" />
+    <meta name="cover" content="" />
+    <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/iconfontVR/iconfont.css"
+    />
+    <link
+      rel="stylesheet"
+      href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontV1.2.0/iconfont.css"
+    />
+    <link
+      rel="stylesheet"
+      href="<%= VUE_APP_STATIC_DIR %>/lib/swiper/swiper-bundle.min.css"
+    />
     <link rel="icon" href="./favicon.png" />
+    <meta name="description" content="" />
     <title>-</title>
   </head>
   <body>
@@ -21,6 +42,5 @@
     <script src="<%= VUE_APP_STATIC_DIR %>/lib/howler/howler.min.js"></script>
     <script src="<%= VUE_APP_STATIC_DIR %>/lib/swiper/swiper-bundle.min.js"></script>
     <!-- <script src="<%= VUE_APP_STATIC_DIR %>/lib/jssor/jssor.slider-28.1.0.min.js"></script> -->
-   
   </body>
 </html>

+ 33 - 13
packages/qjkankan-view/public/showMobile.html

@@ -1,17 +1,37 @@
 <!DOCTYPE html>
 <html lang="zh">
   <head>
-    <meta charset="utf-8">
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta content="yes" name="apple-mobile-web-app-capable" />  
-    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" />
-    <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/iconfontVR/iconfont.css"/>
-    <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontV1.2.0/iconfont.css"/>
-    <link rel="stylesheet" href="<%= VUE_APP_STATIC_DIR %>/lib/swiper/swiper-bundle.min.css" />
-    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> 
+    <meta charset="utf-8" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta content="yes" name="apple-mobile-web-app-capable" />
+    <meta
+      name="viewport"
+      content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no"
+    />
+    <meta name="description" content="" />
+    <meta name="cover" content="" />
+    <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/iconfontVR/iconfont.css"
+    />
+    <link
+      rel="stylesheet"
+      href="<%= VUE_APP_STATIC_DIR %>/lib/iconfontV1.2.0/iconfont.css"
+    />
+    <link
+      rel="stylesheet"
+      href="<%= VUE_APP_STATIC_DIR %>/lib/swiper/swiper-bundle.min.css"
+    />
+    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
     <link rel="icon" href="./favicon.png" />
     <title>-</title>
   </head>
@@ -25,7 +45,7 @@
     <!-- <script src="<%= VUE_APP_STATIC_DIR %>/lib/jssor/jssor.slider-28.1.0.min.js"></script> -->
     <script src="https://4dkk.4dage.com/v4-test/www/viewer/static/lib/vconsole.js"></script>
     <script>
-      var vConsole = new window.VConsole()
-  </script>
+      var vConsole = new window.VConsole();
+    </script>
   </body>
 </html>

+ 1 - 1
packages/qjkankan-view/src/components/assembly/MobileTags/metas/metas-pdf.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="pdfcon">
-    <iframe :src="currentTag.pdfInfo.url" frameborder="0" allowfullscreen></iframe>
+    <iframe :src="`https://ossxiaoan.4dage.com/pdfjs/web/viewer.html?file=${currentTag.pdfInfo.url}`" frameborder="0" allowfullscreen></iframe>
   </div>
 </template>
 

+ 1 - 1
packages/qjkankan-view/src/components/assembly/Tags/metas/metas-pdf.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="pdfcon">
-    <iframe :src="currentTag.pdfInfo.url" frameborder="0" height="100%" width="100%" allowfullscreen></iframe>
+    <iframe :src="`https://ossxiaoan.4dage.com/pdfjs/web/viewer.html?file=${currentTag.pdfInfo.url}`" frameborder="0" height="100%" width="100%" allowfullscreen></iframe>
   </div>
 </template>
 

+ 40 - 0
packages/qjkankan-view/src/hooks/useWxshared.js

@@ -0,0 +1,40 @@
+import wxshare from '@/utils/wxshare'
+import { onMounted } from 'vue';
+
+
+
+
+const initWxShare = async () => {
+    onMounted(async () => {
+        try {
+            await new Promise(r => setTimeout(r, 1000));
+            const title = document.title;
+            const link = window.location.href
+            // const desc = '测试微信分享'
+            const imgUrl =document.querySelector('meta[name="cover"]').content || '';
+            const desc = document.querySelector('meta[name="description"]').content || '';
+            // const imgUrl = document.document.querySelector('meta[name="description"]').content
+            // title, link, imgUrl, desc 
+            console.log('当前分享imgUrl', imgUrl)
+            await wxshare({
+                title,
+                link,
+                desc,
+                imgUrl
+            });
+        } catch (error) {
+            console.error(error)
+
+        }
+
+
+    })
+}
+
+
+
+export function useWxShared() {
+    return {
+        initWxShare,
+    };
+}

+ 1 - 0
packages/qjkankan-view/src/pages/showMobile.js

@@ -11,6 +11,7 @@ import Deferred from "@/utils/Deferred";
 import store from '../store'
 import VueLazyLoad from 'vue3-lazyload'
 
+
 let App;
 if (
   browser.detectChrome() ||

+ 6 - 0
packages/qjkankan-view/src/pages/showMobile.vue

@@ -36,9 +36,15 @@ import { useStore } from "vuex";
 import config from "@/utils/config";
 import browser from "@/utils/browser";
 import { useApp } from "@/app";
+import { useWxShared } from "@/hooks/useWxshared";
+
 import { useI18n, getLocale } from "@/i18n";
 const { t } = useI18n({ useScope: "global" });
 
+const { initWxShare } = useWxShared();
+initWxShare();
+
+
 const coverInfo = ref({});
 
 const fixOpening = {

+ 4 - 1
packages/qjkankan-view/src/store/modules/scene.js

@@ -13,7 +13,7 @@ const covertCustomButton = (data) => {
       if (item.openMethod == '弹出层打开') item.openMethod = '_self'
       if (item.openMethod == '新窗口打开') item.openMethod = '_target'
     }
-    console.log('当前转换数据!',item);
+    // console.log('当前转换数据!', item);
     return item
   })
 
@@ -174,6 +174,9 @@ export default {
     setMetaData(state, payload) {
       state.metadata = payload;
       document.title = payload.name || '无标题'
+      // debugger
+      document.querySelector('meta[name="description"]').setAttribute("content", payload.description.replace(/<\/?[^>]+(>|$)/g, ""));
+      document.querySelector('meta[name="cover"]').setAttribute("content", payload.icon);
     },
 
     setDoneforCover(state, payload) {

+ 1 - 0
packages/qjkankan-view/src/utils/sound.js

@@ -281,6 +281,7 @@ export function useSoundPlayer() {
 }
 
 function wxConfig() {
+    debugger
     wx.config({
         // 配置信息, 即使不正确也能使用 wx.ready
         debug: false,

+ 107 - 0
packages/qjkankan-view/src/utils/wxshare.js

@@ -0,0 +1,107 @@
+function toConfigure() {
+    return new Promise((resolve, reject) => {
+        $.ajax({
+            url: '//www.4dage.com/wechat/jssdk/share',
+            type: "get",
+            data: {
+                uri: location.href.split("#")[0],
+                name: "厦门四维时代微信公众号"
+            },
+            dataType: "jsonp",
+            //jsonpCallback: "success_jsonp",
+            success: function (data, textStatus) {
+                wx.config({
+                    debug: false,
+                    appId: data.appId,
+                    timestamp: data.timestamp,
+                    nonceStr: data.nonceStr,
+                    signature: data.signature,
+                    jsApiList: ['checkJsApi',
+                        'updateAppMessageShareData',
+                        'updateTimelineShareData',
+                        'onMenuShareQQ',
+                        'onMenuShareWeibo', 'hideMenuItems',
+                        'showMenuItems', 'hideAllNonBaseMenuItem',
+                        'showAllNonBaseMenuItem', 'translateVoice',
+                        'startRecord', 'stopRecord', 'onRecordEnd',
+                        'playVoice', 'pauseVoice', 'stopVoice',
+                        'uploadVoice', 'downloadVoice', 'chooseImage',
+                        'previewImage', 'uploadImage', 'downloadImage',
+                        'getNetworkType', 'openLocation', 'getLocation',
+                        'hideOptionMenu', 'showOptionMenu', 'closeWindow',
+                        'scanQRCode', 'chooseWXPay',
+                        'openProductSpecificView', 'addCard', 'chooseCard',
+                        'openCard'
+                    ]
+                });
+                resolve()
+            },
+            error: function (XMLHttpRequest, textStatus, errorThrown) {
+                reject("jsonp.error:" + textStatus)
+            }
+        });
+    })
+}
+
+function strToJSON(search) {
+    let args = search.substr(1).split('&')
+    let obj = {}
+    args.forEach(arg => {
+        let index = arg.indexOf('=')
+        if (!~index) {
+            obj[arg] = null
+        } else {
+            obj[arg.substr(0, index)] = arg.substr(index + 1)
+        }
+    })
+
+    return obj
+}
+
+function jsonToStr(data) {
+    let strs = []
+    Object.keys(data).forEach(k => {
+        if (data[k] !== null) {
+            strs.push(`${k}=${data[k]}`)
+        }
+    })
+    return '?' + strs.join('&')
+}
+
+
+function setup({ title, link, imgUrl, desc }) {
+    let defaultFn = () => { }
+    let defaultChar = ''
+    let search = link.substr(link.indexOf('?'))
+    let path = link.substr(0, link.indexOf('?'))
+    let data = strToJSON(search)
+
+
+
+    wx.ready(function () {
+        // 微信朋友圈
+        data.open = 'wx_friends'
+        // wx.onMenuShareTimeline({ title, link: path + jsonToStr(data), imgUrl, desc });
+        wx.updateTimelineShareData({ title, link: path + jsonToStr(data), imgUrl, desc });
+        // 微信好友
+        data.open = 'wx_friend'
+        wx.updateAppMessageShareData({ title, desc, link: path + jsonToStr(data), imgUrl, type: defaultChar, dataUrl: defaultChar })
+        // 微博
+        data.open = 'weibo'
+        wx.onMenuShareWeibo({ title, desc, link: path + jsonToStr(data), imgUrl, success: defaultFn, cancel: defaultFn });
+        // 空间
+        data.open = 'qq_zone'
+        wx.onMenuShareQZone({ title, desc, link: path + jsonToStr(data), imgUrl, success: defaultFn, cancel: defaultFn });
+        // QQ好友
+        data.open = 'qq'
+        wx.onMenuShareQQ({ title, desc, link: path + jsonToStr(data), imgUrl, success: defaultFn, cancel: defaultFn });
+        wx.error(function (e) { })
+    })
+}
+
+export default async (args) => {
+    if (typeof wx != "undefined") { //需要引入 https://res.wx.qq.com/open/js/jweixin-1.2.0.js
+        await toConfigure()
+        setup(args)
+    }
+}