diff --git a/search/Gruntfile.js b/search/Gruntfile.js index 47d8d22..c674c82 100644 --- a/search/Gruntfile.js +++ b/search/Gruntfile.js @@ -1,36 +1,45 @@ -module.exports = function(grunt){ - +module.exports = function(grunt) { + grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - concat:{ - options:{ - separator: ';' - }, - dist:{ - src:[ - './lib/main.js', - './lib/directive/**/*.js', - './lib/service/**/*.js', - './lib/list/**/*.js', - './lib/search/**/*.js' - ], - dest:'./build/main.js' - } - }, - uglify: { - options: { - //头部 - banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' - }, - dist: { - src: './build/main.js', - dest: './build/main.min.js' - } - } - }); + pkg: grunt.file.readJSON('package.json'), + concat: { + options: { + separator: ';' + }, + dist: { + src: [ + './lib/main.js', + './lib/directive/**/*.js', + './lib/service/**/*.js', + './lib/list/**/*.js', + './lib/search/**/*.js' + ], + dest: './build/main.js' + } + }, + uglify: { + options: { + //头部 + banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' + }, + dist: { + src: './build/main.js', + dest: './build/main.min.js' + } + }, + + cssmin:{ + css: { + src:'./css/main.css', + dest:'./css/main.min.css' + + } + } + }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-concat'); - - grunt.registerTask('default', ['concat', 'uglify']); -}; + grunt.loadNpmTasks('grunt-css'); + grunt.registerTask('default', ['concat', 'uglify', 'cssmin']); + +}; \ No newline at end of file diff --git a/search/README.md b/search/README.md index 0d07e3a..9866f1b 100644 --- a/search/README.md +++ b/search/README.md @@ -1,12 +1,12 @@ 爱搜索 爱生活 ====== -网址:[点击](http://vczero.github.io/t/html/index.html#/) +网址:[点击](http://vczero.github.io/search/html/index.html#/) + 图书 + 音乐 + 电影 -Angular.js + DouBan APIV2.0 +Angular.js + DouBan APIV2.0 基于豆瓣API的图书、电影、音乐搜索web App ######(1)图书检索 diff --git a/search/build/main.js b/search/build/main.js index 027a534..541ee60 100644 --- a/search/build/main.js +++ b/search/build/main.js @@ -28,7 +28,7 @@ app.constant('ServiceConfig', { movie_search_id: 'https://api.douban.com/v2/movie/subject/' }); -app.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $urlRouterProvider){ +app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider){ /*URL路由*/ $urlRouterProvider.otherwise("/"); @@ -208,10 +208,9 @@ app.factory('movieList', ['$rootScope', '$http', 'ServiceConfig', function($root window.movieSearch = function(data){ $rootScope.isNoLoaded = false; - if(data.subjects && data.subjects.length){ - $rootScope.movieList = data.subjects; + if(data.subjects && data.subjects.length) { + $rootScope.movieList = data.subjects; } - console.log(data.subjects); }; } }; diff --git a/search/build/main.min.js b/search/build/main.min.js index ac45d51..5aef1df 100644 --- a/search/build/main.min.js +++ b/search/build/main.min.js @@ -1,2 +1,2 @@ -/*! wlhmyit 2014-12-14 */ -var app=angular.module("app",["ui.router"]);app.run(["$rootScope",function(a){a.version="0.1",a.author="vczero",a.author_alias="鬼谣",a.isNoLoaded=!0,a.bookList=[],a.musicList=[],a.movieList=[],a.keywordsObj={book:"",music:"",movie:""}}]),app.constant("ServiceConfig",{book_search:"https://api.douban.com/v2/book/search",book_search_id:"https://api.douban.com/v2/book/",music_search:"https://api.douban.com/v2/music/search",music_search_id:"https://api.douban.com/v2/music/",movie_search:"https://api.douban.com/v2/movie/search",movie_search_id:"https://api.douban.com/v2/movie/subject/"}),app.config(["$stateProvider","$urlRouterProvider",function(a,b){b.otherwise("/"),a.state("index",{url:"/",views:{header:{templateUrl:"../html/views/list_header.html",controller:"SearchController"},container:{templateUrl:"../html/views/list_book.html",controller:"BookListController"},footer:{templateUrl:"../html/views/list_footer.html",controller:""}}}).state("book_list",{url:"/book",views:{header:{templateUrl:"../html/views/list_header.html",controller:"SearchController"},container:{templateUrl:"../html/views/list_book.html",controller:"BookListController"},footer:{templateUrl:"../html/views/list_footer.html",controller:""}}}).state("book_detail",{url:"/book/:id",views:{header:{templateUrl:"../html/views/list_header.html",controller:"SearchController"},container:{templateUrl:"../html/views/detail_book.html",controller:"BookDetailController"},footer:{templateUrl:"../html/views/list_footer.html",controller:""}}}).state("music_lsit",{url:"/music",views:{header:{templateUrl:"../html/views/list_header.html",controller:"SearchController"},container:{templateUrl:"../html/views/list_music.html",controller:"musicListController"},footer:{templateUrl:"../html/views/list_footer.html",controller:""}}}).state("movie_lsit",{url:"/movie",views:{header:{templateUrl:"../html/views/list_header.html",controller:"SearchController"},container:{templateUrl:"../html/views/list_movie.html",controller:"movieListController"},footer:{templateUrl:"../html/views/list_footer.html",controller:""}}}).state("search",{url:"/search/:type",views:{header:{templateUrl:"../html/views/search.html",controller:"Search"},container:{templateUrl:"",controller:""},footer:{templateUrl:"",controller:""}}})}]),app.directive("loading",function(){var a='
';return{restrict:"AE",template:a,replace:!0}}),app.directive("tip",function(){var a='
';return{restrict:"AE",template:a,replace:!0}}),app.factory("bookList",["$rootScope","$http","ServiceConfig",function(a,b,c){a.isNoLoaded=!0;var d={getData:function(d){a.isNoLoaded=!0,b.jsonp(c.book_search+"?callback=searchBookList&count=10&q="+d),window.searchBookList=function(b){b.books.length&&(a.isNoLoaded=!1);for(var c=[],d=0;d 爱搜索 爱生活 - +
diff --git a/search/lib/main.js b/search/lib/main.js index 6497cfa..833908f 100644 --- a/search/lib/main.js +++ b/search/lib/main.js @@ -28,7 +28,7 @@ app.constant('ServiceConfig', { movie_search_id: 'https://api.douban.com/v2/movie/subject/' }); -app.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $urlRouterProvider){ +app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider){ /*URL路由*/ $urlRouterProvider.otherwise("/"); diff --git a/search/lib/service/movieList.js b/search/lib/service/movieList.js index 9c4bad6..0b395a3 100644 --- a/search/lib/service/movieList.js +++ b/search/lib/service/movieList.js @@ -8,10 +8,9 @@ app.factory('movieList', ['$rootScope', '$http', 'ServiceConfig', function($root window.movieSearch = function(data){ $rootScope.isNoLoaded = false; - if(data.subjects && data.subjects.length){ - $rootScope.movieList = data.subjects; + if(data.subjects && data.subjects.length) { + $rootScope.movieList = data.subjects; } - console.log(data.subjects); }; } }; diff --git a/search/package.json b/search/package.json index 6547706..8767631 100644 --- a/search/package.json +++ b/search/package.json @@ -4,6 +4,7 @@ "devDependencies": { "grunt": "~0.4.5", "grunt-contrib-uglify": "~0.6.0", - "grunt-contrib-concat": "~0.5.0" + "grunt-contrib-concat": "~0.5.0", + "grunt-css": "^0.5.4" } }