From 09c9b8268e38a8db8edd63ff729a80c7867fc65b Mon Sep 17 00:00:00 2001 From: Nuintun Date: Fri, 20 Nov 2015 15:02:43 +0800 Subject: [PATCH] update files --- bin/app-configure.js | 12 ++--- index.html | 10 +++- static/css/index.css | 25 ++++++---- static/js/app/index.js | 5 ++ .../app-configure/app-configure.html | 14 ++++-- static/js/components/app-configure/index.js | 11 +++++ static/js/components/directory/index.js | 1 + .../components/dynamic-item/dynamic-item.html | 2 +- static/js/components/project-base/index.js | 49 +++++++++++++++++++ .../components/project-base/project-base.html | 15 ++++++ 10 files changed, 124 insertions(+), 20 deletions(-) create mode 100644 static/js/components/project-base/index.js create mode 100644 static/js/components/project-base/project-base.html diff --git a/bin/app-configure.js b/bin/app-configure.js index d7f2585..90118e0 100644 --- a/bin/app-configure.js +++ b/bin/app-configure.js @@ -157,7 +157,7 @@ AppConfigure.prototype = { this.create(); - ipc.on('app-configure', function (event, command){ + ipc.on('app-configure', function (event, command, configure){ switch (command) { case 'import': context.import(function (configure){ @@ -185,11 +185,11 @@ AppConfigure.prototype = { }); }); break; - case 'add': - context.save(function (configure){ - - }, function (configure){ - + case 'save': + context.save(configure, function (){ + this.showMessageBox('保存成功!', { type: 'info' }); + }, function (){ + this.showMessageBox('保存失败!'); }); break; } diff --git a/index.html b/index.html index 51381f2..fb2a255 100644 --- a/index.html +++ b/index.html @@ -54,9 +54,17 @@ -
  • +
  • + + 项目名称不能为空 +
  • +
  • +
  • + + 项目路径不能为空 +
  • diff --git a/static/css/index.css b/static/css/index.css index 6ef5af0..7a52c11 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -420,15 +420,22 @@ header [class*=" icon-"] { .ui-sub-item ul { padding: 0; } -.ui-sub-item .ui-action-bar { +.ui-sub-item .ui-item-add { margin: 0; } +.ui-sub-item span, +.ui-item-error span { + line-height: 25px; + display: inline-block; + vertical-align: middle; +} .ui-sub-item span { width: 192px; - line-height: 25px; 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 { cursor: pointer; @@ -441,12 +448,12 @@ header [class*=" icon-"] { text-overflow: ellipsis; white-space: nowrap; } -.ui-sub-item .ui-item-error { - margin: 10px 0 0; +.ui-popup-content .ui-item-error, +.ui-project-configure .ui-item-error { + margin: 10px 0; } -.ui-item-error span { - color: #f00; - border-bottom-color: #f00; +.ui-sub-item .ui-item-error { + margin: 15px 0 -10px; } .ui-item-error .icon-expand { position: absolute; diff --git a/static/js/app/index.js b/static/js/app/index.js index d2cb15d..f8aab5a 100644 --- a/static/js/app/index.js +++ b/static/js/app/index.js @@ -19,6 +19,11 @@ window.addEventListener('DOMContentLoaded', function (){ data: { activeIndex: 0, configure: {} + }, + events: { + 'save-configure': function (){ + + } } }); diff --git a/static/js/components/app-configure/app-configure.html b/static/js/components/app-configure/app-configure.html index df78f94..2d366c2 100644 --- a/static/js/components/app-configure/app-configure.html +++ b/static/js/components/app-configure/app-configure.html @@ -1,5 +1,5 @@
    - + @@ -10,7 +10,7 @@
    -
    +
    @@ -22,12 +22,20 @@
  • +
  • + + asdasdasdsa +
  • +
  • + + asdasdasdsa +
  • - +
  • diff --git a/static/js/components/app-configure/index.js b/static/js/components/app-configure/index.js index e7a8584..90d2ca1 100644 --- a/static/js/components/app-configure/index.js +++ b/static/js/components/app-configure/index.js @@ -18,9 +18,20 @@ module.exports = Vue.component('app-configure', { required: true } }, + data: function (){ + return { + popup: false + } + }, methods: { appConfigure: function (command, configure){ ipc.send('app-configure', command, configure); + }, + popupToggle: function (){ + this.popup = !this.popup; + }, + addProject: function (){ + } } }); diff --git a/static/js/components/directory/index.js b/static/js/components/directory/index.js index aacae61..46a1143 100644 --- a/static/js/components/directory/index.js +++ b/static/js/components/directory/index.js @@ -18,6 +18,7 @@ module.exports = Vue.component('directory', { }, path: { type: String, + twoWay: true, default: '' } }, diff --git a/static/js/components/dynamic-item/dynamic-item.html b/static/js/components/dynamic-item/dynamic-item.html index b820726..caaadee 100644 --- a/static/js/components/dynamic-item/dynamic-item.html +++ b/static/js/components/dynamic-item/dynamic-item.html @@ -4,7 +4,7 @@ {{ item.value }} -
  • +
  •     diff --git a/static/js/components/project-base/index.js b/static/js/components/project-base/index.js new file mode 100644 index 0000000..fa19278 --- /dev/null +++ b/static/js/components/project-base/index.js @@ -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 = '项目路径不能为空'; + } + } + } +}); diff --git a/static/js/components/project-base/project-base.html b/static/js/components/project-base/project-base.html new file mode 100644 index 0000000..71fe76b --- /dev/null +++ b/static/js/components/project-base/project-base.html @@ -0,0 +1,15 @@ +
  • + + +
  • +
  • + + {{ nameError }} +
  • +
  • + +
  • +
  • + + {{ pathError }} +
  • \ No newline at end of file