diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6edb925..887db0a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -11,6 +11,9 @@ + + + 需要访问麦克风以录制语音和视频 NSPhotoLibraryUsageDescription 需要访问相册以选择和发送图片、视频 + NSPhotoLibraryAddUsageDescription + 需要访问相册以保存图片和视频 + NSLocationWhenInUseUsageDescription + 需要获取您的位置信息以提供同城匹配服务 UIApplicationSupportsIndirectInputEvents UILaunchStoryboardName diff --git a/lib/controller/home/home_controller.dart b/lib/controller/home/home_controller.dart index 01de050..07214f8 100644 --- a/lib/controller/home/home_controller.dart +++ b/lib/controller/home/home_controller.dart @@ -304,11 +304,14 @@ class HomeController extends GetxController { // data 是 PaginatedResponse,直接使用其属性 // records 中的每个项是 dynamic,需要转换为 MarriageData - final records = paginatedData.records + final allRecords = paginatedData.records .map((item) => MarriageData.fromJson(item as Map)) .toList(); - print('_fetchMarriageData 返回 - 请求页码: $pageNum, 返回当前页: ${paginatedData.current}, 总页数: ${paginatedData.pages}, 记录数: ${records.length}'); + // 过滤掉直播类型的项 + final records = allRecords.where((item) => !item.isLive).toList(); + + print('_fetchMarriageData 返回 - 请求页码: $pageNum, 返回当前页: ${paginatedData.current}, 总页数: ${paginatedData.pages}, 原始记录数: ${allRecords.length}, 过滤后记录数: ${records.length}'); return { 'records': records, diff --git a/lib/controller/mine/mine_controller.dart b/lib/controller/mine/mine_controller.dart index 721f780..7739079 100644 --- a/lib/controller/mine/mine_controller.dart +++ b/lib/controller/mine/mine_controller.dart @@ -3,14 +3,9 @@ import 'package:dating_touchme_app/generated/assets.dart'; import 'package:dating_touchme_app/model/mine/user_count_data.dart'; import 'package:dating_touchme_app/network/user_api.dart'; import 'package:dating_touchme_app/pages/mine/auth_center_page.dart'; -import 'package:dating_touchme_app/pages/mine/matchmaker_update_page.dart'; -import 'package:dating_touchme_app/pages/mine/my_wallet_page.dart'; -import 'package:dating_touchme_app/pages/mine/rose_page.dart'; import 'package:dating_touchme_app/pages/mine/user_help_center_page.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; -import '../../pages/setting/match_spread_page.dart'; import '../../pages/setting/setting_page.dart'; class MineController extends GetxController { @@ -19,7 +14,7 @@ class MineController extends GetxController { final blockList = [ // {"icon": Assets.imagesRose, "title": "我的玫瑰", "subTitle": "新人限时福利", "path": () => RosePage()}, - {"icon": Assets.imagesWallet, "title": "我的钱包", "subTitle": "提现无门槛", "path": () => MyWalletPage()}, + // {"icon": Assets.imagesWallet, "title": "我的钱包", "subTitle": "提现无门槛", "path": () => MyWalletPage()}, // {"icon": Assets.imagesShop, "title": "商城中心", "subTitle": "不定期更新商品", "path": () => null}, {"icon": Assets.imagesCert, "title": "认证中心", "subTitle": GlobalData().userData?.identityCard == null || GlobalData().userData?.profilePhoto == null ? "未认证" : "已认证", "path": () => AuthCenterPage()}, // {"icon": Assets.imagesMatchmaker, "title": "红娘等级", "subTitle": "实习红娘", "path": () => MatchSpreadPage()}, diff --git a/lib/model/home/marriage_data.dart b/lib/model/home/marriage_data.dart index 32fd9d1..06d0818 100644 --- a/lib/model/home/marriage_data.dart +++ b/lib/model/home/marriage_data.dart @@ -20,6 +20,7 @@ class MarriageData { final String createTime; final int genderCode; final List photoList; + final bool isLive; // 是否为直播类型 // 为了兼容UI展示,添加一些计算属性 String get name => nickName; @@ -47,6 +48,7 @@ class MarriageData { required this.createTime, required this.photoList, required this.genderCode, + this.isLive = false, }); factory MarriageData.fromJson(Map json) { @@ -69,6 +71,7 @@ class MarriageData { createTime: json['createTime'] ?? '', genderCode: json['genderCode'] ?? 0, photoList: (json['photoList'] as List?)?.map((e) => PhotoItem.fromJson(e as Map)).toList() ?? [], + isLive: json['isLive'] ?? json['liveStatus'] ?? false, // 支持isLive或liveStatus字段 ); } @@ -98,6 +101,7 @@ class MarriageData { id: photo.id ?? '', miId: photo.miId ?? 0, )).toList(), + isLive: false, // 从UserInfoData转换时默认为false ); } } diff --git a/lib/pages/home/content_card.dart b/lib/pages/home/content_card.dart index cf7067c..6d8e98b 100644 --- a/lib/pages/home/content_card.dart +++ b/lib/pages/home/content_card.dart @@ -4,6 +4,8 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:dating_touchme_app/model/home/marriage_data.dart'; import 'package:dating_touchme_app/pages/home/user_information_page.dart'; +import 'package:dating_touchme_app/pages/message/chat_page.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; // 通用头部组件:头像/昵称/在线/认证/Hi/直播中徽标 class _CardHeader extends StatelessWidget { @@ -12,7 +14,7 @@ class _CardHeader extends StatelessWidget { @override Widget build(BuildContext context) { - final bool isLive = true; //item.isLive ?? false; + final bool isLive = item.isLive; final bool isOnline = true; //item.isOnline ?? false; return Row( @@ -222,23 +224,46 @@ class _CardHeader extends StatelessWidget { ), // 根据不同状态显示不同按钮 - 都放在HI按钮相同位置 InkWell( - onTap: () { + onTap: () async { // 点击事件处理 if (isLive) { // 进入直播间逻辑 print('进入直播间'); } else if (isOnline) { - // HI按钮点击逻辑 - print('HI点击'); + // HI按钮点击逻辑 - 跳转到聊天页面 + try { + if (item.userId.isEmpty) { + SmartDialog.showToast('用户ID不存在,无法发送消息'); + return; + } + await Get.to(() => ChatPage( + userId: item.userId, + userData: item, + )); + } catch (e) { + print('❌ [ContentCard] 跳转聊天页面失败: $e'); + SmartDialog.showToast('跳转失败,请重试'); + } } else { - // 发消息按钮点击逻辑 - print('发送消息'); + // 发消息按钮点击逻辑 - 跳转到聊天页面 + try { + if (item.userId.isEmpty) { + SmartDialog.showToast('用户ID不存在,无法发送消息'); + return; + } + await Get.to(() => ChatPage( + userId: item.userId, + userData: item, + )); + } catch (e) { + print('❌ [ContentCard] 跳转聊天页面失败: $e'); + SmartDialog.showToast('跳转失败,请重试'); + } } }, child: Image.asset( - _getButtonImage(), - // width: (item.isLive ?? false) ? 60 : 40, - width: (true) ? 60 : 40, + _getButtonImage(isLive, isOnline), + width: isLive ? 60 : 40, height: 20, ), ), @@ -246,17 +271,14 @@ class _CardHeader extends StatelessWidget { ); } - String _getButtonImage() { - // if (item.isLive ?? false) { - // return Assets.imagesLiveIcon; // 直播显示直播间按钮(放在HI位置) - // } else if (item.isOnline ?? false) { - // return Assets.imagesHiIcon; // 在线显示HI按钮 - // } else { - // return Assets.imagesSendMessageIcon; // 下线显示发消息按钮(放在HI位置) - // } - // } - - return Assets.imagesLiveIcon; // 直播显示直播间按钮(放在HI位置) + String _getButtonImage(bool isLive, bool isOnline) { + if (isLive) { + return Assets.imagesLiveIcon; // 直播显示直播间按钮(放在HI位置) + } else if (isOnline) { + return Assets.imagesHiIcon; // 在线显示HI按钮 + } else { + return Assets.imagesSendMessageIcon; // 下线显示发消息按钮(放在HI位置) + } } } diff --git a/lib/pages/home/user_information_page.dart b/lib/pages/home/user_information_page.dart index 9b192ca..9217d54 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -236,38 +236,39 @@ class UserInformationPage extends StatelessWidget { ), ], ), - Container( - width: 63.w, - height: 27.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(27.w)), - color: const Color.fromRGBO(117, 98, 249, .1) - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesPlayer, - width: 15.w, - height: 15.w, - ), - SizedBox(width: 4.w,), - Image.asset( - Assets.imagesVoice, - width: 15.w, - height: 13.w, - ), - SizedBox(width: 4.w,), - Text( - "6'", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(117, 98, 249, 1) - ), - ) - ], - ), - ) + // 语音介绍功能暂时隐藏(为了通过苹果审核) + // Container( + // width: 63.w, + // height: 27.w, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all(Radius.circular(27.w)), + // color: const Color.fromRGBO(117, 98, 249, .1) + // ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // Assets.imagesPlayer, + // width: 15.w, + // height: 15.w, + // ), + // SizedBox(width: 4.w,), + // Image.asset( + // Assets.imagesVoice, + // width: 15.w, + // height: 13.w, + // ), + // SizedBox(width: 4.w,), + // Text( + // "6'", + // style: TextStyle( + // fontSize: 11.w, + // color: const Color.fromRGBO(117, 98, 249, 1) + // ), + // ) + // ], + // ), + // ) ], ), SizedBox(height: 8.w,), diff --git a/lib/pages/mine/login_page.dart b/lib/pages/mine/login_page.dart index 59345bb..276398d 100644 --- a/lib/pages/mine/login_page.dart +++ b/lib/pages/mine/login_page.dart @@ -20,20 +20,26 @@ class LoginPage extends StatelessWidget { builder: (controller) { return Scaffold( resizeToAvoidBottomInset: false, - body: Stack( - children: [ - Container( - width: double.infinity, - height: 1.sh, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(Assets.imagesLoginBg), - fit: BoxFit.cover, - alignment: Alignment.topCenter, + body: GestureDetector( + onTap: () { + // 点击空白区域关闭键盘 + FocusScope.of(context).unfocus(); + }, + behavior: HitTestBehavior.translucent, + child: Stack( + children: [ + Container( + width: double.infinity, + height: 1.sh, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(Assets.imagesLoginBg), + fit: BoxFit.cover, + alignment: Alignment.topCenter, + ), ), - ), - padding: EdgeInsets.symmetric(horizontal: 20), - child: Column( + padding: EdgeInsets.symmetric(horizontal: 20), + child: Column( children: [ const SizedBox(height: 150), // Logo和标题区域 @@ -264,7 +270,8 @@ class LoginPage extends StatelessWidget { ], ), ), - ], + ], + ), ), ); }, diff --git a/lib/widget/live/live_recharge_popup.dart b/lib/widget/live/live_recharge_popup.dart index ffb22ae..71f4c2e 100644 --- a/lib/widget/live/live_recharge_popup.dart +++ b/lib/widget/live/live_recharge_popup.dart @@ -167,27 +167,25 @@ class LiveRechargePopup extends StatelessWidget { ), ], ), - Obx(() { - return Container( - width: 18.w, - height: 18.w, - decoration: BoxDecoration( - shape: BoxShape.circle, + Container( + width: 18.w, + height: 18.w, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color.fromRGBO(117, 98, 249, 1), + border: Border.all( + width: 1, color: const Color.fromRGBO(117, 98, 249, 1), - border: Border.all( - width: 1, - color: const Color.fromRGBO(117, 98, 249, 1), - ), ), - child: Center( - child: Icon( - Icons.check, - size: 12.w, - color: Colors.white, - ), + ), + child: Center( + child: Icon( + Icons.check, + size: 12.w, + color: Colors.white, ), - ); - }), + ), + ), ], ), ],