Работа над BookInfoDialog

This commit is contained in:
Book Pauk
2022-11-10 00:59:47 +07:00
parent 1d99472ca1
commit 79e6ca2d27
3 changed files with 33 additions and 16 deletions

View File

@@ -8,8 +8,15 @@
</div>
</template>
<div ref="box" class="column q-mt-xs overflow-auto no-wrap" style="padding: 0px 10px 10px 10px;">
<div v-html="annotation" />
<div ref="box" class="fit column q-mt-xs overflow-auto no-wrap" style="padding: 0px 10px 10px 10px;">
<div class="row" style="height: 300px">
<div style="height: 300px">
<img v-if="coverSrc" :src="coverSrc" style="height: 100%;" />
</div>
</div>
<div class="q-mt-md" v-html="annotation" />
<pre>{{ annotation }}</pre>
</div>
<template #footer>
@@ -25,7 +32,7 @@
import vueComponent from '../../vueComponent.js';
import Dialog from '../../share/Dialog.vue';
import XmlParser from '../../../../server/core/xml/XmlParser';
import Fb2Parser from '../../../../server/core/fb2/Fb2Parser';
const componentOptions = {
components: {
@@ -53,6 +60,7 @@ class BookInfoDialog {
dialogVisible = false;
//info props
coverSrc = '';
annotation = '';
created() {
@@ -65,21 +73,29 @@ class BookInfoDialog {
parseBookInfo() {
const bookInfo = this.bookInfo;
const xml = new XmlParser();
const parser = new Fb2Parser();
//defaults
this.coverSrc = '';
this.annotation = '';
if (bookInfo.fb2) {
const desc = xml.navigator(bookInfo.fb2);
//cover
if (bookInfo.cover)
this.coverSrc = bookInfo.cover;
//fb2
if (bookInfo.fb2 && bookInfo.fb2.fictionbook && bookInfo.fb2.fictionbook.description) {
const desc = parser.inspector(bookInfo.fb2.fictionbook.description);
//annotation
const annObj = desc.v('description/title-info/annotation');
const annObj = desc.v('title-info/annotation');
if (annObj) {
this.annotation = xml.fromObject(annObj).toString({noHeader: true});
this.annotation = parser.fromObject(annObj).toString({noHeader: true, format: true});
this.annotation = parser.toHtml(this.annotation);
this.annotation = this.annotation.replace(/<p>/g, `<p class="p-annotation">`);
}
}
}
okClick() {