x1ongzhu 6 vuotta sitten
vanhempi
commit
0202e7fb21

+ 6 - 19
lib/model/PlayerInfo.dart

@@ -10,26 +10,10 @@ part 'PlayerInfo.g.dart';
 class PlayerInfo {
   PlayerInfo.empty();
 
-  PlayerInfo(
-      this.id,
-      this.houseId,
-      this.userId,
-      this.statusFlag,
-      this.userInfo,
-      this.points,
-      this.gameInfo,
-      this.houseInfo,
-      this.liveTime,
-      this.score,
-      this.rank,
-      this.ranking,
-      this.houseRank,
-      this.video,
-      this.played,
-      this.competitionInfo);
+  PlayerInfo(this.id, this.houseId, this.userId, this.statusFlag, this.userInfo, this.points, this.gameInfo, this.houseInfo, this.liveTime, this.score,
+      this.rank, this.ranking, this.houseRank, this.video, this.played, this.competitionInfo, this.createTime, this.dataError, this.resultError);
 
-  factory PlayerInfo.fromJson(Map<String, dynamic> json) =>
-      _$PlayerInfoFromJson(json);
+  factory PlayerInfo.fromJson(Map<String, dynamic> json) => _$PlayerInfoFromJson(json);
 
   int id;
   int houseId; //房间id
@@ -47,6 +31,9 @@ class PlayerInfo {
   String video; //视频地址
   bool played;
   CompetitionInfo competitionInfo;
+  int createTime;
+  bool dataError;
+  bool resultError;
 
   Map<String, dynamic> toJson() => _$PlayerInfoToJson(this);
 

+ 8 - 2
lib/model/PlayerInfo.g.dart

@@ -32,7 +32,10 @@ PlayerInfo _$PlayerInfoFromJson(Map<String, dynamic> json) {
       json['competitionInfo'] == null
           ? null
           : CompetitionInfo.fromJson(
-              json['competitionInfo'] as Map<String, dynamic>));
+              json['competitionInfo'] as Map<String, dynamic>),
+      json['createTime'] as int,
+      json['dataError'] as bool,
+      json['resultError'] as bool);
 }
 
 Map<String, dynamic> _$PlayerInfoToJson(PlayerInfo instance) =>
@@ -52,5 +55,8 @@ Map<String, dynamic> _$PlayerInfoToJson(PlayerInfo instance) =>
       'houseRank': instance.houseRank,
       'video': instance.video,
       'played': instance.played,
-      'competitionInfo': instance.competitionInfo
+      'competitionInfo': instance.competitionInfo,
+      'createTime': instance.createTime,
+      'dataError': instance.dataError,
+      'resultError': instance.resultError
     };

+ 2 - 2
lib/net/HttpManager.dart

@@ -3,8 +3,8 @@ import 'Result.dart';
 import 'package:intl/intl.dart';
 
 class HttpManager {
-   static String baseUrl = 'http://123.58.240.138:8090/';
-//  static String baseUrl = 'http://192.168.50.132:8080/';
+  //  static String baseUrl = 'http://123.58.240.138:8090/';
+ static String baseUrl = 'http://192.168.50.132:8080/';
   static String token;
   static bool debug;
 

+ 10 - 8
lib/pages/RoomInfoDetail.dart

@@ -187,7 +187,7 @@ class RoomInfoDetailState extends State<RoomInfoDetail> {
                 crossAxisAlignment: CrossAxisAlignment.stretch,
                 children: <Widget>[
                   Text(
-                    '游戏结果',
+                    '和平精英游戏结果',
                     textAlign: TextAlign.left,
                     style: TextStyle(color: Color(0x99FFFFFF)),
                   ),
@@ -312,13 +312,15 @@ class RoomInfoDetailState extends State<RoomInfoDetail> {
                       ],
                     ),
                   ),
-                  Container(
-                    margin: EdgeInsets.only(top: 5),
-                    child: Text(
-                      '吃鸡可额外获得10积分',
-                      style: TextStyle(color: PRIMARY_COLOR, fontSize: 12),
-                    ),
-                  )
+                  (widget.playerInfo?.ranking ?? 99) == 1
+                      ? Container(
+                          margin: EdgeInsets.only(top: 5),
+                          child: Text(
+                            '吃鸡额外获得10积分',
+                            style: TextStyle(color: PRIMARY_COLOR, fontSize: 12),
+                          ),
+                        )
+                      : Container()
                 ],
               ),
             )

+ 269 - 105
lib/pages/TipInfo.dart

@@ -21,30 +21,32 @@ class TipInfo extends StatefulWidget {
 class TipInfoState extends State<TipInfo> {
   SystemNotice notice;
   HouseInfo houseInfo;
+  bool canAppeal = false;
+  int appealState = 0;
   Future<void> getInfo() async {
-    Toast.show(context, '加载中', -1, 'loading');
-    Result res = await HttpManager.get('systemNotice/getOne', data: {'id': widget.notice.id});
-    Toast.hide();
-    if (res.success) {
-      setState(() {
-        notice = SystemNotice.fromJson(res.data);
-      });
-    }
+    HttpManager.get('systemNotice/getOne', data: {'id': widget.notice.id}).then((res) {
+      if (res.success) {
+        setState(() {
+          notice = SystemNotice.fromJson(res.data);
+        });
+      }
 
-    if (notice.statusFlag == 0 && notice.typeFlag != 2 && notice.typeFlag != 3) {
-      HttpManager.post('systemNotice/update', data: {'id': notice.id, 'statusFlag': 1});
-    }
+      if (notice.statusFlag == 0 && notice.typeFlag != 2 && notice.typeFlag != 3) {
+        HttpManager.post('systemNotice/update', data: {'id': notice.id, 'statusFlag': 1});
+      }
 
-    if (notice.typeFlag == 3) {
-      return;
-    }
+      if (notice.typeFlag == 3) {
+        return;
+      }
+    });
 
-    Result res2 = await HttpManager.get('houseInfo/getOne', data: {'id': notice.houseId});
-    if (res2.success) {
-      setState(() {
-        houseInfo = HouseInfo.fromJson(res2.data);
-      });
-    }
+    HttpManager.get('houseInfo/getOne', data: {'id': notice.houseId}).then((res2) {
+      if (res2.success) {
+        setState(() {
+          houseInfo = HouseInfo.fromJson(res2.data);
+        });
+      }
+    });
   }
 
   void showSuccess(money) {
@@ -83,7 +85,7 @@ class TipInfoState extends State<TipInfo> {
     return WillPopScope(
       child: Scaffold(
           appBar: AppBar(
-            title: Text('通知详情'),
+            title: Text('消息详情'),
             centerTitle: true,
             elevation: 0,
           ),
@@ -113,39 +115,42 @@ class TipInfoState extends State<TipInfo> {
                     ],
                   ),
                 ),
+                Builder(
+                  builder: (context) {
+                    String content = '';
+                    if (notice.playerInfo.dataError || !notice.playerInfo.played) {
+                      content = '造成此情况等原因可能是:\n'
+                          '1、没有实际进行游戏比赛\n'
+                          '2、使用作弊手段进行游戏';
+                    } else if (notice.playerInfo.resultError) {
+                      content = '造成此情况等原因可能是:\n'
+                          '1、确认开始游戏后没有授权系统进行录屏\n'
+                          '2、视频没有录制到最后的分数名次结算页面就回到APP点击完成比赛了\n'
+                          '3、在游戏过程中,由于电量过低或系统安全性能策略问题导致本竞赛APP后台进程被退出\n'
+                          '4、游戏结束后没有在规定时间内返回APP点击完成比赛按钮';
+                    }
+                    return Container(
+                      margin: EdgeInsets.only(left: 15, right: 15, bottom: 20),
+                      child: Text(
+                        content,
+                        style: TextStyle(color: Color(0x99FFFFFF), fontSize: 13),
+                      ),
+                    );
+                  },
+                ),
                 houseInfo != null && type != 3 ? _houseWidget() : Container(),
-                (type == 2 || type == 3)
-                    ? Container(
-                        width: double.infinity,
-                        height: 48,
-                        padding: EdgeInsets.symmetric(horizontal: 15),
-                        child: RaisedButton(
-                          textColor: Colors.white,
-                          disabledColor: Color(0xFF763939),
-                          disabledTextColor: Color(0xFF252532),
-                          child: Text(status == 0 ? '立即领取' : '已领取'),
-                          onPressed: status == 0
-                              ? () async {
-                                  Toast.show(context, '加载中', -1, 'loading');
-                                  Result res = type == 2
-                                      ? await HttpManager.post('playerInfo/receive', data: {'id': notice.playerId})
-                                      : await HttpManager.post('systemNotice/receive', data: {'id': widget.notice.id});
-                                  Toast.hide();
-                                  if (res.success) {
-                                    if (notice.playerInfo != null) {
-                                      showSuccess(notice.playerInfo.points);
-                                    } else {
-                                      showSuccess(notice.bonus);
-                                    }
-                                    getInfo();
-                                  } else {
-                                    Toast.show(context, res.error, 1000, 'info');
-                                  }
-                                }
-                              : null,
-                        ),
-                      )
-                    : Container(),
+                resultWidget(),
+                Expanded(
+                  child: Container(
+                    child: FlatButton(
+                      child: Text(
+                        '申诉结果',
+                        style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
+                      ),
+                      onPressed: () {},
+                    ),
+                  ),
+                )
                 // CustomPaint(
                 //   painter: CircleProgressBarPainter(
                 //       Color(0xFFDCA659), Color(0xFFAE4945), 0.0, 270.0, 360.0, 18.0),
@@ -163,68 +168,227 @@ class TipInfoState extends State<TipInfo> {
   }
 
   Widget _houseWidget() {
-    return Container(
-      margin: EdgeInsets.only(bottom: 50),
-      color: SUB_COLOR,
-      child: Material(
-        color: Colors.transparent,
-        child: InkWell(
-          child: Padding(
-            padding: EdgeInsets.all(15),
-            child: Row(
-              children: <Widget>[
-                Image.network(
-                  notice.gameInfo.icon,
-                  width: 48,
-                  height: 48,
-                ),
-                Container(
-                  width: 10,
-                ),
-                Expanded(
-                  flex: 1,
-                  child: Column(
-                    crossAxisAlignment: CrossAxisAlignment.start,
-                    children: <Widget>[
-                      Text(
-                        notice.competitionInfo.competitionName,
-                        style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
-                        maxLines: 1,
-                        overflow: TextOverflow.ellipsis,
-                      ),
-                      Text(
+    return GestureDetector(
+      child: Container(
+        padding: EdgeInsets.all(15),
+        margin: EdgeInsets.only(left: 15, right: 15, bottom: 10),
+        height: 78,
+        color: SUB_COLOR,
+        child: Material(
+          color: Colors.transparent,
+          child: Row(
+            children: <Widget>[
+              Image.network(
+                notice.gameInfo.icon,
+                width: 48,
+                height: 48,
+              ),
+              Container(
+                width: 10,
+              ),
+              Expanded(
+                flex: 1,
+                child: Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  mainAxisAlignment: MainAxisAlignment.center,
+                  children: <Widget>[
+                    Row(
+                      children: <Widget>[
+                        Expanded(
+                          child: Text(
+                            notice.competitionInfo.competitionName,
+                            style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
+                            maxLines: 1,
+                            overflow: TextOverflow.ellipsis,
+                          ),
+                        ),
+                        Text(
+                          readTimestamp(notice.playerInfo.createTime, 'yyyy-MM-dd HH:mm:ss'),
+                          style: TextStyle(color: Color(0xff9BA0AE), fontSize: 12),
+                        )
+                      ],
+                    ),
+                    Container(
+                      margin: EdgeInsets.only(top: 4),
+                      child: Text(
                         houseInfo.houseName,
                         style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal, color: Color(0xFF9BA0AE)),
                         maxLines: 2,
                         overflow: TextOverflow.ellipsis,
-                      )
-                    ],
-                  ),
+                      ),
+                    )
+                  ],
                 ),
-                Row(
-                  mainAxisAlignment: MainAxisAlignment.center,
+              ),
+            ],
+          ),
+        ),
+      ),
+      onTap: () {
+        Navigator.push(
+            context,
+            CupertinoPageRoute(
+                builder: (context) => RoomInfo(
+                      houseInfo,
+                      playerInfo: notice.playerInfo,
+                    )));
+      },
+    );
+  }
+
+  Widget resultWidget() {
+    if (!notice.playerInfo.played || notice.playerInfo.dataError || notice.playerInfo.resultError) {
+      return Container();
+    }
+    return Column(
+      children: <Widget>[
+        Container(
+          margin: EdgeInsets.fromLTRB(15, 0, 15, 5),
+          color: SUB_COLOR,
+          padding: EdgeInsets.fromLTRB(15, 15, 0, 15),
+          child: Column(
+            mainAxisAlignment: MainAxisAlignment.center,
+            crossAxisAlignment: CrossAxisAlignment.stretch,
+            children: <Widget>[
+              Text(
+                '和平精英游戏结果',
+                textAlign: TextAlign.left,
+                style: TextStyle(color: Color(0x99FFFFFF)),
+              ),
+              Container(
+                margin: EdgeInsets.only(top: 10),
+                child: Row(
                   children: <Widget>[
-                    Image.asset('images/icon_renshu.png', width: 20),
                     Text(
-                      (houseInfo.playerNumber != null ? houseInfo.playerNumber.toString() : '0') + '/' + houseInfo.maxNumber.toString(),
-                      style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xFFB1B2C0)),
-                    )
+                      '名次',
+                      style: TextStyle(color: Colors.white, fontSize: 14),
+                    ),
+                    Expanded(
+                      child: Container(
+                        margin: EdgeInsets.only(left: 5),
+                        child: Text(
+                          notice.playerInfo?.ranking?.toString() ?? '',
+                          style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
+                        ),
+                      ),
+                    ),
+                    Text(
+                      '时长',
+                      style: TextStyle(color: Colors.white, fontSize: 14),
+                    ),
+                    Expanded(
+                      child: Container(
+                        margin: EdgeInsets.only(left: 5),
+                        child: Text(
+                          (notice.playerInfo?.liveTime ?? '') + '分钟',
+                          style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
+                        ),
+                      ),
+                    ),
+                    Text(
+                      '评分',
+                      style: TextStyle(color: Colors.white, fontSize: 14),
+                    ),
+                    Expanded(
+                      child: Container(
+                        margin: EdgeInsets.only(left: 5),
+                        child: Text(
+                          notice.playerInfo?.score?.toString() ?? '',
+                          style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
+                        ),
+                      ),
+                    ),
                   ],
-                )
-              ],
-            ),
+                ),
+              ),
+            ],
           ),
-          onTap: () {
-            Navigator.push(
-                context,
-                CupertinoPageRoute(
-                    builder: (context) => RoomInfo(
-                          houseInfo,
-                          playerInfo: notice.playerInfo,
-                        )));
-          },
         ),
-      ),
+        Container(
+          margin: EdgeInsets.fromLTRB(15, 0, 15, 20),
+          color: SUB_COLOR,
+          padding: EdgeInsets.all(15),
+          child: Column(
+            mainAxisAlignment: MainAxisAlignment.center,
+            crossAxisAlignment: CrossAxisAlignment.stretch,
+            children: <Widget>[
+              Text(
+                '比赛结果',
+                textAlign: TextAlign.left,
+                style: TextStyle(color: Color(0x99FFFFFF)),
+              ),
+              Container(
+                margin: EdgeInsets.only(top: 10),
+                child: Row(
+                  children: <Widget>[
+                    Expanded(
+                      child: Text(
+                        '参赛成员',
+                        style: TextStyle(color: Colors.white, fontSize: 14),
+                        textAlign: TextAlign.left,
+                      ),
+                    ),
+                    Text(
+                      houseInfo?.playerNumber?.toString() ?? '',
+                      style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
+                    )
+                  ],
+                ),
+              ),
+              Container(
+                margin: EdgeInsets.only(top: 10),
+                child: Row(
+                  children: <Widget>[
+                    Expanded(
+                      child: Text(
+                        '我的排名',
+                        style: TextStyle(color: Colors.white, fontSize: 14),
+                        textAlign: TextAlign.left,
+                      ),
+                    ),
+                    Text(
+                      notice.playerInfo?.houseRank?.toString() ?? '',
+                      style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
+                    )
+                  ],
+                ),
+              ),
+              Container(
+                margin: EdgeInsets.only(top: 10),
+                child: Row(
+                  children: <Widget>[
+                    Expanded(
+                      child: Text(
+                        '本场比赛获得积分',
+                        style: TextStyle(color: Colors.white, fontSize: 14),
+                        textAlign: TextAlign.left,
+                      ),
+                    ),
+                    Container(
+                      margin: EdgeInsets.only(right: 3),
+                      width: 20,
+                      child: Image.asset('images/icon_jifen_da.png'),
+                    ),
+                    Text(
+                      notice.playerInfo?.points?.toString() ?? '0',
+                      style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
+                    )
+                  ],
+                ),
+              ),
+              (notice.playerInfo?.ranking ?? 99) == 1
+                  ? Container(
+                      margin: EdgeInsets.only(top: 5),
+                      child: Text(
+                        '吃鸡额外获得10积分',
+                        style: TextStyle(color: PRIMARY_COLOR, fontSize: 12),
+                      ),
+                    )
+                  : Container()
+            ],
+          ),
+        )
+      ],
     );
   }
 }