Commit 31be7da1 authored by rockyl's avatar rockyl

拷贝模板到粘贴板

parent e667fb72
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
"Meta Editor": "Meta Editor", "Meta Editor": "Meta Editor",
"Env editor": "Env editor", "Env editor": "Env editor",
"As inline": "As inline", "As inline": "As inline",
"Copy template to clipboard": "Copy template to clipboard",
"Link to parent": "Link to parent", "Link to parent": "Link to parent",
"Input project name": "Input project name", "Input project name": "Input project name",
"Invalid project name": "Invalid project name", "Invalid project name": "Invalid project name",
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
"Meta Editor": "过程元配置", "Meta Editor": "过程元配置",
"Env editor": "环境编辑器", "Env editor": "环境编辑器",
"As inline": "作为内联", "As inline": "作为内联",
"Copy template to clipboard": "复制模板到粘贴板",
"Link to parent": "连接到父节点", "Link to parent": "连接到父节点",
"Input project name": "输入项目名", "Input project name": "输入项目名",
"Invalid project name": "无效的项目名", "Invalid project name": "无效的项目名",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<inspector splitpanes-min="20" :splitpanes-size="getSize(0, 1)"></inspector> <inspector splitpanes-min="20" :splitpanes-size="getSize(0, 1)"></inspector>
</split-panes> </split-panes>
<details-dialog ref="dialogsDialog"/> <details-dialog ref="dialogsDialog"/>
<pack-result-dialog ref="packResultDialog"/>
</div> </div>
</template> </template>
...@@ -26,10 +27,12 @@ ...@@ -26,10 +27,12 @@
import DetailsDialog from "./Editor/dialogs/DetailsDialog"; import DetailsDialog from "./Editor/dialogs/DetailsDialog";
import {playWaiting} from "../utils"; import {playWaiting} from "../utils";
import i18n from "../i18n"; import i18n from "../i18n";
import PackResultDialog from "./Editor/dialogs/PackResultDialog";
export default { export default {
name: 'Editor', name: 'Editor',
components: { components: {
PackResultDialog,
DetailsDialog, DetailsDialog,
Assets, Assets,
Playground, Playground,
...@@ -192,13 +195,14 @@ ...@@ -192,13 +195,14 @@
}); });
try{ try{
await this.saveProject(); await this.saveProject();
const {tplUrl} = await this.packProject(); const packResult = await this.packProject();
this.$message({ this.$message({
message: this.$t('Pack project successfully'), message: this.$t('Pack project successfully'),
type: 'success', type: 'success',
duration: 1000, duration: 1000,
}); });
this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), { this.$refs.packResultDialog.show(packResult);
/*this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
confirmButtonText: this.$t('Open in new tab'), confirmButtonText: this.$t('Open in new tab'),
cancelButtonText: this.$t('Close'), cancelButtonText: this.$t('Close'),
type: 'warning' type: 'warning'
...@@ -208,7 +212,7 @@ ...@@ -208,7 +212,7 @@
}, 500); }, 500);
}).catch(() => { }).catch(() => {
}); });*/
}catch (e) { }catch (e) {
this.$message({ this.$message({
message: this.$t('Pack project failed'), message: this.$t('Pack project failed'),
......
<template>
<el-dialog :title="$t('Project details')" width="70%" :visible.sync="visible" @open="onOpen"
:close-on-click-modal="false"
:append-to-body="true"
:show-close="false"
custom-class="details-dialog"
>
<div>
<p>{{$t('Pack project successfully')}}</p>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="onClose">{{$t('Close')}}</el-button>
<el-button size="mini" @click="copy">{{$t('Copy template to clipboard')}}</el-button>
<el-button size="mini" type="primary" @click="openInNewTab">{{$t('Open in new tab')}}</el-button>
</div>
</el-dialog>
</template>
<script>
import copy from 'copy-to-clipboard'
export default {
name: "PackResultDialog",
components: {},
data() {
return {
visible: false,
activeName: 'project',
packResult: null,
}
},
methods: {
show(packResult) {
this.packResult = packResult;
this.visible = true;
},
onClose() {
this.visible = false;
},
openInNewTab() {
this.visible = false;
setTimeout(()=>{
window.open(this.packResult.tplUrl, 'blank');
}, 500);
},
copy() {
this.visible = false;
copy(this.packResult.tpl);
},
onOpen() {
},
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment