diff --git a/static/css/index.css b/static/css/index.css index 1659afe..9a21bf1 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -313,6 +313,7 @@ header [class*=" icon-"] { vertical-align: middle; } .ui-project-main { + position: relative; box-sizing: border-box; width: 80%; height: calc(100% - 31px); @@ -324,6 +325,13 @@ header [class*=" icon-"] { .ui-project-setting form { width: 100%; height: 100%; + background-color: #fff; +} +.ui-project-setting { + position: absolute; + top: 0; + left: 0; + z-index: 1; } .ui-control-bar { height: 39px; diff --git a/static/js/app/index.js b/static/js/app/index.js index 1afa2d7..1c087cc 100644 --- a/static/js/app/index.js +++ b/static/js/app/index.js @@ -15,10 +15,6 @@ require('../components/app-main'); window.addEventListener('DOMContentLoaded', function (){ var app; - function normalize(configure){ - return JSON.parse(JSON.stringify(configure)); - } - function init(configure){ app = new Vue({ el: '#app', @@ -42,7 +38,7 @@ window.addEventListener('DOMContentLoaded', function (){ this.activeIndex = index; }, 'save-configure': function (){ - ipc.send('app-configure', 'save', normalize(this.configure)); + ipc.send('app-configure', 'save', JSON.parse(JSON.stringify(this.configure))); } } }); diff --git a/static/js/components/app-configure/app-configure.html b/static/js/components/app-configure/app-configure.html index 59873b1..fe0e0d8 100644 --- a/static/js/components/app-configure/app-configure.html +++ b/static/js/components/app-configure/app-configure.html @@ -10,7 +10,7 @@ -
+
diff --git a/static/js/components/app-configure/index.js b/static/js/components/app-configure/index.js index c9d51f4..596768b 100644 --- a/static/js/components/app-configure/index.js +++ b/static/js/components/app-configure/index.js @@ -30,7 +30,7 @@ module.exports = Vue.component('app-configure', { name: '', path: '', submitError: '', - popup: false + showPopup: false } }, methods: { @@ -43,9 +43,9 @@ module.exports = Vue.component('app-configure', { ipc.send('app-configure', command, configure); }, popupToggle: function (){ - this.popup = !this.popup; + this.showPopup = !this.showPopup; - if (!this.popup) { + if (!this.showPopup) { this.name = ''; this.path = ''; this.submitError = ''; @@ -59,7 +59,7 @@ module.exports = Vue.component('app-configure', { if (this.uniqueProjects[this.name]) { this.submitError = '项目已存在'; } else { - this.popup = false; + this.showPopup = false; this.configure.projects.push({ name: this.name, path: this.path }); // clean imput diff --git a/static/js/components/app-main/app-main.html b/static/js/components/app-main/app-main.html index 9b801cb..03f3722 100644 --- a/static/js/components/app-main/app-main.html +++ b/static/js/components/app-main/app-main.html @@ -1,21 +1,28 @@ - -
+ + +
- - + +
diff --git a/static/js/components/app-main/index.js b/static/js/components/app-main/index.js index 2357421..37a7bef 100644 --- a/static/js/components/app-main/index.js +++ b/static/js/components/app-main/index.js @@ -5,7 +5,6 @@ var fs = require('fs'); var path = require('path'); -var ipc = require('ipc-renderer'); var Vue = require('../../vue/vue'); require('../project-configure'); @@ -29,11 +28,18 @@ module.exports = Vue.component('app-main', { } }, data: function (){ - return {}; + return { + showSetting: false + }; }, computed: { project: function (){ - var project = this.projects[this.activeIndex]; + var project = this.projects[this.activeIndex] || { + name: '', + path: '', + env: [], + command: [] + }; if (!project.env) { project.env = []; @@ -44,11 +50,22 @@ module.exports = Vue.component('app-main', { } return JSON.parse(JSON.stringify(project)); + }, + command: function (){ + console.log(this.project.command.slice(0, 3)); + return this.project.command.slice(0, 3); + }, + moreCommand: function (){ + return this.project.command.slice(3); } }, methods: { + setting: function (){ + this.showSetting = true; + }, remove: function (){ this.projects.splice(this.activeIndex, 1); + this.activeIndex = 0; this.$dispatch('save-configure'); } }, diff --git a/static/js/components/project-configure/index.js b/static/js/components/project-configure/index.js index 952e1bc..5963f7d 100644 --- a/static/js/components/project-configure/index.js +++ b/static/js/components/project-configure/index.js @@ -14,6 +14,11 @@ require('../dynamic-item'); module.exports = Vue.component('project-configure', { template: fs.readFileSync(path.join(__dirname, 'project-configure.html')).toString(), props: { + show: { + type: Boolean, + twoWay: true, + default: false + }, project: { type: Object, required: true @@ -52,11 +57,14 @@ module.exports = Vue.component('project-configure', { } else { // clean error this.submitError = ''; - + // send message this.$dispatch('edit', this.projectClone); } } + }, + cancel: function (){ + this.show = false; } }, events: { diff --git a/static/js/components/project-configure/project-configure.html b/static/js/components/project-configure/project-configure.html index 66d188d..6cbabf4 100644 --- a/static/js/components/project-configure/project-configure.html +++ b/static/js/components/project-configure/project-configure.html @@ -1,9 +1,9 @@ -
-
+
+
- +