Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
73519107
提交
73519107
authored
1月 13, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、积分界面 接口调试以及数据绑定
1、紫荆币界面 接口调试以及数据绑定
上级
88b58c02
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
422 行增加
和
46 行删除
+422
-46
mine.dart
lib/apis/mine.dart
+38
-0
mine.dart
lib/models/mine.dart
+52
-0
controller.dart
lib/pages/mine/controller.dart
+1
-1
controller.dart
lib/pages/user_coin/controller.dart
+64
-0
index.dart
lib/pages/user_coin/index.dart
+9
-2
view.dart
lib/pages/user_coin/view.dart
+53
-37
cell.dart
lib/pages/user_coin/widgets/cell.dart
+9
-5
controller.dart
lib/pages/user_point/controller.dart
+64
-0
index.dart
lib/pages/user_point/index.dart
+17
-0
view.dart
lib/pages/user_point/view.dart
+48
-0
cell.dart
lib/pages/user_point/widgets/cell.dart
+54
-0
index.dart
lib/routes/index.dart
+1
-0
routes.dart
lib/routes/routes.dart
+12
-1
没有找到文件。
lib/apis/mine.dart
浏览文件 @
73519107
...
...
@@ -50,6 +50,8 @@ abstract class MineAPI {
});
}
/// 3、错题
///
static
Future
<
List
<
CourseModel
>>
wrong
({
int
page
=
1
,
int
limit
=
10
,
...
...
@@ -67,6 +69,41 @@ abstract class MineAPI {
});
}
/// 紫金币记录
static
Future
<
List
<
RecordModel
>>
coin
({
int
page
=
1
,
int
limit
=
10
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/Information/getBeanList'
,
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
RecordModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
});
}
/// 积分记录
static
Future
<
List
<
RecordModel
>>
point
({
int
page
=
1
,
int
limit
=
10
,
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/Information/getIntegralList'
,
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
RecordModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
});
}
}
\ No newline at end of file
lib/models/mine.dart
浏览文件 @
73519107
...
...
@@ -13,4 +13,55 @@ class ReadModel {
String
name
;
String
?
link
;
String
?
icon
;
}
/// 紫金币 积分 模型
class
RecordModel
{
RecordModel
({
this
.
integralId
,
this
.
options
,
this
.
numbers
,
this
.
result
,
this
.
remarks
,
this
.
createTime
,});
RecordModel
.
fromJson
(
dynamic
json
)
{
integralId
=
json
[
'integral_id'
];
options
=
json
[
'options'
];
numbers
=
json
[
'numbers'
];
result
=
json
[
'result'
];
remarks
=
json
[
'remarks'
];
createTime
=
json
[
'create_time'
];
}
num
?
integralId
;
num
?
options
;
num
?
numbers
;
num
?
result
;
String
?
remarks
;
String
?
createTime
;
RecordModel
copyWith
({
num
?
integralId
,
num
?
options
,
num
?
numbers
,
num
?
result
,
String
?
remarks
,
String
?
createTime
,
})
=>
RecordModel
(
integralId:
integralId
??
this
.
integralId
,
options:
options
??
this
.
options
,
numbers:
numbers
??
this
.
numbers
,
result:
result
??
this
.
result
,
remarks:
remarks
??
this
.
remarks
,
createTime:
createTime
??
this
.
createTime
,
);
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
map
[
'integral_id'
]
=
integralId
;
map
[
'options'
]
=
options
;
map
[
'numbers'
]
=
numbers
;
map
[
'result'
]
=
result
;
map
[
'remarks'
]
=
remarks
;
map
[
'create_time'
]
=
createTime
;
return
map
;
}
}
\ No newline at end of file
lib/pages/mine/controller.dart
浏览文件 @
73519107
...
...
@@ -49,7 +49,7 @@ class MineController extends GetxController {
];
accounts
=
[
ReadModel
(
name:
'优惠券'
,
value:
userInfo
[
'coupon_nums'
].
toString
(),
icon:
'assets/images/coupon.png'
),
ReadModel
(
name:
'积分'
,
value:
userInfo
[
'integral_nums'
].
toString
(),
link:
Routes
.
coin
,
icon:
'assets/images/point.png'
),
ReadModel
(
name:
'积分'
,
value:
userInfo
[
'integral_nums'
].
toString
(),
link:
Routes
.
point
,
icon:
'assets/images/point.png'
),
ReadModel
(
name:
'紫金币'
,
value:
userInfo
[
'bean_nums'
].
toString
(),
link:
Routes
.
coin
,
icon:
'assets/images/coin.png'
),
ReadModel
(
name:
'订单'
,
value:
userInfo
[
'orders_nums'
].
toString
(),
icon:
'assets/images/order.png'
)
];
...
...
lib/pages/user_coin/controller.dart
0 → 100644
浏览文件 @
73519107
part of
user_coin
;
class
UserCoinController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
List
<
RecordModel
>
coins
=
[];
final
int
_limit
=
10
;
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onClose
()
{
refreshController
.
dispose
();
super
.
onClose
();
}
/// 获取紫金币记录
Future
<
void
>
_getCoin
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
coin
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
coins
.
clear
();
coins
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getCoin
(
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
_getCoin
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
lib/pages/user_coin/index.dart
浏览文件 @
73519107
library
user_coin
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
part
'view.dart'
;
part
'widgets/cell.dart'
;
\ No newline at end of file
part
'widgets/cell.dart'
;
part
'controller.dart'
;
\ No newline at end of file
lib/pages/user_coin/view.dart
浏览文件 @
73519107
...
...
@@ -10,45 +10,61 @@ class UserCoinPage extends StatefulWidget {
class
_UserCoinPageState
extends
State
<
UserCoinPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
CustomAppBar
(
title:
const
Text
(
'紫荆币'
),
actions:
[
GestureDetector
(
onTap:
(){
showModalBottomSheet
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
Container
(
height:
200
,
color:
Colors
.
white
,
child:
Center
(
child:
Text
(
'This is the bottom sheet content'
,
style:
TextStyle
(
fontSize:
18
),
return
GetBuilder
<
UserCoinController
>(
init:
UserCoinController
(),
builder:
(
controller
)
=>
Scaffold
(
appBar:
CustomAppBar
(
title:
const
Text
(
'紫荆币'
),
actions:
[
GestureDetector
(
onTap:
(){
showModalBottomSheet
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
Container
(
height:
200
,
color:
Colors
.
white
,
child:
const
Center
(
child:
Text
(
'This is the bottom sheet content'
,
style:
TextStyle
(
fontSize:
18
),
),
),
),
);
},
).
then
((
value
)
{
print
(
'================================================================'
);
});
},
child:
Text
(
'充值'
,
style:
TextStyle
(
color:
AppTheme
.
primary
),)
)
],
),
body:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
AppTheme
.
margin
,
vertical:
AppTheme
.
margin
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
white
);
},
).
then
((
value
)
{
print
(
'================================================================'
);
});
},
child:
const
Text
(
'充值'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
14
,
height:
1.5
,
fontWeight:
Fonts
.
medium
),)
)
],
),
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
const
BuildCell
();
},
itemCount:
10
,
body:
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
child:
Container
(
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:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildCell
(
model:
controller
.
coins
[
index
],);
},
itemCount:
controller
.
coins
.
length
,
),
),
),
),
);
...
...
lib/pages/user_coin/widgets/cell.dart
浏览文件 @
73519107
part of
user_coin
;
class
BuildCell
extends
StatelessWidget
{
const
BuildCell
({
Key
?
key
})
:
super
(
key:
key
);
final
RecordModel
model
;
const
BuildCell
({
Key
?
key
,
required
this
.
model
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -10,7 +14,7 @@ class BuildCell extends StatelessWidget {
children:
[
Container
(
// color: Colors.green,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
...
...
@@ -30,15 +34,15 @@ class BuildCell extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Gaps
.
vGaps15
,
Text
(
'账户充值'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
14
,
height:
1.6
,
fontWeight:
Fonts
.
medium
),),
Text
(
'2023-12-12 18:00:00'
,
style:
TextStyle
(
color:
Colours
.
c9
,
fontSize:
10
,
height:
1.6
,)),
Text
(
model
.
remarks
??
''
,
style:
const
TextStyle
(
color:
Colours
.
c3
,
fontSize:
14
,
height:
1.6
,
fontWeight:
Fonts
.
medium
),),
Text
(
model
.
createTime
??
''
,
style:
const
TextStyle
(
color:
Colours
.
c9
,
fontSize:
10
,
height:
1.6
,)),
Gaps
.
vGaps15
,
],
)
],
),
),
Text
(
'+188'
,
style:
TextStyle
(
fontSize:
17
,
fontWeight:
Fonts
.
medium
,
color:
AppTheme
.
primary
),)
Text
(
model
.
options
==
1
?
'+
${model.numbers}
'
:
'-
${model.numbers}
'
,
style:
const
TextStyle
(
fontSize:
17
,
fontWeight:
Fonts
.
medium
,
color:
AppTheme
.
primary
),)
],
),
),
...
...
lib/pages/user_point/controller.dart
0 → 100644
浏览文件 @
73519107
part of
user_point
;
class
UserPointController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
List
<
RecordModel
>
points
=
[];
final
int
_limit
=
10
;
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onClose
()
{
refreshController
.
dispose
();
super
.
onClose
();
}
/// 获取课程内图书列表
Future
<
void
>
_getPoint
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
point
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
points
.
clear
();
points
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getPoint
(
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
_getPoint
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
lib/pages/user_point/index.dart
0 → 100644
浏览文件 @
73519107
library
user_point
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
part
'view.dart'
;
part
'widgets/cell.dart'
;
part
'controller.dart'
;
\ No newline at end of file
lib/pages/user_point/view.dart
0 → 100644
浏览文件 @
73519107
part of
user_point
;
class
UserPointPage
extends
StatefulWidget
{
const
UserPointPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
UserPointPage
>
createState
()
=>
_UserPointPageState
();
}
class
_UserPointPageState
extends
State
<
UserPointPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
UserPointController
>(
init:
UserPointController
(),
builder:
(
controller
)
=>
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'积分'
),
),
body:
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onRefresh:
controller
.
onRefresh
,
onLoading:
controller
.
onLoading
,
child:
Container
(
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:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
BuildCell
(
model:
controller
.
points
[
index
],);
},
itemCount:
controller
.
points
.
length
,
),
),
),
),
);
}
}
lib/pages/user_point/widgets/cell.dart
0 → 100644
浏览文件 @
73519107
part of
user_point
;
class
BuildCell
extends
StatelessWidget
{
final
RecordModel
model
;
const
BuildCell
({
Key
?
key
,
required
this
.
model
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
// color: Colors.green,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
child:
Row
(
children:
[
Container
(
width:
27
,
height:
27
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
13.5
),
color:
Colors
.
cyan
,
),
),
Gaps
.
hGaps10
,
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Gaps
.
vGaps15
,
Text
(
model
.
remarks
??
''
,
style:
const
TextStyle
(
color:
Colours
.
c3
,
fontSize:
14
,
height:
1.6
,
fontWeight:
Fonts
.
medium
),),
Text
(
model
.
createTime
??
''
,
style:
const
TextStyle
(
color:
Colours
.
c9
,
fontSize:
10
,
height:
1.6
,)),
Gaps
.
vGaps15
,
],
)
],
),
),
Text
(
model
.
options
==
1
?
'+
${model.numbers}
'
:
'-
${model.numbers}
'
,
style:
const
TextStyle
(
fontSize:
17
,
fontWeight:
Fonts
.
medium
,
color:
AppTheme
.
primary
),)
],
),
),
Container
(
color:
Colours
.
cLine
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
],
);
}
}
lib/routes/index.dart
浏览文件 @
73519107
...
...
@@ -23,6 +23,7 @@ import 'package:flutter_book/pages/user_love/index.dart';
import
'package:flutter_book/pages/user_msg/index.dart'
;
import
'package:flutter_book/pages/user_nick/index.dart'
;
import
'package:flutter_book/pages/user_notes/index.dart'
;
import
'package:flutter_book/pages/user_point/index.dart'
;
import
'package:flutter_book/pages/user_wrong/index.dart'
;
import
'package:flutter_book/pages/web/index.dart'
;
import
'package:go_router/go_router.dart'
;
...
...
lib/routes/routes.dart
浏览文件 @
73519107
...
...
@@ -60,8 +60,10 @@ abstract class Routes {
static
const
versionDes
=
'version_des'
;
// 我的收藏
static
const
collect
=
'collect'
;
// 紫金币
// 紫金币
记录
static
const
coin
=
'coin'
;
// 积分记录
static
const
point
=
'point'
;
// 消息
static
const
msgs
=
'msgs'
;
// 关于
...
...
@@ -306,6 +308,15 @@ abstract class Routes {
child:
const
UserWrongPage
()
)
),
GoRoute
(
path:
'/
$point
'
,
name:
point
,
pageBuilder:
(
context
,
state
)
=>
CupertinoPage
(
name:
state
.
uri
.
toString
(),
key:
state
.
pageKey
,
child:
const
UserPointPage
()
)
),
]
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论