提交更改

This commit is contained in:
luchenqun 2016-11-03 23:00:11 +08:00
parent 230066b84b
commit dbc7ba3816
3 changed files with 46 additions and 19 deletions

2
app.js
View File

@ -30,7 +30,7 @@ app.use(session({
saveUninitialized: true, //添加这行 saveUninitialized: true, //添加这行
secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串 secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串
cookie: { cookie: {
maxAge: 3600 * 24 * 30 maxAge: 3600000 * 24 * 30
} }
})); }));

View File

@ -1,21 +1,46 @@
app.controller('homeCtr', ['$scope', '$stateParams', '$filter', '$state', '$window', 'bookmarkService', 'pubSubService', function($scope, $stateParams, $filter, $state, $window, bookmarkService, pubSubService) { app.controller('homeCtr', ['$scope', '$stateParams', '$filter', '$state', '$window', 'bookmarkService', 'pubSubService', function($scope, $stateParams, $filter, $state, $window, bookmarkService, pubSubService) {
console.log('Hello homeCtr......'); console.log('Hello homeCtr......');
bookmarkService.autoLogin().then( var debug = true;
function(data) { if (debug) {
console.log(data); bookmarkService.login({
if (data.logined) { username: 'luchenqun',
pubSubService.publish('loginCtr.login', { password: 'fendoubuxi',
'login': data.logined, autoLogin: true,
}); }).then(
$state.go('bookmarks', { function(data) {
showStyle: 'navigate', console.log(data);
}) if (data.logined) {
} else { pubSubService.publish('loginCtr.login', {
console.log('login failed......................') 'login': data.logined,
});
$state.go('bookmarks', {
showStyle: 'navigate',
})
} else {
console.log('login failed......................')
}
},
function(errorMsg) {
console.log(errorMsg);
} }
}, );
function(errorMsg) { } else {
console.log(errorMsg); 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);
}
);
}
}]); }]);

View File

@ -2,7 +2,7 @@
<div class="ui internally grid"> <div class="ui internally grid">
<div class="row" ng-repeat="tag in bookmarks"> <div class="row" ng-repeat="tag in bookmarks">
<div class="wrap" style="width:80px"> <div class="wrap" style="width:80px">
<span style="color:#0aa770;">&nbsp;&nbsp;&nbsp;&nbsp;{{ tag.name }}</span> <span style="color:#0aa770;" title="{{ tag.name }}">&nbsp;&nbsp;&nbsp;&nbsp;{{ tag.name }}</span>
</div> </div>
<div class="fourteen wide column"> <div class="fourteen wide column">
<div class="ui grid container"> <div class="ui grid container">
@ -14,8 +14,10 @@
ng-repeat="bookmark in tag.bookmarks" ng-repeat="bookmark in tag.bookmarks"
ng-click="jumpToUrl(bookmark.url, bookmark.id)" ng-click="jumpToUrl(bookmark.url, bookmark.id)"
title="{{ bookmark.title }}"> title="{{ bookmark.title }}">
<!-- <i class="remove circle icon"></i> -->
<img class="ui ui middle aligned tiny image" src="http://api.byi.pw/favicon/?url={{ bookmark.url }}" style="width:16px;height:16px"> <img class="ui ui middle aligned tiny image" src="http://api.byi.pw/favicon/?url={{ bookmark.url }}" style="width:16px;height:16px">
<span>{{ bookmark.title}}</span> <span>{{ bookmark.title}}</span>
<!-- <i class="write icon"></i> -->
</div> </div>
</div> </div>
</div> </div>