Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
4edddaf3
提交
4edddaf3
authored
4月 01, 2024
作者:
岳维路
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'test' 到 'sim'
Test 查看合并请求 kiwitap/zijing-app!26
上级
a554a933
9100bb68
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
134 行增加
和
17 行删除
+134
-17
controller.dart
lib/pages/book_detail/controller.dart
+6
-2
view.dart
lib/pages/book_detail/view.dart
+6
-2
controller.dart
lib/pages/library/controller.dart
+4
-1
content.dart
lib/pages/library/widgets/content.dart
+7
-2
controller.dart
lib/pages/read_web/controller.dart
+88
-0
discuss_controller.dart
lib/pages/read_web/discuss_controller.dart
+3
-0
controller.dart
lib/pages/user_discuss_des/controller.dart
+1
-0
view.dart
lib/pages/user_discuss_des/view.dart
+1
-1
discuss.dart
lib/pages/user_discuss_des/widgets/discuss.dart
+11
-3
assets_picker.dart
lib/utils/assets_picker.dart
+7
-6
没有找到文件。
lib/pages/book_detail/controller.dart
浏览文件 @
4edddaf3
...
...
@@ -22,6 +22,9 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
// 图书
BookDetailModel
bookDetails
=
BookDetailModel
();
// 是否能点击
bool
canTap
=
true
;
@override
void
onInit
()
{
...
...
@@ -147,7 +150,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
update
();
}
/// 收藏 与 取消收藏
void
love
({
Future
<
void
>
love
({
required
String
bookId
,
required
num
isCollection
})
async
{
...
...
@@ -160,8 +163,9 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
if
(
result
)
{
getBookDetails
()
;
bookDetails
.
isCollection
=
isCollection
;
}
update
();
}
// 获取当前的章节id
...
...
lib/pages/book_detail/view.dart
浏览文件 @
4edddaf3
...
...
@@ -37,8 +37,12 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
icon:
Image
.
asset
(
controller
.
bookDetails
.
isCollection
==
0
?
'assets/images/unlove.png'
:
'assets/images/love.png'
,
),
onPressed:
()
{
controller
.
love
(
bookId:
controller
.
bookDetails
.
bookId
.
toString
(),
isCollection:
controller
.
bookDetails
.
isCollection
!);
onPressed:
()
async
{
if
(
controller
.
canTap
==
true
)
{
controller
.
canTap
=
false
;
await
controller
.
love
(
bookId:
controller
.
bookDetails
.
bookId
.
toString
(),
isCollection:
controller
.
bookDetails
.
isCollection
!);
controller
.
canTap
=
true
;
}
},
),
],
...
...
lib/pages/library/controller.dart
浏览文件 @
4edddaf3
...
...
@@ -52,6 +52,9 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
bool
_show
=
false
;
late
UModel
_getModel
;
// 是否可点击收藏
bool
canTap
=
true
;
bool
get
show
=>
_show
;
void
setShow
(
bool
value
)
{
...
...
@@ -233,7 +236,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
}
/// 收藏 与 取消收藏
void
love
({
Future
<
void
>
love
({
required
CourseModel
model
})
async
{
...
...
lib/pages/library/widgets/content.dart
浏览文件 @
4edddaf3
...
...
@@ -37,9 +37,14 @@ class _LibraryContentPageState extends State<LibraryContentPage> with AutomaticK
onTap:
(){
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
bookId
.
toString
()});
},
child:
LibraryCell
(
model:
model
,
onTap:
(){
child:
LibraryCell
(
model:
model
,
onTap:
()
async
{
if
(
UserStore
.
to
.
isLogin
){
widget
.
controller
.
love
(
model:
model
);
if
(
widget
.
controller
.
canTap
==
true
){
widget
.
controller
.
canTap
=
false
;
await
widget
.
controller
.
love
(
model:
model
);
widget
.
controller
.
canTap
=
true
;
}
}
else
{
context
.
pushNamed
(
Routes
.
login
);
...
...
lib/pages/read_web/controller.dart
浏览文件 @
4edddaf3
...
...
@@ -743,6 +743,89 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
queryLocalNote
();
}
// 获取离线数据
void
getOffLineInfo
()
async
{
Map
<
String
,
dynamic
>
data
=
{};
data
[
'chapter_name'
]
=
chapterName
;
// 1、根据当前章节id名称 获取内容
String
toReadHtmlPath
=
await
getLocalReadHtml
(
chapterId
);
// 2、获取 离线文件的内容
final
enCodeContent
=
await
readHtmlFileContent
(
toReadHtmlPath
);
// 3、解密离线的内容
String
deCodeContent
=
EncryptUtil
.
aesDecrypt
(
enCodeContent
!);
data
[
'content'
]
=
deCodeContent
;
// 4、获取上一章节信息
Map
<
String
,
dynamic
>
upChapter
=
{};
final
upId
=
await
getChapterId
(
type:
0
);
if
(
upId
.
isEmpty
)
{
data
[
'up_chapter'
]
=
''
;
}
else
{
String
upName
=
getChapterName
(
upId
);
upChapter
[
'name'
]
=
upName
;
upChapter
[
'id'
]
=
int
.
parse
(
upId
);
}
// 5、获取下一章节信息
Map
<
String
,
dynamic
>
nextChapter
=
{};
final
nextId
=
await
getChapterId
(
type:
1
);
if
(
nextId
.
isEmpty
)
{
data
[
'next_chapter'
]
=
''
;
}
else
{
String
nextName
=
getChapterName
(
upId
);
nextChapter
[
'name'
]
=
nextName
;
nextChapter
[
'id'
]
=
int
.
parse
(
nextId
);
}
// 6、获取离线高亮和划线
final
Map
<
String
,
dynamic
>
temp
=
await
queryNewLocalNote
();
data
.
addAll
(
temp
);
// 7、 给前端参数
String
jsonStr
=
jsonEncode
(
data
);
webViewController
.
evaluateJavascript
(
source
:
'offlineCallbackInFlutterComponent(
$jsonStr
)'
);
}
// 获取上一章节或下一章节 id
Future
<
String
>
getChapterId
({
required
int
type
})
async
{
String
docPath
=
await
_getDirectory
();
String
filePath
=
'
$docPath
/
$bookId
'
;
Directory
directory
=
Directory
(
filePath
);
// 获取目录下的所有文件
List
<
FileSystemEntity
>
files
=
directory
.
listSync
(
recursive:
true
);
int
findIndex
=
int
.
parse
(
currentHtmlName
.
split
(
'-'
).
first
);
if
(
type
==
0
){
findIndex
--;
if
(
findIndex
<
0
){
Toast
.
show
(
'前面已没有章节'
);
// 已到最前
return
''
;
}
}
else
{
findIndex
++;
if
(
findIndex
>
files
.
length
-
1
){
// 已到最后
return
''
;
}
}
for
(
var
file
in
files
)
{
if
(
file
is
File
&&
file
.
path
.
toLowerCase
().
endsWith
(
'.html'
))
{
String
fileName
=
path
.
basenameWithoutExtension
(
file
.
path
);
if
(
int
.
parse
(
fileName
.
split
(
'-'
).
first
)
==
findIndex
){
Console
.
log
(
'HTML File--------------------------------
${file.path}
'
);
String
chapterId
=
fileName
.
split
(
'-'
).
last
;
return
chapterId
;
}
}
}
return
''
;
}
// 本地阅读 读取上一章节 或 下一章节
// 0 上一章节
// 1 下一章节
...
...
@@ -828,6 +911,11 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
return
''
;
}
Future
<
Map
<
String
,
dynamic
>>
queryNewLocalNote
()
async
{
final
result
=
await
SqlManager
.
queryLocalNote
(
bookId:
int
.
parse
(
bookId
),
chapterId:
int
.
parse
(
chapterId
));
return
result
;
}
// 查询本地划线高亮笔记
void
queryLocalNote
()
async
{
final
result
=
await
SqlManager
.
queryLocalNote
(
bookId:
int
.
parse
(
bookId
),
chapterId:
int
.
parse
(
chapterId
));
...
...
lib/pages/read_web/discuss_controller.dart
浏览文件 @
4edddaf3
...
...
@@ -35,6 +35,9 @@ class DiscussController extends GetxController {
// 搜全文
List
<
SearchAllModel
>
searchALlResults
=
[];
// 是否能点击
bool
canTap
=
true
;
@override
void
onReady
()
{
...
...
lib/pages/user_discuss_des/controller.dart
浏览文件 @
4edddaf3
...
...
@@ -23,6 +23,7 @@ class UserDiscussDesController extends GetxController {
// 当前要回复父级的模型
late
DiscussModel
fatherDiscussModel
;
bool
canTap
=
true
;
@override
void
onReady
()
{
...
...
lib/pages/user_discuss_des/view.dart
浏览文件 @
4edddaf3
...
...
@@ -73,7 +73,7 @@ class _UserDiscussDesPageState extends State<UserDiscussDesPage> {
height:
0.5
.
w
,
color:
Colours
.
cF2
,
),
SizedBox
(
height:
10
.
w
),
//
SizedBox(height:10.w),
Expanded
(
child:
TabBarView
(
children:
List
.
generate
(
tabs
.
length
,
(
index
){
...
...
lib/pages/user_discuss_des/widgets/discuss.dart
浏览文件 @
4edddaf3
...
...
@@ -25,7 +25,7 @@ class _BuildDiscussState extends State<BuildDiscuss> {
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
left:
10
.
w
,
right:
10
.
w
),
margin:
EdgeInsets
.
only
(
left:
10
.
w
,
right:
10
.
w
,
top:
10
.
w
),
padding:
EdgeInsets
.
all
(
10
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
.
w
),
...
...
@@ -188,8 +188,16 @@ class _BuildDiscussState extends State<BuildDiscuss> {
children:
[
GestureDetector
(
onTap:
()
async
{
widget
.
controller
?.
commentLove
(
discussModel:
model
);
widget
.
userDiscussDesController
?.
commentLove
(
discussModel:
model
);
if
(
widget
.
controller
?.
canTap
==
true
)
{
widget
.
controller
?.
canTap
=
false
;
await
widget
.
controller
?.
commentLove
(
discussModel:
model
);
widget
.
controller
?.
canTap
=
true
;
}
if
(
widget
.
userDiscussDesController
?.
canTap
==
true
)
{
widget
.
userDiscussDesController
?.
canTap
=
false
;
await
widget
.
userDiscussDesController
?.
commentLove
(
discussModel:
model
);
widget
.
userDiscussDesController
?.
canTap
=
true
;
}
},
child:
SizedBox
(
height:
20
.
w
,
...
...
lib/utils/assets_picker.dart
浏览文件 @
4edddaf3
...
...
@@ -7,8 +7,8 @@ abstract class AssetsPicker {
static
Future
<
XFile
?>
image
({
required
BuildContext
context
,
ImageSource
source
=
ImageSource
.
gallery
,
double
maxWidth
=
512
,
double
maxHeight
=
512
,
double
maxWidth
=
1024
,
double
maxHeight
=
1024
,
})
async
{
if
(!(
await
Access
.
photos
()))
{
if
(
context
.
mounted
)
{
...
...
@@ -22,8 +22,9 @@ abstract class AssetsPicker {
}
return
_imagePicker
.
pickImage
(
source
:
source
,
maxWidth:
maxWidth
,
maxHeight:
maxHeight
,
// maxWidth: maxWidth,
// maxHeight: maxHeight,
// imageQuality: 100
);
}
/// 拍照
...
...
@@ -45,8 +46,8 @@ abstract class AssetsPicker {
}
return
_imagePicker
.
pickImage
(
source
:
source
,
maxWidth:
maxWidth
,
maxHeight:
maxHeight
,
//
maxWidth: maxWidth,
//
maxHeight: maxHeight,
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论