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

feat: merge

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