diff --git a/platforms/ios/www/img/douban_24.png b/platforms/ios/www/img/douban_24.png new file mode 100644 index 0000000..7fdb2f8 Binary files /dev/null and b/platforms/ios/www/img/douban_24.png differ diff --git a/platforms/ios/www/img/douban_32.png b/platforms/ios/www/img/douban_32.png new file mode 100644 index 0000000..71a52cd Binary files /dev/null and b/platforms/ios/www/img/douban_32.png differ diff --git a/platforms/ios/www/img/logo.png b/platforms/ios/www/img/logo.png deleted file mode 100644 index 9519e7d..0000000 Binary files a/platforms/ios/www/img/logo.png and /dev/null differ diff --git a/platforms/ios/www/js/app/controllers/books-controller.coffee b/platforms/ios/www/js/app/controllers/books-controller.coffee index b05fed4..f48a6df 100644 --- a/platforms/ios/www/js/app/controllers/books-controller.coffee +++ b/platforms/ios/www/js/app/controllers/books-controller.coffee @@ -1,12 +1,27 @@ -libr = angular.module 'libr.controllers.books', [] +libr = angular.module 'libr.controllers.books', ['ionic'] class BooksController - @$inject: ['$scope', 'Books', 'ScanService', '$timeout'] - constructor: (@$scope, @Books, ScanService)-> + @$inject: ['$scope', 'Books', 'ScanService', '$ionicModal'] + constructor: (@$scope, @Books, ScanService, @$ionicModal) -> currentPage = localStorage.setItem 'user_books_current_page', 0 @$scope.books = [] @$scope.moreItemsAvailable = true + + @$ionicModal.fromTemplateUrl 'templates/modal/import_books.html', (modal)=> + @$scope.modal = modal + , { + scope: @$scope, + animation: 'slide-in-up' + } + + @$scope.leftButtons = [ + { + type: 'button icon ion-ios7-upload' + tap: (e)=> + @$scope.modal.show() + } + ] @$scope.rightButtons = [ { type: 'button icon ion-camera' diff --git a/platforms/ios/www/js/app/controllers/books-controller.js b/platforms/ios/www/js/app/controllers/books-controller.js index f0f2830..1765f78 100644 --- a/platforms/ios/www/js/app/controllers/books-controller.js +++ b/platforms/ios/www/js/app/controllers/books-controller.js @@ -3,20 +3,39 @@ var BooksController, libr, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - libr = angular.module('libr.controllers.books', []); + libr = angular.module('libr.controllers.books', ['ionic']); BooksController = (function() { - BooksController.$inject = ['$scope', 'Books', 'ScanService', '$timeout']; + BooksController.$inject = ['$scope', 'Books', 'ScanService', '$ionicModal']; - function BooksController($scope, Books, ScanService) { + function BooksController($scope, Books, ScanService, $ionicModal) { var currentPage; this.$scope = $scope; this.Books = Books; + this.$ionicModal = $ionicModal; this.loadMore = __bind(this.loadMore, this); this.refresh = __bind(this.refresh, this); currentPage = localStorage.setItem('user_books_current_page', 0); this.$scope.books = []; this.$scope.moreItemsAvailable = true; + this.$ionicModal.fromTemplateUrl('templates/modal/import_books.html', (function(_this) { + return function(modal) { + return _this.$scope.modal = modal; + }; + })(this), { + scope: this.$scope, + animation: 'slide-in-up' + }); + this.$scope.leftButtons = [ + { + type: 'button icon ion-ios7-upload', + tap: (function(_this) { + return function(e) { + return _this.$scope.modal.show(); + }; + })(this) + } + ]; this.$scope.rightButtons = [ { type: 'button icon ion-camera', diff --git a/platforms/ios/www/js/app/controllers/location-controller.coffee b/platforms/ios/www/js/app/controllers/location-controller.coffee index cddab0b..442a93f 100644 --- a/platforms/ios/www/js/app/controllers/location-controller.coffee +++ b/platforms/ios/www/js/app/controllers/location-controller.coffee @@ -33,6 +33,8 @@ class LocationController addLocation: () => if @$scope.locations.length >= 3 alert '只能创建3个常用的地址哦,你可以尝试删除部分,再添加' + else if localStorage.getItem('cur_address_detail') is null + alert '定位成功后方可添加常用地址' else @GeolocationService.createLocation (result)=> @$scope.locations.push result diff --git a/platforms/ios/www/js/app/controllers/location-controller.js b/platforms/ios/www/js/app/controllers/location-controller.js index 8d81754..09e5314 100644 --- a/platforms/ios/www/js/app/controllers/location-controller.js +++ b/platforms/ios/www/js/app/controllers/location-controller.js @@ -55,6 +55,8 @@ LocationController.prototype.addLocation = function() { if (this.$scope.locations.length >= 3) { return alert('只能创建3个常用的地址哦,你可以尝试删除部分,再添加'); + } else if (localStorage.getItem('cur_address_detail') === null) { + return alert('定位成功后方可添加常用地址'); } else { return this.GeolocationService.createLocation((function(_this) { return function(result) { diff --git a/platforms/ios/www/js/app/controllers/login-controller.coffee b/platforms/ios/www/js/app/controllers/login-controller.coffee index c38ab1d..9e47ef0 100644 --- a/platforms/ios/www/js/app/controllers/login-controller.coffee +++ b/platforms/ios/www/js/app/controllers/login-controller.coffee @@ -9,6 +9,7 @@ class LoginController @$scope.registerForm = @registerForm @$scope.registerUser = @registerUser @$scope.closeDialog = @closeDialog + @$ionicModal.fromTemplateUrl 'templates/modal/registration.html', (modal)=> @$scope.modal = modal , { @@ -16,7 +17,6 @@ class LoginController animation: 'slide-in-up' } - login: (user)=> if !user || user.email == '' || user.password == '' || user.email == undefined || user.password == undefined alert '请输入有效的用户名和密码' diff --git a/platforms/ios/www/js/app/services/recommend-service.js b/platforms/ios/www/js/app/services/recommend-service.js index a5b5ecc..0f8cd75 100644 --- a/platforms/ios/www/js/app/services/recommend-service.js +++ b/platforms/ios/www/js/app/services/recommend-service.js @@ -50,7 +50,7 @@ return this.$http({ url: "" + baseUrl + "/recommend/me?user_email=" + email + "&user_token=" + token, method: 'GET', - timeout: 10000 + timeout: 13000 }).success(function(data, status, headers, config) { return callback(data); }).error(function(data) { @@ -65,7 +65,7 @@ return this.$http({ url: "" + baseUrl + "/recommend/locations/" + locationId + "?user_email=" + email + "&user_token=" + token, method: 'GET', - timeout: 10000 + timeout: 13000 }).success(function(data, status, headers, config) { console.log('数据', data); return callback(data); diff --git a/platforms/ios/www/templates/modal/import_books.html b/platforms/ios/www/templates/modal/import_books.html new file mode 100644 index 0000000..f04ca73 --- /dev/null +++ b/platforms/ios/www/templates/modal/import_books.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/www/img/douban_24.png b/www/img/douban_24.png new file mode 100644 index 0000000..7fdb2f8 Binary files /dev/null and b/www/img/douban_24.png differ diff --git a/www/img/douban_32.png b/www/img/douban_32.png new file mode 100644 index 0000000..71a52cd Binary files /dev/null and b/www/img/douban_32.png differ diff --git a/www/img/logo.png b/www/img/logo.png deleted file mode 100644 index 9519e7d..0000000 Binary files a/www/img/logo.png and /dev/null differ diff --git a/www/js/app/controllers/books-controller.coffee b/www/js/app/controllers/books-controller.coffee index b05fed4..235c6f0 100644 --- a/www/js/app/controllers/books-controller.coffee +++ b/www/js/app/controllers/books-controller.coffee @@ -1,12 +1,27 @@ -libr = angular.module 'libr.controllers.books', [] +libr = angular.module 'libr.controllers.books', ['ionic'] class BooksController - @$inject: ['$scope', 'Books', 'ScanService', '$timeout'] - constructor: (@$scope, @Books, ScanService)-> + @$inject: ['$scope', 'Books', 'ScanService', '$ionicModal'] + constructor: (@$scope, @Books, ScanService, @$ionicModal) -> currentPage = localStorage.setItem 'user_books_current_page', 0 @$scope.books = [] @$scope.moreItemsAvailable = true + + @$ionicModal.fromTemplateUrl 'templates/modal/import_books.html', (modal)=> + @$scope.modal = modal + , { + scope: @$scope, + animation: 'slide-in-up' + } + + @$scope.leftButtons = [ + { + type: 'button icon ion-ios7-upload' + tap: (e)=> + @$scope.modal.show() + } + ] @$scope.rightButtons = [ { type: 'button icon ion-camera' @@ -19,6 +34,7 @@ class BooksController ] @$scope.onRefresh = @refresh @$scope.loadMore = @loadMore + @$scope.closeDialog = @closeDialog refresh: ()=> afterBookId = localStorage.getItem 'user_max_book_id' @@ -51,5 +67,7 @@ class BooksController @$scope.$broadcast('scroll.infiniteScrollComplete') @$scope.moreItemsAvailable = false + closeDialog: => + @$scope.modal.hide() libr.controller 'BooksController', BooksController \ No newline at end of file diff --git a/www/js/app/controllers/books-controller.js b/www/js/app/controllers/books-controller.js index f0f2830..ea834f6 100644 --- a/www/js/app/controllers/books-controller.js +++ b/www/js/app/controllers/books-controller.js @@ -3,20 +3,40 @@ var BooksController, libr, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - libr = angular.module('libr.controllers.books', []); + libr = angular.module('libr.controllers.books', ['ionic']); BooksController = (function() { - BooksController.$inject = ['$scope', 'Books', 'ScanService', '$timeout']; + BooksController.$inject = ['$scope', 'Books', 'ScanService', '$ionicModal']; - function BooksController($scope, Books, ScanService) { + function BooksController($scope, Books, ScanService, $ionicModal) { var currentPage; this.$scope = $scope; this.Books = Books; + this.$ionicModal = $ionicModal; + this.closeDialog = __bind(this.closeDialog, this); this.loadMore = __bind(this.loadMore, this); this.refresh = __bind(this.refresh, this); currentPage = localStorage.setItem('user_books_current_page', 0); this.$scope.books = []; this.$scope.moreItemsAvailable = true; + this.$ionicModal.fromTemplateUrl('templates/modal/import_books.html', (function(_this) { + return function(modal) { + return _this.$scope.modal = modal; + }; + })(this), { + scope: this.$scope, + animation: 'slide-in-up' + }); + this.$scope.leftButtons = [ + { + type: 'button icon ion-ios7-upload', + tap: (function(_this) { + return function(e) { + return _this.$scope.modal.show(); + }; + })(this) + } + ]; this.$scope.rightButtons = [ { type: 'button icon ion-camera', @@ -32,6 +52,7 @@ ]; this.$scope.onRefresh = this.refresh; this.$scope.loadMore = this.loadMore; + this.$scope.closeDialog = this.closeDialog; } BooksController.prototype.refresh = function() { @@ -82,6 +103,10 @@ } }; + BooksController.prototype.closeDialog = function() { + return this.$scope.modal.hide(); + }; + return BooksController; })(); diff --git a/www/js/app/controllers/location-controller.js b/www/js/app/controllers/location-controller.js index 8d81754..09e5314 100644 --- a/www/js/app/controllers/location-controller.js +++ b/www/js/app/controllers/location-controller.js @@ -55,6 +55,8 @@ LocationController.prototype.addLocation = function() { if (this.$scope.locations.length >= 3) { return alert('只能创建3个常用的地址哦,你可以尝试删除部分,再添加'); + } else if (localStorage.getItem('cur_address_detail') === null) { + return alert('定位成功后方可添加常用地址'); } else { return this.GeolocationService.createLocation((function(_this) { return function(result) { diff --git a/www/js/app/controllers/login-controller.coffee b/www/js/app/controllers/login-controller.coffee index c38ab1d..9e47ef0 100644 --- a/www/js/app/controllers/login-controller.coffee +++ b/www/js/app/controllers/login-controller.coffee @@ -9,6 +9,7 @@ class LoginController @$scope.registerForm = @registerForm @$scope.registerUser = @registerUser @$scope.closeDialog = @closeDialog + @$ionicModal.fromTemplateUrl 'templates/modal/registration.html', (modal)=> @$scope.modal = modal , { @@ -16,7 +17,6 @@ class LoginController animation: 'slide-in-up' } - login: (user)=> if !user || user.email == '' || user.password == '' || user.email == undefined || user.password == undefined alert '请输入有效的用户名和密码' diff --git a/www/js/app/services/recommend-service.js b/www/js/app/services/recommend-service.js index a5b5ecc..0f8cd75 100644 --- a/www/js/app/services/recommend-service.js +++ b/www/js/app/services/recommend-service.js @@ -50,7 +50,7 @@ return this.$http({ url: "" + baseUrl + "/recommend/me?user_email=" + email + "&user_token=" + token, method: 'GET', - timeout: 10000 + timeout: 13000 }).success(function(data, status, headers, config) { return callback(data); }).error(function(data) { @@ -65,7 +65,7 @@ return this.$http({ url: "" + baseUrl + "/recommend/locations/" + locationId + "?user_email=" + email + "&user_token=" + token, method: 'GET', - timeout: 10000 + timeout: 13000 }).success(function(data, status, headers, config) { console.log('数据', data); return callback(data); diff --git a/www/templates/modal/import_books.html b/www/templates/modal/import_books.html new file mode 100644 index 0000000..f04ca73 --- /dev/null +++ b/www/templates/modal/import_books.html @@ -0,0 +1,16 @@ + \ No newline at end of file