Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
e326e001
提交
e326e001
authored
1月 13, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化 笔记 错题 讨论 布局满足 UI 效果
上级
73519107
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
289 行增加
和
96 行删除
+289
-96
mine.dart
lib/apis/mine.dart
+24
-2
course.dart
lib/models/course.dart
+21
-1
controller.dart
lib/pages/mine/controller.dart
+1
-1
controller.dart
lib/pages/user_discuss/controller.dart
+63
-0
index.dart
lib/pages/user_discuss/index.dart
+19
-0
view.dart
lib/pages/user_discuss/view.dart
+34
-0
item.dart
lib/pages/user_discuss/widgets/item.dart
+89
-0
controller.dart
lib/pages/user_notes/controller.dart
+1
-1
view.dart
lib/pages/user_notes/view.dart
+7
-44
item.dart
lib/pages/user_notes/widgets/item.dart
+5
-1
controller.dart
lib/pages/user_wrong/controller.dart
+1
-1
view.dart
lib/pages/user_wrong/view.dart
+7
-44
item.dart
lib/pages/user_wrong/widgets/item.dart
+5
-1
index.dart
lib/routes/index.dart
+1
-0
routes.dart
lib/routes/routes.dart
+11
-0
没有找到文件。
lib/apis/mine.dart
浏览文件 @
e326e001
...
...
@@ -69,7 +69,8 @@ abstract class MineAPI {
});
}
/// 紫金币记录
/// 4、紫金币记录
///
static
Future
<
List
<
RecordModel
>>
coin
({
int
page
=
1
,
int
limit
=
10
,
...
...
@@ -87,7 +88,8 @@ abstract class MineAPI {
});
}
/// 积分记录
/// 5、积分记录
///
static
Future
<
List
<
RecordModel
>>
point
({
int
page
=
1
,
int
limit
=
10
,
...
...
@@ -105,5 +107,24 @@ abstract class MineAPI {
});
}
/// 3、讨论
///
static
Future
<
List
<
CourseModel
>>
discuss
({
int
page
=
1
,
int
limit
=
10
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/Information/myComment'
,
params:
{
'page'
:
page
,
'pageSize'
:
limit
,
},
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
){
return
CourseModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
});
}
}
\ No newline at end of file
lib/models/course.dart
浏览文件 @
e326e001
...
...
@@ -41,6 +41,10 @@ class CourseModel {
this
.
wrongNum
,
///
/// 笔记
this
.
commentNum
,
///
});
CourseModel
.
fromJson
(
dynamic
json
)
{
...
...
@@ -72,6 +76,10 @@ class CourseModel {
/// 错题
wrongNum
=
json
[
'wrong_num'
];
///
/// 讨论
commentNum
=
json
[
'comment_num'
];
///
}
num
?
bookId
;
String
?
bookName
;
...
...
@@ -103,6 +111,10 @@ class CourseModel {
num
?
wrongNum
;
///
/// 讨论
num
?
commentNum
;
///
...
...
@@ -155,6 +167,10 @@ class CourseModel {
num
?
wrongNum
,
///
/// 讨论
num
?
commentNum
,
///
})
=>
CourseModel
(
bookId:
bookId
??
this
.
bookId
,
bookName:
bookName
??
this
.
bookName
,
authors:
authors
??
this
.
authors
,
...
...
@@ -182,6 +198,10 @@ class CourseModel {
/// 错题
wrongNum:
wrongNum
??
this
.
wrongNum
,
///
/// 讨论
commentNum:
commentNum
??
this
.
commentNum
,
///
);
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -204,7 +224,7 @@ class CourseModel {
map
[
'cart_id'
]
=
cartId
;
map
[
'notes_num'
]
=
notesNum
;
map
[
'wrong_num'
]
=
wrongNum
;
map
[
'comment_num'
]
=
commentNum
;
return
map
;
}
...
...
lib/pages/mine/controller.dart
浏览文件 @
e326e001
...
...
@@ -43,7 +43,7 @@ class MineController extends GetxController {
userInfo
=
await
MineAPI
.
userInfo
();
reads
=
[
ReadModel
(
name:
'笔记'
,
value:
userInfo
[
'note_nums'
].
toString
(),
link:
Routes
.
note
),
ReadModel
(
name:
'讨论'
,
value:
userInfo
[
'comment_nums'
].
toString
()),
ReadModel
(
name:
'讨论'
,
value:
userInfo
[
'comment_nums'
].
toString
()
,
link:
Routes
.
discuss
),
ReadModel
(
name:
'错题'
,
value:
userInfo
[
'wrong_nums'
].
toString
(),
link:
Routes
.
wrong
),
ReadModel
(
name:
'收藏'
,
value:
userInfo
[
'collect_nums'
].
toString
(),
link:
Routes
.
love
)
];
...
...
lib/pages/user_discuss/controller.dart
0 → 100644
浏览文件 @
e326e001
part of
user_discuss
;
class
UserDiscussController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
List
<
CourseModel
>
discuss
=
[];
final
int
_limit
=
10
;
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onClose
()
{
refreshController
.
dispose
();
super
.
onClose
();
}
/// 获取讨论列表
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
discuss
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
discuss
.
clear
();
discuss
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getNotes
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoading
()
async
{
if
(
_noMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
_getNotes
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
lib/pages/user_discuss/index.dart
0 → 100644
浏览文件 @
e326e001
library
user_discuss
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/apis/index.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'../../models/index.dart'
;
import
'../../utils/index.dart'
;
part
'view.dart'
;
part
'controller.dart'
;
part
'widgets/item.dart'
;
\ No newline at end of file
lib/pages/user_discuss/view.dart
0 → 100644
浏览文件 @
e326e001
part of
user_discuss
;
class
UserDiscussPage
extends
StatefulWidget
{
const
UserDiscussPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
UserDiscussPage
>
createState
()
=>
_UserDiscussPageState
();
}
class
_UserDiscussPageState
extends
State
<
UserDiscussPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
UserDiscussController
>(
init:
UserDiscussController
(),
builder:
(
controller
)=>
Scaffold
(
appBar:
AppBar
(
centerTitle:
true
,
title:
const
Text
(
'讨论'
),
),
body:
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildItem
(
model:
controller
.
discuss
[
index
],
index:
index
,
num
:
controller
.
discuss
.
length
,);
},
itemCount:
controller
.
discuss
.
length
,
)
),
),
);
}
}
lib/pages/user_discuss/widgets/item.dart
0 → 100644
浏览文件 @
e326e001
part of
user_discuss
;
class
BuildItem
extends
StatelessWidget
{
final
CourseModel
model
;
final
int
index
;
final
int
num
;
const
BuildItem
({
Key
?
key
,
required
this
.
model
,
required
this
.
index
,
required
this
.
num
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
// margin: const EdgeInsets.all(10),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Column
(
children:
[
index
==
0
?
Container
(
// padding: const EdgeInsets.only(left: 10),
height:
32
,
width:
double
.
infinity
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
8
),
topRight:
Radius
.
circular
(
8
),
),
color:
Colors
.
white
,
),
alignment:
Alignment
.
centerLeft
,
child:
Text
(
'共
$num
本书'
,
style:
const
TextStyle
(
fontSize:
13
,
height:
1.5
,
color:
Colours
.
c6
),),
):
const
SizedBox
(),
Container
(
height:
0.5
,
color:
Colours
.
cF0
,
),
Container
(
padding:
const
EdgeInsets
.
only
(
top:
12
,
bottom:
15
),
// color: Colors.red,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
height:
87
,
width:
73
,
color:
Colors
.
cyan
,
),
Container
(
height:
87
,
margin:
const
EdgeInsets
.
only
(
left:
13
),
// color: Colors.green,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
model
.
bookName
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
height:
1.5
,
fontWeight:
Fonts
.
medium
,
color:
Colours
.
c3
),),
Text
(
model
.
authors
??
''
,
style:
const
TextStyle
(
fontSize:
12
,
height:
1.5
,
color:
Colours
.
c6
),),
],
),
Text
(
'
${model.commentNum.toString()}
讨论'
,
style:
const
TextStyle
(
fontSize:
11
,
height:
1.5
,
color:
AppTheme
.
primary
)),
],
),
)
],
),
)
],
),
);
}
}
lib/pages/user_notes/controller.dart
浏览文件 @
e326e001
...
...
@@ -19,7 +19,7 @@ class UserNoteController extends GetxController {
super
.
onClose
();
}
/// 获取
课程内图书
列表
/// 获取
笔记
列表
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
...
...
lib/pages/user_notes/view.dart
浏览文件 @
e326e001
...
...
@@ -17,53 +17,16 @@ class _UserNotePageState extends State<UserNotePage> {
centerTitle:
true
,
title:
const
Text
(
'笔记'
),
),
body:
Container
(
margin:
const
EdgeInsets
.
all
(
10
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
// color: Colors.yellow,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
CustomPullScrollView
(
body:
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
child:
SingleChildScrollView
(
child:
Column
(
children:
[
Container
(
padding:
const
EdgeInsets
.
only
(
left:
10
),
height:
32
,
width:
double
.
infinity
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
8
),
topRight:
Radius
.
circular
(
8
),
),
color:
Colors
.
white
,
),
alignment:
Alignment
.
centerLeft
,
child:
Text
(
'共
${controller.notes.length}
本书'
,
style:
const
TextStyle
(
fontSize:
13
,
height:
1.5
,
color:
Colours
.
c6
),),
),
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildItem
(
model:
controller
.
notes
[
index
],);
},
itemCount:
controller
.
notes
.
length
,
)
],
),
),
),
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildItem
(
model:
controller
.
notes
[
index
],
index:
index
,
num
:
controller
.
notes
.
length
,);
},
itemCount:
controller
.
notes
.
length
,
)
),
),
);
...
...
lib/pages/user_notes/widgets/item.dart
浏览文件 @
e326e001
...
...
@@ -2,9 +2,13 @@ part of user_notes;
class
BuildItem
extends
StatelessWidget
{
final
CourseModel
model
;
final
int
index
;
final
int
num
;
const
BuildItem
({
Key
?
key
,
required
this
.
model
required
this
.
model
,
required
this
.
index
,
required
this
.
num
})
:
super
(
key:
key
);
@override
...
...
lib/pages/user_wrong/controller.dart
浏览文件 @
e326e001
...
...
@@ -19,7 +19,7 @@ class UserWrongController extends GetxController {
super
.
onClose
();
}
/// 获取
课程内图书
列表
/// 获取
错题
列表
Future
<
void
>
_getWrongs
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
...
...
lib/pages/user_wrong/view.dart
浏览文件 @
e326e001
...
...
@@ -17,53 +17,16 @@ class _UserWrongPageState extends State<UserWrongPage> {
centerTitle:
true
,
title:
const
Text
(
'错题'
),
),
body:
Container
(
margin:
const
EdgeInsets
.
all
(
10
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
// color: Colors.yellow,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
CustomPullScrollView
(
body:
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
child:
SingleChildScrollView
(
child:
Column
(
children:
[
Container
(
padding:
const
EdgeInsets
.
only
(
left:
10
),
height:
32
,
width:
double
.
infinity
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
8
),
topRight:
Radius
.
circular
(
8
),
),
color:
Colors
.
white
,
),
alignment:
Alignment
.
centerLeft
,
child:
Text
(
'共
${controller.wrongs.length}
本书'
,
style:
const
TextStyle
(
fontSize:
13
,
height:
1.5
,
color:
Colours
.
c6
),),
),
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildItem
(
model:
controller
.
wrongs
[
index
],);
},
itemCount:
controller
.
wrongs
.
length
,
)
],
),
),
),
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildItem
(
model:
controller
.
wrongs
[
index
],
index:
index
,
num
:
controller
.
wrongs
.
length
,);
},
itemCount:
controller
.
wrongs
.
length
,
)
),
),
);
...
...
lib/pages/user_wrong/widgets/item.dart
浏览文件 @
e326e001
...
...
@@ -2,9 +2,13 @@ part of user_wrong;
class
BuildItem
extends
StatelessWidget
{
final
CourseModel
model
;
final
int
index
;
final
int
num
;
const
BuildItem
({
Key
?
key
,
required
this
.
model
required
this
.
model
,
required
this
.
index
,
required
this
.
num
})
:
super
(
key:
key
);
@override
...
...
lib/routes/index.dart
浏览文件 @
e326e001
...
...
@@ -18,6 +18,7 @@ import 'package:flutter_book/pages/splash/index.dart';
import
'package:flutter_book/pages/study_history/index.dart'
;
import
'package:flutter_book/pages/study_report/index.dart'
;
import
'package:flutter_book/pages/user_coin/index.dart'
;
import
'package:flutter_book/pages/user_discuss/index.dart'
;
import
'package:flutter_book/pages/user_info/index.dart'
;
import
'package:flutter_book/pages/user_love/index.dart'
;
import
'package:flutter_book/pages/user_msg/index.dart'
;
...
...
lib/routes/routes.dart
浏览文件 @
e326e001
...
...
@@ -76,6 +76,8 @@ abstract class Routes {
static
const
note
=
'note'
;
// 错题
static
const
wrong
=
'wrong'
;
// 讨论
static
const
discuss
=
'discuss'
;
static
final
GoRouter
config
=
GoRouter
(
...
...
@@ -317,6 +319,15 @@ abstract class Routes {
child:
const
UserPointPage
()
)
),
GoRoute
(
path:
'/
$discuss
'
,
name:
discuss
,
pageBuilder:
(
context
,
state
)
=>
CupertinoPage
(
name:
state
.
uri
.
toString
(),
key:
state
.
pageKey
,
child:
const
UserDiscussPage
()
)
),
]
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论