login.html page

This commit is contained in:
life
2015-02-17 23:56:21 +08:00
parent 6983a6004b
commit 07e2b43755
12 changed files with 118 additions and 53 deletions

View File

@@ -21,45 +21,30 @@ html, body {
<body id="boxBody">
<section id="box" class="animated fadeInUp">
<div>
<h1 id="logo">leanote</h1>
<h1 id="logo">
<img src="public/images/logo/leanote_icon_blue.png" style="width: 60px">
</h1>
<div id="boxForm">
<div id="boxHeader">登录</div>
<form>
<div class="alert alert-danger" id="loginMsg"></div>
<input id="from" type="hidden" value="" />
<div class="form-group">
<label class="control-label">用户名或Email</label>
<input type="text" class="form-control" id="email" name="email" value="">
<input type="text" placeholder="Email" class="form-control" id="email" name="email" value="">
</div>
<div class="form-group">
<label class="control-label">密码</label>
<input type="password" class="form-control" id="pwd" name="pwd">
<input type="password" placeholder="Password" class="form-control" id="pwd" name="pwd">
</div>
<div class="clearfix">
<a href="/findPassword" class="pull-right m-t-xs"><small>忘记密码?</small></a>
<button id="loginBtn" class="btn btn-success">登录</button>
<div class="clearfix btns">
<a href="/findPassword" class="pull-right m-t-xs"><small>Forget password?</small></a>
<a href="/findPassword" class="pull-right m-t-xs" style="margin-right: 10px"><small>Sign up</small></a>
<button id="loginBtn" class="btn btn-success" style="visibility: hidden">Sign in</button>
</div>
<div class="line line-dashed"></div>
<p class="text-muted text-center"><small>还无帐户?</small></p>
<a href="/register" class="btn btn-default btn-block">注册</a>
</form>
</div>
</div>
</section>
<div id="boxFooter">
<p>
<a href="/index">主页</a>
</p>
<p>
<a href="/index">leanote</a> © 2015
</p>
</div>
<script src="public/js/jquery-1.9.0.min.js"></script>
<script src="public/js/bootstrap.js"></script>
<script src="public/js/app/service.js"></script>
@@ -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');
</script>
</body>
</html>

22
node_modules/api.js generated vendored
View File

@@ -41,14 +41,20 @@ var Api = {
if(!ret['Ok'] && ret['Msg'] == 'NOTLOGIN') {
Web.notLogin();
}
} else {
// 出现问题
Web.unConnected();
}
} catch(e) {
// 出错问题
Web.unConnected();
}
} catch(e) {}
},
// 是否断网
unConnected: function(error) {
var me = this;
if(error && error.code == "ECONNREFUSED") {
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,

3
node_modules/note.js generated vendored
View File

@@ -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);

6
node_modules/notebook.js generated vendored
View File

@@ -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) {

17
node_modules/user.js generated vendored
View File

@@ -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.......")

View File

@@ -210,6 +210,7 @@ function log(o) {
<a>Theme</a>
</li>
<li role="presentation">
<!-- 400 * 300px -->
<a href="login.html">Switch account</a>
</li>
<li role="presentation" class="divider"></li>
@@ -219,7 +220,6 @@ function log(o) {
</ul>
</div>
</div>
</div>
</div>

View File

@@ -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;
}

View File

@@ -1,3 +1,4 @@
// #65bd77
@bgColor: #fff;
@headerBgColor: #fff;
@fontFamily: 'Open Sans', '微软雅黑', Arial, Tahoma, sans-serif;
@@ -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;
@@ -756,3 +761,9 @@ input, .form-control {
.hide-img {
opacity: 0;
}
.alert-danger {
background: none;
}
.alert {
padding: 3px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -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 {

View File

@@ -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({

12
test.js
View File

@@ -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);