merged app-store branch

This commit is contained in:
2014-05-22 09:05:03 +08:00
27 changed files with 49 additions and 1427 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ libr = angular.module 'libr.constant', []
Constant = {}
#Constant.baseUrl = "http://libr.herokuapp.com/api/v1"
Constant.baseUrl = "http://192.168.0.103:3000/api/v1"
Constant.baseUrl = "http://10.117.100.31:3000/api/v1"
libr.constant 'Constant', Constant
+2 -2
View File
@@ -7,7 +7,7 @@ class HomeController
@$scope.showRecommendActionSheet = @showRecommendActionSheet
if @LocalStorageUtils.isUserLogedIn()
showLoading(@$scope, @$ionicLoading)
@$scope.title = '随便看看吧'
@$scope.title = {'name': 'Libr-随便看看吧'}
if localStorage.getItem('home.books') is null
@RecommendService.randomBooks (result)=>
@$scope.books = result
@@ -57,7 +57,7 @@ class HomeController
listArray = JSON.parse(localStorage.getItem 'recommend_action_sheet_full_arr')
console.log '=========='
console.log listArray,index
@$scope.title = listArray[index].text
@$scope.title.name = listArray[index].text
, (error)=>
@ErrorHandler.whenError null
libr.controller 'HomeCtrl', HomeController
@@ -1,5 +1,5 @@
#Last build type
#Fri, 16 May 2014 11:49:01 +0800
#Thu, 22 May 2014 09:04:22 +0800
build.last.target=debug
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -500,6 +500,7 @@
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/douban_24.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/douban_32.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/social.umeng \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/weibo24.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/social.umeng/back.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/social.umeng/send.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/social.umeng/send_disable.png \
@@ -602,4 +603,5 @@
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/templates/modal/comment.html \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/templates/modal/import_books.html \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/templates/modal/registration.html \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/templates/modal/share.html \
/Users/twer/gitrepo/libr-mobile/platforms/android/ant-build/AndroidManifest.xml \
+1 -1
View File
@@ -1,5 +1,5 @@
#Last build type
#Fri, 16 May 2014 11:49:07 +0800
#Thu, 22 May 2014 09:04:28 +0800
build.last.target=debug
-5
View File
@@ -52,11 +52,6 @@ ul.shareList li.shareList_item:focus{background-color:#E3EDFC}
.icon-submit{background:url(../../img/social.umeng/send.png) no-repeat center center;background-size:60%}
.icon-submit.disabled{background:url(../../img/social.umeng/send_disable.png) no-repeat center center;background-size:60%}
.icon-back:focus,.icon-submit:focus{background-color:#E4EFFB}
.sharePage .sharePageTitle .sharePageBack{position:absolute;left:0;top:0}
.sharePage .sharePageTitle .sharePageSubmit{position:absolute;right:0;top:0}
.sharePage .sharePageContent{display:block;top:50px;bottom:110px;left:10px;right:10px;background:#FFF;border:none;position:fixed;font-size:1em}
.sharePage .sharePageBottom{position:fixed;bottom:0;width:100%;left:0;height:40px;line-height:40px;background:#EFF2F8;border-top:1px solid #DDD}
.sharePage .sharePageBottom .shareBottomBtn{width:30px;height:30px;background:#FF0;border-radius:5px;position:relative;display:block;float:left;margin:5px 10px}
.shareGeo{position:absolute;top:-30px;left:10px;font-size:1em;height:20px;border:1px solid #CCC;border-radius:15px;line-height:20px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:150px;color:#666;text-align:center}
.shareImg{position:absolute;bottom:50px;right:10px;max-height:70px;max-width:70px;display:none}
.umTip{position:fixed;bottom:50px;left:0;width:100%;text-align:center;display:none;z-index:10000}
File diff suppressed because it is too large Load Diff
-17
View File
@@ -34,26 +34,9 @@
<ion-nav-view></ion-nav-view>
<script src="assets/angular-resource/angular-resource.min.js"></script>
<script type="text/javascript" src="js/libr.js"></script>
<script src="js/app.js"></script>
<script src="js/umeng/jquery.js"></script>
<script src="js/umeng/social.umeng.js"></script>
<script src="js/umeng/html2canvas.js"></script>
<script src="dist/js/all.min.js"></script>
<!-- <script src="http://10.17.2.56:8080/target/target-script-min.js#anonymous"></script> -->
<script>
var opt = {
'data': {
'content': {
'text': 'Libr分享即将来临',
'img': 'img/share.png'
}
}
};
function goShare() {
$("#xyz").umshare(opt);
}
</script>
</body>
</html>
+1 -1
View File
@@ -17,6 +17,7 @@ angular.module('libr', [
'libr.services.comment',
'libr.services.recommend',
'libr.services.utils',
'libr.directives.swipeBack',
'libr.controllers.login',
'libr.controllers.home',
'libr.controllers.main',
@@ -100,5 +101,4 @@ angular.module('libr', [
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/login');
});
-4
View File
@@ -1,4 +0,0 @@
var haha = function () {
alert('ssss');
console.log('.......text');
}
@@ -203,13 +203,14 @@
c.name = $.fn.umshare.defaults.data.platform[plat].name;
}
var sharePanel = function (plat, c) {
var panel = $('<div class="sharePage">\
<div class="sharePageTitle">\
<b class="icon-back sharePageBack"></b>\
<span>分享到' + c.name + '</span>\
<b class="icon-submit sharePageSubmit"></b>\
</div>\
var panel = $('<div class="bar bar-header bar-positive">\
<button class="button icon sharePageBack ion-arrow-left-c"></button>\
<h1 class="title">分享到' + c.name + '</h1>\
<button class="button sharePageSubmit icon ion-checkmark-round"></button>\
</div><div class="padding has-header">\
<div class="list">\
<textarea class="sharePageContent">' + c.data.content.text + '</textarea>\
</div></div>\
<div class="sharePageBottom">\
<span class="shareGeo"></span>\
<img id="shareImage" class="shareImg" src="' + (c.data.content.img ? c.data.content.img : c.data.content.furl) + '"/>\
@@ -3,7 +3,7 @@
<button class="button button-icon ion-arrow-left-c" ng-click="back()">
</button>
</ion-nav-buttons>
<ion-content has-header="true" padding="true">
<ion-content has-header="true" padding="true" swipe-back>
<div class="list card">
<div class="item ">
<h2>{{book.name}}</h2>
@@ -27,7 +27,7 @@
<i class="icon ion-chatbox"></i>
评论
</a>
<a class="tab-item" onclick="goShare()" id="xyz">
<a class="tab-item" id="xyz" ng-click="goShare()">
<i class="icon ion-share"></i>
分享
</a>
@@ -1,6 +1,7 @@
<ion-view title="{{title}}">
<ion-view title="{{title.name}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)"
ng-show="(title.name=='随便看看吧')|| (title.name=='Libr-随便看看吧')">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
@@ -12,19 +12,10 @@
<i class="icon ion-log-out"></i>
注销登录
</a>
<a class="item item-icon-left">
<i class="icon ion-email"></i>
系统消息
<span class="badge badge-assertive">0</span>
</a>
<a class="item item-icon-left" href="#" ng-click="feedback()">
<i class="icon ion-heart"></i>
请给我们提供反馈吧
</a>
<a class="item item-icon-left" ng-click="showMe()">
<i class="icon ion-information-circled"></i>
关于
</a>
</div>
</ion-content>
</ion-view>
+2 -1
View File
@@ -8,9 +8,10 @@
(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:!1}).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 navigator.notification.vibrate(50),cordova.plugins.barcodeScanner.scan(function(_this){return 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}}(this),function(error){return errorCallback("扫描图书失败:"+error+" ")})},ScanService}(),libr.service("ScanService",ScanService)}).call(this);
(function(){var SwipeBack,libr;libr=angular.module("libr.directives.swipeBack",[]),SwipeBack=function(){function SwipeBack($ionicGesture,$window){return this.$ionicGesture=$ionicGesture,this.$window=$window,{restrict:"A",link:function(_this){return function(scope,element){return _this.$ionicGesture.on("swiperight",function(){return _this.$window.history.back()},element)}}(this)}}return SwipeBack.$inject=["$ionicGesture","$window"],SwipeBack}(),libr.directive("swipeBack",["$ionicGesture","$window",SwipeBack])}).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,DoubanService,$ionicActionSheet){this.$scope=$scope,this.$stateParams=$stateParams,this.Books=Books,this.$window=$window,this.$ionicModal=$ionicModal,this.Comments=Comments,this.DoubanService=DoubanService,this.$ionicActionSheet=$ionicActionSheet,this.swipeRight=__bind(this.swipeRight,this),this.closeShare=__bind(this.closeShare,this),this.goShare=__bind(this.goShare,this),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.$scope.goShare=this.goShare,this.$scope.closeShare=this.closeShare,this.$scope.swipeRight=this.swipeRight,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"}),this.$ionicModal.fromTemplateUrl("templates/modal/share.html",function(_this){return function(modal){return _this.$scope.shareModal=modal}}(this),{scope:this.$scope,animation:"slide-in-up"}),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.DoubanService.bookDetail(result.isbn,function(data){return console.log(data),_this.$scope.bookDetail=data},function(error){return console.log("error",error)})}}(this)),this.$scope.$on("$destroy",function(_this){return function(){return _this.$scope.modal.remove()}}(this))}return BookDetailController.$inject=["$scope","$stateParams","Books","$window","$ionicModal","Comments","DoubanService","$ionicActionSheet"],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.prototype.goShare=function(){return this.$scope.shareModal.show()},BookDetailController.prototype.closeShare=function(){return this.$scope.shareModal.hide()},BookDetailController.prototype.swipeRight=function(){return this.$window.history.back(),console.log("swipe right..")},BookDetailController}(),libr.controller("BookDetailController",BookDetailController)}).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 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="随便看看吧",null===localStorage.getItem("home.books")?this.RecommendService.randomBooks(function(_this){return function(result){return _this.$scope.books=result,localStorage.setItem("home.books",JSON.stringify(result)),_this.$ionicLoading.hide()}}(this),function(_this){return function(){return _this.ErrorHandler.loadingHandler(_this.$scope,null)}}(this)):(this.$scope.books=JSON.parse(localStorage.getItem("home.books")),this.$ionicLoading.hide()),void(this.$scope.changeRecommend=this.changeRecommend)):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,localStorage.setItem("home.books",JSON.stringify(result)),listArray=JSON.parse(localStorage.getItem("recommend_action_sheet_full_arr")),console.log("=========="),console.log(listArray,index),_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 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={name:"Libr-随便看看吧"},null===localStorage.getItem("home.books")?this.RecommendService.randomBooks(function(_this){return function(result){return _this.$scope.books=result,localStorage.setItem("home.books",JSON.stringify(result)),_this.$ionicLoading.hide()}}(this),function(_this){return function(){return _this.ErrorHandler.loadingHandler(_this.$scope,null)}}(this)):(this.$scope.books=JSON.parse(localStorage.getItem("home.books")),this.$ionicLoading.hide()),void(this.$scope.changeRecommend=this.changeRecommend)):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,localStorage.setItem("home.books",JSON.stringify(result)),listArray=JSON.parse(localStorage.getItem("recommend_action_sheet_full_arr")),console.log("=========="),console.log(listArray,index),_this.$scope.title.name=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.deleteItem=__bind(this.deleteItem,this),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),this.$scope.deleteItem=this.deleteItem}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")||void 0===localStorage.getItem("cur_address_detail")?this.IonicUtils.showLoading(this.$scope,"定位成功后方可添加常用地址"):null===this.$scope.address||""===this.$scope.address?this.IonicUtils.showLoading(this.$scope,"定位成功后方可添加常用地址"):this.GeolocationService.createLocation(function(_this){return function(result){return _this.$scope.locations.push(result)}}(this))},LocationController.prototype.deleteItem=function(item){return this.GeolocationService.deleteLocation(item,function(_this){return function(){return _this.$scope.locations.splice(_this.$scope.locations.indexOf(item),1)}}(this))},LocationController}(),libr.controller("LocationController",LocationController)}).call(this);
(function(){var LoginController,libr,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};libr=angular.module("libr.controllers.login",["ionic"]),LoginController=function(){function LoginController($scope,AuthService,$state,$ionicModal,IonicUtils,LocalStorageUtils){this.$scope=$scope,this.AuthService=AuthService,this.$state=$state,this.$ionicModal=$ionicModal,this.IonicUtils=IonicUtils,this.LocalStorageUtils=LocalStorageUtils,this.closeDialog=__bind(this.closeDialog,this),this.registerUser=__bind(this.registerUser,this),this.registerForm=__bind(this.registerForm,this),this.login=__bind(this.login,this),this.LocalStorageUtils.isUserLogedIn()&&this.$state.go("tab.home"),this.$scope.login=this.login,this.$scope.registerForm=this.registerForm,this.$scope.registerUser=this.registerUser,this.$scope.closeDialog=this.closeDialog,this.$ionicModal.fromTemplateUrl("templates/modal/registration.html",function(_this){return function(modal){return _this.$scope.modal=modal}}(this),{scope:this.$scope,animation:"slide-in-up"}),this.IonicUtils.initCustomLoading(this.$scope)}return LoginController.$inject=["$scope","AuthService","$state","$ionicModal","IonicUtils","LocalStorageUtils"],LoginController.prototype.login=function(user){return user&&""!==user.email&&""!==user.password&&void 0!==user.email&&void 0!==user.password?this.AuthService.login(user,function(_this){return function(result){return localStorage.setItem("token",result.user.token),localStorage.setItem("avatar",result.user.avatar),localStorage.setItem("username",result.user.name),localStorage.setItem("email",user.email),localStorage.setItem("user",JSON.stringify(result.user)),_this.$state.go("tab.home")}}(this),function(_this){return function(data){return _this.IonicUtils.showLoading(_this.$scope,data)}}(this)):void this.IonicUtils.showLoading(this.$scope,"请输入有效的用户名和密码")},LoginController.prototype.registerForm=function(){return this.$scope.modal.show()},LoginController.prototype.registerUser=function(user){return user&&""!==user.email&&""!==user.password&&void 0!==user.email&&void 0!==user.password?this.AuthService.register(user,function(_this){return function(result,status){return 201===status?(alert("注册成功,请返回登录"),_this.$scope.modal.hide()):_this.IonicUtils.showLoading(_this.$scope,"注册失败,请确认是否输入正确,并重试")}}(this),function(_this){return function(error){return _this.IonicUtils.showLoading(_this.$scope,"注册失败,请确认是否输入正确,并重试"),console.log("registerError",error)}}(this)):void this.IonicUtils.showLoading(this.$scope,"用户名或密码错误,请重试")},LoginController.prototype.closeDialog=function(){return this.$scope.modal.hide()},LoginController}(),libr.controller("LoginController",LoginController)}).call(this);
(function(){var MainController,libr;libr=angular.module("libr.controllers.main",["ionic"]),MainController=function(){function MainController($scope,$location,$ionicModal,$state){this.$scope=$scope,this.$location=$location,this.$ionicModal=$ionicModal,this.$state=$state}return MainController.$inject=["$scope","$location","$ionicModal","$state"],MainController}(),libr.controller("MainCtrl",MainController)}).call(this);
-17
View File
@@ -34,26 +34,9 @@
<ion-nav-view></ion-nav-view>
<script src="assets/angular-resource/angular-resource.min.js"></script>
<script type="text/javascript" src="js/libr.js"></script>
<script src="js/app.js"></script>
<script src="js/umeng/jquery.js"></script>
<script src="js/umeng/social.umeng.js"></script>
<script src="js/umeng/html2canvas.js"></script>
<script src="dist/js/all.min.js"></script>
<!-- <script src="http://10.17.2.56:8080/target/target-script-min.js#anonymous"></script> -->
<script>
var opt = {
'data': {
'content': {
'text': 'Libr分享即将来临',
'img': 'img/share.png'
}
}
};
function goShare() {
$("#xyz").umshare(opt);
}
</script>
</body>
</html>
+1 -1
View File
@@ -17,6 +17,7 @@ angular.module('libr', [
'libr.services.comment',
'libr.services.recommend',
'libr.services.utils',
'libr.directives.swipeBack',
'libr.controllers.login',
'libr.controllers.home',
'libr.controllers.main',
@@ -100,5 +101,4 @@ angular.module('libr', [
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/login');
});
-4
View File
@@ -1,4 +0,0 @@
var haha = function () {
alert('ssss');
console.log('.......text');
}
+1 -1
View File
@@ -3,7 +3,7 @@
<button class="button button-icon ion-arrow-left-c" ng-click="back()">
</button>
</ion-nav-buttons>
<ion-content has-header="true" padding="true" ng-swipe-right="swipeRight()">
<ion-content has-header="true" padding="true" swipe-back>
<div class="list card">
<div class="item ">
<h2>{{book.name}}</h2>
+3 -2
View File
@@ -1,6 +1,7 @@
<ion-view title="{{title}}">
<ion-view title="{{title.name}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)"
ng-show="(title.name=='随便看看吧')|| (title.name=='Libr-随便看看吧')">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
@@ -12,19 +12,10 @@
<i class="icon ion-log-out"></i>
注销登录
</a>
<a class="item item-icon-left">
<i class="icon ion-email"></i>
系统消息
<span class="badge badge-assertive">0</span>
</a>
<a class="item item-icon-left" href="#" ng-click="feedback()">
<i class="icon ion-heart"></i>
请给我们提供反馈吧
</a>
<a class="item item-icon-left" ng-click="showMe()">
<i class="icon ion-information-circled"></i>
关于
</a>
</div>
</ion-content>
</ion-view>
+3 -2
View File
@@ -1,6 +1,7 @@
<ion-view title="{{title}}">
<ion-view title="{{title.name}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)"
ng-show="(title.name=='随便看看吧')|| (title.name=='Libr-随便看看吧')">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
-9
View File
@@ -12,19 +12,10 @@
<i class="icon ion-log-out"></i>
注销登录
</a>
<a class="item item-icon-left">
<i class="icon ion-email"></i>
系统消息
<span class="badge badge-assertive">0</span>
</a>
<a class="item item-icon-left" href="#" ng-click="feedback()">
<i class="icon ion-heart"></i>
请给我们提供反馈吧
</a>
<a class="item item-icon-left" ng-click="showMe()">
<i class="icon ion-information-circled"></i>
关于
</a>
</div>
</ion-content>
</ion-view>