Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
e9ef4778
提交
e9ef4778
authored
2月 26, 2024
作者:
maodou
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/test' into test
上级
c183137c
eaf67f06
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
496 行增加
和
43 行删除
+496
-43
account.dart
lib/apis/account.dart
+20
-0
library.dart
lib/apis/library.dart
+24
-0
library.dart
lib/models/library.dart
+42
-0
index.dart
lib/pages/answer/index.dart
+9
-0
view.dart
lib/pages/answer/view.dart
+38
-0
controller.dart
lib/pages/forget_pwd/controller.dart
+7
-0
view.dart
lib/pages/forget_pwd/view.dart
+8
-2
controller.dart
lib/pages/help_cneter_content/controller.dart
+3
-0
view.dart
lib/pages/help_cneter_content/view.dart
+3
-3
controller.dart
lib/pages/read_web/controller.dart
+61
-0
discuss_controller.dart
lib/pages/read_web/discuss_controller.dart
+66
-0
note_controller.dart
lib/pages/read_web/note_controller.dart
+54
-0
view.dart
lib/pages/read_web/view.dart
+22
-4
category.dart
lib/pages/read_web/widgets/category.dart
+11
-6
discuss.dart
lib/pages/read_web/widgets/discuss.dart
+10
-5
note.dart
lib/pages/read_web/widgets/note.dart
+10
-6
search_all.dart
lib/pages/read_web/widgets/search_all.dart
+73
-13
index.dart
lib/pages/study_history/index.dart
+2
-0
view.dart
lib/pages/study_history/view.dart
+6
-1
item.dart
lib/pages/study_history/widgets/item.dart
+9
-2
index.dart
lib/routes/index.dart
+1
-0
routes.dart
lib/routes/routes.dart
+14
-0
http.dart
lib/services/http.dart
+1
-1
constants.dart
lib/utils/constants.dart
+2
-0
没有找到文件。
lib/apis/account.dart
浏览文件 @
e9ef4778
...
@@ -110,6 +110,26 @@ abstract class AccountAPI {
...
@@ -110,6 +110,26 @@ abstract class AccountAPI {
return
false
;
return
false
;
}
}
/// 6、验证验证码
static
Future
checkCode
({
required
String
phone
,
required
String
code
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/login/checkPhoneCode'
,
params:
{
'phone'
:
phone
,
'code'
:
code
},
excludeToken:
true
,
showLoading:
true
,
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
}
return
false
;
}
...
...
lib/apis/library.dart
浏览文件 @
e9ef4778
...
@@ -318,4 +318,27 @@ abstract class LibraryAPI {
...
@@ -318,4 +318,27 @@ abstract class LibraryAPI {
return
false
;
return
false
;
}
}
/// 16、 搜索全文
static
Future
<
List
<
SearchAllModel
>>
searchAll
({
int
page
=
1
,
int
limit
=
10
,
required
String
bookId
,
required
String
key
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/book/Information/searchContent'
,
params:
{
'page'
:
page
,
'page_size'
:
limit
,
'book_id'
:
bookId
,
'key'
:
key
},
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
)
{
return
SearchAllModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
});
}
}
}
\ No newline at end of file
lib/models/library.dart
浏览文件 @
e9ef4778
...
@@ -531,4 +531,46 @@ class OssModel {
...
@@ -531,4 +531,46 @@ class OssModel {
}
}
class
SearchAllModel
{
SearchAllModel
({
this
.
bookId
,
this
.
chapterId
,
this
.
chapterName
,
this
.
key
,
this
.
combinedContent
,});
SearchAllModel
.
fromJson
(
dynamic
json
)
{
bookId
=
json
[
'book_id'
];
chapterId
=
json
[
'chapter_id'
];
chapterName
=
json
[
'chapter_name'
];
key
=
json
[
'key'
];
combinedContent
=
json
[
'combined_content'
];
}
String
?
bookId
;
num
?
chapterId
;
String
?
chapterName
;
String
?
key
;
String
?
combinedContent
;
SearchAllModel
copyWith
({
String
?
bookId
,
num
?
chapterId
,
String
?
chapterName
,
String
?
key
,
String
?
combinedContent
,
})
=>
SearchAllModel
(
bookId:
bookId
??
this
.
bookId
,
chapterId:
chapterId
??
this
.
chapterId
,
chapterName:
chapterName
??
this
.
chapterName
,
key:
key
??
this
.
key
,
combinedContent:
combinedContent
??
this
.
combinedContent
,
);
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
map
[
'book_id'
]
=
bookId
;
map
[
'chapter_id'
]
=
chapterId
;
map
[
'chapter_name'
]
=
chapterName
;
map
[
'key'
]
=
key
;
map
[
'combined_content'
]
=
combinedContent
;
return
map
;
}
}
lib/pages/answer/index.dart
0 → 100644
浏览文件 @
e9ef4778
library
answer
;
import
'package:flutter/material.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'../../utils/index.dart'
;
part
'view.dart'
;
\ No newline at end of file
lib/pages/answer/view.dart
0 → 100644
浏览文件 @
e9ef4778
part of
answer
;
class
AnswerPage
extends
StatefulWidget
{
final
Map
<
String
,
String
>
params
;
const
AnswerPage
({
Key
?
key
,
required
this
.
params
})
:
super
(
key:
key
);
@override
State
<
AnswerPage
>
createState
()
=>
_AnswerPageState
();
}
class
_AnswerPageState
extends
State
<
AnswerPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'知识测评'
),
),
body:
InAppWebView
(
initialUrlRequest:
URLRequest
(
url:
Uri
.
parse
(
widget
.
params
[
'url'
]??
''
),
),
onLoadStop:
(
controller
,
url
)
{
String
str
=
'
${widget.params['book_id']}
,
${widget.params['chapter_id']}
,
${widget.params['token']}
,
${widget.params['position']}
'
;
Console
.
log
(
'知识测评--------传给前端的参数--------------------------------
$str
'
);
controller
.
evaluateJavascript
(
source
:
'callbackInFlutterComponent("
$str
");'
);
},
onConsoleMessage:
(
controller
,
consoleMessage
)
{
// 接收从 WebView 发送的消息
Console
.
log
(
"知识测评-------Received message from WebView-----------------------------:
${consoleMessage.message}
"
);
},
)
);
}
}
lib/pages/forget_pwd/controller.dart
浏览文件 @
e9ef4778
...
@@ -84,6 +84,12 @@ class ForgetPwdController extends GetxController {
...
@@ -84,6 +84,12 @@ class ForgetPwdController extends GetxController {
else
{
else
{
Toast
.
show
(
'发送失败'
);
Toast
.
show
(
'发送失败'
);
}
}
}
Future
<
bool
>
checkCode
()
async
{
final
result
=
await
AccountAPI
.
checkCode
(
phone:
phoneInput
.
text
,
code:
codeInput
.
text
);
return
result
;
}
}
}
}
\ No newline at end of file
lib/pages/forget_pwd/view.dart
浏览文件 @
e9ef4778
...
@@ -72,8 +72,14 @@ class _ForgetPwdPageState extends State<ForgetPwdPage> {
...
@@ -72,8 +72,14 @@ class _ForgetPwdPageState extends State<ForgetPwdPage> {
CustomGradientButton
(
CustomGradientButton
(
text:
'下一步'
,
text:
'下一步'
,
isEnabled:
controller
.
enable
,
isEnabled:
controller
.
enable
,
onPressed:
()
{
onPressed:
()
async
{
context
.
pushNamed
(
Routes
.
resetPwd
,
queryParameters:
{
'phone'
:
controller
.
phoneInput
.
text
,
'code'
:
controller
.
codeInput
.
text
});
final
result
=
await
controller
.
checkCode
();
if
(
result
){
context
.
pushNamed
(
Routes
.
resetPwd
,
queryParameters:
{
'phone'
:
controller
.
phoneInput
.
text
,
'code'
:
controller
.
codeInput
.
text
});
}
else
{
Toast
.
show
(
'验证码错误'
);
}
},
},
)
)
],
],
...
...
lib/pages/help_cneter_content/controller.dart
浏览文件 @
e9ef4778
...
@@ -6,6 +6,8 @@ class HelpCenterContentController extends GetxController {
...
@@ -6,6 +6,8 @@ class HelpCenterContentController extends GetxController {
HelpCenterContentController
(
this
.
id
);
HelpCenterContentController
(
this
.
id
);
late
InAppWebViewController
webViewController
;
@override
@override
void
onReady
()
{
void
onReady
()
{
_getHelpCenterContent
(
id
);
_getHelpCenterContent
(
id
);
...
@@ -15,6 +17,7 @@ class HelpCenterContentController extends GetxController {
...
@@ -15,6 +17,7 @@ class HelpCenterContentController extends GetxController {
/// 获取帮助中心内容
/// 获取帮助中心内容
void
_getHelpCenterContent
(
String
id
)
async
{
void
_getHelpCenterContent
(
String
id
)
async
{
helpCenterContentModel
=
await
MineAPI
.
helpCenterContent
(
id
);
helpCenterContentModel
=
await
MineAPI
.
helpCenterContent
(
id
);
webViewController
.
loadData
(
data:
helpCenterContentModel
.
helpContent
??
''
);
update
();
update
();
}
}
}
}
lib/pages/help_cneter_content/view.dart
浏览文件 @
e9ef4778
...
@@ -20,14 +20,14 @@ class _HelpCenterContentPageState extends State<HelpCenterContentPage> {
...
@@ -20,14 +20,14 @@ class _HelpCenterContentPageState extends State<HelpCenterContentPage> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
HelpCenterContentController
>(
return
GetBuilder
<
HelpCenterContentController
>(
init:
HelpCenterContentController
(
widget
.
id
),
init:
HelpCenterContentController
(
widget
.
id
),
builder:
(
c
ontroller
)
=>
Scaffold
(
builder:
(
helpC
ontroller
)
=>
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
centerTitle:
true
,
centerTitle:
true
,
title:
Text
(
widget
.
title
),
title:
Text
(
widget
.
title
),
),
),
body:
InAppWebView
(
body:
InAppWebView
(
onWebViewCreated:
(
InAppWebViewController
w
controller
){
onWebViewCreated:
(
InAppWebViewController
controller
){
wcontroller
.
loadData
(
data:
controller
.
helpCenterContentModel
.
helpContent
??
''
,)
;
helpController
.
webViewController
=
controller
;
},
},
),
),
...
...
lib/pages/read_web/controller.dart
浏览文件 @
e9ef4778
...
@@ -66,6 +66,21 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -66,6 +66,21 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 是否展示搜索结果
// 是否展示搜索结果
bool
showSearch
=
false
;
bool
showSearch
=
false
;
final
int
_searchLimit
=
10
;
int
_searchPage
=
1
;
bool
_searchNoMore
=
false
;
// 搜全文
List
<
SearchAllModel
>
searchALlResults
=
[];
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
late
TextEditingController
searchInput
=
TextEditingController
();
///------------------------------------------ 页面 生命周期--------------------------------------------------------
///------------------------------------------ 页面 生命周期--------------------------------------------------------
@override
@override
...
@@ -112,6 +127,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -112,6 +127,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
titleInput
.
dispose
();
titleInput
.
dispose
();
contentInput
.
dispose
();
contentInput
.
dispose
();
flutterTts
.
stop
();
flutterTts
.
stop
();
searchInput
.
dispose
();
super
.
onClose
();
super
.
onClose
();
}
}
///------------------------------------------ 页面 生命周期--------------------------------------------------------
///------------------------------------------ 页面 生命周期--------------------------------------------------------
...
@@ -729,6 +745,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -729,6 +745,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
update
();
update
();
}
}
/// 添加阅读时长
/// 添加阅读时长
void
_addReadTime
({
required
type
})
async
{
void
_addReadTime
({
required
type
})
async
{
final
result
=
await
LibraryAPI
.
addReadTime
(
bookId:
bookId
,
readTypes:
type
);
final
result
=
await
LibraryAPI
.
addReadTime
(
bookId:
bookId
,
readTypes:
type
);
...
@@ -757,6 +774,50 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -757,6 +774,50 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
/// 搜全文
Future
<
void
>
searchAll
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_searchPage
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
searchAll
(
page:
_searchPage
,
limit:
_searchLimit
,
bookId:
bookDetailModel
.
bookId
.
toString
(),
key:
searchInput
.
text
);
Console
.
log
(
'--------------------------------'
);
// 如果是刷新 清理数据
if
(
isRefresh
)
searchALlResults
.
clear
();
searchALlResults
.
addAll
(
result
);
_searchPage
++;
_searchNoMore
=
result
.
length
<
_searchLimit
;
update
();
}
void
onRefreshSearch
()
async
{
try
{
await
searchAll
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
Console
.
log
(
'--error-----------------------------
$error
-'
);
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoadingSearch
()
async
{
if
(
_searchNoMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
searchAll
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
///------------------------------------------ app 生命周期--------------------------------------------------------
///------------------------------------------ app 生命周期--------------------------------------------------------
...
...
lib/pages/read_web/discuss_controller.dart
浏览文件 @
e9ef4778
...
@@ -18,6 +18,11 @@ class DiscussController extends GetxController {
...
@@ -18,6 +18,11 @@ class DiscussController extends GetxController {
int
_page
=
1
;
int
_page
=
1
;
bool
_noMore
=
false
;
bool
_noMore
=
false
;
final
int
_searchLimit
=
10
;
int
_searchPage
=
1
;
bool
_searchNoMore
=
false
;
// 展示回复输入框
// 展示回复输入框
bool
showReply
=
false
;
bool
showReply
=
false
;
// 当前要回复的模型
// 当前要回复的模型
...
@@ -25,6 +30,9 @@ class DiscussController extends GetxController {
...
@@ -25,6 +30,9 @@ class DiscussController extends GetxController {
// 是否展示搜索结果
// 是否展示搜索结果
bool
showSearch
=
false
;
bool
showSearch
=
false
;
// 搜全文
List
<
SearchAllModel
>
searchALlResults
=
[];
@override
@override
void
onReady
()
{
void
onReady
()
{
...
@@ -53,6 +61,7 @@ class DiscussController extends GetxController {
...
@@ -53,6 +61,7 @@ class DiscussController extends GetxController {
update
();
update
();
}
}
Future
<
bool
>
submit
()
async
{
Future
<
bool
>
submit
()
async
{
Map
<
String
,
dynamic
>
contentMap
=
{
Map
<
String
,
dynamic
>
contentMap
=
{
...
@@ -82,6 +91,52 @@ class DiscussController extends GetxController {
...
@@ -82,6 +91,52 @@ class DiscussController extends GetxController {
return
result
;
return
result
;
}
}
/// 搜全文
Future
<
void
>
searchAll
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_searchPage
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
searchAll
(
page:
_searchPage
,
limit:
_searchLimit
,
bookId:
bookDetailModel
.
bookId
.
toString
(),
key:
searchInput
.
text
);
testData
();
Console
.
log
(
'--------------------------------'
);
// 如果是刷新 清理数据
if
(
isRefresh
)
searchALlResults
.
clear
();
searchALlResults
.
addAll
(
result
);
_searchPage
++;
_searchNoMore
=
result
.
length
<
_searchLimit
;
update
();
}
void
onRefreshSearch
()
async
{
try
{
await
searchAll
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
Console
.
log
(
'--error-----------------------------
$error
-'
);
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoadingSearch
()
async
{
if
(
_searchNoMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
searchAll
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
/// 获取讨论详情
/// 获取讨论详情
Future
<
void
>
_getDiscuss
([
bool
isRefresh
=
false
])
async
{
Future
<
void
>
_getDiscuss
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
if
(
isRefresh
)
_page
=
1
;
...
@@ -126,4 +181,14 @@ class DiscussController extends GetxController {
...
@@ -126,4 +181,14 @@ class DiscussController extends GetxController {
}
}
}
}
void
testData
(){
// String? bookId, num? chapterId, String? chapterName, String? key, String? combinedContent,
searchALlResults
.
addAll
([
SearchAllModel
(
bookId:
'123'
,
chapterId:
333
,
chapterName:
'你好'
,
key:
'我是'
,
combinedContent:
'我是谁啊'
),
SearchAllModel
(
bookId:
'13'
,
chapterId:
22
,
chapterName:
'哈哈哈'
,
key:
'你是'
,
combinedContent:
'你是谁啊'
)
]);
}
}
}
\ No newline at end of file
lib/pages/read_web/note_controller.dart
浏览文件 @
e9ef4778
...
@@ -12,6 +12,8 @@ class NoteController extends GetxController {
...
@@ -12,6 +12,8 @@ class NoteController extends GetxController {
controlFinishRefresh:
true
,
controlFinishRefresh:
true
,
);
);
late
TextEditingController
searchInput
=
TextEditingController
();
final
int
_limit
=
10
;
final
int
_limit
=
10
;
int
_page
=
1
;
int
_page
=
1
;
bool
_noMore
=
false
;
bool
_noMore
=
false
;
...
@@ -19,6 +21,13 @@ class NoteController extends GetxController {
...
@@ -19,6 +21,13 @@ class NoteController extends GetxController {
// 是否展示搜索结果
// 是否展示搜索结果
bool
showSearch
=
false
;
bool
showSearch
=
false
;
final
int
_searchLimit
=
10
;
int
_searchPage
=
1
;
bool
_searchNoMore
=
false
;
// 搜全文
List
<
SearchAllModel
>
searchALlResults
=
[];
@override
@override
void
onReady
()
{
void
onReady
()
{
...
@@ -29,6 +38,7 @@ class NoteController extends GetxController {
...
@@ -29,6 +38,7 @@ class NoteController extends GetxController {
@override
@override
void
onClose
()
{
void
onClose
()
{
refreshController
.
dispose
();
refreshController
.
dispose
();
searchInput
.
dispose
();
super
.
onClose
();
super
.
onClose
();
}
}
...
@@ -37,6 +47,50 @@ class NoteController extends GetxController {
...
@@ -37,6 +47,50 @@ class NoteController extends GetxController {
update
();
update
();
}
}
/// 搜全文
Future
<
void
>
searchAll
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_searchPage
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
searchAll
(
page:
_searchPage
,
limit:
_searchLimit
,
bookId:
bookDetailModel
.
bookId
.
toString
(),
key:
searchInput
.
text
);
Console
.
log
(
'--------------------------------'
);
// 如果是刷新 清理数据
if
(
isRefresh
)
searchALlResults
.
clear
();
searchALlResults
.
addAll
(
result
);
_searchPage
++;
_searchNoMore
=
result
.
length
<
_searchLimit
;
update
();
}
void
onRefreshSearch
()
async
{
try
{
await
searchAll
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
Console
.
log
(
'--error-----------------------------
$error
-'
);
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoadingSearch
()
async
{
if
(
_searchNoMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
searchAll
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
/// 获取笔记列表
/// 获取笔记列表
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
if
(
isRefresh
)
_page
=
1
;
...
...
lib/pages/read_web/view.dart
浏览文件 @
e9ef4778
...
@@ -151,13 +151,31 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -151,13 +151,31 @@ class _ReadPageState extends State<ReadPage> {
readController
.
titleInput
.
text
=
args
.
first
.
toString
();
readController
.
titleInput
.
text
=
args
.
first
.
toString
();
});
});
controller
.
addJavaScriptHandler
(
handlerName:
'answerCallBack'
,
callback:
(
args
){
controller
.
addJavaScriptHandler
(
handlerName:
'answer
Result
CallBack'
,
callback:
(
args
){
Console
.
log
(
'监听答题回调------------------------------------------------
$args
'
);
Console
.
log
(
'监听答题回调------------------------------------------------
$args
'
);
});
String
chapterId
=
args
.
first
[
0
].
toString
();
String
position
=
args
.
first
[
1
].
toString
();
String
type
=
args
.
first
[
2
].
toString
();
String
url
=
''
;
// 未答题
if
(
type
==
'0'
){
url
=
kAnswer
;
}
else
{
url
=
kAnswerResult
;
}
Map
<
String
,
String
>
params
=
{
'chapter_id'
:
chapterId
,
'position'
:
position
,
'url'
:
url
,
'book_id'
:
readController
.
bookId
,
'token'
:
UserStore
.
to
.
token
};
Console
.
log
(
'监听答题回调---------------给页面传参---------------------------------
$params
'
);
context
.
pushNamed
(
Routes
.
answer
,
queryParameters:
params
);
controller
.
addJavaScriptHandler
(
handlerName:
'answerResultCallBack'
,
callback:
(
args
){
// 跳转知识测评界面
Console
.
log
(
'监听答题结果回调------------------------------------------------
$args
'
);
});
});
...
...
lib/pages/read_web/widgets/category.dart
浏览文件 @
e9ef4778
...
@@ -56,7 +56,7 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
...
@@ -56,7 +56,7 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
child:
ClipRRect
(
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
17.5
.
w
),
borderRadius:
BorderRadius
.
circular
(
17.5
.
w
),
child:
CustomInputSearch
(
child:
CustomInputSearch
(
// controller:
controller.searchInput,
controller:
widget
.
controller
.
searchInput
,
readOnly:
false
,
readOnly:
false
,
hintText:
'搜索全文---目录'
,
hintText:
'搜索全文---目录'
,
onTap:
()
{
onTap:
()
{
...
@@ -64,6 +64,7 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
...
@@ -64,6 +64,7 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
},
},
onEditingComplete:
()
{
onEditingComplete:
()
{
widget
.
controller
.
setShowSearch
(
true
);
widget
.
controller
.
setShowSearch
(
true
);
widget
.
controller
.
onRefreshSearch
();
Tools
.
unfocus
();
Tools
.
unfocus
();
},
},
),
),
...
@@ -82,11 +83,15 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
...
@@ -82,11 +83,15 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
):
const
SizedBox
(),
):
const
SizedBox
(),
],
],
),
),
widget
.
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
onTap:
(){
widget
.
controller
.
showSearch
?
Expanded
(
if
(
widget
.
onTapSearchItem
!=
null
)
{
child:
BuildSearchAll
(
widget
.
onTapSearchItem
!();
onTap:
(){
}
if
(
widget
.
onTapSearchItem
!=
null
)
{
},)):
widget
.
onTapSearchItem
!();
}
},
searchALlResults:
widget
.
controller
.
searchALlResults
,)):
widget
.
controller
.
showSearch
?
const
SizedBox
():
BuildBook
(
bookDetailModel:
widget
.
controller
.
bookDetailModel
,),
widget
.
controller
.
showSearch
?
const
SizedBox
():
BuildBook
(
bookDetailModel:
widget
.
controller
.
bookDetailModel
,),
widget
.
controller
.
showSearch
?
const
SizedBox
():
Expanded
(
widget
.
controller
.
showSearch
?
const
SizedBox
():
Expanded
(
child:
ListView
.
builder
(
child:
ListView
.
builder
(
...
...
lib/pages/read_web/widgets/discuss.dart
浏览文件 @
e9ef4778
...
@@ -65,6 +65,7 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
...
@@ -65,6 +65,7 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
},
},
onEditingComplete:
()
{
onEditingComplete:
()
{
controller
.
setShowSearch
(
true
);
controller
.
setShowSearch
(
true
);
controller
.
onRefreshSearch
();
Tools
.
unfocus
();
Tools
.
unfocus
();
},
},
),
),
...
@@ -83,11 +84,15 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
...
@@ -83,11 +84,15 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
):
const
SizedBox
(),
):
const
SizedBox
(),
],
],
),
),
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
onTap:
(){
controller
.
showSearch
?
Expanded
(
if
(
widget
.
onTapSearchItem
!=
null
)
{
child:
BuildSearchAll
(
widget
.
onTapSearchItem
!();
onTap:
(){
}
if
(
widget
.
onTapSearchItem
!=
null
)
{
},)):
widget
.
onTapSearchItem
!();
}
},
searchALlResults:
controller
.
searchALlResults
,
)):
controller
.
showSearch
?
const
SizedBox
():
BuildBook
(
bookDetailModel:
widget
.
bookDetailModel
,),
controller
.
showSearch
?
const
SizedBox
():
BuildBook
(
bookDetailModel:
widget
.
bookDetailModel
,),
controller
.
showSearch
?
const
SizedBox
():
Expanded
(
controller
.
showSearch
?
const
SizedBox
():
Expanded
(
child:
Stack
(
child:
Stack
(
...
...
lib/pages/read_web/widgets/note.dart
浏览文件 @
e9ef4778
...
@@ -55,7 +55,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
...
@@ -55,7 +55,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
child:
ClipRRect
(
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
17.5
.
w
),
borderRadius:
BorderRadius
.
circular
(
17.5
.
w
),
child:
CustomInputSearch
(
child:
CustomInputSearch
(
//
controller: controller.searchInput,
controller:
controller
.
searchInput
,
readOnly:
false
,
readOnly:
false
,
hintText:
'搜索全文---笔记'
,
hintText:
'搜索全文---笔记'
,
onTap:
()
{
onTap:
()
{
...
@@ -63,6 +63,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
...
@@ -63,6 +63,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
},
},
onEditingComplete:
()
{
onEditingComplete:
()
{
controller
.
setShowSearch
(
true
);
controller
.
setShowSearch
(
true
);
controller
.
onRefreshSearch
();
Tools
.
unfocus
();
Tools
.
unfocus
();
},
},
),
),
...
@@ -81,11 +82,14 @@ class _ReadNotePageState extends State<ReadNotePage> {
...
@@ -81,11 +82,14 @@ class _ReadNotePageState extends State<ReadNotePage> {
):
const
SizedBox
(),
):
const
SizedBox
(),
],
],
),
),
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
onTap:
(){
controller
.
showSearch
?
Expanded
(
child:
BuildSearchAll
(
if
(
widget
.
onTapSearchItem
!=
null
)
{
onTap:
(){
widget
.
onTapSearchItem
!();
if
(
widget
.
onTapSearchItem
!=
null
)
{
}
widget
.
onTapSearchItem
!();
},)):
}
},
searchALlResults:
controller
.
searchALlResults
)):
controller
.
showSearch
?
const
SizedBox
():
BuildBook
(
bookDetailModel:
widget
.
bookDetailModel
,),
controller
.
showSearch
?
const
SizedBox
():
BuildBook
(
bookDetailModel:
widget
.
bookDetailModel
,),
controller
.
showSearch
?
const
SizedBox
():
Expanded
(
controller
.
showSearch
?
const
SizedBox
():
Expanded
(
child:
MediaQuery
.
removePadding
(
child:
MediaQuery
.
removePadding
(
...
...
lib/pages/read_web/widgets/search_all.dart
浏览文件 @
e9ef4778
...
@@ -2,9 +2,12 @@ part of web;
...
@@ -2,9 +2,12 @@ part of web;
class
BuildSearchAll
extends
StatefulWidget
{
class
BuildSearchAll
extends
StatefulWidget
{
final
void
Function
()?
onTap
;
final
void
Function
()?
onTap
;
final
List
<
SearchAllModel
>
searchALlResults
;
const
BuildSearchAll
({
const
BuildSearchAll
({
Key
?
key
,
Key
?
key
,
this
.
onTap
this
.
onTap
,
required
this
.
searchALlResults
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
@override
...
@@ -16,26 +19,83 @@ class _BuildSearchAllState extends State<BuildSearchAll> {
...
@@ -16,26 +19,83 @@ class _BuildSearchAllState extends State<BuildSearchAll> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
ListView
.
builder
(
return
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
SearchAllModel
model
=
widget
.
searchALlResults
[
index
];
return
GestureDetector
(
return
GestureDetector
(
onTap:
(){
onTap:
(){
if
(
widget
.
onTap
!=
null
){
if
(
widget
.
onTap
!=
null
){
widget
.
onTap
!();
widget
.
onTap
!();
}
}
},
},
child:
Container
(
child:
Column
(
color:
Colors
.
red
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
height:
110
,
children:
[
child:
Column
(
Container
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
// color: Colors.red,
children:
[
margin:
EdgeInsets
.
only
(
left:
15
.
w
,
top:
8
.
w
),
Text
(
'章节名称
$index
'
),
// height: 110,
Text
(
'章节内容
$index
'
),
child:
Column
(
],
crossAxisAlignment:
CrossAxisAlignment
.
start
,
),
children:
[
),
Text
(
model
.
chapterName
??
''
,
style:
TextStyle
(
fontSize:
11
.
w
,
height:
2
,
color:
Colours
.
c9
,
fontWeight:
Fonts
.
medium
),),
Gaps
.
vGaps5
,
ColoredText
(
text:
model
.
combinedContent
??
''
,
coloredSubstring:
model
.
key
??
''
,
coloredTextStyle:
TextStyle
(
fontSize:
13
.
w
,
height:
2
,
color:
AppTheme
.
primary
),),
],
),
),
Gaps
.
vGaps10
,
Container
(
height:
0.5
.
w
,
color:
Colours
.
cF2
,)
],
)
);
);
},
},
itemCount:
3
,
itemCount:
widget
.
searchALlResults
.
length
,
);
}
}
class
ColoredText
extends
StatelessWidget
{
final
String
text
;
final
String
coloredSubstring
;
final
TextStyle
coloredTextStyle
;
const
ColoredText
({
super
.
key
,
required
this
.
text
,
required
this
.
coloredSubstring
,
required
this
.
coloredTextStyle
,
});
@override
Widget
build
(
BuildContext
context
)
{
return
RichText
(
text:
TextSpan
(
style:
TextStyle
(
fontSize:
13
.
w
,
height:
2
,
color:
Colours
.
c3
),
children:
_buildTextSpans
(),
),
);
);
}
}
List
<
TextSpan
>
_buildTextSpans
()
{
final
List
<
TextSpan
>
spans
=
[];
final
int
substringIndex
=
text
.
indexOf
(
coloredSubstring
);
if
(
substringIndex
!=
-
1
)
{
spans
.
add
(
TextSpan
(
text:
text
.
substring
(
0
,
substringIndex
),
));
spans
.
add
(
TextSpan
(
text:
coloredSubstring
,
style:
coloredTextStyle
,
));
spans
.
add
(
TextSpan
(
text:
text
.
substring
(
substringIndex
+
coloredSubstring
.
length
),
));
}
else
{
spans
.
add
(
TextSpan
(
text:
text
));
}
return
spans
;
}
}
}
lib/pages/study_history/index.dart
浏览文件 @
e9ef4778
...
@@ -7,8 +7,10 @@ import 'package:flutter/material.dart';
...
@@ -7,8 +7,10 @@ import 'package:flutter/material.dart';
import
'package:flutter_book/apis/index.dart'
;
import
'package:flutter_book/apis/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'../../models/index.dart'
;
import
'../../models/index.dart'
;
import
'../../routes/index.dart'
;
import
'../../theme.dart'
;
import
'../../theme.dart'
;
import
'../../utils/index.dart'
;
import
'../../utils/index.dart'
;
import
'../../widgets/index.dart'
;
import
'../../widgets/index.dart'
;
...
...
lib/pages/study_history/view.dart
浏览文件 @
e9ef4778
...
@@ -23,7 +23,12 @@ class _StudyHistoryPageState extends State<StudyHistoryPage> {
...
@@ -23,7 +23,12 @@ class _StudyHistoryPageState extends State<StudyHistoryPage> {
onLoading:
controller
.
onLoading
,
onLoading:
controller
.
onLoading
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
)
{
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
BuildDayItem
(
historyModel:
controller
.
histories
[
index
],);
return
BuildDayItem
(
historyModel:
controller
.
histories
[
index
],
onTap:
(
CourseModel
courseModel
){
context
.
pushNamed
(
Routes
.
bookDetail
,
queryParameters:
{
'book_id'
:
courseModel
.
bookId
.
toString
()});
},
);
},
},
itemCount:
controller
.
histories
.
length
,
itemCount:
controller
.
histories
.
length
,
),
),
...
...
lib/pages/study_history/widgets/item.dart
浏览文件 @
e9ef4778
...
@@ -2,9 +2,11 @@ part of study_history;
...
@@ -2,9 +2,11 @@ part of study_history;
class
BuildDayItem
extends
StatelessWidget
{
class
BuildDayItem
extends
StatelessWidget
{
final
StudyHistoryModel
historyModel
;
final
StudyHistoryModel
historyModel
;
final
void
Function
(
CourseModel
courseModel
)
onTap
;
const
BuildDayItem
({
const
BuildDayItem
({
Key
?
key
,
Key
?
key
,
required
this
.
historyModel
required
this
.
historyModel
,
required
this
.
onTap
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
@override
...
@@ -43,7 +45,11 @@ class BuildDayItem extends StatelessWidget {
...
@@ -43,7 +45,11 @@ class BuildDayItem extends StatelessWidget {
shrinkWrap:
true
,
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
physics:
const
NeverScrollableScrollPhysics
(),
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
return
_buildItem
(
historyModel
.
courses
[
index
]);
return
GestureDetector
(
onTap:
(){
onTap
(
historyModel
.
courses
[
index
]);
},
child:
_buildItem
(
historyModel
.
courses
[
index
]));
},
},
itemCount:
historyModel
.
courses
.
length
,
itemCount:
historyModel
.
courses
.
length
,
)
)
...
@@ -54,6 +60,7 @@ class BuildDayItem extends StatelessWidget {
...
@@ -54,6 +60,7 @@ class BuildDayItem extends StatelessWidget {
Widget
_buildItem
(
CourseModel
courseModel
){
Widget
_buildItem
(
CourseModel
courseModel
){
return
Container
(
return
Container
(
color:
Colors
.
white
,
margin:
EdgeInsets
.
only
(
left:
10
.
w
,
right:
10
.
w
),
margin:
EdgeInsets
.
only
(
left:
10
.
w
,
right:
10
.
w
),
child:
Column
(
child:
Column
(
children:
[
children:
[
...
...
lib/routes/index.dart
浏览文件 @
e9ef4778
...
@@ -3,6 +3,7 @@ library routes;
...
@@ -3,6 +3,7 @@ library routes;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter_book/pages/ad/index.dart'
;
import
'package:flutter_book/pages/ad/index.dart'
;
import
'package:flutter_book/pages/answer/index.dart'
;
import
'package:flutter_book/pages/book_detail/index.dart'
;
import
'package:flutter_book/pages/book_detail/index.dart'
;
import
'package:flutter_book/pages/book_pay/index.dart'
;
import
'package:flutter_book/pages/book_pay/index.dart'
;
import
'package:flutter_book/pages/book_score/index.dart'
;
import
'package:flutter_book/pages/book_score/index.dart'
;
...
...
lib/routes/routes.dart
浏览文件 @
e9ef4778
...
@@ -9,7 +9,10 @@ abstract class Routes {
...
@@ -9,7 +9,10 @@ abstract class Routes {
static
const
ad
=
'ad'
;
static
const
ad
=
'ad'
;
static
const
adDetail
=
'ad_detail'
;
static
const
adDetail
=
'ad_detail'
;
static
const
web
=
'read_web'
;
static
const
web
=
'read_web'
;
static
const
answer
=
'answer'
;
// 支付界面
// 支付界面
static
const
bookPay
=
'book_pay'
;
static
const
bookPay
=
'book_pay'
;
...
@@ -639,6 +642,17 @@ abstract class Routes {
...
@@ -639,6 +642,17 @@ abstract class Routes {
)
)
)
)
),
),
GoRoute
(
// 知识测评
path:
'/
$answer
'
,
name:
answer
,
pageBuilder:
(
context
,
state
)
=>
CupertinoPage
(
name:
state
.
uri
.
toString
(),
key:
state
.
pageKey
,
child:
AnswerPage
(
params:
state
.
uri
.
queryParameters
,
)
)
),
]
]
);
);
...
...
lib/services/http.dart
浏览文件 @
e9ef4778
...
@@ -29,6 +29,7 @@ class HttpService extends GetxService {
...
@@ -29,6 +29,7 @@ class HttpService extends GetxService {
headers
[
'appSecret'
]
=
AppConfig
.
appSecret
;
headers
[
'appSecret'
]
=
AppConfig
.
appSecret
;
headers
[
'timestamp'
]
=
(
DateTime
.
now
().
millisecondsSinceEpoch
~/
1000
).
toString
();
headers
[
'timestamp'
]
=
(
DateTime
.
now
().
millisecondsSinceEpoch
~/
1000
).
toString
();
headers
[
'url'
]
=
kServerUrl
+
url
.
toString
();
headers
[
'url'
]
=
kServerUrl
+
url
.
toString
();
headers
[
'token'
]
=
UserStore
.
to
.
token
;
if
(
Get
.
isRegistered
<
UserStore
>()
&&
if
(
Get
.
isRegistered
<
UserStore
>()
&&
UserStore
.
to
.
hasToken
&&
!
excludeToken
)
{
UserStore
.
to
.
hasToken
&&
!
excludeToken
)
{
...
@@ -44,7 +45,6 @@ class HttpService extends GetxService {
...
@@ -44,7 +45,6 @@ class HttpService extends GetxService {
else
{
else
{
headers
[
'Sign'
]
=
SignTool
.
createSign
(
headers
);
headers
[
'Sign'
]
=
SignTool
.
createSign
(
headers
);
}
}
// Console.log(headers);
// Console.log(headers);
return
headers
;
return
headers
;
}
}
...
...
lib/utils/constants.dart
浏览文件 @
e9ef4778
...
@@ -23,6 +23,8 @@ const String kUserWrongDes = 'http://150.158.138.40:9200/evaluating_wrong.html';
...
@@ -23,6 +23,8 @@ const String kUserWrongDes = 'http://150.158.138.40:9200/evaluating_wrong.html';
const
String
kReadBook
=
'http://150.158.138.40:9200/read.html'
;
const
String
kReadBook
=
'http://150.158.138.40:9200/read.html'
;
// 答题页
// 答题页
const
String
kAnswer
=
'http://150.158.138.40:9200/evaluating.html'
;
const
String
kAnswer
=
'http://150.158.138.40:9200/evaluating.html'
;
// 答题结果页
const
String
kAnswerResult
=
'http://150.158.138.40:9200/evaluating_result.html'
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论