mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
add search page in search web app
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
/*搜索*/
|
||||
var SearchController = function($scope, $rootScope, $location, bookList, musicList, movieList){
|
||||
var path = $location.path();
|
||||
$scope.search = function(){
|
||||
var keywords = $scope.keywords;
|
||||
if(path.indexOf('/book') !== -1 || path === '/'){
|
||||
if(keywords){
|
||||
$rootScope.keywordsObj.book = keywords;
|
||||
}
|
||||
bookList.getData($rootScope.keywordsObj.book);
|
||||
|
||||
}else if(path.indexOf('/music') !== -1 || path === '/music'){
|
||||
if(keywords){
|
||||
$rootScope.keywordsObj.music = keywords;
|
||||
}
|
||||
musicList.getData($rootScope.keywordsObj.music);
|
||||
|
||||
}else if(path.indexOf('/movie') !== -1 || path === '/movie'){
|
||||
if(keywords){
|
||||
$rootScope.keywordsObj.movie = keywords;
|
||||
}
|
||||
movieList.getData($rootScope.keywordsObj.movie);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SearchController.$inject = ['$scope', '$rootScope', '$location', 'bookList', 'musicList', 'movieList'];
|
||||
app.controller('SearchController', SearchController);
|
||||
@@ -125,5 +125,23 @@ app.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $url
|
||||
controller: ''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('search',{
|
||||
url: '/search/:type',
|
||||
views:{
|
||||
header:{
|
||||
templateUrl: '../html/views/search.html',
|
||||
controller: 'Search'
|
||||
},
|
||||
container:{
|
||||
templateUrl: '',
|
||||
controller: ''
|
||||
},
|
||||
footer:{
|
||||
templateUrl: '',
|
||||
controller: ''
|
||||
}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*负责搜索结果的导向*/
|
||||
var Search = function($scope, $rootScope, $location, bookList, musicList, movieList){
|
||||
var path = $location.path();
|
||||
$rootScope.isNoLoaded = false;
|
||||
//跳回列表页
|
||||
$scope.search = function(){
|
||||
var keywords = $scope.keywords;
|
||||
if(path.indexOf('/book') !== -1){
|
||||
if(keywords){
|
||||
$rootScope.keywordsObj.book = keywords;
|
||||
}
|
||||
$location.path('/book');
|
||||
|
||||
}else if(path.indexOf('/music') !== -1){
|
||||
if(keywords){
|
||||
$rootScope.keywordsObj.music = keywords;
|
||||
}
|
||||
$location.path('/music');
|
||||
|
||||
}else if(path.indexOf('/movie') !== -1){
|
||||
if(keywords){
|
||||
$rootScope.keywordsObj.movie = keywords;
|
||||
}
|
||||
$location.path('/movie');
|
||||
}
|
||||
};
|
||||
};
|
||||
Search.$inject = ['$scope', '$rootScope', '$location', 'bookList', 'musicList', 'movieList'];
|
||||
app.controller('Search', Search);
|
||||
@@ -0,0 +1,20 @@
|
||||
/*仅负责搜索页面的打开*/
|
||||
var SearchController = function($scope, $rootScope, $location){
|
||||
var path = $location.path();
|
||||
$scope.goToSearch = function(){
|
||||
if(path.indexOf('/book') !== -1 || path === '/'){
|
||||
$location.path('/search/book');
|
||||
|
||||
}else if(path.indexOf('/music') !== -1 || path === '/music'){
|
||||
$location.path('/search/music');
|
||||
|
||||
|
||||
}else if(path.indexOf('/movie') !== -1 || path === '/movie'){
|
||||
$location.path('/search/movie');
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
SearchController.$inject = ['$scope', '$rootScope', '$location'];
|
||||
app.controller('SearchController', SearchController);
|
||||
Reference in New Issue
Block a user