From dbc7ba38166aade8c530fb8cf87ba54c7c776f05 Mon Sep 17 00:00:00 2001 From: luchenqun Date: Thu, 3 Nov 2016 23:00:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 2 +- public/scripts/controllers/home-controller.js | 59 +++++++++++++------ public/views/bookmarks.html | 4 +- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/app.js b/app.js index bf78b45..b10238f 100644 --- a/app.js +++ b/app.js @@ -30,7 +30,7 @@ app.use(session({ saveUninitialized: true, //添加这行 secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串 cookie: { - maxAge: 3600 * 24 * 30 + maxAge: 3600000 * 24 * 30 } })); diff --git a/public/scripts/controllers/home-controller.js b/public/scripts/controllers/home-controller.js index d611bd1..285c7b0 100644 --- a/public/scripts/controllers/home-controller.js +++ b/public/scripts/controllers/home-controller.js @@ -1,21 +1,46 @@ app.controller('homeCtr', ['$scope', '$stateParams', '$filter', '$state', '$window', 'bookmarkService', 'pubSubService', function($scope, $stateParams, $filter, $state, $window, bookmarkService, pubSubService) { console.log('Hello homeCtr......'); - bookmarkService.autoLogin().then( - function(data) { - console.log(data); - if (data.logined) { - pubSubService.publish('loginCtr.login', { - 'login': data.logined, - }); - $state.go('bookmarks', { - showStyle: 'navigate', - }) - } else { - console.log('login failed......................') + var debug = true; + if (debug) { + bookmarkService.login({ + username: 'luchenqun', + password: 'fendoubuxi', + autoLogin: true, + }).then( + function(data) { + console.log(data); + if (data.logined) { + pubSubService.publish('loginCtr.login', { + 'login': data.logined, + }); + $state.go('bookmarks', { + showStyle: 'navigate', + }) + } else { + console.log('login failed......................') + } + }, + function(errorMsg) { + console.log(errorMsg); } - }, - function(errorMsg) { - console.log(errorMsg); - } - ); + ); + } else { + bookmarkService.autoLogin().then( + function(data) { + if (data.logined || debug) { + pubSubService.publish('loginCtr.login', { + 'login': debug || data.logined, + }); + $state.go('bookmarks', { + showStyle: 'navigate', + }) + } else { + console.log('login failed......................') + } + }, + function(errorMsg) { + console.log(errorMsg); + } + ); + } }]); diff --git a/public/views/bookmarks.html b/public/views/bookmarks.html index 1046c0e..f49b126 100644 --- a/public/views/bookmarks.html +++ b/public/views/bookmarks.html @@ -2,7 +2,7 @@
-     {{ tag.name }} +     {{ tag.name }}
@@ -14,8 +14,10 @@ ng-repeat="bookmark in tag.bookmarks" ng-click="jumpToUrl(bookmark.url, bookmark.id)" title="{{ bookmark.title }}"> + {{ bookmark.title}} +