tremble 2 лет назад
Родитель
Сommit
7bb9ef82fe
45 измененных файлов с 370 добавлено и 237 удалено
  1. 2 1
      miniProgram/app.json
  2. 66 0
      miniProgram/pages/share/index.js
  3. 3 0
      miniProgram/pages/share/index.json
  4. 2 0
      miniProgram/pages/share/index.wxml
  5. 1 0
      miniProgram/pages/share/index.wxss
  6. 1 0
      miniProgram/pages/webview/index.js
  7. 1 0
      web/index.html
  8. 1 0
      web/public/js/jweixin-1.6.0.js
  9. BIN
      web/public/program/Build/Build1.data.unityweb
  10. BIN
      web/public/program/Build/Build1.framework.js.unityweb
  11. 0 1
      web/public/program/Build/Build1.loader.js
  12. BIN
      web/public/program/Build/Build1.wasm.unityweb
  13. BIN
      web/public/program/Build/Build10.data.unityweb
  14. BIN
      web/public/program/Build/Build10.framework.js.unityweb
  15. 0 1
      web/public/program/Build/Build10.loader.js
  16. BIN
      web/public/program/Build/Build10.wasm.unityweb
  17. BIN
      web/public/program/Build/Build6.data.unityweb
  18. BIN
      web/public/program/Build/Build11.framework.js.unityweb
  19. 0 0
      web/public/program/Build/Build11.loader.js
  20. BIN
      web/public/program/Build/Build11.wasm.unityweb
  21. BIN
      web/public/program/Build/Build3.data.unityweb
  22. BIN
      web/public/program/Build/Build12.framework.js.unityweb
  23. 0 0
      web/public/program/Build/Build12.loader.js
  24. BIN
      web/public/program/Build/Build12.wasm.unityweb
  25. BIN
      web/public/program/Build/Build2.data.unityweb
  26. BIN
      web/public/program/Build/Build2.framework.js.unityweb
  27. 0 1
      web/public/program/Build/Build2.loader.js
  28. BIN
      web/public/program/Build/Build2.wasm.unityweb
  29. 0 1
      web/public/program/Build/Build3.loader.js
  30. BIN
      web/public/program/Build/Build6.framework.js.unityweb
  31. 0 1
      web/public/program/Build/Build6.loader.js
  32. BIN
      web/public/program/Build/Build6.wasm.unityweb
  33. BIN
      web/public/program/Build/Build8.data.unityweb
  34. BIN
      web/public/program/Build/Build8.framework.js.unityweb
  35. BIN
      web/public/program/Build/Build8.wasm.unityweb
  36. BIN
      web/public/program/Build/BuildTest.data.unityweb
  37. BIN
      web/public/program/Build/BuildTest.framework.js.unityweb
  38. BIN
      web/public/program/Build/BuildTest.wasm.unityweb
  39. 21 12
      web/public/program/README.txt
  40. 4 4
      web/public/program/ServiceWorker.js
  41. 118 102
      web/public/program/index copy.html
  42. 125 104
      web/public/program/index.html
  43. 11 6
      web/src/App.vue
  44. 13 1
      web/src/views/Courtyard.vue
  45. 1 2
      web/src/views/Editing.vue

+ 2 - 1
miniProgram/app.json

@@ -1,7 +1,8 @@
 {
   "pages": [
     "pages/index/index",
-    "pages/webview/index"
+    "pages/webview/index",
+    "pages/share/index"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 66 - 0
miniProgram/pages/share/index.js

@@ -0,0 +1,66 @@
+// pages/share/index.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
miniProgram/pages/share/index.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
miniProgram/pages/share/index.wxml

@@ -0,0 +1,2 @@
+<!--pages/share/index.wxml-->
+<text>pages/share/index.wxml</text>

+ 1 - 0
miniProgram/pages/share/index.wxss

@@ -0,0 +1 @@
+/* pages/share/index.wxss */

+ 1 - 0
miniProgram/pages/webview/index.js

@@ -33,6 +33,7 @@ Page({
       url: `http://192.168.20.11:5173/?token=${token}#/`
     })
 
+    
   },
 
 

+ 1 - 0
web/index.html

@@ -8,6 +8,7 @@
   </head>
   <body>
     <div id="app"></div>
+    <script src="js/jweixin-1.6.0.js"></script>
     <script type="module" src="/src/main.js"></script>
   </body>
 </html>

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
web/public/js/jweixin-1.6.0.js


BIN
web/public/program/Build/Build1.data.unityweb


BIN
web/public/program/Build/Build1.framework.js.unityweb


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
web/public/program/Build/Build1.loader.js


BIN
web/public/program/Build/Build1.wasm.unityweb


BIN
web/public/program/Build/Build10.data.unityweb


BIN
web/public/program/Build/Build10.framework.js.unityweb


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
web/public/program/Build/Build10.loader.js


BIN
web/public/program/Build/Build10.wasm.unityweb


BIN
web/public/program/Build/Build6.data.unityweb


BIN
web/public/program/Build/Build11.framework.js.unityweb


web/public/program/Build/BuildTest.loader.js → web/public/program/Build/Build11.loader.js


BIN
web/public/program/Build/Build11.wasm.unityweb


BIN
web/public/program/Build/Build3.data.unityweb


BIN
web/public/program/Build/Build12.framework.js.unityweb


web/public/program/Build/Build8.loader.js → web/public/program/Build/Build12.loader.js


BIN
web/public/program/Build/Build12.wasm.unityweb


BIN
web/public/program/Build/Build2.data.unityweb


BIN
web/public/program/Build/Build2.framework.js.unityweb


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
web/public/program/Build/Build2.loader.js


BIN
web/public/program/Build/Build2.wasm.unityweb


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
web/public/program/Build/Build3.loader.js


BIN
web/public/program/Build/Build6.framework.js.unityweb


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
web/public/program/Build/Build6.loader.js


BIN
web/public/program/Build/Build6.wasm.unityweb


BIN
web/public/program/Build/Build8.data.unityweb


BIN
web/public/program/Build/Build8.framework.js.unityweb


BIN
web/public/program/Build/Build8.wasm.unityweb


BIN
web/public/program/Build/BuildTest.data.unityweb


BIN
web/public/program/Build/BuildTest.framework.js.unityweb


BIN
web/public/program/Build/BuildTest.wasm.unityweb


+ 21 - 12
web/public/program/README.txt

@@ -1,19 +1,28 @@
-unityInstance.SendMessage('Main', 'OnClickModule', 0); //点击主楼
-unityInstance.SendMessage('Main', 'OnClickModule', 1); //点击一进院
-unityInstance.SendMessage('Main', 'OnClickModule', 2); //点击二进院
-unityInstance.SendMessage('Main', 'OnClickModule', 3); //点击后院
-unityInstance.SendMessage('Main', 'OnClickModule', 4); //点击左侧田地
-unityInstance.SendMessage('Main', 'OnClickModule', -1); //点击整体预览 -默认值,刚进入场景的时候不需要调用这个
 
+//js -> unity
 
-unityInstance.SendMessage('Main', 'OnClickType', 0); //点击构建
-unityInstance.SendMessage('Main', 'OnClickType', 1); //点击颜色
+unityInstance.SendMessage('Main', 'OnClickEdit', 0); //点击编辑 -刚进入场景时默认为浏览模式,调用此函数后进入编辑模式
 
+unityInstance.SendMessage('Main', 'OnClickModule', 0); //单击模块按钮 0主楼 1一进院 2二进院 3后院 4左侧田地 -1整体预览
+unityInstance.SendMessage('Main', 'OnClickType', 0); //点击类型按钮 0构建 1颜色
+unityInstance.SendMessage('Main', 'OnClickItem', 0); //点击类型中的元素
 
-unityInstance.SendMessage('Main', 'OnClickItem', itemIndex); //点击(颜色/构建)的某一项,从0开始
 
+unityInstance.SendMessage('Main', 'Save', 0); //保存拼接状态	-注意:调用完此函数后,ui需要恢复成我的庭院
+unityInstance.SendMessage('Main', 'Cancel', 0); //恢复拼接状态	-注意:调用完此函数后,ui需要恢复成我的庭院
 
-unityInstance.SendMessage('Main', 'Save', itemIndex); //点击保存
-unityInstance.SendMessage('Main', 'Cancel', itemIndex); //点击取消
 
-unityInstance.SendMessage('Main', 'CallShareImage', itemIndex); //点击取消
+
+
+unityInstance.SendMessage('Main', 'CallShareImage', 0); //分享
+
+
+
+
+//unity -> js (此为需要定义的函数)
+
+function onShareImage(str)  //点击分享,截图成功回调。string类型参数
+
+function enableUIInteract()  //启用ui交互 - 默认为允许交互
+function disableUIInteract()  //禁用ui交互
+function showTouchErrorTips()  //显示触摸位置错误tips

+ 4 - 4
web/public/program/ServiceWorker.js

@@ -1,9 +1,9 @@
 const cacheName = "DefaultCompany-HeNanMuseum-0.1";
 const contentToCache = [
-    "Build/Build10.loader.js",
-    "Build/Build10.framework.js.unityweb",
-    "Build/Build10.data.unityweb",
-    "Build/Build10.wasm.unityweb",
+    "Build/Build12.loader.js",
+    "Build/Build12.framework.js.unityweb",
+    "Build/Build12.data.unityweb",
+    "Build/Build12.wasm.unityweb",
     "TemplateData/style.css"
 
 ];

+ 118 - 102
web/public/program/index copy.html

@@ -1,110 +1,123 @@
 <!DOCTYPE html>
 <html lang="en-us">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>Unity WebGL Player | HeNanMuseum</title>
-    <link rel="shortcut icon" href="TemplateData/favicon.ico">
-    <link rel="stylesheet" href="TemplateData/style.css">
-    <link rel="manifest" href="manifest.webmanifest">
-  </head>
-  <body>
-    <div id="unity-container">
-      <canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
-      <div id="unity-loading-bar">
-        <div id="unity-logo"></div>
-        <div id="unity-progress-bar-empty">
-          <div id="unity-progress-bar-full"></div>
-        </div>
+
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Unity WebGL Player | HeNanMuseum</title>
+  <link rel="shortcut icon" href="TemplateData/favicon.ico">
+  <link rel="stylesheet" href="TemplateData/style.css">
+  <link rel="manifest" href="manifest.webmanifest">
+</head>
+
+<body>
+  <div id="unity-container">
+    <canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
+    <div id="unity-loading-bar">
+      <div id="unity-logo"></div>
+      <div id="unity-progress-bar-empty">
+        <div id="unity-progress-bar-full"></div>
       </div>
-      <div id="unity-warning"> </div>
     </div>
-    <script>
-      window.addEventListener("load", function () {
-        if ("serviceWorker" in navigator) {
-          navigator.serviceWorker.register("ServiceWorker.js");
-        }
-      });
-
-      var container = document.querySelector("#unity-container");
-      var canvas = document.querySelector("#unity-canvas");
-      var loadingBar = document.querySelector("#unity-loading-bar");
-      var progressBarFull = document.querySelector("#unity-progress-bar-full");
-      var warningBanner = document.querySelector("#unity-warning");
-
-      // 新添加
-      let unityInstance = null
-      // Shows a temporary message banner/ribbon for a few seconds, or
-      // a permanent error message on top of the canvas if type=='error'.
-      // If type=='warning', a yellow highlight color is used.
-      // Modify or remove this function to customize the visually presented
-      // way that non-critical warnings and error messages are presented to the
-      // user.
-      function unityShowBanner(msg, type) {
-        function updateBannerVisibility() {
-          warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
-        }
-        var div = document.createElement('div');
-        div.innerHTML = msg;
-        warningBanner.appendChild(div);
-        if (type == 'error') div.style = 'background: red; padding: 10px;';
-        else {
-          if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
-          setTimeout(function() {
-            warningBanner.removeChild(div);
-            updateBannerVisibility();
-          }, 5000);
-        }
-        updateBannerVisibility();
+    <div id="unity-warning"> </div>
+  </div>
+  <script>
+    window.addEventListener("load", function () {
+      if ("serviceWorker" in navigator) {
+        navigator.serviceWorker.register("ServiceWorker.js");
       }
+    });
 
-      var buildUrl = "Build";
-      var loaderUrl = buildUrl + "/Build8.loader.js";
-      var config = {
-        dataUrl: buildUrl + "/Build8.data.unityweb",
-        frameworkUrl: buildUrl + "/Build8.framework.js.unityweb",
-        codeUrl: buildUrl + "/Build8.wasm.unityweb",
-        streamingAssetsUrl: "StreamingAssets",
-        companyName: "DefaultCompany",
-        productName: "HeNanMuseum",
-        productVersion: "0.1",
-        showBanner: unityShowBanner,
-      };
-
-      // By default Unity keeps WebGL canvas render target size matched with
-      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
-      // Set this to false if you want to decouple this synchronization from
-      // happening inside the engine, and you would instead like to size up
-      // the canvas DOM size and WebGL render target sizes yourself.
-      // config.matchWebGLToCanvasSize = false;
-
-      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
-        // Mobile device style: fill the whole browser client area with the game canvas:
-        var meta = document.createElement('meta');
-        meta.name = 'viewport';
-        meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
-        document.getElementsByTagName('head')[0].appendChild(meta);
+    var container = document.querySelector("#unity-container");
+    var canvas = document.querySelector("#unity-canvas");
+    var loadingBar = document.querySelector("#unity-loading-bar");
+    var progressBarFull = document.querySelector("#unity-progress-bar-full");
+    var warningBanner = document.querySelector("#unity-warning");
+    let unityInstance = null
+    // Shows a temporary message banner/ribbon for a few seconds, or
+    // a permanent error message on top of the canvas if type=='error'.
+    // If type=='warning', a yellow highlight color is used.
+    // Modify or remove this function to customize the visually presented
+    // way that non-critical warnings and error messages are presented to the
+    // user.
+    function unityShowBanner(msg, type) {
+      function updateBannerVisibility() {
+        warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
+      }
+      var div = document.createElement('div');
+      div.innerHTML = msg;
+      warningBanner.appendChild(div);
+      if (type == 'error') div.style = 'background: red; padding: 10px;';
+      else {
+        if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
+        setTimeout(function () {
+          warningBanner.removeChild(div);
+          updateBannerVisibility();
+        }, 5000);
       }
+      updateBannerVisibility();
+    }
+
+    var buildUrl = "Build";
+    var loaderUrl = buildUrl + "/Build11.loader.js";
+    var config = {
+      dataUrl: buildUrl + "/Build11.data.unityweb",
+      frameworkUrl: buildUrl + "/Build11.framework.js.unityweb",
+      codeUrl: buildUrl + "/Build11.wasm.unityweb",
+      streamingAssetsUrl: "StreamingAssets",
+      companyName: "DefaultCompany",
+      productName: "HeNanMuseum",
+      productVersion: "0.1",
+      showBanner: unityShowBanner,
+    };
+
+    // By default Unity keeps WebGL canvas render target size matched with
+    // the DOM size of the canvas element (scaled by window.devicePixelRatio)
+    // Set this to false if you want to decouple this synchronization from
+    // happening inside the engine, and you would instead like to size up
+    // the canvas DOM size and WebGL render target sizes yourself.
+    // config.matchWebGLToCanvasSize = false;
+
+    if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
+      // Mobile device style: fill the whole browser client area with the game canvas:
+      var meta = document.createElement('meta');
+      meta.name = 'viewport';
+      meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
+      document.getElementsByTagName('head')[0].appendChild(meta);
+    }
+
+    loadingBar.style.display = "block";
+
+    var script = document.createElement("script");
+    script.src = loaderUrl;
+    script.onload = () => {
+      createUnityInstance(canvas, config, (progress) => {
+        progressBarFull.style.width = 100 * progress + "%";
+      }).then((instance) => {
+        loadingBar.style.display = "none";
+        // 新添加
+        unityInstance = instance
+      }).catch((message) => {
+        alert(message);
+      });
+    };
+    document.body.appendChild(script);
+
 
-      loadingBar.style.display = "block";
-
-      var script = document.createElement("script");
-      script.src = loaderUrl;
-      script.onload = () => {
-        createUnityInstance(canvas, config, (progress) => {
-          progressBarFull.style.width = 100 * progress + "%";
-        }).then((instance) => {
-          loadingBar.style.display = "none";
-          // 新添加
-          unityInstance = instance
-        }).catch((message) => {
-          alert(message);
-        });
-      };
-      document.body.appendChild(script);
 
     // 新添加
+    window.onShareImage = (img) => {
+      console.log('result:', img);
+      window.parent.postMessage({
+        source: 'shareImg',
+        data: img,
+      },
+        "*")
+    }
+
+
     window.addEventListener('message', (res) => {
+      console.log('result:', unityInstance);
       if (!unityInstance) return
       if (Object.prototype.toString.call(res.data) == "[object Object]") {
         let data = res.data.data;
@@ -137,15 +150,18 @@
           unityInstance.SendMessage('Main', 'Cancel');
         }
 
+
         // 图片回调
         else if (res.data.source === "CallShareImage") {
-          unityInstance.SendMessage('Main', 'CallShareImage', (img) => {
-            console.log('result:', img);
-          });
+          unityInstance.SendMessage('Main', 'CallShareImage');
         }
+
+
       }
     })
 
-    </script>
-  </body>
-</html>
+
+  </script>
+</body>
+
+</html>

+ 125 - 104
web/public/program/index.html

@@ -1,114 +1,134 @@
 <!DOCTYPE html>
 <html lang="en-us">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>Unity WebGL Player | HeNanMuseum</title>
-    <link rel="shortcut icon" href="TemplateData/favicon.ico">
-    <link rel="stylesheet" href="TemplateData/style.css">
-    <link rel="manifest" href="manifest.webmanifest">
-  </head>
-  <body>
-    <div id="unity-container">
-      <canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
-      <div id="unity-loading-bar">
-        <div id="unity-logo"></div>
-        <div id="unity-progress-bar-empty">
-          <div id="unity-progress-bar-full"></div>
-        </div>
+
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Unity WebGL Player | HeNanMuseum</title>
+  <link rel="shortcut icon" href="TemplateData/favicon.ico">
+  <link rel="stylesheet" href="TemplateData/style.css">
+  <link rel="manifest" href="manifest.webmanifest">
+</head>
+
+<body>
+  <div id="unity-container">
+    <canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
+    <div id="unity-loading-bar">
+      <div id="unity-logo"></div>
+      <div id="unity-progress-bar-empty">
+        <div id="unity-progress-bar-full"></div>
       </div>
-      <div id="unity-warning"> </div>
     </div>
-    <script>
-      window.addEventListener("load", function () {
-        if ("serviceWorker" in navigator) {
-          navigator.serviceWorker.register("ServiceWorker.js");
-        }
+    <div id="unity-warning"> </div>
+  </div>
+  <script>
+    window.addEventListener("load", function () {
+      if ("serviceWorker" in navigator) {
+        navigator.serviceWorker.register("ServiceWorker.js");
+      }
+    });
+
+    var container = document.querySelector("#unity-container");
+    var canvas = document.querySelector("#unity-canvas");
+    var loadingBar = document.querySelector("#unity-loading-bar");
+    var progressBarFull = document.querySelector("#unity-progress-bar-full");
+    var warningBanner = document.querySelector("#unity-warning");
+    let unityInstance = null
+    // Shows a temporary message banner/ribbon for a few seconds, or
+    // a permanent error message on top of the canvas if type=='error'.
+    // If type=='warning', a yellow highlight color is used.
+    // Modify or remove this function to customize the visually presented
+    // way that non-critical warnings and error messages are presented to the
+    // user.
+    function unityShowBanner(msg, type) {
+      function updateBannerVisibility() {
+        warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
+      }
+      var div = document.createElement('div');
+      div.innerHTML = msg;
+      warningBanner.appendChild(div);
+      if (type == 'error') div.style = 'background: red; padding: 10px;';
+      else {
+        if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
+        setTimeout(function () {
+          warningBanner.removeChild(div);
+          updateBannerVisibility();
+        }, 5000);
+      }
+      updateBannerVisibility();
+    }
+
+    var buildUrl = "Build";
+    var loaderUrl = buildUrl + "/Build12.loader.js";
+    var config = {
+      dataUrl: buildUrl + "/Build12.data.unityweb",
+      frameworkUrl: buildUrl + "/Build12.framework.js.unityweb",
+      codeUrl: buildUrl + "/Build12.wasm.unityweb",
+      streamingAssetsUrl: "StreamingAssets",
+      companyName: "DefaultCompany",
+      productName: "HeNanMuseum",
+      productVersion: "0.1",
+      showBanner: unityShowBanner,
+    };
+
+    // By default Unity keeps WebGL canvas render target size matched with
+    // the DOM size of the canvas element (scaled by window.devicePixelRatio)
+    // Set this to false if you want to decouple this synchronization from
+    // happening inside the engine, and you would instead like to size up
+    // the canvas DOM size and WebGL render target sizes yourself.
+    // config.matchWebGLToCanvasSize = false;
+
+    if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
+      // Mobile device style: fill the whole browser client area with the game canvas:
+      var meta = document.createElement('meta');
+      meta.name = 'viewport';
+      meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
+      document.getElementsByTagName('head')[0].appendChild(meta);
+    }
+
+    loadingBar.style.display = "block";
+
+    var script = document.createElement("script");
+    script.src = loaderUrl;
+    script.onload = () => {
+      createUnityInstance(canvas, config, (progress) => {
+        progressBarFull.style.width = 100 * progress + "%";
+      }).then((instance) => {
+        loadingBar.style.display = "none";
+
+        unityInstance = instance
+      }).catch((message) => {
+        alert(message);
       });
+    };
+    document.body.appendChild(script);
 
-      var container = document.querySelector("#unity-container");
-      var canvas = document.querySelector("#unity-canvas");
-      var loadingBar = document.querySelector("#unity-loading-bar");
-      var progressBarFull = document.querySelector("#unity-progress-bar-full");
-      var warningBanner = document.querySelector("#unity-warning");
-      let unityInstance = null
-
-      // Shows a temporary message banner/ribbon for a few seconds, or
-      // a permanent error message on top of the canvas if type=='error'.
-      // If type=='warning', a yellow highlight color is used.
-      // Modify or remove this function to customize the visually presented
-      // way that non-critical warnings and error messages are presented to the
-      // user.
-      function unityShowBanner(msg, type) {
-        function updateBannerVisibility() {
-          warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
-        }
-        var div = document.createElement('div');
-        div.innerHTML = msg;
-        warningBanner.appendChild(div);
-        if (type == 'error') div.style = 'background: red; padding: 10px;';
-        else {
-          if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
-          setTimeout(function() {
-            warningBanner.removeChild(div);
-            updateBannerVisibility();
-          }, 5000);
-        }
-        updateBannerVisibility();
-      }
 
-      var buildUrl = "Build";
-      var loaderUrl = buildUrl + "/Build10.loader.js";
-      var config = {
-        dataUrl: buildUrl + "/Build10.data.unityweb",
-        frameworkUrl: buildUrl + "/Build10.framework.js.unityweb",
-        codeUrl: buildUrl + "/Build10.wasm.unityweb",
-        streamingAssetsUrl: "StreamingAssets",
-        companyName: "DefaultCompany",
-        productName: "HeNanMuseum",
-        productVersion: "0.1",
-        showBanner: unityShowBanner,
-      };
-
-      // By default Unity keeps WebGL canvas render target size matched with
-      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
-      // Set this to false if you want to decouple this synchronization from
-      // happening inside the engine, and you would instead like to size up
-      // the canvas DOM size and WebGL render target sizes yourself.
-      // config.matchWebGLToCanvasSize = false;
-
-      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
-        // Mobile device style: fill the whole browser client area with the game canvas:
-        var meta = document.createElement('meta');
-        meta.name = 'viewport';
-        meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
-        document.getElementsByTagName('head')[0].appendChild(meta);
-      }
+    // 新添加(以下全是)
+    window.onShareImage = (img) => {
+      console.log('result:', img);
+      window.parent.postMessage({
+        source: 'shareImg',
+        data: img,
+      },
+        "*")
+    }
 
-      loadingBar.style.display = "block";
-
-      var script = document.createElement("script");
-      script.src = loaderUrl;
-      script.onload = () => {
-        createUnityInstance(canvas, config, (progress) => {
-          progressBarFull.style.width = 100 * progress + "%";
-        }).then((instance) => {
-          loadingBar.style.display = "none";
-          console.log('result:', instance);
-          unityInstance = instance
-        }).catch((message) => {
-          alert(message);
-        });
-      };
-    document.body.appendChild(script);
+
+    window.Internal_ShowTouchErrorTips = (data) => {
+      console.log('result:', data);
+    }
+
+    window.showTouchErrorTips = (data) => {
+      console.log('result:', data);
+    }
+
+    window._Internal_ShowTouchErrorTips = (data) => {
+      console.log('result:', data);
+    }
 
 
 
-      
-    // 新添加
-    window.onShareImage(img=>{
-      console.log('result:', img);
-    })
 
 
     window.addEventListener('message', (res) => {
@@ -155,7 +175,8 @@
       }
     })
 
- 
-    </script>
-  </body>
-</html>
+
+  </script>
+</body>
+
+</html>

+ 11 - 6
web/src/App.vue

@@ -1,6 +1,6 @@
 
 <template>
-  <iframe class="ifr" id="ifr" :src="`program/index.html?token=${token}`" frameborder="0"></iframe>
+  <iframe class="ifr" id="ifr" @load="onLoadIfr" :src="`program/index.html?token=${token}`" frameborder="0"></iframe>
   <router-view class="fix-root" :userInfo="userInfo" />
 
   <template v-if="!$route.meta.outoflist">
@@ -18,9 +18,6 @@
     <Transition>
       <IntegralDetail v-if="isShowIntegralDetail" @close="isShowIntegralDetail = false" />
     </Transition>
-    <Transition>
-      <Share v-if="isShowShare" @close="isShowShare = false" />
-    </Transition>
   </teleport>
 </template>
 
@@ -29,7 +26,6 @@ import Vmenu from "@/components/Vmenu.vue";
 import Introduce from "@/components/Introduce.vue";
 import IntegralDetail from '@/components/Integral-detail.vue'
 
-import Share from '@/components/Share.vue'
 
 
 import { ref, onMounted, reactive } from 'vue'
@@ -39,7 +35,6 @@ let token = utils.getQueryByName('token')
 
 const isShowIntro = ref(false)
 const isShowIntegralDetail = ref(false)
-const isShowShare = ref(false)
 const point = ref(0)
 
 
@@ -48,6 +43,16 @@ let userInfo = reactive({})
 const root = document.documentElement;
 root.style.setProperty('--bgImage', `url(${config.cdn_url}images/background.jpg)`);
 
+const onLoadIfr = () => {
+  window.onmessage = (e) => {
+    if (e.data.source === 'shareImg') {
+      e.data.data && wx.miniProgram.navigateTo({
+        url: '/pages/share/index?img='+ encodeURIComponent(e.data.data)
+      })
+    }
+  };
+}
+
 onMounted(async () => {
   let result = (await http.get('cms/wxUser/getUserInfo')).data;
   let info = result.data

+ 13 - 1
web/src/views/Courtyard.vue

@@ -4,7 +4,7 @@
       <li @click="$router.push({ name: 'Editing' })">
         <img :src="`${config.cdn_url}images/btn_edit.png`" alt="">
       </li>
-      <li>
+      <li @click="gotoShare">
         <img :src="`${config.cdn_url}images/btn_share.png`" alt="">
       </li>
     </ul>
@@ -18,7 +18,19 @@ export default {
 
   },
   methods: {
+    gotoShare() {
 
+      // 跳转到小程序页面实现保存
+      let ifrDom = document.querySelector('#ifr')
+
+      ifrDom.contentWindow.postMessage(
+        {
+          source: 'CallShareImage',
+        },
+        "*"
+      );
+      
+    }
   }
 }
 

+ 1 - 2
web/src/views/Editing.vue

@@ -165,8 +165,7 @@ const onClickLeft = (item) => {
 }
 
 const save = ()=>{
-  console.log('result:', 1111);
-  postMsg("CallShareImage", '')
+  postMsg("Save", '')
 }
 
 const mycomfirm = () => {