Przeglądaj źródła

场景本地化

aamin 1 rok temu
rodzic
commit
5ae28624dc

+ 16 - 6
hot - 副本/src/views/Home.vue

@@ -3,7 +3,7 @@
     <div class="main">
       <div class="mainCon" v-show="!oneTxt">
         <!-- 音频播放器 -->
-        <audio id="myAudio" v-if="audio" v-show="isOneAduio" :src="audio" controls></audio>
+        <audio id="myAudio" v-if="audio" v-show="isOneAduio" :src="urlToFitFu(audio)" controls></audio>
         <!-- 音频图标 -->
         <div class="audioIcon" v-if="audio && !isOneAduio" @click="audioSta = !audioSta"
           :title="audioSta ? '关闭音频' : '打开音频'">
@@ -39,16 +39,16 @@
             :key="myType === 'video' ? item.url : item">
             <!-- 模型页面 -->
             <div class="modelBox" v-if="myType === 'model'">
-              <iframe :src="item" frameborder="0" v-if="index === myInd"></iframe>
+              <iframe :src="urlToFitFu(item)" frameborder="0" v-if="index === myInd"></iframe>
             </div>
             <!-- 视频页面 -->
             <div class="videoBox" v-else-if="myType === 'video'">
-              <video id="videoID" controls :src="item.url" v-if="index === myInd" autoplay></video>
+              <video id="videoID" controls :src="urlToFitFu(item.url)" v-if="index === myInd" autoplay></video>
             </div>
             <!-- 图片页面 -->
             <div class="imgBox" v-else-if="myType === 'img'">
-              <div class="smImgBox" @click="lookImg(item)">
-                <img v-lazy="item" alt="" />
+              <div class="smImgBox" @click="lookImg(urlToFitFu(item))">
+                <img v-lazy="urlToFitFu(item)" alt="" />
               </div>
             </div>
           </div>
@@ -148,6 +148,16 @@ export default {
   computed: {},
   components: {},
   methods: {
+    // 本地化 url 适配
+    urlToFitFu(url) {
+      const resUrl = url;
+      if (url.includes("https://super.4dage.com")) {
+        return url.replace("https://super.4dage.com", "");
+      } else if (url.includes("http://super.4dage.com")) {
+        return url.replace("http://super.4dage.com", "");
+      } else return resUrl;
+    },
+
     // 点击左右箭头
     cutMyInd(num, flag) {
       if (flag) return;
@@ -161,7 +171,7 @@ export default {
     },
     async getData() {
       // https://www.4dmodel.com/
-      let url = `https://super.4dage.com/data/${this.id
+      let url = `/data/${this.id
         }/hot/js/data.js?time=${Math.random()}`;
       let result = (await this.$http.get(url)).data;
       const resData = result[this.m];

+ 2 - 2
scene - 副本/public/static/css/css/main.css

@@ -831,7 +831,7 @@ hr {
 
 .icon-fullscreen-exit:before {
     content: "";
-    background: url("https://super.4dage.com/images/narrow_off.png") center top no-repeat;
+    background: url("../../images/narrow_off.png") center top no-repeat;
     background-size: 100%;
     display: inline-block;
     width: 24px;
@@ -840,7 +840,7 @@ hr {
 
 .icon-fullscreen:before {
     content: "";
-    background: url("https://super.4dage.com/images/enlarge_on.png")center top no-repeat;
+    background: url("../../images/enlarge_on.png")center top no-repeat;
     background-size: 100%;
     display: inline-block;
     width: 24px;

+ 1 - 1
scene - 副本/public/static/css/css/oldVer/main0.css

@@ -52,7 +52,7 @@ iframe{
 	opacity:0.1; 
 }
 #closepop {
-	background: url(https://super.4dage.com/images/close1.png) no-repeat;
+	background: url(../../../images/close1.png) no-repeat;
 	width: 60px;
 	height: 60px;
 	cursor: pointer;

+ 10 - 0
scene - 副本/public/static/js/Hot.js

@@ -1811,6 +1811,16 @@ window.initHot = function(model){
         var hots = hotGroup.children.filter(hot=>hot.info.actionType.openHot);
         hots = hots.sort((a,b)=>{return a.order - b.order});
 
+        hots = hots.map((item)=>{
+            return {
+                ...item,
+                info:{
+                    ...item.info,
+                    texSrc:item.info.texSrc.replace('https://super.4dage.com','')
+                }
+            }
+        })
+
         window.myHotList = hots
         window.hotData = true
 

+ 1 - 1
scene - 副本/public/static/js/loadCAD.js

@@ -15,7 +15,7 @@ window.grendCAD = (function grendCAD() {
     if (initScript) return cb();
 
     let $script = document.createElement("script");
-    $script.src = "//www.4dmodel.com/CAD/bundle.js";
+    $script.src = "static/js/bundle.js";
     $script.onload = function () {
       initScript = true;
       cb();

+ 19 - 1
scene - 副本/public/static/js/main_2020_show.js

@@ -17116,7 +17116,13 @@ window.Modernizr = function(n, e, t) {
                         if (cameraMode === a.MESH) return 
                                      
                         
-                        if(window.isLocal)src = manage.dealURL(src)
+                        if(window.isLocal){
+                            src = manage.dealURL(src)
+                            //本地文件莫名少了个"."
+                            if(src[src.length-1]=='.'){
+                               src = src.slice(0,-1) 
+                            }
+                        }
                         else src = "one" === g_version ? g_Prefix + src + "?" + randomTime().getTime() :  src + "?" + randomTime().getTime()
                          
                         var l = { 
@@ -17578,6 +17584,18 @@ window.Modernizr = function(n, e, t) {
                     responseType: "json",
                     auth: this.isPublic ? null : f.authorizationHeader
                 }).done(function(e) {
+                     // 将data2.js中所有https的值本地化
+                     function replaceHttpsWithHttp(obj) {
+                        for (let key in obj) {
+                          if (typeof obj[key] === 'string') {
+                            obj[key] = obj[key].replace('https://super.4dage.com', '');
+                          } else if (typeof obj[key] === 'object') {
+                            replaceHttpsWithHttp(obj[key]);
+                          }
+                        }
+                        return obj;
+                      }
+                    e = replaceHttpsWithHttp(e)
                     window.data2 = e;
                     
                     this.roomLabels = []

+ 5 - 2
scene - 副本/public/static/js/manage.js

@@ -1,10 +1,12 @@
   
 var g_ProjectName=window.location.pathname.substring(window.location.pathname.indexOf("/")+1,window.location.pathname.lastIndexOf("/"));
-var g_Prefix="https://super.4dage.com/";
+// var g_Prefix="https://super.4dage.com/";
 // var g_Prefix=window.location.href.substring(0,window.location.href.indexOf("/index.html")+1);
+var g_Prefix=window.location.href.substring(0,window.location.href.indexOf("/index.html")+1);
 var s = window.location.href.split('/');
     s.pop();
 //var g_Prefix = s.join('/');
+window.isLocal = true
 var g_index=null;
 var g_modeldata=null;
 
@@ -93,6 +95,7 @@ var settings = {
     hotFastTran:false,
     transparentBg: false,
     bgImg:  null,
+    localPrefix: '',
      
     tileClass:{//默认全景贴图加载的清晰度
         pc:{
@@ -671,7 +674,7 @@ var Manage = function(){
     this.weixinURL = "https://res.wx.qq.com/open/js/jweixin-1.2.0.js",
     this.time = "?"+new Date().getTime();
     this.loadAudio();
-    this.loadWeixin();
+    // this.loadWeixin();
 }
 //动态加载js文件
 Manage.prototype.LoadJs = function(_files, succes){

+ 3 - 2
scene - 副本/public/static/js/myShow.js

@@ -1,7 +1,8 @@
 var g_ProjectName=window.location.pathname.substring(window.location.pathname.indexOf("/")+1,window.location.pathname.lastIndexOf("/"));
-var g_Prefix="https://super.4dage.com/";
-// var g_Prefix=window.location.href.substring(0,window.location.href.indexOf("/index.html")+1);
+// var g_Prefix="https://super.4dage.com/";
+var g_Prefix=window.location.href.substring(0,window.location.href.indexOf("/index.html")+1);
 var s = window.location.href.split('/');
+window.isLocal = true
 s.pop();
 //var g_Prefix = s.join('/');
 var g_index=null;

+ 8 - 8
scene - 副本/src/pages/Home.vue

@@ -170,14 +170,14 @@ export default {
       });
     });
   },
-  async created() {
-    // 发送访问量
-    try {
-      await addVisitAPI();
-    } catch (e) {
-      console.log(e);
-    }
-  },
+  // async created() {
+  //   // 发送访问量
+  //   try {
+  //     await addVisitAPI();
+  //   } catch (e) {
+  //     console.log(e);
+  //   }
+  // },
 };
 </script>