From 54a515bec0f9c2155dca9c1cd397831d028dfa9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E4=B8=89=E7=9A=84=E9=9D=93=E4=BB=94?= Date: Tue, 2 Jul 2024 17:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BB=E5=99=A8=E8=BE=B9=E8=B7=9D?= =?UTF-8?q?=E8=B0=83=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reader/DownloadSettingDialog.ets | 0 .../ets/componets/Reader/LayoutMoreDialog.ets | 49 +++++++++++ .../componets/{ => Reader}/MusicPlayer.ets | 0 .../main/ets/pages/view/Reader/ReaderPage.ets | 84 +++++++++++++------ .../base/media/my_center_set_icon_fill.svg | 5 ++ 5 files changed, 114 insertions(+), 24 deletions(-) rename entry/src/main/ets/{pages/view => componets}/Reader/DownloadSettingDialog.ets (100%) create mode 100644 entry/src/main/ets/componets/Reader/LayoutMoreDialog.ets rename entry/src/main/ets/componets/{ => Reader}/MusicPlayer.ets (100%) create mode 100644 entry/src/main/resources/base/media/my_center_set_icon_fill.svg diff --git a/entry/src/main/ets/pages/view/Reader/DownloadSettingDialog.ets b/entry/src/main/ets/componets/Reader/DownloadSettingDialog.ets similarity index 100% rename from entry/src/main/ets/pages/view/Reader/DownloadSettingDialog.ets rename to entry/src/main/ets/componets/Reader/DownloadSettingDialog.ets diff --git a/entry/src/main/ets/componets/Reader/LayoutMoreDialog.ets b/entry/src/main/ets/componets/Reader/LayoutMoreDialog.ets new file mode 100644 index 00000000..340ca679 --- /dev/null +++ b/entry/src/main/ets/componets/Reader/LayoutMoreDialog.ets @@ -0,0 +1,49 @@ +@Component +export default struct LayoutMore { + @Link ReaderPadding: number + + build() { + Column() { + Row() { + Text("边距") + Slider({ + value: this.ReaderPadding, + max: 32, + min: 12, + step: 4, + style: SliderStyle.InSet + }) + .selectedColor('rgba(0, 0, 0, 0.04)') + .blockSize({ width: 30, height: 30 }) + .layoutWeight(1) + .onChange((value) => { + this.ReaderPadding = value + }) + } + .width("100%") + + Row() { + Text("字体") + Button("细") + Button("中") + Button("粗") + + Button("简体") + Button("繁体") + } + .width("100%") + + Row() { + Text("首行缩进") + // Toggle() + } + .width("100%") + } + .height(500) + .padding({ + left: 20, + right: 20 + }) + } +} + diff --git a/entry/src/main/ets/componets/MusicPlayer.ets b/entry/src/main/ets/componets/Reader/MusicPlayer.ets similarity index 100% rename from entry/src/main/ets/componets/MusicPlayer.ets rename to entry/src/main/ets/componets/Reader/MusicPlayer.ets diff --git a/entry/src/main/ets/pages/view/Reader/ReaderPage.ets b/entry/src/main/ets/pages/view/Reader/ReaderPage.ets index 37d5c723..6a5aa0e1 100644 --- a/entry/src/main/ets/pages/view/Reader/ReaderPage.ets +++ b/entry/src/main/ets/pages/view/Reader/ReaderPage.ets @@ -5,8 +5,9 @@ import sourceView from './sourceView'; import { FileHandler } from 'ets/common/utils/FileHandler'; import { NetworkInput } from 'ets/componets/Reader/NetworkInput'; import { LengthMetrics } from '@ohos.arkui.node'; -import DownloadSettingDialog from './DownloadSettingDialog'; -import { MusicPlayer } from 'ets/componets/MusicPlayer'; +import DownloadSettingDialog from '../../../componets/Reader/DownloadSettingDialog'; +import LayoutMoreDialog from '../../../componets/Reader/LayoutMoreDialog'; +import { MusicPlayer } from 'ets/componets/Reader/MusicPlayer'; import purificationView from './purificationView'; import { chaptersItem } from 'ets/componets/dataList/ReaderChaptersItem'; import { BookList } from 'ets/componets/dataList/bookList'; @@ -16,10 +17,12 @@ import { BookList } from 'ets/componets/dataList/bookList'; struct ReaderPage { @StorageLink('bottomRectHeight') bottomRectHeight: number = 0 @StorageLink('topRectHeight') topRectHeight: number = 0 + @State ReaderPadding: number = 24 // 亮度 @State isShowSetting: boolean = true @State isShowDownload: boolean = false @State isShowListen: boolean = false @State isShowContentSetting: boolean = false + @State isShowMoreLayout: boolean = false @State CurrentChapters: number = 0 @State TotalChapters: number = 0 @State CurrentLuminance: number = 0 // 亮度 @@ -29,7 +32,20 @@ struct ReaderPage { @State isShowSource: boolean = false @State isShowPurification: boolean = false @State txtFile: chaptersItem[] = []; - scroller: Scroller = new Scroller() + // 网址导入Dialog + dialogController: CustomDialogController = new CustomDialogController({ + builder: Dialog({ + title: '加入书架', + CancelString: "暂不加入", + ConfirmString: "加入书架", + child: () => { + this.DialogString() + }, + }), + cornerRadius: 16, + gridCount: 4, + offset: { dx: 0, dy: -300 } + }) async onPageShow() { let temp = router.getParams() as BookList @@ -212,6 +228,7 @@ struct ReaderPage { }) .width("100%") } else { + // 下方-设置 Column({ space: 24 }) { Row({ space: 16 }) { Text('亮度') @@ -237,7 +254,7 @@ struct ReaderPage { Text('字号') Slider({ value: this.CurrentFontSize, - max: 30, + max: 48, min: 12, step: 1, style: SliderStyle.InSet @@ -272,8 +289,34 @@ struct ReaderPage { }) Row() { Button('更多') + .bindSheet($$this.isShowMoreLayout, this.LayoutMoreDialog(), { + height: 500, + showClose: false, + dragBar: false, + blurStyle: BlurStyle.COMPONENT_ULTRA_THIN, + onDisappear: () => { + // this.clickBookType = '' + } + }) + .onClick(() => { + this.isShowMoreLayout = true + }) } } + + Row({ space: 16 }) { + Text('背景') + Blank(1) + Row() { + Button('更多') + } + } + + Row({ space: 16 }) { + Button('自动阅读') + Button('仿真翻页') + Button('更多设置') + } } .padding({ left: 20, @@ -312,7 +355,9 @@ struct ReaderPage { GridItem() { Column() { - Image($r("app.media.my_center_set_icon")).width(24) + Image($r(this.isShowContentSetting ? "app.media.my_center_set_icon_fill" : + "app.media.my_center_set_icon")) + .width(24) Text("设置") } .onClick(() => { @@ -344,7 +389,7 @@ struct ReaderPage { .width("100%") .height(40) - Scroll(this.scroller) { + Scroll() { Column() { Row() { Text(this.txtFile[this.CurrentChapters]?.title) @@ -374,13 +419,12 @@ struct ReaderPage { .width("100%") } .padding({ - left: 24, - right: 24 + left: this.ReaderPadding, + right: this.ReaderPadding }) } .layoutWeight(1) - Blank(1) Row({ space: 4 }) { Text("1/14 0.1%") @@ -451,21 +495,6 @@ struct ReaderPage { }) } - // 网址导入Dialog - dialogController: CustomDialogController = new CustomDialogController({ - builder: Dialog({ - title: '加入书架', - CancelString: "暂不加入", - ConfirmString: "加入书架", - child: () => { - this.DialogString() - }, - }), - cornerRadius: 16, - gridCount: 4, - offset: { dx: 0, dy: -300 } - }) - onBackPress() { this.dialogController.open(); return true @@ -487,4 +516,11 @@ struct ReaderPage { }) } } + + @Builder + LayoutMoreDialog() { + LayoutMoreDialog({ ReaderPadding: this.ReaderPadding }) + .height(500) + .width("100%") + } } diff --git a/entry/src/main/resources/base/media/my_center_set_icon_fill.svg b/entry/src/main/resources/base/media/my_center_set_icon_fill.svg new file mode 100644 index 00000000..53967a5c --- /dev/null +++ b/entry/src/main/resources/base/media/my_center_set_icon_fill.svg @@ -0,0 +1,5 @@ + + + + +