|
@@ -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>
|