mirror of
https://github.com/wahyd4/Libr-mobile.git
synced 2026-08-09 04:45:57 +10:00
start working on import books from douban
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 181 B |
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
@@ -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'
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 '请输入有效的用户名和密码'
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<div class="modal">
|
||||
<header class="bar bar-header bar-positive">
|
||||
<button class="button button-icon ion-arrow-left-c" ng-click="closeDialog()"></button>
|
||||
<h1 class="title"><img src="img/douban_24.png">从豆瓣读书导入书籍</h1>
|
||||
</header>
|
||||
<ion-content has-header="true" padding="true">
|
||||
<label class="item item-input">
|
||||
<span class="input-label">豆瓣用户名</span>
|
||||
<input type="text" placeholder="请输入豆瓣用户名" ng-model="user.email">
|
||||
</label>
|
||||
<button class="button button-full button-energized" ng-click="doComment()">
|
||||
提交
|
||||
</button>
|
||||
<p>注意:绑定后不能更改用户名,请填入正确的用户名</p>
|
||||
</ion-content>
|
||||
</div>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 181 B |
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
@@ -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
|
||||
@@ -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;
|
||||
|
||||
})();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 '请输入有效的用户名和密码'
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<div class="modal">
|
||||
<header class="bar bar-header bar-positive">
|
||||
<button class="button button-icon ion-arrow-left-c" ng-click="closeDialog()"></button>
|
||||
<h1 class="title"><img src="img/douban_24.png">从豆瓣读书导入书籍</h1>
|
||||
</header>
|
||||
<ion-content has-header="true" padding="true">
|
||||
<label class="item item-input">
|
||||
<span class="input-label">豆瓣用户名</span>
|
||||
<input type="text" placeholder="请输入豆瓣用户名" ng-model="user.email">
|
||||
</label>
|
||||
<button class="button button-full button-energized" ng-click="doComment()">
|
||||
提交
|
||||
</button>
|
||||
<p>注意:绑定后不能更改用户名,请填入正确的用户名</p>
|
||||
</ion-content>
|
||||
</div>
|
||||
Reference in New Issue
Block a user