Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
22afd49f
提交
22afd49f
authored
1月 11, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
我的接口
上级
d6e31643
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
167 行增加
和
61 行删除
+167
-61
common.dart
lib/apis/common.dart
+1
-0
library.dart
lib/apis/library.dart
+21
-0
mine.dart
lib/apis/mine.dart
+14
-0
mine.dart
lib/models/mine.dart
+13
-0
controller.dart
lib/pages/mine/controller.dart
+27
-0
view.dart
lib/pages/mine/view.dart
+47
-35
account.dart
lib/pages/mine/widgets/account.dart
+19
-11
read.dart
lib/pages/mine/widgets/read.dart
+19
-13
user.dart
lib/pages/mine/widgets/user.dart
+6
-2
没有找到文件。
lib/apis/common.dart
浏览文件 @
22afd49f
...
...
@@ -112,6 +112,7 @@ abstract class CommonAPI {
}
/// 8、搜索书籍
///
static
Future
<
List
<
CourseModel
>>
searchBooks
({
int
page
=
1
,
int
limit
=
20
,
...
...
lib/apis/library.dart
浏览文件 @
22afd49f
...
...
@@ -30,6 +30,7 @@ abstract class LibraryAPI {
}
/// 3、书籍列表
///
static
Future
<
List
<
CourseModel
>>
bookList
({
int
page
=
1
,
int
limit
=
20
,
...
...
@@ -47,6 +48,25 @@ abstract class LibraryAPI {
});
}
/// 4、收藏、取消收藏
static
Future
<
bool
>
love
({
required
String
bookId
,
required
String
isSelect
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/book/Information/serachDel'
,
params:
{
'book_id'
:
bookId
,
'is_select'
:
isSelect
},
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
}
return
false
;
}
}
\ No newline at end of file
lib/apis/mine.dart
浏览文件 @
22afd49f
...
...
@@ -2,4 +2,17 @@ part of apis;
abstract
class
MineAPI
{
/// 1、个人信息以及8个数据
///
static
Future
<
Map
<
String
,
dynamic
>>
userInfo
()
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/Information/getMyStatistics'
,
params:
{},
);
if
(
result
.
data
is
!
Map
)
return
{};
return
result
.
data
;
}
}
\ No newline at end of file
lib/models/mine.dart
0 → 100644
浏览文件 @
22afd49f
part of
models
;
class
ReadModel
{
ReadModel
({
required
this
.
value
,
required
this
.
name
,
});
String
value
;
String
name
;
}
\ No newline at end of file
lib/pages/mine/controller.dart
浏览文件 @
22afd49f
...
...
@@ -4,7 +4,14 @@ part of mine;
class
MineController
extends
GetxController
{
// 广告数据
List
<
AdModel
>
ads
=
[];
// 个人信息数据
Map
<
String
,
dynamic
>
userInfo
=
{
'name'
:
''
,
'phone'
:
''
};
// 笔记 讨论 错题 收藏
List
<
ReadModel
>
reads
=
[];
// 我的账户数据
List
<
ReadModel
>
accounts
=
[];
// 消息未读数
int
num
=
0
;
...
...
@@ -14,6 +21,7 @@ class MineController extends GetxController {
void
onReady
()
{
_getAds
();
_getNums
();
_getInfo
();
super
.
onReady
();
}
...
...
@@ -30,4 +38,22 @@ class MineController extends GetxController {
update
();
}
/// 获取个人信息数据
void
_getInfo
()
async
{
userInfo
=
await
MineAPI
.
userInfo
();
reads
=
[
ReadModel
(
name:
'笔记'
,
value:
userInfo
[
'note_nums'
].
toString
()),
ReadModel
(
name:
'讨论'
,
value:
userInfo
[
'comment_nums'
].
toString
()),
ReadModel
(
name:
'错题'
,
value:
userInfo
[
'wrong_nums'
].
toString
()),
ReadModel
(
name:
'收藏'
,
value:
userInfo
[
'collect_nums'
].
toString
())
];
accounts
=
[
ReadModel
(
name:
'优惠券'
,
value:
userInfo
[
'coupon_nums'
].
toString
()),
ReadModel
(
name:
'积分'
,
value:
userInfo
[
'integral_nums'
].
toString
()),
ReadModel
(
name:
'紫金币'
,
value:
userInfo
[
'bean_nums'
].
toString
()),
ReadModel
(
name:
'订单'
,
value:
userInfo
[
'orders_nums'
].
toString
())
];
update
();
}
}
\ No newline at end of file
lib/pages/mine/view.dart
浏览文件 @
22afd49f
...
...
@@ -14,6 +14,7 @@ class _MinePageState extends State<MinePage> {
return
GetBuilder
<
MineController
>(
init:
MineController
(),
builder:
(
controller
)
=>
Scaffold
(
backgroundColor:
Colours
.
cF9
,
appBar:
CustomAppBar
(
backgroundColor:
Colors
.
transparent
,
actions:
[
...
...
@@ -58,42 +59,53 @@ class _MinePageState extends State<MinePage> {
)
],
),
body:
SingleChildScrollView
(
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
AppTheme
.
margin
),
child:
Column
(
children:
[
BuildUser
(
onTap:
(){
context
.
pushNamed
(
Routes
.
userInfo
);
},),
Gaps
.
vGaps10
,
BuildRead
(
items:
[
'1'
,
'2'
,
'3'
,
'4'
],),
controller
.
ads
.
isNotEmpty
?
Gaps
.
vGaps10
:
SizedBox
(),
controller
.
ads
.
isNotEmpty
?
Container
(
color:
Colors
.
transparent
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
BuildBanner
(
items:
controller
.
ads
),
):
const
SizedBox
(),
Gaps
.
vGaps10
,
BuildAccount
(
items:
[
'1'
,
'11'
,
'紫荆币'
,
'1111'
],),
Gaps
.
vGaps10
,
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
cyan
,
body:
Container
(
color:
Colours
.
cF9
,
child:
SingleChildScrollView
(
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
AppTheme
.
margin
),
child:
Column
(
children:
[
BuildUser
(
userInfo:
controller
.
userInfo
,
onTap:
(){
context
.
pushNamed
(
Routes
.
userInfo
);
},),
Gaps
.
vGaps10
,
BuildRead
(
items:
controller
.
reads
),
controller
.
ads
.
isNotEmpty
?
Gaps
.
vGaps10
:
SizedBox
(),
controller
.
ads
.
isNotEmpty
?
Container
(
color:
Colors
.
transparent
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
BuildBanner
(
items:
controller
.
ads
),
):
const
SizedBox
(),
Gaps
.
vGaps10
,
BuildAccount
(
items:
controller
.
accounts
,),
Gaps
.
vGaps10
,
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
const
Color
(
0xFFF9F9F9
),
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Column
(
children:
[
_buildItem
(
'账户安全'
,
''
),
Container
(
color:
Colours
.
cLine
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'意见反馈'
,
''
),
Container
(
color:
Colours
.
cLine
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'关于我们'
,
''
),
],
),
),
child:
Column
(
children:
[
_buildItem
(
'账户安全'
,
''
),
Container
(
color:
Colours
.
cLine
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'意见反馈'
,
''
),
Container
(
color:
Colours
.
cLine
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'关于我们'
,
''
),
],
),
),
],
],
),
),
),
),
...
...
lib/pages/mine/widgets/account.dart
浏览文件 @
22afd49f
part of
mine
;
class
BuildAccount
extends
StatelessWidget
{
final
List
items
;
final
List
<
ReadModel
>
items
;
const
BuildAccount
({
super
.
key
,
...
...
@@ -13,20 +13,28 @@ class BuildAccount extends StatelessWidget {
return
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
cyan
,
color:
const
Color
(
0xFFF9F9F9
),
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
only
(
left:
17
,
top:
14
,
bottom:
14
,
right:
17
),
child:
Text
(
'我的账户'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
16
,
height:
1.6
,
fontWeight:
Fonts
.
medium
),),
padding:
const
EdgeInsets
.
only
(
left:
17
,
top:
14
,
bottom:
14
,
right:
17
),
child:
const
Text
(
'我的账户'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
16
,
height:
1.6
,
fontWeight:
Fonts
.
medium
),),
),
Container
(
padding:
EdgeInsets
.
only
(
bottom:
13
,
top:
5
),
padding:
const
EdgeInsets
.
only
(
bottom:
13
,
top:
5
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
items
.
map
((
item
){
children:
items
.
map
((
model
){
return
Column
(
children:
[
Container
(
...
...
@@ -35,13 +43,13 @@ class BuildAccount extends StatelessWidget {
color:
Colors
.
green
,
),
Gaps
.
vGaps5
,
Text
(
'111'
,
style:
TextStyle
(
fontSize:
12
.
w
,
height:
1.6
,
color:
Colours
.
c9
),),
items
.
indexOf
(
item
)
==
0
?
Row
(
Text
(
model
.
name
,
style:
TextStyle
(
fontSize:
12
.
w
,
height:
1.6
,
color:
Colours
.
c9
),),
items
.
indexOf
(
model
)
==
0
?
Row
(
children:
[
Text
(
'3'
,
style:
TextStyle
(
fontSize:
16
,
height:
1.6
,
fontWeight:
Fonts
.
medium
,
color:
AppTheme
.
primary
,),),
Text
(
'张'
,
style:
TextStyle
(
fontSize:
12
,
height:
1.6
,
color:
Colours
.
c3
),)
Text
(
model
.
value
.
toString
()
,
style:
TextStyle
(
fontSize:
16
,
height:
1.6
,
fontWeight:
Fonts
.
medium
,
color:
AppTheme
.
primary
,),),
const
Text
(
'张'
,
style:
TextStyle
(
fontSize:
12
,
height:
1.6
,
color:
Colours
.
c3
),)
],
):
Text
(
'11'
,
style:
TextStyle
(
fontSize:
16
,
height:
1.6
,
color:
Colours
.
c3
),)
):
Text
(
model
.
value
.
toString
()
,
style:
TextStyle
(
fontSize:
16
,
height:
1.6
,
color:
Colours
.
c3
),)
],
);
}
).
toList
(),
...
...
lib/pages/mine/widgets/read.dart
浏览文件 @
22afd49f
...
...
@@ -4,7 +4,7 @@ part of mine;
class
BuildRead
extends
StatelessWidget
{
final
void
Function
()?
onTap
;
final
List
items
;
final
List
<
ReadModel
>
items
;
const
BuildRead
({
super
.
key
,
this
.
onTap
,
...
...
@@ -15,22 +15,28 @@ class BuildRead extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
GestureDetector
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
16.5
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.5
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
green
,
borderRadius:
BorderRadius
.
circular
(
8
),
color:
const
Color
(
0xFFF9F9F9
),
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
items
.
map
((
item
){
return
Container
(
child:
Column
(
children:
[
Text
(
'3'
,
style:
TextStyle
(
fontSize:
18
,
height:
1.6
,
fontWeight:
Fonts
.
medium
,
color:
Colours
.
c3
),),
Gaps
.
vGaps5
,
Text
(
'笔记'
,
style:
TextStyle
(
fontSize:
13
,
height:
1.6
,
color:
Colours
.
c6
))
],
),
children:
items
.
map
((
model
){
return
Column
(
children:
[
Text
(
model
.
value
,
style:
const
TextStyle
(
fontSize:
18
,
height:
1.6
,
fontWeight:
Fonts
.
medium
,
color:
Colours
.
c3
),),
Gaps
.
vGaps5
,
Text
(
model
.
name
,
style:
const
TextStyle
(
fontSize:
13
,
height:
1.6
,
color:
Colours
.
c6
))
],
);
}).
toList
(),
),
...
...
lib/pages/mine/widgets/user.dart
浏览文件 @
22afd49f
...
...
@@ -4,10 +4,12 @@ part of mine;
class
BuildUser
extends
StatelessWidget
{
final
void
Function
()?
onTap
;
final
Map
<
String
,
dynamic
>
userInfo
;
const
BuildUser
({
super
.
key
,
this
.
onTap
,
required
this
.
userInfo
});
@override
...
...
@@ -23,14 +25,16 @@ class BuildUser extends StatelessWidget {
),
Gaps
.
hGaps10
,
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'八仙过海
'
,
style:
TextStyle
(
Text
(
userInfo
.
containsKey
(
'name'
)?
userInfo
[
'name'
]:
'
'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
15
.
w
,
fontWeight:
Fonts
.
medium
,
height:
1.6
.
w
),),
Text
(
'1881000000'
,
style:
TextStyle
(
Gaps
.
vGaps5
,
Text
(
userInfo
.
containsKey
(
'phone'
)?
userInfo
[
'phone'
]:
''
,
style:
TextStyle
(
fontSize:
12
.
w
,
color:
Colours
.
c6
),)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论