Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
9254a4f2
提交
9254a4f2
authored
4月 24, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
格式化代码
上级
3e998548
隐藏空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
421 行增加
和
525 行删除
+421
-525
controller.dart
lib/pages/ad/controller.dart
+11
-11
controller.dart
lib/pages/answer/controller.dart
+1
-4
controller.dart
lib/pages/book_score/controller.dart
+9
-17
controller.dart
lib/pages/book_shop/controller.dart
+56
-46
controller.dart
lib/pages/change_phone/controller.dart
+18
-17
controller.dart
lib/pages/change_pwd/controller.dart
+35
-29
controller.dart
lib/pages/course/controller.dart
+15
-23
controller.dart
lib/pages/forget_pwd/controller.dart
+18
-17
controller.dart
lib/pages/help_center/controller.dart
+7
-14
controller.dart
lib/pages/login/controller.dart
+39
-40
controller.dart
lib/pages/main/controller.dart
+1
-5
controller.dart
lib/pages/search/controller.dart
+13
-25
controller.dart
lib/pages/study_history/controller.dart
+4
-11
controller.dart
lib/pages/study_report/controller.dart
+3
-5
controller.dart
lib/pages/user_coin/controller.dart
+3
-11
controller.dart
lib/pages/user_coupon/controller.dart
+6
-12
controller.dart
lib/pages/user_discuss/controller.dart
+4
-11
controller.dart
lib/pages/user_discuss_des/controller.dart
+43
-45
controller.dart
lib/pages/user_edit_note/controller.dart
+57
-60
controller.dart
lib/pages/user_feedback/controller.dart
+6
-5
controller.dart
lib/pages/user_gender/controller.dart
+3
-3
controller.dart
lib/pages/user_info/controller.dart
+13
-15
controller.dart
lib/pages/user_love/controller.dart
+4
-13
controller.dart
lib/pages/user_msg/controller.dart
+4
-11
controller.dart
lib/pages/user_nick/controller.dart
+3
-3
controller.dart
lib/pages/user_notes/controller.dart
+4
-10
controller.dart
lib/pages/user_notes_des/controller.dart
+29
-28
controller.dart
lib/pages/user_point/controller.dart
+3
-11
controller.dart
lib/pages/user_wrong/controller.dart
+3
-10
controller.dart
lib/pages/version/controller.dart
+6
-13
没有找到文件。
lib/pages/ad/controller.dart
浏览文件 @
9254a4f2
part of
ad
;
class
AdController
extends
GetxController
{
late
BuildContext
context
;
AdController
(
this
.
context
);
int
_countdown
=
5
;
late
Timer
_timer
;
late
BuildContext
context
;
AdController
(
this
.
context
);
@override
int
_countdown
=
5
;
late
Timer
_timer
;
@override
void
onInit
()
{
super
.
onInit
();
startTime
();
}
void
startTime
(){
void
startTime
()
{
_timer
=
Timer
.
periodic
(
const
Duration
(
seconds:
1
),
(
timer
)
{
if
(
_countdown
>
0
)
{
_countdown
--;
update
();
}
else
{
}
else
{
_timer
.
cancel
();
// context.pushReplacementNamed(Routes.splash);
context
.
goNamed
(
Routes
.
main
);
...
...
@@ -28,7 +29,7 @@ class AdController extends GetxController {
@override
void
onClose
()
{
_timer
.
cancel
();
_timer
.
cancel
();
super
.
onClose
();
}
}
\ No newline at end of file
}
lib/pages/answer/controller.dart
浏览文件 @
9254a4f2
part of
answer
;
class
AnswerController
extends
GetxController
{
// 刷新token
Future
<
String
?>
refreshToken
()
async
{
final
result
=
await
CommonAPI
.
refreshToken
();
return
result
;
}
}
\ No newline at end of file
}
lib/pages/book_score/controller.dart
浏览文件 @
9254a4f2
part of
book_score
;
class
BookScoreController
extends
GetxController
{
final
String
bookId
;
final
String
bookId
;
BookScoreController
(
this
.
bookId
);
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
...
...
@@ -10,9 +11,7 @@ class BookScoreController extends GetxController {
);
// 评价列表
List
<
ScoreModel
>
scores
=
[];
List
<
ScoreModel
>
scores
=
[];
@override
void
onClose
()
{
...
...
@@ -20,33 +19,27 @@ class BookScoreController extends GetxController {
super
.
onClose
();
}
final
int
_limit
=
10
;
int
_page
=
1
;
bool
_noMore
=
false
;
/// 获取课程内图书列表
Future
<
void
>
_getScores
(
String
bookId
,[
bool
isRefresh
=
false
])
async
{
Future
<
void
>
_getScores
(
String
bookId
,
[
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
scores
(
page:
_page
,
limit:
_limit
,
bookId:
bookId
);
final
result
=
await
LibraryAPI
.
scores
(
page:
_page
,
limit:
_limit
,
bookId:
bookId
);
// 如果是刷新 清理数据
if
(
isRefresh
)
scores
.
clear
();
scores
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getScores
(
bookId
,
true
);
await
_getScores
(
bookId
,
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
...
...
@@ -66,4 +59,4 @@ class BookScoreController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/book_shop/controller.dart
浏览文件 @
9254a4f2
part of
book_shop
;
class
BookshopController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -9,6 +8,7 @@ class BookshopController extends GetxController {
// 书架数组
List
<
CourseModel
>
carts
=
[];
// 是否全选
late
bool
all
=
false
;
...
...
@@ -16,9 +16,6 @@ class BookshopController extends GetxController {
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onReady
()
{
onRefresh
();
...
...
@@ -32,15 +29,15 @@ class BookshopController extends GetxController {
}
// 选中 与 取消选中
void
select
(
CourseModel
courseModel
){
if
(
courseModel
.
status
==
1
){
void
select
(
CourseModel
courseModel
)
{
if
(
courseModel
.
status
==
1
)
{
courseModel
.
selected
=
!
courseModel
.
selected
;
}
bool
checkAll
=
true
;
for
(
CourseModel
model
in
carts
){
if
(
model
.
status
==
1
){
if
(
model
.
selected
==
false
){
for
(
CourseModel
model
in
carts
)
{
if
(
model
.
status
==
1
)
{
if
(
model
.
selected
==
false
)
{
checkAll
=
false
;
}
}
...
...
@@ -53,9 +50,9 @@ class BookshopController extends GetxController {
// 获取选中数量
int
get
num
{
int
num
=
0
;
for
(
CourseModel
model
in
carts
){
if
(
model
.
selected
==
true
){
num
++;
for
(
CourseModel
model
in
carts
)
{
if
(
model
.
selected
==
true
)
{
num
++;
}
}
return
num
;
...
...
@@ -63,12 +60,12 @@ class BookshopController extends GetxController {
// 获取总价
//总价格
double
get
allPrice
{
double
get
allPrice
{
Decimal
price
=
Decimal
.
zero
;
for
(
CourseModel
model
in
carts
)
{
if
(
model
.
status
==
1
){
if
(
model
.
selected
==
true
){
price
=
price
+
Decimal
.
parse
(
model
.
vipPrice
??
'0.00'
);
if
(
model
.
status
==
1
)
{
if
(
model
.
selected
==
true
)
{
price
=
price
+
Decimal
.
parse
(
model
.
vipPrice
??
'0.00'
);
}
}
}
...
...
@@ -94,49 +91,44 @@ class BookshopController extends GetxController {
}
* */
// 全选
void
selectAll
()
{
if
(
all
==
false
)
{
if
(
all
==
false
)
{
for
(
CourseModel
model
in
carts
)
{
if
(
model
.
status
==
1
){
if
(
model
.
status
==
1
)
{
model
.
selected
=
true
;
}
}
all
=
true
;
}
else
{
}
else
{
for
(
CourseModel
model
in
carts
)
{
if
(
model
.
status
==
1
){
if
(
model
.
status
==
1
)
{
model
.
selected
=
false
;
}
}
all
=
false
;
}
update
();
}
/// 购买的书籍
List
<
CourseModel
>
get
buy
{
List
<
CourseModel
>
temp
=
[];
for
(
CourseModel
model
in
carts
)
{
if
(
model
.
status
==
1
){
if
(
model
.
selected
==
true
)
{
temp
.
add
(
model
);
}
if
(
model
.
status
==
1
)
{
if
(
model
.
selected
==
true
)
{
temp
.
add
(
model
);
}
}
}
return
temp
;
}
/// 删除购物车 单个书籍
void
delCart
({
required
String
cartId
,
})
async
{
bool
result
=
await
ShopAPI
.
delCart
(
cartId:
cartId
);
bool
result
=
await
ShopAPI
.
delCart
(
cartId:
cartId
);
if
(
result
)
{
onRefresh
();
}
...
...
@@ -146,21 +138,16 @@ class BookshopController extends GetxController {
Future
<
void
>
getCart
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
ShopAPI
.
cart
(
page:
_page
,
limit:
_limit
);
final
result
=
await
ShopAPI
.
cart
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
carts
.
clear
();
// carts.addAll(_test());
carts
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
getCart
(
true
);
...
...
@@ -184,14 +171,38 @@ class BookshopController extends GetxController {
}
}
List
<
CourseModel
>
_test
(){
List
<
CourseModel
>
_test
()
{
return
[
CourseModel
(
bookName:
'哈1'
,
bookId:
111
,
vipPrice:
'100.33'
,
authors:
'John'
,
status:
1
),
CourseModel
(
bookName:
'哈2'
,
bookId:
123
,
vipPrice:
'12.00'
,
authors:
'json'
,
status:
1
),
CourseModel
(
bookName:
'哈3'
,
bookId:
11
,
vipPrice:
'12.43'
,
authors:
'hash'
,
status:
1
),
CourseModel
(
bookName:
'哈3'
,
bookId:
11
,
vipPrice:
'12.43'
,
authors:
'hash'
,
status:
1
),
CourseModel
(
bookName:
'哈3'
,
bookId:
11
,
vipPrice:
'12.43'
,
authors:
'hash'
,
status:
1
),
CourseModel
(
bookName:
'哈1'
,
bookId:
111
,
vipPrice:
'100.33'
,
authors:
'John'
,
status:
1
),
CourseModel
(
bookName:
'哈2'
,
bookId:
123
,
vipPrice:
'12.00'
,
authors:
'json'
,
status:
1
),
CourseModel
(
bookName:
'哈3'
,
bookId:
11
,
vipPrice:
'12.43'
,
authors:
'hash'
,
status:
1
),
CourseModel
(
bookName:
'哈3'
,
bookId:
11
,
vipPrice:
'12.43'
,
authors:
'hash'
,
status:
1
),
CourseModel
(
bookName:
'哈3'
,
bookId:
11
,
vipPrice:
'12.43'
,
authors:
'hash'
,
status:
1
),
];
}
}
\ No newline at end of file
}
lib/pages/change_phone/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -3,6 +3,7 @@ part of change_phone;
class
ChangePhoneController
extends
GetxController
{
// 账号
final
TextEditingController
phoneInput
=
TextEditingController
();
// 验证码
final
TextEditingController
codeInput
=
TextEditingController
();
...
...
@@ -10,15 +11,17 @@ class ChangePhoneController extends GetxController {
late
Timer
_timer
;
// 按钮是否可用
bool
_enable
=
false
;
bool
_enable
=
false
;
bool
get
enable
=>
_enable
;
// 倒计时60秒
int
_countDown
=
60
;
int
get
countDown
=>
_countDown
;
bool
_isCounting
=
false
;
bool
get
isCounting
=>
_isCounting
;
bool
get
isCounting
=>
_isCounting
;
// 开启定时器
void
start
()
{
...
...
@@ -35,18 +38,17 @@ class ChangePhoneController extends GetxController {
// 停止计时器
void
stop
()
{
if
(
_timer
!=
null
){
if
(
_timer
!=
null
)
{
_timer
.
cancel
();
_isCounting
=
false
;
}
_countDown
=
60
;
}
void
setCanClick
(){
if
(
phoneInput
.
text
.
length
==
11
&&
codeInput
.
text
.
length
==
6
){
void
setCanClick
()
{
if
(
phoneInput
.
text
.
length
==
11
&&
codeInput
.
text
.
length
==
6
)
{
_enable
=
true
;
}
else
{
}
else
{
_enable
=
false
;
}
update
();
...
...
@@ -57,6 +59,7 @@ class ChangePhoneController extends GetxController {
_timer
=
Timer
.
periodic
(
const
Duration
(
seconds:
1
),
(
timer
)
{
// 定时器回调
});
/// 测试账号
// if (kDebugMode) {
// phoneInput.text = '13521054068';
...
...
@@ -74,22 +77,21 @@ class ChangePhoneController extends GetxController {
super
.
onClose
();
}
void
sendCode
()
async
{
final
result
=
await
AccountAPI
.
sendCode
(
phone:
phoneInput
.
text
,
type:
'login'
);
if
(
result
){
if
(
result
)
{
Toast
.
show
(
'发送成功'
);
start
();
}
else
{
}
else
{
Toast
.
show
(
'发送失败'
);
}
}
Future
<
bool
>
changePhone
()
async
{
final
result
=
await
MineAPI
.
changePhone
(
phone:
phoneInput
.
text
,
code:
codeInput
.
text
,);
Future
<
bool
>
changePhone
()
async
{
final
result
=
await
MineAPI
.
changePhone
(
phone:
phoneInput
.
text
,
code:
codeInput
.
text
,
);
return
result
;
}
}
\ No newline at end of file
}
lib/pages/change_pwd/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -2,37 +2,42 @@ part of change_pwd;
class
ChangePwdController
extends
GetxController
{
final
UserInfoModel
userInfo
;
ChangePwdController
(
this
.
userInfo
);
// 新密码
final
TextEditingController
pwdInput
=
TextEditingController
();
// 确认密码
final
TextEditingController
pwd2Input
=
TextEditingController
();
// 显示密码
final
ValueNotifier
<
bool
>
showPassword
=
ValueNotifier
(
false
);
// 显示密码
final
ValueNotifier
<
bool
>
showPassword2
=
ValueNotifier
(
false
);
// 按钮是否可用
bool
_enable
=
false
;
bool
get
enable
=>
_enable
;
bool
_enable
=
false
;
bool
get
enable
=>
_enable
;
void
onShowPassword
()
=>
showPassword
.
value
=
!
showPassword
.
value
;
void
onShowPassword2
()
=>
showPassword2
.
value
=
!
showPassword2
.
value
;
void
setCanClick
(){
if
(
ValidatorTool
.
isValidPassword
(
pwdInput
.
text
)
&&
ValidatorTool
.
isValidPassword
(
pwd2Input
.
text
)
&&
(
pwdInput
.
text
==
pwd2Input
.
text
)){
void
setCanClick
()
{
if
(
ValidatorTool
.
isValidPassword
(
pwdInput
.
text
)
&&
ValidatorTool
.
isValidPassword
(
pwd2Input
.
text
)
&&
(
pwdInput
.
text
==
pwd2Input
.
text
))
{
Console
.
log
(
'-------
${pwdInput.text}
-------------
${pwd2Input.text}
'
);
_enable
=
true
;
}
else
{
}
else
{
_enable
=
false
;
}
update
();
}
@override
void
onClose
()
{
pwd2Input
.
dispose
();
...
...
@@ -40,32 +45,33 @@ class ChangePwdController extends GetxController {
super
.
onClose
();
}
Future
<
bool
>
changePwd
()
async
{
Future
<
bool
>
changePwd
()
async
{
final
result
=
await
MineAPI
.
changePwd
(
password:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwdInput
.
text
)),
rePassword:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwd2Input
.
text
))
);
if
(
result
){
userInfo
.
password
=
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwdInput
.
text
));
rePassword:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwd2Input
.
text
)));
if
(
result
)
{
userInfo
.
password
=
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwdInput
.
text
));
update
();
}
return
result
;
}
// void resetPassword(BuildContext context) async {
// final result = await AccountAPI.resetPassword(
// phone: phone,
// code: code,
// password: pwdInput.text,
// rePassword: pwd2Input.text
// );
// if (result){
// if (context.mounted){
// context.goNamed(Routes.login);
// }
// }
// else{
//
// }
// }
// void resetPassword(BuildContext context) async {
// final result = await AccountAPI.resetPassword(
// phone: phone,
// code: code,
// password: pwdInput.text,
// rePassword: pwd2Input.text
// );
// if (result){
// if (context.mounted){
// context.goNamed(Routes.login);
// }
// }
// else{
//
// }
// }
}
lib/pages/course/controller.dart
浏览文件 @
9254a4f2
part of
course
;
class
CourseController
extends
GetxController
{
// 课程数组
List
<
CourseModel
>
courses
=
[];
// 消息数组
List
<
AdModel
>
ads
=
[];
...
...
@@ -48,26 +47,21 @@ class CourseController extends GetxController {
/// 获取图书详细信息
Future
<
BookDetailModel
>
getBookDetails
(
String
bookId
)
async
{
final
result
=
await
LibraryAPI
.
details
(
bookId:
bookId
);
final
result
=
await
LibraryAPI
.
details
(
bookId:
bookId
);
return
result
;
}
/// 获取课程内图书列表
Future
<
void
>
_getCourse
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
CourseAPI
.
list
(
page:
_page
,
limit:
_limit
);
final
result
=
await
CourseAPI
.
list
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
courses
.
clear
();
courses
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -93,15 +87,14 @@ class CourseController extends GetxController {
}
}
// void logout(BuildContext context) async {
// final result = await AccountAPI.logout();
// if (result){
// CustomToast.success('退出成功');
// await UserStore.to.logout();
// if(context.mounted){
// context.goNamed(Routes.main);
// }
// }
// }
}
\ No newline at end of file
// void logout(BuildContext context) async {
// final result = await AccountAPI.logout();
// if (result){
// CustomToast.success('退出成功');
// await UserStore.to.logout();
// if(context.mounted){
// context.goNamed(Routes.main);
// }
// }
// }
}
lib/pages/forget_pwd/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -3,6 +3,7 @@ part of forget_pwd;
class
ForgetPwdController
extends
GetxController
{
// 账号
final
TextEditingController
phoneInput
=
TextEditingController
();
// 验证码
final
TextEditingController
codeInput
=
TextEditingController
();
...
...
@@ -10,15 +11,17 @@ class ForgetPwdController extends GetxController {
late
Timer
_timer
;
// 按钮是否可用
bool
_enable
=
false
;
bool
_enable
=
false
;
bool
get
enable
=>
_enable
;
// 倒计时60秒
int
_countDown
=
60
;
int
get
countDown
=>
_countDown
;
bool
_isCounting
=
false
;
bool
get
isCounting
=>
_isCounting
;
bool
get
isCounting
=>
_isCounting
;
// 开启定时器
void
start
()
{
...
...
@@ -35,18 +38,18 @@ class ForgetPwdController extends GetxController {
// 停止计时器
void
stop
()
{
if
(
_timer
!=
null
){
if
(
_timer
!=
null
)
{
_timer
.
cancel
();
_isCounting
=
false
;
}
_countDown
=
60
;
}
void
setCanClick
(){
if
(
ValidatorTool
.
isValidPhoneNumber
(
phoneInput
.
text
)&&
codeInput
.
text
.
length
==
6
){
void
setCanClick
()
{
if
(
ValidatorTool
.
isValidPhoneNumber
(
phoneInput
.
text
)
&&
codeInput
.
text
.
length
==
6
)
{
_enable
=
true
;
}
else
{
}
else
{
_enable
=
false
;
}
update
();
...
...
@@ -57,6 +60,7 @@ class ForgetPwdController extends GetxController {
_timer
=
Timer
.
periodic
(
const
Duration
(
seconds:
1
),
(
timer
)
{
// 定时器回调
});
/// 测试账号
// if (kDebugMode) {
// phoneInput.text = '13521054068';
...
...
@@ -74,22 +78,20 @@ class ForgetPwdController extends GetxController {
super
.
onClose
();
}
void
sendCode
()
async
{
final
result
=
await
AccountAPI
.
sendCode
(
phone:
phoneInput
.
text
,
type:
'login'
);
if
(
result
){
final
result
=
await
AccountAPI
.
sendCode
(
phone:
phoneInput
.
text
,
type:
'login'
);
if
(
result
)
{
Toast
.
show
(
'发送成功'
);
start
();
}
else
{
}
else
{
Toast
.
show
(
'发送失败'
);
}
}
Future
<
bool
>
checkCode
()
async
{
final
result
=
await
AccountAPI
.
checkCode
(
phone:
phoneInput
.
text
,
code:
codeInput
.
text
);
final
result
=
await
AccountAPI
.
checkCode
(
phone:
phoneInput
.
text
,
code:
codeInput
.
text
);
return
result
;
}
}
\ No newline at end of file
}
lib/pages/help_center/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -11,7 +11,6 @@ class HelpCenterController extends GetxController {
bool
_noMore
=
false
;
List
<
HelpCenterModel
>
helpCenters
=
[];
@override
void
onClose
()
{
refreshController
.
dispose
();
...
...
@@ -22,17 +21,13 @@ class HelpCenterController extends GetxController {
Future
<
void
>
_gethelpCenters
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
helpCenters
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
helpCenters
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
helpCenters
.
clear
();
helpCenters
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -58,12 +53,11 @@ class HelpCenterController extends GetxController {
}
}
List
<
HelpCenterModel
>
test
(){
List
<
HelpCenterModel
>
test
()
{
return
[
HelpCenterModel
(
id:
1
,
helpTitle:
'账号注册'
),
HelpCenterModel
(
id:
2
,
helpTitle:
'如何进行充值'
),
HelpCenterModel
(
id:
3
,
helpTitle:
'如何对内容进行划线'
),
HelpCenterModel
(
id:
1
,
helpTitle:
'账号注册'
),
HelpCenterModel
(
id:
2
,
helpTitle:
'如何进行充值'
),
HelpCenterModel
(
id:
3
,
helpTitle:
'如何对内容进行划线'
),
];
}
}
\ No newline at end of file
}
lib/pages/login/controller.dart
浏览文件 @
9254a4f2
part of
login
;
enum
LoginType
{
code
,
password
}
enum
LoginType
{
code
,
password
}
class
LoginController
extends
GetxController
{
// 0:密码登录 1:验证码登录
late
int
loginType
=
0
;
// 2、密码登录
// 账号
final
TextEditingController
phoneInput
=
TextEditingController
();
// 密码
final
TextEditingController
passwordInput
=
TextEditingController
();
// 验证码
final
TextEditingController
codeInput
=
TextEditingController
();
// 显示密码
final
ValueNotifier
<
bool
>
showPassword
=
ValueNotifier
(
false
);
// 定时器
late
Timer
_timer
;
// 按钮是否可用
bool
_enable
=
false
;
bool
_enable
=
false
;
bool
get
enable
=>
_enable
;
// 倒计时60秒
int
_countDown
=
60
;
int
get
countDown
=>
_countDown
;
bool
_isCounting
=
false
;
bool
get
isCounting
=>
_isCounting
;
// 同意协议
bool
_agree
=
false
;
bool
get
agree
=>
_agree
;
void
setAgree
()
{
_agree
=
!
_agree
;
update
();
...
...
@@ -52,27 +60,26 @@ class LoginController extends GetxController {
// 停止计时器
void
stop
()
{
if
(
_timer
!=
null
){
if
(
_timer
!=
null
)
{
_timer
.
cancel
();
_isCounting
=
false
;
}
_countDown
=
60
;
}
void
setCanClick
(){
if
(
loginType
==
0
){
if
(
ValidatorTool
.
isValidPhoneNumber
(
phoneInput
.
text
)
&&
ValidatorTool
.
isValidPassword
(
passwordInput
.
text
)){
void
setCanClick
()
{
if
(
loginType
==
0
)
{
if
(
ValidatorTool
.
isValidPhoneNumber
(
phoneInput
.
text
)
&&
ValidatorTool
.
isValidPassword
(
passwordInput
.
text
))
{
_enable
=
true
;
}
else
{
}
else
{
_enable
=
false
;
}
}
else
{
if
(
ValidatorTool
.
isValidPhoneNumber
(
phoneInput
.
text
)
&&
ValidatorTool
.
isValidCode
(
codeInput
.
text
))
{
}
else
{
if
(
ValidatorTool
.
isValidPhoneNumber
(
phoneInput
.
text
)
&&
ValidatorTool
.
isValidCode
(
codeInput
.
text
))
{
_enable
=
true
;
}
else
{
}
else
{
_enable
=
false
;
}
}
...
...
@@ -80,18 +87,18 @@ class LoginController extends GetxController {
update
();
}
@override
void
onInit
()
{
_timer
=
Timer
.
periodic
(
const
Duration
(
seconds:
1
),
(
timer
)
{
// 定时器回调
});
/// 测试账号
if
(
kDebugMode
)
{
phoneInput
.
text
=
'18810760819'
;
passwordInput
.
text
=
'1234567m'
;
// phoneInput.text = '17311837355';
// passwordInput.text = '12345678';
phoneInput
.
text
=
'18810760819'
;
passwordInput
.
text
=
'1234567m'
;
// phoneInput.text = '17311837355';
// passwordInput.text = '12345678';
}
super
.
onInit
();
}
...
...
@@ -109,7 +116,7 @@ class LoginController extends GetxController {
void
onShowPassword
()
=>
showPassword
.
value
=
!
showPassword
.
value
;
void
updateLoginType
(
int
value
){
void
updateLoginType
(
int
value
)
{
stop
();
loginType
=
value
;
update
();
...
...
@@ -131,16 +138,12 @@ class LoginController extends GetxController {
phone:
phoneInput
.
text
,
password:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
passwordInput
.
text
)),
code:
codeInput
.
text
,
type:
type
);
if
((
result
.
token
??
''
).
isEmpty
)
return
;
type:
type
);
if
((
result
.
token
??
''
).
isEmpty
)
return
;
// 存储用户信息
await
Future
.
wait
([
UserStore
.
to
.
login
(
result
)
]);
await
Future
.
wait
([
UserStore
.
to
.
login
(
result
)]);
// await Future.wait([
// UserStore.to.setToken(result.token!),
// UserStore.to.setAccessToken(result.accessToken!),
...
...
@@ -152,15 +155,14 @@ class LoginController extends GetxController {
// UserStore.to.profile(),
// ]);
if
(
context
.
mounted
){
if
(
context
.
mounted
)
{
// context.goNamed(Routes.main);
Future
.
delayed
(
const
Duration
(
milliseconds:
10
)).
then
((
value
){
Future
.
delayed
(
const
Duration
(
milliseconds:
10
)).
then
((
value
)
{
context
.
pop
();
});
}
else
{
}
else
{
context
.
goNamed
(
Routes
.
main
);
}
}
void
sendCode
()
async
{
...
...
@@ -168,15 +170,13 @@ class LoginController extends GetxController {
Toast
.
show
(
'请先阅读并同意《用户协议》和《隐私政策》'
);
return
;
}
final
result
=
await
AccountAPI
.
sendCode
(
phone:
phoneInput
.
text
,
type:
'login'
);
if
(
result
){
final
result
=
await
AccountAPI
.
sendCode
(
phone:
phoneInput
.
text
,
type:
'login'
);
if
(
result
)
{
Toast
.
show
(
'发送成功'
);
start
();
}
else
{
}
else
{
Toast
.
show
(
'发送失败'
);
}
}
}
\ No newline at end of file
}
lib/pages/main/controller.dart
浏览文件 @
9254a4f2
part of
main
;
class
MainController
extends
GetxController
{
late
final
PageController
pageController
;
...
...
@@ -23,6 +22,4 @@ class MainController extends GetxController {
currentPage
=
page
;
update
([
'navigation'
]);
}
}
\ No newline at end of file
}
lib/pages/search/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -7,8 +7,10 @@ class SearchController extends GetxController {
);
late
TextEditingController
searchController
=
TextEditingController
();
bool
showHistory
=
true
;
// 搜索记录数组
List
<
String
>
records
=
[];
// 书籍数组
List
<
CourseModel
>
books
=
[];
...
...
@@ -49,19 +51,15 @@ class SearchController extends GetxController {
update
();
}
/// 收藏 与 取消收藏
void
love
({
required
String
bookId
,
required
num
isCollection
})
async
{
if
(
isCollection
==
0
){
void
love
({
required
String
bookId
,
required
num
isCollection
})
async
{
if
(
isCollection
==
0
)
{
isCollection
=
1
;
}
else
{
}
else
{
isCollection
=
0
;
}
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
if
(
result
)
{
onRefresh
();
}
...
...
@@ -71,17 +69,14 @@ class SearchController extends GetxController {
Future
<
void
>
_getBooks
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
LibraryAPI
.
books
(
page:
_page
,
limit:
_limit
,
categoryId:
''
);
final
result
=
await
LibraryAPI
.
books
(
page:
_page
,
limit:
_limit
,
categoryId:
''
);
// 如果是刷新 清理数据
if
(
isRefresh
)
books
.
clear
();
books
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -94,10 +89,8 @@ class SearchController extends GetxController {
}
}
/// 本地搜索历史
/*
/// 本地搜索历史
/*
///获取搜索关键字数据
List<String> _getHistory(){
List <String>historys = [];
...
...
@@ -147,8 +140,4 @@ class SearchController extends GetxController {
}
*/
}
\ No newline at end of file
}
lib/pages/study_history/controller.dart
浏览文件 @
9254a4f2
part of
study_history
;
class
HistoryController
extends
GetxController
{
class
HistoryController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -25,23 +25,18 @@ class HistoryController extends GetxController {
super
.
onClose
();
}
/// 获取 最近学习数据
Future
<
void
>
_getHistory
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
CommonAPI
.
history
(
page:
_page
,
limit:
_limit
);
final
result
=
await
CommonAPI
.
history
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
histories
.
clear
();
histories
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -66,5 +61,4 @@ class HistoryController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/study_report/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -2,9 +2,10 @@ part of study_report;
class
StudyReportController
extends
GetxController
{
final
String
bookId
;
StudyReportController
(
this
.
bookId
);
ReportModel
model
=
ReportModel
();
ReportModel
model
=
ReportModel
();
@override
void
onReady
()
{
...
...
@@ -12,10 +13,8 @@ class StudyReportController extends GetxController {
super
.
onReady
();
}
void
_getReport
()
async
{
model
=
await
LibraryAPI
.
report
(
bookId:
bookId
);
update
();
}
}
\ No newline at end of file
}
lib/pages/user_coin/controller.dart
浏览文件 @
9254a4f2
part of
user_coin
;
class
UserCoinController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -25,22 +24,17 @@ class UserCoinController extends GetxController {
super
.
onClose
();
}
/// 获取紫金币记录
Future
<
void
>
getCoin
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
coin
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
coin
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
coins
.
clear
();
coins
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -65,5 +59,4 @@ class UserCoinController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_coupon/controller.dart
浏览文件 @
9254a4f2
part of
user_coupon
;
class
UserCouponController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
// 优惠券
List
<
CouponModel
>
coupons
=
[];
List
<
CouponModel
>
coupons
=
[];
// late int type = 0;
...
...
@@ -28,7 +27,6 @@ class UserCouponController extends GetxController {
super
.
onClose
();
}
//
// void getOverCoupons() {
// _noMore = true;
...
...
@@ -42,9 +40,9 @@ class UserCouponController extends GetxController {
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
coupon
(
page:
_page
,
limit:
_limit
,
type:
0
,
page:
_page
,
limit:
_limit
,
type:
0
,
);
// 如果是刷新 清理数据
if
(
isRefresh
)
coupons
.
clear
();
...
...
@@ -53,10 +51,9 @@ class UserCouponController extends GetxController {
// coupons.add(model);
// }
coupons
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -81,6 +78,4 @@ class UserCouponController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_discuss/controller.dart
浏览文件 @
9254a4f2
part of
user_discuss
;
class
UserDiscussController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -13,7 +12,6 @@ class UserDiscussController extends GetxController {
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onReady
()
{
onRefresh
();
...
...
@@ -30,17 +28,13 @@ class UserDiscussController extends GetxController {
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
discuss
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
discuss
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
discuss
.
clear
();
discuss
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -66,11 +60,11 @@ class UserDiscussController extends GetxController {
}
}
List
<
CourseModel
>
_test
(){
List
<
CourseModel
>
_test
()
{
return
[
CourseModel
(),
CourseModel
(),
CourseModel
(),
];
}
}
\ No newline at end of file
}
lib/pages/user_discuss_des/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -3,7 +3,9 @@ part of user_discuss_des;
class
UserDiscussDesController
extends
GetxController
{
final
String
tag
;
final
CourseModel
model
;
UserDiscussDesController
(
this
.
tag
,
this
.
model
);
UserDiscussDesController
(
this
.
tag
,
this
.
model
);
List
<
DiscussModel
>
discuss
=
[];
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
...
...
@@ -18,12 +20,14 @@ class UserDiscussDesController extends GetxController {
// 展示回复输入框
bool
showReply
=
false
;
// 当前要回复的模型
late
DiscussModel
discussModel
;
// 当前要回复父级的模型
late
DiscussModel
fatherDiscussModel
;
bool
canTap
=
true
;
bool
canTap
=
true
;
@override
void
onReady
()
{
...
...
@@ -42,17 +46,22 @@ class UserDiscussDesController extends GetxController {
showReply
=
!
showReply
;
update
();
}
void
setDiscussModel
(
DiscussModel
model
){
void
setDiscussModel
(
DiscussModel
model
)
{
discussModel
=
model
;
}
void
setFatherDiscussModel
(
DiscussModel
model
){
void
setFatherDiscussModel
(
DiscussModel
model
)
{
fatherDiscussModel
=
model
;
}
// 删除回复
Future
<
void
>
delComment
({
required
List
<
DiscussModel
>?
list
,
required
DiscussModel
discussModel
})
async
{
final
result
=
await
LibraryAPI
.
delComment
(
bookId:
model
.
bookId
!,
commentId:
discussModel
.
id
!);
if
(
result
){
Future
<
void
>
delComment
(
{
required
List
<
DiscussModel
>?
list
,
required
DiscussModel
discussModel
})
async
{
final
result
=
await
LibraryAPI
.
delComment
(
bookId:
model
.
bookId
!,
commentId:
discussModel
.
id
!);
if
(
result
)
{
list
?.
remove
(
discussModel
);
Toast
.
show
(
'删除成功'
);
}
...
...
@@ -60,11 +69,10 @@ class UserDiscussDesController extends GetxController {
}
Future
<
bool
>
submit
()
async
{
Map
<
String
,
dynamic
>
contentMap
=
{
'text'
:
replyInput
.
text
,
'audio'
:[],
'image'
:[]
Map
<
String
,
dynamic
>
contentMap
=
{
'text'
:
replyInput
.
text
,
'audio'
:
[],
'image'
:
[]
};
final
result
=
await
LibraryAPI
.
addDiscuss
(
...
...
@@ -73,12 +81,11 @@ class UserDiscussDesController extends GetxController {
commentId:
discussModel
.
id
.
toString
(),
quoteContent:
''
,
title:
''
,
content:
jsonEncode
(
contentMap
)
);
content:
jsonEncode
(
contentMap
));
if
(
result
.
isNotEmpty
)
{
if
(
result
.
isNotEmpty
)
{
Toast
.
show
(
'发表成功'
);
discussModel
.
replyNum
=
discussModel
.
replyNum
!
+
1
;
discussModel
.
replyNum
=
discussModel
.
replyNum
!
+
1
;
DiscussModel
tempModel
=
DiscussModel
.
fromJson
(
discussModel
.
toJson
());
// tempModel.status = 1;
tempModel
.
privacyStatus
=
0
;
...
...
@@ -87,25 +94,23 @@ class UserDiscussDesController extends GetxController {
tempModel
.
id
=
result
[
'id'
];
NoteContentModel
contentModel
=
NoteContentModel
(
text:
MediaModel
(
content:
replyInput
.
text
,
privacyStatus:
1
)
);
tempModel
.
content
=
contentModel
;
text:
MediaModel
(
content:
replyInput
.
text
,
privacyStatus:
1
));
tempModel
.
content
=
contentModel
;
tempModel
.
content
?.
text
?.
privacyStatus
=
1
;
tempModel
.
replacePersonName
=
discussModel
.
personName
;
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'head_img'
)){
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'head_img'
))
{
tempModel
.
personPic
=
map
[
'head_img'
];
}
if
(
map
.
keys
.
contains
(
'name'
)){
if
(
map
.
keys
.
contains
(
'name'
))
{
tempModel
.
personName
=
map
[
'name'
];
}
tempModel
.
replyNum
=
0
;
fatherDiscussModel
.
commentAll
?.
add
(
tempModel
);
// fatherDiscussModel.replyNum = fatherDiscussModel.commentAll?.length;
}
else
{
}
else
{
Toast
.
show
(
'发表失败'
);
}
replyInput
.
text
=
''
;
...
...
@@ -114,23 +119,22 @@ class UserDiscussDesController extends GetxController {
// 重置所有信息
// reset();
// setShowChat(false);
return
result
.
isNotEmpty
?
true
:
false
;
return
result
.
isNotEmpty
?
true
:
false
;
}
Future
<
void
>
commentLove
({
required
DiscussModel
discussModel
})
async
{
num
type
=
0
;
if
(
discussModel
.
isPraise
==
0
)
{
if
(
discussModel
.
isPraise
==
0
)
{
type
=
1
;
}
final
result
=
await
LibraryAPI
.
commentLove
(
bookId:
model
.
bookId
!
,
type:
type
,
commentId:
discussModel
.
id
!);
if
(
result
){
num
goodNum
=
discussModel
.
goodNum
??
0
;
if
(
type
==
0
){
goodNum
--;
}
else
{
goodNum
++;
final
result
=
await
LibraryAPI
.
commentLove
(
bookId:
model
.
bookId
!,
type:
type
,
commentId:
discussModel
.
id
!);
if
(
result
)
{
num
goodNum
=
discussModel
.
goodNum
??
0
;
if
(
type
==
0
)
{
goodNum
--;
}
else
{
goodNum
++;
}
discussModel
.
isPraise
=
type
;
discussModel
.
goodNum
=
goodNum
;
...
...
@@ -146,15 +150,13 @@ class UserDiscussDesController extends GetxController {
page:
_page
,
limit:
_limit
,
bookId:
model
.
bookId
.
toString
(),
types:
tag
);
types:
tag
);
// 如果是刷新 清理数据
if
(
isRefresh
)
discuss
.
clear
();
discuss
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -180,7 +182,4 @@ class UserDiscussDesController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_edit_note/controller.dart
浏览文件 @
9254a4f2
part of
user_edit_note
;
class
UserEditNoteController
extends
GetxController
{
final
NoteModel
model
;
final
String
bookId
;
late
TextEditingController
contentInput
;
UserEditNoteController
(
this
.
model
,
this
.
bookId
){
UserEditNoteController
(
this
.
model
,
this
.
bookId
)
{
_setDuration
();
contentInput
=
TextEditingController
(
text:
model
.
noteContent
?.
text
?.
content
);
contentInput
=
TextEditingController
(
text:
model
.
noteContent
?.
text
?.
content
);
}
// 录音
final
FlutterSoundRecorder
_mRecorder
=
FlutterSoundRecorder
();
just_audio
.
AudioPlayer
audioPlayer
=
just_audio
.
AudioPlayer
();
// 录音开始
bool
startRecording
=
false
;
// 笔记是否公开
bool
isPublic
=
false
;
...
...
@@ -26,7 +29,7 @@ class UserEditNoteController extends GetxController {
@override
void
onInit
()
{
isPublic
=
model
.
isOpen
==
1
?
true
:
false
;
isPublic
=
model
.
isOpen
==
1
?
true
:
false
;
super
.
onInit
();
}
...
...
@@ -39,14 +42,16 @@ class UserEditNoteController extends GetxController {
}
// 设置笔记是否公开
void
setIsPublic
(){
void
setIsPublic
()
{
isPublic
=
!
isPublic
;
update
();
}
// 配置音频时长
void
_setDuration
()
async
{
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
audio
!){
Duration
?
duration
=
await
just_audio
.
AudioPlayer
().
setUrl
(
mediaModel
.
content
??
''
);
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
audio
!)
{
Duration
?
duration
=
await
just_audio
.
AudioPlayer
().
setUrl
(
mediaModel
.
content
??
''
);
mediaModel
.
duration
=
Tools
.
formatDuration
(
duration
!);
}
...
...
@@ -54,48 +59,48 @@ class UserEditNoteController extends GetxController {
}
// 删除图片
void
delImage
(
MediaModel
mediaModel
){
model
.
noteContent
!.
image
!.
remove
(
mediaModel
);
update
();
void
delImage
(
MediaModel
mediaModel
)
{
model
.
noteContent
!.
image
!.
remove
(
mediaModel
);
update
();
}
// 删除音频
void
delAudio
(
MediaModel
mediaModel
){
void
delAudio
(
MediaModel
mediaModel
)
{
model
.
noteContent
!.
audio
!.
remove
(
mediaModel
);
// 新加的录音 如果删除要删除源文件
if
(
mediaModel
.
id
==
0
){
}
if
(
mediaModel
.
id
==
0
)
{}
update
();
}
// 添加音频
void
addAudio
(
String
path
,
String
duration
)
{
MediaModel
mediaModel
=
MediaModel
(
path:
path
,
id:
0
,
duration:
duration
);
void
addAudio
(
String
path
,
String
duration
)
{
MediaModel
mediaModel
=
MediaModel
(
path:
path
,
id:
0
,
duration:
duration
);
model
.
noteContent
!.
audio
!.
add
(
mediaModel
);
update
();
}
// 添加图片
void
addImage
(
String
path
){
MediaModel
mediaModel
=
MediaModel
(
path:
path
,
id:
0
);
void
addImage
(
String
path
)
{
MediaModel
mediaModel
=
MediaModel
(
path:
path
,
id:
0
);
model
.
noteContent
!.
image
!.
add
(
mediaModel
);
update
();
}
// 初始化录音组件
Future
<
void
>
openTheRecorder
()
async
{
if
(!
initRecorder
)
{
if
(!
initRecorder
)
{
// 获取权限
if
(
await
Access
.
microphone
())
{
if
(
await
Access
.
microphone
())
{
await
_mRecorder
.
openRecorder
();
final
session
=
await
AudioSession
.
instance
;
await
session
.
configure
(
AudioSessionConfiguration
(
avAudioSessionCategory:
AVAudioSessionCategory
.
playAndRecord
,
avAudioSessionCategoryOptions:
AVAudioSessionCategoryOptions
.
allowBluetooth
|
AVAudioSessionCategoryOptions
.
defaultToSpeaker
,
AVAudioSessionCategoryOptions
.
allowBluetooth
|
AVAudioSessionCategoryOptions
.
defaultToSpeaker
,
avAudioSessionMode:
AVAudioSessionMode
.
spokenAudio
,
avAudioSessionRouteSharingPolicy:
AVAudioSessionRouteSharingPolicy
.
defaultPolicy
,
AVAudioSessionRouteSharingPolicy
.
defaultPolicy
,
avAudioSessionSetActiveOptions:
AVAudioSessionSetActiveOptions
.
none
,
androidAudioAttributes:
const
AndroidAudioAttributes
(
contentType:
AndroidAudioContentType
.
speech
,
...
...
@@ -107,9 +112,7 @@ class UserEditNoteController extends GetxController {
));
}
// 没有权限
else
{
}
else
{}
}
initRecorder
=
true
;
}
...
...
@@ -126,12 +129,11 @@ class UserEditNoteController extends GetxController {
toFile:
'
$filePath
/
$fileName
'
,
audioSource:
sound_recorder_platform
.
AudioSource
.
microphone
,
codec:
Codec
.
aacMP4
,
);
}
// 停止录音
void
stopRecorder
()
async
{
// 停止录音
void
stopRecorder
()
async
{
startRecording
=
false
;
final
path
=
await
_mRecorder
.
stopRecorder
();
var
duration
=
await
audioPlayer
.
setFilePath
(
path
!);
...
...
@@ -141,8 +143,8 @@ class UserEditNoteController extends GetxController {
}
// 播放音频
void
playAudio
(
MediaModel
mediaModel
){
if
(
audioPlayer
.
playerState
.
playing
)
{
void
playAudio
(
MediaModel
mediaModel
)
{
if
(
audioPlayer
.
playerState
.
playing
)
{
audioPlayer
.
stop
();
mediaModel
.
currentDuration
=
'0:00:00'
;
// if(currentPlayMediaModel.id == mediaModel.id){
...
...
@@ -150,20 +152,21 @@ class UserEditNoteController extends GetxController {
// }
}
// 本地音频
if
(
mediaModel
.
id
==
0
){
if
(
mediaModel
.
id
==
0
)
{
audioPlayer
.
setFilePath
(
mediaModel
.
path
);
}
// 远程音频
else
{
audioPlayer
.
setUrl
(
mediaModel
.
content
??
''
);
audioPlayer
.
setUrl
(
mediaModel
.
content
??
''
);
}
audioPlayer
.
play
();
StreamSubscription
?
positionSubscription
;
positionSubscription
=
audioPlayer
.
positionStream
.
listen
((
position
)
{
String
temp
=
Tools
.
formatDuration
(
position
);
Console
.
log
(
'播放时间---------------------
$temp
------id-------------
${mediaModel.id}
'
);
positionSubscription
=
audioPlayer
.
positionStream
.
listen
((
position
)
{
String
temp
=
Tools
.
formatDuration
(
position
);
Console
.
log
(
'播放时间---------------------
$temp
------id-------------
${mediaModel.id}
'
);
mediaModel
.
currentDuration
=
temp
;
if
(
position
>=
audioPlayer
.
duration
!)
{
if
(
position
>=
audioPlayer
.
duration
!)
{
Console
.
log
(
'---------播放结束-----------'
);
positionSubscription
?.
cancel
();
}
...
...
@@ -173,9 +176,7 @@ class UserEditNoteController extends GetxController {
}
// 上传文件
Future
<
String
>
upload
({
required
String
path
})
async
{
Future
<
String
>
upload
({
required
String
path
})
async
{
// String result = await CommonAPI.upload(path:path,fileTypes: 'comment');
// return result;
OssTool
tool
=
OssTool
(
'zxts-comment-file'
);
...
...
@@ -187,16 +188,16 @@ class UserEditNoteController extends GetxController {
Future
<
bool
>
submit
()
async
{
CustomToast
.
loading
();
// 循环上传图片获取地址
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
image
!)
{
if
(
mediaModel
.
id
==
0
){
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
image
!)
{
if
(
mediaModel
.
id
==
0
)
{
final
url
=
await
upload
(
path:
mediaModel
.
path
);
mediaModel
.
content
=
url
;
}
}
// 循环上传音频获取地址
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
audio
!)
{
if
(
mediaModel
.
id
==
0
){
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
audio
!)
{
if
(
mediaModel
.
id
==
0
)
{
final
url
=
await
upload
(
path:
mediaModel
.
path
);
mediaModel
.
content
=
url
;
}
...
...
@@ -205,37 +206,34 @@ class UserEditNoteController extends GetxController {
// 组织图片
List
<
Map
>
images
=
[];
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
image
!)
{
images
.
add
(
mediaModel
.
toJson
());
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
image
!)
{
images
.
add
(
mediaModel
.
toJson
());
}
// 组织音频
List
<
Map
>
audios
=
[];
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
audio
!)
{
audios
.
add
(
mediaModel
.
toJson
());
for
(
MediaModel
mediaModel
in
model
.
noteContent
!.
audio
!)
{
audios
.
add
(
mediaModel
.
toJson
());
}
model
.
noteContent
!.
text
!.
content
=
contentInput
.
text
;
Map
<
String
,
dynamic
>
contentMap
=
{
'text'
:
model
.
noteContent
!.
text
!.
toJson
(),
'audio'
:
audios
,
'image'
:
images
Map
<
String
,
dynamic
>
contentMap
=
{
'text'
:
model
.
noteContent
!.
text
!.
toJson
(),
'audio'
:
audios
,
'image'
:
images
};
String
isOpen
=
'0'
;
if
(
isPublic
)
{
if
(
isPublic
)
{
isOpen
=
'1'
;
}
final
result
=
MineAPI
.
editNotes
(
content:
model
.
content
??
''
,
content:
model
.
content
??
''
,
notesId:
model
.
notesId
.
toString
(),
bookId:
bookId
,
noteContent:
jsonEncode
(
contentMap
),
isOpen:
isOpen
);
isOpen:
isOpen
);
return
result
;
}
}
\ No newline at end of file
}
lib/pages/user_feedback/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -3,8 +3,10 @@ part of user_feedback;
/// 提交意见反馈
class
UserFeedbackController
extends
GetxController
{
late
TextEditingController
searchController
=
TextEditingController
();
// 按钮是否可用
bool
_enable
=
false
;
bool
_enable
=
false
;
bool
get
enable
=>
_enable
;
/// 提交意见反馈
...
...
@@ -17,11 +19,10 @@ class UserFeedbackController extends GetxController {
return
result
;
}
void
setCanClick
(){
if
(
searchController
.
text
.
isNotEmpty
){
void
setCanClick
()
{
if
(
searchController
.
text
.
isNotEmpty
)
{
_enable
=
true
;
}
else
{
}
else
{
_enable
=
false
;
}
update
();
...
...
lib/pages/user_gender/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -10,9 +10,9 @@ class UserGenderController extends GetxController {
final
result
=
await
MineAPI
.
changeInfo
(
sex:
sex
);
if
(
result
)
{
Toast
.
show
(
'修改成功'
);
userInfo
.
sex
=
sex
;
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'sex'
)){
userInfo
.
sex
=
sex
;
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'sex'
))
{
map
[
'sex'
]
=
sex
;
await
StorageService
.
to
.
setString
(
kLocalUserInfo
,
jsonEncode
(
map
));
}
...
...
lib/pages/user_info/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -2,20 +2,21 @@ part of user_info;
class
UserInfoController
extends
GetxController
{
final
UserInfoModel
userInfo
;
UserInfoController
(
this
.
userInfo
);
// 时候展示底部视图
bool
showDetail
=
false
;
/// 上传头像
void
upload
({
required
String
path
})
async
{
// String result = await CommonAPI.upload(path:path,fileTypes: 'user');
OssTool
tool
=
OssTool
(
'zxts-user-file'
);
final
response
=
await
tool
.
putObjectFile
(
path
);
_changeInfo
(
response
.
realUri
.
toString
());
void
upload
({
required
String
path
})
async
{
// String result = await CommonAPI.upload(path:path,fileTypes: 'user');
OssTool
tool
=
OssTool
(
'zxts-user-file'
);
final
response
=
await
tool
.
putObjectFile
(
path
);
_changeInfo
(
response
.
realUri
.
toString
());
}
void
show
(){
void
show
()
{
showDetail
=
!
showDetail
;
update
();
}
...
...
@@ -23,11 +24,11 @@ class UserInfoController extends GetxController {
/// 修改用用户信息
void
_changeInfo
(
String
img
)
async
{
final
result
=
await
MineAPI
.
changeInfo
(
headImg:
img
);
if
(
result
)
{
if
(
result
)
{
Toast
.
show
(
'修改成功'
);
userInfo
.
headImg
=
img
;
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'head_img'
)){
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'head_img'
))
{
map
[
'head_img'
]
=
img
;
await
StorageService
.
to
.
setString
(
kLocalUserInfo
,
jsonEncode
(
map
));
}
...
...
@@ -35,6 +36,4 @@ class UserInfoController extends GetxController {
Get
.
put
(
MineController
()).
getInfo
();
}
}
}
\ No newline at end of file
}
lib/pages/user_love/controller.dart
浏览文件 @
9254a4f2
part of
user_love
;
class
UserLoveController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -27,9 +26,7 @@ class UserLoveController extends GetxController {
}
/// 取消收藏
void
unLoved
({
required
String
bookId
})
async
{
void
unLoved
({
required
String
bookId
})
async
{
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
'0'
);
if
(
result
)
{
onRefresh
();
...
...
@@ -40,17 +37,13 @@ class UserLoveController extends GetxController {
Future
<
void
>
_getLoves
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
love
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
love
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
loves
.
clear
();
loves
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -75,5 +68,4 @@ class UserLoveController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_msg/controller.dart
浏览文件 @
9254a4f2
part of
user_msg
;
class
MsgController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -28,7 +26,7 @@ class MsgController extends GetxController {
/// 消息未读变已读
Future
<
bool
>
read
(
MsgModel
model
)
async
{
final
result
=
await
CommonAPI
.
read
(
id:
model
.
id
.
toString
());
if
(
result
){
if
(
result
)
{
model
.
status
=
1
;
}
update
();
...
...
@@ -45,17 +43,13 @@ class MsgController extends GetxController {
Future
<
void
>
_getMsgs
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
CommonAPI
.
msgs
(
page:
_page
,
limit:
_limit
);
final
result
=
await
CommonAPI
.
msgs
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
msgs
.
clear
();
msgs
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -80,4 +74,4 @@ class MsgController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_nick/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -11,10 +11,10 @@ class UserNickController extends GetxController {
if
(
result
)
{
Toast
.
show
(
'修改成功'
);
userInfo
.
name
=
nick
;
userInfo
.
name
=
nick
;
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'name'
)){
Map
<
String
,
dynamic
>
map
=
jsonDecode
(
StorageService
.
to
.
getString
(
kLocalUserInfo
));
if
(
map
.
keys
.
contains
(
'name'
))
{
map
[
'name'
]
=
nick
;
await
StorageService
.
to
.
setString
(
kLocalUserInfo
,
jsonEncode
(
map
));
}
...
...
lib/pages/user_notes/controller.dart
浏览文件 @
9254a4f2
part of
user_notes
;
class
UserNoteController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -29,18 +28,14 @@ class UserNoteController extends GetxController {
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
note
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
note
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
notes
.
clear
();
// notes.addAll(_test());
notes
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -66,11 +61,11 @@ class UserNoteController extends GetxController {
}
}
List
<
CourseModel
>
_test
(){
List
<
CourseModel
>
_test
()
{
return
[
CourseModel
(),
CourseModel
(),
CourseModel
(),
];
}
}
\ No newline at end of file
}
lib/pages/user_notes_des/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -3,7 +3,9 @@ part of user_notes_des;
class
UserNotesDesController
extends
GetxController
{
final
String
tag
;
final
CourseModel
model
;
UserNotesDesController
(
this
.
tag
,
this
.
model
);
UserNotesDesController
(
this
.
tag
,
this
.
model
);
List
<
NoteModel
>
notes
=
[];
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
...
...
@@ -17,7 +19,6 @@ class UserNotesDesController extends GetxController {
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onReady
()
{
// onRefresh();
...
...
@@ -32,8 +33,8 @@ class UserNotesDesController extends GetxController {
}
// 播放音频
void
playAudio
(
MediaModel
mediaModel
){
if
(
audioPlayer
.
playerState
.
playing
)
{
void
playAudio
(
MediaModel
mediaModel
)
{
if
(
audioPlayer
.
playerState
.
playing
)
{
audioPlayer
.
stop
();
mediaModel
.
currentDuration
=
'0:00:00'
;
// if(currentPlayMediaModel.id == mediaModel.id){
...
...
@@ -41,20 +42,21 @@ class UserNotesDesController extends GetxController {
// }
}
// 本地音频
if
(
mediaModel
.
id
==
0
){
if
(
mediaModel
.
id
==
0
)
{
audioPlayer
.
setFilePath
(
mediaModel
.
path
);
}
// 远程音频
else
{
audioPlayer
.
setUrl
(
mediaModel
.
content
??
''
);
audioPlayer
.
setUrl
(
mediaModel
.
content
??
''
);
}
audioPlayer
.
play
();
StreamSubscription
?
positionSubscription
;
positionSubscription
=
audioPlayer
.
positionStream
.
listen
((
position
)
{
String
temp
=
Tools
.
formatDuration
(
position
);
Console
.
log
(
'播放时间---------------------
$temp
------id-------------
${mediaModel.id}
'
);
positionSubscription
=
audioPlayer
.
positionStream
.
listen
((
position
)
{
String
temp
=
Tools
.
formatDuration
(
position
);
Console
.
log
(
'播放时间---------------------
$temp
------id-------------
${mediaModel.id}
'
);
mediaModel
.
currentDuration
=
temp
;
if
(
position
>=
audioPlayer
.
duration
!)
{
if
(
position
>=
audioPlayer
.
duration
!)
{
Console
.
log
(
'---------播放结束-----------'
);
positionSubscription
?.
cancel
();
}
...
...
@@ -63,9 +65,10 @@ class UserNotesDesController extends GetxController {
// currentPlayMediaModel = mediaModel;
}
void
delNotes
({
required
NoteModel
noteModel
,
required
String
bookId
})
async
{
final
result
=
await
MineAPI
.
delNotes
(
notesId:
noteModel
.
notesId
.
toString
(),
bookId:
bookId
);
if
(
result
){
void
delNotes
({
required
NoteModel
noteModel
,
required
String
bookId
})
async
{
final
result
=
await
MineAPI
.
delNotes
(
notesId:
noteModel
.
notesId
.
toString
(),
bookId:
bookId
);
if
(
result
)
{
Toast
.
show
(
'删除笔记成功'
);
notes
.
remove
(
noteModel
);
}
...
...
@@ -80,14 +83,16 @@ class UserNotesDesController extends GetxController {
page:
_page
,
limit:
_limit
,
bookId:
model
.
bookId
.
toString
(),
types:
tag
);
for
(
NoteModel
noteModel
in
result
){
if
(
noteModel
.
noteContent
!=
null
&&
noteModel
.
noteContent
!.
audio
!=
null
){
if
(
noteModel
.
noteContent
!.
audio
!.
isNotEmpty
){
await
Future
.
forEach
(
noteModel
.
noteContent
!.
audio
!,
(
MediaModel
?
mediaModel
)
async
{
types:
tag
);
for
(
NoteModel
noteModel
in
result
)
{
if
(
noteModel
.
noteContent
!=
null
&&
noteModel
.
noteContent
!.
audio
!=
null
)
{
if
(
noteModel
.
noteContent
!.
audio
!.
isNotEmpty
)
{
await
Future
.
forEach
(
noteModel
.
noteContent
!.
audio
!,
(
MediaModel
?
mediaModel
)
async
{
if
(
mediaModel
!=
null
&&
mediaModel
.
content
!=
null
)
{
Duration
?
duration
=
await
audioPlayer
.
setUrl
(
mediaModel
.
content
!);
Duration
?
duration
=
await
audioPlayer
.
setUrl
(
mediaModel
.
content
!);
if
(
duration
!=
null
)
{
mediaModel
.
duration
=
Tools
.
formatDuration
(
duration
);
}
...
...
@@ -99,10 +104,9 @@ class UserNotesDesController extends GetxController {
// 如果是刷新 清理数据
if
(
isRefresh
)
notes
.
clear
();
notes
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -111,7 +115,8 @@ class UserNotesDesController extends GetxController {
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
Console
.
log
(
'----error--------------------------------------
$error
--------------'
);
Console
.
log
(
'----error--------------------------------------
$error
--------------'
);
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
...
...
@@ -128,7 +133,4 @@ class UserNotesDesController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_point/controller.dart
浏览文件 @
9254a4f2
part of
user_point
;
class
UserPointController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -25,22 +24,17 @@ class UserPointController extends GetxController {
super
.
onClose
();
}
/// 获取课程内图书列表
Future
<
void
>
_getPoint
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
point
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
point
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
points
.
clear
();
points
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -65,5 +59,4 @@ class UserPointController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/user_wrong/controller.dart
浏览文件 @
9254a4f2
part of
user_wrong
;
class
UserWrongController
extends
GetxController
{
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
...
...
@@ -29,17 +28,13 @@ class UserWrongController extends GetxController {
Future
<
void
>
_getWrongs
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
wrong
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
wrong
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
wrongs
.
clear
();
wrongs
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -64,5 +59,4 @@ class UserWrongController extends GetxController {
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
}
\ No newline at end of file
}
lib/pages/version/controller.dart
浏览文件 @
9254a4f2
...
...
@@ -11,7 +11,6 @@ class VersionController extends GetxController {
bool
_noMore
=
false
;
List
<
VersionModel
>
versions
=
[];
@override
void
onClose
()
{
refreshController
.
dispose
();
...
...
@@ -22,17 +21,13 @@ class VersionController extends GetxController {
Future
<
void
>
_getVersions
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
versions
(
page:
_page
,
limit:
_limit
);
final
result
=
await
MineAPI
.
versions
(
page:
_page
,
limit:
_limit
);
// 如果是刷新 清理数据
if
(
isRefresh
)
versions
.
clear
();
versions
.
addAll
(
result
);
_page
++;
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
...
...
@@ -58,11 +53,10 @@ class VersionController extends GetxController {
}
}
List
<
VersionModel
>
test
(){
List
<
VersionModel
>
test
()
{
return
[
VersionModel
(
version:
'1.11'
,
updateTime:
'2024-01-03 11:14:40'
),
VersionModel
(
version:
'1.21'
,
updateTime:
'2023-01-03 11:14:40'
)
VersionModel
(
version:
'1.11'
,
updateTime:
'2024-01-03 11:14:40'
),
VersionModel
(
version:
'1.21'
,
updateTime:
'2023-01-03 11:14:40'
)
];
}
}
\ No newline at end of file
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论