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:
+2
-1
@@ -11,7 +11,8 @@ module.exports = function(grunt){
|
|||||||
'./lib/main.js',
|
'./lib/main.js',
|
||||||
'./lib/directive/**/*.js',
|
'./lib/directive/**/*.js',
|
||||||
'./lib/service/**/*.js',
|
'./lib/service/**/*.js',
|
||||||
'./lib/list/**/*.js'
|
'./lib/list/**/*.js',
|
||||||
|
'./lib/search/**/*.js'
|
||||||
],
|
],
|
||||||
dest:'./build/main.js'
|
dest:'./build/main.js'
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-9
@@ -125,6 +125,24 @@ app.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $url
|
|||||||
controller: ''
|
controller: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.state('search',{
|
||||||
|
url: '/search/:type',
|
||||||
|
views:{
|
||||||
|
header:{
|
||||||
|
templateUrl: '../html/views/search.html',
|
||||||
|
controller: 'Search'
|
||||||
|
},
|
||||||
|
container:{
|
||||||
|
templateUrl: '',
|
||||||
|
controller: ''
|
||||||
|
},
|
||||||
|
footer:{
|
||||||
|
templateUrl: '',
|
||||||
|
controller: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
;
|
;
|
||||||
@@ -263,32 +281,51 @@ app.controller('musicListController', ['$rootScope', 'musicList',function($rootS
|
|||||||
}
|
}
|
||||||
musicList.getData($rootScope.keywordsObj.music);
|
musicList.getData($rootScope.keywordsObj.music);
|
||||||
}]);
|
}]);
|
||||||
;/*搜索*/
|
;/*负责搜索结果的导向*/
|
||||||
var SearchController = function($scope, $rootScope, $location, bookList, musicList, movieList){
|
var Search = function($scope, $rootScope, $location, bookList, musicList, movieList){
|
||||||
var path = $location.path();
|
var path = $location.path();
|
||||||
|
$rootScope.isNoLoaded = false;
|
||||||
|
//跳回列表页
|
||||||
$scope.search = function(){
|
$scope.search = function(){
|
||||||
var keywords = $scope.keywords;
|
var keywords = $scope.keywords;
|
||||||
if(path.indexOf('/book') !== -1 || path === '/'){
|
if(path.indexOf('/book') !== -1){
|
||||||
if(keywords){
|
if(keywords){
|
||||||
$rootScope.keywordsObj.book = keywords;
|
$rootScope.keywordsObj.book = keywords;
|
||||||
}
|
}
|
||||||
bookList.getData($rootScope.keywordsObj.book);
|
$location.path('/book');
|
||||||
|
|
||||||
}else if(path.indexOf('/music') !== -1 || path === '/music'){
|
}else if(path.indexOf('/music') !== -1){
|
||||||
if(keywords){
|
if(keywords){
|
||||||
$rootScope.keywordsObj.music = keywords;
|
$rootScope.keywordsObj.music = keywords;
|
||||||
}
|
}
|
||||||
musicList.getData($rootScope.keywordsObj.music);
|
$location.path('/music');
|
||||||
|
|
||||||
}else if(path.indexOf('/movie') !== -1 || path === '/movie'){
|
}else if(path.indexOf('/movie') !== -1){
|
||||||
if(keywords){
|
if(keywords){
|
||||||
$rootScope.keywordsObj.movie = keywords;
|
$rootScope.keywordsObj.movie = keywords;
|
||||||
}
|
}
|
||||||
movieList.getData($rootScope.keywordsObj.movie);
|
$location.path('/movie');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Search.$inject = ['$scope', '$rootScope', '$location', 'bookList', 'musicList', 'movieList'];
|
||||||
|
app.controller('Search', Search);;/*仅负责搜索页面的打开*/
|
||||||
|
var SearchController = function($scope, $rootScope, $location){
|
||||||
|
var path = $location.path();
|
||||||
|
$scope.goToSearch = function(){
|
||||||
|
if(path.indexOf('/book') !== -1 || path === '/'){
|
||||||
|
$location.path('/search/book');
|
||||||
|
|
||||||
SearchController.$inject = ['$scope', '$rootScope', '$location', 'bookList', 'musicList', 'movieList'];
|
}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);
|
app.controller('SearchController', SearchController);
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
<header ng-controller="SearchController">
|
<header ng-controller="SearchController">
|
||||||
<div>
|
<div>
|
||||||
<input id="search_input" ng-model="keywords" type="text" placeholder="请输入关键字"/>
|
<input id="search_input" ng-model="keywords" type="text" placeholder="请输入关键字" ng-click="goToSearch()"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="button" id="search_btn" ng-click="search()" value="搜索"/>
|
<input type="button" id="search_btn" value="搜索"/>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<header ng-controller="Search">
|
||||||
|
<div>
|
||||||
|
<input id="search_input" ng-model="keywords" type="text" placeholder="请输入关键字"/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="button" id="search_btn" ng-click="search()" value="搜索"/>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
@@ -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: ''
|
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