Skip to content

Commit d52ebec

Browse files
committed
Milestone.
1 parent ff0b647 commit d52ebec

File tree

9 files changed

+53
-11
lines changed

9 files changed

+53
-11
lines changed

electron/src/book.backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class BookBackend {
6666

6767
bookWindow.setMaximizable(true);
6868
bookWindow.setMaximizable(true);
69-
bookWindow.setMinimumSize(1024, 768);
69+
bookWindow.setMinimumSize(1024, 600);
7070
const webContents = bookWindow.webContents;
7171
webContents.openDevTools();
7272

src/app/home/components/book-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</mat-card-header>
2828

2929
<mat-card-content *ngIf="book.desc.length > 0">
30-
<mat-label><b></b>{{book.desc}}<b></b></mat-label>
30+
<mat-label><b></b>{{book.desc.length > 256 ? book.desc.slice(0,256)+'...' : book.desc}}<b></b></mat-label>
3131
</mat-card-content>
3232

3333
<mat-card-content fxLayout="row" fxLayoutGap="5px" class="cate-list">

src/app/home/components/new-book-dialog.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
Component,
33
OnInit,
44
ElementRef,
5+
Inject,
56
ViewChild
67
} from '@angular/core';
78
import { FormControl, Validators } from '@angular/forms';
@@ -12,6 +13,7 @@ import { map, startWith } from 'rxjs/operators';
1213

1314
import {
1415
MatDialogRef,
16+
MAT_DIALOG_DATA,
1517
} from '@angular/material/dialog';
1618
import { MatAutocompleteSelectedEvent, MatAutocomplete} from '@angular/material/autocomplete';
1719
import { MatChipInputEvent } from '@angular/material/chips';
@@ -55,9 +57,10 @@ export class NewBookDialog implements OnInit{
5557
public dialogRef: MatDialogRef<NewBookDialog>,
5658
private book: BookService,
5759
private cate: CateService,
60+
@Inject(MAT_DIALOG_DATA) public bookUri: string
5861
) {
62+
this.newBook.bookUri = bookUri ? bookUri : '';
5963
this.cateList = this.cate.list;
60-
6164
this.filteredCateList = this.cateListInputControl.valueChanges.pipe(
6265
startWith(null),
6366
map((cateInput: string | null) => cateInput ? this._filter(cateInput) : this.tempCateList.slice())
@@ -68,7 +71,6 @@ export class NewBookDialog implements OnInit{
6871

6972
ngOnInit() {
7073
this.tempCateList = this.cateList.slice();
71-
7274
this.uriInputControl.setValidators(IsQualifiedAndNotExistedGitRepoValidatorFn(this.book.list.slice()));
7375
}
7476

src/app/home/components/reading-record.dialog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h2 mat-dialog-title>{{data.name|uppercase}} 阅读记录 - 共 {{recordList.len
88
style="height: 40px; padding: 0">
99
<ion-label color="dark" class="ion-float-left" style="width: 360px;">
1010
<ion-text class="ion-float-left" style="width: 350px;">
11-
<b>{{getReadableDate(record.dateCreated)}}</b> - <i>{{record.dateCreated | date : 'yyyy-M-d H:mm:ss' : 'GMT+8' }}</i>
11+
<b>{{getReadableDate(record.dateCreated)}}</b> - <i>{{record.dateCreated | date : 'yyyy-MM-dd HH:mm:ss' : 'GMT+8' }}</i>
1212
</ion-text>
1313
</ion-label>
1414
</mgl-timeline-entry-header>

src/app/home/components/search.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
fxLayoutGap="10px"
66
fxFlexOffset="10px">
77
<mat-card class="search-result" *ngFor="let book of bookList">
8+
<ion-button color="success" size="small" class="save-cloud-book" (click)="saveCloudBook(book)">
9+
<ion-icon name="magnet-outline"></ion-icon>放到书架
10+
</ion-button>
811
<mat-card-header>
912
<img mat-card-avatar
1013
uiImageLoader
@@ -27,7 +30,7 @@
2730
获星<ion-icon name="star"></ion-icon><i>{{book.stars}}</i>
2831
</ion-label>
2932
<ion-label>
30-
更新时间:<i>{{book.dateUpdated | date : 'yyyy-M-d H:mm:ss' : 'GMT+8' }}</i>
33+
更新时间:<i>{{book.dateUpdated | date : 'yyyy-MM-dd HH:mm:ss' : 'GMT+8' }}</i>
3134
</ion-label>
3235
</mat-card-footer>
3336
</mat-card>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1+
mat-card:hover .save-cloud-book{
2+
display: block;
3+
}
4+
5+
ion-button.save-cloud-book {
6+
position: absolute;
7+
right: 10px;
8+
top: 5px;
9+
display: none;
10+
}
111

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import { Component, OnInit, Input } from '@angular/core';
22

3-
import { ICloudBook } from '../../vendor';
3+
import {
4+
ICloudBook,
5+
IAddBookDialogResData,
6+
} from '../../vendor';
7+
8+
import { NewBookDialog } from './new-book-dialog.component';
9+
import { BookService } from '../services/book.service';
10+
11+
import {
12+
MatDialog,
13+
} from '@angular/material/dialog';
14+
415
@Component({
516
selector: 'app-books-cloud-search',
617
templateUrl: './search.component.html',
@@ -10,7 +21,22 @@ export class SearchComponent implements OnInit {
1021
@Input() bookList: Array<ICloudBook>;
1122
@Input() searching: boolean;
1223

13-
constructor() {}
24+
constructor(
25+
private dialog: MatDialog,
26+
private book: BookService
27+
) {}
1428

1529
ngOnInit() {}
30+
31+
saveCloudBook = (cloudBook: ICloudBook) => {
32+
const dialogRef = this.dialog.open(NewBookDialog, {
33+
width: '480px',
34+
data: cloudBook.url
35+
});
36+
37+
dialogRef.afterClosed().subscribe((res: IAddBookDialogResData) => {
38+
if(res) this.book.save(res);
39+
});
40+
41+
}
1642
}

src/app/home/home.page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@
9292
[(ngModel)]="platformSelected" fxLayoutGap="10px">
9393
<mat-radio-button *ngFor="let platform of platforms" [value]="platform.name">
9494
<mat-chip>
95-
<ion-icon [src]="platform.icon"></ion-icon>{{platform.name}}
95+
<ion-icon [src]="platform.icon"></ion-icon> {{platform.name}}
9696
</mat-chip>
9797
</mat-radio-button>
9898
</mat-radio-group>
9999

100100
<button mat-stroked-button color="primary"
101101
(click)="cloudSearch(1)"
102102
[disabled]="!keywordsFormControl.valid">
103-
<ion-text color="light"><ion-icon name="search-outline"></ion-icon>搜索</ion-text>
103+
<ion-text color="light"><ion-icon name="search-outline"></ion-icon>搜 索</ion-text>
104104
</button>
105105
</div>
106106
</form>

src/app/home/home.page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ export class HomePage implements OnInit, AfterViewInit {
252252
}
253253

254254
cloudSearch = async (page: number) => {
255+
if(page === 1) this.bookListCloud = [].slice();
255256
this.searching = true;
257+
256258
const res = await this.fetchService.searchBooks(this.platformSelected, this.keywords, page) as object[] | object;
257259
this.searching = false;
258260

@@ -263,7 +265,6 @@ export class HomePage implements OnInit, AfterViewInit {
263265
_bookList = (res as object[]).slice();
264266
}
265267

266-
if(page === 1) this.bookListCloud = [].slice();
267268
_bookList.map((bookRaw: object) => {
268269
const book: ICloudBook = {
269270
fullName: '',

0 commit comments

Comments
 (0)