提交 1c4f51ca authored 作者: yueweilu's avatar yueweilu

1、删除笔记

2、笔记详情列表跳转阅读页
上级 c5ec2873
......@@ -49,7 +49,13 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
/// 获取目录信息
void getChapters() async {
final result = await LibraryAPI.chapters(bookId: bookId);
// final result = await LibraryAPI.chapters(bookId: bookId);
// for(int index = 0;index < chapters.length;index++){
// ChapterModel oModel = chapters[index];
// ChapterModel nModel = result[index];
// if()
// }
chapters = await LibraryAPI.chapters(bookId: bookId);
......
......@@ -113,7 +113,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
controller.getChapters();
}
}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()},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);
if (result == true){
controller.getChapters();
}
......@@ -201,7 +201,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
// 1免费 0 不免费
if(controller.bookDetails.isFree == 1){
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString(),'note_id':'0'},extra: controller.bookDetails);
if (result == true){
controller.getChapters();
}
......@@ -230,14 +230,14 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
}
}
else{
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString(),'note_id':'0'},extra: controller.bookDetails);
if (result == true){
controller.getChapters();
}
}
}
else{
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString(),'note_id':'0'},extra: controller.bookDetails);
if (result == true){
controller.getChapters();
}
......
......@@ -6,7 +6,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
String chapterId;
String chapterName;
final BookDetailModel bookDetailModel;
ReadController({required this.bookId, required this.chapterId,required this.chapterName,required this.bookDetailModel});
final String noteId;
ReadController({required this.bookId, required this.chapterId,required this.chapterName,required this.bookDetailModel,required this.noteId});
late InAppWebViewController webViewController;
......@@ -787,7 +788,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final result = await LibraryAPI.searchAll(
page: _searchPage,
limit: _searchLimit,
bookId: bookDetailModel.bookId.toString(),
bookId: bookId.toString(),
key: searchInput.text
);
Console.log('--------------------------------');
......
......@@ -4,13 +4,15 @@ class ReadPage extends StatefulWidget {
final String bookId;
final String chapterId;
final String chapterName;
final String noteId;
final BookDetailModel bookDetailModel;
const ReadPage({
Key? key,
required this.bookId,
required this.chapterId,
required this.chapterName,
required this.bookDetailModel
required this.bookDetailModel,
required this.noteId
}) : super(key: key);
@override
......@@ -31,7 +33,7 @@ class _ReadPageState extends State<ReadPage> {
return false;
},
child: GetBuilder<ReadController>(
init: ReadController(bookId: widget.bookId, chapterId: widget.chapterId,chapterName: widget.chapterName,bookDetailModel: widget.bookDetailModel),
init: ReadController(bookId: widget.bookId, chapterId: widget.chapterId,chapterName: widget.chapterName,bookDetailModel: widget.bookDetailModel,noteId: widget.noteId),
builder: (readController) => Scaffold(
appBar: CustomAppBar(
titleSpacing: 0,
......@@ -93,7 +95,7 @@ class _ReadPageState extends State<ReadPage> {
'chapter_id': readController.chapterId,
'token':UserStore.to.token
};
String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token}';
String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token},${readController.noteId}';
Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
......
......@@ -32,7 +32,7 @@ class BuildHigh extends StatelessWidget {
SlidableAction(
// An action can be bigger than the others.
onPressed: (BuildContext context){
onTapDel;
if (onTapDel !=null) onTapDel!();
},
backgroundColor: const Color(0xFFAE1414),
foregroundColor: Colors.white,
......
......@@ -32,7 +32,7 @@ class BuildLine extends StatelessWidget {
SlidableAction(
// An action can be bigger than the others.
onPressed: (BuildContext context){
onTapDel;
if (onTapDel !=null) onTapDel!();
},
backgroundColor: const Color(0xFFAE1414),
foregroundColor: Colors.white,
......@@ -52,7 +52,7 @@ class BuildLine extends StatelessWidget {
color: Colours.c3,
decoration: TextDecoration.underline,
// decorationColor: Colors.red,
decorationColor:Color(int.parse(model.color!.substring(1), radix: 16) + 0xFF000000),
decorationColor:model.color!.isEmpty?AppTheme.primary: Color(int.parse(model.color!.substring(1), radix: 16) + 0xFF000000),
decorationThickness: 2
),),
Gaps.vGaps8,
......
......@@ -31,7 +31,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
return GestureDetector(
// TODO:跳转阅读页对应位置
onTap: () async{
// final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': widget.model.bookId.toString(),'chapter_id': model.chapterId.toString(),'chapter_name':model.chapterName.toString(),'note_id':model.notesId.toString()},extra: BookDetailModel(bookId: widget.model.bookId));
},
child: BuildLine(model: model,
onTapDel: (){
......@@ -44,8 +44,8 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
else if(model.types == 2){
return GestureDetector(
// TODO:跳转阅读页对应位置
onTap: (){
// final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
onTap: () async{
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': widget.model.bookId.toString(),'chapter_id': model.chapterId.toString(),'chapter_name':model.chapterName.toString(),'note_id':model.notesId.toString()},extra: BookDetailModel(bookId: widget.model.bookId));
},
child: BuildHigh(model: model,
onTapDel: (){
......
......@@ -203,6 +203,7 @@ abstract class Routes {
chapterId: state.uri.queryParameters['chapter_id'].toString(),
chapterName: state.uri.queryParameters['chapter_name'].toString(),
bookDetailModel: state.extra as BookDetailModel,
noteId: state.uri.queryParameters['note_id'].toString(),
)
)
),
......
......@@ -285,6 +285,8 @@ class _RequestInterceptor extends Interceptor {
msg = '$statusCode - Bad gateway';
// CustomToast.fail(msg);
break;
case 3000:
default:
// if (code == 901) UserStore.to.logout();
// msg = response?.data?['msg']?.toString() ?? msg;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论