update files

This commit is contained in:
Nuintun 2015-11-20 15:02:43 +08:00
parent 05a99b46ac
commit 09c9b8268e
10 changed files with 124 additions and 20 deletions

View File

@ -157,7 +157,7 @@ AppConfigure.prototype = {
this.create(); this.create();
ipc.on('app-configure', function (event, command){ ipc.on('app-configure', function (event, command, configure){
switch (command) { switch (command) {
case 'import': case 'import':
context.import(function (configure){ context.import(function (configure){
@ -185,11 +185,11 @@ AppConfigure.prototype = {
}); });
}); });
break; break;
case 'add': case 'save':
context.save(function (configure){ context.save(configure, function (){
this.showMessageBox('保存成功!', { type: 'info' });
}, function (configure){ }, function (){
this.showMessageBox('保存失败!');
}); });
break; break;
} }

View File

@ -54,9 +54,17 @@
<label>项目名称:</label> <label>项目名称:</label>
<input type="text" placeholder="项目名称"/> <input type="text" placeholder="项目名称"/>
</li> </li>
<li id="open-dir"> <li class="ui-item-error">
<label class="fn-invisible">&emsp;&emsp;&emsp;&emsp;&emsp;</label>
<span><i class="icon-expand"></i>项目名称不能为空</span>
</li>
<li>
<directory label="项目路径"></directory> <directory label="项目路径"></directory>
</li> </li>
<li class="ui-item-error">
<label class="fn-invisible">&emsp;&emsp;&emsp;&emsp;&emsp;</label>
<span><i class="icon-expand"></i>项目路径不能为空</span>
</li>
<li id="add-env" class="ui-sub-item"> <li id="add-env" class="ui-sub-item">
<label>环境变量:</label> <label>环境变量:</label>
<dynamic-item name-label="变量名" value-label="变量值"></dynamic-item> <dynamic-item name-label="变量名" value-label="变量值"></dynamic-item>

View File

@ -420,15 +420,22 @@ header [class*=" icon-"] {
.ui-sub-item ul { .ui-sub-item ul {
padding: 0; padding: 0;
} }
.ui-sub-item .ui-action-bar { .ui-sub-item .ui-item-add {
margin: 0; margin: 0;
} }
.ui-sub-item span,
.ui-item-error span {
line-height: 25px;
display: inline-block;
vertical-align: middle;
}
.ui-sub-item span { .ui-sub-item span {
width: 192px; width: 192px;
line-height: 25px;
border-bottom: 1px dotted #ccc; border-bottom: 1px dotted #ccc;
display: inline-block; }
vertical-align: middle; .ui-item-error span {
color: #f00;
border-bottom: none;
} }
.ui-sub-item .icon-trash { .ui-sub-item .icon-trash {
cursor: pointer; cursor: pointer;
@ -441,12 +448,12 @@ header [class*=" icon-"] {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.ui-sub-item .ui-item-error { .ui-popup-content .ui-item-error,
margin: 10px 0 0; .ui-project-configure .ui-item-error {
margin: 10px 0;
} }
.ui-item-error span { .ui-sub-item .ui-item-error {
color: #f00; margin: 15px 0 -10px;
border-bottom-color: #f00;
} }
.ui-item-error .icon-expand { .ui-item-error .icon-expand {
position: absolute; position: absolute;

View File

@ -19,6 +19,11 @@ window.addEventListener('DOMContentLoaded', function (){
data: { data: {
activeIndex: 0, activeIndex: 0,
configure: {} configure: {}
},
events: {
'save-configure': function (){
}
} }
}); });

View File

@ -1,5 +1,5 @@
<div class="fn-left"> <div class="fn-left">
<a @click="appConfigure('save', configure)" title="添加项目" class="ui-project-add" href="javascript:;"> <a @click="popupToggle" title="添加项目" class="ui-project-add" href="javascript:;">
<i class="icon-plus"></i> <i class="icon-plus"></i>
<i class="icon-expand"></i> <i class="icon-expand"></i>
</a> </a>
@ -10,7 +10,7 @@
<i class="icon-export"></i> <i class="icon-export"></i>
</a> </a>
</div> </div>
<div class="ui-popup fn-hide"> <div v-show="popup" class="ui-popup">
<div class="ui-popup-arrow"> <div class="ui-popup-arrow">
<em></em> <em></em>
<span></span> <span></span>
@ -22,12 +22,20 @@
<label>项目名称:</label> <label>项目名称:</label>
<input type="text" placeholder="项目名称"/> <input type="text" placeholder="项目名称"/>
</li> </li>
<li class="ui-item-error">
<label class="fn-invisible">项目名称:</label>
<span><i class="icon-expand"></i>asdasdasdsa</span>
</li>
<li id="popup-open-dir"> <li id="popup-open-dir">
<directory label="项目路径"></directory> <directory label="项目路径"></directory>
</li> </li>
<li class="ui-item-error">
<label class="fn-invisible">项目名称:</label>
<span><i class="icon-expand"></i>asdasdasdsa</span>
</li>
<li class="ui-popup-control"> <li class="ui-popup-control">
<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 @click="popupToggle" type="button" class="ui-button ui-button-orange" value="取消"/>
</li> </li>
</ul> </ul>
</form> </form>

View File

@ -18,9 +18,20 @@ module.exports = Vue.component('app-configure', {
required: true required: true
} }
}, },
data: function (){
return {
popup: false
}
},
methods: { methods: {
appConfigure: function (command, configure){ appConfigure: function (command, configure){
ipc.send('app-configure', command, configure); ipc.send('app-configure', command, configure);
},
popupToggle: function (){
this.popup = !this.popup;
},
addProject: function (){
} }
} }
}); });

View File

@ -18,6 +18,7 @@ module.exports = Vue.component('directory', {
}, },
path: { path: {
type: String, type: String,
twoWay: true,
default: '' default: ''
} }
}, },

View File

@ -4,7 +4,7 @@
<span :title="item.value">{{ item.value }}</span> <span :title="item.value">{{ item.value }}</span>
<i @click="remove(index)" title="删除" class="icon-trash"></i> <i @click="remove(index)" title="删除" class="icon-trash"></i>
</li> </li>
<li class="ui-action-bar"> <li class="ui-item-add">
<input type="text" :placeholder="nameLabel" v-model="name" lazy @focus="focus('nameError')"/>&nbsp; <input type="text" :placeholder="nameLabel" v-model="name" lazy @focus="focus('nameError')"/>&nbsp;
<input type="text" :placeholder="valueLabel" v-model="value" lazy @focus="focus('valueError')"/>&nbsp; <input type="text" :placeholder="valueLabel" v-model="value" lazy @focus="focus('valueError')"/>&nbsp;
<input type="button" class="ui-button" @click="add" value="添加"/> <input type="button" class="ui-button" @click="add" value="添加"/>

View File

@ -0,0 +1,49 @@
/**
* Created by nuintun on 2015/11/20.
*/
'use strict';
var fs = require('fs');
var path = require('path');
var Vue = require('../../vue/vue');
module.exports = Vue.component('app-configure', {
template: fs.readFileSync(path.join(__dirname, 'project-base.html')).toString(),
props: {
name: {
type: String,
twoWay: true,
default: ''
},
path: {
type: String,
twoWay: true,
default: ''
}
},
data: function (){
return {
nameError: '',
pathError: ''
};
},
events: {
'submit': function (){
this.name = this.name.trim();
this.path = this.path.trim();
if (this.name) {
this.nameError = '';
} else {
this.nameError = '项目名称不能为空';
}
if (this.path) {
this.pathError = '';
} else {
this.pathError = '项目路径不能为空';
}
}
}
});

View File

@ -0,0 +1,15 @@
<li>
<label>项目名称:</label>
<input type="text" v-model="name" placeholder="项目名称"/>
</li>
<li v-show="nameError" class="ui-item-error">
<label class="fn-invisible">&emsp;&emsp;&emsp;&emsp;&emsp;</label>
<span><i class="icon-expand"></i>{{ nameError }}</span>
</li>
<li>
<directory label="项目路径" :path.sync="path"></directory>
</li>
<li v-show="pathError" class="ui-item-error">
<label class="fn-invisible">&emsp;&emsp;&emsp;&emsp;&emsp;</label>
<span><i class="icon-expand"></i>{{ pathError }}</span>
</li>