Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
cc22c4e3
提交
cc22c4e3
authored
3月 07, 2024
作者:
岳维路
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'test' 到 'sim'
Test 查看合并请求 kiwitap/zijing-app!4
上级
2017cc6f
860362ca
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
36 个修改的文件
包含
881 行增加
和
268 行删除
+881
-268
library.dart
lib/apis/library.dart
+38
-0
library.dart
lib/models/library.dart
+6
-0
mine.dart
lib/models/mine.dart
+24
-1
item.dart
lib/pages/book_category/widgets/item.dart
+1
-1
controller.dart
lib/pages/book_detail/controller.dart
+9
-1
view.dart
lib/pages/book_detail/view.dart
+9
-7
view.dart
lib/pages/help_center/view.dart
+1
-1
item.dart
lib/pages/help_center/widgets/item.dart
+1
-1
controller.dart
lib/pages/library/controller.dart
+9
-9
content.dart
lib/pages/library/widgets/content.dart
+1
-1
controller.dart
lib/pages/read_web/controller.dart
+47
-11
discuss_controller.dart
lib/pages/read_web/discuss_controller.dart
+60
-3
index.dart
lib/pages/read_web/index.dart
+1
-0
view.dart
lib/pages/read_web/view.dart
+83
-15
category.dart
lib/pages/read_web/widgets/category.dart
+3
-3
discuss.dart
lib/pages/read_web/widgets/discuss.dart
+12
-5
input_discuss.dart
lib/pages/read_web/widgets/input_discuss.dart
+28
-22
item.dart
lib/pages/read_web/widgets/item.dart
+145
-56
note.dart
lib/pages/read_web/widgets/note.dart
+3
-3
search_all.dart
lib/pages/read_web/widgets/search_all.dart
+3
-3
view.dart
lib/pages/user_about/view.dart
+1
-1
controller.dart
lib/pages/user_discuss_des/controller.dart
+100
-1
index.dart
lib/pages/user_discuss_des/index.dart
+3
-0
discuss.dart
lib/pages/user_discuss_des/widgets/discuss.dart
+0
-0
list.dart
lib/pages/user_discuss_des/widgets/list.dart
+89
-7
controller.dart
lib/pages/user_msg/controller.dart
+7
-2
view.dart
lib/pages/user_msg/view.dart
+12
-12
view.dart
lib/pages/user_notes/view.dart
+5
-2
controller.dart
lib/pages/user_notes_des/controller.dart
+4
-3
view.dart
lib/pages/user_notes_des/view.dart
+49
-43
list.dart
lib/pages/user_notes_des/widgets/list.dart
+3
-3
note.dart
lib/pages/user_notes_des/widgets/note.dart
+7
-25
awaiting.dart
lib/pages/user_order/widgets/awaiting.dart
+1
-1
constants.dart
lib/utils/constants.dart
+1
-0
sql.dart
lib/utils/sql.dart
+114
-24
tools.dart
lib/utils/tools.dart
+1
-1
没有找到文件。
lib/apis/library.dart
浏览文件 @
cc22c4e3
...
@@ -342,5 +342,42 @@ abstract class LibraryAPI {
...
@@ -342,5 +342,42 @@ abstract class LibraryAPI {
});
});
}
}
/// 17、评论 点赞 取消
static
Future
<
bool
>
commentLove
({
required
num
bookId
,
required
num
type
,
required
num
commentId
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/book/Information/clickPraise'
,
params:
{
'book_id'
:
bookId
,
'type'
:
type
,
'comment_id'
:
commentId
},
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
}
return
false
;
}
/// 18、删除讨论回复
static
Future
<
bool
>
delComment
({
required
num
bookId
,
required
num
commentId
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/book/Information/delComment'
,
params:
{
'book_id'
:
bookId
,
'comment_id'
:
commentId
},
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
}
return
false
;
}
}
}
\ No newline at end of file
lib/models/library.dart
浏览文件 @
cc22c4e3
...
@@ -222,6 +222,7 @@ class BookDetailModel {
...
@@ -222,6 +222,7 @@ class BookDetailModel {
this
.
chapterId
,
this
.
chapterId
,
this
.
chapterName
,
this
.
chapterName
,
this
.
readChapterId
,
this
.
readChapterId
,
this
.
introduction
,
});
});
BookDetailModel
.
fromJson
(
dynamic
json
)
{
BookDetailModel
.
fromJson
(
dynamic
json
)
{
...
@@ -249,6 +250,7 @@ class BookDetailModel {
...
@@ -249,6 +250,7 @@ class BookDetailModel {
chapterId
=
json
[
'chapter_id'
];
chapterId
=
json
[
'chapter_id'
];
chapterName
=
json
[
'chapter_name'
];
chapterName
=
json
[
'chapter_name'
];
readChapterId
=
json
[
'read_chapter_id'
];
readChapterId
=
json
[
'read_chapter_id'
];
introduction
=
json
[
'introduction'
];
}
}
num
?
bookId
;
num
?
bookId
;
String
?
bookName
;
String
?
bookName
;
...
@@ -274,6 +276,7 @@ class BookDetailModel {
...
@@ -274,6 +276,7 @@ class BookDetailModel {
num
?
chapterId
;
num
?
chapterId
;
String
?
chapterName
;
String
?
chapterName
;
num
?
readChapterId
;
num
?
readChapterId
;
String
?
introduction
;
BookDetailModel
copyWith
({
num
?
bookId
,
BookDetailModel
copyWith
({
num
?
bookId
,
String
?
bookName
,
String
?
bookName
,
String
?
img
,
String
?
img
,
...
@@ -298,6 +301,7 @@ class BookDetailModel {
...
@@ -298,6 +301,7 @@ class BookDetailModel {
num
?
chapterId
,
num
?
chapterId
,
String
?
chapterName
,
String
?
chapterName
,
num
?
readChapterId
,
num
?
readChapterId
,
String
?
introduction
,
})
=>
BookDetailModel
(
bookId:
bookId
??
this
.
bookId
,
})
=>
BookDetailModel
(
bookId:
bookId
??
this
.
bookId
,
bookName:
bookName
??
this
.
bookName
,
bookName:
bookName
??
this
.
bookName
,
img:
img
??
this
.
img
,
img:
img
??
this
.
img
,
...
@@ -322,6 +326,7 @@ class BookDetailModel {
...
@@ -322,6 +326,7 @@ class BookDetailModel {
chapterId:
chapterId
??
this
.
chapterId
,
chapterId:
chapterId
??
this
.
chapterId
,
chapterName:
chapterName
??
this
.
chapterName
,
chapterName:
chapterName
??
this
.
chapterName
,
readChapterId:
readChapterId
??
this
.
readChapterId
,
readChapterId:
readChapterId
??
this
.
readChapterId
,
introduction:
introduction
??
this
.
introduction
);
);
Map
<
String
,
dynamic
>
toJson
()
{
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
final
map
=
<
String
,
dynamic
>{};
...
@@ -349,6 +354,7 @@ class BookDetailModel {
...
@@ -349,6 +354,7 @@ class BookDetailModel {
map
[
'chapter_id'
]
=
chapterId
;
map
[
'chapter_id'
]
=
chapterId
;
map
[
'chapter_name'
]
=
chapterName
;
map
[
'chapter_name'
]
=
chapterName
;
map
[
'read_chapter_id'
]
=
readChapterId
;
map
[
'read_chapter_id'
]
=
readChapterId
;
map
[
'introduction'
]
=
introduction
;
return
map
;
return
map
;
}
}
...
...
lib/models/mine.dart
浏览文件 @
cc22c4e3
...
@@ -539,6 +539,9 @@ class DiscussModel {
...
@@ -539,6 +539,9 @@ class DiscussModel {
this
.
commentAll
,
this
.
commentAll
,
this
.
personPic
,
this
.
personPic
,
this
.
isMy
,
this
.
isMy
,
this
.
commentsCheck
,
this
.
status
,
this
.
isPraise
,
});
});
DiscussModel
.
fromJson
(
dynamic
json
)
{
DiscussModel
.
fromJson
(
dynamic
json
)
{
...
@@ -560,6 +563,9 @@ class DiscussModel {
...
@@ -560,6 +563,9 @@ class DiscussModel {
personName
=
json
[
'person_name'
];
personName
=
json
[
'person_name'
];
personPic
=
json
[
'person_pic'
];
personPic
=
json
[
'person_pic'
];
isMy
=
json
[
'is_my'
];
isMy
=
json
[
'is_my'
];
isPraise
=
json
[
'is_praise'
];
commentsCheck
=
json
[
'comments_check'
];
status
=
json
[
'status'
];
if
(
json
[
'comment_all'
]
!=
null
)
{
if
(
json
[
'comment_all'
]
!=
null
)
{
commentAll
=
[];
commentAll
=
[];
...
@@ -581,6 +587,9 @@ class DiscussModel {
...
@@ -581,6 +587,9 @@ class DiscussModel {
num
?
goodNum
;
num
?
goodNum
;
num
?
replyNum
;
num
?
replyNum
;
num
?
isMy
;
num
?
isMy
;
num
?
isPraise
;
num
?
commentsCheck
;
num
?
status
;
String
?
createTime
;
String
?
createTime
;
String
?
replacePersonName
;
String
?
replacePersonName
;
String
?
replacePersonPic
;
String
?
replacePersonPic
;
...
@@ -601,6 +610,9 @@ class DiscussModel {
...
@@ -601,6 +610,9 @@ class DiscussModel {
num
?
goodNum
,
num
?
goodNum
,
num
?
replyNum
,
num
?
replyNum
,
num
?
isMy
,
num
?
isMy
,
num
?
isPraise
,
num
?
commentsCheck
,
num
?
status
,
String
?
createTime
,
String
?
createTime
,
String
?
replacePersonName
,
String
?
replacePersonName
,
String
?
replacePersonPic
,
String
?
replacePersonPic
,
...
@@ -621,6 +633,9 @@ class DiscussModel {
...
@@ -621,6 +633,9 @@ class DiscussModel {
goodNum:
goodNum
??
this
.
goodNum
,
goodNum:
goodNum
??
this
.
goodNum
,
replyNum:
replyNum
??
this
.
replyNum
,
replyNum:
replyNum
??
this
.
replyNum
,
isMy:
isMy
??
this
.
isMy
,
isMy:
isMy
??
this
.
isMy
,
isPraise:
isPraise
??
this
.
isPraise
,
status:
status
??
this
.
status
,
commentsCheck:
commentsCheck
??
this
.
commentsCheck
,
createTime:
createTime
??
this
.
createTime
,
createTime:
createTime
??
this
.
createTime
,
replacePersonName:
replacePersonName
??
this
.
replacePersonName
,
replacePersonName:
replacePersonName
??
this
.
replacePersonName
,
replacePersonPic:
replacePersonPic
??
this
.
replacePersonPic
,
replacePersonPic:
replacePersonPic
??
this
.
replacePersonPic
,
...
@@ -646,6 +661,9 @@ class DiscussModel {
...
@@ -646,6 +661,9 @@ class DiscussModel {
map
[
'good_num'
]
=
goodNum
;
map
[
'good_num'
]
=
goodNum
;
map
[
'reply_num'
]
=
replyNum
;
map
[
'reply_num'
]
=
replyNum
;
map
[
'is_my'
]
=
isMy
;
map
[
'is_my'
]
=
isMy
;
map
[
'is_praise'
]
=
isPraise
;
map
[
'comments_check'
]
=
commentsCheck
;
map
[
'status'
]
=
status
;
map
[
'create_time'
]
=
createTime
;
map
[
'create_time'
]
=
createTime
;
map
[
'replace_person_name'
]
=
replacePersonName
;
map
[
'replace_person_name'
]
=
replacePersonName
;
map
[
'replace_person_pic'
]
=
replacePersonPic
;
map
[
'replace_person_pic'
]
=
replacePersonPic
;
...
@@ -664,25 +682,29 @@ class HelpCenterModel {
...
@@ -664,25 +682,29 @@ class HelpCenterModel {
this
.
id
,
this
.
id
,
this
.
helpTitle
,
this
.
helpTitle
,
this
.
createTime
,
this
.
createTime
,
this
.
index
,
});
});
HelpCenterModel
.
fromJson
(
dynamic
json
)
{
HelpCenterModel
.
fromJson
(
dynamic
json
)
{
id
=
json
[
'id'
];
id
=
json
[
'id'
];
helpTitle
=
json
[
'help_title'
];
helpTitle
=
json
[
'help_title'
];
createTime
=
json
[
'create_time'
];
createTime
=
json
[
'create_time'
];
index
=
json
[
'index'
];
}
}
num
?
index
;
num
?
id
;
num
?
id
;
String
?
helpTitle
;
String
?
helpTitle
;
String
?
createTime
;
String
?
createTime
;
HelpCenterModel
copyWith
({
HelpCenterModel
copyWith
({
num
?
index
,
num
?
id
,
num
?
id
,
String
?
helpTitle
,
String
?
helpTitle
,
String
?
createTime
,
String
?
createTime
,
})
=>
})
=>
HelpCenterModel
(
HelpCenterModel
(
id:
id
??
this
.
id
,
id:
id
??
this
.
id
,
index:
index
??
this
.
index
,
helpTitle:
helpTitle
??
this
.
helpTitle
,
helpTitle:
helpTitle
??
this
.
helpTitle
,
createTime:
createTime
??
this
.
createTime
,
createTime:
createTime
??
this
.
createTime
,
);
);
...
@@ -690,6 +712,7 @@ class HelpCenterModel {
...
@@ -690,6 +712,7 @@ class HelpCenterModel {
Map
<
String
,
dynamic
>
toJson
()
{
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
final
map
=
<
String
,
dynamic
>{};
map
[
'id'
]
=
id
;
map
[
'id'
]
=
id
;
map
[
'index'
]
=
index
;
map
[
'help_title'
]
=
helpTitle
;
map
[
'help_title'
]
=
helpTitle
;
map
[
'create_time'
]
=
createTime
;
map
[
'create_time'
]
=
createTime
;
return
map
;
return
map
;
...
...
lib/pages/book_category/widgets/item.dart
浏览文件 @
cc22c4e3
...
@@ -178,7 +178,7 @@ class _BuildItemState extends State<BuildItem> {
...
@@ -178,7 +178,7 @@ class _BuildItemState extends State<BuildItem> {
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
ChapterModel
model
=
chapterModel
.
children
![
index
];
ChapterModel
model
=
chapterModel
.
children
![
index
];
return
Container
(
return
Container
(
padding:
EdgeInsets
.
only
(
left:
6
0
.
w
,
bottom:
4
.
w
),
padding:
EdgeInsets
.
only
(
left:
2
0
.
w
,
bottom:
4
.
w
),
child:
_buildChapter
(
model
)
child:
_buildChapter
(
model
)
);
);
// GestureDetector(
// GestureDetector(
...
...
lib/pages/book_detail/controller.dart
浏览文件 @
cc22c4e3
...
@@ -9,6 +9,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
...
@@ -9,6 +9,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
final
PageController
pageController
=
PageController
(
initialPage:
0
);
final
PageController
pageController
=
PageController
(
initialPage:
0
);
List
<
Widget
>
tabs
=
[
List
<
Widget
>
tabs
=
[
const
Tab
(
text:
'目录'
,),
const
Tab
(
text:
'目录'
,),
const
Tab
(
text:
'编辑推荐'
,),
const
Tab
(
text:
'简介'
,),
const
Tab
(
text:
'简介'
,),
const
Tab
(
text:
'本书信息'
,),
const
Tab
(
text:
'本书信息'
,),
];
];
...
@@ -84,7 +85,14 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
...
@@ -84,7 +85,14 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
void
getBookDetails
()
async
{
void
getBookDetails
()
async
{
bookDetails
=
await
LibraryAPI
.
details
(
bookId:
bookId
);
bookDetails
=
await
LibraryAPI
.
details
(
bookId:
bookId
);
// 将阅读最后章节写入到数据库
// 将阅读最后章节写入到数据库
SqlManager
.
updateReadHistoryByBookId
(
int
.
parse
(
bookId
),
bookDetails
.
chapterId
!.
toInt
());
try
{
final
result
=
await
SqlManager
.
updateReadHistoryByBookId
(
int
.
parse
(
bookId
),
bookDetails
.
chapterId
!.
toInt
());
Console
.
log
(
'Sql-------存入数据库读到的章节----------------book_id:
$bookId
-----chapterId:
${bookDetails.chapterId!.toInt()}
---------result:
$result
--'
);
}
catch
(
err
){
Console
.
log
(
'Sql--------------err------------------
$err
'
);
}
update
();
update
();
}
}
/// 收藏 与 取消收藏
/// 收藏 与 取消收藏
...
...
lib/pages/book_detail/view.dart
浏览文件 @
cc22c4e3
...
@@ -110,7 +110,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
...
@@ -110,7 +110,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
final
result
=
await
context
.
pushNamed
(
Routes
.
bookPay
,
extra:
buy
);
final
result
=
await
context
.
pushNamed
(
Routes
.
bookPay
,
extra:
buy
);
if
(
result
==
true
)
{
if
(
result
==
true
)
{
controller
.
get
Chapter
s
();
controller
.
get
BookDetail
s
();
}
}
}
else
{
}
else
{
final
result
=
await
context
.
pushNamed
(
Routes
.
web
,
queryParameters:
{
'book_id'
:
controller
.
bookDetails
.
bookId
.
toString
(),
'chapter_id'
:
chapterModel
.
id
.
toString
(),
'chapter_name'
:
chapterModel
.
name
.
toString
(),
'note_id'
:
'0'
},
extra:
controller
.
bookDetails
);
final
result
=
await
context
.
pushNamed
(
Routes
.
web
,
queryParameters:
{
'book_id'
:
controller
.
bookDetails
.
bookId
.
toString
(),
'chapter_id'
:
chapterModel
.
id
.
toString
(),
'chapter_name'
:
chapterModel
.
name
.
toString
(),
'note_id'
:
'0'
},
extra:
controller
.
bookDetails
);
...
@@ -120,11 +120,13 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
...
@@ -120,11 +120,13 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
}
}
},
},
),
),
// Container(
SingleChildScrollView
(
// padding: EdgeInsets.only(left: 15.w,right: 15.w,top:12.w),
child:
Container
(
// color: Colors.white,
padding:
EdgeInsets
.
only
(
left:
15
.
w
,
right:
15
.
w
,
top:
12
.
w
),
// child: Text(controller.bookDetails.content??'',style: TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c3),),
color:
Colors
.
white
,
// ),
child:
Text
(
controller
.
bookDetails
.
introduction
??
''
,
style:
const
TextStyle
(
fontSize:
15
,
height:
2.1
,
color:
Colours
.
c9
),),
),
),
InAppWebView
(
InAppWebView
(
contextMenu:
ContextMenu
(
contextMenu:
ContextMenu
(
options:
ContextMenuOptions
(
hideDefaultSystemContextMenuItems:
true
),
options:
ContextMenuOptions
(
hideDefaultSystemContextMenuItems:
true
),
...
@@ -227,7 +229,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
...
@@ -227,7 +229,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
final
result
=
await
context
.
pushNamed
(
Routes
.
bookPay
,
extra:
buy
);
final
result
=
await
context
.
pushNamed
(
Routes
.
bookPay
,
extra:
buy
);
if
(
result
==
true
)
{
if
(
result
==
true
)
{
controller
.
get
Chapter
s
();
controller
.
get
BookDetail
s
();
}
}
}
}
else
{
else
{
...
...
lib/pages/help_center/view.dart
浏览文件 @
cc22c4e3
...
@@ -26,7 +26,7 @@ class _HelpCenterPageState extends State<HelpCenterPage> {
...
@@ -26,7 +26,7 @@ class _HelpCenterPageState extends State<HelpCenterPage> {
itemCount:
controller
.
helpCenters
.
length
,
itemCount:
controller
.
helpCenters
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
HelpCenterModel
model
=
controller
.
helpCenters
[
index
];
HelpCenterModel
model
=
controller
.
helpCenters
[
index
];
model
.
i
d
=
index
+
1
;
model
.
i
ndex
=
index
+
1
;
return
GestureDetector
(
return
GestureDetector
(
child:
BuildItem
(
model:
model
,),
child:
BuildItem
(
model:
model
,),
onTap:
(){
onTap:
(){
...
...
lib/pages/help_center/widgets/item.dart
浏览文件 @
cc22c4e3
...
@@ -18,7 +18,7 @@ class BuildItem extends StatelessWidget {
...
@@ -18,7 +18,7 @@ class BuildItem extends StatelessWidget {
Row
(
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
Text
(
Text
(
'
${model!.i
d
}
.'
,
'
${model!.i
ndex
}
.'
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
.
w
,
height:
1.5
.
w
,
color:
Colours
.
c3
),
fontSize:
14
.
w
,
height:
1.5
.
w
,
color:
Colours
.
c3
),
),
),
...
...
lib/pages/library/controller.dart
浏览文件 @
cc22c4e3
...
@@ -227,26 +227,26 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
...
@@ -227,26 +227,26 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
/// 收藏 与 取消收藏
/// 收藏 与 取消收藏
void
love
({
void
love
({
required
String
bookId
,
required
CourseModel
model
required
num
isCollection
})
async
{
})
async
{
if
(
isCollection
==
0
){
num
isCollection
=
0
;
if
(
model
.
isCollection
==
0
){
isCollection
=
1
;
isCollection
=
1
;
}
}
else
{
isCollection
=
0
;
bool
result
=
await
CommonAPI
.
love
(
bookId:
model
.
bookId
.
toString
(),
love:
isCollection
.
toString
());
}
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
if
(
result
)
{
if
(
result
)
{
onRefresh
()
;
model
.
isCollection
=
isCollection
;
}
}
update
();
}
}
/// 批量上传离线笔记、高亮、划线的内容
/// 批量上传离线笔记、高亮、划线的内容
void
upload
()
async
{
void
upload
()
async
{
List
<
Map
<
String
,
dynamic
>>
data
=
await
SqlManager
.
queryNoUploadData
();
List
<
Map
<
String
,
dynamic
>>
data
=
await
SqlManager
.
queryNoUploadData
();
Console
.
log
(
'
查询到的数据-----------------------------
-----------------------
$data
'
);
Console
.
log
(
'
Sql-----查询到的数据
-----------------------
$data
'
);
if
(
data
.
isNotEmpty
){
if
(
data
.
isNotEmpty
){
for
(
Map
<
String
,
dynamic
>
temp
in
data
){
for
(
Map
<
String
,
dynamic
>
temp
in
data
){
...
...
lib/pages/library/widgets/content.dart
浏览文件 @
cc22c4e3
...
@@ -38,7 +38,7 @@ class _LibraryContentPageState extends State<LibraryContentPage> with AutomaticK
...
@@ -38,7 +38,7 @@ class _LibraryContentPageState extends State<LibraryContentPage> with AutomaticK
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
bookId
.
toString
()});
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
bookId
.
toString
()});
},
},
child:
LibraryCell
(
model:
model
,
onTap:
(){
child:
LibraryCell
(
model:
model
,
onTap:
(){
widget
.
controller
.
love
(
bookId:
model
.
bookId
.
toString
(),
isCollection:
model
.
isCollection
!
);
widget
.
controller
.
love
(
model:
model
);
},),
},),
);
);
}
}
...
...
lib/pages/read_web/controller.dart
浏览文件 @
cc22c4e3
...
@@ -83,6 +83,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -83,6 +83,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
just_audio
.
AudioPlayer
audioPlayer
=
just_audio
.
AudioPlayer
();
just_audio
.
AudioPlayer
audioPlayer
=
just_audio
.
AudioPlayer
();
late
SearchAllModel
sModel
=
SearchAllModel
(
bookId:
'0'
);
///------------------------------------------ 页面 生命周期--------------------------------------------------------
///------------------------------------------ 页面 生命周期--------------------------------------------------------
...
@@ -101,10 +103,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -101,10 +103,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
netStatus
=
await
Tools
.
checkCurrentNetStatus
();
netStatus
=
await
Tools
.
checkCurrentNetStatus
();
final
exist
=
await
_isExistFile
(
bookId
);
final
exist
=
await
_isExistFile
(
bookId
);
// chapterId = await SqlManager.queryReadHistoryByBookId(int.parse(bookId));
// Console.log('数据库中得到最后阅读的章节----------------------$chapterId----------');
if
(!
netStatus
&&
exist
){
if
(!
netStatus
&&
exist
){
// 1、从数据库中获取读到那个章节
// 1、从数据库中获取读到那个章节
chapterId
=
await
SqlManager
.
queryReadHistoryByBookId
(
int
.
parse
(
bookId
));
chapterId
=
await
SqlManager
.
queryReadHistoryByBookId
(
int
.
parse
(
bookId
));
Console
.
log
(
'Sql-----------数据库中得到最后阅读的章节----------------------
$chapterId
----------'
);
chapterName
=
getChapterName
(
chapterId
);
chapterName
=
getChapterName
(
chapterId
);
// 2、通过 chapterId 获取 对应离线的 html路径
// 2、通过 chapterId 获取 对应离线的 html路径
String
toReadHtmlPath
=
await
getLocalReadHtml
(
chapterId
);
String
toReadHtmlPath
=
await
getLocalReadHtml
(
chapterId
);
...
@@ -351,8 +356,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -351,8 +356,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 重置所有信息
// 重置所有信息
void
reset
(){
void
reset
(){
clearAllDiscussInput
();
clearAllDiscussInput
();
clearDiscussInputImages
();
clearDiscussAudios
();
}
}
// 播放音频
// 播放音频
...
@@ -408,11 +411,12 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -408,11 +411,12 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
// 清空所有已经填写的数据
// 清空所有已经填写的数据
void
clearAllDiscussInput
(){
void
clearAllDiscussInput
(){
discussInputImages
.
clear
();
clearDiscussInputImages
();
discussInputAudios
.
clear
();
clearDiscussAudios
();
titleInput
.
text
=
''
;
titleInput
.
text
=
''
;
contentInput
.
text
=
''
;
contentInput
.
text
=
''
;
isPublic
=
false
;
isPublic
=
false
;
noteTitle
=
''
;
Console
.
log
(
'clearAllDiscussInput--------------------------------'
);
Console
.
log
(
'clearAllDiscussInput--------------------------------'
);
update
();
update
();
}
}
...
@@ -546,7 +550,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -546,7 +550,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bookId:
bookId
,
bookId:
bookId
,
chapterId:
chapterId
,
chapterId:
chapterId
,
commentId:
'0'
,
commentId:
'0'
,
quoteContent:
''
,
quoteContent:
noteTitle
,
title:
titleInput
.
text
,
title:
titleInput
.
text
,
content:
jsonEncode
(
contentMap
)
content:
jsonEncode
(
contentMap
)
);
);
...
@@ -579,6 +583,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -579,6 +583,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 展示输入框
// 展示输入框
void
setShowChat
(
bool
value
)
{
void
setShowChat
(
bool
value
)
{
showChat
=
value
;
showChat
=
value
;
if
(
value
==
false
){
reset
();
}
update
();
update
();
}
}
// 显示输入框类型
// 显示输入框类型
...
@@ -605,24 +612,26 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -605,24 +612,26 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 从缓存中获取 ZIP 文件
// 从缓存中获取 ZIP 文件
var
file
=
await
DefaultCacheManager
().
getSingleFile
(
url
);
var
file
=
await
DefaultCacheManager
().
getSingleFile
(
url
);
if
(
file
!=
null
)
{
if
(
file
!=
null
)
{
Toast
.
show
(
'离线成功'
);
// 读取 ZIP 文件内容
// 读取 ZIP 文件内容
Uint8List
bytes
=
await
file
.
readAsBytes
();
Uint8List
bytes
=
await
file
.
readAsBytes
();
// 解压缩 ZIP 文件
// 解压缩 ZIP 文件
Archive
archive
=
ZipDecoder
().
decodeBytes
(
bytes
);
Archive
archive
=
ZipDecoder
().
decodeBytes
(
bytes
);
// 获取设备上的临时目录
// 获取设备上的临时目录
Directory
?
tempDir
=
await
getExternalStorage
Directory
();
String
tempPath
=
await
Tools
.
get
Directory
();
// 将解压缩后的文件保存到临时目录中
// 将解压缩后的文件保存到临时目录中
for
(
var
file
in
archive
)
{
for
(
var
file
in
archive
)
{
if
(
file
.
isFile
)
{
if
(
file
.
isFile
)
{
String
fileName
=
file
.
name
;
String
fileName
=
file
.
name
;
String
filePath
=
'
$
{tempDir!.path}
/
$bookId
/
$fileName
'
;
String
filePath
=
'
$
tempPath
/
$bookId
/
$fileName
'
;
File
(
filePath
)
File
(
filePath
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
file
.
content
as
List
<
int
>);
..
writeAsBytesSync
(
file
.
content
as
List
<
int
>);
(
'解压缩文件:
$fileName
,保存路径:
$filePath
'
);
Console
.
log
(
'解压缩文件:
$fileName
,保存路径:
$filePath
'
);
}
}
}
}
Toast
.
show
(
'离线成功'
);
final
exit
=
await
_isExistFile
(
bookId
);
update
();
}
else
{
}
else
{
Console
.
log
(
'未找到缓存中的文件或文件不存在'
);
Console
.
log
(
'未找到缓存中的文件或文件不存在'
);
...
@@ -649,7 +658,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -649,7 +658,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
Future
<
String
>
getLocalReadHtml
(
String
chapterId
)
async
{
Future
<
String
>
getLocalReadHtml
(
String
chapterId
)
async
{
String
docPath
=
await
_
getDirectory
();
String
docPath
=
await
Tools
.
getDirectory
();
String
filePath
=
'
$docPath
/
$bookId
'
;
String
filePath
=
'
$docPath
/
$bookId
'
;
Directory
directory
=
Directory
(
filePath
);
Directory
directory
=
Directory
(
filePath
);
// 获取目录下的所有文件
// 获取目录下的所有文件
...
@@ -683,6 +692,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -683,6 +692,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// url: Uri.parse(writeFilePath),
// url: Uri.parse(writeFilePath),
url:
WebUri
.
uri
(
Uri
.
parse
(
writeFilePath
))
url:
WebUri
.
uri
(
Uri
.
parse
(
writeFilePath
))
));
));
queryLocalNote
();
}
}
// 本地阅读 读取上一章节 或 下一章节
// 本地阅读 读取上一章节 或 下一章节
...
@@ -771,6 +781,33 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -771,6 +781,33 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
return
''
;
return
''
;
}
}
// 查询本地划线高亮笔记
void
queryLocalNote
()
async
{
final
result
=
await
SqlManager
.
queryLocalNote
(
bookId:
int
.
parse
(
bookId
),
chapterId:
int
.
parse
(
chapterId
));
Console
.
log
(
'前端-----------queryLocalNote---------------------
$result
'
);
webViewController
.
evaluateJavascript
(
source
:
'querySuccessCallBack(
$result
)'
);
}
// 本地添加划线高亮笔记
void
addLocalNote
(
Map
<
String
,
dynamic
>
data
)
async
{
data
[
'book_id'
]
=
int
.
parse
(
bookId
);
data
[
'chapter_id'
]
=
int
.
parse
(
chapterId
);
final
result
=
await
SqlManager
.
addLocalNote
(
data
);
Console
.
log
(
'前端-----------addLocalNote---------------------
$result
'
);
webViewController
.
evaluateJavascript
(
source
:
'addSuccessCallBack(
$result
)'
);
}
// 本地删除划线高亮笔记
void
delLocalNote
({
required
int
id
})
async
{
final
result
=
await
SqlManager
.
delLocalNote
(
id:
id
);
Console
.
log
(
'前端-----------delLocalNote---------------------
$result
'
);
webViewController
.
evaluateJavascript
(
source
:
'delSuccessCallBack(
$result
)'
);
}
// 修改本地划线高亮笔记
void
updateLocalNote
({
required
int
id
,
required
Map
<
String
,
dynamic
>
data
})
async
{
final
result
=
await
SqlManager
.
updateLocalNote
(
id:
id
,
data:
data
);
Console
.
log
(
'前端-----------updateLocalNote---------------------
$result
'
);
webViewController
.
evaluateJavascript
(
source
:
'updateSuccessCallBack(
$result
)'
);
}
//获取存储目录
//获取存储目录
Future
<
String
>
_getDirectory
()
async
{
Future
<
String
>
_getDirectory
()
async
{
// getTemporaryDirectory
// getTemporaryDirectory
...
@@ -779,7 +816,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -779,7 +816,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
/// 获取目录信息
/// 获取目录信息
void
_getChapters
()
async
{
void
_getChapters
()
async
{
chapters
=
await
LibraryAPI
.
chapters
(
bookId:
bookId
);
chapters
=
await
LibraryAPI
.
chapters
(
bookId:
bookId
);
...
...
lib/pages/read_web/discuss_controller.dart
浏览文件 @
cc22c4e3
...
@@ -27,6 +27,8 @@ class DiscussController extends GetxController {
...
@@ -27,6 +27,8 @@ class DiscussController extends GetxController {
bool
showReply
=
false
;
bool
showReply
=
false
;
// 当前要回复的模型
// 当前要回复的模型
late
DiscussModel
discussModel
;
late
DiscussModel
discussModel
;
// 当前要回复父级的模型
late
DiscussModel
fatherDiscussModel
;
// 是否展示搜索结果
// 是否展示搜索结果
bool
showSearch
=
false
;
bool
showSearch
=
false
;
...
@@ -49,18 +51,54 @@ class DiscussController extends GetxController {
...
@@ -49,18 +51,54 @@ class DiscussController extends GetxController {
void
setShow
()
{
void
setShow
()
{
showReply
=
!
showReply
;
showReply
=
!
showReply
;
if
(
showReply
==
false
)
{
replyInput
.
text
=
''
;
}
update
();
update
();
}
}
void
setDiscussModel
(
DiscussModel
model
){
void
setDiscussModel
(
DiscussModel
model
){
discussModel
=
model
;
discussModel
=
model
;
}
}
void
setFatherDiscussModel
(
DiscussModel
model
){
fatherDiscussModel
=
model
;
}
void
setShowSearch
(
bool
show
){
void
setShowSearch
(
bool
show
){
showSearch
=
show
;
showSearch
=
show
;
update
();
update
();
}
}
// 点赞 取消点赞
Future
<
void
>
commentLove
({
required
DiscussModel
discussModel
})
async
{
num
type
=
0
;
if
(
discussModel
.
isPraise
==
0
){
type
=
1
;
}
final
result
=
await
LibraryAPI
.
commentLove
(
bookId:
bookDetailModel
.
bookId
!
,
type:
type
,
commentId:
discussModel
.
id
!);
if
(
result
){
num
goodNum
=
discussModel
.
goodNum
??
0
;
if
(
type
==
0
){
goodNum
--;
}
else
{
goodNum
++;
}
discussModel
.
isPraise
=
type
;
discussModel
.
goodNum
=
goodNum
;
}
update
();
}
// 删除回复
Future
<
void
>
delComment
({
required
DiscussModel
discussModel
})
async
{
final
result
=
await
LibraryAPI
.
delComment
(
bookId:
bookDetailModel
.
bookId
!,
commentId:
discussModel
.
id
!);
if
(
result
){
discuss
.
remove
(
discussModel
);
Toast
.
show
(
'删除成功'
);
}
update
();
}
Future
<
bool
>
submit
()
async
{
Future
<
bool
>
submit
()
async
{
...
@@ -79,15 +117,34 @@ class DiscussController extends GetxController {
...
@@ -79,15 +117,34 @@ class DiscussController extends GetxController {
content:
jsonEncode
(
contentMap
)
content:
jsonEncode
(
contentMap
)
);
);
if
(
result
){
if
(
result
){
Toast
.
show
(
'话题发表成功'
);
Toast
.
show
(
'发表成功'
);
Toast
.
show
(
'发表成功'
);
discussModel
.
replyNum
=
discussModel
.
replyNum
!
+
1
;
DiscussModel
tempModel
=
DiscussModel
.
fromJson
(
discussModel
.
toJson
());
tempModel
.
status
=
1
;
tempModel
.
commentsCheck
=
0
;
tempModel
.
isMy
=
1
;
NoteContentModel
contentModel
=
NoteContentModel
(
text:
MediaModel
(
content:
replyInput
.
text
,
privacyStatus:
1
)
);
tempModel
.
content
=
contentModel
;
tempModel
.
content
?.
text
?.
privacyStatus
=
1
;
tempModel
.
replacePersonName
=
discussModel
.
personName
;
tempModel
.
replacePersonPic
=
discussModel
.
personPic
;
tempModel
.
replyNum
=
0
;
fatherDiscussModel
.
commentAll
?.
add
(
tempModel
);
// fatherDiscussModel.replyNum = fatherDiscussModel.commentAll?.length;
}
}
else
{
else
{
Toast
.
show
(
'
话题
发表失败'
);
Toast
.
show
(
'发表失败'
);
}
}
// 重置所有信息
// 重置所有信息
// reset();
// reset();
// setShowChat(false);
// setShowChat(false);
replyInput
.
text
=
''
;
update
();
return
result
;
return
result
;
}
}
...
@@ -101,7 +158,7 @@ class DiscussController extends GetxController {
...
@@ -101,7 +158,7 @@ class DiscussController extends GetxController {
bookId:
bookDetailModel
.
bookId
.
toString
(),
bookId:
bookDetailModel
.
bookId
.
toString
(),
key:
searchInput
.
text
key:
searchInput
.
text
);
);
testData
();
//
testData();
Console
.
log
(
'--------------------------------'
);
Console
.
log
(
'--------------------------------'
);
// 如果是刷新 清理数据
// 如果是刷新 清理数据
if
(
isRefresh
)
searchALlResults
.
clear
();
if
(
isRefresh
)
searchALlResults
.
clear
();
...
...
lib/pages/read_web/index.dart
浏览文件 @
cc22c4e3
...
@@ -26,6 +26,7 @@ import 'package:just_audio/just_audio.dart' as just_audio;
...
@@ -26,6 +26,7 @@ import 'package:just_audio/just_audio.dart' as just_audio;
import
'package:path_provider/path_provider.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'dart:async'
;
import
'dart:async'
;
import
'package:plugin_platform_interface/plugin_platform_interface.dart'
;
import
'package:plugin_platform_interface/plugin_platform_interface.dart'
;
import
'package:sqflite/sqflite.dart'
;
import
'../../apis/index.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
import
'../../models/index.dart'
;
...
...
lib/pages/read_web/view.dart
浏览文件 @
cc22c4e3
...
@@ -104,7 +104,7 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -104,7 +104,7 @@ class _ReadPageState extends State<ReadPage> {
'chapter_id'
:
readController
.
chapterId
,
'chapter_id'
:
readController
.
chapterId
,
'token'
:
UserStore
.
to
.
token
'token'
:
UserStore
.
to
.
token
};
};
String
str
=
'
$kServerUrl
,
${readController.bookId}
,
${readController.chapterId}
,
${UserStore.to.token}
,
${readController.noteId}
'
;
String
str
=
'
$kServerUrl
,
${readController.bookId}
,
${readController.chapterId}
,
${UserStore.to.token}
,
${readController.noteId}
,
${readController.sModel.bookId =='0'?'':readController.sModel.combinedContent}
'
;
Console
.
log
(
'传给前端的参数--------------------------------
$str
'
);
Console
.
log
(
'传给前端的参数--------------------------------
$str
'
);
controller
.
evaluateJavascript
(
source
:
'callbackInFlutterComponent("
$str
");'
);
controller
.
evaluateJavascript
(
source
:
'callbackInFlutterComponent("
$str
");'
);
...
@@ -159,7 +159,7 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -159,7 +159,7 @@ class _ReadPageState extends State<ReadPage> {
Console
.
log
(
'监听讨论回调------------------------------------------------
$args
'
);
Console
.
log
(
'监听讨论回调------------------------------------------------
$args
'
);
readController
.
setShowChat
(
true
);
readController
.
setShowChat
(
true
);
readController
.
setChatType
(
0
);
readController
.
setChatType
(
0
);
readController
.
titleInput
.
text
=
args
.
first
.
toString
();
readController
.
noteTitle
=
args
.
first
.
toString
();
});
});
controller
.
addJavaScriptHandler
(
handlerName:
'answerResultCallBack'
,
callback:
(
args
){
controller
.
addJavaScriptHandler
(
handlerName:
'answerResultCallBack'
,
callback:
(
args
){
...
@@ -194,7 +194,7 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -194,7 +194,7 @@ class _ReadPageState extends State<ReadPage> {
controller
.
addJavaScriptHandler
(
handlerName:
'loadChapterCallBack'
,
callback:
(
args
){
controller
.
addJavaScriptHandler
(
handlerName:
'loadChapterCallBack'
,
callback:
(
args
){
String
chapterId
=
args
.
first
[
0
].
toString
();
String
chapterId
=
args
.
first
[
0
].
toString
();
String
chapterName
=
args
.
first
[
1
].
toString
();
String
chapterName
=
args
.
first
[
1
].
toString
();
readController
.
setChapterInfo
(
id:
chapterId
,
name:
chapterName
);
readController
.
setChapterInfo
(
id:
chapterId
,
name:
chapterName
??
''
);
Console
.
log
(
'监听 上一节 下一节------------------------------------------------
$args
'
);
Console
.
log
(
'监听 上一节 下一节------------------------------------------------
$args
'
);
});
});
...
@@ -209,6 +209,56 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -209,6 +209,56 @@ class _ReadPageState extends State<ReadPage> {
context
.
pushNamed
(
Routes
.
link
,
queryParameters:
{
'url'
:
args
.
first
.
toString
()});
context
.
pushNamed
(
Routes
.
link
,
queryParameters:
{
'url'
:
args
.
first
.
toString
()});
});
});
/// 离线需要参数
// //
// Map<String, dynamic> param111 = {
// 'book_id': readController.bookId,
// 'chapter_id': readController.chapterId,
// 'token':UserStore.to.token
// };
// String jsonStr = jsonEncode(param111);
// controller.evaluateJavascript(source: 'offlineCallbackInFlutterComponent($jsonStr)');
// // controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
// 添加高亮划线笔记
controller
.
addJavaScriptHandler
(
handlerName:
'offlineAddNoteCallBack'
,
callback:
(
args
){
Map
<
String
,
dynamic
>
data
=
{};
readController
.
addLocalNote
(
data
);
});
// 删除高亮划线笔记
controller
.
addJavaScriptHandler
(
handlerName:
'offlineDelNoteCallBack'
,
callback:
(
args
){
int
id
=
0
;
readController
.
delLocalNote
(
id:
id
);
});
// 更新高亮划线笔记
controller
.
addJavaScriptHandler
(
handlerName:
'offlineUpdateNoteCallBack'
,
callback:
(
args
){
int
id
=
0
;
Map
<
String
,
dynamic
>
data
=
{};
readController
.
updateLocalNote
(
id:
id
,
data:
data
);
});
// 查询高亮划线笔记
controller
.
addJavaScriptHandler
(
handlerName:
'offlineQueryNoteCallBack'
,
callback:
(
args
){
});
// 上一节下一节
controller
.
addJavaScriptHandler
(
handlerName:
'offlineReadNoteCallBack'
,
callback:
(
args
){
int
type
=
0
;
// 上一节
if
(
type
==
0
){
readController
.
readChapter
(
type:
0
);
}
// 下一节
else
{
readController
.
readChapter
(
type:
1
);
}
});
},
},
),
),
// AnimatedPositioned(
// AnimatedPositioned(
...
@@ -347,10 +397,13 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -347,10 +397,13 @@ class _ReadPageState extends State<ReadPage> {
controller
.
chooseTool
(
model
);
controller
.
chooseTool
(
model
);
},
},
// 点 搜索全部 列表 某一项 事件
// 点 搜索全部 列表 某一项 事件
onTapSearchItem:
(){
onTapSearchItem:
(
SearchAllModel
sModel
){
controller
.
chooseTool
(
model
);
controller
.
chooseTool
(
model
);
// TODO:重新加载阅读界面 参数:chapter_id text
// TODO:重新加载阅读界面 参数:chapter_id text
Console
.
log
(
'-----------目录点击搜索条目---------------------'
);
Console
.
log
(
'-----------目录点击搜索条目---------------------'
);
controller
.
sModel
=
sModel
;
controller
.
selectChapter
(
ChapterModel
(
id:
sModel
.
chapterId
,
name:
sModel
.
chapterName
));
controller
.
webViewController
.
reload
();
},
},
onTapChapter:
(
ChapterModel
chapterModel
){
onTapChapter:
(
ChapterModel
chapterModel
){
Console
.
log
(
'-----------选择的章节-------------
${chapterModel.name}
--------'
);
Console
.
log
(
'-----------选择的章节-------------
${chapterModel.name}
--------'
);
...
@@ -370,10 +423,13 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -370,10 +423,13 @@ class _ReadPageState extends State<ReadPage> {
controller
.
chooseTool
(
model
);
controller
.
chooseTool
(
model
);
},
},
// 点 搜索全部 列表 某一项 事件
// 点 搜索全部 列表 某一项 事件
onTapSearchItem:
(){
onTapSearchItem:
(
SearchAllModel
sModel
){
controller
.
chooseTool
(
model
);
controller
.
chooseTool
(
model
);
// TODO:重新加载阅读界面 参数:chapter_id text
// TODO:重新加载阅读界面 参数:chapter_id text
Console
.
log
(
'-----------笔记点击搜索条目---------------------'
);
Console
.
log
(
'-----------笔记点击搜索条目---------------------'
);
controller
.
sModel
=
sModel
;
controller
.
selectChapter
(
ChapterModel
(
id:
sModel
.
chapterId
,
name:
sModel
.
chapterName
));
controller
.
webViewController
.
reload
();
},
},
bookDetailModel:
controller
.
bookDetailModel
,
bookDetailModel:
controller
.
bookDetailModel
,
chapterId:
controller
.
chapterId
,
chapterId:
controller
.
chapterId
,
...
@@ -386,10 +442,13 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -386,10 +442,13 @@ class _ReadPageState extends State<ReadPage> {
controller
.
chooseTool
(
model
);
controller
.
chooseTool
(
model
);
},
},
// 点 搜索全部 列表 某一项 事件
// 点 搜索全部 列表 某一项 事件
onTapSearchItem:
(){
onTapSearchItem:
(
SearchAllModel
sModel
){
controller
.
chooseTool
(
model
);
controller
.
chooseTool
(
model
);
controller
.
sModel
=
sModel
;
// TODO:重新加载阅读界面 参数:chapter_id text
// TODO:重新加载阅读界面 参数:chapter_id text
Console
.
log
(
'-----------讨论点击搜索条目---------------------'
);
Console
.
log
(
'-----------讨论点击搜索条目---------------------'
);
controller
.
selectChapter
(
ChapterModel
(
id:
sModel
.
chapterId
,
name:
sModel
.
chapterName
));
controller
.
webViewController
.
reload
();
},
},
bookDetailModel:
controller
.
bookDetailModel
,
bookDetailModel:
controller
.
bookDetailModel
,
chapterId:
controller
.
chapterId
,
chapterId:
controller
.
chapterId
,
...
@@ -402,17 +461,26 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -402,17 +461,26 @@ class _ReadPageState extends State<ReadPage> {
Console
.
log
(
'++++++++++++++++++++++++
${model.tag}
'
);
Console
.
log
(
'++++++++++++++++++++++++
${model.tag}
'
);
if
(
controller
.
show
){
if
(
controller
.
show
){
if
(
model
.
selected
){
if
(
model
.
selected
){
return
Container
(
return
GestureDetector
(
color:
const
Color
(
0xFF000000
).
withOpacity
(
0.5
),
onTap:
(){
padding:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.2
),
controller
.
chooseTool
(
model
);
child:
ClipRRect
(
},
borderRadius:
BorderRadius
.
only
(
topRight:
Radius
.
circular
(
8
.
w
),
topLeft:
Radius
.
circular
(
8
.
w
)),
child:
Container
(
child:
Container
(
color:
const
Color
(
0xFF000000
).
withOpacity
(
0.5
),
color:
Colors
.
white
,
padding:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.2
),
child:
detail
(
controller
,
model
)
child:
ClipRRect
(
borderRadius:
BorderRadius
.
only
(
topRight:
Radius
.
circular
(
8
.
w
),
topLeft:
Radius
.
circular
(
8
.
w
)),
child:
Container
(
color:
Colors
.
white
,
child:
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
(){},
child:
detail
(
controller
,
model
),
)
),
),
),
// child: ReadCategoryPage(),
),
),
// child: ReadCategoryPage(),
);
);
}
}
else
{
else
{
...
...
lib/pages/read_web/widgets/category.dart
浏览文件 @
cc22c4e3
...
@@ -4,7 +4,7 @@ class ReadCategoryPage extends StatefulWidget {
...
@@ -4,7 +4,7 @@ class ReadCategoryPage extends StatefulWidget {
final
ReadController
controller
;
final
ReadController
controller
;
final
void
Function
()?
onTap
;
final
void
Function
()?
onTap
;
// 点击 搜索全文 中的列表事件
// 点击 搜索全文 中的列表事件
final
void
Function
()?
onTapSearchItem
;
final
void
Function
(
SearchAllModel
sModel
)?
onTapSearchItem
;
final
Function
(
ChapterModel
chapterModel
)
onTapChapter
;
final
Function
(
ChapterModel
chapterModel
)
onTapChapter
;
const
ReadCategoryPage
({
const
ReadCategoryPage
({
Key
?
key
,
Key
?
key
,
...
@@ -88,9 +88,9 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
...
@@ -88,9 +88,9 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
),
),
widget
.
controller
.
showSearch
?
Expanded
(
widget
.
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
child:
BuildSearchAll
(
onTap:
(){
onTap:
(
SearchAllModel
sModel
){
if
(
widget
.
onTapSearchItem
!=
null
)
{
if
(
widget
.
onTapSearchItem
!=
null
)
{
widget
.
onTapSearchItem
!();
widget
.
onTapSearchItem
!(
sModel
);
}
}
},
},
searchALlResults:
widget
.
controller
.
searchALlResults
searchALlResults:
widget
.
controller
.
searchALlResults
...
...
lib/pages/read_web/widgets/discuss.dart
浏览文件 @
cc22c4e3
...
@@ -4,7 +4,7 @@ class ReadDiscussPage extends StatefulWidget {
...
@@ -4,7 +4,7 @@ class ReadDiscussPage extends StatefulWidget {
// 点 x 事件
// 点 x 事件
final
void
Function
()?
onTap
;
final
void
Function
()?
onTap
;
// 点击 搜索全文 中的列表事件
// 点击 搜索全文 中的列表事件
final
void
Function
()?
onTapSearchItem
;
final
void
Function
(
SearchAllModel
sModel
)?
onTapSearchItem
;
final
BookDetailModel
bookDetailModel
;
final
BookDetailModel
bookDetailModel
;
// 当前的章节id
// 当前的章节id
final
String
chapterId
;
final
String
chapterId
;
...
@@ -89,9 +89,9 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
...
@@ -89,9 +89,9 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
),
),
controller
.
showSearch
?
Expanded
(
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
child:
BuildSearchAll
(
onTap:
(){
onTap:
(
SearchAllModel
sModel
){
if
(
widget
.
onTapSearchItem
!=
null
)
{
if
(
widget
.
onTapSearchItem
!=
null
)
{
widget
.
onTapSearchItem
!();
widget
.
onTapSearchItem
!(
sModel
);
}
}
},
},
searchALlResults:
controller
.
searchALlResults
,
searchALlResults:
controller
.
searchALlResults
,
...
@@ -103,14 +103,21 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
...
@@ -103,14 +103,21 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
ListView
.
builder
(
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
DiscussModel
model
=
controller
.
discuss
[
index
];
DiscussModel
model
=
controller
.
discuss
[
index
];
return
BuildDiscuss
(
model:
model
,
controller:
controller
,);
return
BuildDiscuss
(
model:
model
,
controller:
controller
,
bookId:
widget
.
bookDetailModel
.
bookId
.
toString
(),
onTapDel:
(
DiscussModel
dModel
){
controller
.
delComment
(
discussModel:
dModel
);
},
);
},
},
itemCount:
controller
.
discuss
.
length
,
itemCount:
controller
.
discuss
.
length
,
),
),
Visibility
(
Visibility
(
visible:
controller
.
showReply
,
visible:
controller
.
showReply
,
child:
Positioned
(
child:
Positioned
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
-
4
9
,
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
-
6
9
,
left:
0
,
left:
0
,
right:
0
,
right:
0
,
child:
Container
(
child:
Container
(
...
...
lib/pages/read_web/widgets/input_discuss.dart
浏览文件 @
cc22c4e3
...
@@ -22,31 +22,37 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
...
@@ -22,31 +22,37 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
.
w
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
.
w
),
child:
widget
.
controller
.
chatType
==
0
?
Row
(
child:
widget
.
controller
.
chatType
==
0
?
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Text
(
'话题'
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
Colours
.
c3
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),),
widget
.
controller
.
noteTitle
.
isEmpty
?
const
SizedBox
():
Text
(
'"
${widget.controller.noteTitle}
"'
,
style:
TextStyle
(
fontSize:
12
.
w
,
height:
1.4
,
color:
Colours
.
c9
),),
Gaps
.
hGaps5
,
Row
(
Expanded
(
children:
[
child:
ClipRRect
(
Text
(
'话题'
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
Colours
.
c3
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),),
borderRadius:
BorderRadius
.
circular
(
4
),
Gaps
.
hGaps5
,
child:
TextField
(
Expanded
(
focusNode:
widget
.
controller
.
discussTitleFocusNode
,
child:
ClipRRect
(
controller:
widget
.
controller
.
titleInput
,
borderRadius:
BorderRadius
.
circular
(
4
),
autofocus:
true
,
child:
TextField
(
decoration:
InputDecoration
(
focusNode:
widget
.
controller
.
discussTitleFocusNode
,
border:
InputBorder
.
none
,
controller:
widget
.
controller
.
titleInput
,
enabledBorder:
InputBorder
.
none
,
autofocus:
true
,
focusedBorder:
InputBorder
.
none
,
decoration:
InputDecoration
(
hintText:
'请输入话题名称'
,
border:
InputBorder
.
none
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
enabledBorder:
InputBorder
.
none
,
filled:
true
,
focusedBorder:
InputBorder
.
none
,
fillColor:
Colours
.
cF8
,
hintText:
'请输入话题名称'
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
filled:
true
,
fillColor:
Colours
.
cF8
,
),
onSubmitted:
(
_
){
FocusScope
.
of
(
context
).
requestFocus
(
widget
.
controller
.
discussContentFocusNode
);
},
),
),
),
onSubmitted:
(
_
){
FocusScope
.
of
(
context
).
requestFocus
(
widget
.
controller
.
discussContentFocusNode
);
},
),
),
)
,
]
,
),
),
],
],
):
Text
(
'"
${widget.controller.noteTitle}
"'
,
style:
TextStyle
(
fontSize:
12
.
w
,
height:
1.4
,
color:
Colours
.
c9
),),
):
Text
(
'"
${widget.controller.noteTitle}
"'
,
style:
TextStyle
(
fontSize:
12
.
w
,
height:
1.4
,
color:
Colours
.
c9
),),
...
...
lib/pages/read_web/widgets/item.dart
浏览文件 @
cc22c4e3
...
@@ -16,82 +16,171 @@ class BuildItem extends StatefulWidget {
...
@@ -16,82 +16,171 @@ class BuildItem extends StatefulWidget {
class
_BuildItemState
extends
State
<
BuildItem
>
{
class
_BuildItemState
extends
State
<
BuildItem
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
_buildChapter
(
widget
.
model
);
// Column(
// children: [
// /// 章节名称容器
// GestureDetector(
// onTap: (){
// if(widget.model.children!.isEmpty){
// widget.onTapChapter(widget.model);
// }
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 15.w),
// height: 30.w,
// color: Colors.white,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.boldSemi,height: 2),),
// Gaps.hGaps5,
// widget.model.isReading == 1? Container(
// height: 18,
// width: 18,
// margin: EdgeInsets.only(top: 6.w),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8.5.w),
// border: Border.all(width:1,color: AppTheme.primary)
// ),
// child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),),
// ):const SizedBox(),
// ],
// ),
// Transform.rotate(
// angle: widget.model.selected?0:-90 * (3.141592653589793 / 180),
// child: GestureDetector(
// onTap: (){
// setState(() {
// widget.model.selected = !widget.model.selected;
// });
// },
// child: SizedBox(
// width: 20.w,
// height: 20.w,
// child: Image.asset('assets/images/down.png')
// ),
// )
// )
//
// ],
// )
// ),
// ),
// /// 节的名称容器
// Visibility(
// visible: widget.model.selected,
// child: ListView.builder(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (BuildContext context, int index){
// ChapterModel model = widget.model.children![index];
// return GestureDetector(
// onTap: (){
// widget.onTapChapter(model);
// },
// child: _buildSection(model)
// );
// },
// itemCount: widget.model.children!.length,
// )
// )
// ],
// );
}
Widget
_buildChapter
(
ChapterModel
chapterModel
){
return
Column
(
return
Column
(
children:
[
children:
[
/// 章节名称容器
/// 章节名称容器
GestureDetector
(
GestureDetector
(
onTap:
(){
onTap:
(){
if
(
widget
.
model
.
children
!.
isEmpty
){
widget
.
onTapChapter
(
chapterModel
);
widget
.
onTapChapter
(
widget
.
model
);
// // 如果章下面没有节 点击才会跳转
}
// if (widget.model.children!.isEmpty){
// widget.onTap(widget.model);
// // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id': widget.model.id.toString(),'chapter_name':widget.model.name.toString()},extra: widget.bookDetails);
// }
// setState(() {
// widget.model.selected = !widget.model.selected;
// });
},
},
child:
Container
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
.
w
),
height:
30
.
w
,
height:
30
.
w
,
color:
Colors
.
white
,
color:
Colors
.
white
,
child:
Row
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
crossAxisAlignment:
CrossAxisAlignment
.
center
,
Row
(
children:
[
crossAxisAlignment:
CrossAxisAlignment
.
center
,
Row
(
children:
[
crossAxisAlignment:
CrossAxisAlignment
.
center
,
Text
(
widget
.
model
.
name
??
''
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
widget
.
model
.
seen
==
0
?
Colours
.
c3
:
Colours
.
c9
,
fontWeight:
Fonts
.
boldSemi
,
height:
2
),),
children:
[
Gaps
.
hGaps5
,
Text
(
chapterModel
.
name
??
''
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
chapterModel
.
seen
==
0
?
Colours
.
c3
:
Colours
.
c9
,
fontWeight:
Fonts
.
medium
,
height:
2
),),
widget
.
model
.
isReading
==
1
?
Container
(
Gaps
.
hGaps5
,
height:
18
,
chapterModel
.
isReading
==
1
?
Container
(
width:
18
,
margin:
const
EdgeInsets
.
fromLTRB
(
0
,
6
,
0
,
0
),
margin:
EdgeInsets
.
only
(
top:
6
.
w
),
height:
18
,
alignment:
Alignment
.
center
,
width:
18
,
decoration:
BoxDecoration
(
alignment:
Alignment
.
center
,
borderRadius:
BorderRadius
.
circular
(
8.5
.
w
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
width:
1
,
color:
AppTheme
.
primary
)
borderRadius:
BorderRadius
.
circular
(
8.5
.
w
),
),
border:
Border
.
all
(
width:
1
,
color:
AppTheme
.
primary
)
child:
Text
(
'试'
,
style:
TextStyle
(
fontSize:
11
.
w
,
color:
AppTheme
.
primary
),),
),
):
const
SizedBox
(),
child:
Text
(
'试'
,
style:
TextStyle
(
fontSize:
11
.
w
,
color:
AppTheme
.
primary
),),
],
):
const
SizedBox
(),
),
],
Transform
.
rotate
(
),
angle:
widget
.
model
.
selected
?
0
:-
90
*
(
3.141592653589793
/
180
),
Transform
.
rotate
(
child:
GestureDetector
(
angle:
chapterModel
.
selected
?
0
:-
90
*
(
3.141592653589793
/
180
),
onTap:
(){
child:
GestureDetector
(
setState
(()
{
onTap:
(){
widget
.
model
.
selected
=
!
widget
.
model
.
selected
;
setState
(()
{
});
chapterModel
.
selected
=
!
chapterModel
.
selected
;
},
});
child:
SizedBox
(
},
width:
20
.
w
,
child:
Container
(
height:
20
.
w
,
width:
20
.
w
,
child:
Image
.
asset
(
'assets/images/down.png'
)
height:
20
.
w
,
),
// color: Colors.red,
)
child:
Image
.
asset
(
'assets/images/down.png'
)
)
),
)
)
],
],
)
)
),
),
),
),
/// 节的名称容器
/// 节的名称容器
Visibility
(
Visibility
(
visible:
widget
.
m
odel
.
selected
,
visible:
chapterM
odel
.
selected
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
shrinkWrap:
true
,
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
physics:
const
NeverScrollableScrollPhysics
(),
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
ChapterModel
model
=
widget
.
model
.
children
![
index
];
ChapterModel
model
=
chapterModel
.
children
![
index
];
return
GestureDetector
(
return
Container
(
onTap:
(){
padding:
EdgeInsets
.
only
(
left:
20
.
w
,
bottom:
4
.
w
),
widget
.
onTapChapter
(
model
);
child:
_buildChapter
(
model
)
},
);
child:
_buildSection
(
model
)
// GestureDetector(
);
// onTap: (){
},
// widget.onTap(model);
itemCount:
widget
.
model
.
children
!.
length
,
// // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
// },
// child: _buildSection(model)
// );
},
itemCount:
chapterModel
.
children
!.
length
,
)
)
)
)
],
],
);
);
}
}
Widget
_buildSection
(
ChapterModel
model
){
Widget
_buildSection
(
ChapterModel
model
){
return
Container
(
return
Container
(
color:
Colors
.
white
,
color:
Colors
.
white
,
...
...
lib/pages/read_web/widgets/note.dart
浏览文件 @
cc22c4e3
...
@@ -3,7 +3,7 @@ part of web;
...
@@ -3,7 +3,7 @@ part of web;
class
ReadNotePage
extends
StatefulWidget
{
class
ReadNotePage
extends
StatefulWidget
{
final
BookDetailModel
bookDetailModel
;
final
BookDetailModel
bookDetailModel
;
// 点击 搜索全文 中的列表事件
// 点击 搜索全文 中的列表事件
final
void
Function
()?
onTapSearchItem
;
final
void
Function
(
SearchAllModel
sModel
)?
onTapSearchItem
;
// 当前的章节id
// 当前的章节id
final
String
chapterId
;
final
String
chapterId
;
final
void
Function
()?
onTap
;
final
void
Function
()?
onTap
;
...
@@ -86,9 +86,9 @@ class _ReadNotePageState extends State<ReadNotePage> {
...
@@ -86,9 +86,9 @@ class _ReadNotePageState extends State<ReadNotePage> {
],
],
),
),
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
onTap:
(){
onTap:
(
SearchAllModel
sModel
){
if
(
widget
.
onTapSearchItem
!=
null
)
{
if
(
widget
.
onTapSearchItem
!=
null
)
{
widget
.
onTapSearchItem
!();
widget
.
onTapSearchItem
!(
sModel
);
}
}
},
},
searchALlResults:
controller
.
searchALlResults
searchALlResults:
controller
.
searchALlResults
...
...
lib/pages/read_web/widgets/search_all.dart
浏览文件 @
cc22c4e3
part of
web
;
part of
web
;
class
BuildSearchAll
extends
StatefulWidget
{
class
BuildSearchAll
extends
StatefulWidget
{
final
void
Function
()?
onTap
;
final
void
Function
(
SearchAllModel
sModel
)?
onTap
;
final
List
<
SearchAllModel
>
searchALlResults
;
final
List
<
SearchAllModel
>
searchALlResults
;
const
BuildSearchAll
({
const
BuildSearchAll
({
...
@@ -23,14 +23,14 @@ class _BuildSearchAllState extends State<BuildSearchAll> {
...
@@ -23,14 +23,14 @@ class _BuildSearchAllState extends State<BuildSearchAll> {
return
GestureDetector
(
return
GestureDetector
(
onTap:
(){
onTap:
(){
if
(
widget
.
onTap
!=
null
){
if
(
widget
.
onTap
!=
null
){
widget
.
onTap
!();
widget
.
onTap
!(
model
);
}
}
},
},
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Container
(
// color: Colors.red
,
color:
Colors
.
white
,
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
top:
8
.
w
),
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
top:
8
.
w
),
// height: 110,
// height: 110,
child:
Column
(
child:
Column
(
...
...
lib/pages/user_about/view.dart
浏览文件 @
cc22c4e3
...
@@ -73,7 +73,7 @@ class _AboutPageState extends State<AboutPage> {
...
@@ -73,7 +73,7 @@ class _AboutPageState extends State<AboutPage> {
],
],
),
),
Gaps
.
hGaps10
,
Gaps
.
hGaps10
,
Text
(
'Copyright © 2024 Zijing Education. All rights reserved.
\n
清控紫荆(北京)教育科技股份有限公司
京
\n
ICP证150431号'
,
style:
TextStyle
(
color:
Colours
.
c9
,
fontSize:
9
.
w
),
textAlign:
TextAlign
.
center
,),
Text
(
'Copyright © 2024 Zijing Education. All rights reserved.
\n
清控紫荆(北京)教育科技股份有限公司
\n
京
ICP证150431号'
,
style:
TextStyle
(
color:
Colours
.
c9
,
fontSize:
9
.
w
),
textAlign:
TextAlign
.
center
,),
Gaps
.
vGaps25
,
Gaps
.
vGaps25
,
],
],
),
),
...
...
lib/pages/user_discuss_des/controller.dart
浏览文件 @
cc22c4e3
...
@@ -10,24 +10,123 @@ class UserDiscussDesController extends GetxController {
...
@@ -10,24 +10,123 @@ class UserDiscussDesController extends GetxController {
controlFinishLoad:
true
,
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
controlFinishRefresh:
true
,
);
);
late
TextEditingController
replyInput
=
TextEditingController
();
final
int
_limit
=
10
;
final
int
_limit
=
10
;
int
_page
=
1
;
int
_page
=
1
;
bool
_noMore
=
false
;
bool
_noMore
=
false
;
// 展示回复输入框
bool
showReply
=
false
;
// 当前要回复的模型
late
DiscussModel
discussModel
;
// 当前要回复父级的模型
late
DiscussModel
fatherDiscussModel
;
@override
@override
void
onReady
()
{
void
onReady
()
{
onRefresh
();
//
onRefresh();
super
.
onReady
();
super
.
onReady
();
}
}
@override
@override
void
onClose
()
{
void
onClose
()
{
refreshController
.
dispose
();
refreshController
.
dispose
();
replyInput
.
dispose
();
super
.
onClose
();
super
.
onClose
();
}
}
void
setShow
()
{
showReply
=
!
showReply
;
update
();
}
void
setDiscussModel
(
DiscussModel
model
){
discussModel
=
model
;
}
void
setFatherDiscussModel
(
DiscussModel
model
){
fatherDiscussModel
=
model
;
}
// 删除回复
Future
<
void
>
delComment
({
required
DiscussModel
discussModel
})
async
{
final
result
=
await
LibraryAPI
.
delComment
(
bookId:
model
.
bookId
!,
commentId:
discussModel
.
id
!);
if
(
result
){
discuss
.
remove
(
discussModel
);
Toast
.
show
(
'删除成功'
);
}
update
();
}
Future
<
bool
>
submit
()
async
{
Map
<
String
,
dynamic
>
contentMap
=
{
'text'
:
replyInput
.
text
,
'audio'
:[],
'image'
:[]
};
final
result
=
await
LibraryAPI
.
addDiscuss
(
bookId:
model
.
bookId
.
toString
(),
chapterId:
discussModel
.
chapterId
.
toString
(),
commentId:
discussModel
.
id
.
toString
(),
quoteContent:
''
,
title:
''
,
content:
jsonEncode
(
contentMap
)
);
if
(
result
){
Toast
.
show
(
'发表成功'
);
discussModel
.
replyNum
=
discussModel
.
replyNum
!
+
1
;
DiscussModel
tempModel
=
DiscussModel
.
fromJson
(
discussModel
.
toJson
());
tempModel
.
status
=
1
;
tempModel
.
commentsCheck
=
0
;
tempModel
.
isMy
=
1
;
NoteContentModel
contentModel
=
NoteContentModel
(
text:
MediaModel
(
content:
replyInput
.
text
,
privacyStatus:
1
)
);
tempModel
.
content
=
contentModel
;
tempModel
.
content
?.
text
?.
privacyStatus
=
1
;
tempModel
.
replacePersonName
=
discussModel
.
personName
;
tempModel
.
replacePersonPic
=
discussModel
.
personPic
;
tempModel
.
replyNum
=
0
;
fatherDiscussModel
.
commentAll
?.
add
(
tempModel
);
// fatherDiscussModel.replyNum = fatherDiscussModel.commentAll?.length;
}
else
{
Toast
.
show
(
'发表失败'
);
}
replyInput
.
text
=
''
;
update
();
// 重置所有信息
// reset();
// setShowChat(false);
return
result
;
}
Future
<
void
>
commentLove
({
required
DiscussModel
discussModel
})
async
{
num
type
=
0
;
if
(
discussModel
.
isPraise
==
0
){
type
=
1
;
}
final
result
=
await
LibraryAPI
.
commentLove
(
bookId:
model
.
bookId
!
,
type:
type
,
commentId:
discussModel
.
id
!);
if
(
result
){
num
goodNum
=
discussModel
.
goodNum
??
0
;
if
(
type
==
0
){
goodNum
--;
}
else
{
goodNum
++;
}
discussModel
.
isPraise
=
type
;
discussModel
.
goodNum
=
goodNum
;
}
update
();
}
/// 获取讨论详情
/// 获取讨论详情
Future
<
void
>
_getDiscuss
([
bool
isRefresh
=
false
])
async
{
Future
<
void
>
_getDiscuss
([
bool
isRefresh
=
false
])
async
{
...
...
lib/pages/user_discuss_des/index.dart
浏览文件 @
cc22c4e3
library
user_discuss_des
;
library
user_discuss_des
;
import
'dart:convert'
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_slidable/flutter_slidable.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'package:go_router/go_router.dart'
;
...
...
lib/pages/user_discuss_des/widgets/discuss.dart
浏览文件 @
cc22c4e3
差异被折叠。
点击展开。
lib/pages/user_discuss_des/widgets/list.dart
浏览文件 @
cc22c4e3
...
@@ -24,13 +24,95 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
...
@@ -24,13 +24,95 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
controller:
controller
.
refreshController
,
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
onLoading:
controller
.
onLoading
,
child:
ListView
.
builder
(
child:
Stack
(
itemBuilder:
(
BuildContext
context
,
int
index
){
children:
[
DiscussModel
model
=
controller
.
discuss
[
index
];
ListView
.
builder
(
return
BuildDiscuss
(
model:
model
,);
itemBuilder:
(
BuildContext
context
,
int
index
){
},
DiscussModel
model
=
controller
.
discuss
[
index
];
itemCount:
controller
.
discuss
.
length
,
return
BuildDiscuss
(
),
model:
model
,
bookId:
widget
.
model
.
bookId
.
toString
(),
userDiscussDesController:
controller
,
onTapDel:
(
DiscussModel
dModel
){
controller
.
delComment
(
discussModel:
dModel
);
},
);
},
itemCount:
controller
.
discuss
.
length
,
),
Visibility
(
visible:
controller
.
showReply
,
child:
Positioned
(
bottom:
0
,
left:
0
,
right:
0
,
top:
0
,
child:
GestureDetector
(
onTap:
(){
controller
.
setShow
();
},
child:
Container
(
color:
const
Color
(
0xFF000000
).
withOpacity
(
0.5
),
child:
SingleChildScrollView
(
reverse:
true
,
child:
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
(){},
child:
Container
(
color:
Colors
.
white
,
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Row
(
children:
[
Expanded
(
child:
TextField
(
autofocus:
true
,
maxLines:
null
,
controller:
controller
.
replyInput
,
decoration:
InputDecoration
(
border:
InputBorder
.
none
,
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
hintText:
'请输入内容'
,
hintStyle:
TextStyle
(
fontSize:
12
.
w
,
height:
1.5
,
color:
Colours
.
c9
,),
filled:
true
,
fillColor:
Colours
.
cF8
,
),
),
),
Gaps
.
hGaps10
,
GestureDetector
(
onTap:
(){
controller
.
submit
();
controller
.
setShow
();
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
15
.
w
),
color:
AppTheme
.
primary
,
gradient:
LinearGradient
(
colors:
[
const
Color
(
0xFFD53676
).
withOpacity
(
0.9
),
AppTheme
.
primary
]
,
// 不可点击时的颜色,透明度为0.7
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
),
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
13.5
.
w
,
vertical:
4
.
w
),
child:
Text
(
'发表'
,
style:
TextStyle
(
fontSize:
14
.
w
,
fontWeight:
Fonts
.
medium
,
color:
Colors
.
white
),),
),
)
],
),
),
),
),
),
),
),
),
)
],
)
),
),
);
);
}
}
...
...
lib/pages/user_msg/controller.dart
浏览文件 @
cc22c4e3
...
@@ -21,8 +21,13 @@ class MsgController extends GetxController {
...
@@ -21,8 +21,13 @@ class MsgController extends GetxController {
}
}
/// 消息未读变已读
/// 消息未读变已读
Future
<
bool
>
read
(
String
id
)
async
{
Future
<
bool
>
read
(
MsgModel
model
)
async
{
bool
result
=
await
CommonAPI
.
read
(
id:
id
);
final
result
=
await
CommonAPI
.
read
(
id:
model
.
id
.
toString
());
if
(
result
){
model
.
status
=
1
;
}
update
();
return
result
;
return
result
;
}
}
...
...
lib/pages/user_msg/view.dart
浏览文件 @
cc22c4e3
...
@@ -31,7 +31,7 @@ class MsgPage extends StatelessWidget {
...
@@ -31,7 +31,7 @@ class MsgPage extends StatelessWidget {
return
GestureDetector
(
return
GestureDetector
(
child:
BuildItem
(
model:
model
,),
child:
BuildItem
(
model:
model
,),
onTap:
()
async
{
onTap:
()
async
{
controller
.
read
(
model
.
id
.
toString
()
);
controller
.
read
(
model
);
if
(
model
.
type
==
1
){
if
(
model
.
type
==
1
){
// final result = await context.pushNamed(Routes.order);
// final result = await context.pushNamed(Routes.order);
...
@@ -46,7 +46,7 @@ class MsgPage extends StatelessWidget {
...
@@ -46,7 +46,7 @@ class MsgPage extends StatelessWidget {
final
result
=
await
context
.
pushNamed
(
Routes
.
orderAwaiting
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderAwaiting
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
// 充值订单
// 充值订单
...
@@ -54,7 +54,7 @@ class MsgPage extends StatelessWidget {
...
@@ -54,7 +54,7 @@ class MsgPage extends StatelessWidget {
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCoinAwaiting
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCoinAwaiting
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
...
@@ -65,14 +65,14 @@ class MsgPage extends StatelessWidget {
...
@@ -65,14 +65,14 @@ class MsgPage extends StatelessWidget {
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCancel
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCancel
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
else
{
else
{
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCoinCancel
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCoinCancel
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
}
}
...
@@ -82,14 +82,14 @@ class MsgPage extends StatelessWidget {
...
@@ -82,14 +82,14 @@ class MsgPage extends StatelessWidget {
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCompleted
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCompleted
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
else
{
else
{
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCoinCompleted
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderCoinCompleted
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
}
}
...
@@ -99,7 +99,7 @@ class MsgPage extends StatelessWidget {
...
@@ -99,7 +99,7 @@ class MsgPage extends StatelessWidget {
final
result
=
await
context
.
pushNamed
(
Routes
.
orderRefunded
,
final
result
=
await
context
.
pushNamed
(
Routes
.
orderRefunded
,
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
queryParameters:
{
'orderNum'
:
model
.
urlId
?.
orderNum
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
}
}
...
@@ -114,28 +114,28 @@ class MsgPage extends StatelessWidget {
...
@@ -114,28 +114,28 @@ class MsgPage extends StatelessWidget {
//
//
final
result
=
await
context
.
pushNamed
(
Routes
.
order
);
final
result
=
await
context
.
pushNamed
(
Routes
.
order
);
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
///TODO:
///TODO:
}
else
if
(
model
.
type
==
3
){
}
else
if
(
model
.
type
==
3
){
// 3 讨论有人回复的时候 (跳转对应书籍的讨论页面)
// 3 讨论有人回复的时候 (跳转对应书籍的讨论页面)
final
result
=
await
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
urlId
?.
bookId
.
toString
()});
final
result
=
await
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
model
.
urlId
?.
bookId
.
toString
()});
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
else
if
(
model
.
type
==
4
){
else
if
(
model
.
type
==
4
){
// 4 订单完成后有新的积分增加(跳转用户积分记录页)
// 4 订单完成后有新的积分增加(跳转用户积分记录页)
final
result
=
await
context
.
pushNamed
(
Routes
.
point
);
final
result
=
await
context
.
pushNamed
(
Routes
.
point
);
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
else
if
(
model
.
type
==
5
){
}
else
if
(
model
.
type
==
5
){
// 5后台直接发放给指定用户优惠券(跳转到用户优惠券页)
// 5后台直接发放给指定用户优惠券(跳转到用户优惠券页)
final
result
=
await
context
.
pushNamed
(
Routes
.
coupon
);
final
result
=
await
context
.
pushNamed
(
Routes
.
coupon
);
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
//
controller.onRefresh();
}
}
}
}
...
...
lib/pages/user_notes/view.dart
浏览文件 @
cc22c4e3
...
@@ -34,8 +34,11 @@ class _UserNotePageState extends State<UserNotePage> {
...
@@ -34,8 +34,11 @@ class _UserNotePageState extends State<UserNotePage> {
// shrinkWrap: true,
// shrinkWrap: true,
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
return
GestureDetector
(
return
GestureDetector
(
onTap:
(){
onTap:
()
async
{
context
.
pushNamed
(
Routes
.
noteDes
,
extra:
controller
.
notes
[
index
]);
final
result
=
await
context
.
pushNamed
(
Routes
.
noteDes
,
extra:
controller
.
notes
[
index
]);
if
(
result
==
true
){
controller
.
onRefresh
;
}
},
},
child:
BuildItem
(
model:
controller
.
notes
[
index
],)
child:
BuildItem
(
model:
controller
.
notes
[
index
],)
);
);
...
...
lib/pages/user_notes_des/controller.dart
浏览文件 @
cc22c4e3
...
@@ -63,12 +63,13 @@ class UserNotesDesController extends GetxController {
...
@@ -63,12 +63,13 @@ class UserNotesDesController extends GetxController {
// currentPlayMediaModel = mediaModel;
// currentPlayMediaModel = mediaModel;
}
}
void
delNotes
({
required
String
notesId
,
required
String
bookId
})
async
{
void
delNotes
({
required
NoteModel
noteModel
,
required
String
bookId
})
async
{
final
result
=
await
MineAPI
.
delNotes
(
notesId:
note
sId
,
bookId:
bookId
);
final
result
=
await
MineAPI
.
delNotes
(
notesId:
note
Model
.
notesId
.
toString
()
,
bookId:
bookId
);
if
(
result
){
if
(
result
){
Toast
.
show
(
'删除笔记成功'
);
Toast
.
show
(
'删除笔记成功'
);
onRefresh
(
);
notes
.
remove
(
noteModel
);
}
}
update
();
}
}
/// 获取笔记列表
/// 获取笔记列表
...
...
lib/pages/user_notes_des/view.dart
浏览文件 @
cc22c4e3
...
@@ -22,51 +22,57 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> {
...
@@ -22,51 +22,57 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
WillPopScope
(
appBar:
AppBar
(
onWillPop:
()
async
{
centerTitle:
true
,
context
.
pop
(
true
);
title:
const
Text
(
'笔记详情'
),
return
false
;
),
},
body:
DefaultTabController
(
child:
Scaffold
(
length:
tabs
.
length
,
appBar:
AppBar
(
child:
Column
(
centerTitle:
true
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
title:
const
Text
(
'笔记详情'
),
children:
[
),
BuildItem
(
model:
widget
.
model
),
body:
DefaultTabController
(
ClipRRect
(
length:
tabs
.
length
,
borderRadius:
const
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5
),
topRight:
Radius
.
circular
(
5
)),
child:
Column
(
child:
Container
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
width:
double
.
infinity
,
children:
[
color:
Colors
.
white
,
BuildItem
(
model:
widget
.
model
),
height:
35
.
w
,
ClipRRect
(
child:
TabBar
(
borderRadius:
const
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5
),
topRight:
Radius
.
circular
(
5
)),
indicator:
UnderlineTabIndicator
(
child:
Container
(
borderRadius:
BorderRadius
.
circular
(
0.75
),
width:
double
.
infinity
,
borderSide:
BorderSide
(
width:
1.5
.
w
,
color:
AppTheme
.
primary
),
color:
Colors
.
white
,
insets:
EdgeInsets
.
symmetric
(
horizontal:
22
.
w
),
// 设置标签下面指示器的水平内边距
height:
35
.
w
,
),
child:
TabBar
(
labelPadding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
),
indicator:
UnderlineTabIndicator
(
indicatorSize:
TabBarIndicatorSize
.
label
,
borderRadius:
BorderRadius
.
circular
(
0.75
),
indicatorColor:
AppTheme
.
primary
,
borderSide:
BorderSide
(
width:
1.5
.
w
,
color:
AppTheme
.
primary
),
indicatorWeight:
1.5
,
insets:
EdgeInsets
.
symmetric
(
horizontal:
22
.
w
),
// 设置标签下面指示器的水平内边距
labelStyle:
TextStyle
(
color:
AppTheme
.
primary
,
fontSize:
15
.
w
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),
),
unselectedLabelColor:
Colours
.
c9
,
labelPadding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
),
unselectedLabelStyle:
TextStyle
(
color:
Colours
.
c9
,
fontSize:
15
.
w
,
height:
1.5
),
indicatorSize:
TabBarIndicatorSize
.
label
,
isScrollable:
true
,
indicatorColor:
AppTheme
.
primary
,
tabs:
tabs
indicatorWeight:
1.5
,
labelStyle:
TextStyle
(
color:
AppTheme
.
primary
,
fontSize:
15
.
w
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),
unselectedLabelColor:
Colours
.
c9
,
unselectedLabelStyle:
TextStyle
(
color:
Colours
.
c9
,
fontSize:
15
.
w
,
height:
1.5
),
isScrollable:
true
,
tabs:
tabs
),
),
),
),
),
),
Expanded
(
Expanded
(
child:
TabBarView
(
child:
TabBarView
(
children:
List
.
generate
(
tabs
.
length
,
(
index
){
children:
List
.
generate
(
tabs
.
length
,
(
index
){
return
BuildListPage
(
tag:
'
$index
'
,
model:
widget
.
model
);
return
BuildListPage
(
tag:
'
$index
'
,
model:
widget
.
model
);
})
})
),
)
,
)
)
],
],
)
)
),
),
),
);
);
}
}
}
}
lib/pages/user_notes_des/widgets/list.dart
浏览文件 @
cc22c4e3
...
@@ -36,7 +36,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
...
@@ -36,7 +36,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
},
},
child:
BuildLine
(
model:
model
,
child:
BuildLine
(
model:
model
,
onTapDel:
(){
onTapDel:
(){
controller
.
delNotes
(
note
sId:
model
.
notesId
.
toString
()
,
bookId:
widget
.
model
.
bookId
.
toString
());
controller
.
delNotes
(
note
Model:
model
,
bookId:
widget
.
model
.
bookId
.
toString
());
},
},
),
),
);
);
...
@@ -50,7 +50,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
...
@@ -50,7 +50,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
},
},
child:
BuildHigh
(
model:
model
,
child:
BuildHigh
(
model:
model
,
onTapDel:
(){
onTapDel:
(){
controller
.
delNotes
(
note
sId:
model
.
notesId
.
toString
()
,
bookId:
widget
.
model
.
bookId
.
toString
());
controller
.
delNotes
(
note
Model:
model
,
bookId:
widget
.
model
.
bookId
.
toString
());
},
},
),
),
);
);
...
@@ -59,7 +59,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
...
@@ -59,7 +59,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
else
if
(
model
.
types
==
3
){
else
if
(
model
.
types
==
3
){
return
BuildNote
(
model:
model
,
return
BuildNote
(
model:
model
,
onTapDel:
(){
onTapDel:
(){
controller
.
delNotes
(
note
sId:
model
.
notesId
.
toString
()
,
bookId:
widget
.
model
.
bookId
.
toString
());
controller
.
delNotes
(
note
Model:
model
,
bookId:
widget
.
model
.
bookId
.
toString
());
},
},
onTapEdit:
(){
onTapEdit:
(){
context
.
pushNamed
(
Routes
.
editNote
,
extra:
model
,
queryParameters:
{
'book_id'
:
widget
.
model
.
bookId
.
toString
()});
context
.
pushNamed
(
Routes
.
editNote
,
extra:
model
,
queryParameters:
{
'book_id'
:
widget
.
model
.
bookId
.
toString
()});
...
...
lib/pages/user_notes_des/widgets/note.dart
浏览文件 @
cc22c4e3
...
@@ -72,7 +72,7 @@ class BuildNote extends StatelessWidget {
...
@@ -72,7 +72,7 @@ class BuildNote extends StatelessWidget {
// color: Colors.red,
// color: Colors.red,
color:
Colours
.
c3
color:
Colours
.
c3
),),
),),
Text
(
_showStatus
(
model
),
style:
TextStyle
(
fontSize:
1
4
.
w
,
height:
1.5
,
color:
AppTheme
.
primary
),),
Text
(
_showStatus
(
model
),
style:
TextStyle
(
fontSize:
1
1
.
w
,
height:
1.5
,
color:
AppTheme
.
primary
),),
],
],
),
),
Gaps
.
vGaps13
,
Gaps
.
vGaps13
,
...
@@ -102,15 +102,11 @@ class BuildNote extends StatelessWidget {
...
@@ -102,15 +102,11 @@ class BuildNote extends StatelessWidget {
String
_showText
(
NoteModel
discussModel
){
String
_showText
(
NoteModel
discussModel
){
String
text
=
''
;
String
text
=
''
;
// 是我的
// // 是我的
if
(
discussModel
.
isMy
==
1
){
// if(discussModel.isMy == 1){
text
=
'
${discussModel.noteContent?.text?.content}
'
;
// text = '${discussModel.noteContent?.text?.content}';
}
// }
else
{
text
=
'
${discussModel.noteContent?.text?.content}
'
;
if
(
discussModel
.
noteContent
?.
text
?.
privacyStatus
==
1
){
text
=
'
${discussModel.noteContent?.text?.content}
'
;
}
}
return
text
;
return
text
;
}
}
String
_showStatus
(
NoteModel
discussModel
){
String
_showStatus
(
NoteModel
discussModel
){
...
@@ -130,20 +126,6 @@ class BuildNote extends StatelessWidget {
...
@@ -130,20 +126,6 @@ class BuildNote extends StatelessWidget {
text
=
''
;
text
=
''
;
}
}
}
}
else
{
// 审核中
if
(
discussModel
.
noteContent
?.
text
?.
privacyStatus
==
0
||
discussModel
.
noteContent
?.
text
?.
privacyStatus
==
2
){
text
=
'(审核中)'
;
}
// 审核未通过
else
if
(
discussModel
.
noteContent
?.
text
?.
privacyStatus
==-
1
){
text
=
'(审核未通过)'
;
}
// 审核通过
else
{
text
=
''
;
}
}
return
text
;
return
text
;
}
}
// 图片
// 图片
...
@@ -184,7 +166,7 @@ class BuildNote extends StatelessWidget {
...
@@ -184,7 +166,7 @@ class BuildNote extends StatelessWidget {
child:
Container
(
child:
Container
(
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
color:
model
.
isMy
==
1
?
Colours
.
c9
.
withOpacity
(
0.5
):
Colours
.
c9
.
withOpacity
(
1
),
color:
model
.
isMy
==
1
?
Colours
.
c9
.
withOpacity
(
0.5
):
Colours
.
c9
.
withOpacity
(
1
),
child:
Text
(
'(审核中)'
,
style:
TextStyle
(
fontSize:
1
4
.
w
,
height:
1.5
,
color:
AppTheme
.
primary
),),
child:
Text
(
'(审核中)'
,
style:
TextStyle
(
fontSize:
1
1
.
w
,
height:
1.5
,
color:
AppTheme
.
primary
),),
)
)
),
),
),
),
...
...
lib/pages/user_order/widgets/awaiting.dart
浏览文件 @
cc22c4e3
...
@@ -128,7 +128,7 @@ class BuiltAwaiting extends StatelessWidget {
...
@@ -128,7 +128,7 @@ class BuiltAwaiting extends StatelessWidget {
child:
Align
(
child:
Align
(
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
child:
Text
(
child:
Text
(
'
${3
0
- (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}
分钟'
,
'
${3
1
- (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}
分钟'
,
style:
TextStyle
(
style:
TextStyle
(
color:
Colours
.
cC31F4C
,
color:
Colours
.
cC31F4C
,
fontSize:
10
.
w
,
fontSize:
10
.
w
,
...
...
lib/utils/constants.dart
浏览文件 @
cc22c4e3
...
@@ -21,6 +21,7 @@ const String kUserRechargeAgreement = '/html/agreement/rec_agreement.html';
...
@@ -21,6 +21,7 @@ const String kUserRechargeAgreement = '/html/agreement/rec_agreement.html';
// 错题详情页 html
// 错题详情页 html
const
String
kUserWrongDes
=
'
$kServerUrl
/html/app/evaluating_wrong.html'
;
const
String
kUserWrongDes
=
'
$kServerUrl
/html/app/evaluating_wrong.html'
;
// 阅读页 html
// 阅读页 html
const
String
kReadTestUnderLineBook
=
'http://150.158.138.40:9200/read-unline.html'
;
const
String
kReadBook
=
'
$kServerUrl
/html/app/read.html'
;
const
String
kReadBook
=
'
$kServerUrl
/html/app/read.html'
;
// 答题页
// 答题页
const
String
kAnswer
=
'
$kServerUrl
/html/app/evaluating.html'
;
const
String
kAnswer
=
'
$kServerUrl
/html/app/evaluating.html'
;
...
...
lib/utils/sql.dart
浏览文件 @
cc22c4e3
...
@@ -16,7 +16,7 @@ class SqlManager {
...
@@ -16,7 +16,7 @@ class SqlManager {
var
databasesPath
=
await
getDatabasesPath
();
var
databasesPath
=
await
getDatabasesPath
();
// var databasesPath = await Tools.getDirectory();
// var databasesPath = await Tools.getDirectory();
String
dbName
=
_name
;
String
dbName
=
_name
;
Console
.
log
(
'databasesPath---------
$databasesPath
'
);
Console
.
log
(
'
Sql-----------
databasesPath---------
$databasesPath
'
);
if
(
databasesPath
!=
null
)
{
if
(
databasesPath
!=
null
)
{
String
path
=
databasesPath
+
dbName
;
String
path
=
databasesPath
+
dbName
;
if
(
Platform
.
isIOS
)
{
if
(
Platform
.
isIOS
)
{
...
@@ -34,6 +34,7 @@ class SqlManager {
...
@@ -34,6 +34,7 @@ class SqlManager {
"chapter_id INTEGER, "
"chapter_id INTEGER, "
"node_id INTEGER, "
"node_id INTEGER, "
"is_open INTEGER, "
"is_open INTEGER, "
"del INTEGER, "
"color TEXT, "
"color TEXT, "
"content TEXT, "
"content TEXT, "
"upload INTEGER, "
"upload INTEGER, "
...
@@ -50,58 +51,143 @@ class SqlManager {
...
@@ -50,58 +51,143 @@ class SqlManager {
}
}
}
}
static
Future
<
Database
?>
getCurrentDatabase
()
async
{
if
(
_database
==
null
)
{
await
init
();
}
return
_database
;
}
// 关闭数据库
// 关闭数据库
static
Future
<
void
>
closeDatabase
()
async
{
static
Future
<
void
>
closeDatabase
()
async
{
await
_database
?.
close
();
await
_database
?.
close
();
}
}
// 查询划线高亮笔记
static
Future
<
Map
<
String
,
dynamic
>>
queryLocalNote
({
required
int
bookId
,
required
int
chapterId
})
async
{
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
Map
<
String
,
dynamic
>
returnMap
=
{};
// 划线
List
<
Map
<
String
,
dynamic
>>?
lineResult
=
await
db
?.
query
(
'members_book_notes'
,
where:
'book_id = ? and chapter_id = ? and types = ? and del = ?'
,
whereArgs:
[
bookId
,
chapterId
,
2
,
0
],
);
// 高亮
List
<
Map
<
String
,
dynamic
>>?
colorResult
=
await
db
?.
query
(
'members_book_notes'
,
where:
'book_id = ? and chapter_id = ? and types = ? and del = ?'
,
whereArgs:
[
bookId
,
chapterId
,
3
,
0
],
);
returnMap
[
'line_list'
]
=
lineResult
;
returnMap
[
'color_line'
]
=
colorResult
;
Console
.
log
(
'Sql-----------queryLocalNote---------------------
$returnMap
'
);
return
returnMap
;
}
// 添加划线高亮笔记
static
Future
<
int
>
addLocalNote
(
Map
<
String
,
dynamic
>
data
)
async
{
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
final
result
=
await
db
?.
insert
(
'members_book_notes'
,
data
,
conflictAlgorithm:
ConflictAlgorithm
.
replace
,
);
return
result
??
0
;
}
// 删除划线高亮笔记
static
Future
<
int
>
delLocalNote
({
required
int
id
})
async
{
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
final
result
=
await
db
?.
update
(
'members_book_notes'
,
{
'del'
:
1
},
where:
'id = ?'
,
whereArgs:
[
id
],
);
return
result
??
0
;
}
// 修改划线高亮笔记
static
Future
<
int
>
updateLocalNote
({
required
int
id
,
required
Map
<
String
,
dynamic
>
data
})
async
{
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
final
result
=
await
db
?.
update
(
'members_book_notes'
,
data
,
where:
'id = ?'
,
whereArgs:
[
id
],
);
return
result
??
0
;
}
// 查询所有没有上传的数据
// 查询所有没有上传的数据
static
Future
<
List
<
Map
<
String
,
dynamic
>>>
queryNoUploadData
()
async
{
static
Future
<
List
<
Map
<
String
,
dynamic
>>>
queryNoUploadData
()
async
{
List
<
Map
<
String
,
dynamic
>>
results
=
await
_database
!.
query
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
List
<
Map
<
String
,
dynamic
>>?
results
=
await
db
?.
query
(
'members_book_notes'
,
'members_book_notes'
,
where:
'upload = ?'
,
where:
'upload = ?
and del = ?
'
,
whereArgs:
[
0
],
whereArgs:
[
0
,
0
],
);
);
return
results
.
isNotEmpty
?
results
:
[];
return
results
??
[];
}
}
// 将所有 upload 为 0 的数据的 upload 字段值更新为 1
// 将所有 upload 为 0 的数据的 upload 字段值更新为 1
static
Future
<
void
>
updateUploadStatus
()
async
{
static
Future
<
void
>
updateUploadStatus
()
async
{
final
result
=
await
_database
!.
update
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
final
result
=
await
db
?.
update
(
'members_book_notes'
,
'members_book_notes'
,
{
'upload'
:
1
},
{
'upload'
:
1
},
where:
'upload = ?'
,
where:
'upload = ?'
,
whereArgs:
[
0
],
whereArgs:
[
0
],
);
);
Console
.
log
(
'
更新数据---------------
----------------
$result
'
);
Console
.
log
(
'
Sql---------------更新数据
----------------
$result
'
);
}
}
// 根据 book_id 查询当前读到的 章节
// 根据 book_id 查询当前读到的 章节
static
Future
<
String
>
queryReadHistoryByBookId
(
int
bookId
)
async
{
static
Future
<
String
>
queryReadHistoryByBookId
(
int
bookId
)
async
{
List
<
Map
<
String
,
dynamic
>>
results
=
await
_database
!.
query
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
List
<
Map
<
String
,
dynamic
>>?
results
=
await
db
?.
query
(
'read_history'
,
'read_history'
,
where:
'book_id = ?'
,
where:
'book_id = ?'
,
whereArgs:
[
bookId
],
whereArgs:
[
bookId
],
);
);
return
results
.
isNotEmpty
?
results
.
first
[
'chapter_id'
]
:
0
;
return
results
?.
first
[
'chapter_id'
].
toString
()
??
''
;
}
}
// 根据 book_id 写入当前读到的 章节
// 根据 book_id 写入当前读到的 章节
static
Future
<
int
>
updateReadHistoryByBookId
(
int
bookId
,
int
chapterId
)
async
{
static
Future
<
int
>
updateReadHistoryByBookId
(
int
bookId
,
int
chapterId
)
async
{
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
final
result
=
await
_database
!.
update
(
final
queryResult
=
await
queryReadHistoryByBookId
(
bookId
);
'members_book_notes'
,
if
(
queryResult
.
isEmpty
){
{
'chapter_id'
:
chapterId
},
Console
.
log
(
'Sql----------没有当前书籍的数据----------------------'
);
where:
'book_id = ?'
,
final
result
=
await
db
?.
insert
(
whereArgs:
[
bookId
],
'read_history'
,
);
{
'chapter_id'
:
chapterId
,
'book_id'
:
bookId
},
conflictAlgorithm:
ConflictAlgorithm
.
replace
,
return
result
;
);
Console
.
log
(
'Sql----------插入数据结果:
$result
----------------------'
);
return
result
??
0
;
}
else
{
Console
.
log
(
'Sql----------有当前书籍的数据----------------------'
);
final
result
=
await
db
!.
update
(
'read_history'
,
{
'chapter_id'
:
chapterId
},
where:
'book_id = ?'
,
whereArgs:
[
bookId
],
);
Console
.
log
(
'Sql----------更新数据结果:
$result
----------------------'
);
return
result
;
}
}
}
// 插入数据
// 插入数据
static
Future
<
bool
>
insertData
(
Map
<
String
,
dynamic
>
data
)
async
{
static
Future
<
bool
>
insertData
(
Map
<
String
,
dynamic
>
data
)
async
{
final
result
=
await
_database
?.
insert
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
final
result
=
await
db
?.
insert
(
'members_book_notes'
,
'members_book_notes'
,
data
,
data
,
conflictAlgorithm:
ConflictAlgorithm
.
replace
,
conflictAlgorithm:
ConflictAlgorithm
.
replace
,
...
@@ -116,22 +202,25 @@ class SqlManager {
...
@@ -116,22 +202,25 @@ class SqlManager {
// 查询所有数据
// 查询所有数据
static
Future
<
List
<
Map
<
String
,
dynamic
>>?>
queryAllData
()
async
{
static
Future
<
List
<
Map
<
String
,
dynamic
>>?>
queryAllData
()
async
{
return
await
_database
?.
query
(
'members_book_notes'
);
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
return
await
db
?.
query
(
'members_book_notes'
);
}
}
// 根据 ID 查询数据
// 根据 ID 查询数据
static
Future
<
Map
<
String
,
dynamic
>?>
queryDataById
(
int
id
)
async
{
static
Future
<
Map
<
String
,
dynamic
>?>
queryDataById
(
int
id
)
async
{
List
<
Map
<
String
,
dynamic
>>
results
=
await
_database
!.
query
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
List
<
Map
<
String
,
dynamic
>>?
results
=
await
db
?.
query
(
'members_book_notes'
,
'members_book_notes'
,
where:
'id = ?'
,
where:
'id = ?'
,
whereArgs:
[
id
],
whereArgs:
[
id
],
);
);
return
results
.
isNotEmpty
?
results
.
first
:
null
;
return
results
?.
first
??{}
;
}
}
// 更新数据
// 更新数据
static
Future
<
void
>
updateData
(
int
id
,
Map
<
String
,
dynamic
>
newData
)
async
{
static
Future
<
void
>
updateData
(
int
id
,
Map
<
String
,
dynamic
>
newData
)
async
{
await
_database
?.
update
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
await
db
?.
update
(
'members_book_notes'
,
'members_book_notes'
,
newData
,
newData
,
where:
'id = ?'
,
where:
'id = ?'
,
...
@@ -141,7 +230,8 @@ class SqlManager {
...
@@ -141,7 +230,8 @@ class SqlManager {
// 删除数据
// 删除数据
static
Future
<
void
>
deleteData
(
int
id
)
async
{
static
Future
<
void
>
deleteData
(
int
id
)
async
{
await
_database
?.
delete
(
Database
?
db
=
await
SqlManager
.
getCurrentDatabase
();
await
db
?.
delete
(
'members_book_notes'
,
'members_book_notes'
,
where:
'id = ?'
,
where:
'id = ?'
,
whereArgs:
[
id
],
whereArgs:
[
id
],
...
...
lib/utils/tools.dart
浏览文件 @
cc22c4e3
...
@@ -38,7 +38,7 @@ abstract class Tools {
...
@@ -38,7 +38,7 @@ abstract class Tools {
static
Future
<
String
>
getDirectory
()
async
{
static
Future
<
String
>
getDirectory
()
async
{
// getTemporaryDirectory
// getTemporaryDirectory
final
directory
=
await
get
ApplicationSupport
Directory
();
final
directory
=
await
get
ExternalStorage
Directory
();
return
directory
!.
path
;
return
directory
!.
path
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论