diff --git a/lib/controller/home/home_controller.dart b/lib/controller/home/home_controller.dart index 43978f7..060a524 100644 --- a/lib/controller/home/home_controller.dart +++ b/lib/controller/home/home_controller.dart @@ -97,7 +97,8 @@ class HomeController extends GetxController { // 根据返回的分页信息判断是否还有更多数据 final int currentPage = result['current'] ?? 1; - final int totalPages = result['pages'] ?? 1; + // final int totalPages = result['pages'] ?? 1; + final int totalPages = 100; recommendHasMore.value = currentPage < totalPages; print(recommendHasMore.value); } catch (e) { @@ -128,7 +129,8 @@ class HomeController extends GetxController { // 根据返回的分页信息判断是否还有更多数据 final int currentPage = result['current'] ?? 1; - final int totalPages = result['pages'] ?? 1; + // final int totalPages = result['pages'] ?? 1; + final int totalPages = 100; nearbyHasMore.value = currentPage < totalPages; } catch (e) { _handleError('获取同城列表异常', e, '同城列表加载失败,请稍后重试'); @@ -156,7 +158,8 @@ class HomeController extends GetxController { try { recommendIsLoading.value = true; - final nextPage = recommendPage.value + 1; + // final nextPage = recommendPage.value + 1; + final nextPage = recommendPage.value; print('推荐列表加载更多 - 当前页: ${recommendPage.value}, 下一页: $nextPage'); // 获取推荐数据 (type=0) @@ -173,7 +176,8 @@ class HomeController extends GetxController { // 根据返回的分页信息判断是否还有更多数据 final int currentPage = result['current'] as int; - final int totalPages = result['pages'] as int; + // final int totalPages = result['pages'] ?? 1; + final int totalPages = 100; recommendHasMore.value = currentPage < totalPages; print('推荐列表加载更多完成 - 当前页: $currentPage, 总页数: $totalPages, 还有更多: ${recommendHasMore.value}'); } catch (e) { @@ -189,7 +193,8 @@ class HomeController extends GetxController { try { nearbyIsLoading.value = true; - final nextPage = nearbyPage.value + 1; + // final nextPage = recommendPage.value + 1; + final nextPage = recommendPage.value; print('同城列表加载更多 - 当前页: ${nearbyPage.value}, 下一页: $nextPage'); // 获取同城数据 (type=1) @@ -206,7 +211,8 @@ class HomeController extends GetxController { // 根据返回的分页信息判断是否还有更多数据 final int currentPage = result['current'] as int; - final int totalPages = result['pages'] as int; + // final int totalPages = result['pages'] ?? 1; + final int totalPages = 100; nearbyHasMore.value = currentPage < totalPages; print('同城列表加载更多完成 - 当前页: $currentPage, 总页数: $totalPages, 还有更多: ${nearbyHasMore.value}'); } catch (e) { @@ -250,7 +256,8 @@ class HomeController extends GetxController { // 根据返回的分页信息判断是否还有更多数据 final int currentPage = result['current'] ?? 1; - final int totalPages = result['pages'] ?? 1; + // final int totalPages = result['pages'] ?? 1; + final int totalPages = 100; recommendHasMore.value = currentPage < totalPages; } catch (e) { _handleError('刷新推荐数据异常', e, '刷新失败,请稍后重试'); @@ -280,7 +287,8 @@ class HomeController extends GetxController { // 根据返回的分页信息判断是否还有更多数据 final int currentPage = result['current'] ?? 1; - final int totalPages = result['pages'] ?? 1; + // final int totalPages = result['pages'] ?? 1; + final int totalPages = 100; nearbyHasMore.value = currentPage < totalPages; } catch (e) { _handleError('刷新同城数据异常', e, '刷新失败,请稍后重试'); diff --git a/lib/controller/mine/edit_info_controller.dart b/lib/controller/mine/edit_info_controller.dart index aa38121..80dea06 100644 --- a/lib/controller/mine/edit_info_controller.dart +++ b/lib/controller/mine/edit_info_controller.dart @@ -36,6 +36,7 @@ class EditInfoController extends GetxController { final message = ''.obs; + final realDescribe = ''.obs; final messageController = TextEditingController().obs; final name = ''.obs; @@ -301,7 +302,8 @@ class EditInfoController extends GetxController { birthday.value = userData.value?.birthDate ?? ""; - message.value = userData.value?.describeInfo ?? ""; + message.value = (userData.value?.auditDescribeInfo != null && userData.value?.auditDescribeInfo != "") ? (userData.value?.auditDescribeInfo ?? "") : (userData.value?.describeInfo ?? ""); + realDescribe.value = message.value; messageController.value.value = TextEditingValue( text: message.value, @@ -619,8 +621,11 @@ class EditInfoController extends GetxController { final imgAuditResp = await _userApi.saveCertificationAudit(imgPayload); if (imgAuditResp.data.isSuccess) { + realDescribe.value = message.value; getInfo(); SmartDialog.showToast("交友心声已提交审核"); + + Get.back(); } else{ SmartDialog.showToast(imgAuditResp.data.message); diff --git a/lib/model/home/marriage_data.dart b/lib/model/home/marriage_data.dart index 06d0818..8c66e99 100644 --- a/lib/model/home/marriage_data.dart +++ b/lib/model/home/marriage_data.dart @@ -19,16 +19,17 @@ class MarriageData { final String describeInfo; final String createTime; final int genderCode; + final int visitCount; final List photoList; final bool isLive; // 是否为直播类型 - + // 为了兼容UI展示,添加一些计算属性 String get name => nickName; String get avatar => profilePhoto.trim().replaceAll('`', ''); // 移除照片URL中的反引号 String get city => cityName; String get description => describeInfo; List get images => photoList.map((photo) => photo.photoUrl.trim().replaceAll('`', '')).toList(); - + MarriageData({ required this.miId, required this.userId, @@ -48,9 +49,10 @@ class MarriageData { required this.createTime, required this.photoList, required this.genderCode, + required this.visitCount, this.isLive = false, }); - + factory MarriageData.fromJson(Map json) { return MarriageData( miId: json['miId'] ?? '', @@ -70,11 +72,12 @@ class MarriageData { describeInfo: json['describeInfo'] ?? '', createTime: json['createTime'] ?? '', genderCode: json['genderCode'] ?? 0, + visitCount: json['visitCount'] ?? 0, photoList: (json['photoList'] as List?)?.map((e) => PhotoItem.fromJson(e as Map)).toList() ?? [], isLive: json['isLive'] ?? json['liveStatus'] ?? false, // 支持isLive或liveStatus字段 ); } - + /// 从 UserInfoData 转换为 MarriageData factory MarriageData.fromUserInfoData(UserInfoData userInfo) { return MarriageData( @@ -95,6 +98,7 @@ class MarriageData { describeInfo: userInfo.describeInfo ?? '', createTime: userInfo.createTime ?? '', genderCode: userInfo.genderCode?.toInt() ?? 0, + visitCount: userInfo.visitCount?.toInt() ?? 0, photoList: (userInfo.photoList ?? []).map((photo) => PhotoItem( photoUrl: photo.photoUrl ?? '', auditStatus: photo.auditStatus, @@ -112,14 +116,14 @@ class PhotoItem { final String? id; final num? miId; final dynamic auditStatus; - + PhotoItem({ required this.photoUrl, this.id, this.miId, this.auditStatus, }); - + factory PhotoItem.fromJson(Map json) { return PhotoItem( photoUrl: json['photoUrl'] ?? '', diff --git a/lib/model/home/user_info_data.dart b/lib/model/home/user_info_data.dart index 78119e2..e4b322b 100644 --- a/lib/model/home/user_info_data.dart +++ b/lib/model/home/user_info_data.dart @@ -90,6 +90,7 @@ class UserInfoData { bool? consumeRight; bool? vip; num? dataScoring; + num? visitCount; String? phone; Null? guestMatchmaker; String? miId; @@ -187,6 +188,7 @@ class UserInfoData { this.consumeRight, this.vip, this.dataScoring, + this.visitCount, this.phone, this.guestMatchmaker, this.miId, @@ -296,6 +298,7 @@ class UserInfoData { consumeRight = json['consumeRight']; vip = json['vip']; dataScoring = json['dataScoring']; + visitCount = json['visitCount']; phone = json['phone']; guestMatchmaker = json['guestMatchmaker']; miId = json['miId']; @@ -394,7 +397,7 @@ class UserInfoData { data['mateDescriptionAudit'] = this.mateDescriptionAudit; if (this.marriageSeekingContacts != null) { data['marriageSeekingContacts'] = []; - // this.marriageSeekingContacts!.map((v) => v.toJson()).toList(); + // this.marriageSeekingContacts!.map((v) => v.toJson()).toList(); } data['age'] = this.age; data['meLike'] = this.meLike; @@ -402,6 +405,7 @@ class UserInfoData { data['consumeRight'] = this.consumeRight; data['vip'] = this.vip; data['dataScoring'] = this.dataScoring; + data['visitCount'] = this.visitCount; data['phone'] = this.phone; data['guestMatchmaker'] = this.guestMatchmaker; data['miId'] = this.miId; @@ -514,4 +518,4 @@ class PhotoList { data['auditStatus'] = this.auditStatus; return data; } -} +} \ No newline at end of file diff --git a/lib/model/mine/user_data.dart b/lib/model/mine/user_data.dart index c77f02b..ec6e2cc 100644 --- a/lib/model/mine/user_data.dart +++ b/lib/model/mine/user_data.dart @@ -36,6 +36,7 @@ class UserData { final int? incomeCode; final String? income; final String? describeInfo; + final String? auditDescribeInfo; final int? domicilePlaceProvinceCode; final String? domicilePlaceProvinceName; final int? domicilePlaceCityCode; @@ -103,6 +104,7 @@ class UserData { this.incomeCode, this.income, this.describeInfo, + this.auditDescribeInfo, this.domicilePlaceProvinceCode, this.domicilePlaceProvinceName, this.domicilePlaceCityCode, @@ -175,6 +177,7 @@ class UserData { incomeCode: json['incomeCode'], income: json['income'], describeInfo: json['describeInfo'], + auditDescribeInfo: json['auditDescribeInfo'], domicilePlaceProvinceCode: json['domicilePlaceProvinceCode'], domicilePlaceProvinceName: json['domicilePlaceProvinceName'], domicilePlaceCityCode: json['domicilePlaceCityCode'], @@ -243,6 +246,7 @@ class UserData { 'incomeCode': incomeCode, 'income': income, 'describeInfo': describeInfo, + 'auditDescribeInfo': auditDescribeInfo, 'domicilePlaceProvinceCode': domicilePlaceProvinceCode, 'domicilePlaceProvinceName': domicilePlaceProvinceName, 'domicilePlaceCityCode': domicilePlaceCityCode, diff --git a/lib/pages/discover/visitor_list_page.dart b/lib/pages/discover/visitor_list_page.dart index 30cbea1..8964f6e 100644 --- a/lib/pages/discover/visitor_list_page.dart +++ b/lib/pages/discover/visitor_list_page.dart @@ -70,18 +70,16 @@ class _VisitorListPagePageState extends State { return EasyRefresh( controller: visitorController.refreshController, - onRefresh: visitorController.onRefresh, - onLoad: visitorController.onLoadMore, header: ClassicHeader( - dragText: '下拉刷新', - armedText: '释放刷新', - readyText: '刷新中...', - processingText: '刷新中...', - processedText: '刷新完成', - failedText: '刷新失败', - noMoreText: '没有更多数据', - messageText: '更新时间 %T', - showMessage: false + dragText: '下拉刷新', + armedText: '释放刷新', + readyText: '刷新中...', + processingText: '刷新中...', + processedText: '刷新完成', + failedText: '刷新失败', + noMoreText: '没有更多数据', + messageText: '更新时间 %T', + showMessage: false ), footer: ClassicFooter( dragText: '上拉加载', @@ -93,6 +91,15 @@ class _VisitorListPagePageState extends State { noMoreText: '没有更多数据', showMessage: false, ), + + // 下拉刷新 + onRefresh: () async { + visitorController.onRefresh(); + }, + // 上拉加载更多 + onLoad: () async { + visitorController.onLoadMore(); + }, child: GridView.builder( padding: EdgeInsets.only(top: 8.w, left: 10.w, right: 8.w, bottom: 0.w), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -122,93 +129,93 @@ class VisitorItem extends StatelessWidget { @override Widget build(BuildContext context) { return Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(10.w)), - child: CachedNetworkImage( - imageUrl: "${visitor.profilePhoto}?x-oss-process=image/format,webp/resize,w_240", - width: 173.w, - height: 173.w, - fit: BoxFit.cover, - placeholder: (context, url) => Container( - color: Colors.white38, - child: Center( - child: CircularProgressIndicator( - strokeWidth: 1.w, - color: Colors.grey, - ), + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(10.w)), + child: CachedNetworkImage( + imageUrl: "${visitor.profilePhoto}?x-oss-process=image/format,webp/resize,w_240", + width: 173.w, + height: 173.w, + fit: BoxFit.cover, + placeholder: (context, url) => Container( + color: Colors.white38, + child: Center( + child: CircularProgressIndicator( + strokeWidth: 1.w, + color: Colors.grey, ), ), - errorWidget: (context, url, error) => - Image.asset( - Assets.imagesUserAvatar, - width: 173.w, - height: 173.w, - fit: BoxFit.cover, - ), ), + errorWidget: (context, url, error) => + Image.asset( + Assets.imagesUserAvatar, + width: 173.w, + height: 173.w, + fit: BoxFit.cover, + ), ), - Positioned( - left: 8.w, - bottom: 12.w, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if(visitor.describeInfo.isNotEmpty)SizedBox( - width: 156.w, - child: Text(visitor.describeInfo, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.w, - color: Colors.white, - fontWeight: FontWeight.w500, - ), + ), + Positioned( + left: 8.w, + bottom: 12.w, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(visitor.nickName.isNotEmpty)SizedBox( + width: 156.w, + child: Text(visitor.nickName, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.w, + color: Colors.white, + fontWeight: FontWeight.w500, ), ), - SizedBox(height: 2.w), - SizedBox( - width: 156.w, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "${visitor.cityName.isNotEmpty ? '${visitor.cityName} | ' : ''}${visitor.age}岁", - style: TextStyle( - fontSize: 14.w, - color: Colors.white, - fontWeight: FontWeight.w500, - ), + ), + SizedBox(height: 2.w), + SizedBox( + width: 156.w, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "${visitor.cityName.isNotEmpty ? '${visitor.cityName} | ' : ''}${visitor.age}岁", + style: TextStyle( + fontSize: 14.w, + color: Colors.white, + fontWeight: FontWeight.w500, ), - Text('访问1次', style: TextStyle(color: Color(0xffA799FF), fontSize: 12.w)) - ], - ), - ) - ], - ), - ) - ], + ), + Text('访问${visitor.visitCount}次', style: TextStyle(color: Color(0xffA799FF), fontSize: 12.w)) + ], + ), + ) + ], + ), + ) + ], ).onTap((){ Get.to(() => UserInformationPage(miId: visitor.miId, userId: GlobalData().userId!)); }); } - // String _formatTime(String timestamp) { - // var time = DateTime.parse(timestamp); - // final now = DateTime.now(); - // final difference = now.difference(time); - // - // if (difference.inMinutes < 1) { - // return '刚刚'; - // } else if (difference.inHours < 1) { - // return '${difference.inMinutes}分钟前'; - // } else if (difference.inDays < 1) { - // return '${difference.inHours}小时前'; - // } else if (difference.inDays < 7) { - // return '${difference.inDays}天前'; - // } else { - // return '${time.month}/${time.day}'; - // } - // } +// String _formatTime(String timestamp) { +// var time = DateTime.parse(timestamp); +// final now = DateTime.now(); +// final difference = now.difference(time); +// +// if (difference.inMinutes < 1) { +// return '刚刚'; +// } else if (difference.inHours < 1) { +// return '${difference.inMinutes}分钟前'; +// } else if (difference.inDays < 1) { +// return '${difference.inHours}小时前'; +// } else if (difference.inDays < 7) { +// return '${difference.inDays}天前'; +// } else { +// return '${time.month}/${time.day}'; +// } +// } } \ No newline at end of file diff --git a/lib/pages/home/content_card.dart b/lib/pages/home/content_card.dart index 0db351b..4ad63c7 100644 --- a/lib/pages/home/content_card.dart +++ b/lib/pages/home/content_card.dart @@ -61,54 +61,6 @@ class _CardHeader extends StatelessWidget { ), ), ), - // if (isOnline) - // Positioned( - // right: 6, - // bottom: 1, - // child: Container( - // width: 12, - // height: 12, - // decoration: BoxDecoration( - // color: isOnline - // ? const Color(0xFF2ED573) - // : const Color(0xFFCCCCCC), // 在线绿色,离线灰色 - // shape: BoxShape.circle, - // boxShadow: isOnline - // ? const [ - // BoxShadow( - // color: Color(0x332ED573), - // blurRadius: 4, - // offset: Offset(0, 2), - // ), - // ] - // : [], - // ), - // ), - // ), - // if (isLive) - // Positioned( - // bottom: 0, - // left: 0, - // right: 0, - // child: Container( - // width: 37, - // height: 14, - // alignment: Alignment.center, // 关键:让子内容居中 - // decoration: BoxDecoration( - // image: DecorationImage( - // image: AssetImage(Assets.imagesBtnBgIcon), - // ), - // ), - // child: const Text( - // '直播中', - // style: TextStyle( - // color: Colors.white, - // fontSize: 8, - // fontWeight: FontWeight.w600, - // ), - // ), - // ), - // ), ], ), const SizedBox(width: 10), @@ -135,26 +87,6 @@ class _CardHeader extends StatelessWidget { maxLines: 1, overflow: TextOverflow.ellipsis, ), - // 在线徽标 - // if (isOnline == true) - // Container( - // padding: const EdgeInsets.symmetric( - // horizontal: 8, - // vertical: 2, - // ), - // decoration: BoxDecoration( - // color: Color.fromRGBO(234, 255, 219, 1), - // borderRadius: BorderRadius.circular(12), - // ), - // child: Text( - // isOnline ? '在线' : '', - // style: TextStyle( - // fontSize: 9, - // color: Color.fromRGBO(38, 199, 124, 1), - // ), - // ), - // ), - // 实名徽标 if (item.isRealNameCertified == true) Container( padding: const EdgeInsets.symmetric( @@ -214,7 +146,7 @@ class _CardHeader extends StatelessWidget { SizedBox( height: 16, child: Text( - '${item.age ?? 0}岁 · ${item.cityName ?? ''}${item.districtName != null ? item.districtName : ''}', + '${item.age ?? 0}岁 ${(item.cityName ?? '') != "" ? "· " : ""}${item.cityName ?? ''}${item.districtName != null ? item.districtName : ''}', style: TextStyle( fontSize: 12, color: Color.fromRGBO(51, 51, 51, 1), @@ -288,8 +220,8 @@ class _CardHeader extends StatelessWidget { }, child: Image.asset( _getButtonImage(isLive, isOnline), - width: isLive ? 60 : 40, - height: 20, + width: isLive ? 60 : 50, + height: 30, ), ), ], @@ -324,13 +256,7 @@ class ContentCard extends StatelessWidget { decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), - boxShadow: const [ - BoxShadow( - color: Color(0x14000000), - blurRadius: 8, - offset: Offset(0, 4), - ), - ], + ), padding: const EdgeInsets.all(12), child: Column( @@ -338,7 +264,6 @@ class ContentCard extends StatelessWidget { children: [ // 头部:头像、昵称、在线状态、按钮等 - 所有按钮都放在HI位置 _CardHeader(item: item), - const SizedBox(height: 8), // 内容区域 - 根据类型显示不同内容 _buildContent(), @@ -372,7 +297,7 @@ class ContentCard extends StatelessWidget { // 根据接口返回的图片列表动态显示图片 if (item.photoList != null && item.photoList!.isNotEmpty) { - contentWidgets.add(const SizedBox(height: 16)); + contentWidgets.add(const SizedBox(height: 6)); // 计算固定宽度:每张图片的宽度 = (屏幕宽度 - 卡片左右padding - ListView左右padding - 图片间距) / 3 // 卡片左右padding: 12 * 2 = 24 @@ -437,6 +362,7 @@ class _NetworkImageWidget extends StatelessWidget { imageUrl: '$imageUrl?x-oss-process=image/format,webp/resize,w_320', width: 80, height: 80, + fit: BoxFit.cover, imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 1537967..cbc11e3 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -39,6 +39,21 @@ class _HomePageState extends State width: double.infinity, height: double.infinity, ), + Positioned.fill( + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Colors.transparent, // rgba(248, 242, 255, 1) + Color.fromRGBO(242, 242, 242, .2), // rgba(247, 247, 247, 1) + ], + stops: [0.0, 1.0], + ), + ), + ), + ), Scaffold( backgroundColor: Colors.transparent, appBar: _buildAppBar(controller), diff --git a/lib/pages/home/user_information_page.dart b/lib/pages/home/user_information_page.dart index 375c97b..3efcf7c 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -369,7 +369,7 @@ class UserInformationPage extends StatelessWidget { ), SizedBox(height: 8.w,), Text( - controller.userData.value.describeInfo ?? "我想找一个有缘的异性,快来联系我吧。", + (miId == GlobalData().userData!.id && GlobalData().userData!.auditDescribeInfo != null && GlobalData().userData!.auditDescribeInfo != "") ? (GlobalData().userData!.auditDescribeInfo ?? "") : (controller.userData.value.describeInfo ?? "我想找一个有缘的异性,快来联系我吧。"), style: TextStyle( fontSize: 14.w, color: const Color.fromRGBO(144, 144, 144, 1) diff --git a/lib/pages/main/main_page.dart b/lib/pages/main/main_page.dart index 0e060cd..a383aa2 100644 --- a/lib/pages/main/main_page.dart +++ b/lib/pages/main/main_page.dart @@ -100,6 +100,7 @@ class _MainPageState extends State { TDBottomTabBarBasicType.iconText, componentType: TDBottomTabBarComponentType.normal, useVerticalDivider: false, + barHeight: 61, navigationTabs: [ tabItem('首页', Assets.imagesHomePre, Assets.imagesHomeNol, 0), tabItem('广场', Assets.imagesDiscoverPre, Assets.imagesDiscoverNol, 1), @@ -118,8 +119,8 @@ class _MainPageState extends State { TDBottomTabBarTabConfig tabItem(String title, String selectedIcon, String unselectedIcon, int index) { return TDBottomTabBarTabConfig( tabText: title, - selectedIcon: Image.asset(selectedIcon, width: 25, height: 25, fit: BoxFit.cover), - unselectedIcon: Image.asset(unselectedIcon, width: 25, height: 25, fit: BoxFit.cover), + selectedIcon: Image.asset(selectedIcon, width: 30, height: 30, fit: BoxFit.cover), + unselectedIcon: Image.asset(unselectedIcon, width: 30, height: 30, fit: BoxFit.cover), selectTabTextStyle: TextStyle(color: Color(0xFFED4AC3)), unselectTabTextStyle: TextStyle(color: Color(0xFF999999)), onTap: () { diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index f139da4..60e19ed 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -226,7 +226,21 @@ class _EditInfoPageState extends State { init: EditInfoController(), builder: (controller) { return Scaffold( - appBar: PageAppbar(title: "编辑资料"), + appBar: PageAppbar(title: "编辑资料", right: Container( + margin: EdgeInsets.only(right: 14.w), + child: InkWell( + onTap: (){ + controller.goPreview(); + }, + child: Text( + "预览", + style: TextStyle( + fontSize: 13.w, + color: const Color.fromRGBO(144, 144, 144, 1), + ), + ), + ), + ),), backgroundColor: const Color.fromRGBO(243, 243, 243, 1.0), body: SingleChildScrollView( @@ -307,7 +321,6 @@ class _EditInfoPageState extends State { File(controller.avatarLocalPath.value), width: 85.w, height: 85.w, - fit: BoxFit.cover, ) : (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? CachedNetworkImage( imageUrl: "${controller.userData.value?.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_170", width: 85.w, @@ -366,9 +379,8 @@ class _EditInfoPageState extends State { ], ), SizedBox(height: 5.w,), - Container( + SizedBox( width: 340.w, - margin: EdgeInsets.only(bottom: 35.w), child: Wrap( spacing: 5.w, runSpacing: 5.w, @@ -821,7 +833,7 @@ class _EditInfoPageState extends State { top: 14.w, bottom: 14.w ), - margin: EdgeInsets.only(top: 10.w), + margin: EdgeInsets.only(top: 10.w, bottom: 15.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(9.w)) @@ -829,6 +841,7 @@ class _EditInfoPageState extends State { child: Column( children: [ Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "交友心声", @@ -836,6 +849,18 @@ class _EditInfoPageState extends State { fontSize: 15.w, fontWeight: FontWeight.w500 ), + ), + (controller.userData.value?.auditDescribeInfo != null && controller.userData.value?.auditDescribeInfo != "") ? Text( + "审核中", + style: TextStyle( + fontSize: 13.w, + fontWeight: FontWeight.w500, + color: Color.fromRGBO(191, 191, 191, 1) + ), + ) : Icon( + Icons.keyboard_arrow_right, + size: 15.w, + color: Color.fromRGBO(191, 191, 191, 1) ) ], ), @@ -843,10 +868,11 @@ class _EditInfoPageState extends State { Container( alignment: Alignment.centerLeft, child: Text( - controller.message.value, + controller.realDescribe.value != "" ? controller.realDescribe.value : "请输入交友心声", style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500 + fontSize: 13.w, + fontWeight: FontWeight.w500, + color: controller.realDescribe.value != "" ? const Color.fromRGBO(51, 51, 51, 1) : const Color.fromRGBO(191, 191, 191, 1), ), ), ) @@ -854,9 +880,11 @@ class _EditInfoPageState extends State { ], ), ).onTap((){ - Get.to(() => SignaturePage())?.then((e){ - controller.savaDescribeInfo(); - }); + if(controller.userData.value?.auditDescribeInfo != null && controller.userData.value?.auditDescribeInfo != ""){ + SmartDialog.showToast("交友心声正在审核中,请勿重复提交"); + return; + } + Get.to(() => SignaturePage()); }), ], if(false && controller.menuActive.value == 2) ...[ diff --git a/lib/pages/mine/mine_page.dart b/lib/pages/mine/mine_page.dart index 76dee8d..05890a7 100644 --- a/lib/pages/mine/mine_page.dart +++ b/lib/pages/mine/mine_page.dart @@ -184,11 +184,10 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ ) ], ), - SizedBox(height: 11.w,), Text( "ID:${controller.userId.value ?? ""}", style: TextStyle( - fontSize: 12.w, + fontSize: 10.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), diff --git a/lib/pages/mine/phone_page.dart b/lib/pages/mine/phone_page.dart index 117c3fa..cce7aec 100644 --- a/lib/pages/mine/phone_page.dart +++ b/lib/pages/mine/phone_page.dart @@ -29,25 +29,25 @@ class PhonePage extends StatelessWidget { const SizedBox(height: 12), Text(_encryptPhone(controller.phone.value), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)), SizedBox(height: 64), - TDButton( - text: '更换手机号码', - width: MediaQuery.of(context).size.width - 50, - size: TDButtonSize.large, - type: TDButtonType.fill, - shape: TDButtonShape.round, - style: TDButtonStyle( - textColor: Colors.white, - backgroundColor: Color(0xFF7562F9), - ), - activeStyle: TDButtonStyle( - textColor: Colors.white, - backgroundColor: Color(0xC37562F9), - ), - onTap: (){ - controller.tabIndex.value = 1; - }, - ), - SizedBox(height: 200), + // TDButton( + // text: '更换手机号码', + // width: MediaQuery.of(context).size.width - 50, + // size: TDButtonSize.large, + // type: TDButtonType.fill, + // shape: TDButtonShape.round, + // style: TDButtonStyle( + // textColor: Colors.white, + // backgroundColor: Color(0xFF7562F9), + // ), + // activeStyle: TDButtonStyle( + // textColor: Colors.white, + // backgroundColor: Color(0xC37562F9), + // ), + // onTap: (){ + // controller.tabIndex.value = 1; + // }, + // ), + // SizedBox(height: 200), ], ), ), diff --git a/lib/pages/mine/signature_page.dart b/lib/pages/mine/signature_page.dart index ca0aaac..dcaa6a0 100644 --- a/lib/pages/mine/signature_page.dart +++ b/lib/pages/mine/signature_page.dart @@ -1,70 +1,94 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/controller/mine/edit_info_controller.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; -class SignaturePage extends StatefulWidget { +class SignaturePage extends StatelessWidget { const SignaturePage({super.key}); - @override - State createState() => _SignaturePageState(); -} - -class _SignaturePageState extends State { - - - String message = '拒绝内耗,向阳而生,用热爱抵御岁月漫长,用真诚对待每一次相遇拒绝内耗,向阳而生,用热爱抵御岁月漫长,用真诚对待每一次相遇'; - final TextEditingController _messageController = TextEditingController(); - - @override - void initState() { - super.initState(); - - _messageController.value = TextEditingValue( - text: message, - selection: TextSelection.fromPosition(TextPosition(offset: message.length)), - ); - } @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: "交友心声",), - body: Container( - padding: EdgeInsets.all(17.w), - child: TextField( - controller: _messageController, - maxLength: 50, // 上限 - minLines: 5, // 多行 - maxLines: 5, // 自适应高度 - style: TextStyle( - fontSize: ScreenUtil().setWidth(13), - height: 1 - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 0, - horizontal: 0 - ), - hintText: "请输入交友心声", + return GetX( + init: EditInfoController(), + builder: (controller) { + return Scaffold( + appBar: PageAppbar(title: "交友心声",), + body: Container( + padding: EdgeInsets.all(17.w), + child: TextField( + controller: controller.messageController.value, + maxLength: 50, // 上限 + minLines: 5, // 多行 + maxLines: 5, // 自适应高度 + style: TextStyle( + fontSize: ScreenUtil().setWidth(13), + height: 1 + ), + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 0 + ), + hintText: "请输入交友心声", - border: const OutlineInputBorder( - borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 - ), - // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(8.0)), - ), - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(8.0)), + border: const OutlineInputBorder( + borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 + ), + // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(8.0)), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(8.0)), + ), + ), + onChanged: (value){ + controller.message.value = value; + print(value); + }, ), ), - onChanged: (value){ - message = value; - }, - ), - ), + bottomNavigationBar: Container( + margin: EdgeInsets.only(bottom: 30.w), + child: Container( + width: 350.w, + height: 45.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(45.w)), + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg: 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 起点颜色 + Color.fromRGBO(77, 127, 231, 1), // 中间颜色 + Color.fromRGBO(61, 138, 224, 1), // 终点颜色 + ], + stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% + ), + ), + child: Center( + child: Text( + "保存", + style: TextStyle( + fontSize: 18.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ).onTap(() async { + controller.savaDescribeInfo(); + }), + ), + ); + }, ); } } + +