From a43e03e0ca43a921c77c240bedadee9f1d6f2aac Mon Sep 17 00:00:00 2001 From: junv Date: Thu, 17 Apr 2014 16:06:59 +0800 Subject: [PATCH] fix some issues --- env/dev/constant.coffee | 2 +- .../UserInterfaceState.xcuserstate | Bin 14438 -> 14545 bytes platforms/ios/Libr/config.xml | 6 +++--- platforms/ios/cordova/console.log | 8 ++++++++ platforms/ios/www/dist/js/all.min.js | 4 ++-- platforms/ios/www/index.html | 1 + .../app/controllers/books-controller.coffee | 17 +++++++---------- .../js/app/controllers/main-controller.coffee | 1 + .../www/js/app/services/scan-service.coffee | 3 ++- platforms/ios/www/templates/my-books.html | 2 +- www/index.html | 1 + .../app/controllers/books-controller.coffee | 17 +++++++---------- www/js/app/controllers/main-controller.coffee | 1 + www/js/app/services/scan-service.coffee | 3 ++- www/templates/my-books.html | 2 +- 15 files changed, 38 insertions(+), 30 deletions(-) diff --git a/env/dev/constant.coffee b/env/dev/constant.coffee index 5eb61b1..913daeb 100644 --- a/env/dev/constant.coffee +++ b/env/dev/constant.coffee @@ -2,7 +2,7 @@ libr = angular.module 'libr.constant',[] Constant = {} #Constant.baseUrl = "http://libr.herokuapp.com/api/v1" -Constant.baseUrl = "http://192.168.0.104:3000/api/v1" +Constant.baseUrl = "http://10.17.2.92:3000/api/v1" libr.constant 'Constant', Constant diff --git a/platforms/ios/Libr.xcodeproj/project.xcworkspace/xcuserdata/twer.xcuserdatad/UserInterfaceState.xcuserstate b/platforms/ios/Libr.xcodeproj/project.xcworkspace/xcuserdata/twer.xcuserdatad/UserInterfaceState.xcuserstate index 59f82020e3ec8793e558e226215268ec7285f362..3c75190d05d038bf227ad5ad5ae60ea8b8f40b62 100644 GIT binary patch delta 6897 zcmZu#2Y3@l)4tg~S&}8IS;8t-KlNfD^xmrrU}LH=281yfY>Z6}XpfK(La0Xwfe>(^ zC85_q0Ehl10YVRfP(tqz2rZQVWMYE<@6+Swd^bD0J3I5fGjn$}|H$x})$n|J!7QBz zvS+pA!q=#K)P3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m1nbOt7n&Ik7uvvd(Sb?InQm+J*8n4cq z;B|YwUcWcdTgzM5Ti=`HP4#y2W_i1KdwP3&bG>=q!QRnc>YeO;%R9|G!#mgep?9Ho zvA5h?>D}wS;QiBQ@VR|;eD!^ed`*2xzE-~0zRtcbzV5zWz8qg)Uq4^IZ=CNP-y+{G z-z~qwZ}MCG34W(P;_>_ZP5kZr?fo76ss8@{68}j5DE}D$c>hHIbpH(hO#gfSMgEWd z75-)ZmHtosU->urH~Y8xzxN;TAMzjd|K>mCKkGm5zv#alzyU{~Ss*Ep8z>4y0+Rw$ z0&fSV2i^_5AD9#PAh00tX<%JoL*R?RrofiK_Q0;d?!dQ^z;}VOfrmj!&=9N@Y#q!C zjtb5U&I^7JTo9}beir;HxIMTx_+4;c@Nn=*@R#7J;Pv3G;N9SZ;N#$5!Dk@|C4`!X zx`&2_Xs9BzIkc_TkiUMz~WrH#{g@79JZOAD$SV9DXZ2Ej&HEIJ_c!G5jD= Ym?%rsRDCxv2)+0x^I!Z|KNEHT2PefWe*gdg diff --git a/platforms/ios/Libr/config.xml b/platforms/ios/Libr/config.xml index 75a188d..339e76d 100644 --- a/platforms/ios/Libr/config.xml +++ b/platforms/ios/Libr/config.xml @@ -31,6 +31,9 @@ + + + Libr A sample Apache Cordova application that responds to the deviceready event. @@ -46,7 +49,4 @@ - - - diff --git a/platforms/ios/cordova/console.log b/platforms/ios/cordova/console.log index 33414d0..eef204a 100644 --- a/platforms/ios/cordova/console.log +++ b/platforms/ios/cordova/console.log @@ -6,3 +6,11 @@ 2014-04-15 21:50:10.156 Libr[17256:70b] Unlimited access to network resources 2014-04-15 21:50:10.708 Libr[17256:70b] Resetting plugins due to page load. 2014-04-15 21:50:11.015 Libr[17256:70b] Finished load of: file:///Users/twer/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/689C9FCB-41B1-4F23-A468-5913ACF7FA66/Libr.app/www/index.html#/login +2014-04-16 11:35:08.332 Libr[2157:70b] Multi-tasking -> Device: YES, App: YES +2014-04-16 11:35:08.390 Libr[2157:70b] Unlimited access to network resources +2014-04-16 11:35:08.707 Libr[2157:70b] Resetting plugins due to page load. +2014-04-16 11:35:09.192 Libr[2157:70b] Finished load of: file:///Users/twer/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/689C9FCB-41B1-4F23-A468-5913ACF7FA66/Libr.app/www/index.html#/login +2014-04-16 11:35:40.636 Libr[2534:70b] Multi-tasking -> Device: YES, App: YES +2014-04-16 11:35:40.642 Libr[2534:70b] Unlimited access to network resources +2014-04-16 11:35:40.728 Libr[2534:70b] Resetting plugins due to page load. +2014-04-16 11:35:40.881 Libr[2534:70b] Finished load of: file:///Users/twer/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/689C9FCB-41B1-4F23-A468-5913ACF7FA66/Libr.app/www/index.html#/login diff --git a/platforms/ios/www/dist/js/all.min.js b/platforms/ios/www/dist/js/all.min.js index d49cff1..b674353 100644 --- a/platforms/ios/www/dist/js/all.min.js +++ b/platforms/ios/www/dist/js/all.min.js @@ -7,8 +7,8 @@ (function(){var DoubanService,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.services.douban",[]),DoubanService=function(){function DoubanService($http,Constant,LocalStorageUtils){this.$http=$http,this.Constant=Constant,this.LocalStorageUtils=LocalStorageUtils,this.submitUser=__bind(this.submitUser,this)}return DoubanService.$inject=["$http","Constant","LocalStorageUtils"],DoubanService.prototype.userInfo=function(user,callback,error){return this.$http({url:"http://api.douban.com/v2/user/"+user,method:"GET",timeout:1e4,cache:!0}).success(function(data,status){return 200===status?callback(data):error(data)}).error(function(data){return error(data)})},DoubanService.prototype.submitUser=function(user,callback,error){var email,token,userId;return email=localStorage.getItem("email"),token=localStorage.getItem("token"),userId=this.LocalStorageUtils.getUserId(),this.$http({url:""+this.Constant.baseUrl+"/users/"+userId+"/link/douban/"+user+"?user_email="+email+"&user_token="+token,method:"POST",timeout:1e4}).success(function(data){return callback(data)}).error(function(data){return error(data)})},DoubanService}(),libr.service("DoubanService",DoubanService)}).call(this); (function(){var GeolocationService,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.services.geolocation",[]),GeolocationService=function(){function GeolocationService($http,Constant){this.$http=$http,this.Constant=Constant,this.getDetailAddress=__bind(this.getDetailAddress,this)}var getLocation,onError,onSuccess;return GeolocationService.$inject=["$http","Constant"],onSuccess=function(position){return alert("lat"+position.coords.latitude),{Latitude:position.coords.latitude,Longitude:position.coords.longitude,Altitude:position.coords.altitude,Accuracy:position.coords.accuracy,"Altitude Accuracy":position.coords.altitudeAccuracy,Heading:position.coords.heading,Speed:position.coords.speed,Timestamp:position.timestamp}},onError=function(error){throw"code: "+error.code+" \n message: "+error.message},GeolocationService.prototype.getCurrentLocation=function(callback,error){return navigator.geolocation.getCurrentPosition(callback,error)},GeolocationService.prototype.getDetailAddress=function(callback){var baseUrl;return baseUrl=this.Constant.baseUrl+"/locations/detail",this.getCurrentLocation(function(_this){return function(position){return _this.$http({url:""+baseUrl+"?lat="+position.coords.latitude+"&lng="+position.coords.longitude,cache:!0,method:"GET"}).success(function(data){return callback(data)})}}(this),function(error){throw Error(error)})},GeolocationService.prototype.getLocations=function(callback,error){var baseUrl,email,token;return baseUrl=this.Constant.baseUrl+"/locations",email=localStorage.getItem("email"),token=localStorage.getItem("token"),this.$http({url:""+baseUrl+"?user_email="+email+"&user_token="+token,method:"GET",cache:!1}).success(function(data){return callback(data)}).error(function(){throw Error(error)})},GeolocationService.prototype.createLocation=function(callback){var baseUrl,email,location,token;return baseUrl=this.Constant.baseUrl+"/locations",location=getLocation(),email=localStorage.getItem("email"),token=localStorage.getItem("token"),this.$http({method:"POST",url:baseUrl+("?user_email="+email+"&user_token="+token),data:"address="+location.address+"&lat="+location.lat+"&lng="+location.lng,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(data){return callback(data)})},GeolocationService.prototype.deleteLocation=function(item,callback){var baseUrl,email,token;return baseUrl=this.Constant.baseUrl+"/locations",email=localStorage.getItem("email"),token=localStorage.getItem("token"),this.$http({method:"DELETE",url:baseUrl+("?user_email="+email+"&user_token="+token+"&id="+item.id),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(data){return console.log("=====",data),callback(data)})},getLocation=function(){var location;return location={},location.address=localStorage.getItem("cur_address_detail"),location.lat=localStorage.getItem("cur_lat"),location.lng=localStorage.getItem("cur_lng"),location},GeolocationService}(),libr.service("GeolocationService",GeolocationService)}).call(this); (function(){var RecommendService,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.services.recommend",[]),RecommendService=function(){function RecommendService(GeolocationService,$http,Constant){this.GeolocationService=GeolocationService,this.$http=$http,this.Constant=Constant,this.changeRecommendAction=__bind(this.changeRecommendAction,this),this.popularBooksAroundMe=__bind(this.popularBooksAroundMe,this)}return RecommendService.$injector=["GeolocationService","$http","Constant"],RecommendService.prototype.getActionSheetList=function(){var actionList;return actionList=[],actionList.push({text:"随机找几本书看看"}),actionList.push({text:"你可能喜欢的书"}),this.GeolocationService.getLocations(function(){return function(locations){var locationIds;return locationIds=[],locations.map(function(location){return locationIds.push(location.id),location={text:""+location.address+"附近流行的书"},actionList.push(location)}),localStorage.setItem("recommend_action_sheet_arr",JSON.stringify(locationIds)),localStorage.setItem("recommend_action_sheet_full_arr",JSON.stringify(actionList))}}(this)),actionList},RecommendService.prototype.popularBooksForMe=function(callback,error){var email,token;return email=localStorage.getItem("email"),token=localStorage.getItem("token"),this.$http({url:this.Constant.baseUrl+("/recommend/me?user_email="+email+"&user_token="+token),method:"GET",timeout:15e3}).success(function(data){return callback(data)}).error(function(data){return error(data)})},RecommendService.prototype.randomBooks=function(callback,error){var email,token;return email=localStorage.getItem("email"),token=localStorage.getItem("token"),this.$http({url:this.Constant.baseUrl+("/recommend/random?user_email="+email+"&user_token="+token),method:"GET",timeout:15e3,cache:!0}).success(function(data){return callback(data)}).error(function(data){return error(data)})},RecommendService.prototype.popularBooksAroundMe=function(locationId,callback,error){var email,token;return email=localStorage.getItem("email"),token=localStorage.getItem("token"),this.$http({url:this.Constant.baseUrl+("/recommend/locations/"+locationId+"?user_email="+email+"&user_token="+token),method:"GET",timeout:15e3,cache:!0}).success(function(data){return console.log("数据",data),callback(data)}).error(function(data){return error(data)})},RecommendService.prototype.changeRecommendAction=function(index,callback,error){var locations;return console.log("index====",index),0===index?this.randomBooks(callback,error):1===index?this.popularBooksForMe(callback,error):(locations=JSON.parse(localStorage.getItem("recommend_action_sheet_arr")),console.log(locations[index-2],"index......"),this.popularBooksAroundMe(locations[index-2],function(result){return console.log("callback....",result),callback(result)},function(errorMessage){return error(errorMessage)}))},RecommendService}(),libr.service("RecommendService",RecommendService)}).call(this); -(function(){var ScanService,libr;libr=angular.module("libr.services.scan",[]),ScanService=function(){function ScanService(Books){this.Books=Books}return ScanService.$inject=["Books"],ScanService.prototype.scan=function(callback,errorCallback){return setTimeout(function(_this){return function(){return cordova.plugins.barcodeScanner.scan(function(result){return console.log("got scan result",result),1!==result.cancelled?"EAN_13"!==result.format?void errorCallback("条形码类型不匹配,请确认所扫为书籍,并尝试更换角度"):_this.Books.save({isbn:result.text},null,function(data){return console.log("get server response"),"error"===data.status?errorCallback(data.message):callback(data)},function(error){return errorCallback("添加图书失败"+error.data.message)}):void 0},function(error){return errorCallback("扫描图书失败:"+error+" ")})}}(this),600),navigator.notification.vibrate(50)},ScanService}(),libr.service("ScanService",ScanService)}).call(this); -(function(){var BooksController,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.controllers.books",["ionic"]),BooksController=function(){function BooksController($scope,Books,ScanService,$ionicModal,DoubanService,IonicUtils,LocalStorageUtils){var currentPage;this.$scope=$scope,this.Books=Books,this.ScanService=ScanService,this.$ionicModal=$ionicModal,this.DoubanService=DoubanService,this.IonicUtils=IonicUtils,this.LocalStorageUtils=LocalStorageUtils,this.submitDoubanUser=__bind(this.submitDoubanUser,this),this.scanBooks=__bind(this.scanBooks,this),this.searchDoubanUser=__bind(this.searchDoubanUser,this),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=!0,this.$scope.submitAllowed=!1,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.data={isLoading:!1,text:null},this.IonicUtils.initCustomLoading(this.$scope),this.$scope.onRefresh=this.refresh,this.$scope.loadMore=this.loadMore,this.$scope.closeDialog=this.closeDialog,this.$scope.searchDoubanUser=this.searchDoubanUser,this.$scope.scanBooks=this.scanBooks,this.$scope.submitDoubanUser=this.submitDoubanUser,this.$scope.doubanInputDisabled=null!==this.LocalStorageUtils.getDoubanUser(),this.$scope.doubanUsername=this.LocalStorageUtils.getDoubanUser(),this.$scope.$on("$destroy",function(_this){return function(){return _this.Books=null,_this.ScanService=null,console.log("销毁。。。。。",_this.Books)}}(this))}return BooksController.$inject=["$scope","Books","ScanService","$ionicModal","DoubanService","IonicUtils","LocalStorageUtils"],BooksController.prototype.refresh=function(){var afterBookId;return afterBookId=localStorage.getItem("user_max_book_id"),this.Books.fetchNew({afterId:afterBookId},function(_this){return function(data){return _this.$scope.$broadcast("scroll.refreshComplete"),0!==data.books.length?(localStorage.setItem("user_max_book_id",data.books[0].id),data.books.forEach(function(item){return _this.$scope.books.push(item)})):void 0}}(this))},BooksController.prototype.loadMore=function(){var currentPage,maxPage;return currentPage=localStorage.getItem("user_books_current_page"),maxPage=localStorage.getItem("user_books_max_page"),maxPage=parseInt(maxPage),currentPage=parseInt(currentPage),currentPage>=maxPage?(this.$scope.$broadcast("scroll.infiniteScrollComplete"),this.$scope.moreItemsAvailable=!1):this.Books.query({page:currentPage+1},function(_this){return function(data){return 0!==data.books.length?(localStorage.setItem("user_max_book_id",data.books[0].id),localStorage.setItem("user_books_current_page",data.current_page),localStorage.setItem("user_books_max_page",data.total_page),data.books.forEach(function(item){return _this.$scope.books.push(item)})):_this.$scope.moreItemsAvailable=!1,_this.$scope.$broadcast("scroll.infiniteScrollComplete")}}(this))},BooksController.prototype.closeDialog=function(){return this.$scope.modal.hide()},BooksController.prototype.searchDoubanUser=function(user){return console.log(user,"..."),void 0===user||""===user.trim()?this.IonicUtils.showLoading(this.$scope,"请输入有效昵称"):this.DoubanService.userInfo(user,function(_this){return function(data){return _this.$scope.resultEnabled=!0,_this.$scope.submitAllowed=!0,_this.$scope.doubanUser=data}}(this),function(_this){return function(error){return _this.IonicUtils.showLoading(_this.$scope,"查找豆瓣用户失败,请稍后再试"),console.log(error),_this.$scope.resultEnabled=!1,_this.$scope.submitAllowed=!1}}(this))},BooksController.prototype.scanBooks=function(){return this.ScanService.scan(function(_this){return function(result){return navigator.notification.alert("添加图书《"+result.book.name+"》成功",null,"Libr","确定"),_this.$scope.books.unshift(result.book)}}(this),function(_this){return function(msg){return _this.IonicUtils.showLoading(_this.$scope,msg)}}(this))},BooksController.prototype.submitDoubanUser=function(){var username;return username=angular.element(document.getElementById("douban-username")),username=username.val(),this.DoubanService.submitUser(username,function(_this){return function(){return _this.$scope.doubanInputDisabled=!0,_this.LocalStorageUtils.storeDoubanUser(username),alert("成功绑定豆瓣用户",function(){return _this.IonicUtils.showLoading(_this.$scope,"绑定豆瓣用户失败,请稍后再试")})}}(this))},BooksController}(),libr.controller("BooksController",BooksController)}).call(this); +(function(){var ScanService,libr;libr=angular.module("libr.services.scan",[]),ScanService=function(){function ScanService(Books){this.Books=Books}return ScanService.$inject=["Books"],ScanService.prototype.scan=function(callback,errorCallback){return setTimeout(function(_this){return function(){return cordova.plugins.barcodeScanner.scan(function(result){return console.log("got scan result",result),1!==result.cancelled?"EAN_13"!==result.format?(console.log("条码不匹配"),void errorCallback("条形码类型不匹配,请确认所扫为书籍,并更换角度")):_this.Books.save({isbn:result.text},null,function(data){return console.log("get server response"),"error"===data.status?errorCallback(data.message):callback(data)},function(error){return errorCallback("添加图书失败"+error.data.message)}):void 0},function(error){return errorCallback("扫描图书失败:"+error+" ")})}}(this),600),navigator.notification.vibrate(50)},ScanService}(),libr.service("ScanService",ScanService)}).call(this); +(function(){var BooksController,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.controllers.books",["ionic"]),BooksController=function(){function BooksController($scope,Books,ScanService,$ionicModal,DoubanService,IonicUtils,LocalStorageUtils){var currentPage;this.$scope=$scope,this.Books=Books,this.ScanService=ScanService,this.$ionicModal=$ionicModal,this.DoubanService=DoubanService,this.IonicUtils=IonicUtils,this.LocalStorageUtils=LocalStorageUtils,this.submitDoubanUser=__bind(this.submitDoubanUser,this),this.scanBooks=__bind(this.scanBooks,this),this.searchDoubanUser=__bind(this.searchDoubanUser,this),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=!0,this.$scope.submitAllowed=!1,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.data={isLoading:!1,text:null},this.IonicUtils.initCustomLoading(this.$scope),this.$scope.onRefresh=this.refresh,this.$scope.loadMore=this.loadMore,this.$scope.closeDialog=this.closeDialog,this.$scope.searchDoubanUser=this.searchDoubanUser,this.$scope.scanBooks=this.scanBooks,this.$scope.submitDoubanUser=this.submitDoubanUser,this.$scope.doubanInputDisabled=null!==this.LocalStorageUtils.getDoubanUser(),this.$scope.doubanUsername=this.LocalStorageUtils.getDoubanUser()}return BooksController.$inject=["$scope","Books","ScanService","$ionicModal","DoubanService","IonicUtils","LocalStorageUtils"],BooksController.prototype.refresh=function(){var afterBookId;return afterBookId=localStorage.getItem("user_max_book_id"),this.Books.fetchNew({afterId:afterBookId},function(_this){return function(data){return _this.$scope.$broadcast("scroll.refreshComplete"),0!==data.books.length?(localStorage.setItem("user_max_book_id",data.books[0].id),data.books.forEach(function(item){return _this.$scope.books.push(item)})):void 0}}(this))},BooksController.prototype.loadMore=function(){var currentPage,maxPage;return currentPage=localStorage.getItem("user_books_current_page"),maxPage=localStorage.getItem("user_books_max_page"),maxPage=parseInt(maxPage),currentPage=parseInt(currentPage),currentPage>=maxPage?(this.$scope.$broadcast("scroll.infiniteScrollComplete"),this.$scope.moreItemsAvailable=!1):this.Books.query({page:currentPage+1},function(_this){return function(data){return 0!==data.books.length?(localStorage.setItem("user_max_book_id",data.books[0].id),localStorage.setItem("user_books_current_page",data.current_page),localStorage.setItem("user_books_max_page",data.total_page),data.books.forEach(function(item){return _this.$scope.books.push(item)})):_this.$scope.moreItemsAvailable=!1,_this.$scope.$broadcast("scroll.infiniteScrollComplete")}}(this))},BooksController.prototype.closeDialog=function(){return this.$scope.modal.hide()},BooksController.prototype.searchDoubanUser=function(user){return console.log(user,"..."),void 0===user||""===user.trim()?this.IonicUtils.showLoading(this.$scope,"请输入有效昵称"):this.DoubanService.userInfo(user,function(_this){return function(data){return _this.$scope.resultEnabled=!0,_this.$scope.submitAllowed=!0,_this.$scope.doubanUser=data}}(this),function(_this){return function(error){return _this.IonicUtils.showLoading(_this.$scope,"查找豆瓣用户失败,请稍后再试"),console.log(error),_this.$scope.resultEnabled=!1,_this.$scope.submitAllowed=!1}}(this))},BooksController.prototype.scanBooks=function(){return this.ScanService.scan(function(_this){return function(result){return navigator.notification.alert("添加图书《"+result.book.name+"》成功",null,"Libr","确定"),_this.$scope.books.unshift(result.book)}}(this),function(_this){return function(msg){return console.log("trying to show loading...",msg),_this.IonicUtils.showLoading(_this.$scope,msg),_this.$scope.$apply(),console.log("applied")}}(this))},BooksController.prototype.submitDoubanUser=function(){var username;return username=angular.element(document.getElementById("douban-username")),username=username.val(),this.DoubanService.submitUser(username,function(_this){return function(){return _this.$scope.doubanInputDisabled=!0,_this.LocalStorageUtils.storeDoubanUser(username),alert("成功绑定豆瓣用户,请返回,系统将自动为你导入豆瓣图书")}}(this),function(_this){return function(){return _this.IonicUtils.showLoading(_this.$scope,"绑定豆瓣用户失败,请稍后再试")}}(this))},BooksController}(),libr.controller("BooksController",BooksController)}).call(this); (function(){var BookDetailController,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.controllers",["ionic"]),BookDetailController=function(){function BookDetailController($scope,$stateParams,Books,$window,$ionicModal,Comments){this.$scope=$scope,this.$stateParams=$stateParams,this.Books=Books,this.$window=$window,this.$ionicModal=$ionicModal,this.Comments=Comments,this.back=__bind(this.back,this),this.doComment=__bind(this.doComment,this),this.closeCommentDialog=__bind(this.closeCommentDialog,this),this.openCommentDialog=__bind(this.openCommentDialog,this),this.$scope.openDialog=this.openCommentDialog,this.$scope.closeDialog=this.closeCommentDialog,this.$scope.doComment=this.doComment,this.$scope.back=this.back,this.$ionicModal.fromTemplateUrl("templates/modal/comment.html",function(_this){return function(modal){return _this.$scope.modal=modal}}(this),{scope:this.$scope,animation:"slide-in-up"}),console.log("===="),this.Books.get({book_id:this.$stateParams.isbn},function(_this){return function(result){return _this.$scope.book=result,_this.$scope.usersAccount=result.users.length,_this.$scope.bookName=_this.$scope.book.name,_this.Comments.query({book_id:result.id},function(data){return console.log(data,"!!!!!"),_this.$scope.comments=data})}}(this)),this.$scope.$on("$destroy",function(_this){return function(){return _this.$scope.modal.remove()}}(this))}return BookDetailController.$inject=["$scope","$stateParams","Books","$window","$ionicModal","Comments"],BookDetailController.prototype.openCommentDialog=function(){return this.$scope.modal.show()},BookDetailController.prototype.closeCommentDialog=function(){return this.$scope.modal.hide()},BookDetailController.prototype.doComment=function(){var text;return text=angular.element(document.getElementById("comment")).val(),""===text.trim()?(alert("请输入有效字符"),!1):this.Comments.save({book_id:this.$scope.book.id,content:text},null,function(_this){return function(data){return null===data.id?alert("添加图书失败"):(console.log("成功。。。。。。。"),_this.$scope.comments.push(data),_this.closeCommentDialog())}}(this))},BookDetailController.prototype.back=function(){return this.$window.history.back()},BookDetailController}(),libr.controller("BookDetailController",BookDetailController)}).call(this); (function(){var HomeController,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.controllers.home",["ionic"]),HomeController=function(){function HomeController($scope,$location,ScanService,$ionicLoading,$ionicActionSheet,RecommendService,ErrorHandler,LocalStorageUtils){return this.$scope=$scope,this.$location=$location,this.$ionicLoading=$ionicLoading,this.$ionicActionSheet=$ionicActionSheet,this.RecommendService=RecommendService,this.ErrorHandler=ErrorHandler,this.LocalStorageUtils=LocalStorageUtils,this.changeRecommend=__bind(this.changeRecommend,this),this.showRecommendActionSheet=__bind(this.showRecommendActionSheet,this),this.$scope.showRecommendActionSheet=this.showRecommendActionSheet,this.LocalStorageUtils.isUserLogedIn()?(showLoading(this.$scope,this.$ionicLoading),this.$scope.title="随便看看吧",this.RecommendService.randomBooks(function(_this){return function(result){return _this.$scope.books=result,_this.$scope.loading.hide()}}(this),function(_this){return function(){return _this.ErrorHandler.loadingHandler(_this.$scope,null)}}(this)),void 0):void this.$location.path("/tab/settings")}var showLoading;return HomeController.$inject=["$scope","$location","ScanService","$ionicLoading","$ionicActionSheet","RecommendService","ErrorHandler","LocalStorageUtils"],showLoading=function($scope,$ionicLoading){return $scope.loading=$ionicLoading.show({content:"加载中",animation:"fade-in",showBackdrop:!0,maxWidth:200,showDelay:500})},HomeController.prototype.showRecommendActionSheet=function(){return this.$ionicActionSheet.show({titleText:"Libr 为你推荐",buttons:this.RecommendService.getActionSheetList(),cancelText:"取消",cancel:function(){return console.log("CANCELLED")},buttonClicked:function(_this){return function(index){return console.log(""+index+" has been taped"),_this.changeRecommend(index),!0}}(this)})},HomeController.prototype.changeRecommend=function(index){var msg;return msg="喔,看来附近还没有好书推荐,快去推荐你的朋友也来使用吧!",this.RecommendService.changeRecommendAction(index,function(_this){return function(result){var listArray;return 0===result.length?navigator.notification.alert(msg,null,"libr","确定"):(_this.$scope.books=result,listArray=JSON.parse(localStorage.getItem("recommend_action_sheet_full_arr")),_this.$scope.title=listArray[index].text)}}(this),function(_this){return function(){return _this.ErrorHandler.whenError(null)}}(this))},HomeController}(),libr.controller("HomeCtrl",HomeController)}).call(this); (function(){var LocationController,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.controllers.location",["ionic"]),LocationController=function(){function LocationController($scope,$location,GeolocationService,IonicUtils){this.$scope=$scope,this.$location=$location,this.GeolocationService=GeolocationService,this.IonicUtils=IonicUtils,this.addLocation=__bind(this.addLocation,this),this.$scope.addLocation=this.addLocation,this.$scope.itemButtons=[{text:"删除",type:"button-assertive",onTap:function(_this){return function(item){return _this.GeolocationService.deleteLocation(item,function(){return _this.$scope.locations.splice(_this.$scope.locations.indexOf(item),1)})}}(this)}],this.GeolocationService.getLocations(function(_this){return function(locations){return _this.$scope.locations=locations}}(this)),this.GeolocationService.getDetailAddress(function(_this){return function(position){return localStorage.setItem("cur_address_detail",position.result.formatted_address),localStorage.setItem("cur_lat",position.result.location.lat),localStorage.setItem("cur_lng",position.result.location.lng),_this.$scope.address=position.result.formatted_address}}(this)),this.IonicUtils.initCustomLoading(this.$scope)}return LocationController.$inject=["$scope","$location","GeolocationService","IonicUtils"],LocationController.prototype.addLocation=function(){return this.$scope.locations.length>=3?this.IonicUtils.showLoading(this.$scope,"只能创建3个常用的地址,请先删除部分再添加"):null===localStorage.getItem("cur_address_detail")?this.IonicUtils.showLoading(this.$scope,"定位成功后方可添加常用地址"):this.GeolocationService.createLocation(function(_this){return function(result){return _this.$scope.locations.push(result)}}(this))},LocationController}(),libr.controller("LocationController",LocationController)}).call(this); diff --git a/platforms/ios/www/index.html b/platforms/ios/www/index.html index 667a088..5df8e40 100644 --- a/platforms/ios/www/index.html +++ b/platforms/ios/www/index.html @@ -10,6 +10,7 @@ diff --git a/platforms/ios/www/js/app/controllers/books-controller.coffee b/platforms/ios/www/js/app/controllers/books-controller.coffee index b184784..eb8719b 100644 --- a/platforms/ios/www/js/app/controllers/books-controller.coffee +++ b/platforms/ios/www/js/app/controllers/books-controller.coffee @@ -33,12 +33,6 @@ class BooksController @$scope.doubanUsername = @LocalStorageUtils.getDoubanUser() - # destory $scope - @$scope.$on '$destroy', ()=> - @Books = null - @ScanService = null - console.log '销毁。。。。。', @Books - refresh: ()=> afterBookId = localStorage.getItem 'user_max_book_id' @Books.fetchNew {afterId: afterBookId}, (data)=> @@ -74,7 +68,7 @@ class BooksController @$scope.modal.hide() searchDoubanUser: (user)=> - console.log user,'...' + console.log user, '...' if user is undefined or user.trim() is '' @IonicUtils.showLoading(@$scope, '请输入有效昵称') else @@ -95,7 +89,10 @@ class BooksController navigator.notification.alert "添加图书《#{result.book.name}》成功", null, "Libr", "确定" @$scope.books.unshift result.book , (msg)=> + console.log 'trying to show loading...', msg @IonicUtils.showLoading(@$scope, msg) + @$scope.$apply() + console.log 'applied' submitDoubanUser: => username = angular.element document.getElementById('douban-username') @@ -103,8 +100,8 @@ class BooksController @DoubanService.submitUser username, (data) => @$scope.doubanInputDisabled = true @LocalStorageUtils.storeDoubanUser(username) - alert '成功绑定豆瓣用户' - , (data)=> - @IonicUtils.showLoading(@$scope, '绑定豆瓣用户失败,请稍后再试') + alert '成功绑定豆瓣用户,请返回,系统将自动为你导入豆瓣图书' + , (data)=> + @IonicUtils.showLoading(@$scope, '绑定豆瓣用户失败,请稍后再试') libr.controller 'BooksController', BooksController diff --git a/platforms/ios/www/js/app/controllers/main-controller.coffee b/platforms/ios/www/js/app/controllers/main-controller.coffee index 8c71ce1..9155fe3 100644 --- a/platforms/ios/www/js/app/controllers/main-controller.coffee +++ b/platforms/ios/www/js/app/controllers/main-controller.coffee @@ -7,3 +7,4 @@ class MainController libr.controller 'MainCtrl', MainController + diff --git a/platforms/ios/www/js/app/services/scan-service.coffee b/platforms/ios/www/js/app/services/scan-service.coffee index 51538be..6b1cd09 100644 --- a/platforms/ios/www/js/app/services/scan-service.coffee +++ b/platforms/ios/www/js/app/services/scan-service.coffee @@ -11,7 +11,8 @@ class ScanService console.log 'got scan result', result if result.cancelled is 1 then return if result.format isnt 'EAN_13' - errorCallback '条形码类型不匹配,请确认所扫为书籍,并尝试更换角度' + console.log '条码不匹配' + errorCallback '条形码类型不匹配,请确认所扫为书籍,并更换角度' return @Books.save {isbn: result.text}, null, (data)-> console.log 'get server response' diff --git a/platforms/ios/www/templates/my-books.html b/platforms/ios/www/templates/my-books.html index 92212b3..5ce7b14 100644 --- a/platforms/ios/www/templates/my-books.html +++ b/platforms/ios/www/templates/my-books.html @@ -7,7 +7,7 @@ -
+
{{data.text}}
diff --git a/www/index.html b/www/index.html index 667a088..5df8e40 100644 --- a/www/index.html +++ b/www/index.html @@ -10,6 +10,7 @@ diff --git a/www/js/app/controllers/books-controller.coffee b/www/js/app/controllers/books-controller.coffee index b184784..eb8719b 100644 --- a/www/js/app/controllers/books-controller.coffee +++ b/www/js/app/controllers/books-controller.coffee @@ -33,12 +33,6 @@ class BooksController @$scope.doubanUsername = @LocalStorageUtils.getDoubanUser() - # destory $scope - @$scope.$on '$destroy', ()=> - @Books = null - @ScanService = null - console.log '销毁。。。。。', @Books - refresh: ()=> afterBookId = localStorage.getItem 'user_max_book_id' @Books.fetchNew {afterId: afterBookId}, (data)=> @@ -74,7 +68,7 @@ class BooksController @$scope.modal.hide() searchDoubanUser: (user)=> - console.log user,'...' + console.log user, '...' if user is undefined or user.trim() is '' @IonicUtils.showLoading(@$scope, '请输入有效昵称') else @@ -95,7 +89,10 @@ class BooksController navigator.notification.alert "添加图书《#{result.book.name}》成功", null, "Libr", "确定" @$scope.books.unshift result.book , (msg)=> + console.log 'trying to show loading...', msg @IonicUtils.showLoading(@$scope, msg) + @$scope.$apply() + console.log 'applied' submitDoubanUser: => username = angular.element document.getElementById('douban-username') @@ -103,8 +100,8 @@ class BooksController @DoubanService.submitUser username, (data) => @$scope.doubanInputDisabled = true @LocalStorageUtils.storeDoubanUser(username) - alert '成功绑定豆瓣用户' - , (data)=> - @IonicUtils.showLoading(@$scope, '绑定豆瓣用户失败,请稍后再试') + alert '成功绑定豆瓣用户,请返回,系统将自动为你导入豆瓣图书' + , (data)=> + @IonicUtils.showLoading(@$scope, '绑定豆瓣用户失败,请稍后再试') libr.controller 'BooksController', BooksController diff --git a/www/js/app/controllers/main-controller.coffee b/www/js/app/controllers/main-controller.coffee index 8c71ce1..9155fe3 100644 --- a/www/js/app/controllers/main-controller.coffee +++ b/www/js/app/controllers/main-controller.coffee @@ -7,3 +7,4 @@ class MainController libr.controller 'MainCtrl', MainController + diff --git a/www/js/app/services/scan-service.coffee b/www/js/app/services/scan-service.coffee index 51538be..6b1cd09 100644 --- a/www/js/app/services/scan-service.coffee +++ b/www/js/app/services/scan-service.coffee @@ -11,7 +11,8 @@ class ScanService console.log 'got scan result', result if result.cancelled is 1 then return if result.format isnt 'EAN_13' - errorCallback '条形码类型不匹配,请确认所扫为书籍,并尝试更换角度' + console.log '条码不匹配' + errorCallback '条形码类型不匹配,请确认所扫为书籍,并更换角度' return @Books.save {isbn: result.text}, null, (data)-> console.log 'get server response' diff --git a/www/templates/my-books.html b/www/templates/my-books.html index 92212b3..5ce7b14 100644 --- a/www/templates/my-books.html +++ b/www/templates/my-books.html @@ -7,7 +7,7 @@ -
+
{{data.text}}