Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
ce4a0087
提交
ce4a0087
authored
2月 23, 2024
作者:
maodou
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/test' into test
上级
8a35a394
8adc506a
全部展开
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
144 行增加
和
22 行删除
+144
-22
library.dart
lib/apis/library.dart
+16
-0
global.dart
lib/global.dart
+0
-2
index.dart
lib/pages/bai_dict/index.dart
+11
-0
view.dart
lib/pages/bai_dict/view.dart
+31
-0
controller.dart
lib/pages/book_detail/controller.dart
+2
-0
controller.dart
lib/pages/library/controller.dart
+35
-15
index.dart
lib/pages/library/index.dart
+2
-0
controller.dart
lib/pages/read_web/controller.dart
+0
-0
index.dart
lib/pages/read_web/index.dart
+1
-0
view.dart
lib/pages/read_web/view.dart
+26
-0
index.dart
lib/routes/index.dart
+1
-0
routes.dart
lib/routes/routes.dart
+13
-1
sql.dart
lib/utils/sql.dart
+6
-4
没有找到文件。
lib/apis/library.dart
浏览文件 @
ce4a0087
...
...
@@ -302,5 +302,20 @@ abstract class LibraryAPI {
return
false
;
}
/// 15、批量上传离线笔记、高亮、划线的内容
static
Future
<
bool
>
uploadOffline
({
required
String
node
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/book/Information/addOfflineNotes'
,
params:
{
'nodes_list'
:
node
,
},
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
}
return
false
;
}
}
\ No newline at end of file
lib/global.dart
浏览文件 @
ce4a0087
...
...
@@ -18,8 +18,6 @@ class Global {
// print('本地服务器已成功启动,根目录为: $documentRoot');
SqlManager
.
init
();
WidgetsBinding
.
instance
?.
addObserver
(
AppLifecycleObserver
());
await
Future
.
wait
([
...
...
lib/pages/bai_dict/index.dart
0 → 100644
浏览文件 @
ce4a0087
library
bai_dict
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
part
'view.dart'
;
\ No newline at end of file
lib/pages/bai_dict/view.dart
0 → 100644
浏览文件 @
ce4a0087
part of
bai_dict
;
class
BaiDictPage
extends
StatefulWidget
{
final
String
keyword
;
const
BaiDictPage
({
Key
?
key
,
required
this
.
keyword
})
:
super
(
key:
key
);
@override
State
<
BaiDictPage
>
createState
()
=>
_BaiKePageState
();
}
class
_BaiKePageState
extends
State
<
BaiDictPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
centerTitle:
false
,
title:
Text
(
'
$widget
.keyword'
,
style:
TextStyle
(
fontSize:
14
.
w
,
fontWeight:
Fonts
.
medium
,
color:
Colours
.
c3
),),
),
body:
InAppWebView
(
initialUrlRequest:
URLRequest
(
url:
Uri
.
parse
(
'https://hanyu.baidu.com/hanyu-page/zici/s?from=aladdin&query=
${widget.keyword}
&srcid=51368&wd=
${widget.keyword}
&ptype=zici'
),
),
),
);
}
}
\ No newline at end of file
lib/pages/book_detail/controller.dart
浏览文件 @
ce4a0087
...
...
@@ -56,6 +56,8 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
/// 获取图书详细信息
void
getBookDetails
()
async
{
bookDetails
=
await
LibraryAPI
.
details
(
bookId:
bookId
);
// 将阅读最后章节写入到数据库
SqlManager
.
updateReadHistoryByBookId
(
int
.
parse
(
bookId
),
bookDetails
.
chapterId
!.
toInt
());
update
();
}
/// 收藏 与 取消收藏
...
...
lib/pages/library/controller.dart
浏览文件 @
ce4a0087
...
...
@@ -73,16 +73,38 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
vsync:
this
,
duration:
const
Duration
(
milliseconds:
100
),
);
super
.
onInit
();
}
@override
void
onReady
()
{
void
onReady
()
async
{
// 获取标签数据
_getLabels
();
_getAds
();
onRefresh
();
Map
<
String
,
dynamic
>
data
=
{
'types'
:
1
,
'book_id'
:
175
,
'chapter_id'
:
334
,
'is_open'
:
1
,
'color'
:
'blue'
,
'content'
:
'This is a note content'
,
'upload'
:
0
,
'positioning'
:
'top'
,
'note'
:
'This is a note'
,
'node_id'
:
0
,
};
await
SqlManager
.
insertData
(
data
);
final
result
=
await
Tools
.
checkCurrentNetStatus
();
// 有网络的时候上传 笔记
if
(
result
){
upload
();
}
super
.
onReady
();
}
...
...
@@ -176,20 +198,6 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
/// 获取tab分类数据
void
_getTabs
()
async
{
Map
<
String
,
dynamic
>
data
=
{
'types'
:
1
,
'book_id'
:
123
,
'chapter_id'
:
456
,
// 'is_open': 1,
// 'color': 'blue',
// 'content': 'This is a note content',
// 'del': 0,
// 'positioning': 'top',
// 'note': 'This is a note',
};
await
SqlManager
.
insertData
(
data
);
categories
=
await
LibraryAPI
.
categories
();
tabController
.
dispose
();
tabController
=
TabController
(
length:
categories
.
length
,
vsync:
this
);
...
...
@@ -232,6 +240,18 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
}
}
/// 批量上传离线笔记、高亮、划线的内容
void
upload
()
async
{
List
<
Map
<
String
,
dynamic
>>
data
=
await
SqlManager
.
queryNoUploadData
();
Console
.
log
(
'查询到的数据----------------------------------------------------
$data
'
);
final
result
=
await
LibraryAPI
.
uploadOffline
(
node:
jsonEncode
(
data
));
// 上传成功后 更新数据库中的字段
if
(
result
)
{
SqlManager
.
updateUploadStatus
();
}
}
/// 获取图书列表数据
Future
<
void
>
_getBooks
([
bool
isRefresh
=
false
])
async
{
...
...
lib/pages/library/index.dart
浏览文件 @
ce4a0087
library
library
;
import
'dart:convert'
;
import
'package:azlistview/azlistview.dart'
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
...
...
lib/pages/read_web/controller.dart
浏览文件 @
ce4a0087
差异被折叠。
点击展开。
lib/pages/read_web/index.dart
浏览文件 @
ce4a0087
...
...
@@ -18,6 +18,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import
'package:flutter_sound/public/flutter_sound_recorder.dart'
;
import
'package:flutter_sound_platform_interface/flutter_sound_platform_interface.dart'
;
import
'package:flutter_sound_platform_interface/flutter_sound_recorder_platform_interface.dart'
;
import
'package:flutter_tts/flutter_tts.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'package:intl/intl.dart'
;
...
...
lib/pages/read_web/view.dart
浏览文件 @
ce4a0087
...
...
@@ -102,6 +102,7 @@ class _ReadPageState extends State<ReadPage> {
// 监听笔记回调
controller
.
addJavaScriptHandler
(
handlerName:
'noteCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听笔记回调------------------------------------------------
$args
'
);
readController
.
noteTitle
=
args
.
first
;
readController
.
setShowChat
(
true
);
readController
.
setChatType
(
1
);
...
...
@@ -110,16 +111,41 @@ class _ReadPageState extends State<ReadPage> {
// 监听百科回调
controller
.
addJavaScriptHandler
(
handlerName:
'baikeCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听百科回调------------------------------------------------
$args
'
);
context
.
pushNamed
(
Routes
.
baiKe
,
queryParameters:
{
'keyword'
:
args
.
first
});
});
// 监听字典回调
controller
.
addJavaScriptHandler
(
handlerName:
'dicCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听百科回调------------------------------------------------
$args
'
);
context
.
pushNamed
(
Routes
.
baiDict
,
queryParameters:
{
'keyword'
:
args
.
first
});
});
// 监听朗读回调
controller
.
addJavaScriptHandler
(
handlerName:
'readCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听朗读回调------------------------------------------------
$args
'
);
readController
.
speak
(
args
.
first
.
toString
());
// readController.speak('中国共产党(英文名:the Communist Party of China,简写CPC),'
// '创建于1921年7月23日,1921年中国共产党成立后,确立了新民主主义革命的正确道路,让灾难深重的中'
// '国人民看到了新的希望、有了新的依靠。我们党探索出农村包围城市、武装夺取政权的正确革命道路,“唤起工'
// '农千百万”“夺过鞭子揍敌人”,经过土地革命战争、抗日战争、解放战争,推翻了压在中国人民头上的帝国主义、'
// '封建主义、官僚资本主义“三座大山”,建立了人民当家作主的中华人民共和国,彻底结束了近代以来中国内忧外患、积贫积弱的悲惨境地,开启了中华民族发展进步的新纪元'
// );
});
// 监听讨论回调
controller
.
addJavaScriptHandler
(
handlerName:
'discussCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听讨论回调------------------------------------------------
$args
'
);
readController
.
setShowChat
(
true
);
readController
.
setChatType
(
0
);
readController
.
titleInput
.
text
=
args
.
first
.
toString
();
});
// 监听 上一节 下一节
controller
.
addJavaScriptHandler
(
handlerName:
'readCallBack'
,
callback:
(
args
){
Console
.
log
(
'监听 上一节 下一节------------------------------------------------
$args
'
);
});
},
),
// AnimatedPositioned(
...
...
lib/routes/index.dart
浏览文件 @
ce4a0087
...
...
@@ -45,6 +45,7 @@ import 'package:go_router/go_router.dart';
import
'../models/index.dart'
;
import
'../pages/ad_detail/index.dart'
;
import
'../pages/bai_dict/index.dart'
;
import
'../pages/bai_ke/index.dart'
;
import
'../pages/read_web/index.dart'
;
import
'../pages/user_edit_note/index.dart'
;
...
...
lib/routes/routes.dart
浏览文件 @
ce4a0087
...
...
@@ -40,7 +40,8 @@ abstract class Routes {
/// 图书馆模块
// 百科
static
const
baiKe
=
'bai_ke'
;
// 字典
static
const
baiDict
=
'bai_dict'
;
/// 书架模块
static
const
creditPoints
=
'credit_points'
;
...
...
@@ -595,6 +596,17 @@ abstract class Routes {
child:
AdDetailPage
(
adModel:
state
.
extra
as
AdModel
,),
)
),
GoRoute
(
// 字典
path:
'/
$baiDict
'
,
name:
baiDict
,
pageBuilder:
(
context
,
state
)
=>
CupertinoPage
(
name:
state
.
uri
.
toString
(),
key:
state
.
pageKey
,
child:
BaiDictPage
(
keyword:
state
.
uri
.
queryParameters
[
'keyword'
].
toString
(),
)
)
),
]
);
...
...
lib/utils/sql.dart
浏览文件 @
ce4a0087
...
...
@@ -32,6 +32,7 @@ class SqlManager {
"types INTEGER, "
"book_id INTEGER, "
"chapter_id INTEGER, "
"node_id INTEGER, "
"is_open INTEGER, "
"color TEXT, "
"content TEXT, "
...
...
@@ -65,15 +66,16 @@ class SqlManager {
}
// 将所有 upload 为 0 的数据的 upload 字段值更新为 1
static
Future
<
void
>
updateUploadStatus
()
async
{
await
_database
!.
update
(
final
result
=
await
_database
!.
update
(
'members_book_notes'
,
{
'upload'
:
1
},
where:
'upload = ?'
,
whereArgs:
[
0
],
);
Console
.
log
(
'更新数据-------------------------------
$result
'
);
}
// 根据 book_id 查询当前读到的 章节
static
Future
<
int
>
queryData
ByBookId
(
int
bookId
)
async
{
static
Future
<
String
>
queryReadHistory
ByBookId
(
int
bookId
)
async
{
List
<
Map
<
String
,
dynamic
>>
results
=
await
_database
!.
query
(
'read_history'
,
where:
'book_id = ?'
,
...
...
@@ -83,9 +85,9 @@ class SqlManager {
}
// 根据 book_id 写入当前读到的 章节
static
Future
<
int
?>
updateReadHistor
yBookId
(
int
bookId
,
int
chapterId
)
async
{
static
Future
<
int
>
updateReadHistoryB
yBookId
(
int
bookId
,
int
chapterId
)
async
{
final
result
=
await
_database
?
.
update
(
final
result
=
await
_database
!
.
update
(
'members_book_notes'
,
{
'chapter_id'
:
chapterId
},
where:
'book_id = ?'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论