|
@@ -23,19 +23,6 @@ interface BookInfo {
|
|
callNumber: string;
|
|
callNumber: string;
|
|
yearVolumeIssue: string;
|
|
yearVolumeIssue: string;
|
|
}
|
|
}
|
|
-
|
|
|
|
-interface ItemInfo {
|
|
|
|
- title:string;
|
|
|
|
- callNumber:string;
|
|
|
|
- barCodeNumber:string;
|
|
|
|
- bookStatus:string;
|
|
|
|
- borrowingProperties:string;
|
|
|
|
- depositDate:string;
|
|
|
|
- shelvingNumber:string;
|
|
|
|
- annualRollPeriod:string;
|
|
|
|
- donor:string;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 引用Parse JS SDK
|
|
// 引用Parse JS SDK
|
|
|
|
|
|
Parse.initialize("dev"); // 设置applicationId
|
|
Parse.initialize("dev"); // 设置applicationId
|
|
@@ -47,9 +34,9 @@ Parse.serverURL = "http://web2023.fmode.cn:9999/parse"; // 设置serverURL
|
|
styleUrls: ['./details-book.page.scss']
|
|
styleUrls: ['./details-book.page.scss']
|
|
})
|
|
})
|
|
export class DetailsBookPage implements OnInit {
|
|
export class DetailsBookPage implements OnInit {
|
|
- bookList:Array<Parse.Object> = []
|
|
|
|
- bookInfo:Parse.Object|undefined
|
|
|
|
- items:ItemInfo[] = [];
|
|
|
|
|
|
+ bookList:any[] = [];
|
|
|
|
+ bookInfo:any;
|
|
|
|
+ items:any[] = [];
|
|
book:BookInfo={
|
|
book:BookInfo={
|
|
src: '',
|
|
src: '',
|
|
title: '',
|
|
title: '',
|
|
@@ -86,27 +73,27 @@ export class DetailsBookPage implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
|
|
+ private router: Router,
|
|
private route:ActivatedRoute,
|
|
private route:ActivatedRoute,
|
|
private navCtrl:NavController,
|
|
private navCtrl:NavController,
|
|
private alertController:AlertController
|
|
private alertController:AlertController
|
|
) {}
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
- this.loadPetById()
|
|
|
|
- this.loadAWBook()
|
|
|
|
- this.generateItems();
|
|
|
|
|
|
+ this.loadBookById()
|
|
|
|
+ // this.generateItems();
|
|
this.makeStarList();
|
|
this.makeStarList();
|
|
}
|
|
}
|
|
|
|
|
|
- async loadPetById(){
|
|
|
|
|
|
+ async loadBookById(){
|
|
// let id = location.pathname.split("/").pop();
|
|
// let id = location.pathname.split("/").pop();
|
|
let id = this.route.snapshot.params["id"]
|
|
let id = this.route.snapshot.params["id"]
|
|
|
|
|
|
if(id){
|
|
if(id){
|
|
let query = new Parse.Query("AWBook");
|
|
let query = new Parse.Query("AWBook");
|
|
this.bookInfo = await query.get(id);
|
|
this.bookInfo = await query.get(id);
|
|
- // this.value = this.bookInfo.get("value");
|
|
|
|
this.initBookInfo(this.bookInfo);
|
|
this.initBookInfo(this.bookInfo);
|
|
|
|
+ this.loadItemByBookTitle(this.bookInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -131,30 +118,34 @@ export class DetailsBookPage implements OnInit {
|
|
this.book.yearVolumeIssue = bookInfo.get("yearVolumeIssue");
|
|
this.book.yearVolumeIssue = bookInfo.get("yearVolumeIssue");
|
|
}
|
|
}
|
|
|
|
|
|
- async loadAWBook(){
|
|
|
|
- let query = new Parse.Query("AWBook");
|
|
|
|
- let list = await query.find();
|
|
|
|
- this.bookList = list
|
|
|
|
- }
|
|
|
|
|
|
+ async loadItemByBookTitle(bookInfo:Parse.Object){
|
|
|
|
+ let query = new Parse.Query("AWItem");
|
|
|
|
+ query.equalTo("bookTitle", bookInfo.get("title"));
|
|
|
|
|
|
- private generateItems() {
|
|
|
|
- const count = this.items.length + 1;
|
|
|
|
- for (let i = 0; i < 5; i++) {
|
|
|
|
- let item:ItemInfo = {
|
|
|
|
- title:"111",
|
|
|
|
- callNumber:"",
|
|
|
|
- barCodeNumber:"",
|
|
|
|
- bookStatus:"",
|
|
|
|
- borrowingProperties:"",
|
|
|
|
- depositDate:"",
|
|
|
|
- shelvingNumber:"",
|
|
|
|
- annualRollPeriod:"",
|
|
|
|
- donor:""
|
|
|
|
- }
|
|
|
|
- this.items.push(item);
|
|
|
|
- }
|
|
|
|
|
|
+ let bookInfoList = await query.find();
|
|
|
|
+ this.items = bookInfoList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // private generateItems() {
|
|
|
|
+ // const count = this.items.length + 1;
|
|
|
|
+ // for (let i = 0; i < 5; i++) {
|
|
|
|
+ // let item:ItemInfo = {
|
|
|
|
+ // title:"111",
|
|
|
|
+ // callNumber:"",
|
|
|
|
+ // barCodeNumber:"",
|
|
|
|
+ // bookStatus:"",
|
|
|
|
+ // borrowingProperties:"",
|
|
|
|
+ // depositDate:"",
|
|
|
|
+ // shelvingNumber:"",
|
|
|
|
+ // annualRollPeriod:"",
|
|
|
|
+ // donor:""
|
|
|
|
+ // }
|
|
|
|
+ // this.items.push(item);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
onStarClick(index:number){
|
|
onStarClick(index:number){
|
|
let score = index + 1
|
|
let score = index + 1
|
|
|
|
|
|
@@ -179,8 +170,10 @@ export class DetailsBookPage implements OnInit {
|
|
this.starCheckList = starList
|
|
this.starCheckList = starList
|
|
}
|
|
}
|
|
|
|
|
|
- back(){
|
|
|
|
- this.navCtrl.back()
|
|
|
|
|
|
+
|
|
|
|
+ onClickRequest(event:MouseEvent){
|
|
|
|
+ let id = this.route.snapshot.params["id"]
|
|
|
|
+ this.router.navigate(['request/'+id]);
|
|
}
|
|
}
|
|
|
|
|
|
// onIonInfinite(ev: any) {
|
|
// onIonInfinite(ev: any) {
|