Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
bc4b9436
提交
bc4b9436
authored
4月 09, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
传参加入上一节的内容、并且传参加入上一节的标识
上级
23a38b15
全部展开
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
91 行增加
和
52 行删除
+91
-52
read.css
assets/html/assets/css/read.css
+0
-0
read.html
assets/html/read.html
+26
-16
read_unline.html
assets/html/read_unline.html
+50
-33
controller.dart
lib/pages/read_web/controller.dart
+9
-1
view.dart
lib/pages/read_web/view.dart
+6
-2
没有找到文件。
assets/html/assets/css/read.css
浏览文件 @
bc4b9436
差异被折叠。
点击展开。
assets/html/read.html
浏览文件 @
bc4b9436
...
...
@@ -55,6 +55,15 @@ function countSubstringOccurrences(str, substring) {
</div>
<div
class=
"chapter-content-list"
id=
"chapter-content-list"
>
<div
class=
"show-up"
>
<div
class=
"chapter-item-up"
:class=
"[`chapter-item-up-${prev_chapter.id}`]"
id=
"chapter-item-up"
:data-id=
"prev_chapter.id"
v-html=
"prev_chapter.contents"
></div>
</div>
<div
class=
"show"
>
<div
class=
"chapter-item"
...
...
@@ -219,6 +228,7 @@ function countSubstringOccurrences(str, substring) {
docmHeight
:
document
.
documentElement
.
clientHeight
||
document
.
body
.
clientHeight
,
clientWidth
:
document
.
documentElement
.
clientWidth
||
document
.
body
.
clientWidth
,
windowHeight
:
0
,
// 视口的高度
upContentsHeight
:
0
,
colorList
:
[
"feff00"
,
"00ff00"
,
...
...
@@ -355,14 +365,21 @@ function countSubstringOccurrences(str, substring) {
this
.
clearRangeContent
();
this
.
callHandlerNoticeFlutterSubmit
(
"dismissLoadingCallback"
);
document
.
querySelectorAll
(
'pre code'
).
forEach
((
el
)
=>
{
hljs
.
highlightElement
(
el
);
});
// 带内容加载完成
await
this
.
waitForContentLoad
();
if
(
scroll
)
{
$
(
".chapter-content-list .show"
).
css
({
transform
:
`translateY(-
${
this
.
upContentsHeight
-
this
.
windowHeight
}
px)`
,
WebkitTranform
:
`translateY(-
${
this
.
upContentsHeight
-
this
.
windowHeight
}
px)`
,
})
}
this
.
searchTextInSide
();
document
.
querySelectorAll
(
'pre code'
).
forEach
((
el
)
=>
{
hljs
.
highlightElement
(
el
);
});
// 计算设置上一节的高度
this
.
upContentsHeight
=
$
(
".chapter-item-up"
).
innerHeight
();
// 进度设置
await
this
.
uploadRead
();
await
this
.
line_listFilterShow
();
...
...
@@ -536,9 +553,7 @@ function countSubstringOccurrences(str, substring) {
loadedCount
++
;
// 如果所有图片都加载完成,执行其他操作
if
(
loadedCount
===
images
.
length
)
{
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
observer
.
disconnect
();
resolve
();
}
...
...
@@ -548,18 +563,14 @@ function countSubstringOccurrences(str, substring) {
loadedCount
++
;
// 处理加载失败的情况
if
(
loadedCount
===
images
.
length
)
{
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
observer
.
disconnect
();
resolve
();
}
});
});
}
else
{
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
observer
.
disconnect
();
resolve
();
}
...
...
@@ -1047,12 +1058,11 @@ function countSubstringOccurrences(str, substring) {
if
(
Object
.
entries
(
_that
.
prev_chapter
).
length
>
0
)
{
$
(
".prev-chapter"
).
css
({
opacity
:
0
});
_that
.
chapter_id
=
_that
.
prev_chapter
.
id
;
console
.
log
(
_that
.
prev_chapter
.
name
);
_that
.
callHandlerNoticeFlutterSubmit
(
"loadChapterCallBack"
,
[
_that
.
chapter_id
,
_that
.
prev_chapter
.
name
]
);
await
_that
.
getBookChapterData
();
await
_that
.
getBookChapterData
(
null
,
true
);
}
else
{
$
(
".prev-chapter"
).
css
({
opacity
:
0
});
$
(
"#chapter-content-list .show"
).
css
({
...
...
@@ -2210,7 +2220,7 @@ function countSubstringOccurrences(str, substring) {
const
refreshTokenSuccess
=
(
arguments
)
=>
{
return
app
.
refreshTokenSuccess
(
arguments
);
};
// callbackInFlutterComponent(',3
68,2901,bc398dd1d424aea905b05fc7de6af8f5b
');
// callbackInFlutterComponent(',3
58,2821,d4c36b804c0418b134c2eef6d1689943
');
</script>
</body>
</html>
assets/html/read_unline.html
浏览文件 @
bc4b9436
...
...
@@ -55,6 +55,15 @@ function countSubstringOccurrences(str, substring) {
</div>
<div
class=
"chapter-content-list"
id=
"chapter-content-list"
>
<div
class=
"show-up"
>
<div
class=
"chapter-item-up"
:class=
"[`chapter-item-up-${prev_chapter.id}`]"
id=
"chapter-item-up"
:data-id=
"prev_chapter.id"
v-html=
"prev_chapter.contents"
></div>
</div>
<div
class=
"show"
>
<div
class=
"chapter-item"
...
...
@@ -201,6 +210,7 @@ function countSubstringOccurrences(str, substring) {
docmHeight
:
document
.
documentElement
.
clientHeight
||
document
.
body
.
clientHeight
,
clientWidth
:
document
.
documentElement
.
clientWidth
||
document
.
body
.
clientWidth
,
windowHeight
:
0
,
// 视口的高度
upContentsHeight
:
0
,
colorList
:
[
"feff00"
,
"00ff00"
,
...
...
@@ -303,55 +313,62 @@ function countSubstringOccurrences(str, substring) {
methods
:
{
async
getBookChapterData
(
args
,
scroll
)
{
if
(
this
.
nextChapterLoading
)
return
;
// loading
this
.
callHandlerNoticeFlutterSubmit
(
"showLoadingCallback"
);
this
.
book_id
=
args
.
book_id
;
this
.
c
hapter_id
=
args
.
chapter_id
;
this
.
initArags
()
;
this
.
c
learRangeContent
()
;
this
.
chapterContent
=
""
;
if
(
Object
.
entries
(
args
).
length
>
0
)
{
if
(
args
&&
args
.
direction
===
'scrollUp'
)
{
$
(
".chapter-content-list .show"
).
css
({
transform
:
`translateY(-
${
this
.
upContentsHeight
-
this
.
windowHeight
}
px)`
,
WebkitTranform
:
`translateY(-
${
this
.
upContentsHeight
-
this
.
windowHeight
}
px)`
,
})
}
else
{
this
.
nextChapterLoading
=
true
;
$
(
"#chapter-content-list .show"
).
css
({
transform
:
`translateY(0px)`
,
WebkitTranform
:
`translateY(0px)`
,
});
this
.
nextChapterLoading
=
true
;
this
.
initArags
();
this
.
clearRangeContent
();
// loading
this
.
callHandlerNoticeFlutterSubmit
(
"showLoadingCallback"
);
}
this
.
book_id
=
args
.
book_id
;
this
.
chapter_id
=
args
.
chapter_id
;
this
.
next_chapter
=
args
.
next_chapter
;
// 下一节的内容
this
.
prev_chapter
=
args
.
up_chapter
;
// 上一节的内容
this
.
color_line
=
args
.
color_line
;
// 高亮
this
.
line_list
=
args
.
line_list
;
// 划线
this
.
chapterContent
=
args
.
content
;
this
.
color_line
.
forEach
((
item
)
=>
{
item
.
color_id
=
item
.
id
;
})
this
.
line_list
.
forEach
((
item
)
=>
{
item
.
line_id
=
item
.
id
;
})
if
(
args
.
content
)
{
this
.
chapterContent
=
args
.
content
;
this
.
initArags
();
this
.
clearRangeContent
();
this
.
callHandlerNoticeFlutterSubmit
(
"dismissLoadingCallback"
);
// 带内容加载完成
await
this
.
waitForContentLoad
();
document
.
querySelectorAll
(
'pre code'
).
forEach
((
el
)
=>
{
hljs
.
highlightElement
(
el
);
});
// 进度设置
// 带内容加载完成
await
this
.
waitForContentLoad
();
setTimeout
(()
=>
{
// 计算设置上一节的高度
this
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
this
.
upContentsHeight
=
$
(
".chapter-item-up"
).
innerHeight
();
},
1000
)
await
this
.
line_listFilterShow
();
this
.
nextChapterLoading
=
false
;
await
this
.
toNoteIdSide
();
// 各类事件
this
.
listenHandlerEvents
();
}
else
{
this
.
nextChapterLoading
=
false
;
$
(
"#chapter-content-list .show"
).
css
({
transform
:
`translateY(0px)`
,
WebkitTranform
:
`translateY(0px)`
,
});
}
this
.
nextChapterLoading
=
false
;
this
.
callHandlerNoticeFlutterSubmit
(
"dismissLoadingCallback"
);
},
...
...
@@ -413,9 +430,7 @@ function countSubstringOccurrences(str, substring) {
loadedCount
++
;
// 如果所有图片都加载完成,执行其他操作
if
(
loadedCount
===
images
.
length
)
{
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
observer
.
disconnect
();
resolve
();
}
...
...
@@ -425,18 +440,14 @@ function countSubstringOccurrences(str, substring) {
loadedCount
++
;
// 处理加载失败的情况
if
(
loadedCount
===
images
.
length
)
{
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
observer
.
disconnect
();
resolve
();
}
});
});
}
else
{
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
_that
.
chapterContentHeight
=
$
(
"#chapter-content-list .show"
).
innerHeight
();
observer
.
disconnect
();
resolve
();
}
...
...
@@ -448,7 +459,6 @@ function countSubstringOccurrences(str, substring) {
// 监听touch事件
async
listenHandlerEvents
()
{
const
eleContent
=
document
.
querySelector
(
"#chapter-content-list"
);
const
chapterContent
=
document
.
querySelector
(
"#chapter-content-list"
);
document
.
addEventListener
(
"touchstart"
,
this
.
touchStartEvent
);
document
.
addEventListener
(
"touchmove"
,
this
.
touchMoveEvent
);
...
...
@@ -575,6 +585,12 @@ function countSubstringOccurrences(str, substring) {
_that
.
touchIn
=
false
;
if
(
$
(
target
).
closest
(
".tange-tooptip"
).
length
>
0
)
{
const
href
=
$
(
target
).
closest
(
".c-link"
).
attr
(
"href"
);
_that
.
callHandlerNoticeFlutterSubmit
(
"openLinkCallback"
,
href
);
_that
.
tooltipId
=
null
;
event
.
preventDefault
();
return
false
;
}
...
...
@@ -910,9 +926,10 @@ function countSubstringOccurrences(str, substring) {
if
(
Object
.
entries
(
_that
.
prev_chapter
).
length
>
0
)
{
$
(
".prev-chapter"
).
css
({
opacity
:
0
});
_that
.
chapter_id
=
_that
.
prev_chapter
.
id
;
_that
.
chapterContent
=
_that
.
prev_chapter
.
contents
;
_that
.
callHandlerNoticeFlutterSubmit
(
"loadChapterCallBack"
,
[
_that
.
chapter_id
,
_that
.
prev_chapter
.
name
]
[
_that
.
chapter_id
,
_that
.
prev_chapter
.
name
,
'scrollUp'
]
);
}
else
{
$
(
".prev-chapter"
).
css
({
opacity
:
0
});
...
...
lib/pages/read_web/controller.dart
浏览文件 @
bc4b9436
...
...
@@ -648,7 +648,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
// 获取离线数据
void
getOffLineInfo
()
async
{
void
getOffLineInfo
(
{
String
direction
=
''
}
)
async
{
Console
.
log
(
'-chapterId----------------------
$chapterId
-----------------------------------------'
);
Map
<
String
,
dynamic
>
data
=
{};
data
[
'chapter_name'
]
=
chapterName
;
...
...
@@ -670,7 +670,12 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
String
upName
=
getChapterName
(
upId
);
upChapter
[
'name'
]
=
upName
;
upChapter
[
'id'
]
=
int
.
parse
(
upId
);
String
htmlPath
=
await
getLocalReadHtml
(
upId
);
final
enCodeContent
=
await
readHtmlFileContent
(
htmlPath
);
String
deCodeContent
=
EncryptUtil
.
aesDecrypt
(
enCodeContent
!);
upChapter
[
'contents'
]
=
deCodeContent
;
data
[
'up_chapter'
]
=
upChapter
;
}
// 5、获取下一章节信息
Map
<
String
,
dynamic
>
nextChapter
=
{};
...
...
@@ -690,6 +695,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
data
[
'line_list'
]
=
temp
[
'line_list'
];
data
[
'color_line'
]
=
temp
[
'color_line'
];
//
data
[
'direction'
]
=
direction
;
// 7、 给前端参数
String
jsonStr
=
jsonEncode
(
data
);
Console
.
log
(
'callbackInFlutterComponent--------------------------------
$jsonStr
'
);
...
...
lib/pages/read_web/view.dart
浏览文件 @
bc4b9436
...
...
@@ -186,15 +186,19 @@ class _ReadPageState extends State<ReadPage> {
// 监听 上一节 下一节
controller
.
addJavaScriptHandler
(
handlerName:
'loadChapterCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听 上一节 下一节------------------------------------------------
$args
'
);
String
chapterId
=
args
.
first
[
0
].
toString
();
String
chapterName
=
args
.
first
[
1
].
toString
();
ChapterModel
chapterModel
=
ChapterModel
(
id:
int
.
parse
(
chapterId
),
name:
chapterName
);
// readController.setChapterInfo(id: chapterId, name: chapterName ?? '');
readController
.
selectChapter
(
chapterModel
);
if
(
readController
.
existDownFile
&&
!
readController
.
netStatus
){
readController
.
getOffLineInfo
();
String
direction
=
''
;
if
(
args
.
first
.
length
==
3
){
direction
=
args
.
first
[
2
].
toString
();
}
readController
.
getOffLineInfo
(
direction:
direction
);
}
Console
.
log
(
'监听 上一节 下一节------------------------------------------------
$args
'
);
});
// // 监听 双击回调
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论