Commit 1dc2e5de authored by 张晨辰's avatar 张晨辰

feat: merge

parent d64a4c0f
......@@ -3,7 +3,11 @@
*/
export const API_HOST = 'http://10.10.94.31:7777';
<<<<<<< Updated upstream
//export const API_HOST = 'http://localhost:3002';
=======
// export const API_HOST = 'http://localhost:3002';
>>>>>>> Stashed changes
export const ASSETS_BASE = 'http://0.0.0.0:4002/assets';
//文件类型图标 t表示展示缩略图
......
......@@ -30,6 +30,8 @@
"Failed to delete project": "Failed to delete project",
"Failed to get project": "Failed to get project",
"Failed to save project": "Failed to save project",
"Confirm to exit the editor": "Confirm to exit the editor?",
"Confirm to publish": "Confirm to publish?",
"menu": {
"save": "Save",
"details": "Details",
......
......@@ -24,5 +24,19 @@
"Failed to duplicate project": "复制项目失败",
"Failed to delete project": "删除项目失败",
"Failed to get project": "获取项目失败",
"Failed to save project": "保存项目失败"
"Failed to save project": "保存项目失败",
"menu": {
"save": "保存",
"details": "详情",
"preview": "预览",
"publish": "发布",
"data-mapping": "数据映射",
"exit": "退出"
},
"panes": {
"Assets": "素材",
"Inspector": "属性",
"Playground": "编辑",
"Views": "视图"
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
* Created by rockyl on 2019-09-19.
*/
import {projectApi} from "../../api";
import { projectApi } from "../../api";
export const projectStore = {
state: {
......@@ -10,7 +10,7 @@ export const projectStore = {
name: '',
creator: '',
data: {
views: [],
views: [{ name: 'body', children: [] }],
assets: [],
dataMapping: [],
}
......@@ -37,11 +37,30 @@ export const projectStore = {
}
},
createView(state) {
state.data.views.push({
name: '未命名',
children: []
})
console.log(state.data.views);
}
},
getters: {
views: state => {
return state.views
}
},
actions: {
async updateProject({commit}, projectID) {
const project = await projectApi.getData(projectID);
commit('updateProject', project);
},
/**
* 新建视图
*/
async createView({ commit }) {
commit('createView');
}
},
};
......@@ -26,7 +26,7 @@
flex-wrap: wrap;
.file-item {
padding: 5px 5px 0;
padding: 5px;
color: $--color-text-regular;
.icon {
......
......@@ -17,18 +17,18 @@
</template>
<script>
import {mapState, mapActions} from 'vuex'
import SplitPanes from 'splitpanes'
import ToolBar from "./Editor/ToolBar";
import Inspector from "./Editor/Inspector";
import Views from "./Editor/Views";
import Playground from "./Editor/Playground";
import Assets from "./Editor/Assets";
import ProjectDetailsDialog from "./Editor/dialogs/ProjectDetailsDialog";
import DataMappingDialog from "./Editor/dialogs/DataMappingDialog";
import {playWaiting} from "../utils";
import { mapState, mapActions } from 'vuex';
import SplitPanes from 'splitpanes';
import ToolBar from './Editor/ToolBar';
import Inspector from './Editor/Inspector';
import Views from './Editor/Views';
import Playground from './Editor/Playground';
import Assets from './Editor/Assets';
import ProjectDetailsDialog from './Editor/dialogs/ProjectDetailsDialog';
import DataMappingDialog from './Editor/dialogs/DataMappingDialog';
import { playWaiting } from '../utils';
export default {
export default {
name: 'Editor',
components: {
DataMappingDialog,
......@@ -38,49 +38,78 @@
Views,
Inspector,
ToolBar,
SplitPanes,
SplitPanes
},
data() {
const panesConfig = localStorage.panesConfig ? JSON.parse(localStorage.panesConfig) : [0.8, 0.8, 0.3];
return {
panesConfig,
}
panesConfig
};
},
mounted() {
const {projectID} = this.$route.params;
if(projectID){
const { projectID } = this.$route.params;
if (projectID) {
playWaiting(this.updateProject(projectID), this.$t('Preparing')).catch(e => {});
}else{
this.$router.push({name: 'home'})
} else {
this.$router.push({ name: 'home' });
}
},
methods: {
getSize(id, side) {
let ratio = this.panesConfig[id];
return (side === 0 ? ratio : 1 - ratio) * 100
return (side === 0 ? ratio : 1 - ratio) * 100;
},
onPanesReSized(id, configs) {
this.panesConfig[id] = configs[0].width / 100;
localStorage.panesConfig = JSON.stringify(this.panesConfig);
},
clickMenu(menuItem){
clickMenu(menuItem) {
console.log(menuItem);
switch(menuItem){
switch (menuItem) {
case 'details':
this.$refs.projectDialogsDialog.show();
break;
case 'data-mapping':
this.$refs.dataMappingDialog.show();
break;
case 'exit':
this,exitConfirm();
break;
case 'publish':
this.publishConfirm();
break;
}
},
...mapActions([
'updateProject'
])
}
/**
* 退出
*/
async exitConfirm() {
await this.$confirm(this.$t('Confirm to exit the editor'), {
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancle'),
type: 'warning'
});
// todo
// exit
console.log('exit confirm');
},
/**
* 发布
*/
async publishConfirm() {
await this.$confirm(this.$t('Confirm to publish'), {
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancle'),
type: 'warning'
});
// todo
// exit
console.log('exit confirm');
},
...mapActions(['updateProject'])
}
};
</script>
<style lang="scss">
</style>
\ No newline at end of file
......@@ -38,7 +38,7 @@
return fileTypeIcon[this.ext] === 't';
},
thumbnailUrl(){
return ASSETS_BASE + this.data.url;
return this.data.url;
},
},
methods: {
......
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