diff --git a/circle_app/assets/images/msg/heart_icon.png b/circle_app/assets/images/msg/heart_icon.png new file mode 100644 index 0000000..b60562c Binary files /dev/null and b/circle_app/assets/images/msg/heart_icon.png differ diff --git a/circle_app/ios/Runner.xcodeproj/project.pbxproj b/circle_app/ios/Runner.xcodeproj/project.pbxproj index 1190fa8..24dd6f0 100644 --- a/circle_app/ios/Runner.xcodeproj/project.pbxproj +++ b/circle_app/ios/Runner.xcodeproj/project.pbxproj @@ -382,7 +382,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.3.2; - PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; + PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -531,7 +531,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.3.2; - PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; + PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -574,7 +574,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.3.2; - PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; + PRODUCT_BUNDLE_IDENTIFIER = com.example.circleapp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/circle_app/ios/Runner/Runner.entitlements b/circle_app/ios/Runner/Runner.entitlements index 903def2..0c67376 100644 --- a/circle_app/ios/Runner/Runner.entitlements +++ b/circle_app/ios/Runner/Runner.entitlements @@ -1,8 +1,5 @@ - - aps-environment - development - + diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart index 7384595..a17a286 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart @@ -446,6 +446,35 @@ class _TIMUIKItHistoryMessageListItemState if (messageItem.customElem?.extension?.contains('cardData') ?? false) { Map info = jsonDecode(messageItem.customElem?.data ?? ''); + + String title = ''; + + if (info.containsKey('title')) { + var recommendCircleFriendData= info['title']; + + + if (recommendCircleFriendData['is_follow_me'] && isFromSelf) { + title = '对方喜欢了你'; + } else if (recommendCircleFriendData['is_follow_to'] && !isFromSelf) { + title = '对方喜欢了你'; + } else if (recommendCircleFriendData['is_follow_to']) { + title = '你喜欢了TA'; + } else if (recommendCircleFriendData['has_both_friend']) { + title = '你们有共同喜欢的圈友'; + } else if (recommendCircleFriendData['has_friend_follow_to'] && isFromSelf) { + title = '你喜欢的圈友也喜欢TA'; + } else if (recommendCircleFriendData['is_wanna_meet'] && isFromSelf) { + title = '很多圈友都喜欢TA'; + } else if (recommendCircleFriendData['is_wanna_meet'] && isFromSelf) { + title = 'TA是乐园优秀圈主哦~'; + } else if (recommendCircleFriendData['is_wanna_meet'] && isFromSelf) { + title = '可能是你想认识的人'; + } + + } + + + return Column( children: [ Container( @@ -464,6 +493,30 @@ class _TIMUIKItHistoryMessageListItemState child: Column( children: [ + if (title.isNotEmpty) + Container( + margin: EdgeInsets.only(top: 10.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3.sp, + height: 3.sp, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(1.5.sp), + color: Color(0xFF00FFF4)), + ), + Text( + title, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + ) + ], + ), + ), if (info.containsKey('city')) info['city'].toString().isNotEmpty ? Container( @@ -492,7 +545,7 @@ class _TIMUIKItHistoryMessageListItemState : Container(), if (info.containsKey('both_interests')) Container( - margin: EdgeInsets.only(top: 16.sp, right: 16.sp), + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), child: Row( children: [ Container( diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart index e6aeecc..d92e786 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart @@ -31,6 +31,7 @@ import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField import '../../../../common/Widgets/open_vip_tip/view.dart'; import '../../../../util/eventBus.dart'; +import '../../widget/send_gift_dialog.dart'; enum MuteStatus { none, me, all } @@ -358,12 +359,18 @@ class _InputTextFieldState extends TIMUIKitState { atUserIDList: getUserIdFromMemberInfoMap()), context); } else if (memberInfoMap.isNotEmpty) { + + widget.model.sendTextAtMessage( text: text, convType: widget.conversationType, convID: widget.conversationID, atUserList: getUserIdFromMemberInfoMap()); } else { + bool isOK = await loadIsShowSendGiftDialogData(); + if (!isOK) { + return; + } isSendLoging = true; var data = await DioManager.instance .post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2}); @@ -379,12 +386,14 @@ class _InputTextFieldState extends TIMUIKitState { } if (words.isEmpty) { - MessageUtils.handleMessageError( + var msgResult = await MessageUtils.handleMessageError( widget.model.sendTextMessage( text: text, convID: widget.conversationID, convType: convType), context); + + addChatRecord(text, msgResult!.data!.msgID! ?? '', msgResult!.data!.timestamp!.toString() ?? ''); } else { textEditingController.text = text; showOKToast('含违规词汇,无法发送'); @@ -403,6 +412,19 @@ class _InputTextFieldState extends TIMUIKitState { } } + loadIsShowSendGiftDialogData() async { + V2TimConversation con = Get.arguments; + var data = await DioManager.instance.get(url: Api.isShow_give_gift + widget.conversationID.split('_').last); + if (data['code'] == 200) { + if (data['data']) { + Get.bottomSheet(SendGiftDialog(accid: widget.conversationID,title: data['msg'],), isScrollControlled: true, + enableDrag: false); + return false; + } + } + return true; + } + sendHiText() async { Map info = jsonDecode(widget.currentConversation.lastMessage!.customElem!.data!); @@ -417,13 +439,23 @@ class _InputTextFieldState extends TIMUIKitState { } sendHiTextMsg(String text) async { - var result = await widget.model.sendTextMessage( + widget.model.sendTextMessage( text: text, convID: widget.conversationID, convType: ConvType.c2c); - hintText = '说些什么吧~'; setState(() {}); } + addChatRecord(String msgContent,String msgId,String sendTime) async { + String str = DateTime.now().toString().split('.').first; + var data = + await DioManager.instance.post(url: Api.chatRecord, params: { + "content": msgContent, + "msgId": msgId, + "sendTime": str, + "to": widget.conversationID.split('_').last + }); + } + void goDownBottom() { if (globalModel.getMessageListPosition(widget.conversationID) == HistoryMessagePosition.notShowLatest) { diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart index eee9dd8..19bf1be 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart @@ -921,6 +921,10 @@ class _TIMTextFieldLayoutNarrowState } Future checkImStatus() async { + imStatusOK = await loadIsShowSendGiftDialogData(); + if (imStatusOK == false) { + return imStatusOK; + } var data = await DioManager.instance.get(url: Api.imstate); int code = data['code']; @@ -939,9 +943,23 @@ class _TIMTextFieldLayoutNarrowState showOKToast(data['msg']); imStatusOK = false; } + return imStatusOK; } + loadIsShowSendGiftDialogData() async { + + var data = await DioManager.instance.get(url: Api.isShow_give_gift +widget.userId!.split('_').last); + if (data['code'] == 200) { + if (data['data']) { + Get.bottomSheet(SendGiftDialog(accid: widget.userId!,title: data['msg'],), isScrollControlled: true, + enableDrag: false); + return false; + } + } + return true; + } + Future checkVipStatus(int plate) async { var data = await DioManager.instance.get(url: Api.getIsVips + plate.toString()); @@ -966,6 +984,20 @@ class _TIMTextFieldLayoutNarrowState return isVip; } + addChatRecord(String msgContent,String msgId,String sendTime) async { + + + String str = DateTime.now().toString().split('.').first; + + var data = + await DioManager.instance.post(url: Api.chatRecord, params: { + "content": msgContent, + "msgId": msgId, + "sendTime": str, + "to": widget.conversationID.split('_').last + }); + } + VideoPlayerController? videoPlayerController; Future getVideoFile(ImageSource imageSource) async { @@ -1009,7 +1041,7 @@ class _TIMTextFieldLayoutNarrowState final Duration videoDuration = videoPlayerController!.value.duration; final double durationInSeconds = videoDuration.inSeconds.toDouble(); - await widget.model.sendVideoMessage( + V2TimValueCallback? msgresult = await widget.model.sendVideoMessage( videoPath: pickedFile.path, snapshotPath: thumbnailPath, // 在此处可用 @@ -1018,6 +1050,9 @@ class _TIMTextFieldLayoutNarrowState duration: durationInSeconds.toInt(), inputElement: context, ); + + addChatRecord('[视频]', msgresult!.data!.msgID! ?? '', msgresult!.data!.timestamp!.toString() ?? ''); + if (imageSource == ImageSource.camera) { DioManager.instance.get(url: Api.getAddTrialCount + "2"); } else { @@ -1068,11 +1103,13 @@ class _TIMTextFieldLayoutNarrowState final XFile? pickedFile = await _picker.pickImage( source: ImageSource.gallery, ); - await widget.model.sendImageMessage( + var msgresult = await widget.model.sendImageMessage( imagePath: pickedFile!.path, convID: widget.conversationID, convType: widget.conversationType, inputElement: context); + + addChatRecord('[图片]', msgresult!.data!.msgID! ?? '', msgresult!.data!.timestamp!.toString() ?? ''); var data = await DioManager.instance.get(url: Api.getAddTrialCount + "3"); } catch (e) { print(e); @@ -1100,11 +1137,12 @@ class _TIMTextFieldLayoutNarrowState if (null == pickedFile) { return; } - widget.model.sendImageMessage( + var msgresult = await widget.model.sendImageMessage( imagePath: pickedFile.path, convID: widget.conversationID, convType: widget.conversationType, inputElement: context); + addChatRecord('[图片]', msgresult!.data?.msgID! ?? '', msgresult!.data!.timestamp!.toString() ?? ''); DioManager.instance.get(url: Api.getAddTrialCount + "1"); } catch (e) {} } diff --git a/circle_app/lib/app/chat/logic.dart b/circle_app/lib/app/chat/logic.dart index 22b7a30..2fe8ded 100644 --- a/circle_app/lib/app/chat/logic.dart +++ b/circle_app/lib/app/chat/logic.dart @@ -1,9 +1,11 @@ +import 'package:circle_app/network/api.dart'; import 'package:circle_app/network/dio_manager.dart'; import 'package:get/get.dart'; import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; import '../../util/eventBus.dart'; import 'state.dart'; +import 'widget/send_gift_dialog.dart'; class ChatLogic extends GetxController { @@ -14,12 +16,25 @@ class ChatLogic extends GetxController { void onInit() { // TODO: implement onInit super.onInit(); + // loadIsShowSendGiftDialogData(); selectedConversation = Get.arguments; } sendData() async { - var data = await DioManager.instance.get(url: 'url',params: {}); + var data = await DioManager.instance.get(url: Api.isShow_give_gift,params: {}); + } + + Future loadIsShowSendGiftDialogData() async { + var data = await DioManager.instance.get(url: Api.isShow_give_gift + selectedConversation!.conversationID!.split('_').last); + if (data['code'] == 200) { + if (data['data']) { + Get.bottomSheet(SendGiftDialog(accid: selectedConversation!.conversationID!,title: data['msg'],), isScrollControlled: true, + enableDrag: false); + return false; + } + } + return true; } } diff --git a/circle_app/lib/app/chat/view.dart b/circle_app/lib/app/chat/view.dart index 98854cb..7e5d597 100644 --- a/circle_app/lib/app/chat/view.dart +++ b/circle_app/lib/app/chat/view.dart @@ -33,7 +33,7 @@ class _ChatPageState extends State { @override void dispose() { // TODO: implement dispose - EventBusManager.fire(RefreshUnread()); + sub.cancel(); super.dispose(); } @@ -41,25 +41,42 @@ class _ChatPageState extends State { TIMUIKitChatController(); User? userInfoBean; - + var sub; @override void initState() { // TODO: implement initState super.initState(); initEventBus(); loadMyInfo(); + // loadIsShowSendGiftDialogData(); + } + + + + void loadIsShowSendGiftDialogData() async { + V2TimConversation con = Get.arguments; + var data = await DioManager.instance.get(url: Api.isShow_give_gift + con!.conversationID!.split('_').last); + if (data['code'] == 200) { + if (data['data']) { + Get.bottomSheet(SendGiftDialog(accid: con!.conversationID!,title: data['msg'],), isScrollControlled: true, + enableDrag: false); + } + } } initEventBus()async{ - EventBusManager.on().listen((event) async{ + sub = EventBusManager.on().listen((event) async{ V2TimValueCallback? sendMessageRes = await _timuiKitChatController.sendMessage( messageInfo: event.createCustomMessageRes?.data?.messageInfo); if (sendMessageRes!.code == 0) { // 发送成功 - showOKToast('发送成功'); + if (sendMessageRes.data?.customElem?.extension != 'cardData') { + showOKToast('发送成功'); + } + // sendMessageRes.data?.customElem?.data; //自定义data sendMessageRes.data?.customElem?.desc; //自定义desc sendMessageRes.data?.customElem?.extension; //自定义extension diff --git a/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart b/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart index e03ec49..dbd212e 100644 --- a/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart +++ b/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart @@ -83,6 +83,7 @@ class _ChatCircleShareDialogState extends State { body: Column( children: [ Expanded(child: Container()), + Container( height:Get.height * 0.5, color: Color(0xFF423055), @@ -99,7 +100,7 @@ class _ChatCircleShareDialogState extends State { var bean = circle.lists[index]; return circleInfoItemWidget( - circle.lists[index]); + circle.lists[index],index); }, itemCount: circle.lists.length + 1, ), @@ -112,12 +113,20 @@ class _ChatCircleShareDialogState extends State { } - circleInfoItemWidget(Circle bean) { + circleInfoItemWidget(Circle bean,int index) { return Container( margin: EdgeInsets.only(top: 10.sp, left: 10.sp, right: 10.sp), child: Column( children: [ + if (index == 0) + Container( + height: 28.sp, + margin: EdgeInsets.only(bottom: 10.sp), + alignment: Alignment.center, + child: Text('我的圈子',style: TextStyle(color: Colors.white,fontSize: 17.sp),), + ), + ClipRRect( borderRadius: BorderRadius.circular(10.sp), child: Container( diff --git a/circle_app/lib/app/chat/widget/chat_gift_pannel.dart b/circle_app/lib/app/chat/widget/chat_gift_pannel.dart index dd6b688..f3e72ab 100644 --- a/circle_app/lib/app/chat/widget/chat_gift_pannel.dart +++ b/circle_app/lib/app/chat/widget/chat_gift_pannel.dart @@ -74,7 +74,7 @@ class _ChatGiftPannelState extends State child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - + SizedBox(height: 5.sp,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -90,13 +90,13 @@ class _ChatGiftPannelState extends State indicatorColor: AppColor.mainColor, indicatorSize: TabBarIndicatorSize.label, unselectedLabelStyle: TextStyle( - fontSize: 14.sp, + fontSize: 16.sp, fontWeight: FontWeight.w500, ), unselectedLabelColor: Color(0xB3FFFFFF), labelColor: AppColor.mainColor, labelStyle: TextStyle( - fontSize: 14.sp, fontWeight: FontWeight.w500), + fontSize: 16.sp, fontWeight: FontWeight.w500), controller: tabController, tabs: const [ Tab( @@ -132,7 +132,7 @@ class _ChatGiftPannelState extends State color: Color(0xFF423055), borderRadius: BorderRadius.circular(10.sp) )), - Text('礼物馆',style: TextStyle(color: Colors.white,fontSize: 14.sp),) + Text('礼物墙',style: TextStyle(color: Colors.white,fontSize: 14.sp),) ], ), )), diff --git a/circle_app/lib/app/chat/widget/gift.dart b/circle_app/lib/app/chat/widget/gift.dart index 2c2e2c2..d2170e8 100644 --- a/circle_app/lib/app/chat/widget/gift.dart +++ b/circle_app/lib/app/chat/widget/gift.dart @@ -17,7 +17,7 @@ import '../../../common/Widgets/base_tip_widget.dart'; class Gift extends StatefulWidget { String accid; String giftId; - Gift(this.accid,this.giftId, {super.key}); + Gift(this.accid, this.giftId, {super.key}); @override _GiftState createState() => _GiftState(); } @@ -48,20 +48,22 @@ class _GiftState extends State { } gelectThirdItem() async { - var data = await DioManager.getInstance().get(url: Api.walletRechargeSelectItem); + var data = + await DioManager.getInstance().get(url: Api.walletRechargeSelectItem); if (data['code'] == 200) { // "walletRechargeSelectItemBos" -> [_GrowableList] - List response =data['data']['priceConfs']; + List response = data['data']['priceConfs']; incomeBalance = data['data']['balance'].toString(); // List walletRechargeSelectItemBos = []; - AssetsDataDataPriceConfs info = AssetsDataDataPriceConfs.fromJson(response.last); - balanceTipStr = info.remark!.isNotEmpty ? '首冲最高赠送' + info.remark!.split('送').last + '>' : '充值>'; + AssetsDataDataPriceConfs info = + AssetsDataDataPriceConfs.fromJson(response.last); + balanceTipStr = info.remark!.isNotEmpty + ? '首冲最高赠送' + info.remark!.split('送').last + '>' + : '充值>'; } - } - @override Widget build(BuildContext context) { return Stack( @@ -70,19 +72,20 @@ class _GiftState extends State { color: Colors.transparent, child: Column( children: [ - - widget.accid!.isNotEmpty ? Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - width: Get.width, - alignment: Alignment.center, - child: Text( - tipStr.isNotEmpty ? '礼物送出后,获得$tipStr小时的消息置顶' : '', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ) : Container(), + widget.accid!.isNotEmpty + ? Container( + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), + width: Get.width, + alignment: Alignment.center, + child: Text( + tipStr.isNotEmpty ? '礼物送出后,获得$tipStr小时的消息置顶' : '', + style: TextStyle( + color: AppColor.mainColor, + fontSize: 12.sp, + fontWeight: FontWeight.w500), + ), + ) + : Container(), Expanded( child: Container( width: Get.width, @@ -99,35 +102,39 @@ class _GiftState extends State { width: Get.width, child: Row( children: [ - Container( - margin: EdgeInsets.only(right: 4.sp), - child: Image.asset( - getMineImage('bi_icon1'), - width: 24.sp, - ), - ), - Text( - '${incomeBalance}', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - SizedBox( - width: 16.sp, - ), GestureDetector( onTap: () { showRechargeScreenDialog().then((value) { getAsset(); }); }, - child: Text( - balanceTipStr, - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 4.sp), + child: Image.asset( + getMineImage('bi_icon1'), + width: 24.sp, + ), + ), + Text( + '${incomeBalance}', + style: TextStyle( + color: Color(0xFFF7FAFA), + fontSize: 12.sp, + fontWeight: FontWeight.w500), + ), + SizedBox( + width: 16.sp, + ), + Text( + balanceTipStr, + style: TextStyle( + color: AppColor.mainColor, + fontSize: 12.sp, + fontWeight: FontWeight.w500), + ), + ], ), ), Expanded(child: Container()), @@ -153,7 +160,8 @@ class _GiftState extends State { height: 27.sp, decoration: BoxDecoration( gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(13.5.sp)), + borderRadius: + BorderRadius.circular(13.5.sp)), alignment: Alignment.center, child: Text( '求送', @@ -164,13 +172,15 @@ class _GiftState extends State { ), ), ), - SizedBox(width: 8,), + SizedBox( + width: 8, + ), GestureDetector( onTap: () { if (giftId.isEmpty) { showOKToast('请选择您想赠送的礼物'); } else { - sendGiftData(); + sendGiftData(); } }, child: Container( @@ -178,7 +188,8 @@ class _GiftState extends State { height: 27.sp, decoration: BoxDecoration( gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(13.5.sp)), + borderRadius: + BorderRadius.circular(13.5.sp)), alignment: Alignment.center, child: Text( '赠送', @@ -211,9 +222,13 @@ class _GiftState extends State { sendGetGiftCustomMsg(widget.accid, jsonEncode(info), '求您送我${info['name']}'); } - void sendGiftData() async { - var result = await DioManager.instance.post(url: Api.sendGift,params: {'accid':widget.accid,'giftId':giftId,'num':giftCount,'toUserId':widget.accid!.split('_').last}); + var result = await DioManager.instance.post(url: Api.sendGift, params: { + 'accid': widget.accid, + 'giftId': giftId, + 'num': giftCount, + 'toUserId': widget.accid!.split('_').last + }); if (result['code'] == 200) { showOKToast('赠送成功'); getAsset(); @@ -223,12 +238,12 @@ class _GiftState extends State { } } - void loadGiftData() async { var result = await DioManager.instance.get(url: Api.giftList); if (result['code'] == 200) { List dataList = result['data']; List giftItemData = []; + for (int i = 0; i < dataList.length; i++) { var info = dataList[i]; if (info['id'] == giftId) { @@ -242,6 +257,15 @@ class _GiftState extends State { giftItemData.clear(); } } + + for (int i = 0; i < giftList[0].length; i++) { + var info = giftList[0][i]; + if (info['name'] == '浪漫告白') { + selectedIndex = i; + giftId = info['id'].toString(); + } + } + setState(() {}); } } @@ -267,7 +291,7 @@ class _GiftState extends State { crossAxisCount: 4, crossAxisSpacing: 0.0.sp, mainAxisSpacing: 0.sp, - childAspectRatio: (Get.width - 32.sp) / 4 / 127.5.sp , + childAspectRatio: (Get.width - 32.sp) / 4 / 127.5.sp, ), itemCount: info.length, // Replace with the actual item count @@ -275,13 +299,13 @@ class _GiftState extends State { physics: NeverScrollableScrollPhysics(), itemBuilder: (context, index) { // Replace the placeholders with the actual item widgets - return giftItemWidget(info[index],index); + return giftItemWidget(info[index], index); }, ), ); } - giftItemWidget(Map info,int index) { + giftItemWidget(Map info, int index) { bool isSelected = giftId.contains(info['id'].toString()); double price = info['price']; @@ -309,7 +333,11 @@ class _GiftState extends State { child: Stack( fit: StackFit.expand, children: [ - isSelected ? Image.asset(getMsgImage('gift_bg'),) : Container(), + isSelected + ? Image.asset( + getMsgImage('gift_bg'), + ) + : Container(), Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -359,9 +387,7 @@ class _GiftState extends State { onTap: () { giftCount = count; isShowCount = false; - setState(() { - - }); + setState(() {}); }, child: Container( height: 30.sp, @@ -372,18 +398,20 @@ class _GiftState extends State { children: [ Expanded( child: Container( - alignment: Alignment.center, + alignment: Alignment.center, child: Text( - '${count}', - style: TextStyle(color: Color(0xFFE6E6E6), fontSize: 12.sp), - ))), + '${count}', + style: + TextStyle(color: Color(0xFFE6E6E6), fontSize: 12.sp), + ))), Expanded( child: Container( alignment: Alignment.center, child: Text( - desc, - style: TextStyle(color: Color(0xFFE6E6E6), fontSize: 12.sp), - ))), + desc, + style: + TextStyle(color: Color(0xFFE6E6E6), fontSize: 12.sp), + ))), ], ), ), diff --git a/circle_app/lib/app/chat/widget/partner_option.dart b/circle_app/lib/app/chat/widget/partner_option.dart index 2cef2be..69a4ceb 100644 --- a/circle_app/lib/app/chat/widget/partner_option.dart +++ b/circle_app/lib/app/chat/widget/partner_option.dart @@ -80,8 +80,8 @@ class _PartnerOptionState extends State { setState(() {}); }, child: Container( - height: 60.sp, - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + // height: 60.sp, + padding: EdgeInsets.only(left: 15.sp, right: 15.sp,top: 10.sp,bottom: 10.sp), // margin: EdgeInsets.only(right: 5.sp, bottom: 5.sp), //height: 300, decoration: BoxDecoration( @@ -96,8 +96,8 @@ class _PartnerOptionState extends State { children: [ Image.asset( getMsgImage(vipName[index]), - width: 48.sp, - height: 48.sp, + width: 60.sp, + height: 60.sp, fit: BoxFit.cover, ), SizedBox(width: 10.sp), @@ -109,7 +109,7 @@ class _PartnerOptionState extends State { Text( vipTitleName[index], style: TextStyle( - color: Colors.white, fontSize: 14.sp), + color: Colors.white, fontSize: 17.sp), ), SizedBox(height: 4.sp), Text( @@ -120,7 +120,7 @@ class _PartnerOptionState extends State { ? '3个月' : '1个月'), style: TextStyle( - color: Colors.grey, fontSize: 10.sp), + color: Colors.grey, fontSize: 15.sp), ), ], )), @@ -128,7 +128,7 @@ class _PartnerOptionState extends State { Text( item.amount.toInt().toString() + '元', style: TextStyle( - color: AppColor.mainColor, fontSize: 12.sp), + color: AppColor.mainColor, fontSize: 14.sp), ) ], ), diff --git a/circle_app/lib/app/chat/widget/send_gift_dialog.dart b/circle_app/lib/app/chat/widget/send_gift_dialog.dart index 2848d23..25cc154 100644 --- a/circle_app/lib/app/chat/widget/send_gift_dialog.dart +++ b/circle_app/lib/app/chat/widget/send_gift_dialog.dart @@ -11,8 +11,8 @@ import '../../../util/util.dart'; class SendGiftDialog extends StatefulWidget { String accid; - - SendGiftDialog({super.key,required this.accid}); + String title; + SendGiftDialog({super.key,required this.accid,required this.title}); @override _SendGiftDialogState createState() => new _SendGiftDialogState(); @@ -37,6 +37,15 @@ class _SendGiftDialogState extends State { var result = await DioManager.instance.get(url: Api.giftList); if (result['code'] == 200) { giftList = result['data']; + + for (int i= 0; i< giftList.length; i++) { + var info = giftList[i]; + if (info['name'] == '浪漫告白') { + selectedIndex = i ; + giftId = info['id'].toString(); + } + } + setState(() {}); } } @@ -44,104 +53,112 @@ class _SendGiftDialogState extends State { @override Widget build(BuildContext context) { // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Center( - child: Container( - height: 255.sp, - margin: EdgeInsets.only(left: 15.sp,right: 15.sp), - padding: EdgeInsets.only(left: 15.sp,right: 15.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 18.sp), - child: Text( - '今天找TA聊天的人有点多哦,为了避免打扰你需要赠送个礼物给TA才能继续聊天哈~', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - Container( - height: 102.sp, - margin: EdgeInsets.only(top: 12.sp,), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient( - colors: [Color(0xFF132B40), Color(0xFF251240)])), - child: giftGridWidget(), - ), - Container( - margin: EdgeInsets.only(top: 25.sp,), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - height: 42.sp, - width: 136.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - color: Color(0x26FFFFFF) - ), - alignment: Alignment.center, - child: Text( - '放弃', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - GestureDetector( - onTap: () async { - if (selectedIndex < 0) { - showOKToast('请选择一个礼物'); - return; - } - var result = await DioManager.instance.post(url: Api.sendGift,params: {'accid':widget.accid,'giftId':giftId,'num':1,'toUserId':widget.accid!.split('_').last}); - if (result['code'] == 200) { - showOKToast('赠送成功'); - Get.back(); - } else if (result['code'] == 31201) { - showOKToast(result['msg']); - showRechargeScreenDialog(); - } + return GestureDetector( + onTap: () { - }, - child: Container( - height: 42.sp, - width: 136.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: AppColor.mainVerLinearGradient - ), - child: Text( - '赠送', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), + }, + child: Scaffold( + backgroundColor: Colors.transparent, + body: Center( + child: Container( + constraints: BoxConstraints( + maxHeight: 285.sp + ), + margin: EdgeInsets.only(left: 15.sp,right: 15.sp), + padding: EdgeInsets.only(left: 15.sp,right: 15.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]), + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 1.sp, + ), + ), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 18.sp), + child: Text( + widget.title, + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ), + Container( + height: 102.sp, + margin: EdgeInsets.only(top: 12.sp,), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + gradient: LinearGradient( + colors: [Color(0xFF132B40), Color(0xFF251240)])), + child: giftGridWidget(), + ), + Container( + margin: EdgeInsets.only(top: 25.sp,), + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Get.back(); + Get.back(); + }, + child: Container( + height: 42.sp, + width: 136.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + color: Color(0x26FFFFFF) + ), + alignment: Alignment.center, + child: Text( + '放弃', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), ), ), - ), - ], - ), - ) - ], + GestureDetector( + onTap: () async { + if (selectedIndex < 0) { + showOKToast('请选择一个礼物'); + return; + } + var result = await DioManager.instance.post(url: Api.sendGift,params: {'accid':widget.accid,'giftId':giftId,'num':1,'toUserId':widget.accid!.split('_').last}); + if (result['code'] == 200) { + showOKToast('赠送成功'); + Get.back(); + } else if (result['code'] == 31201) { + showOKToast(result['msg']); + showRechargeScreenDialog(); + } + + }, + child: Container( + height: 42.sp, + width: 136.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + gradient: AppColor.mainVerLinearGradient + ), + child: Text( + '赠送', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + ], + ), + ) + ], + ), ), ), ), diff --git a/circle_app/lib/app/chat/widget/wish_dialog.dart b/circle_app/lib/app/chat/widget/wish_dialog.dart index 702fa33..399fd7d 100644 --- a/circle_app/lib/app/chat/widget/wish_dialog.dart +++ b/circle_app/lib/app/chat/widget/wish_dialog.dart @@ -24,7 +24,7 @@ class _WishDialogState extends State { List giftList = []; String giftId = ''; String withStr = ''; - int selectedIndex = -1; + int selectedIndex = 1; List optionList = [ '分享一张本人照片', @@ -47,6 +47,13 @@ class _WishDialogState extends State { var result = await DioManager.instance.get(url: Api.giftList); if (result['code'] == 200) { giftList = result['data']; + for (int i= 0; i< giftList.length; i++) { + var info = giftList[i]; + if (info['name'] == '浪漫告白') { + selectedIndex = i ; + giftId = info['id'].toString(); + } + } setState(() {}); } } @@ -149,46 +156,45 @@ class _WishDialogState extends State { colors: [Color(0xFF132B40), Color(0xFF251240)])), child: giftGridWidget(), ), - Container( - height: 30.sp, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(15.sp)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '选择感恩方式', - style: TextStyle( - color: Color(0xB3FFFFFF), fontSize: 15.sp), + GestureDetector( + onTap: () { + showOptionPiker(withStr); + }, + // behavior: HitTestBehavior.opaque, + child: Container( + height: 30.sp, + padding: EdgeInsets.only(left: 10.sp, right: 10.sp), + margin: EdgeInsets.only(top: 12.sp), + decoration: BoxDecoration( + color: Color(0x1AFFFFFF), + borderRadius: BorderRadius.circular(15.sp)), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '选择感恩方式', + style: TextStyle( + color: Color(0xB3FFFFFF), fontSize: 15.sp), + ), + Row( + children: [ + Text( + withStr.isNotEmpty ? withStr : '请选择', + style: TextStyle( + color: withStr.isNotEmpty + ? AppColor.mainColor + : Colors.white, + fontSize: 15.sp), + ), + Image.asset( + getHomeImage('icon_in'), + width: 24.sp, + ) + ], + ), + ], ), - GestureDetector( - onTap: () { - showOptionPiker(withStr); - }, - behavior: HitTestBehavior.opaque, - child: Row( - children: [ - Text( - withStr.isNotEmpty ? withStr : '请选择', - style: TextStyle( - color: withStr.isNotEmpty - ? AppColor.mainColor - : Colors.white, - fontSize: 15.sp), - ), - Image.asset( - getHomeImage('icon_in'), - width: 24.sp, - ) - ], - ), - ) - ], - ), - ), + )), Container( margin: EdgeInsets.only(top: 12.sp, bottom: 15.sp), padding: EdgeInsets.only(left: 30.sp, right: 30.sp), @@ -228,14 +234,14 @@ class _WishDialogState extends State { if (selectedIndex < 0) { showOKToast('请选择一个礼物'); return; - } else if (withStr.isEmpty) { + } else if (withStr.isEmpty) { showOKToast('请选择感恩方式'); return; } var info = giftList[selectedIndex]; info['option'] = withStr; - sendGetWishCustomMsg( - widget.accId, jsonEncode(info), '许愿:想要${info['name']}'); + sendGetWishCustomMsg(widget.accId, jsonEncode(info), + '许愿:想要${info['name']}'); }, child: Container( height: 42.sp, @@ -277,7 +283,7 @@ class _WishDialogState extends State { Pickers.showSinglePicker(context, pickerStyle: DefaultPickerStyle.dark(), data: optionList, - selectData: text.isNotEmpty ? text : optionList.first, + selectData: text.isNotEmpty ? text : optionList[2], onConfirm: (p, position) { withStr = p; setState(() {}); diff --git a/circle_app/lib/app/circle/widgets/discover.dart b/circle_app/lib/app/circle/widgets/discover.dart index 99ca9a0..2bbf21c 100644 --- a/circle_app/lib/app/circle/widgets/discover.dart +++ b/circle_app/lib/app/circle/widgets/discover.dart @@ -562,11 +562,11 @@ class _DiscoverState extends State ), Container( width: Get.width - 120.sp, - margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), + margin: EdgeInsets.only(top: 15.sp,bottom: 15.sp), child: Text( user.signature! ?? '', overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: (user.signature! ?? '').length > 15 ? 2 : 1, style: TextStyle( fontSize: 16.sp, color: const Color(0XFFF7FAFA)), diff --git a/circle_app/lib/app/circle/widgets/info_list_view.dart b/circle_app/lib/app/circle/widgets/info_list_view.dart index ae6990f..f2737ce 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -67,6 +67,10 @@ class InfoListViewState extends State with AutomaticKeepAliveClien EventBusManager.cancelSubscription(scroToTop!); } + + if (cicleInfoRefresh != null) { + cicleInfoRefresh!.cancel(); + } scrollController.dispose(); super.dispose(); @@ -74,6 +78,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } StreamSubscription? callRefreshCicle =null; + StreamSubscription? cicleInfoRefresh =null; StreamSubscription? scroToTop =null; @override @@ -99,10 +104,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien callRefreshCicle = EventBusManager.on().listen((event) { if(widget.bean.id.toString() == event.circleId){ + callOutPage = 1; loadCallOutListData(); } }); + cicleInfoRefresh = EventBusManager.on().listen((event) { + if(widget.bean.id.toString() == event.circleId){ + refreshCircleData(); + } + }); + + // // scroToTop = EventBusManager.on().listen((event) { // if (widget.logic.state.index == widget.index) { @@ -219,6 +232,9 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } void pushMsgPage(Lists bean, String cicleId) async { + if (widget.bean.is_limit&&widget.bean.amount > 0) { + await refreshCircleData(); + } if (widget.bean.is_limit&&widget.bean.amount>0) { showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ @@ -770,6 +786,9 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Get.toNamed(AppRoutes.UserInfoActivity); return; } + if (widget.bean.is_limit&&widget.bean.amount > 0) { + await refreshCircleData(); + } if (widget.bean.is_limit&&widget.bean.amount>0) { showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ widget.bean.is_limit = false; @@ -1075,6 +1094,10 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Get.toNamed(AppRoutes.UserInfoActivity); return; } + if (widget.bean.is_limit&&widget.bean.amount > 0) { + await refreshCircleData(); + } + if (widget.bean.is_limit&&widget.bean.amount > 0) { showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ widget.bean.is_limit = false; @@ -1588,9 +1611,9 @@ class InfoListViewState extends State with AutomaticKeepAliveClien content, 17.sp, FontWeight.w300, Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 64.sp, 100); } - void refreshCircleData() async { - var routePath = Get.currentRoute; - if (routePath == AppRoutes.Signal_circle_list) return; + refreshCircleData() async { + // var routePath = Get.currentRoute; + // if (routePath == AppRoutes.Signal_circle_list) return; var data = await DioManager.instance .get(url: 'up-service/interest/${widget.bean.id}'); diff --git a/circle_app/lib/app/gift_shop/view.dart b/circle_app/lib/app/gift_shop/view.dart index c2475d2..80944f5 100644 --- a/circle_app/lib/app/gift_shop/view.dart +++ b/circle_app/lib/app/gift_shop/view.dart @@ -24,7 +24,7 @@ class Gift_shopPage extends StatelessWidget { return Scaffold( backgroundColor: Colors.black, appBar: MyAppBar( - centerTitle: logic.userId.isNotEmpty ? 'Ta的礼物馆' : '我的礼物馆', + centerTitle: logic.userId.isNotEmpty ? 'Ta的礼物墙' : '我的礼物墙', actionWdiget: logic.userId.isNotEmpty ? Container() : GestureDetector( @@ -118,7 +118,7 @@ class Gift_shopPage extends StatelessWidget { children: [ Image.network( logic.toUser['avatar'] ?? - 'http://qiniuyun.ikuayou.com/avatar/default/default_header.png', + 'https://qiniuyun.ikuayou.com/avatar/default/default_header.png', width: Get.width - 32.sp, height: 100.sp, fit: BoxFit.cover, @@ -140,7 +140,7 @@ class Gift_shopPage extends StatelessWidget { child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: logic.toUser['avatar'] ?? - 'http://qiniuyun.ikuayou.com/avatar/default/default_header.png', + 'https://qiniuyun.ikuayou.com/avatar/default/default_header.png', width: 45.sp, height: 45.sp, ), @@ -313,8 +313,14 @@ class Gift_shopPage extends StatelessWidget { fontWeight: FontWeight.w500)), GestureDetector( onTap: () { - logic.sendGiftData(logic.accid, info['id'].toString(), - logic.userId, index, ''); + if (logic.userId.isEmpty) { + logic.sendGiftData(logic.accid, info['id'].toString(), + logic.accid.split('_').last, index, ''); + } else { + logic.sendGiftData(logic.accid, info['id'].toString(), + logic.userId, index, ''); + } + }, child: Container( height: 20.sp, @@ -326,7 +332,7 @@ class Gift_shopPage extends StatelessWidget { gradient: AppColor.mainVerLinearGradient, borderRadius: BorderRadius.circular(10.sp)), child: Text( - !isGet ? '去送礼' : '赠送', + !isGet ? '点亮' : '赠送', style: TextStyle(color: Colors.white, fontSize: 11.sp), ), ), diff --git a/circle_app/lib/app/login/complete_material/logic.dart b/circle_app/lib/app/login/complete_material/logic.dart index d801582..a4f3336 100644 --- a/circle_app/lib/app/login/complete_material/logic.dart +++ b/circle_app/lib/app/login/complete_material/logic.dart @@ -11,6 +11,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:image_picker/image_picker.dart'; +import '../../../common/Widgets/base_tip_widget.dart'; import '../../../common/config.dart'; import '../../../network/api.dart'; import '../../../util/qiniu.dart'; @@ -38,6 +39,8 @@ class Complete_materialLogic extends GetxController { int unLockWxNum = 0; + Map wxStatusInfo = {}; + late ConfigBean configBean; List numbers = []; @@ -62,6 +65,7 @@ class Complete_materialLogic extends GetxController { await loadCofigData(); getCityList(); if(type!=''){ + loadWXEditStatus(); var data = await DioManager.instance.get(url: Api.getUserInfo); var bean = BaseResponse.fromJson( data, (data) => ResponseBean.fromJson(data)); @@ -107,6 +111,21 @@ class Complete_materialLogic extends GetxController { } + loadWXEditStatus() async { + var data = + await DioManager.instance.get(url: Api.checkWxNumState,); + if (data['code'] == 200) { + // code 200 直接跳填微信,不提示,4000 不让填写,32100 弹返回的提示 + // + // BAN_ACTION(4000, "用户当前操作被禁止"), + // + // NOTICE_UPDATE_WXNUM(32100, "填写/更新微信需要消耗{}小票哦"); + + } else { + wxStatusInfo['${data['code']}'] = data['msg']; + } + } + loadCofigData() async { var data = await DioManager.instance.get(url: Api.getqiniuToken, params: {}); @@ -326,7 +345,7 @@ class Complete_materialLogic extends GetxController { return; } - if (state.wxEditingController.text.isNotEmpty) { + if (state.wxEditingController.text.isNotEmpty && userInfoBean!.wx_num != state.wxEditingController.text) { bool isPass = false; if (state.wxEditingController.text.length == 11) { RegExp exp = RegExp( @@ -341,8 +360,23 @@ class Complete_materialLogic extends GetxController { return; } } + + if (wxStatusInfo.containsKey('4000')) { + showOKToast(wxStatusInfo['40000']); + return; + } var result = await DioManager().post(url: Api.updateWxNum,params: {'type':2,'wxNum':state.wxEditingController.text}); + if (result['code'] == 31201) { + // showToast. + showOKToast(result['msg']); + showRechargeScreenDialog(); + return; + } else if (result['code'] == 200) { + if (wxStatusInfo.containsKey('32100')) { + showOKToast(wxStatusInfo['32100']); + } + } print(result); } //TODO 强制获取经纬度 @@ -367,6 +401,7 @@ class Complete_materialLogic extends GetxController { }); var bean = BaseResponse.fromJson(data, (data) => data); if (bean.code == 200) { + showOKToast('操作成功'); var mineFragment = Get.find(); mineFragment.avatar = headUrl; mineFragment.name = state.textEditingController.text; diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart index fdc002c..ceca43f 100644 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -1,8 +1,13 @@ import 'dart:convert'; import 'dart:math'; +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/common/colors/app_color.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_slidable_for_tencent_im/flutter_slidable.dart'; +import 'package:get/get.dart'; +import 'package:gradient_borders/gradient_borders.dart'; import 'package:provider/provider.dart'; import 'package:scroll_to_index/scroll_to_index.dart'; import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; @@ -19,7 +24,12 @@ import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; +import '../../../network/api.dart'; +import '../../../network/dio_manager.dart'; +import '../../../router/app_routers.dart'; import '../../../util/eventBus.dart'; +import '../../../util/util.dart'; +import '../../circle/widgets/discover.dart'; import 'tim_uikit_conversation_item.dart'; typedef TIMConversationItemBuilder = Widget Function( @@ -137,8 +147,6 @@ class ConversationItemSlidePanel extends TIMUIKitStatelessWidget { /// A label to display below the [icon]. final String? label; - - @override Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { return SlidableAction( @@ -161,16 +169,19 @@ class _TIMConversationState extends TIMUIKitState { // final TUIFriendShipViewModel friendShipViewModel = // serviceLocator(); bool hasMore = true; + List chatImIdList = []; + var recommendCircleFriendData = {}; + @override void initState() { super.initState(); - + loadRecommendCircleFriendData(); final controller = getController(); widget.scrollController!.addListener(() { - try { if (widget.scrollController!.position.pixels == - widget.scrollController!.position.maxScrollExtent && hasMore) { + widget.scrollController!.position.maxScrollExtent && + hasMore) { _timuiKitConversationController.loadData(); } } catch (_) {} @@ -418,28 +429,18 @@ class _TIMConversationState extends TIMUIKitState { future: getUserListInfo(userIdList), builder: (BuildContext context, AsyncSnapshot> snapshot) { - // if (snapshot.connectionState != ConnectionState.done || - // haveMoreData) { - // if (haveMoreData) { - // _timuiKitConversationController.loadData(); - // } - // - // return Container(); - // } - return ListView.builder( controller: widget.scrollController!, - shrinkWrap: true, - itemCount: filteredConversationList.length, + // shrinkWrap: true, + itemCount: recommendCircleFriendData.isNotEmpty && filteredConversationList.length < 15 + ? filteredConversationList.length + 1 + : filteredConversationList.length, itemBuilder: (context, index) { - // if (index == filteredConversationList.length - 1) { - // if (haveMoreData) { - // loaddingWidget(true); - // // _timuiKitConversationController.loadData(); - // } else { - // return Container(); - // } - // } + if (index == filteredConversationList.length) { + return recommendCircleFriendData.isNotEmpty + ? recommendCircleFriendWidget() + : Container(); + } final conversationItem = filteredConversationList[index]; @@ -488,9 +489,9 @@ class _TIMConversationState extends TIMUIKitState { if (userFullInfo!.customInfo! .containsKey('Label')) { - if (userFullInfo! - .customInfo!['Label'] - .toString().isNotEmpty) { + if (userFullInfo!.customInfo!['Label'] + .toString() + .isNotEmpty) { var otherInfo = jsonDecode(userFullInfo! .customInfo!['Label'] .toString()); @@ -614,23 +615,541 @@ class _TIMConversationState extends TIMUIKitState { }) : (widget.emptyBuilder != null ? widget.emptyBuilder!() - : Container()); + : recommendCircleFriendData.isNotEmpty + ? recommendCircleFriendWidget() + : Container()); } + // EasyRefresh( // header: CustomizeBallPulseHeader(color: theme.primaryColor), // onRefresh: () async { // model.refresh(); // }, // child: - return TUIKitScreenUtils.getDeviceWidget( + return TUIKitScreenUtils.getDeviceWidget( defaultWidget: SlidableAutoCloseBehavior( child: conversationList(), - - ), - + ), desktopWidget: Scrollbar( controller: widget.autoScrollController!, child: conversationList())); }); } + + recommendCircleFriendWidget() { + var info = {}; + + var user = Users.fromJson(recommendCircleFriendData['user']); + + // 对方喜欢了你100 + // ·你们有共同喜欢的圈友90 + // ·你喜欢的圈友也喜欢TA80 + // ·你们都在深圳留下过足迹70 + // ·你们有2个共同的圈子:圈子名称、圈子名称60 + // ·可能是你想认识的人50 + // ·很多圈友都喜欢TA40 + // ·TA是乐园优秀圈主哦~30 + + var titleList = []; + + if (recommendCircleFriendData['is_follow_me']) { + titleList.add('对方喜欢了你'); + } else if (recommendCircleFriendData['has_both_friend']) { + titleList.add('你们有共同喜欢的圈友'); + } else if (recommendCircleFriendData['has_friend_follow_to']) { + titleList.add('你喜欢的圈友也喜欢TA'); + } + if (titleList.length < 3) { + List citys = recommendCircleFriendData['both_cities']; + if (citys.isNotEmpty) { + titleList.add('你们都在${citys.first}留下过足迹'); + } + } + if (titleList.length < 3) { + List circles = recommendCircleFriendData['both_interests']; + if (circles.isNotEmpty) { + List both_interests = + recommendCircleFriendData['both_interests']; + List circleList = []; + both_interests.forEach((element) { + circleList.add(element['title']); + }); + if (circleList.isNotEmpty) { + titleList + .add('你们有${circleList.length}个共同的圈子:${circleList.join('、')}'); + } + } + } + if (titleList.length < 3) { + if (recommendCircleFriendData['is_wanna_meet']) { + titleList.add('很多圈友都喜欢TA'); + } + } + + if (titleList.length < 3) { + if (recommendCircleFriendData['is_most_fans']) { + titleList.add('可能是你想认识的人'); + } + } + + if (titleList.length < 3) { + if (recommendCircleFriendData['is_excellent_qz_leader']) { + titleList.add('TA是乐园优秀圈主哦~'); + } + } + + if (titleList.length >= 1) { + info['city'] = titleList.first; + } + + if (titleList.length >= 2) { + info['both_interests'] = titleList[1]; + } + + if (titleList.length >= 3) { + info['desc'] = titleList[2]; + } + + List circleList = recommendCircleFriendData['interests']; + + return Container( + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + child: Column(children: [ + Container( + margin: EdgeInsets.only(top: 20.sp), + child: Row( + children: [ + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), + Container( + width: 4.sp, + height: 4.sp, + margin: EdgeInsets.only(left: 15.sp, right: 15.sp), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white.withOpacity(0.5)), + ), + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 16.sp), + child: Row( + children: [ + Image.asset( + getMsgImage('heart_icon'), + width: 18.sp, + ), + SizedBox( + width: 4.sp, + ), + ShaderMask( + shaderCallback: (Rect bounds) { + return const LinearGradient( + begin: Alignment(0.0, -1.0), + end: Alignment.bottomCenter, + colors: [Color(0xff71F3F2), Color(0xffF657FF)], + ).createShader(Offset.zero & bounds.size); + }, + child: Text( + '圈友推荐', + style: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.white, + shadows: [ + Shadow( + color: Color(0xffF657FF), offset: Offset(0.0, -1)) + ]), + ), + ), + SizedBox( + width: 4.sp, + ), + Image.asset( + getMsgImage('heart_icon'), + width: 18.sp, + ), + Expanded(child: Container()), + InkWell( + onTap: () { + loadRecommendCircleFriendData(); + }, + child: Container( + child: Row( + children: [ + Icon( + Icons.refresh_sharp, + size: 18.sp, + color: AppColor.mainColor, + ), + SizedBox( + width: 4.sp, + ), + Text( + '换一位', + style: TextStyle( + color: AppColor.mainColor, fontSize: 15.sp), + ) + ], + ), + ), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 16.sp), + width: Get.width, + // constraints: BoxConstraints(maxHeight: 230.sp), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Color(0xFF4C3E5F), Color(0xFF324140)]), + borderRadius: BorderRadius.circular(8.sp), + border: GradientBoxBorder( + gradient: AppColor.mainVerLinearGradient, + width: 1.sp, + ), + ), + padding: EdgeInsets.only(left: 12.sp, right: 12.sp,top: 10.sp), + child: Column( + children: [ + GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity,arguments: user.userId.toString()); + }, + child: Container( + child: Row( + children: [ + ClipOval( + child: Image.network( + recommendCircleFriendData['user']['avatar'], + width: 50.sp, + height: 50.sp, + fit: BoxFit.cover, + ), + ), + SizedBox( + width: 6.sp, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + user.nickname ?? '', + style: TextStyle( + fontSize: 16.sp, + color: Color(0XFFF7FAFA), + fontWeight: FontWeight.bold), + ), + SizedBox(height: 4.sp,), + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: + EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(9.sp), + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + user!.gender ?? 0, + user!.age ?? 0, + user!.role ?? 0, + user!.orientation ?? 0), + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ), + if (user.vip! > 0) + Container( + margin: EdgeInsets.only( + left: 4.sp, + ), + child: Image.asset( + getCircleImage( + user.vip == 1 ? 'vip' : 'year_vip'), + width: 36.sp, + ), + ), + ], + ), + ], + )), + GestureDetector( + onTap: () async { + if (!chatImIdList.contains(user.userId.toString())) { + await createCustomMsg(user.userId.toString(), recommendCircleFriendData['user']['imId']); + } + + pushChatPage(user.userId.toString(), recommendCircleFriendData['user']['imId'], user.nickname!); + }, + child: Container( + height: 25.sp, + padding: EdgeInsets.only(left: 6.sp,right: 6.sp), + decoration: BoxDecoration( + gradient: AppColor.mainVerLinearGradient, + borderRadius: BorderRadius.circular(12.5.sp)), + alignment: Alignment.center, + child: Text( + '聊一聊', + style: + TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ), + ) + ], + ), + ), + ), + if (info.containsKey('desc')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + if (info.containsKey('city')) + info['city'].toString().isNotEmpty + ? Container( + margin: EdgeInsets.only(top: 10.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3.sp, + height: 3.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5.sp), + color: Color(0xFF00FFF4)), + ), + Expanded(child: Text( + info['city'], + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + )) + ], + ), + ) + : Container(), + if (info.containsKey('both_interests')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['both_interests'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + + Container( + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), + alignment: Alignment.centerLeft, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp, top: 10.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Text( + '交友宣言:' + + recommendCircleFriendData['user']['signature'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + maxLines: 2, + overflow: TextOverflow.ellipsis, + )), + ])), + Image.asset( + getCircleImage('line'), + width: Get.width, + fit: BoxFit.fill, + ), + + if (circleList.isNotEmpty) + Container( + height: 72.sp, + margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), + width: Get.width, + child: ListView.builder(itemBuilder: (context,index) { + return circleInfoItem(circleList[index], index); + },itemCount: circleList.length,scrollDirection: Axis.horizontal,), + ) + ], + ), + ), + ])); + } + + circleInfoItem(var bean, int index) { + return GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.Signal_circle_list, + arguments: bean['id'].toString()); + }, + child: Container( + margin: EdgeInsets.only(right: 10.sp), + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + height: 72.sp, + width: 140.sp, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(8.sp), + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 1.sp, + ), + ), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl: bean['image'], + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + fit: BoxFit.cover), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8.sp, ), + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + bean['title'], + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + height: 4.sp, + ), + Text( + // "view_total" -> 21 + '${convertToTenThousand(bean['viewTotal'])}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + )), + ], + ), + ), + ); + } + + void loadRecommendCircleFriendData() async { + var data = await DioManager.instance.get( + url: Api.chatRecommendFriend, + ); + + if (data['code'] == 200) { + recommendCircleFriendData = data['data'][0]; + setState(() {}); + } + } } diff --git a/circle_app/lib/app/msg/logic.dart b/circle_app/lib/app/msg/logic.dart index 5986dbc..b26b05e 100644 --- a/circle_app/lib/app/msg/logic.dart +++ b/circle_app/lib/app/msg/logic.dart @@ -19,12 +19,15 @@ class MsgLogic extends GetxController { int total = 0; + bool isStart = false; + @override void onInit() { // TODO: implement onInit super.onInit(); loadChatData(); loadLikeData(); + loadStatusData(); } loadLikeData() async { var data = @@ -65,9 +68,10 @@ class MsgLogic extends GetxController { .get(url: Api.startQuick); if (data["code"] == 200) { showOKToast("已开启速聊"); + isStart = true; loadChatData(); return true; - } else if (data["code"] == 10102) { + } else if (data["code"] == 31201) { showRechargeScreenDialog(); } } else if (data["data"] == 1) { @@ -84,6 +88,7 @@ class MsgLogic extends GetxController { await DioManager.getInstance().get(url: Api.stopQuick); if (data["code"] == 200) { showOKToast('操作成功'); + isStart = false; loadChatData(); } @@ -95,11 +100,9 @@ class MsgLogic extends GetxController { if (data["code"] == 200) { showOKToast("已成功召唤三十人,请耐心等待TA的回复哈~"); return true; - } else if(data["code"] == 10081){ - showOKToast(data["msg"]); + } else if (data["code"] == 31201) { showRechargeScreenDialog(); - - }else{ + } else{ showOKToast(data["msg"]); } return false; @@ -149,4 +152,17 @@ class MsgLogic extends GetxController { ), isScrollControlled: true); } + + void loadStatusData() async { + var data = + await DioManager.getInstance().get(url: Api.queryQuickStart); + if (data["code"] == 200) { + if (data["data"] == 0) { + isStart = false; + } else { + isStart = true; + } + } + update(); + } } diff --git a/circle_app/lib/app/msg/view.dart b/circle_app/lib/app/msg/view.dart index ebca571..b3b5795 100644 --- a/circle_app/lib/app/msg/view.dart +++ b/circle_app/lib/app/msg/view.dart @@ -67,34 +67,30 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.transparent, - body: Stack( - children: [ - SafeArea( - child: GetBuilder(builder: (MsgLogic controller) { - return Column( - children: [ - navigatorItem(controller), - tipWidget(), - reconmandWidget(), - // Text(controller.state.msg), - Expanded(child: TIMConversation( - autoScrollController: logic.scrollController, - scrollController: logic.listScrollController, - onTapItem: (selectedConv) async{ - String type = selectedConv.userID!.split('_')[2]; - if (int.parse(type) == 11) { - Get.toNamed(AppRoutes.Sys_notify_list, arguments: selectedConv); - return; - } - Get.toNamed(AppRoutes.Chat, arguments: selectedConv); + body: SafeArea( + child: GetBuilder(builder: (MsgLogic controller) { + return Column( + children: [ + navigatorItem(controller), + tipWidget(), + reconmandWidget(), + // Text(controller.state.msg), + Expanded(child: TIMConversation( + autoScrollController: logic.scrollController, + scrollController: logic.listScrollController, + onTapItem: (selectedConv) async{ + String type = selectedConv.userID!.split('_')[2]; + if (int.parse(type) == 11) { + Get.toNamed(AppRoutes.Sys_notify_list, arguments: selectedConv); + return; + } + Get.toNamed(AppRoutes.Chat, arguments: selectedConv); - }, - )) - ], - ); - }), - ) - ], + }, + )) + ], + ); + }), ), ); } @@ -314,7 +310,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { height: 4.sp, ), Text( - '抢占第一', + ctr.isStart ? '关闭速聊' : '开启速聊', style: TextStyle(color: Colors.white, fontSize: 12.sp), ), ], diff --git a/circle_app/lib/app/my_assets/view.dart b/circle_app/lib/app/my_assets/view.dart index 4a5eecb..0d14e31 100644 --- a/circle_app/lib/app/my_assets/view.dart +++ b/circle_app/lib/app/my_assets/view.dart @@ -107,47 +107,54 @@ class My_assetsPage extends StatelessWidget { ), Expanded( flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "收入金额", - style: TextStyle( - color: Colors.white, - fontSize: 13.sp), - ), - // if (Platform.isAndroid) - SizedBox(width: 4.sp), - // if (Platform.isAndroid) - GestureDetector( - onTap: () { - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - }, - child: Container( - height: 20.sp, - padding: EdgeInsets.only(left: 6.sp,right: 6.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor - .mainVerLinearGradient, - borderRadius: BorderRadius - .circular(10.sp) - ), - child: Text('联系客服', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp),), + child: Container( + padding: EdgeInsets.only(left: 10.sp,right: 10.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(right: 15.sp), + child: Text( + "收入金额", + style: TextStyle( + color: Colors.white, + fontSize: 13.sp), ), - ) - ], + ), + // if (Platform.isAndroid) + // SizedBox(width: 30.sp,), + // Expanded(child: Container()), + // if (Platform.isAndroid) + GestureDetector( + onTap: () { + var con; + if(kDebugMode){ + con = V2TimConversation( + conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); + }else{ + con = V2TimConversation( + conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); + } + Get.toNamed(AppRoutes.Chat, arguments: con); + }, + child: Container( + height: 20.sp, + padding: EdgeInsets.only(left: 6.sp,right: 6.sp), + alignment: Alignment.center, + decoration: BoxDecoration( + gradient: AppColor + .mainVerLinearGradient, + borderRadius: BorderRadius + .circular(10.sp) + ), + child: Text('联系客服', + style: TextStyle( + color: Colors.white, + fontSize: 14.sp),), + ), + ) + ], + ), ), ), ], @@ -209,16 +216,21 @@ class My_assetsPage extends StatelessWidget { "总充值", style: TextStyle( color: Colors.white, - fontSize: 12.sp), + fontSize: 14.sp), ), Text("${logic.myAssest!.totalRechargeBalance!}小票", style: TextStyle( color: Colors.white, - fontSize: 12.sp), + fontSize: 14.sp), ), ], ), ), + Container( + height: 15.sp, + width: 1.sp, + color:Color(0x4DFFFFFF), + ), Expanded( flex: 1, child: Column( @@ -228,17 +240,22 @@ class My_assetsPage extends StatelessWidget { "总收入", style: TextStyle( color: Colors.white, - fontSize: 12.sp), + fontSize: 14.sp), ), Text( "${logic.myAssest!.totalIncomeBalance!}小票", style: TextStyle( color: Colors.white, - fontSize: 12.sp), + fontSize: 14.sp), ), ], ), ), + Container( + height: 15.sp, + width: 1.sp, + color:Color(0x4DFFFFFF), + ), Expanded( flex: 1, child: Column( @@ -248,12 +265,12 @@ class My_assetsPage extends StatelessWidget { "总支出", style: TextStyle( color: Colors.white, - fontSize: 12.sp), + fontSize: 14.sp), ), Text("${logic.myAssest!.totalExpenseBalance!}小票", style: TextStyle( color: Colors.white, - fontSize: 12.sp), + fontSize: 14.sp), ), ], ), diff --git a/circle_app/lib/app/userinfo/logic.dart b/circle_app/lib/app/userinfo/logic.dart index 81549a1..23a851a 100644 --- a/circle_app/lib/app/userinfo/logic.dart +++ b/circle_app/lib/app/userinfo/logic.dart @@ -469,15 +469,18 @@ class UserBean { class Interest { int id; String title; + int viewTotal; Interest({ required this.id, required this.title, + required this.viewTotal, }); factory Interest.fromJson(Map json) { return Interest( id: json['id'], + viewTotal: json['viewTotal'] ?? 0, title: json['title'], ); } diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index 0993069..e3607f4 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -1,3 +1,5 @@ + + import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/app/userinfo/widgets/home_call_out.dart'; import 'package:circle_app/common/Widgets/base_tip_widget.dart'; @@ -12,6 +14,7 @@ import 'package:get/get.dart'; import '../../components/my_app_bar.dart'; import '../../router/app_routers.dart'; +import '../../util/eventBus.dart'; import '../../util/util.dart'; import '../select_circle/logic.dart'; import 'logic.dart'; @@ -31,9 +34,35 @@ class MyTabbedScreenState extends State ScrollController scrollController = ScrollController(); bool isShowBlackTitle = false; + bool isSetState = false; + var sub; @override void initState() { super.initState(); + sub = EventBusManager.on().listen((event) { + scrollController.animateTo(0, duration: Duration(microseconds: 200), curve: Curves.easeIn); + }); + scrollController.addListener(() { + if (scrollController.position.pixels == + scrollController.position.maxScrollExtent) { + print('2222'); + isSetState = true; + setState(() { + + }); + EventBusManager.fire(ScrollViewIsEnd(true)); + } else { + EventBusManager.fire(ScrollViewIsEnd(false)); + if (isSetState) { + setState(() { + + }); + isSetState = false; + } + + print('111'); + } + }); _pageController = PageController(); _tabController = TabController(length: 2, vsync: this); _tabController.animation!.addListener(_handleTabChange); @@ -50,24 +79,22 @@ class MyTabbedScreenState extends State routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); } - void didPopNext() { print('didPopNext'); if (logic.userId.isEmpty) { - logic.fetchUserInfo(Api.getUserInfo); + logic.fetchUserInfo(Api.getUserInfo); } } ///当前页面进入时触发 void didPush() { print('didPopNext'); - } + void didPop() { print('didPop'); } - void _handleTabChange() { // 在这里可以执行滑动监听后的逻辑操作 // 比如根据当前选中的标签执行其他操作 @@ -79,6 +106,7 @@ class MyTabbedScreenState extends State @override void dispose() { _tabController.dispose(); + sub.cancel(); routeObserver.unsubscribe(this); super.dispose(); } @@ -108,95 +136,159 @@ class MyTabbedScreenState extends State Scaffold( backgroundColor: Colors.transparent, appBar: MyAppBar( - centerTitle: logic.userInfoBean != null - ? "${logic.userInfoBean!.nickname}" - : "个人主页", - actionWdiget: logic.isMe ? GestureDetector( - onTap: () async{ - await showAddWxPicker(logic.userInfoBean!.wx_num!.isNotEmpty ?? false,isHidden: logic.userInfoBean!.wx_num!.isNotEmpty ?? false,isWxHidden:logic.userInfoBean!.hide_wx_num == 1,); - logic.fetchUserInfo(Api.getUserInfo); - }, - child:Stack( - alignment: Alignment.center, - children: [ - Container( - width: 101.sp, - height: 26.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.sp), - gradient: LinearGradient( - colors: [ Color(0xFF30FFD9),Color(0xFFDD3DF4)], - begin: Alignment.centerLeft, - end: Alignment.centerRight, + centerTitle: logic.userInfoBean != null + ? "${logic.userInfoBean!.nickname}" + : "个人主页", + actionWdiget: logic.isMe + ? GestureDetector( + onTap: () async { + await showAddWxPicker( + logic.userInfoBean!.wx_num!.isNotEmpty ?? false, + isHidden: + logic.userInfoBean!.wx_num!.isNotEmpty ?? false, + isWxHidden: logic.userInfoBean!.hide_wx_num == 1, + ); + logic.fetchUserInfo(Api.getUserInfo); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 101.sp, + height: 26.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.sp), + gradient: LinearGradient( + colors: [ + Color(0xFF30FFD9), + Color(0xFFDD3DF4) + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + ), + Container( + width: 100.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(11.sp), + color: Color(0xFF240F3B)), + alignment: Alignment.center, + height: 24.sp, + child: Text( + '填写微信号', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + ), + ) + ], ), - ), - ), - Container( - width: 100.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(11.sp), - color: Color(0xFF240F3B) - - ), - alignment: Alignment.center, - height: 24.sp, - child: Text( - '填写微信号', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ) - ], - ), - // Container( - // alignment: Alignment.center, - // // width: 90.sp, - // height: 24.sp, - // padding: - // EdgeInsets.only(left: 6.sp, right: 6.sp), - // decoration: BoxDecoration( - // color: AppColor.mainColor, - // borderRadius: - // BorderRadiusDirectional.circular( - // 11.sp)), - // child: Text( - // '填写微信号', - // style: TextStyle( - // color: Colors.white, fontSize: 13.sp), - // ), - // ), - ) : Container() - ), + // Container( + // alignment: Alignment.center, + // // width: 90.sp, + // height: 24.sp, + // padding: + // EdgeInsets.only(left: 6.sp, right: 6.sp), + // decoration: BoxDecoration( + // color: AppColor.mainColor, + // borderRadius: + // BorderRadiusDirectional.circular( + // 11.sp)), + // child: Text( + // '填写微信号', + // style: TextStyle( + // color: Colors.white, fontSize: 13.sp), + // ), + // ), + ) + : Container()), body: Stack( + // fit: StackFit.expand, children: [ Container( - child: buildContent(logic), - ), + height: Get.height, + width: Get.width, + // color: Colors.red, + child: + NestedScrollView( + controller: scrollController, + headerSliverBuilder: (context,isScrolled) { + return [ + SliverAppBar( + stretch: false, + elevation: 0, + primary: true, + pinned: true, + floating: true, + forceElevated: false, + toolbarHeight: 0, + foregroundColor: Colors.transparent, + backgroundColor: Colors.transparent, + expandedHeight: 372.sp + (logic.userInfoBean != null + ? logic.userInfoBean!.wx_num!.isNotEmpty + ? 59.sp : 0 : 0), + bottom: PreferredSize( + preferredSize: Size(Get.width,40), + child: titleTab(logic), + ), + flexibleSpace: FlexibleSpaceBar( + expandedTitleScale: 1.0, + centerTitle: true, + title: buildContent(logic), + ), + ) + ]; + }, + body: contentWidget(logic), + // slivers: [ + // SliverAppBar( + // leadingWidth: 0, + // titleSpacing: 0, + // title: buildContent(logic), + // toolbarHeight: 500.sp, + // backgroundColor: Colors.transparent, + // ), + // SliverPadding( + // padding: EdgeInsets.zero, + // sliver: SliverList(delegate: + // SliverChildBuilderDelegate((context, index) { + // // if (index == 0) { + // // return buildContent(logic); + // // } + // return contentWidget(logic); + // },childCount: 1),)) + // + // // (delegate: (BuildContext context, int index) { + // // return contentWidget(logic); + // // }), + // + // // buildContent(logic), + // ] + )), Positioned( bottom: 27.sp, width: Get.width, child: _meInfoButton(logic), ), - !logic.isShowAlbum &&logic.isMe ? Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { + !logic.isShowAlbum && logic.isMe + ? Positioned( + bottom: 36.sp, + right: 10.sp, + child: GestureDetector( + onTap: () async { + List numbers = []; - List numbers = []; - - var data = await Get.toNamed( - AppRoutes.Call_out, - arguments: {'numbers': numbers}); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 60.sp, - ))):Container() + var data = await Get.toNamed(AppRoutes.Call_out, + arguments: {'numbers': numbers}); + }, + child: Image.asset( + getCircleImage('send_msg'), + width: 60.sp, + ))) + : Container() ], ), ), - ], ), ); @@ -342,11 +434,15 @@ class MyTabbedScreenState extends State final interests = userInfoBean?.interests ?? []; return Container( + // color: Colors.red, + width: Get.width, + // height: Get.height, padding: EdgeInsets.symmetric(vertical: 14.sp), child: Column( children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 19.sp), + height: 58.sp, + padding: EdgeInsets.symmetric(horizontal: 15.sp), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -359,7 +455,7 @@ class MyTabbedScreenState extends State ), Container( padding: EdgeInsets.symmetric( - horizontal: 19.sp, + horizontal: 15.sp, ), margin: EdgeInsets.only(top: 19.sp), child: Row( @@ -369,7 +465,7 @@ class MyTabbedScreenState extends State children: [ Text( userInfoBean?.nickname ?? "", - style: TextStyle( + style: TextStyle( color: Color.fromRGBO(247, 250, 250, 1.0), fontSize: 14.sp, ), @@ -410,35 +506,42 @@ class MyTabbedScreenState extends State ), ), SizedBox( - height: 59.sp, + height: 78.sp, child: logic.isBlack || logic.isDestroy || logic.isBlackBeen ? Container() : _buildInterestsListView(interests), ), - if (!logic.isMe) - logic.userInfoBean != null ? logic.userInfoBean!.wx_num!.isNotEmpty ? Container( - alignment: Alignment.centerLeft, - // width: 200.sp, - // color: Colors.red, - margin: EdgeInsets.only(left: 20.sp,bottom: 15.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - wxStatusWidget(logic.unLockWxNum == 1,logic.userInfoBean!.wx_num, logic.userInfoBean!.id.toString(),logic.userInfoBean!.avatar!, (){}), - ], - )) : Container() : Container(), - + logic.userInfoBean != null + ? logic.userInfoBean!.wx_num!.isNotEmpty + ? Container( + alignment: Alignment.centerLeft, + // width: 200.sp, + // color: Colors.red, + margin: EdgeInsets.only(left: 15.sp, bottom: 15.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + wxStatusWidget( + logic.unLockWxNum == 1, + logic.userInfoBean!.wx_num, + logic.userInfoBean!.id.toString(), + logic.userInfoBean!.avatar!, + () {}), + ], + )) + : Container() + : Container(), if (logic.userInfoBean != null && logic.giftList.isNotEmpty) GestureDetector( onTap: () async { - var result = await Get.toNamed(AppRoutes.GiftShopPage, - arguments: logic.imId.split('_').last); + arguments: logic.userId); logic.loadGiftListData(); }, child: Container( - margin: EdgeInsets.only(top: 0.sp,left: 15.sp,right: 15.sp), + margin: EdgeInsets.only( + top: 0.sp, left: 15.sp, right: 10.sp, bottom: 10.sp), padding: EdgeInsets.only( left: 12.sp, right: 12.sp, bottom: 18.sp, top: 16.sp), height: 144.sp, @@ -486,107 +589,125 @@ class MyTabbedScreenState extends State ), Expanded( child: Container( - margin: EdgeInsets.only(top: 10.sp), - alignment: Alignment.centerLeft, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: logic.giftList.length, - itemBuilder: (BuildContext context, int giftIndex) { - var info = logic.giftList[giftIndex]; - bool isGet = false; - int num = 0; - logic.recevigiftList.forEach((element) { - if (element['giftId'] == info['id']) { - isGet = true; - num = element['num']; - } - }); - return GestureDetector( - onTap: () {}, - child: Container( - margin: EdgeInsets.only(right: 10.sp), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Stack(children: [ - Opacity( - opacity: !isGet ? 0.5 : 1, - child: Image.network( - info['icon'], - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - ]), - SizedBox( - height: 6.sp, + margin: EdgeInsets.only(top: 10.sp), + alignment: Alignment.centerLeft, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: logic.giftList.length, + itemBuilder: (BuildContext context, int giftIndex) { + var info = logic.giftList[giftIndex]; + bool isGet = false; + int num = 0; + logic.recevigiftList.forEach((element) { + if (element['giftId'] == info['id']) { + isGet = true; + num = element['num']; + } + }); + return GestureDetector( + onTap: () {}, + child: Container( + margin: EdgeInsets.only(right: 10.sp), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Stack(children: [ + Opacity( + opacity: !isGet ? 0.5 : 1, + child: Image.network( + info['icon'], + width: 50.sp, + height: 50.sp, + fit: BoxFit.cover, ), - GestureDetector( - onTap: () { - logic.sendGiftData( - logic.imId, - info['id'].toString(), - logic.imId.split('_').last, - ); - }, - child: Container( - height: 20.sp, - width: 52.sp, - // padding: EdgeInsets.only(left: 5.sp,right: 5.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor - .mainVerLinearGradient, - borderRadius: - BorderRadius.circular(10.sp)), - child: Text( - !isGet ? '点亮' : '赠送', - style: TextStyle( - color: Colors.white, - fontSize: 11.sp), - ), - ), - ) - ], + ), + ]), + SizedBox( + height: 6.sp, ), - ), - ); - }), - )) + GestureDetector( + onTap: () { + logic.sendGiftData( + logic.imId, + info['id'].toString(), + logic.imId.split('_').last, + ); + }, + child: Container( + height: 20.sp, + width: 52.sp, + // padding: EdgeInsets.only(left: 5.sp,right: 5.sp), + alignment: Alignment.center, + decoration: BoxDecoration( + gradient: + AppColor.mainVerLinearGradient, + borderRadius: + BorderRadius.circular(10.sp)), + child: Text( + !isGet ? '点亮' : '赠送', + style: TextStyle( + color: Colors.white, + fontSize: 11.sp), + ), + ), + ) + ], + ), + ), + ); + }), + )) ], ), ), ), - - titleTab(controller), - - Expanded( - child: PageView( - controller: _pageController, - onPageChanged: (index) { - _tabController.animateTo(index); - }, - children: [ - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : _imageAdapter(controller), - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : HomeCallOutView(controller.userId), - ], - ), - ), + // titleTab(controller), ], ), ); + + // Expanded( + // child: PageView( + // controller: _pageController, + // onPageChanged: (index) { + // _tabController.animateTo(index); + // }, + // children: [ + // logic.isBlack || logic.isDestroy || logic.isBlackBeen + // ? Container() + // : _imageAdapter(controller), + // logic.isBlack || logic.isDestroy || logic.isBlackBeen + // ? Container() + // : HomeCallOutView(controller.userId), + // ], + // ), + // ), + } + + contentWidget(UserinfoLogic controller) { + return TabBarView( + controller: _tabController, + // controller: _pageController, + // onPageChanged: (index) { + // _tabController.animateTo(index); + // }, + children: [ + logic.isBlack || logic.isDestroy || logic.isBlackBeen + ? Container() + : _imageAdapter(controller), + logic.isBlack || logic.isDestroy || logic.isBlackBeen + ? Container() + : HomeCallOutView(controller.userId), + ], + + ); } Widget _buildInterestsListView(List interests) { return ListView.builder( itemCount: interests.length, scrollDirection: Axis.horizontal, - padding: EdgeInsets.symmetric(vertical: 18.sp, horizontal: 19.sp), + padding: EdgeInsets.symmetric(vertical: 15.sp, horizontal: 15.sp), itemBuilder: (context, index) { final interest = interests[index]; return GestureDetector( @@ -597,7 +718,7 @@ class MyTabbedScreenState extends State child: Container( margin: EdgeInsets.only(right: 11.sp), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), + borderRadius: BorderRadius.circular(8.0), gradient: const LinearGradient( colors: [ Color(0xFF06F9FA), @@ -607,29 +728,48 @@ class MyTabbedScreenState extends State color: const Color(0xFF392D53), ), child: Container( - margin: EdgeInsets.all(0.2.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, + margin: EdgeInsets.all(0.2.sp), + padding: EdgeInsets.only(left: 5.sp, right: 0.sp, top: 5.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + color: const Color(0xFF392D53), ), - child: Center( - child: Text( - interest.title, - style: const TextStyle( - fontSize: 11.0, - color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + // color: Colors.red, + child: Row( + children: [ + Text( + interest.title, + style: TextStyle( + fontSize: 13.sp, + color: Colors.white, + ), + ), + Container( + margin: EdgeInsets.only( + bottom: 2.sp, + ), + child: Icon( + Icons.keyboard_arrow_right, + color: Colors.white, + size: 18.sp, + ), + ) + ], + ), ), - ), - ), - ), - ), + Text( + '${interest.viewTotal}人看过', + style: TextStyle( + fontSize: 13.sp, + color: AppColor.mainColor, + ), + ), + ], + )), ), ); }, @@ -650,7 +790,7 @@ class MyTabbedScreenState extends State } return Container( alignment: Alignment.centerLeft, - padding: EdgeInsets.symmetric(horizontal: 10.sp), + padding: EdgeInsets.only(left: 0, right: 10.sp), height: 27.sp, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -663,7 +803,7 @@ class MyTabbedScreenState extends State color: const Color(0xFF00FFF4), width: 2.sp, ), - insets: EdgeInsets.symmetric(horizontal: 6.0.sp), + insets: EdgeInsets.symmetric(horizontal: 12.0.sp), borderRadius: BorderRadius.circular(18.0), ), indicatorColor: const Color(0xFF00FFF4), @@ -677,57 +817,62 @@ class MyTabbedScreenState extends State ), Tab(text: "喊话"), ], - onTap: (index) { - _pageController.animateToPage( - index, // 目标页面索引 - duration: const Duration(milliseconds: 300), // 动画时长 - curve: Curves.ease, // 动画曲线 - ); - }, + // onTap: (index) { + // _pageController.animateToPage( + // index, // 目标页面索引 + // duration: const Duration(milliseconds: 300), // 动画时长 + // curve: Curves.ease, // 动画曲线 + // ); + // }, ), - logic.isBlack||logic.isDestroy||logic.isBlackBeen?Container(): _tabController.index == 0 ? GestureDetector( - onTap: () { - if(!logic.isShowAlbum&&controller.isMe){ - List numbers = []; - var data = Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers}); - return ; - } - if (controller.isMe) { - controller.isEdit = !controller.isEdit; - controller.update(); - } else { - controller.urgeChange(); - } - }, - child: Visibility( - // visible: logic.isShowAlbum, - child: Container( - margin: EdgeInsets.only(left: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.symmetric( - vertical: 2.sp, - horizontal: 12.sp, - ), - child: Text( - buttonText, - style: const TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - ) : Container(), + logic.isBlack || logic.isDestroy || logic.isBlackBeen + ? Container() + : _tabController.index == 0 + ? GestureDetector( + onTap: () { + if (!logic.isShowAlbum && controller.isMe) { + List numbers = []; + var data = Get.toNamed(AppRoutes.Call_out, + arguments: {'numbers': numbers}); + return; + } + if (controller.isMe) { + controller.isEdit = !controller.isEdit; + controller.update(); + } else { + controller.urgeChange(); + } + }, + child: Visibility( + // visible: logic.isShowAlbum, + child: Container( + margin: EdgeInsets.only(left: 10.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.symmetric( + vertical: 2.sp, + horizontal: 12.sp, + ), + child: Text( + buttonText, + style: const TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ), + ) + : Container(), ], ), ); @@ -738,6 +883,7 @@ class MyTabbedScreenState extends State // : return Container( + margin: EdgeInsets.only(top: isSetState ? 40.sp : 0.sp), padding: EdgeInsets.symmetric(horizontal: 19.sp), child: Stack( children: [ @@ -757,7 +903,7 @@ class MyTabbedScreenState extends State mainAxisAlignment: MainAxisAlignment.start, children: [ const SizedBox( - height: 100, + height: 30, ), Image.asset( getBaseImage('no_result'), @@ -784,20 +930,20 @@ class MyTabbedScreenState extends State crossAxisCount: 3, ), itemCount: controller.isMe - // ? controller.isEdit - // ? controller.state.imaglist.length < 15 - // ? controller.state.imaglist.length - ? controller.state.imaglist.length+1 - : controller.state.imaglist.length , + // ? controller.isEdit + // ? controller.state.imaglist.length < 15 + // ? controller.state.imaglist.length + ? controller.state.imaglist.length + 1 + : controller.state.imaglist.length, itemBuilder: (BuildContext context, int index) { - // print("123123123123"); - if (controller.isMe ) { + // print("123123123123"); + if (controller.isMe) { if (index == 0) { return GestureDetector( onTap: () { - if(controller.state.imaglist.length >= 15){ + if (controller.state.imaglist.length >= 15) { showOKToast("最大只可上传15张图片哦~"); - return ; + return; } controller.getImageFile(); }, @@ -902,7 +1048,7 @@ class MyTabbedScreenState extends State ? controller.userInfoBean!.signature : "", maxLines: 2, - style: const TextStyle(color: Colors.white), + style: TextStyle(color: Colors.white,fontSize: 15.sp), overflow: TextOverflow.ellipsis, ), ), @@ -1377,3 +1523,12 @@ class MyTabbedScreenState extends State ); } } + + +class ScrollViewIsEnd { + bool isEnd; + ScrollViewIsEnd(this.isEnd); +} + +class ScrollViewScrollTop { +} \ No newline at end of file diff --git a/circle_app/lib/app/userinfo/widgets/home_call_out.dart b/circle_app/lib/app/userinfo/widgets/home_call_out.dart index d3998c2..6850b55 100644 --- a/circle_app/lib/app/userinfo/widgets/home_call_out.dart +++ b/circle_app/lib/app/userinfo/widgets/home_call_out.dart @@ -3,6 +3,7 @@ import 'package:circle_app/app/circle/state.dart'; import 'package:circle_app/app/circle/widgets/video_item.dart'; import 'package:circle_app/app/userinfo/widgets/home_call_out_logic.dart'; import 'package:circle_app/router/app_routers.dart'; +import 'package:circle_app/util/eventBus.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -11,6 +12,8 @@ import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get.dart'; +import '../view.dart'; + class HomeCallOutView extends StatefulWidget { // Get.lazyPut(() => ListLogic()); @@ -27,19 +30,46 @@ class _HomeCallOutViewState extends State with AutomaticKeepAli bool get wantKeepAlive => true; HomeCallOutLogic? listsLg; + bool isEnd = false; + var sub; @override void initState() { // TODO: implement initState super.initState(); + + sub = EventBusManager.on().listen((event) { + if (event.isEnd) { + isEnd = true; + setState(() { + + }); + } else { + isEnd = false; + setState(() { + + }); + } + }); Get.lazyPut(() => HomeCallOutLogic()); listsLg = Get.find(); listsLg?.loadCallOutListData(widget.userId); + + listsLg!.scrollController.addListener(() { + if (listsLg!.scrollController.offset < 0) { + EventBusManager.fire(ScrollViewScrollTop()); + isEnd = false; + setState(() { + + }); + } + }); } @override void dispose() { // TODO: implement dispose super.dispose(); + sub.cancel(); listsLg?.onClose(); } @@ -48,61 +78,46 @@ class _HomeCallOutViewState extends State with AutomaticKeepAli return GetBuilder( assignId: true, builder: (listLogic) { - return ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: listLogic.lists.isEmpty?Center( - child: Image.asset( - getBaseImage('no_result'), - width: 200, - // height: 11, - ), - ): Container( - width: Get.width, - child: Stack( - children: [ - Container( - height: Get.height, - width: Get.width, - margin: EdgeInsets.only( - // bottom: MediaQuery.of(context).padding.bottom + 56.sp, - left: 19.sp, - right: 19.sp), - child: RefreshIndicator( - onRefresh: () async { - listLogic.refreshData(); - }, - child: listLogic.lists.isEmpty - ? loaddingWidget(true) - : ListView.builder( - padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + 56.sp), - physics: const AlwaysScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - controller: listLogic.scrollController, - itemCount: listLogic.lists.length + 1, - itemBuilder: (context, index) { - if (listLogic.lists.length > index) { - Lists lists = listLogic.lists[index]; - if (lists.isQueen!) { - return vipDynamicItem(lists); - } else { - return normalDynamicItem(lists); - } - } else { - return Container( - margin: EdgeInsets.only( - top: listLogic.callOutMore - ? 0 - : 10.sp), - child: - loaddingWidget(listLogic.callOutMore), - ); - } - }), - ), - ), - ], - ))); + return listLogic.lists.isEmpty?Center( + child: Image.asset( + getBaseImage('no_result'), + width: 200, + // height: 11, + ), + ): Container( + width: Get.width, + margin: EdgeInsets.only(top: isEnd ? 40.sp : 0.sp), + child: listLogic.lists.isEmpty + ? loaddingWidget(true) + : ListView.builder( + // physics: const AlwaysScrollableScrollPhysics(), + physics: isEnd ? AlwaysScrollableScrollPhysics() : NeverScrollableScrollPhysics(), + // shrinkWrap:true, + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom + 56.sp), + + scrollDirection: Axis.vertical, + controller: listLogic.scrollController, + itemCount: listLogic.lists.length + 1, + itemBuilder: (context, index) { + if (listLogic.lists.length > index) { + Lists lists = listLogic.lists[index]; + if (lists.isQueen!) { + return vipDynamicItem(lists); + } else { + return normalDynamicItem(lists); + } + } else { + return Container( + margin: EdgeInsets.only( + top: listLogic.callOutMore + ? 0 + : 10.sp), + child: + loaddingWidget(listLogic.callOutMore), + ); + } + })); }, ); } diff --git a/circle_app/lib/common/Widgets/RechargeScreenDialog.dart b/circle_app/lib/common/Widgets/RechargeScreenDialog.dart index fd8684d..94bbc5a 100644 --- a/circle_app/lib/common/Widgets/RechargeScreenDialog.dart +++ b/circle_app/lib/common/Widgets/RechargeScreenDialog.dart @@ -62,7 +62,7 @@ class _RechargeScreenDialogState extends State { response.forEach((element) { AssetsDataDataPriceConfs item = AssetsDataDataPriceConfs.fromJson(element); - if (walletRechargeSelectItemBos.isEmpty) { + if (walletRechargeSelectItemBos.length == 1) { item.isSelected = true; } walletRechargeSelectItemBos.add(item); @@ -324,7 +324,7 @@ class _RechargeScreenDialogState extends State { ), GestureDetector( onTap: () { - // navigateToPriceAgreement(); + navigateToItem(); }, child: Text( '《小票充值协议》', diff --git a/circle_app/lib/common/Widgets/circle_share.dart b/circle_app/lib/common/Widgets/circle_share.dart index ad5e000..17d432d 100644 --- a/circle_app/lib/common/Widgets/circle_share.dart +++ b/circle_app/lib/common/Widgets/circle_share.dart @@ -311,7 +311,8 @@ class _CircleShareState extends State { var info = lists[index]; return GestureDetector( onTap: () { - sendCircleCustomMsg( 'qpqz_dev_0_'+ info.user.id.toString(), jsonEncode(widget.bean.toJson()), '分享[${widget.bean.title}]'); + sendCircleCustomMsg(info.user.imId, + jsonEncode(widget.bean.toJson()), '分享[${widget.bean.title}]'); }, behavior: HitTestBehavior.opaque, child: Container( diff --git a/circle_app/lib/common/const.dart b/circle_app/lib/common/const.dart index db4224a..5d555d4 100644 --- a/circle_app/lib/common/const.dart +++ b/circle_app/lib/common/const.dart @@ -41,7 +41,7 @@ wxStatusWidget(bool isUnclock, String wx, String userId, String avatarUrl, }, child: Container( height: 42.sp, - width: (isUnclock ? 60.sp : 100.sp) + textWidth, + width: (isUnclock ? 60.sp : 102.sp) + textWidth, decoration: BoxDecoration( gradient: const LinearGradient( colors: [ diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index ce62e9f..42255d3 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -12,6 +12,7 @@ class Api { // 登录 static const login = 'user-service/login/smscode'; + // 登录 static const new_login = 'user-service/login/password'; @@ -20,7 +21,6 @@ class Api { static const getqiniuToken = 'up-service/oss/token'; - //上传个人资料 static const UpdataUserInfo = 'user-service/register/user/info'; @@ -37,39 +37,26 @@ class Api { static const queryUnlockPrice = '/mall-service/wxNum/unlock/queryUnlockPrice'; - - //支付宝支付 static const postAliPayOrder = 'mall-service/alipay/order'; - - //微信支付 static const postWxOrder = 'mall-service/wxpay/order'; - - //vip状态 static const getVipStatus = 'mall-service/my/vip'; - - - - //刷新token static const refreshToken = 'user-service/login/token/refresh'; - //圈子列表 static const getCircleInterests = 'up-service/interest/interests'; - - //版本信息 static const APP_VERSION = 'user-service/app/version'; @@ -81,15 +68,14 @@ class Api { static const SendShout = 'up-service/callout'; - //mine 基本信息 static const getUserMine = 'user-service/my/main'; - //发消息是否需要vip弹窗 - static const getIsVips = 'mall-service/vips/show/'; + //发消息是否需要vip弹窗 + static const getIsVips = 'mall-service/vips/show/'; - //IM状态 + //IM状态 static const imstate = '/user-service/user/im/state'; @@ -125,8 +111,6 @@ class Api { static const blackList = 'user-service/blacklist/users'; - - //我的相册 static const getMyAlbum = 'up-service/my/albums'; @@ -139,31 +123,22 @@ class Api { static const updataAlbum = 'up-service/album'; - //删除相册照片 static const deleteAlbum = 'up-service/album/'; - //催更Ta的相册 static const urgeAlbum = 'up-service/user/'; - //获取催更状态 static const getUrgeStatus = 'up-service/user/'; - - - - //关注列表 static const followList = 'user-service/follow/users'; - - //被关注列表 static const fansList = 'user-service/fans/users'; @@ -172,76 +147,34 @@ class Api { static const visitList = 'user-service/visit/users'; - //举报 static const postReport = 'up-service/report'; - - - - - - //意见反馈 static const getFeedBack = 'up-service/feedback'; - //意见反馈列表 static const getFeedBackList = 'up-service/my/feedbacks'; - - // //圈子访客记录 // static const getInterestList = 'up-service/interest/20/users'; - - - //猜你想问 static const getQuestions = 'up-service/guide/feedback/questions'; - - - - //附近banner static const getNearbyBeanner = 'user-service/nearby/banner'; - - //附近列表 static const postNearbyList = 'user-service/nearby/queryNearByUserList'; - - - - - - - - - - - - - - - - - - - - - - - //获取IM配置信息 static const getIMInfo = 'msg-service/im/token'; @@ -252,10 +185,13 @@ class Api { // /up-service/my/interests /up-service/interest/statistics static const getMyCircleInterests = 'up-service/my/interests'; + //我的所有圈子 static const getMyCircleAll = '/up-service/my/interests/all'; + //缘分匹配 static const getMatch = 'msg-service/im/chat/match'; + //系统通知 static const getNotices = 'msg-service/system/notices'; @@ -307,13 +243,16 @@ class Api { //是否置顶圈子 static const circleTop = '/up-service/interest/top'; + //是否隐藏微信号 static const hideWxNum = '/user-service/hideWxNum/'; //是否显示好评反馈 static const showPositiveFeedBack = '/up-service/showPositiveFeedBack'; + //钱包充值选项查询 static const walletRechargeSelectItem = '/mall-service/wallet/walletRechargeConfig'; + //用户资产 static const userAsset = '/mall-service/wallet/userAsset'; @@ -327,7 +266,7 @@ class Api { //礼物列表 static const giftList = '/mall-service/gift/giftMall'; - //礼物馆 + //礼物墙 static const giftHall = '/mall-service/gift/giftHall/'; //速聊推荐 @@ -352,4 +291,15 @@ class Api { //获取一条招呼语 static const msgRandOne = '/msg-service/message/hello_word/randOne'; + + //检查更新微信权限 + static const checkWxNumState = '/user-service/user/updateWxNum/state'; + + //保存聊天记录 + static const chatRecord = '/msg-service/message/chat/log/save'; + + //聊天推荐圈友 + static const chatRecommendFriend = '/msg-service/im/chat/recommend'; + //是否显示送礼物 + static const isShow_give_gift = '/msg-service/message/show_give_gift/'; } \ No newline at end of file diff --git a/circle_app/lib/network/dio_manager.dart b/circle_app/lib/network/dio_manager.dart index ce87c0f..ccd9ca7 100644 --- a/circle_app/lib/network/dio_manager.dart +++ b/circle_app/lib/network/dio_manager.dart @@ -233,7 +233,6 @@ class DioManager { pushLoginPage(); } else { switch (responseMap["code"]) { - case 4000: case 4001: case 4002: case 4003: @@ -247,7 +246,7 @@ class DioManager { pushLoginPage(); break; } - if (responseMap["code"] != 200 && responseMap["code"] != 10000) { + if (responseMap["code"] != 200 && responseMap["code"] != 10000 && !url.contains(Api.checkWxNumState)) { showOKToast(responseMap['msg']); } } diff --git a/circle_app/lib/util/eventBus.dart b/circle_app/lib/util/eventBus.dart index 5a76b4d..e56cbea 100644 --- a/circle_app/lib/util/eventBus.dart +++ b/circle_app/lib/util/eventBus.dart @@ -56,7 +56,13 @@ class CommentBlackMoreEvent { class CallRefreshCircle { String circleId = ""; - CallRefreshCircle(String id); + CallRefreshCircle(this.circleId); +} + +class CircleInfoRefresh { + String circleId = ""; + + CircleInfoRefresh(this.circleId); } class ScrollToTop { diff --git a/circle_app/lib/util/paymentUtil.dart b/circle_app/lib/util/paymentUtil.dart index e26539d..c395854 100644 --- a/circle_app/lib/util/paymentUtil.dart +++ b/circle_app/lib/util/paymentUtil.dart @@ -115,6 +115,7 @@ class IOSPayment { } logic.update(); } + EventBusManager.fire(CircleInfoRefresh(typeId)); } else if (type == 2) { if (target_id.isNotEmpty) { showOKToast('赠送会员成功'); diff --git a/circle_app/lib/util/util.dart b/circle_app/lib/util/util.dart index b089b07..b828696 100644 --- a/circle_app/lib/util/util.dart +++ b/circle_app/lib/util/util.dart @@ -411,6 +411,14 @@ void navigateToPartnerAgreement() { }); } +//小票充值协议 +void navigateToItem() { + Get.toNamed(AppRoutes.WebViewActivity, arguments: { + 'title': "小票充值协议", + "url":'https://www.iquanpai.com/app-h5/4_173.html' + }); +} + //邀请攻略 void navigateToInviteStrategy() { Get.toNamed(AppRoutes.WebViewActivity, arguments: { @@ -515,6 +523,20 @@ createCustomMsg(String userId, String imId) async { String cityStr = ''; Map info = {}; + + // 对方喜欢了你100 + // ·你们有共同喜欢的圈友90 + // ·你喜欢的圈友也喜欢TA80 + // ·你们都在深圳留下过足迹70 + // ·你们有2个共同的圈子:圈子名称、圈子名称60 + // ·可能是你想认识的人50 + // ·很多圈友都喜欢TA40 + // ·TA是乐园优秀圈主哦~30 + + var titleList = []; + + var recommendCircleFriendData = data['data']; + if (data['data']['both_interests'] != null) { List both_interests = data['data']['both_interests']; List circleList = []; @@ -543,8 +565,8 @@ createCustomMsg(String userId, String imId) async { if (data['data']['both_cities'] != null) { info['city'] = cityStr; } + info['title'] = recommendCircleFriendData; info['interests'] = data['data']['interests'] ?? []; - info['guide_text'] = data['data']['guide_text'] ?? ''; info['my'] = data['data']['my'] ?? ''; info['myInterests'] = data['data']['myInterests'] ?? []; info['user'] = data['data']['user']; @@ -649,8 +671,17 @@ sendCircleCustomMsg(String userId, String data, String desc) async { ); if (createCustomMessageRes.code == 0) { String? id = createCustomMessageRes.data?.id; - // 发送自定义消息 - EventBusManager.fire(SendCoustomMessage(createCustomMessageRes)); + V2TimValueCallback sendMessageRes = await TencentImSDKPlugin + .v2TIMManager + .getMessageManager() + .sendMessage(id: id!, receiver: userId, groupID: ''); + if (sendMessageRes.code == 0) { + // 发送成功 + showOKToast('发送成功'); + sendMessageRes.data?.customElem?.data; //自定义data + sendMessageRes.data?.customElem?.desc; //自定义desc + sendMessageRes.data?.customElem?.extension; //自定义extension + } } }