Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
1550099f
提交
1550099f
authored
1月 23, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、消息跳转
2、消息已读状态
上级
11406f8d
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
82 行增加
和
15 行删除
+82
-15
common.dart
lib/apis/common.dart
+0
-1
msg.dart
lib/models/msg.dart
+32
-4
controller.dart
lib/pages/mine/controller.dart
+2
-2
view.dart
lib/pages/mine/view.dart
+7
-3
index.dart
lib/pages/user_coupon/index.dart
+1
-0
view.dart
lib/pages/user_coupon/view.dart
+7
-1
view.dart
lib/pages/user_msg/view.dart
+25
-3
index.dart
lib/pages/user_point/index.dart
+1
-0
view.dart
lib/pages/user_point/view.dart
+7
-1
没有找到文件。
lib/apis/common.dart
浏览文件 @
1550099f
...
@@ -34,7 +34,6 @@ abstract class CommonAPI {
...
@@ -34,7 +34,6 @@ abstract class CommonAPI {
);
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
){
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
){
print
(
result
.
data
[
'list'
][
index
]);
return
MsgModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
return
MsgModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
});
});
}
}
...
...
lib/models/msg.dart
浏览文件 @
1550099f
...
@@ -23,7 +23,7 @@ class MsgModel {
...
@@ -23,7 +23,7 @@ class MsgModel {
title
=
json
[
'title'
];
title
=
json
[
'title'
];
content
=
json
[
'content'
];
content
=
json
[
'content'
];
status
=
json
[
'status'
];
status
=
json
[
'status'
];
urlId
=
json
[
'url_id'
];
urlId
=
json
[
'url_id'
]
!=
null
?
UrlIdModel
.
fromJson
(
json
[
'url_id'
])
:
null
;
createTime
=
json
[
'create_time'
];
createTime
=
json
[
'create_time'
];
}
}
num
?
id
;
num
?
id
;
...
@@ -31,7 +31,7 @@ class MsgModel {
...
@@ -31,7 +31,7 @@ class MsgModel {
String
?
title
;
String
?
title
;
String
?
content
;
String
?
content
;
num
?
status
;
num
?
status
;
num
?
urlId
;
UrlIdModel
?
urlId
;
String
?
createTime
;
String
?
createTime
;
MsgModel
copyWith
({
MsgModel
copyWith
({
num
?
id
,
num
?
id
,
...
@@ -39,7 +39,7 @@ class MsgModel {
...
@@ -39,7 +39,7 @@ class MsgModel {
String
?
title
,
String
?
title
,
String
?
content
,
String
?
content
,
num
?
status
,
num
?
status
,
num
?
urlId
,
UrlIdModel
?
urlId
,
String
?
createTime
,
String
?
createTime
,
})
=>
MsgModel
(
})
=>
MsgModel
(
id:
id
??
this
.
id
,
id:
id
??
this
.
id
,
...
@@ -57,9 +57,36 @@ class MsgModel {
...
@@ -57,9 +57,36 @@ class MsgModel {
map
[
'title'
]
=
title
;
map
[
'title'
]
=
title
;
map
[
'content'
]
=
content
;
map
[
'content'
]
=
content
;
map
[
'status'
]
=
status
;
map
[
'status'
]
=
status
;
map
[
'url_id'
]
=
urlId
;
if
(
urlId
!=
null
)
{
map
[
'url_id'
]
=
urlId
?.
toJson
();
}
map
[
'create_time'
]
=
createTime
;
map
[
'create_time'
]
=
createTime
;
return
map
;
return
map
;
}
}
}
}
class
UrlIdModel
{
UrlIdModel
({
this
.
bookId
,
this
.
chapterId
,});
UrlIdModel
.
fromJson
(
dynamic
json
)
{
bookId
=
json
[
'book_id'
];
chapterId
=
json
[
'chapter_id'
];
}
num
?
bookId
;
num
?
chapterId
;
UrlIdModel
copyWith
({
num
?
bookId
,
num
?
chapterId
,
})
=>
UrlIdModel
(
bookId:
bookId
??
this
.
bookId
,
chapterId:
chapterId
??
this
.
chapterId
,
);
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
map
[
'book_id'
]
=
bookId
;
map
[
'chapter_id'
]
=
chapterId
;
return
map
;
}
}
\ No newline at end of file
lib/pages/mine/controller.dart
浏览文件 @
1550099f
...
@@ -20,7 +20,7 @@ class MineController extends GetxController {
...
@@ -20,7 +20,7 @@ class MineController extends GetxController {
@override
@override
void
onReady
()
{
void
onReady
()
{
_getAds
();
_getAds
();
_
getNums
();
getNums
();
getInfo
();
getInfo
();
super
.
onReady
();
super
.
onReady
();
}
}
...
@@ -33,7 +33,7 @@ class MineController extends GetxController {
...
@@ -33,7 +33,7 @@ class MineController extends GetxController {
}
}
/// 消息未读数
/// 消息未读数
void
_
getNums
()
async
{
void
getNums
()
async
{
num
=
await
CommonAPI
.
num
();
num
=
await
CommonAPI
.
num
();
update
();
update
();
}
}
...
...
lib/pages/mine/view.dart
浏览文件 @
1550099f
...
@@ -42,9 +42,13 @@ class _MinePageState extends State<MinePage> {
...
@@ -42,9 +42,13 @@ class _MinePageState extends State<MinePage> {
onPressed:
()
=>
context
.
pushNamed
(
Routes
.
set
),
onPressed:
()
=>
context
.
pushNamed
(
Routes
.
set
),
),
),
GestureDetector
(
GestureDetector
(
onTap:
(){
onTap:
()
async
{
context
.
pushNamed
(
Routes
.
msgs
);
final
result
=
await
context
.
pushNamed
(
Routes
.
msgs
);
// controller.logout(context);
print
(
'---------------------------------1111
$result
'
);
if
(
result
==
true
){
controller
.
getNums
();
}
},
},
child:
badges
.
Badge
(
child:
badges
.
Badge
(
position:
badges
.
BadgePosition
.
topEnd
(
top:
-
5
,
end:
0
),
position:
badges
.
BadgePosition
.
topEnd
(
top:
-
5
,
end:
0
),
...
...
lib/pages/user_coupon/index.dart
浏览文件 @
1550099f
...
@@ -8,6 +8,7 @@ import 'package:flutter_book/utils/index.dart';
...
@@ -8,6 +8,7 @@ import 'package:flutter_book/utils/index.dart';
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'../../models/index.dart'
;
import
'../../models/index.dart'
;
...
...
lib/pages/user_coupon/view.dart
浏览文件 @
1550099f
...
@@ -11,7 +11,12 @@ class UserCouponPage extends StatefulWidget {
...
@@ -11,7 +11,12 @@ class UserCouponPage extends StatefulWidget {
class
_UserCouponPageState
extends
State
<
UserCouponPage
>
{
class
_UserCouponPageState
extends
State
<
UserCouponPage
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
UserCouponController
>(
return
WillPopScope
(
onWillPop:
()
async
{
context
.
pop
(
true
);
return
false
;
},
child:
GetBuilder
<
UserCouponController
>(
init:
UserCouponController
(),
init:
UserCouponController
(),
builder:
(
controller
)
=>
Scaffold
(
builder:
(
controller
)
=>
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
...
@@ -44,6 +49,7 @@ class _UserCouponPageState extends State<UserCouponPage> {
...
@@ -44,6 +49,7 @@ class _UserCouponPageState extends State<UserCouponPage> {
),
),
),
),
),
),
),
);
);
}
}
}
}
lib/pages/user_msg/view.dart
浏览文件 @
1550099f
...
@@ -27,14 +27,36 @@ class MsgPage extends StatelessWidget {
...
@@ -27,14 +27,36 @@ class MsgPage extends StatelessWidget {
onLoading:
controller
.
onLoading
,
onLoading:
controller
.
onLoading
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
MsgModel
model
=
controller
.
msgs
[
index
];
return
GestureDetector
(
return
GestureDetector
(
child:
BuildItem
(
model:
controller
.
msgs
[
index
]
,),
child:
BuildItem
(
model:
model
,),
onTap:
()
async
{
onTap:
()
async
{
controller
.
read
(
controller
.
msgs
[
index
].
id
.
toString
());
controller
.
read
(
model
.
id
.
toString
());
final
result
=
await
context
.
pushNamed
(
Routes
.
coin
);
if
(
model
.
type
==
1
){
// 1订单支付快要超时(跳转订单详情)
///TODO:
}
else
if
(
model
.
type
==
2
){
// 2 购买完成三天未评价(跳转订单列表--已完成)
///TODO:
}
else
if
(
model
.
type
==
3
){
// 3 讨论有人回复的时候 (跳转对应书籍的讨论页面)
}
else
if
(
model
.
type
==
4
){
// 4 订单完成后有新的积分增加(跳转用户积分记录页)
final
result
=
await
context
.
pushNamed
(
Routes
.
point
);
if
(
result
==
true
){
controller
.
onRefresh
();
}
}
else
if
(
model
.
type
==
5
){
// 5后台直接发放给指定用户优惠券(跳转到用户优惠券页)
final
result
=
await
context
.
pushNamed
(
Routes
.
coupon
);
if
(
result
==
true
){
if
(
result
==
true
){
controller
.
onRefresh
();
controller
.
onRefresh
();
}
}
}
},
},
);
);
},
},
...
...
lib/pages/user_point/index.dart
浏览文件 @
1550099f
...
@@ -7,6 +7,7 @@ import 'package:flutter_book/utils/index.dart';
...
@@ -7,6 +7,7 @@ import 'package:flutter_book/utils/index.dart';
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'../../apis/index.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
import
'../../models/index.dart'
;
...
...
lib/pages/user_point/view.dart
浏览文件 @
1550099f
...
@@ -10,7 +10,12 @@ class UserPointPage extends StatefulWidget {
...
@@ -10,7 +10,12 @@ class UserPointPage extends StatefulWidget {
class
_UserPointPageState
extends
State
<
UserPointPage
>
{
class
_UserPointPageState
extends
State
<
UserPointPage
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
UserPointController
>(
return
WillPopScope
(
onWillPop:
()
async
{
context
.
pop
(
true
);
return
false
;
},
child:
GetBuilder
<
UserPointController
>(
init:
UserPointController
(),
init:
UserPointController
(),
builder:
(
controller
)
=>
Scaffold
(
builder:
(
controller
)
=>
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
...
@@ -43,6 +48,7 @@ class _UserPointPageState extends State<UserPointPage> {
...
@@ -43,6 +48,7 @@ class _UserPointPageState extends State<UserPointPage> {
),
),
),
),
),
),
),
);
);
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论