diff --git a/login.html b/login.html index 8fb30705..ab9b8efd 100644 --- a/login.html +++ b/login.html @@ -21,45 +21,30 @@ html, body {
-

leanote

+

+ +

-
登录
- - +
- - +
-
- 忘记密码? - +
+ Forget password? + Sign up +
- -
- -

还无帐户?

- - 注册
-
-

- 主页 -

-

- leanote © 2015 -

-
- @@ -107,11 +92,16 @@ $(function() { $("#loginBtn").html("Success..."); location.href = 'index.html'; } else { - showMsg(ret.Msg); + showMsg("Email or Password error"); } }); }); }); + +var gui = require('nw.gui'); +var win = gui.Window.get(); +win.resizeTo(400, 300); +win.setPosition('center'); \ No newline at end of file diff --git a/node_modules/api.js b/node_modules/api.js index a88aad3b..0661d1a5 100644 --- a/node_modules/api.js +++ b/node_modules/api.js @@ -41,14 +41,20 @@ var Api = { if(!ret['Ok'] && ret['Msg'] == 'NOTLOGIN') { Web.notLogin(); } + } else { + // 出现问题 + Web.unConnected(); } - } catch(e) {} + } catch(e) { + // 出错问题 + Web.unConnected(); + } }, // 是否断网 unConnected: function(error) { var me = this; - if(error && error.code == "ECONNREFUSED") { - console.log(error); + console.log(error); + if(error && (error.code == "ECONNREFUSED" || error.code == 'ECONNRESET')) { // socket hand up Web.unConnected(); return true; } @@ -366,8 +372,8 @@ var Api = { seq: notebook.Seq, parentNotebookId: serverNotebookId } - log('add notebook'); - log(data); + console.log('add notebook'); + console.log(data); needle.post(me.getUrl('notebook/addNotebook'), data, {}, function(err, resp) { me.checkError(err, resp); @@ -375,7 +381,7 @@ var Api = { return callback(false); } var ret = resp.body; - log(ret); + console.log(ret); if(Common.isOk(ret)) { callback(ret); } else { @@ -481,6 +487,12 @@ var Api = { var me = this; // note.NotebookId是本的, 要得到远程的 Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) { + if(!serverNotebookId) { + console.error('No serverNotebookId'); + console.log(note); + callback && callback(false); + return; + } var data = { Title: note.Title, NotebookId: serverNotebookId, diff --git a/node_modules/note.js b/node_modules/note.js index ffad9442..b0a13930 100644 --- a/node_modules/note.js +++ b/node_modules/note.js @@ -586,6 +586,7 @@ var Note = { // addNote, updateNote后的操作 // 添加修改ServerNoteId; 更新修改usn + // note是服务器传来的, note.NoteId, note.ServerNoteId已设置正确, note.NotebookId是服务器上的 updateNoteForceForSendChange: function(note, isAdd, callback) { var me = this; note.IsDirty = false; @@ -602,6 +603,8 @@ var Note = { delete note['Content']; // } + delete note['NotebookId']; // 不要设置notebookId, 2/16 fixed + console.log('server data from::::'); console.log(note.NoteId); console.log(note.Files); diff --git a/node_modules/notebook.js b/node_modules/notebook.js index a49164dc..aa6afd8f 100644 --- a/node_modules/notebook.js +++ b/node_modules/notebook.js @@ -297,6 +297,10 @@ var Notebook = { notebook.LocalIsNew = false; notebook.LocalIsDelete = false; + delete note['NumberNotes']; + delete note['UpdatedTime']; + delete note['CreatedTime']; + var serverNotebookId = notebook.NotebookId; me.getNotebookIdByServerNotebookId(notebook.ParentNotebookId, function(parentNotebookId) { notebook.ParentNotebookId = parentNotebookId; @@ -322,6 +326,8 @@ var Notebook = { notebook.IsDirty = false; notebook.LocalIsNew = false; notebook.ServerNotebookId = notebook.NotebookId; // ? 怎么可能要改呢? 因为这可能是添加后的笔记本 + notebook.NotebookId = notebookId; // 必须设为本地, 因为notebook.NotebookId是服务器传过来的 2/16 fixed + me.getNotebookIdByServerNotebookId(notebook.ParentNotebookId, function(parentNotebookId) { notebook.ParentNotebookId = parentNotebookId; NB.update({NotebookId: notebookId}, {$set: notebook}, {}, function (err, n) { diff --git a/node_modules/user.js b/node_modules/user.js index d4c0b4f4..dc303535 100644 --- a/node_modules/user.js +++ b/node_modules/user.js @@ -58,9 +58,24 @@ User = { }); } }); + // console.log("........."); + // console.log(user); // 设值其它用户为非active - db.users.update({_id: {$ne: user.UserId}}, {$set: {IsActive: false}}, {multiple: true}) + db.users.update({_id: {$ne: user.UserId}}, {$set: {IsActive: false}}, {multi: true}, function(err, n) { + // console.log(err); + // console.log(n); + }); }, + + // for test + getAllUsers: function() { + var me = this; + db.users.find({}, function(err, users) { + console.log(err); + console.log(users); + }); + }, + // 打开软件时, 从db中获取当前用户 init: function(callback) { console.log("......user init.......") diff --git a/note.html b/note.html index 4435ee75..95015696 100755 --- a/note.html +++ b/note.html @@ -210,6 +210,7 @@ function log(o) { Theme
  • + Switch account
  • @@ -219,7 +220,6 @@ function log(o) { - diff --git a/public/css/index.css b/public/css/index.css index be325595..83a4f5db 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -81,7 +81,7 @@ a:hover { margin-top: 60px; } section { - background-color: #65bd77; + background-color: #fff; color: #e2f3e5; margin-top: 60px; } @@ -289,7 +289,7 @@ input, padding: 30px; } #boxBody { - background-color: #65bd77; + background-color: #fff; } #box { margin: 0; @@ -317,17 +317,17 @@ input, font-size: 16px; } #boxForm { - background-color: #fff; width: 500px; margin: auto; border-radius: 2px; + width: 200px; } -#boxForm form { - padding: 20px 30px; - padding-bottom: 30px; +#boxForm .form-group { + margin: 0px; + width: 200px; } -#boxForm table { - width: 100%; +#boxForm .btns a { + color: #666; } .back { position: absolute; @@ -672,3 +672,9 @@ input, .hide-img { opacity: 0; } +.alert-danger { + background: none; +} +.alert { + padding: 3px; +} diff --git a/public/css/index.less b/public/css/index.less index c8c83da1..521f4c8e 100644 --- a/public/css/index.less +++ b/public/css/index.less @@ -1,3 +1,4 @@ +// #65bd77 @bgColor: #fff; @headerBgColor: #fff; @fontFamily: 'Open Sans', '微软雅黑', Arial, Tahoma, sans-serif; @@ -18,7 +19,7 @@ font-style: normal; font-weight: 300; src: local('Open Sans Light'), local('OpenSans-Light'), url('../fonts/open-sans2/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff') format('woff'); -} +} @font-face { font-family: 'Open Sans'; font-style: normal; @@ -96,7 +97,7 @@ a:hover { margin-top: @headerHeight; } section { - background-color: #65bd77; + background-color: #fff; color: #e2f3e5; margin-top: @headerHeight; } @@ -327,7 +328,7 @@ input, .form-control { } //------------- #boxBody { - background-color: #65bd77; + background-color: #fff; } @boxWidth: 500px; #box { @@ -358,17 +359,22 @@ input, .form-control { font-size: 16px; } #boxForm { - background-color: #fff; + // background-color: #fff; width: @boxWidth;; margin: auto; border-radius: 2px; form { - padding: 20px 30px; - padding-bottom: 30px; + // padding: 20px 30px; + // padding-bottom: 30px; } - table { - width: 100%; - td { + width: 200px; + .form-group { + margin: 0px; + width: 200px; + } + .btns { + a { + color: #666; } } } @@ -732,7 +738,6 @@ input, .form-control { width: 750px; height: 370px; margin: auto; - } #webSliderContainer img { position: absolute; @@ -755,4 +760,10 @@ input, .form-control { } .hide-img { opacity: 0; +} +.alert-danger { + background: none; +} +.alert { + padding: 3px; } \ No newline at end of file diff --git a/public/images/leanote-logo.png b/public/images/leanote-logo.png new file mode 100644 index 00000000..cc5cba34 Binary files /dev/null and b/public/images/leanote-logo.png differ diff --git a/public/js/app/notebook.js b/public/js/app/notebook.js index 7ed09e6d..cb261af3 100644 --- a/public/js/app/notebook.js +++ b/public/js/app/notebook.js @@ -32,6 +32,9 @@ Notebook._updateNotebookNumberNotes = function(notebookId, n) { if(!notebook) { return; } + if(!notebook.NumberNotes) { + notebook.NumberNotes = 0; + } notebook.NumberNotes += n; if(notebook.NumberNotes < 0) { notebook.NumberNotes = 0; @@ -645,8 +648,9 @@ Notebook.changeNotebook = function(notebookId, callback) { cacheNotes = Note.getNotesByNotebookId(notebookId); var notebook = Notebook.cache[notebookId]; var len = cacheNotes ? cacheNotes.length : 0; - // alert( notebook.NumberNotes + " " + len); - if(len == notebook.NumberNotes) { + + // 如果为0, 从服务器上拿 + if(len != 0 && len == notebook.NumberNotes) { if(callback) { callback(cacheNotes); } else { diff --git a/public/js/app/service.js b/public/js/app/service.js index 106e7c7e..2c42e2c1 100644 --- a/public/js/app/service.js +++ b/public/js/app/service.js @@ -61,6 +61,12 @@ $(document).on('contextmenu', function (e) { }); var gui = require('nw.gui'); + +// 窗口大小设置 +var win = gui.Window.get(); +win.resizeTo(1100, 600); +win.setPosition('center'); + function Menu() { this.menu = new gui.Menu(); this.cut = new gui.MenuItem({ diff --git a/test.js b/test.js index e365df25..ebe81dcc 100755 --- a/test.js +++ b/test.js @@ -19,14 +19,26 @@ Api.addNotebook({ // Api.uploadImage(); User.userId = '54bdc65599c37b0da9000002'; User.userId = '54d7620d99c37b030600002c'; +User.userId = '54db772899c37b1a6c000135'; /* User.init(function() { Api.getAttach('54d8c8de99c37b02fa000002', function() { }); + Note.getNote('54e16d90c596f238dc000001', function(note) { + console.log(note); + console.log(note.NotebookId); + Notebook.getNotebook(note.NotebookId, function(notebook) { + console.log(notebook); + }); + }) + }); */ +Api.auth('e@a.com', 'abc123'); +User.getAllUsers(); + /* Note.hasNotes('54bdc65599c37b0da9000005', function(doc) { console.log(doc);