Merge pull request #4 from ananzhusen/master

anjin_modify_preview
This commit is contained in:
ananzhusen 2021-04-22 11:17:26 +08:00 committed by GitHub
commit 1be4b264fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 24 deletions

View File

@ -87,21 +87,23 @@ export default {
};
},
created: function () {
const data = window.topologyData;
//
if (data) {
this.data = { data: Object.assign({}, data) };
setTimeout(() => {
window.topologyData = null;
}, 200);
} else {
// Do sth.
}
},
mounted() {
// 7777777().js rg.js
if (window.registerTools) {
window.registerTools();
//
const json = sessionStorage.getItem('topologyData');
if (!this.$route.query.id && json) {
this.data = JSON.parse(json);
setTimeout(() => {
// session
sessionStorage.removeItem('topologyData');
}, 200);
}
this.materials.system[0].list = this.materials.system[0].list.concat(
window.topologyTools.map((el, index) => {
return {
@ -166,8 +168,10 @@ export default {
case 'preview':
//
// 便
window.topologyData = window.topology.data;
//
// sessionStorage
sessionStorage.setItem('topologyData',JSON.stringify(window.topology.pureData()));
this.$router.push({
path: '/preview',
query: { id: 'xxx', r: '1' },

View File

@ -32,16 +32,12 @@ export default {
};
},
created() {
const data = window.topologyData;
if (data) {
this.locked = data.locked;
data.locked = 1;
this.data = Object.assign({}, data);
setTimeout(() => {
window.topologyData = null;
}, 200);
} else {
// Do sth.
//
const data = sessionStorage.getItem('topologyData');
if(data){
this.data = JSON.parse(data);
}else{
//
}
this.showTools = !!this.$route.query.r;
@ -56,8 +52,6 @@ export default {
},
onBack() {
window.topology.data.locked = this.locked;
window.topologyData = window.topology.data;
this.$router.go(-1);
},
},