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

1、删除笔记

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