增加一个搜索历史表

This commit is contained in:
luchenqun 2017-04-03 23:25:17 +08:00
parent 4b6bd2a404
commit f0aa9a0723
1 changed files with 15 additions and 16 deletions

View File

@ -1,4 +1,4 @@
app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', 'pubSubService', 'bookmarkService', function($scope, $stateParams, $state, $window, pubSubService, bookmarkService) { app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$timeout', 'pubSubService', 'bookmarkService', function($scope, $stateParams, $state, $window, $timeout, pubSubService, bookmarkService) {
console.log("Hello menuCtr") console.log("Hello menuCtr")
$scope.login = false; /**< 是否登陆 */ $scope.login = false; /**< 是否登陆 */
$scope.selectLoginIndex = 0; /**< 默认登陆之后的选择的菜单索引,下表从 0 开始 */ $scope.selectLoginIndex = 0; /**< 默认登陆之后的选择的菜单索引,下表从 0 开始 */
@ -119,6 +119,7 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', 'pubSu
types[4] = '百度'; types[4] = '百度';
$('.js-search-option').dropdown('set text', types[type]); $('.js-search-option').dropdown('set text', types[type]);
$('.js-search-option').dropdown('save defaults', types[type]); $('.js-search-option').dropdown('save defaults', types[type]);
$scope.search(data);
} }
$scope.updateShowStyle = function(showStyle) { $scope.updateShowStyle = function(showStyle) {
@ -152,19 +153,17 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', 'pubSu
$('.ui.menu a.item:eq(' + index + ')').addClass('selected'); $('.ui.menu a.item:eq(' + index + ')').addClass('selected');
} }
setTimeout(function() { bookmarkService.userInfo({})
bookmarkService.userInfo({}) .then((data) => {
.then((data) => { $scope.searchHistory = JSON.parse(data.search_history || '[]');
$scope.searchHistory = JSON.parse(data.search_history || '[]'); $timeout(function() {
setTimeout(function() { $('.search-item')
$('.search-item') .popup({
.popup({ on: 'focus'
on: 'focus' });
}); }, 100)
}, 1000); })
}) .catch((err) => {
.catch((err) => { toastr.error('获取信息失败。错误信息:' + JSON.stringify(err), "错误");
toastr.error('获取信息失败。错误信息:' + JSON.stringify(err), "错误"); });
});
}, 1000);
}]); }]);