提交更改

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, //添加这行
secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串
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) {
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);
}
);
}
}]);

View File

@ -2,7 +2,7 @@
<div class="ui internally grid">
<div class="row" ng-repeat="tag in bookmarks">
<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 class="fourteen wide column">
<div class="ui grid container">
@ -14,8 +14,10 @@
ng-repeat="bookmark in tag.bookmarks"
ng-click="jumpToUrl(bookmark.url, bookmark.id)"
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">
<span>{{ bookmark.title}}</span>
<!-- <i class="write icon"></i> -->
</div>
</div>
</div>