lsc 3 年之前
父节点
当前提交
7e72d60e56

+ 2 - 2
dist/index.html

@@ -1,4 +1,4 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>cocoroboblockly</title><link href=/static/css/app.f0ad6f05143a21a12b914de13b2f0d27.css rel=stylesheet></head><style>@charset "utf-8";
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>cocoroboblockly</title><link href=/static/css/app.0c9a83be6aa527cce969f1dfc1246645.css rel=stylesheet></head><style>@charset "utf-8";
 
   div::-webkit-scrollbar {
     /*滚动条整体样式*/
@@ -42,4 +42,4 @@
     height: 100%;
     width: 100%;
     background: #e6eaf0;
-  }</style><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.c45496ecc850f4852679.js></script><script type=text/javascript src=/static/js/app.953148c6b4bf7d723fa9.js></script></body></html>
+  }</style><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.c45496ecc850f4852679.js></script><script type=text/javascript src=/static/js/app.cb26c7375b948d35b91c.js></script></body></html>

文件差异内容过多而无法显示
+ 0 - 0
dist/static/css/app.0c9a83be6aa527cce969f1dfc1246645.css


文件差异内容过多而无法显示
+ 0 - 0
dist/static/css/app.0c9a83be6aa527cce969f1dfc1246645.css.map


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/app.953148c6b4bf7d723fa9.js


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/app.953148c6b4bf7d723fa9.js.map


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/app.cb26c7375b948d35b91c.js


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/app.cb26c7375b948d35b91c.js.map


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/manifest.2ae2e69a05c33dfc65f8.js.map


+ 1 - 1
src/App.vue

@@ -99,7 +99,7 @@
 						// window.alert(err.response.data)
 						var type = this.type
 						localStorage.setItem("type",type)
-						window.location.href = "https://edu.cocorobo.cn/course/login?type=1&UnityType="+type;
+						// window.location.href = "https://edu.cocorobo.cn/course/login?type=1&UnityType="+type;
 					});
 			},
 			logout() {

+ 29 - 7
src/components/unity.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="abody">
     <div class="ablockly">
+      <el-button type="primary" class="btnPosition" @click="start()">{{loading ? "运行" : "加载中..." }}</el-button>
       <div id="blocklyDiv"></div>
       <xml id="toolbox" style="display: none">
         <category name="逻辑" colour="%{BKY_LOGIC_HUE}">
@@ -56,6 +57,8 @@ export default {
       that: this,
       workspace: null,
       type: this.$route.query.type,
+      loading: false,
+      active: false,
     };
   },
 
@@ -81,13 +84,16 @@ export default {
     clearBlockData() {
       this.workspace.clear();
     },
-    //下一步
-    // go() {
-    //   //update修改   function state里的参数
-    //   var a = this.myUpdateFunction();
-    //   this.$store.commit("update", ["function", a]);
-    //   this.$router.push("./function");
-    // },
+    //运行
+    start() {
+      if (this.loading) {
+        if (this.active) {
+          that.$refs.unityvue.contentWindow.postMessage({ do: "1" }, "*");
+        } else {
+          this.$message.error("请拼接完才能执行");
+        }
+      }
+    },
   },
 
   mounted() {
@@ -179,8 +185,13 @@ export default {
     window.addEventListener("message", function (e) {
       // 监听 message 事件
       if (e.data.success) {
+        that.loading = true;
         that.$refs.unityvue.contentWindow.postMessage({ type: that.type }, "*");
       }
+
+      if (e.data.active) {
+        that.active = true;
+      }
     });
   },
 };
@@ -211,4 +222,15 @@ export default {
 .blocklySvg {
   height: 905px !important;
 }
+
+.ablockly {
+  position: relative;
+}
+
+.btnPosition {
+  position: absolute;
+  right: 130px;
+  bottom: 35px;
+  z-index: 999999;
+}
 </style>

部分文件因为文件数量过多而无法显示