update files

This commit is contained in:
nuintun 2015-11-23 16:12:00 +08:00
parent ea69932db8
commit 034871ef5d
8 changed files with 64 additions and 28 deletions

View File

@ -313,6 +313,7 @@ header [class*=" icon-"] {
vertical-align: middle; vertical-align: middle;
} }
.ui-project-main { .ui-project-main {
position: relative;
box-sizing: border-box; box-sizing: border-box;
width: 80%; width: 80%;
height: calc(100% - 31px); height: calc(100% - 31px);
@ -324,6 +325,13 @@ header [class*=" icon-"] {
.ui-project-setting form { .ui-project-setting form {
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #fff;
}
.ui-project-setting {
position: absolute;
top: 0;
left: 0;
z-index: 1;
} }
.ui-control-bar { .ui-control-bar {
height: 39px; height: 39px;

View File

@ -15,10 +15,6 @@ require('../components/app-main');
window.addEventListener('DOMContentLoaded', function (){ window.addEventListener('DOMContentLoaded', function (){
var app; var app;
function normalize(configure){
return JSON.parse(JSON.stringify(configure));
}
function init(configure){ function init(configure){
app = new Vue({ app = new Vue({
el: '#app', el: '#app',
@ -42,7 +38,7 @@ window.addEventListener('DOMContentLoaded', function (){
this.activeIndex = index; this.activeIndex = index;
}, },
'save-configure': function (){ 'save-configure': function (){
ipc.send('app-configure', 'save', normalize(this.configure)); ipc.send('app-configure', 'save', JSON.parse(JSON.stringify(this.configure)));
} }
} }
}); });

View File

@ -10,7 +10,7 @@
<i class="icon-export"></i> <i class="icon-export"></i>
</a> </a>
</div> </div>
<div v-show="popup" class="ui-popup"> <div v-show="showPopup" class="ui-popup">
<div class="ui-popup-arrow"> <div class="ui-popup-arrow">
<em></em> <em></em>
<span></span> <span></span>

View File

@ -30,7 +30,7 @@ module.exports = Vue.component('app-configure', {
name: '', name: '',
path: '', path: '',
submitError: '', submitError: '',
popup: false showPopup: false
} }
}, },
methods: { methods: {
@ -43,9 +43,9 @@ module.exports = Vue.component('app-configure', {
ipc.send('app-configure', command, configure); ipc.send('app-configure', command, configure);
}, },
popupToggle: function (){ popupToggle: function (){
this.popup = !this.popup; this.showPopup = !this.showPopup;
if (!this.popup) { if (!this.showPopup) {
this.name = ''; this.name = '';
this.path = ''; this.path = '';
this.submitError = ''; this.submitError = '';
@ -59,7 +59,7 @@ module.exports = Vue.component('app-configure', {
if (this.uniqueProjects[this.name]) { if (this.uniqueProjects[this.name]) {
this.submitError = '项目已存在'; this.submitError = '项目已存在';
} else { } else {
this.popup = false; this.showPopup = false;
this.configure.projects.push({ name: this.name, path: this.path }); this.configure.projects.push({ name: this.name, path: this.path });
// clean imput // clean imput

View File

@ -1,21 +1,28 @@
<project-configure :project="project" :unique-projects.sync="uniqueProjects"></project-configure> <project-configure :show.sync="showSetting" :project="project" :unique-projects.sync="uniqueProjects">
<div class="ui-project-stage fn-hide"> </project-configure>
<div class="ui-project-stage">
<div class="ui-control-bar fn-clear"> <div class="ui-control-bar fn-clear">
<div class="ui-control-operate fn-left"> <div class="ui-control-operate fn-left">
<a title="删除项目" href="javascript:;"><i class="icon-trash"></i></a> <a title="删除项目" href="javascript:;" @click="remove"><i class="icon-trash"></i></a>
<a title="设置项目" href="javascript:;"><i class="icon-gear"></i></a> <a title="设置项目" href="javascript:;" @click="setting"><i class="icon-gear"></i></a>
</div> </div>
<div class="fn-right"> <div class="fn-right">
<ul class="ui-command fn-clear"> <ul class="ui-command fn-clear">
<li><a href="javascript:;"><i class="icon-play"></i>命令1</a></li> <li v-for="cmd in comand">
<li><a href="javascript:;"><i class="icon-stop"></i>命令2</a></li> <a href="javascript:;">
<li><a href="javascript:;"><i class="icon-play"></i>命令3</a></li> <i class="icon-play"></i>
<li class="ui-command-more"> {{ cmd.name }}
</a>
</li>
<li v-if="moreCommand.length" class="ui-command-more">
<a href="javascript:;">更多&nbsp;<i class="icon-expand"></i></a> <a href="javascript:;">更多&nbsp;<i class="icon-expand"></i></a>
<ul class="ui-command-popup fn-hide"> <ul class="ui-command-popup fn-hide">
<li><a href="javascript:;"><i class="icon-play"></i>命令4</a></li> <li v-for="moreCmd in moreCommand">
<li><a href="javascript:;"><i class="icon-stop"></i>命令5</a></li> <a href="javascript:;">
<li><a href="javascript:;"><i class="icon-play"></i>命令6</a></li> <i class="icon-play"></i>
{{ moreCmd.name }}
</a>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -5,7 +5,6 @@
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var ipc = require('ipc-renderer');
var Vue = require('../../vue/vue'); var Vue = require('../../vue/vue');
require('../project-configure'); require('../project-configure');
@ -29,11 +28,18 @@ module.exports = Vue.component('app-main', {
} }
}, },
data: function (){ data: function (){
return {}; return {
showSetting: false
};
}, },
computed: { computed: {
project: function (){ project: function (){
var project = this.projects[this.activeIndex]; var project = this.projects[this.activeIndex] || {
name: '',
path: '',
env: [],
command: []
};
if (!project.env) { if (!project.env) {
project.env = []; project.env = [];
@ -44,11 +50,22 @@ module.exports = Vue.component('app-main', {
} }
return JSON.parse(JSON.stringify(project)); 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: { methods: {
setting: function (){
this.showSetting = true;
},
remove: function (){ remove: function (){
this.projects.splice(this.activeIndex, 1); this.projects.splice(this.activeIndex, 1);
this.activeIndex = 0;
this.$dispatch('save-configure'); this.$dispatch('save-configure');
} }
}, },

View File

@ -14,6 +14,11 @@ require('../dynamic-item');
module.exports = Vue.component('project-configure', { module.exports = Vue.component('project-configure', {
template: fs.readFileSync(path.join(__dirname, 'project-configure.html')).toString(), template: fs.readFileSync(path.join(__dirname, 'project-configure.html')).toString(),
props: { props: {
show: {
type: Boolean,
twoWay: true,
default: false
},
project: { project: {
type: Object, type: Object,
required: true required: true
@ -52,11 +57,14 @@ module.exports = Vue.component('project-configure', {
} else { } else {
// clean error // clean error
this.submitError = ''; this.submitError = '';
// send message // send message
this.$dispatch('edit', this.projectClone); this.$dispatch('edit', this.projectClone);
} }
} }
},
cancel: function (){
this.show = false;
} }
}, },
events: { events: {

View File

@ -1,9 +1,9 @@
<div class="ui-project-setting"> <div v-show="show" class="ui-project-setting">
<form @submit.prevent="edit"> <form @submit.prevent="edit" @focusin="focus">
<div class="ui-control-bar fn-clear"> <div class="ui-control-bar fn-clear">
<div class="fn-right"> <div class="fn-right">
<input type="submit" class="ui-button" value="确认"/> <input type="submit" class="ui-button" value="确认"/>
<input type="button" class="ui-button ui-button-orange" value="取消"/> <input type="button" class="ui-button ui-button-orange" value="取消" @click="cancel"/>
</div> </div>
</div> </div>
<div class="ui-project-configure"> <div class="ui-project-configure">