shaogen1995 пре 2 година
родитељ
комит
189e7ee14d

+ 3 - 5
miniProgram/pages/index/index.js

@@ -23,7 +23,7 @@ Page({
 
 
 
-  onShow(){
+  onShow() {
     this.getUserInfo()
   },
   tapAuthclose() {
@@ -48,9 +48,7 @@ Page({
   },
   onStart() {
     console.log(app.globalData.userInfo);
-    let {
-      userInfo
-    } = app.globalData
+    let userInfo = app.globalData.userInfo || {}
     if (!userInfo.avatarUrl || !userInfo.nickName) {
       this.setData({
         isShowAuthorize: true
@@ -66,7 +64,7 @@ Page({
   getUserInfo() {
     fetchutil.get(`api/cms/wxUser/getUserInfo`, {}, {}).then((res) => {
       app.globalData.userInfo = res.data
-    }).catch(() => {})
+    }).catch(() => { })
   },
 
 })

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


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


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


+ 22 - 7
web/public/program/index copy 2.html

@@ -59,11 +59,11 @@
     }
 
     var buildUrl = "Build";
-    var loaderUrl = buildUrl + "/Build11.loader.js";
+    var loaderUrl = buildUrl + "/Build12.loader.js";
     var config = {
-      dataUrl: buildUrl + "/Build11.data.unityweb",
-      frameworkUrl: buildUrl + "/Build11.framework.js.unityweb",
-      codeUrl: buildUrl + "/Build11.wasm.unityweb",
+      dataUrl: buildUrl + "/Build12.data.unityweb",
+      frameworkUrl: buildUrl + "/Build12.framework.js.unityweb",
+      codeUrl: buildUrl + "/Build12.wasm.unityweb",
       streamingAssetsUrl: "StreamingAssets",
       companyName: "DefaultCompany",
       productName: "HeNanMuseum",
@@ -95,7 +95,7 @@
         progressBarFull.style.width = 100 * progress + "%";
       }).then((instance) => {
         loadingBar.style.display = "none";
-        // 新添加
+
         unityInstance = instance
       }).catch((message) => {
         alert(message);
@@ -104,8 +104,7 @@
     document.body.appendChild(script);
 
 
-
-    // 新添加
+    // 新添加(以下全是)
     window.onShareImage = (img) => {
       console.log('result:', img);
       window.parent.postMessage({
@@ -116,6 +115,22 @@
     }
 
 
+    window.Internal_ShowTouchErrorTips = (data) => {
+      console.log('result:', data);
+    }
+
+    window.showTouchErrorTips = (data) => {
+      console.log('result:', data);
+    }
+
+    window._Internal_ShowTouchErrorTips = (data) => {
+      console.log('result:', data);
+    }
+
+
+
+
+
     window.addEventListener('message', (res) => {
       console.log('result:', unityInstance);
       if (!unityInstance) return

+ 5 - 6
web/public/program/index copy.html

@@ -34,6 +34,7 @@
     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.
@@ -59,11 +60,11 @@
     }
 
     var buildUrl = "Build";
-    var loaderUrl = buildUrl + "/Build12.loader.js";
+    var loaderUrl = buildUrl + "/Build13.loader.js";
     var config = {
-      dataUrl: buildUrl + "/Build12.data.unityweb",
-      frameworkUrl: buildUrl + "/Build12.framework.js.unityweb",
-      codeUrl: buildUrl + "/Build12.wasm.unityweb",
+      dataUrl: buildUrl + "/Build13.data.unityweb",
+      frameworkUrl: buildUrl + "/Build13.framework.js.unityweb",
+      codeUrl: buildUrl + "/Build13.wasm.unityweb",
       streamingAssetsUrl: "StreamingAssets",
       companyName: "DefaultCompany",
       productName: "HeNanMuseum",
@@ -129,8 +130,6 @@
 
 
 
-
-
     window.addEventListener('message', (res) => {
       console.log('result:', unityInstance);
       if (!unityInstance) return

+ 6 - 0
web/public/program/index.html

@@ -170,6 +170,12 @@
           unityInstance.SendMessage('Main', 'CallShareImage');
         }
 
+        
+        // 点击编辑
+        else if (res.data.source === "OnClickEdit") {
+          console.log('----------------');
+          unityInstance.SendMessage('Main', 'OnClickEdit');
+        }
 
       }
     })

+ 15 - 19
web/src/views/Courtyard.vue

@@ -1,39 +1,37 @@
 <template>
   <div class="courtyard">
     <ul class="btn-area">
-      <li @click="$router.push({ name: 'Editing' })">
-        <img :src="`${config.cdn_url}images/btn_edit.png`" alt="">
+      <li @click="clickEdit">
+        <img :src="`${config.cdn_url}images/btn_edit.png`" alt="" />
       </li>
       <li @click="gotoShare">
-        <img :src="`${config.cdn_url}images/btn_share.png`" alt="">
+        <img :src="`${config.cdn_url}images/btn_share.png`" alt="" />
       </li>
     </ul>
   </div>
 </template>
 
 <script>
-
 export default {
-  setup(props) {
-
-  },
+  setup(props) {},
   methods: {
+    // 点击编辑
+    clickEdit() {
+      this.$router.push({ name: "Editing" });
+    },
     gotoShare() {
-
       // 跳转到小程序页面实现保存
-      let ifrDom = document.querySelector('#ifr')
+      let ifrDom = document.querySelector("#ifr");
 
       ifrDom.contentWindow.postMessage(
         {
-          source: 'CallShareImage',
+          source: "CallShareImage",
         },
         "*"
       );
-      
-    }
-  }
-}
-
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -52,16 +50,14 @@ export default {
     justify-content: center;
     align-items: center;
 
-    >li {
+    > li {
       margin: 0 10px;
       width: 40%;
 
-      >img {
+      > img {
         width: 100%;
       }
     }
   }
-
-
 }
 </style>

+ 157 - 111
web/src/views/Editing.vue

@@ -2,20 +2,24 @@
   <div class="editing">
     <ul class="rightbtn-area">
       <li @click="save">
-        <img :src="`${config.cdn_url}images/btn_concert.png`" alt="">
+        <img :src="`${config.cdn_url}images/btn_concert.png`" alt="" />
       </li>
       <li @click="mycomfirm">
-        <img :src="`${config.cdn_url}images/btn_cancel.png`" alt="">
+        <img :src="`${config.cdn_url}images/btn_cancel.png`" alt="" />
       </li>
     </ul>
 
     <div class="left-area">
-      <img class="wuding" :src="`${config.cdn_url}images/wuding.png`" alt="">
+      <img class="wuding" :src="`${config.cdn_url}images/wuding.png`" alt="" />
       <ul>
-        <li @click="onClickLeft(item)" :class="{ active: item.id === currentActive.id }" v-for="item in list"
-          :key="item.id">
+        <li
+          @click="onClickLeft(item)"
+          :class="{ active: item.id === currentActive.id }"
+          v-for="item in list"
+          :key="item.id"
+        >
           <span>{{ item.name }}</span>
-          <img :src="`${config.cdn_url}images/active.png`" alt="">
+          <img :src="`${config.cdn_url}images/active.png`" alt="" />
           <div class="b-line"></div>
         </li>
       </ul>
@@ -24,32 +28,53 @@
     <ul v-if="currentActive.id === -1" class="btm-area">
       <li v-for="item in steps" :key="item.id">
         <span>{{ item.name }}</span>
-        <img :src="`${config.cdn_url}images/icon_next.png`" alt="">
+        <img :src="`${config.cdn_url}images/icon_next.png`" alt="" />
       </li>
     </ul>
 
     <div v-else class="btm-bujian">
       <div class="typecon">
-        <img @click="blockTypeActive = 'block'"
-          :src="`${config.cdn_url}images/icon_element_${blockTypeActive === 'block' ? 'active' : 'normal'}.png`" alt="">
-        <img @click="blockTypeActive = 'color'"
-          :src="`${config.cdn_url}images/icon_color_${blockTypeActive === 'color' ? 'active' : 'normal'}.png`" alt="">
+        <img
+          @click="blockTypeActive = 'block'"
+          :src="`${config.cdn_url}images/icon_element_${
+            blockTypeActive === 'block' ? 'active' : 'normal'
+          }.png`"
+          alt=""
+        />
+        <img
+          @click="blockTypeActive = 'color'"
+          :src="`${config.cdn_url}images/icon_color_${
+            blockTypeActive === 'color' ? 'active' : 'normal'
+          }.png`"
+          alt=""
+        />
       </div>
 
       <div class="line"></div>
 
       <div class="b-list">
         <ul v-if="blockTypeActive === 'block'">
-          <li @click="elementActive = item.id" :class="{ active: item.id === elementActive }" v-for="item in activeBlock"
-            :key="item.id">
-            <img :src="`${config.cdn_url}images/${currentActive.floder}/${item.name}.png`" alt="">
+          <li
+            @click="elementActive = item.id"
+            :class="{ active: item.id === elementActive }"
+            v-for="item in activeBlock"
+            :key="item.id"
+          >
+            <img
+              :src="`${config.cdn_url}images/${currentActive.floder}/${item.name}.png`"
+              alt=""
+            />
           </li>
         </ul>
 
         <ul v-else>
-          <li @click="colorActive = item.id" :class="{ colorActive: item.id === colorActive }"
-            :style="{ background: item.color }" v-for="item in colorsList" :key="item.id">
-          </li>
+          <li
+            @click="colorActive = item.id"
+            :class="{ colorActive: item.id === colorActive }"
+            :style="{ background: item.color }"
+            v-for="item in colorsList"
+            :key="item.id"
+          ></li>
         </ul>
       </div>
     </div>
@@ -57,91 +82,93 @@
 </template>
 
 <script setup>
-import { ref, reactive, getCurrentInstance, unref, watch, onUnmounted } from "vue"
-import { useRouter } from 'vue-router'
-import list from '@/data'
-const router = useRouter()
-
-const instance = getCurrentInstance()
-const globalProperties = instance.appContext.config.globalProperties
+import {
+  ref,
+  reactive,
+  getCurrentInstance,
+  unref,
+  watch,
+  onUnmounted,
+} from "vue";
+import { useRouter } from "vue-router";
+import list from "@/data";
+const router = useRouter();
+
+const instance = getCurrentInstance();
+const globalProperties = instance.appContext.config.globalProperties;
 
 const steps = [
   {
     id: 1,
-    name: '步骤一:选择左侧各部分'
+    name: "步骤一:选择左侧各部分",
   },
   {
     id: 3,
-    name: '步骤二:搭建构件和上色'
+    name: "步骤二:搭建构件和上色",
   },
   {
     id: 3,
-    name: '步骤三:保存模型'
-  }
-]
-
-let activeBlock = reactive([])
-
-
-let colorsList = reactive([{
-  id: 0,
-  color: '#BC8866'
-}, {
-  id: 1,
-  color: '#D6A98C'
-},
-{
-  id: 2,
-  color: '#9F7F6A'
-}
-])
-
-
-const currentActive = ref({ id: -1 })
-const blockTypeActive = ref('block')
+    name: "步骤三:保存模型",
+  },
+];
 
+let activeBlock = reactive([]);
 
-const elementActive = ref('')
+let colorsList = reactive([
+  {
+    id: 0,
+    color: "#BC8866",
+  },
+  {
+    id: 1,
+    color: "#D6A98C",
+  },
+  {
+    id: 2,
+    color: "#9F7F6A",
+  },
+]);
 
-const colorActive = ref('')
+const currentActive = ref({ id: -1 });
+const blockTypeActive = ref("block");
 
+const elementActive = ref("");
 
+const colorActive = ref("");
 
-let ifrDom = document.querySelector('#ifr')
+let ifrDom = document.querySelector("#ifr");
 
 const reset = () => {
-  elementActive.value = ''
-  colorActive.value = ''
-  postMsg("clickTypeBtn", unref(blockTypeActive))
-}
+  elementActive.value = "";
+  colorActive.value = "";
+  postMsg("clickTypeBtn", unref(blockTypeActive));
+};
 
 watch(currentActive, () => {
-  postMsg("changeBlock", unref(currentActive.value.id))
-  reset()
-})
-
+  postMsg("changeBlock", unref(currentActive.value.id));
+  reset();
+});
 
 watch(blockTypeActive, () => {
-  postMsg("clickTypeBtn", unref(blockTypeActive))
-})
+  postMsg("clickTypeBtn", unref(blockTypeActive));
+});
 
 watch(elementActive, () => {
-  if (elementActive.value !== '') {
-    postMsg("clickItemBtn", unref(elementActive))
+  if (elementActive.value !== "") {
+    postMsg("clickItemBtn", unref(elementActive));
   }
-})
+});
 
 watch(colorActive, () => {
-  if (colorActive.value !== '') {
-    postMsg("clickItemBtn", unref(colorActive))
+  if (colorActive.value !== "") {
+    postMsg("clickItemBtn", unref(colorActive));
   }
-})
+});
 
 onUnmounted(() => {
   // 重置到预览
-  postMsg("changeBlock", -1)
-})
-
+  postMsg("changeBlock", -1);
+});
 
 const postMsg = (source, data) => {
   ifrDom.contentWindow.postMessage(
@@ -151,33 +178,38 @@ const postMsg = (source, data) => {
     },
     "*"
   );
-}
+};
+
+// 进页面 通信 编辑
+postMsg("OnClickEdit", "");
 
 const onClickLeft = (item) => {
-  console.log('result:', item);
-  currentActive.value = item
+  console.log("result:", item);
+  currentActive.value = item;
   if (item.id !== -1) {
-    activeBlock = item.blockList
+    activeBlock = item.blockList;
 
-    console.log('result:', activeBlock);
+    console.log("result:", activeBlock);
   }
+};
 
-}
-
-const save = ()=>{
-  postMsg("Save", '')
-}
+const save = () => {
+  postMsg("Save", "");
+};
 
 const mycomfirm = () => {
   globalProperties.$Dialog.confirm({
-    content: '放弃编辑后,信息将不会保存',
-    func: res => {
-      postMsg("Cancel", '')
-      router.push({ name: 'Courtyard' })
-    }
-  })
-}
+    content: "放弃编辑后,信息将不会保存",
+    func: (res) => {
+      console.log('-----------',res);
+      if(res==='ok'){
+        postMsg("Cancel", "");
+      router.push({ name: "Courtyard" });
 
+      }
+    },
+  });
+};
 </script>
 
 <style lang="scss" scoped>
@@ -195,11 +227,11 @@ const mycomfirm = () => {
     flex-direction: column;
     width: 16%;
 
-    >li {
+    > li {
       width: 100%;
       margin: 16px 0;
 
-      >img {
+      > img {
         width: 100%;
       }
     }
@@ -220,14 +252,14 @@ const mycomfirm = () => {
       width: 120%;
     }
 
-    >ul {
+    > ul {
       display: flex;
       flex-direction: column;
       justify-content: space-around;
       align-items: center;
       height: 92%;
 
-      >li {
+      > li {
         color: #fff;
         font-size: 18px;
         font-weight: bold;
@@ -235,14 +267,19 @@ const mycomfirm = () => {
         display: inline-block;
         position: relative;
 
-        >span {
+        > span {
           display: inline-block;
           width: 100%;
-          text-align-last: justify
+          text-align-last: justify;
         }
 
         .b-line {
-          background: linear-gradient(116deg, rgba(99, 84, 61, 0) 0%, rgba(99, 84, 61, 0.3) 50%, rgba(99, 84, 61, 0) 100%);
+          background: linear-gradient(
+            116deg,
+            rgba(99, 84, 61, 0) 0%,
+            rgba(99, 84, 61, 0.3) 50%,
+            rgba(99, 84, 61, 0) 100%
+          );
           width: 120%;
           height: 1px;
           position: absolute;
@@ -257,7 +294,7 @@ const mycomfirm = () => {
           }
         }
 
-        >img {
+        > img {
           opacity: 0;
           display: none;
           pointer-events: none;
@@ -267,7 +304,7 @@ const mycomfirm = () => {
           position: relative;
           color: $font-active-color;
 
-          >img {
+          > img {
             left: 50%;
             top: 50%;
             transform: translate(-50%, -50%);
@@ -287,7 +324,11 @@ const mycomfirm = () => {
     right: 0;
     width: 80%;
     height: 40px;
-    background: linear-gradient(270deg, rgba(193, 169, 122, 0.8) 0%, rgba(193, 169, 122, 0.3) 100%);
+    background: linear-gradient(
+      270deg,
+      rgba(193, 169, 122, 0.8) 0%,
+      rgba(193, 169, 122, 0.3) 100%
+    );
     backdrop-filter: blur(4px);
     display: flex;
     align-items: center;
@@ -296,24 +337,22 @@ const mycomfirm = () => {
     font-size: 12px;
     font-weight: bold;
 
-    >li {
+    > li {
       display: flex;
       align-items: center;
       justify-content: center;
 
-      >img {
+      > img {
         width: 20px;
         margin: 0 20px;
       }
 
       &:last-of-type {
-        >img {
+        > img {
           display: none;
         }
       }
     }
-
-
   }
 
   .btm-bujian {
@@ -321,7 +360,11 @@ const mycomfirm = () => {
     bottom: 0;
     right: 0;
     width: 80%;
-    background: linear-gradient(270deg, rgba(193, 169, 122, 0.8) 0%, rgba(193, 169, 122, 0.3) 100%);
+    background: linear-gradient(
+      270deg,
+      rgba(193, 169, 122, 0.8) 0%,
+      rgba(193, 169, 122, 0.3) 100%
+    );
     backdrop-filter: blur(4px);
     display: flex;
     align-items: center;
@@ -337,7 +380,7 @@ const mycomfirm = () => {
       width: 20%;
       justify-content: flex-end;
 
-      >img {
+      > img {
         margin: 0 10px;
       }
     }
@@ -346,7 +389,12 @@ const mycomfirm = () => {
       width: 1px;
       height: 50px;
       margin: 0 10px;
-      background: linear-gradient(116deg, rgba(99, 84, 61, 0) 0%, rgba(99, 84, 61, 0.49) 51%, rgba(99, 84, 61, 0) 100%);
+      background: linear-gradient(
+        116deg,
+        rgba(99, 84, 61, 0) 0%,
+        rgba(99, 84, 61, 0.49) 51%,
+        rgba(99, 84, 61, 0) 100%
+      );
     }
 
     .b-list {
@@ -359,10 +407,10 @@ const mycomfirm = () => {
         display: none;
       }
 
-      >ul {
+      > ul {
         display: inline-block;
 
-        >li {
+        > li {
           display: inline-block;
           width: 50px;
           height: 50px;
@@ -370,7 +418,7 @@ const mycomfirm = () => {
           background: #e8deca;
           border-radius: 2px;
 
-          >img {
+          > img {
             width: 100%;
             height: 100%;
             object-fit: contain;
@@ -384,10 +432,8 @@ const mycomfirm = () => {
             border: 2px solid #961014;
           }
         }
-
       }
     }
-
   }
 }
 </style>