diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index 88eafad..e3cf78c 100644 --- a/circle_app/android/app/build.gradle +++ b/circle_app/android/app/build.gradle @@ -71,8 +71,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion - versionCode 22 - versionName "1.3.0" + versionCode 25 + versionName "1.3.2" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", diff --git a/circle_app/assets/images/home/icon_vip_more.png b/circle_app/assets/images/home/icon_vip_more.png index f4dbb71..c208d0f 100644 Binary files a/circle_app/assets/images/home/icon_vip_more.png and b/circle_app/assets/images/home/icon_vip_more.png differ diff --git a/circle_app/assets/images/home/mine_vip_icon.png b/circle_app/assets/images/home/mine_vip_icon.png new file mode 100644 index 0000000..8fb2b57 Binary files /dev/null and b/circle_app/assets/images/home/mine_vip_icon.png differ diff --git a/circle_app/assets/images/home/open_vip.png b/circle_app/assets/images/home/open_vip.png new file mode 100644 index 0000000..a70b4e6 Binary files /dev/null and b/circle_app/assets/images/home/open_vip.png differ diff --git a/circle_app/assets/images/home/pay_vip.png b/circle_app/assets/images/home/pay_vip.png new file mode 100644 index 0000000..e8f977d Binary files /dev/null and b/circle_app/assets/images/home/pay_vip.png differ diff --git a/circle_app/lib/app/account/view.dart b/circle_app/lib/app/account/view.dart index 9d01c24..bfc4d8f 100644 --- a/circle_app/lib/app/account/view.dart +++ b/circle_app/lib/app/account/view.dart @@ -313,7 +313,7 @@ class AccountPage extends StatelessWidget { }); } - Future getAuthorization() async { - pushLoginPage(); + getAuthorization() async { + await pushLoginPage(); } } diff --git a/circle_app/lib/app/call_out/logic.dart b/circle_app/lib/app/call_out/logic.dart index 8306218..59b39df 100644 --- a/circle_app/lib/app/call_out/logic.dart +++ b/circle_app/lib/app/call_out/logic.dart @@ -9,6 +9,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart'; +import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; import 'package:video_player/video_player.dart'; import 'package:video_thumbnail/video_thumbnail.dart'; @@ -42,6 +44,8 @@ class Call_outLogic extends GetxController { bool isZfbPrice = true; + final TUISettingModel settingModel = serviceLocator(); + @override void onClose() { super.onClose(); diff --git a/circle_app/lib/app/call_out/view.dart b/circle_app/lib/app/call_out/view.dart index 647eddb..8fa7f56 100644 --- a/circle_app/lib/app/call_out/view.dart +++ b/circle_app/lib/app/call_out/view.dart @@ -8,226 +8,325 @@ import 'package:video_player/video_player.dart'; import '../../router/app_routers.dart'; import 'logic.dart'; -class Call_outPage extends StatelessWidget { +class Call_outPage extends StatefulWidget { Call_outPage({Key? key}) : super(key: key); + @override + State createState() => _Call_outPageState(); +} + +class _Call_outPageState extends State { final logic = Get.find(); + final state = Get.find().state; + bool isShowKeyboard = false; + @override Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { + return GetBuilder(builder: (controller) { + var keyboardSize = MediaQuery.of(context).viewInsets.bottom; + return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getBaseImage('home_back')))), - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: '圈内喊话', - actionWdiget: Image.asset( - getCircleImage('push'), - width: 54.sp, + onTap: () { + FocusManager.instance.primaryFocus?.unfocus(); + }, + child: Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage(getBaseImage('home_back')))), + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.transparent, + appBar: MyAppBar( + centerTitle: '圈内喊话', + actionWdiget: Image.asset( + getCircleImage('push'), + width: 54.sp, + ), + onPressed: () { + logic.sendShout(); + }, ), - onPressed: () { - // - //showToast('111'); - logic.sendShout(); - }, - ), - body: SafeArea( - child: GetBuilder(builder: (Call_outLogic controller) { - return Column( + body: SafeArea( + child: Stack( + fit: StackFit.expand, children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async { - logic.startSelectCircleActivity(); - }, - child: Container( - height: 45.sp, - padding: EdgeInsets.only(left: 17.sp, right: 17.sp), - child: Row( - children: [ - Text( - '选择圈子:', - style: TextStyle( - color: Colors.white, fontSize: 16.sp), + Column( + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + logic.startSelectCircleActivity(); + }, + child: Container( + height: 45.sp, + padding: + EdgeInsets.only(left: 17.sp, right: 17.sp), + child: Row( + children: [ + Text( + '选择圈子:', + style: TextStyle( + color: Colors.white, fontSize: 16.sp), + ), + Expanded(child: Container()), + logic.circleName == '' + ? Container() + : Container( + padding: EdgeInsets.only( + left: 7.sp, right: 7.sp), + height: 21.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular( + 21 * 0.5.sp), + gradient: const LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xff0AFCFF), + Color(0xffD739EA) + ])), + child: Text( + logic.circleName, + style: TextStyle( + color: Colors.white, + fontSize: 12.sp), + ), + ), + Image.asset( + getHomeImage('icon_in'), + width: 24.sp, + ), + ], ), - Expanded(child: Container()), - logic.circleName == '' - ? Container() - : Container( - padding: EdgeInsets.only( - left: 7.sp, right: 7.sp), - height: 21.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 21 * 0.5.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xff0AFCFF), - Color(0xffD739EA) - ])), - child: Text( - logic.circleName, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp), + ), + ), + Image.asset( + getCircleImage('line'), + width: Get.width, + fit: BoxFit.fill, + ), + Expanded( + child: Container( + padding: EdgeInsets.only(top: 15.sp), + child: Stack( + children: [ + SizedBox( + height: 200.sp, + child: TextField( + controller: + controller.textEditingController, + onChanged: (value) { + controller.update(); + }, + onTap: () { + isShowKeyboard = true; + setState(() {}); + }, + style: TextStyle( + color: Colors.white, fontSize: 14.0.sp), + maxLines: 32, + maxLength: 200, + decoration: InputDecoration( + hintStyle: TextStyle( + color: const Color.fromRGBO( + 255, 255, 255, 0.6), + fontSize: 14.sp), + hintText: '请输入...(左下角上传图片或视频哦)', + border: InputBorder.none, + contentPadding: EdgeInsets.only( + left: 17.sp, right: 17.sp), + counter: const Text('')), + ), + ), + Positioned( + right: 15.sp, + top: 190.sp, + child: Text( + '${controller.textEditingController.text.length}/200', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + )), + Container( + margin: EdgeInsets.only(top: 220.sp), + child: _imageAdapter(controller)), + Container( + margin: EdgeInsets.only( + top: 220.sp, left: 15.sp, right: 15.sp), + child: _showVideo(controller), + ) + ], + ), + )), + if (!isShowKeyboard) + Container( + height: 60.sp, + padding: EdgeInsets.only( + left: 17.sp, right: 17.sp, bottom: 5.sp), + child: Row( + children: [ + GestureDetector( + onTap: () { + logic.showImg(); + }, + child: Image.asset( + getCircleImage('photo'), + width: 30.sp, + ), + ), + const SizedBox( + width: 16, + ), + GestureDetector( + onTap: () { + logic.showVideo(); + }, + child: Image.asset( + getCircleImage('video'), + width: 30.sp, + ), + ), + Expanded( + child: GestureDetector( + onTap: () { + if (controller.vip == 2) { + controller.isCheck = + !controller.isCheck; + controller.update(); + } else { + showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~"); + controller.showRechargeDialog(); + } + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + getCircleImage(controller.isCheck + ? 'check' + : 'uncheck'), + width: 17.5.sp, + ), + SizedBox( + width: 4.sp, + ), + Text( + '使用至尊喊话', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + navigateToContentGuidelines(); + }, + child: Text( + '内容规范', + style: TextStyle( + color: const Color(0xff00FFF4), + fontSize: 14.sp), + ), + ) + ], + ), + ) + ], + ), + if (isShowKeyboard) + Positioned( + bottom: keyboardSize, + child: Container( + width: Get.width, + height: 60.sp, + padding: EdgeInsets.only( + left: 17.sp, right: 17.sp, bottom: 5.sp), + child: Row( + children: [ + GestureDetector( + onTap: () { + logic.showImg(); + }, + child: Image.asset( + getCircleImage('photo'), + width: 30.sp, + ), + ), + const SizedBox( + width: 16, + ), + GestureDetector( + onTap: () { + logic.showVideo(); + }, + child: Image.asset( + getCircleImage('video'), + width: 30.sp, + ), + ), + Expanded( + child: GestureDetector( + onTap: () { + if (controller.vip == 2) { + controller.isCheck = + !controller.isCheck; + controller.update(); + } else { + showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~"); + controller.showRechargeDialog(); + } + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + getCircleImage(controller.isCheck + ? 'check' + : 'uncheck'), + width: 17.5.sp, + ), + SizedBox( + width: 4.sp, + ), + Text( + '使用至尊喊话', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp), + ) + ], ), ), - Image.asset( - getHomeImage('icon_in'), - width: 24.sp, - ), - ], - ), - ), - ), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), - Expanded( - child: Container( - padding: EdgeInsets.only(top: 15.sp), - child: Stack( - children: [ - SizedBox( - height: 200.sp, - child: TextField( - controller: controller.textEditingController, - onChanged: (value) { - controller.update(); - }, - style: TextStyle( - color: Colors.white, fontSize: 14.0.sp), - maxLines: 32, - maxLength: 200, - decoration: InputDecoration( - hintStyle: TextStyle( - color: const Color.fromRGBO( - 255, 255, 255, 0.6), - fontSize: 14.sp), - hintText: '请输入...(左下角上传图片或视频哦)', - border: InputBorder.none, - contentPadding: EdgeInsets.only( - left: 17.sp, right: 17.sp), - counter: const Text('')), - ), - ), - Positioned( - right: 15.sp, - top: 190.sp, - child: Text( - '${controller.textEditingController.text.length}/200', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - )), - Container( - margin: EdgeInsets.only(top: 220.sp), - child: _imageAdapter(controller)), - Container( - margin: EdgeInsets.only(top: 220.sp,left: 15.sp,right: 15.sp), - - child:_showVideo(controller) ,) - - ], - ), - )), - Container( - height: 60.sp, - padding: EdgeInsets.only( - left: 17.sp, right: 17.sp, bottom: 5.sp), - child: Row( - children: [ - GestureDetector( - onTap: () { - logic.showImg(); - }, - child: Image.asset( - getCircleImage('photo'), - width: 30.sp, - ), - ), - const SizedBox( - width: 16, - ), - GestureDetector( - onTap: () { - logic.showVideo(); - }, - child: Image.asset( - getCircleImage('video'), - width: 30.sp, - ), - ), - Expanded( - child: GestureDetector( - onTap: () { - if(controller.vip ==2){ - controller.isCheck = !controller.isCheck; - controller.update(); - }else{ - showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~"); - controller.showRechargeDialog(); - } - - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getCircleImage(controller.isCheck - ? 'check' - : 'uncheck'), - width: 17.5.sp, - ), - SizedBox( - width: 4.sp, - ), - Text( - '使用至尊喊话', + ), + GestureDetector( + onTap: () { + navigateToContentGuidelines(); + }, + child: Text( + '内容规范', style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ) - ], - ), + color: const Color(0xff00FFF4), + fontSize: 14.sp), + ), + ) + ], ), - ), - GestureDetector( - onTap: (){ - navigateToContentGuidelines(); - }, - child: Text( - '内容规范', - style: TextStyle( - color: const Color(0xff00FFF4), - fontSize: 14.sp), - ), - ) - ], - ), - ) + )) ], - ); - }), - ), - )), - ); + ), + ), + ))); }); } @@ -240,47 +339,21 @@ class Call_outPage extends StatelessWidget { } // Widget _maxVideo(Call_outLogic controller){ - // return SizedBox( - // width:controller.videoPlayerController!.value.size.width < controller.videoPlayerController!.value.size.height ? 9*15.sp : 16*15.sp, - // height:controller.videoPlayerController!.value.size.width < controller.videoPlayerController!.value.size.height ? 16*15.sp :9*15.sp, - // - // child: Stack( - // children: [ - // ClipRRect( - // borderRadius: BorderRadius.circular(6.sp), - // child: VideoItemWidget(controller.state.videolist[0])), - // // Center(child:controller.videoPlayerController!.value.isPlaying ? Container() : Image(image: AssetImage(getMineImage("icon_play")),width: 30.sp,height: 30.sp,),), - // Positioned( - // top: 0, - // right: 0, - // child: GestureDetector( - // onTap: () { - // // showToast("删除"); - // _showDelVideoDialog(Get.context!, controller); - // }, - // child: Image( - // image: AssetImage(getMineImage("icon_img_del")), - // width: 20.sp, - // height: 20.sp, - // ), - // )) - // - // // ClosedCaption(text: controller.videoPlayerController!.value.caption.text), - // // _ControlsOverlay(controller: controller.videoPlayerController), - // // VideoProgressIndicator(controller.videoPlayerController!, allowScrubbing: true), - // ], - // ), - // ); - // } - Widget _mixVideo(Call_outLogic controller){ + Widget _mixVideo(Call_outLogic controller) { return SizedBox( - width:controller.videoPlayerController!.value.size.width < controller.videoPlayerController!.value.size.height ? 135.sp : 240.sp, - height:controller.videoPlayerController!.value.size.width < controller.videoPlayerController!.value.size.height ? 240.sp :135.sp, + width: controller.videoPlayerController!.value.size.width < + controller.videoPlayerController!.value.size.height + ? 135.sp + : 240.sp, + height: controller.videoPlayerController!.value.size.width < + controller.videoPlayerController!.value.size.height + ? 240.sp + : 135.sp, child: GestureDetector( onTap: () { - if(controller.videoPlayerController!.value.isPlaying){ + if (controller.videoPlayerController!.value.isPlaying) { controller.videoPlayerController!.pause(); - }else{ + } else { controller.videoPlayerController!.play(); } controller.update(); @@ -290,7 +363,15 @@ class Call_outPage extends StatelessWidget { child: Stack( children: [ VideoPlayer(controller.videoPlayerController!), - Center(child:controller.videoPlayerController!.value.isPlaying ? Container() : Image(image: AssetImage(getMineImage("icon_play")),width: 30.sp,height: 30.sp,),), + Center( + child: controller.videoPlayerController!.value.isPlaying + ? Container() + : Image( + image: AssetImage(getMineImage("icon_play")), + width: 30.sp, + height: 30.sp, + ), + ), Positioned( top: 0, right: 0, @@ -515,11 +596,7 @@ class Call_outPage extends StatelessWidget { ); } - - - - void _showDelVideoDialog( - BuildContext context, Call_outLogic controller) { + void _showDelVideoDialog(BuildContext context, Call_outLogic controller) { showDialog( context: context, builder: (BuildContext context) { @@ -561,7 +638,7 @@ class Call_outPage extends StatelessWidget { child: Text( "提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( @@ -615,7 +692,7 @@ class Call_outPage extends StatelessWidget { onTap: () { Navigator.pop(context); controller.videoPlayerController?.dispose(); - controller.videoPlayerController=null; + controller.videoPlayerController = null; controller.state.videolist = []; controller.update(); }, @@ -658,111 +735,4 @@ class Call_outPage extends StatelessWidget { }, ); } - - - // tipWdiget() { - // return Container( - // width: Get.width, - // height: Get.height, - // child: Center( - // child: Container( - // width: 339.sp, - // height: 330.sp, - // decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage(getCircleImage('add_tip_bg')))), - // child: Stack( - // alignment: Alignment.center, - // children: [ - // Positioned( - // top: 5.sp, - // right: 12.sp, - // child: GestureDetector( - // onTap: () { - // Get.back(); - // }, - // child: Image.asset( - // getCircleImage('close'), - // width: 24.sp, - // ), - // )), - // Positioned( - // top: 24.sp, - // child: Text( - // '解锁圈子才能主动私聊', - // style: TextStyle(color: Colors.white, fontSize: 16.sp), - // )), - // Positioned( - // left: 17.sp, - // top: 64.sp, - // child: Text( - // '为什么要解锁圈子?', - // style: TextStyle(color: Colors.white, fontSize: 16.sp), - // )), - // Positioned( - // top: 98.sp, - // child: Container( - // width: 339.sp, - // padding: EdgeInsets.only(left: 17.sp, right: 17.sp), - // child: Text( - // '为打造纯净的社交环境,更好地服务大家,基于以下几方面考虑:1、平台升级为全天24小时人工审核,保证用户真实,避免骗子、酒托、虚假人士等扰乱平台 ;2、杜绝未入圈用户随意骚扰或影响已入圈的;3、谢绝只会白嫖的猎奇人士。', - // style: TextStyle( - // color: Color.fromRGBO(247, 250, 250, 0.8), - // fontSize: 12.sp)), - // )), - // Positioned( - // bottom: 18.sp, - // child: Container( - // width: 168.sp, - // height: 42.sp, - // alignment: Alignment.center, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(21.sp), - // gradient: const LinearGradient( - // begin: Alignment.centerLeft, - // end: Alignment.centerRight, - // colors: [Color(0xff0AFCFF), Color(0xffD739EA)])), - // child: Text( - // '立即解锁', - // style: TextStyle(color: Colors.white, fontSize: 16.sp), - // ), - // )), - // Positioned( - // bottom: 72.sp, - // child: Container( - // child: Row( - // children: [ - // Text( - // '¥18', - // style: TextStyle( - // color: Color(0xffE845FF), - // fontSize: 16.sp, - // fontWeight: FontWeight.w600), - // ), - // SizedBox( - // width: 2.sp, - // ), - // Text( - // '(原价60)', - // style: TextStyle( - // color: Colors.white70, - // fontSize: 16.sp, - // fontWeight: FontWeight.w400, - // decoration: TextDecoration.lineThrough, - // decorationColor: Colors.white70, - // ), - // ), - // ], - // ), - // )) - // ], - // ), - // ), - // ), - // ); - // } - - - } 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 ccc9d08..2ef339e 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -220,23 +220,23 @@ class InfoListViewState extends State with AutomaticKeepAliveClien void pushMsgPage(Lists bean, String cicleId) async { - // if (widget.bean.is_limit&&widget.bean.amount>0) { - // showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ - // widget.bean.is_limit = false; - // if (Get.isRegistered()) { - // var logic = Get.find(); - // for (var element in logic.circle.lists) { - // if (element.id == widget.bean.id) { - // element.is_limit = false; - // element.isJoin = true; - // } - // } - // logic.update(); - // } - // Get.back(); - // },widget.bean.ios_item); - // return; - // } + if (widget.bean.is_limit&&widget.bean.amount>0) { + showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ + widget.bean.is_limit = false; + if (Get.isRegistered()) { + var logic = Get.find(); + for (var element in logic.circle.lists) { + if (element.id == widget.bean.id) { + element.is_limit = false; + element.isJoin = true; + } + } + logic.update(); + } + Get.back(); + },widget.bean.ios_item); + return; + } var sp = await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart index f3f53f6..149b248 100644 --- a/circle_app/lib/app/circle/widgets/like_view.dart +++ b/circle_app/lib/app/circle/widgets/like_view.dart @@ -20,6 +20,8 @@ import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../../../common/Widgets/base_tip_widget.dart'; + class LikeView extends StatefulWidget { @override _LikeViewState createState() => _LikeViewState(); @@ -220,13 +222,13 @@ class _LikeViewState extends State } void pushMsgPage(var bean, String cicleId) async { - // if (widget.bean.is_limit&&widget.bean.amount>0) { - // showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ - // widget.bean.is_limit = false; + // if (bean.is_limit&&bean.amount>0) { + // showJoinCiclePiker(cicleId,bean.amount.toString(),bean.oldAmount.toString(),2,(payResult){ + // bean.is_limit = false; // if (Get.isRegistered()) { // var logic = Get.find(); // for (var element in logic.circle.lists) { - // if (element.id == widget.bean.id) { + // if (element.id == bean.id) { // element.is_limit = false; // element.isJoin = true; // } @@ -234,7 +236,7 @@ class _LikeViewState extends State // logic.update(); // } // Get.back(); - // },widget.bean.ios_item); + // },bean.ios_item); // return; // } diff --git a/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart b/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart index f52d27b..a196639 100644 --- a/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart +++ b/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart @@ -81,7 +81,7 @@ class _ScreenBottomSheetDialogState extends State { height: 220.0, width: double.infinity, child: Container( - margin: EdgeInsets.symmetric( vertical: 20.sp), + margin: EdgeInsets.only(top: 10.sp), child: Column( children: [ Row( diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart index d5a0e70..121faa2 100644 --- a/circle_app/lib/app/home/logic.dart +++ b/circle_app/lib/app/home/logic.dart @@ -13,11 +13,13 @@ import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:get/get.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:tencent_cloud_chat_uikit/data_services/core/core_services.dart'; import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; +import '../../util/SharedPreferencesHelper.dart'; import '../../util/eventBus.dart'; import '../../view/notice.dart'; import '../circle/view.dart'; @@ -54,10 +56,10 @@ class HomeLogic extends GetxController { @override void onInit() async { super.onInit(); - + unreadSIze.value = '0'; getIMData(); - + setFirstData(); tabs.add(CirclePage()); tabs.add(LikePage()); @@ -67,7 +69,7 @@ class HomeLogic extends GetxController { // EventBusManager.on().listen((event) { // getUnreadSize(); // }); - getUnreadSize(); + // getUnreadSize(); @@ -177,25 +179,32 @@ class HomeLogic extends GetxController { showOKToast(bean.msg); } getUnreadSize() async { - try { - V2TimValueCallback getTotalUnreadMessageCountRes = - await TencentImSDKPlugin.v2TIMManager - .getConversationManager() - .getTotalUnreadMessageCount(); - print("未读数量desc=" + - getTotalUnreadMessageCountRes.desc.toString() + - "code=" + - getTotalUnreadMessageCountRes.code.toString() + - "data=" + - getTotalUnreadMessageCountRes.data.toString()); + if (coreInstance.isLoginSuccess) { + try { + V2TimValueCallback getTotalUnreadMessageCountRes = + await TencentImSDKPlugin.v2TIMManager + .getConversationManager() + .getTotalUnreadMessageCount(); + print("未读数量desc=" + + getTotalUnreadMessageCountRes.desc.toString() + + "code=" + + getTotalUnreadMessageCountRes.code.toString() + + "data=" + + getTotalUnreadMessageCountRes.data.toString()); + + if (getTotalUnreadMessageCountRes.code == 0) { + if (getTotalUnreadMessageCountRes.data.toString() != unreadSIze.value) { + unreadSIze.value = getTotalUnreadMessageCountRes.data.toString(); + } + + if (Platform.isAndroid) { + setOfflinePushStatus(status: AppStatus.foreground); + } - if (getTotalUnreadMessageCountRes.code == 0) { - unreadSIze.value = getTotalUnreadMessageCountRes.data.toString(); - if (Platform.isAndroid) { - setOfflinePushStatus(status: AppStatus.foreground); } - } - } catch (e) {} + } catch (e) {} + } + } @override @@ -267,4 +276,12 @@ class HomeLogic extends GetxController { } update(); } + + void setFirstData() async { + SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); + sharedPreferences.setString( + SharedPreferencesHelper.firstLogin, '1'); + + + } } diff --git a/circle_app/lib/app/like/logic.dart b/circle_app/lib/app/like/logic.dart index d7fbbdf..7c71c94 100644 --- a/circle_app/lib/app/like/logic.dart +++ b/circle_app/lib/app/like/logic.dart @@ -79,7 +79,7 @@ class LikeLogic extends GetxController { } isLoad = false; - if (circle.lists.length < 20) { + if (bean.data!.lists.length < 20) { isMore = false; } update(); diff --git a/circle_app/lib/app/like/view.dart b/circle_app/lib/app/like/view.dart index 4cfe535..b3b7fa1 100644 --- a/circle_app/lib/app/like/view.dart +++ b/circle_app/lib/app/like/view.dart @@ -131,11 +131,14 @@ class _LikePageState extends State with RouteAware { logic.relaodData(); }, child: ListView.builder( - controller: logic.rightCtr, + controller: logic.rightCtr , itemBuilder: (context, index) { + if (index == logic.circle.lists.length) { + return loaddingWidget(logic.isMore); + } return circleInfoItem(logic.circle.lists[index],index); }, - itemCount: logic.circle.lists.length, + itemCount: logic.circle.lists.length + 1, )), Positioned( bottom: 36.sp, @@ -154,6 +157,50 @@ class _LikePageState extends State with RouteAware { ); } + goDetailPage(Circle bean,int index) async { + if (!bean.isJoin) { + await logic.outCircle( + bean.id.toString(), + bean.isJoin); + } + + var result = await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); + var data = await DioManager.instance.get( + url: "/up-service/interest/${bean.id}",); + if (data["code"] == 200) { + var bean = Circle.fromJson(data['data']); + logic.circle.lists[index] = bean; + if (mounted) { + setState(() { + + }); + } + + } + } + + goAndJoinDetailPage(Circle bean,int index) async { + if (!bean.isJoin) { + await logic.outCircle( + bean.id.toString(), + bean.isJoin); + } + + var result = await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); + var data = await DioManager.instance.get( + url: "/up-service/interest/${bean.id}",); + if (data["code"] == 200) { + var bean = Circle.fromJson(data['data']); + logic.circle.lists[index] = bean; + if (mounted) { + setState(() { + + }); + } + + } + } + circleInfoItem(Circle bean,int index) { List urlList = bean.lastJoinUsers; List widgets = []; @@ -176,19 +223,7 @@ class _LikePageState extends State with RouteAware { } return GestureDetector( onTap: () async { - var result = await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - var data = await DioManager.instance.get( - url: "/up-service/interest/${bean.id}",); - if (data["code"] == 200) { - var bean = Circle.fromJson(data['data']); - logic.circle.lists[index] = bean; - if (mounted) { - setState(() { - - }); - } - - } + goDetailPage(bean, index); }, child: Container( margin: EdgeInsets.only(bottom: 10.sp), @@ -271,8 +306,7 @@ class _LikePageState extends State with RouteAware { Get.bottomSheet(CircleShare('', '', bean), isScrollControlled: true, enableDrag: false); } else { - await logic.outCircle( - bean.id.toString(), bean.isJoin); + goAndJoinDetailPage(bean, index); } }, child: Stack( @@ -317,8 +351,7 @@ class _LikePageState extends State with RouteAware { additionStyle: TextStyle( color: const Color(0xFFFF4DF6), fontSize: 17.sp), onTap: () { - _showTextContentDialog( - Get.context!, bean.intro, bean.title); + goDetailPage(bean, index); }, )), urlList.length == 0 @@ -430,7 +463,7 @@ class _LikePageState extends State with RouteAware { } if (count == 5 && !logic.mycircle.lists[index].is_top) { - showOKToast('圈子置顶最多五个哦~'); + showOKToast('最多置顶5个,可长按已置顶圈子取消置顶哦~'); } else { _showSetTopCircleDialog(Get.context!,logic,logic.mycircle.lists[index]); } diff --git a/circle_app/lib/app/likelist/logic.dart b/circle_app/lib/app/likelist/logic.dart index d5d4f7f..db5a690 100644 --- a/circle_app/lib/app/likelist/logic.dart +++ b/circle_app/lib/app/likelist/logic.dart @@ -1,4 +1,5 @@ +import 'package:circle_app/app/minefragment/logic.dart'; import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -23,6 +24,8 @@ class LikelistLogic extends GetxController { @override void onInit() async{ super.onInit(); + var mineLogic = Get.find(); + isVip = mineLogic.isVip.value; initList(); } diff --git a/circle_app/lib/app/likelist/view.dart b/circle_app/lib/app/likelist/view.dart index b782051..ed91ff0 100644 --- a/circle_app/lib/app/likelist/view.dart +++ b/circle_app/lib/app/likelist/view.dart @@ -1,4 +1,9 @@ +import 'dart:ui'; + import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/app/minefragment/logic.dart'; +import 'package:circle_app/common/Widgets/open_vip_tip/view.dart'; +import 'package:circle_app/common/colors/app_color.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -25,118 +30,339 @@ class LikelistPage extends StatelessWidget { ? loaddingWidget(true) : logic.lists.isEmpty ? noResultWidget() - : SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - padding: EdgeInsets.all(10.sp), - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListItem(logic.lists[index], index); - }, - ), - ), + : Stack( + + children: [ + SmartRefresher( + controller: logic.refreshController, + onRefresh: _onRefresh, + onLoading: _onLoading, + enablePullUp: true, + child: ListView.builder( + padding: EdgeInsets.all(10.sp), + itemCount: logic.lists.length, + itemBuilder: (context, index) { + return ListItem(logic.lists[index], index); + }, + ), + + ), + showGd() + ], + ), ), ); }); } + + Widget showGd() { + double interval = 50; + List urlList = []; + + if (logic.lists.length > 3) { + for (int i = 3; i < logic.lists.length; i++) { + if (urlList.length < 3) { + print(logic.lists[i].user.avatar); + urlList.add(logic.lists[i].user.avatar); + } else { + break; + } + } + } + + List widgets = []; + + switch (urlList.length) { + case 0: + widgets.add(Positioned( + left: (Get.width / 2) - 40, + child: circleWidget(""), + )); + break; + case 1: + for (int i = 0; i < urlList.length; i++) { + var element = urlList[i]; +// double xOffset = interval * i + xOffsetBase; + double let = (Get.width / 2) - 60; + if (element == '') { + element = + 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; + } + + widgets.add(Positioned( + left: let, + child: circleWidget(element), + )); + } + + widgets.add(Positioned( + left: (Get.width / 2) - 20, + child: circleWidget(""), + )); + break; + case 2: + double xOffsetBase = + (Get.width + interval * urlList.length - 60.0 * urlList.length) * + 0.25; + + for (int i = 0; i < urlList.length; i++) { + var element = urlList[i]; +// double xOffset = interval * i + xOffsetBase; + double let = ((Get.width / 2) - ((40 * urlList.length)) + (i * 40)); + if (element == '') { + element = + 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; + } + widgets.add(Positioned( + left: let, + child: circleWidget(element), + )); + } + + double xOffset = interval * urlList.length + xOffsetBase; + widgets.add(Positioned( + left: xOffset, + child: circleWidget(""), + )); + break; + case 3: + // double xOffsetBase = (Get.width + interval * urlList.length - 60.0 * urlList.length) * 0.25; + + for (int i = 0; i < urlList.length; i++) { + switch (i) { + case 0: + if (urlList[i] == '') { + urlList[i] = + 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; + } + widgets.add(Positioned( + left: (Get.width / 2) - 100, + child: circleWidget(urlList[i]), + )); + break; + case 1: + if (urlList[i] == '') { + urlList[i] = + 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; + } + widgets.add(Positioned( + left: (Get.width / 2) - 60, + child: circleWidget(urlList[i]), + )); + break; + case 2: + if (urlList[i] == '') { + urlList[i] = + 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; + } + widgets.add(Positioned( + left: (Get.width / 2) - 20, + child: circleWidget(urlList[i]), + )); + break; + } + } + widgets.add(Positioned( + left: (Get.width / 2) + 20, + child: circleWidget(""), + )); + + break; + } + + return logic.isVip > 0 + ? Container() + : Positioned( + bottom: 150, + child: Container( + width: Get.width, + child: Column( + children: [ + SizedBox( + height: 140.sp, + width: Get.width, + child: Stack( + alignment: Alignment.centerLeft, + children: widgets, + ), + ), + Container( + margin: EdgeInsets.only(bottom: 40.sp), + child: Text( + "TA们也喜欢你哦 \n" + "成为会员查看所有圈友信息", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 15.sp, + ), + ), + ), + GestureDetector( + onTap: () { + showRechargeDialog(); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: AppColor.mainVerLinearGradient, + ), + padding: EdgeInsets.symmetric( + vertical: 10.sp, + horizontal: 55.sp, + ), + child: Text( + "开通会员查看更多访客", + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + ), + ), + ), + ), + ], + ), + ), + ); + } + + circleWidget(String url, {double width = 80}) { + return GestureDetector( + onTap: () { + // openvi(); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('more'), + width: width.sp, + height: width.sp, + ), + url != null && url.contains("http") + ? ClipOval( + child: CachedNetworkImage( + imageUrl: url, + width: (width - 1).sp, + height: (width - 1).sp, + fit: BoxFit.cover, + ), + ) + : Text( + url, + style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), + ) + ], + )); + } + Widget ListItem(UserListItem item, int index) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: item.user.id.toString()); + if (logic.isVip > 0 || index < 3) { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: item.user.id.toString()); + } + }, - child: Container( - margin: EdgeInsets.only(bottom: 21.sp), - child: Row( - children: [ - Stack( - children: [ - ClipOval( - child: GestureDetector( - onTap: () { - var imgList = []; - imgList.add(item.user.avatar); - Get.toNamed(AppRoutes.Swiper, - arguments: {'imaglist': imgList, 'index': 0}); - }, - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.user.avatarThumb, - width: 53.sp, - height: 53.sp, + child: ImageFiltered( + imageFilter: ImageFilter.blur( + sigmaX: (logic.isVip > 0 || index < 3) ? 0 : 5, + sigmaY: (logic.isVip > 0 || index < 3) ? 0 : 5, + ), + + child: Container( + margin: EdgeInsets.only(bottom: 21.sp), + child: Row( + children: [ + Stack( + children: [ + ClipOval( + child: GestureDetector( + onTap: () { + var imgList = []; + imgList.add(item.user.avatar); + Get.toNamed(AppRoutes.Swiper, + arguments: {'imaglist': imgList, 'index': 0}); + }, + child: CachedNetworkImage( + fit: BoxFit.cover, + imageUrl: item.user.avatarThumb, + width: 53.sp, + height: 53.sp, + ), ), ), - ), - Positioned( - right: 0.sp, - left: 0.sp, - bottom: 0.sp, - child: item.user.vip!=0 - ? Image( - image: AssetImage(getBaseImage(item.user.vip == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ) - : Container(), - ) - ], - ), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.user.nickname, - style: const TextStyle( - color: Colors.white70, - fontSize: 14, - fontWeight: FontWeight.bold), - ), - SizedBox(width: 4.sp), - // SizedBox(height: 8.sp), - _buildInfoRow(item), - // Placeholder image - ], - ), - SizedBox(height: 8.sp), - SizedBox( - width: 200.sp, - child: Text( - item.user.signature, - overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 - maxLines: 1, - style: TextStyle(fontSize: 12.sp, color: const Color(0xFFB7BECC)), + Positioned( + right: 0.sp, + left: 0.sp, + bottom: 0.sp, + child: item.user.vip != 0 + ? Image( + image: AssetImage(getBaseImage( + item.user.vip == 1 ? "vip" : 'year_vip')), + width: 44.sp, + height: 18.sp, + ) + : Container(), + ) + ], + ), + SizedBox(width: 10.sp), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + item.user.nickname, + style: const TextStyle( + color: Colors.white70, + fontSize: 14, + fontWeight: FontWeight.bold), + ), + SizedBox(width: 4.sp), + // SizedBox(height: 8.sp), + _buildInfoRow(item), + // Placeholder image + ], + ), + SizedBox(height: 8.sp), + SizedBox( + width: 200.sp, + child: Text( + item.user.signature, + overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 + maxLines: 1, + style: TextStyle( + fontSize: 12.sp, color: const Color(0xFFB7BECC)), + ), + ), + ], + ), + // Pla + const Spacer(), + GestureDetector( + onTap: () { + logic.setLike(index); + }, + child: Container( + width: 75.sp, + height: 28.sp, + decoration: BoxDecoration( + color: const Color(0xFFFF4D7C), + borderRadius: BorderRadius.circular(14), + ), + child: Center( + child: Text(item.isLike ? "互相关注" : "关注", + style: TextStyle(fontSize: 14.sp, color: Colors.white)), ), - ), - ], - ), - // Pla - const Spacer(), - GestureDetector( - onTap: () { - logic.setLike(index); - }, - child: Container( - width: 75.sp, - height: 28.sp, - decoration: BoxDecoration( - color: const Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text(item.isLike ? "互相关注" : "关注", - style: TextStyle(fontSize: 14.sp, color: Colors.white)), ), ), - ), - ], + ], + ), ), ), ); @@ -186,4 +412,22 @@ class LikelistPage extends StatelessWidget { logic.page = logic.page + 1; logic.initList(); } + + + showRechargeDialog() async { + MinefragmentLogic ctr = Get.find(); + Get.bottomSheet( + Scaffold( + backgroundColor: Colors.transparent, + body: Open_vip_tipPage(false), + ), + isScrollControlled: true, + enableDrag: false).then((value) { + ctr.getMode(); + logic.isVip = ctr.isVip.value; + logic.update(); + }); + + + } } diff --git a/circle_app/lib/app/login/complete_material/logic.dart b/circle_app/lib/app/login/complete_material/logic.dart index ba5ad10..346b252 100644 --- a/circle_app/lib/app/login/complete_material/logic.dart +++ b/circle_app/lib/app/login/complete_material/logic.dart @@ -1,4 +1,6 @@ +import 'dart:convert'; + import 'package:circle_app/network/dio_manager.dart'; import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/util.dart'; @@ -12,6 +14,7 @@ import 'package:image_picker/image_picker.dart'; import '../../../common/config.dart'; import '../../../network/api.dart'; import '../../../util/qiniu.dart'; +import '../../circle/logic.dart'; import '../../minefragment/logic.dart'; import '../../select_circle/logic.dart'; import '../../userinfo/logic.dart'; @@ -46,9 +49,18 @@ class Complete_materialLogic extends GetxController { UserBean? userInfoBean = null; + List provinceList = []; + + List genderTagList = [];//你想认识 + + List watchGenderList = []; + Map cityMap = {}; + @override void onInit() async { FlutterNativeSplash.remove(); + await loadCofigData(); + getCityList(); if(type!=''){ var data = await DioManager.instance.get(url: Api.getUserInfo); var bean = BaseResponse.fromJson( @@ -66,8 +78,18 @@ class Complete_materialLogic extends GetxController { state.role = getRoleContent(userInfoBean!.role); state.roleId = userInfoBean!.role.toString(); state.orientation = getOrientationContent(userInfoBean!.orientation); + if (userInfoBean!.orientations.isNotEmpty) { + + watchGenderList.forEach((element) { + if (userInfoBean!.orientations!.contains(element.id)) { + element.isSelect = true; + } + }); + + } state.orientationId = userInfoBean!.orientation.toString(); state.textEditingController.text = userInfoBean!.nickname; + state.city = userInfoBean!.city ?? ''; state.descEditingController.text = userInfoBean!.signature; headUrl = userInfoBean!.avatar; userInfoBean!.interests.forEach((element) { @@ -82,6 +104,10 @@ class Complete_materialLogic extends GetxController { } + + } + + loadCofigData() async { var data = await DioManager.instance.get(url: Api.getqiniuToken, params: {}); var bean = BaseResponse.fromJson( @@ -99,6 +125,8 @@ class Complete_materialLogic extends GetxController { configBean.genderMap.forEach((key, value) { genderList.add(value); + SysTag tag = SysTag(id: int.parse(key), tagName: value); + watchGenderList.add(tag); }); configBean.orientationMap.forEach((key, value) { @@ -109,6 +137,30 @@ class Complete_materialLogic extends GetxController { }); } + getCityList() async { + try { + String jsonString = await rootBundle.loadString('assets/province.json'); + List jsonData = json.decode(jsonString); + provinceList = + jsonData.map((dynamic item) => Province.fromJson(item)).toList(); + cityMap.clear(); + for (int i = 0; i < provinceList.length; i++) { + Map areaMap = {}; + for (int c = 0; c < provinceList[i].city.length; c++) { + String cityName = provinceList[i].city[c].name; + List cityAreaList = []; + provinceList[i].city[c].area.forEach((element) { + cityAreaList.add(element); + }); + areaMap[cityName] = cityAreaList; + } + cityMap[provinceList[i].name] = areaMap; + } + } catch (e) { + print('Error loading JSON file: $e'); + } + } + Future getImageFile() async { try { final XFile? pickedFile = await _picker.pickImage( @@ -148,16 +200,16 @@ class Complete_materialLogic extends GetxController { showOKToast('昵称最多输入6个字'); return; }else if (state.sex.isEmpty) { - showOKToast('请选择您的属性'); + showOKToast('请选择您的角色'); return; } else if (state.age.isEmpty) { showOKToast('请选择您的年龄'); return; - } else if (state.role.isEmpty) { - showOKToast('请选择您的角色'); + } else if (state.city.isEmpty) { + showOKToast('请选择您的常驻城市'); return; } else if (state.role.isEmpty) { - showOKToast('请选择您的角色'); + showOKToast('请选择您的属性'); return; } else if (state.orientation.isEmpty) { showOKToast('请选择您的取向'); @@ -172,10 +224,26 @@ class Complete_materialLogic extends GetxController { showOKToast('您的交友宣言太短'); return; } + + if (headUrl == '') { showOKToast('请上传头像'); return; } + + genderTagList.clear(); + List tagIds = []; + watchGenderList.forEach((element) { + if(element.isSelect){ + tagIds.add(element.id); + genderTagList.add(element.id); + } + }); + if(genderTagList.isEmpty){ + showOKToast("请选择你想认识的人"); + return; + } + // LatLng location = await getLocation(); List interestsList = []; numbers.forEach((element) { @@ -188,6 +256,8 @@ class Complete_materialLogic extends GetxController { 'role': state.roleId, //Int 角色 'interests': interestsList, //兴趣 'orientation': state.orientationId, //Int 爱好 + 'city':state.city, + 'orientations':genderTagList, // 'lat': location.latitude, // 'lng': location.longitude, 'nickname': state.textEditingController.text.trim(), @@ -214,6 +284,9 @@ class Complete_materialLogic extends GetxController { } else if (state.age.isEmpty) { showOKToast('请选择您的年龄'); return; + } else if (state.city.isEmpty) { + showOKToast('请选择您的常驻城市'); + return; } else if (state.role.isEmpty) { showOKToast('请选择您的角色'); return; @@ -237,6 +310,18 @@ class Complete_materialLogic extends GetxController { showOKToast('请上传头像'); return; } + genderTagList.clear(); + List tagIds = []; + watchGenderList.forEach((element) { + if(element.isSelect){ + tagIds.add(element.id); + genderTagList.add(element.id); + } + }); + if(genderTagList.isEmpty){ + showOKToast("请选择你想认识的人"); + return; + } if (state.wxEditingController.text.isNotEmpty) { bool isPass = false; @@ -270,6 +355,8 @@ class Complete_materialLogic extends GetxController { 'role': state.roleId, //Int 角色 'interests': interestsList, //兴趣 'orientation': state.orientationId, //Int 爱好 + 'orientations':genderTagList, + 'city':state.city, // 'lat': location.latitude, // 'lng': location.longitude, 'nickname': state.textEditingController.text, @@ -322,3 +409,22 @@ class Complete_materialLogic extends GetxController { } } +class SysTag { + final int id; + final String tagName; + + bool isSelect = false; + + SysTag({ + required this.id, + required this.tagName, + this.isSelect = false, + }); + + factory SysTag.fromJson(Map json) { + return SysTag( + id: json['id'], + tagName: json['tagName'], + ); + } +} \ No newline at end of file diff --git a/circle_app/lib/app/login/complete_material/state.dart b/circle_app/lib/app/login/complete_material/state.dart index 6179c9d..3147deb 100644 --- a/circle_app/lib/app/login/complete_material/state.dart +++ b/circle_app/lib/app/login/complete_material/state.dart @@ -10,6 +10,8 @@ class Complete_materialState { String age = ''; String brithday = ''; String role = ''; + String city = ''; + String roleId = ''; String orientation = ''; String orientationId = ''; diff --git a/circle_app/lib/app/login/complete_material/view.dart b/circle_app/lib/app/login/complete_material/view.dart index bd1bd52..6d57f1d 100644 --- a/circle_app/lib/app/login/complete_material/view.dart +++ b/circle_app/lib/app/login/complete_material/view.dart @@ -1,4 +1,5 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/common/colors/app_color.dart'; import 'package:circle_app/components/my_app_bar.dart'; import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/util.dart'; @@ -45,6 +46,26 @@ class _Complete_materialPageState extends State { centerTitle: '完善您的个人形象', isBack: true, isDiyBack: true, + actionWdiget: GestureDetector( + onTap: () { + if (controller.type == "user") { + // Navigator.pop(context); + controller.editInfo(); + } else { + controller.checkInfo(); + } + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(14.sp), + gradient: AppColor.mainVerLinearGradient + ), + width: 60.sp, + height: 28.sp, + alignment: Alignment.center, + child: Text('完成',style: TextStyle(color: Colors.white,fontSize: 15.sp),), + ), + ), backPressed: () async { final isBack = await Navigator.maybePop(context); if (isBack) { @@ -52,253 +73,294 @@ class _Complete_materialPageState extends State { Get.offNamed(AppRoutes.Login); } }), + backgroundColor: Colors.transparent, body: GestureDetector( onTap: () { FocusManager.instance.primaryFocus?.unfocus(); }, - child: SingleChildScrollView( - child: Container( - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 20.sp, - ), - GestureDetector( - onTap: () { - controller.getImageFile(); - }, - child: controller.headUrl == '' - ? Image.asset( - getLoginImage('add'), + child: Stack( + alignment: Alignment.center, + children: [ + SingleChildScrollView( + child: Container( + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 20.sp, + ), + GestureDetector( + onTap: () { + controller.getImageFile(); + }, + child: controller.headUrl == '' + ? Image.asset( + getLoginImage('add'), + width: 86.sp, + height: 86.sp, + ) + : ClipOval( + child: CachedNetworkImage( + fit: BoxFit.cover, + imageUrl: controller.headUrl, width: 86.sp, height: 86.sp, - ) - : ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: controller.headUrl, - width: 86.sp, - height: 86.sp, - ), ), - ), - SizedBox( - height: 15.sp, - ), - Text( - '数据表明95%的人对真实的头像更感兴趣', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 16.sp), - ), - funcWidget( - '昵称', - TextField( - controller: controller.state.textEditingController, + ), + ), + SizedBox( + height: 15.sp, + ), + Text( + '数据表明95%的人对真实的头像更感兴趣', style: TextStyle( color: Colors.white, fontWeight: FontWeight.w500, - fontSize: 14.sp), - decoration: InputDecoration( - hintText: '请输入昵称', - hintStyle: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - border: InputBorder.none, - ), + fontSize: 16.sp), ), - () {}, - img: 'edit'), - if (isShowWx) - funcWidget( - '微信', - TextField( - controller: controller.state.wxEditingController, - maxLength: 19, - inputFormatters: [ - FilteringTextInputFormatter.deny( - RegExp("[^-_a-zA-Z0-9]")), - ], - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - decoration: InputDecoration( - counterText: '', - hintText: '请输入微信号', - hintStyle: TextStyle( + funcWidget( + '昵称', + TextField( + controller: controller.state.textEditingController, + style: TextStyle( color: Colors.white, fontWeight: FontWeight.w500, fontSize: 14.sp), - border: InputBorder.none, + decoration: InputDecoration( + hintText: '请输入昵称', + hintStyle: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + fontSize: 14.sp), + border: InputBorder.none, + ), ), - ), - () {}, - img: 'edit'), - funcWidget( - '属性', - Text( - controller.state.sex, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showSexPiker(context, controller); - }), - funcWidget( - '年龄', - Text( - controller.state.age, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showAgePiker( - context, - controller, - ); - }), - funcWidget( - '角色', - Text( - controller.state.role, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showRolePiker(context, controller); - }), - funcWidget( - '取向', - Text( - controller.state.orientation, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showOrientationPiker(context, controller); - }), - funcWidget( - '兴趣', + () {}, + img: 'edit'), + if (isShowWx) + funcWidget( + '微信', + TextField( + controller: controller.state.wxEditingController, + maxLength: 19, + inputFormatters: [ + FilteringTextInputFormatter.deny( + RegExp("[^-_a-zA-Z0-9]")), + ], + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + fontSize: 14.sp), + decoration: InputDecoration( + counterText: '', + hintText: '请输入微信号', + hintStyle: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + fontSize: 14.sp), + border: InputBorder.none, + ), + ), + () {}, + img: 'edit'), + funcWidget( + '角色', + Text( + controller.state.sex, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + ), () { + showSexPiker(context, controller); + }), + funcWidget( + '你想认识', + Container( + child: Row( + children: controller.watchGenderList.isNotEmpty + ? [sexTagWdiget(controller)] + : [], + ), + ), () async { + + },img: ''), + funcWidget( + '年龄', + Text( + controller.state.age, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + ), () { + showAgePiker( + context, + controller, + ); + }), + funcWidget( + '常驻城市', + Text( + controller.state.city, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + ), () { + showCityPiker(context, controller); + }), + funcWidget( + '属性', + Text( + controller.state.role, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + ), () { + showRolePiker(context, controller); + }), + funcWidget( + '取向', + Text( + controller.state.orientation, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + ), () { + showOrientationPiker(context, controller); + }), + funcWidget( + '兴趣', + Container( + child: Row( + children: controller.numbers.isNotEmpty + ? [interestWdiget('JK圈', controller)] + : [], + ), + ), () async { + var data = await Get.toNamed( + AppRoutes.SelectCircleActivity, + arguments: { + "interestMap": controller.configBean.interestMap, + 'selectCircle': controller.numbers, + "isRodio": false + }); + if (data != null) { + controller.numbers = data; + controller.update(); + } + }), Container( - child: Row( - children: controller.numbers.isNotEmpty - ? [interestWdiget('JK圈', controller)] - : [], - ), - ), () async { - var data = await Get.toNamed( - AppRoutes.SelectCircleActivity, - arguments: { - "interestMap": controller.configBean.interestMap, - 'selectCircle': controller.numbers, - "isRodio": false - }); - if (data != null) { - controller.numbers = data; - controller.update(); - } - }), - Container( - margin: EdgeInsets.only( - top: 24.sp, - bottom: 18.sp, - left: 28.sp, - right: 28.sp), - height: 116.sp, - width: Get.width - 50.sp, - child: Stack( - children: [ - Image.asset( - getLoginImage('desc_bg'), - width: Get.width - 50.sp, - fit: BoxFit.fill, - ), - Container( - margin: + margin: EdgeInsets.only( + top: 24.sp, + bottom: 18.sp, + left: 28.sp, + right: 28.sp), + height: 116.sp, + width: Get.width - 50.sp, + child: Stack( + children: [ + Image.asset( + getLoginImage('desc_bg'), + width: Get.width - 50.sp, + fit: BoxFit.fill, + ), + Container( + margin: EdgeInsets.only(left: 15.sp, top: 15.sp,right: 10.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '交友宣言', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - TextField( - maxLines: 3, - controller: controller - .state.descEditingController, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - decoration: InputDecoration( - hintText: '认真写一段交友宣言可以让您的个人形象更完善哦~', - // icon: Text('交友宣言:',style: TextStyle(color: Colors.white,fontSize: 14.sp,fontWeight: FontWeight.w500),), - // labelText: '交友宣言:认真写一段交友宣言可以让您的个人形象更完善哦~', - labelStyle: TextStyle( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '交友宣言', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + ), + TextField( + maxLines: 3, + controller: controller + .state.descEditingController, + style: TextStyle( color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 14.sp), - hintStyle: TextStyle( - color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w500, fontSize: 14.sp), - border: InputBorder.none, - contentPadding: + decoration: InputDecoration( + hintText: '认真写一段交友宣言可以让您的个人形象更完善哦~', + // icon: Text('交友宣言:',style: TextStyle(color: Colors.white,fontSize: 14.sp,fontWeight: FontWeight.w500),), + // labelText: '交友宣言:认真写一段交友宣言可以让您的个人形象更完善哦~', + labelStyle: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 14.sp), + hintStyle: TextStyle( + color: Colors.white.withOpacity(0.5), + fontWeight: FontWeight.w500, + fontSize: 14.sp), + border: InputBorder.none, + contentPadding: EdgeInsets.only(top: 4.sp,left:0.sp,right: 10.sp)), - inputFormatters: [ - LengthLimitingTextInputFormatter(40) + inputFormatters: [ + LengthLimitingTextInputFormatter(40) + ], + ) ], - ) - ], - )), - ], - ), - ), - GestureDetector( - onTap: () { - if (controller.type == "user") { - // Navigator.pop(context); - controller.editInfo(); - } else { - controller.checkInfo(); - } + )), + ], + ), + ), + SafeArea( + child: Container( + alignment: Alignment.center, + width: 133.sp, + height: 56.sp, - // controller.checkInfo(); - }, - child: Container( - alignment: Alignment.center, - width: 133.sp, - height: 56.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getLoginImage('start_bg'))), - ), - child: Text( - controller.type == "user" ? "完成" : '开启小圈之旅', - style: TextStyle( - color: const Color(0xff00FFF4), - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ) - ], + ), + ) + ], + ), + ), ), - ), + // Positioned( + // bottom: 0 , + // child: SafeArea( + // + // child: GestureDetector( + // onTap: () { + // if (controller.type == "user") { + // // Navigator.pop(context); + // controller.editInfo(); + // } else { + // controller.checkInfo(); + // } + // + // // controller.checkInfo(); + // }, + // child: Container( + // alignment: Alignment.center, + // width: 133.sp, + // height: 56.sp, + // decoration: BoxDecoration( + // image: DecorationImage( + // fit: BoxFit.fill, + // image: AssetImage(getLoginImage('start_bg'))), + // ), + // child: Text( + // controller.type == "user" ? "完成" : '开启小圈之旅', + // style: TextStyle( + // color: const Color(0xff00FFF4), + // fontSize: 16.sp, + // fontWeight: FontWeight.w600), + // ), + // ), + // ), + // )) + ], ), ), ) @@ -312,7 +374,7 @@ class _Complete_materialPageState extends State { {String img = 'down_arr'}) { return Container( width: Get.width, - padding: EdgeInsets.only(left: 28.sp, right: 28.sp), + padding: EdgeInsets.only(left: 20.sp, right: 20.sp), height: 54.sp, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -339,6 +401,7 @@ class _Complete_materialPageState extends State { padding: EdgeInsets.only(left: 20.sp), child: tipWidget, )), + if (img.isNotEmpty) Image.asset( getLoginImage(img), width: img == 'down_arr' ? 24.sp : 18.sp, @@ -394,7 +457,7 @@ class _Complete_materialPageState extends State { ), child: Padding( padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 15.sp, right: 15.sp), + left: 15.sp, right: 15.sp), child: Center( child: Text( controller.numbers[index].name, @@ -413,6 +476,63 @@ class _Complete_materialPageState extends State { ); } + + sexTagWdiget(Complete_materialLogic controller) { + return Container( + height: 59.sp, + width: Get.width - 130.sp, + child: ListView.builder( + itemCount: controller.watchGenderList.length, + scrollDirection: Axis.horizontal, + padding: EdgeInsets.symmetric(vertical: 14.sp), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + controller.watchGenderList[index].isSelect = !controller.watchGenderList[index].isSelect; + controller.update(); + }, + child: Container( + margin: EdgeInsets.only(right: 6.sp), // 替换为实际的 item 间距 + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(14.0), // 设置圆角半径 + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + ), + color: const Color(0xFF392D53), + ), + child: Container( + margin: EdgeInsets.all(0.5.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + // shape: BoxShape.circle, + color: controller.watchGenderList[index].isSelect ? Colors.transparent : const Color(0xFF392D53), + ), + child: Padding( + padding: EdgeInsets.only( + left: 5.sp, right: 5.sp), + child: Center( + child: Text( + controller.watchGenderList[index].tagName, + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + ), + ), + ), + ), + ), + ), // 替换为实际的列表项小部件 + ), + ); + }, + ), + ); + } + showSexPiker(context, Complete_materialLogic controller) { FocusManager.instance.primaryFocus?.unfocus(); Pickers.showSinglePicker(context, @@ -462,6 +582,20 @@ class _Complete_materialPageState extends State { ); } + showCityPiker(context, Complete_materialLogic controller) { + Pickers.showMultiLinkPicker(context, + pickerStyle: DefaultPickerStyle.dark(), data: controller.cityMap, columeNum: 2, + onConfirm: (List res, List position){ + print(res); + print(controller.cityMap[res[0]][res[1]][0]); + // controller.state.city = controller.cityMap[res[0]][res[1]][0]; + controller.state.city = res[1]; + controller.update(); + } + + ); + } + showRolePiker(context, Complete_materialLogic controller) { FocusManager.instance.primaryFocus?.unfocus(); Pickers.showSinglePicker(context, diff --git a/circle_app/lib/app/login/login/logic.dart b/circle_app/lib/app/login/login/logic.dart index 34cdf56..76b0b84 100644 --- a/circle_app/lib/app/login/login/logic.dart +++ b/circle_app/lib/app/login/login/logic.dart @@ -42,6 +42,12 @@ class LoginLogic extends GetxController { if (GetUtils.isPhoneNumber(loginPhone) && loginPhone.length == 11) { isPhone = true; } + + + if (sharedPreferences!.containsKey(SharedPreferencesHelper.firstLogin)) { + loginType = 1; + } + update(); } diff --git a/circle_app/lib/app/minefragment/logic.dart b/circle_app/lib/app/minefragment/logic.dart index d5c3847..232bc9d 100644 --- a/circle_app/lib/app/minefragment/logic.dart +++ b/circle_app/lib/app/minefragment/logic.dart @@ -43,6 +43,7 @@ class MinefragmentLogic extends GetxController { } else { isProxy = false; } + getMode(); EventBusManager.on().listen((event) { isVip.value = event.vip; diff --git a/circle_app/lib/app/minefragment/view.dart b/circle_app/lib/app/minefragment/view.dart index 17b1486..37f9d16 100644 --- a/circle_app/lib/app/minefragment/view.dart +++ b/circle_app/lib/app/minefragment/view.dart @@ -64,21 +64,47 @@ class MinefragmentPage extends StatelessWidget { _buildAvatarRow(logic), _friendsRow(logic), GestureDetector( - onTap: () { - showRechargeDialog(logic); + onTapDown: (detail) { + if (detail.localPosition.dy > 100.0) { + showOKToast('相关特权需要在对应功能使用哦~'); + if (logic.isVip.value == 0) { + showRechargeDialog(logic); + } + } else { + showRechargeDialog(logic); + } + }, child: Stack(children: [ logic.isProxy ? MyImageWidget1 : MyImageWidget, Positioned( - top:(Platform.isIOS && Get.statusBarHeight < 60) ? 30.sp : 24.sp, - left: 78.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("会员-微乐园贵宾",style: TextStyle(color: const Color(0xFFFFFFFF),fontSize: 16.sp),), - SizedBox(height: 4.sp,), - Text(logic.vipMsg,style: TextStyle(color: const Color(0x99FFFFFF),fontSize: 13.sp),), - ], + top:24.sp, + child: Container( + width: Get.width, + padding: EdgeInsets.only(left: 20.sp,right: 50.sp), + height: 50.sp, + child: Row( + children: [ + if (!logic.isProxy) + Image.asset(getHomeImage('mine_vip_icon'),width: 46.sp,), + + SizedBox(width: !logic.isProxy ? 10.sp : 60.sp,), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("会员-微乐园贵宾",style: TextStyle(color: const Color(0xFFFFFFFF),fontSize: 16.sp),), + SizedBox(height: 4.sp,), + Text(logic.vipMsg,style: TextStyle(color: const Color(0x99FFFFFF),fontSize: 13.sp),), + ], + ), + ), + if (!logic.isProxy) + SizedBox(width: 10.sp,), + if (!logic.isProxy) + Image.asset(getHomeImage(logic.isVip.value == 0 ? 'open_vip' : 'pay_vip'),height: 28.sp,), + ], + ), )), ],), diff --git a/circle_app/lib/app/userinfo/logic.dart b/circle_app/lib/app/userinfo/logic.dart index c8cd717..c8b80ca 100644 --- a/circle_app/lib/app/userinfo/logic.dart +++ b/circle_app/lib/app/userinfo/logic.dart @@ -332,10 +332,12 @@ class UserBean { int role; int orientation; List interests; + List orientations; double lng; double lat; String? city; bool isOnline; + int hide_wx_num; DateTime? offlineTime; String avatarThumb; @@ -349,6 +351,8 @@ class UserBean { required this.signature, required this.vip, required this.gender, + required this.hide_wx_num, + required this.orientations, required this.role, required this.orientation, required this.interests, @@ -363,6 +367,8 @@ class UserBean { factory UserBean.fromJson(Map json) { return UserBean( id: json['id'], + hide_wx_num: json['hide_wx_num'] ?? 0, + orientations: json['orientations'] ?? [], wx_num: json['wx_num'] ?? '', nickname: json['nickname'], avatar: json['avatar'], diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index f50acba..7de44b8 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -4,6 +4,7 @@ import 'package:circle_app/common/Widgets/base_tip_widget.dart'; import 'package:circle_app/common/colors/app_color.dart'; import 'package:circle_app/common/const.dart'; import 'package:circle_app/main.dart'; +import 'package:circle_app/network/api.dart'; import 'package:circle_app/view/notice.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -23,7 +24,7 @@ class UserinfoPage extends StatefulWidget { } class MyTabbedScreenState extends State - with SingleTickerProviderStateMixin { + with SingleTickerProviderStateMixin, RouteAware { late TabController _tabController; late PageController _pageController; @@ -40,6 +41,33 @@ class MyTabbedScreenState extends State // _tabController } + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); + } + + + void didPopNext() { + print('didPopNext'); + if (logic.userId.isEmpty) { + logic.fetchUserInfo(Api.getUserInfo); + } + } + + ///当前页面进入时触发 + void didPush() { + print('didPopNext'); + + } + void didPop() { + print('didPop'); + } + + void _handleTabChange() { // 在这里可以执行滑动监听后的逻辑操作 // 比如根据当前选中的标签执行其他操作 @@ -51,6 +79,7 @@ class MyTabbedScreenState extends State @override void dispose() { _tabController.dispose(); + routeObserver.unsubscribe(this); super.dispose(); } @@ -83,8 +112,9 @@ class MyTabbedScreenState extends State ? "${logic.userInfoBean!.nickname}" : "个人主页", actionWdiget: logic.isMe ? GestureDetector( - onTap: () { - showAddWxPicker(logic.userInfoBean!.wx_num!.isNotEmpty ?? false); + 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, @@ -240,8 +270,8 @@ class MyTabbedScreenState extends State borderRadius: BorderRadius.circular(17.sp), gradient: const LinearGradient( colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), + Color(0xff06F9FA), + Color(0xffDC5BFD), ], begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -272,8 +302,8 @@ class MyTabbedScreenState extends State borderRadius: BorderRadius.circular(17.sp), gradient: const LinearGradient( colors: [ - Color(0xaaDC5BFD), - Color(0xaa06F9FA), + Color(0xffDC5BFD), + Color(0xff06F9FA), ], begin: Alignment.centerLeft, end: Alignment.centerRight, diff --git a/circle_app/lib/app/visitorlist/view.dart b/circle_app/lib/app/visitorlist/view.dart index e2f084d..8f668f3 100644 --- a/circle_app/lib/app/visitorlist/view.dart +++ b/circle_app/lib/app/visitorlist/view.dart @@ -190,8 +190,8 @@ class VisitorlistPage extends StatelessWidget { Container( margin: EdgeInsets.only(bottom: 40.sp), child: Text( - "TA们也来看过你 \n" - "成为会员查看完整访客信息", + "TA们也喜欢你哦 \n" + "成为会员查看所有圈友信息", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, diff --git a/circle_app/lib/common/Widgets/add_wx_tip.dart b/circle_app/lib/common/Widgets/add_wx_tip.dart index 349799d..d1d9a02 100644 --- a/circle_app/lib/common/Widgets/add_wx_tip.dart +++ b/circle_app/lib/common/Widgets/add_wx_tip.dart @@ -10,8 +10,10 @@ import 'package:get/get.dart'; class AddWxTip extends StatefulWidget { bool isHaveWx; + bool isHidden; + bool isWxHidden; // TODO: add state variables, methods and constructor params - AddWxTip(this.isHaveWx); + AddWxTip(this.isHaveWx, this.isHidden, this.isWxHidden); @override State createState() => _AddWxTipState(); @@ -37,19 +39,16 @@ class _AddWxTipState extends State { body: Center( child: Container( margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: Get.height * 0.65, - child: Column( children: [ Expanded( child: Container( - width:Get.width - 30.sp, + width: Get.width - 30.sp, decoration: BoxDecoration( color: Color(0x99000000), image: DecorationImage( image: AssetImage(getHomeImage("wx_tip_bg")), - fit: BoxFit.fill, ), ), @@ -60,7 +59,6 @@ class _AddWxTipState extends State { children: [ Expanded( child: Container( - child: RawScrollbar( radius: Radius.circular(20), // isAlwaysShown: true, @@ -70,11 +68,15 @@ class _AddWxTipState extends State { child: Column( children: [ Container( - margin: EdgeInsets.only(top: 10.sp,bottom: 5.sp), - - child: Image.asset(getHomeImage('wx_tip_title'),height: 18.sp,)), + margin: EdgeInsets.only( + top: 10.sp, bottom: 5.sp), + child: Image.asset( + getHomeImage('wx_tip_title'), + height: 18.sp, + )), Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + padding: EdgeInsets.only( + left: 15.sp, right: 15.sp), child: Text( desc, style: TextStyle( @@ -85,7 +87,8 @@ class _AddWxTipState extends State { ), )), Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + padding: EdgeInsets.only( + left: 15.sp, right: 15.sp), child: Text( tip, style: TextStyle( @@ -101,22 +104,40 @@ class _AddWxTipState extends State { ), )), Container( - margin: EdgeInsets.only(top: 15.sp, right: 15.sp, left: 15.sp,bottom: 15.sp), + margin: EdgeInsets.only( + top: 15.sp, + right: 15.sp, + left: 15.sp, + bottom: 15.sp), child: Row( // mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded(child: Container()), GestureDetector( onTap: () async { - showOKToast('为了维护站内的社交环境,微信填写必须真实哦~'); + if (widget.isHidden) { - var result = await DioManager() - .post(url: Api.updateWxNum, params: {'type': 1}); - if (result['code'] == 200) { - Future.delayed(Duration(seconds: 2),() {showOKToast('填写微信成功');}); - Get.back(result: '1'); + var result = await DioManager().post( + url: Api.hideWxNum + (widget.isWxHidden ? 0 : 1).toString(), + ); + if (result['code'] == 200) { + showOKToast('操作成功'); + } + Get.back(); + + } else { + showOKToast('为了维护站内的社交环境,微信填写必须真实哦~'); + + var result = await DioManager().post( + url: Api.updateWxNum, + params: {'type': 1}); + if (result['code'] == 200) { + Future.delayed(Duration(seconds: 2), () { + showOKToast('填写微信成功'); + }); + Get.back(result: '1'); + } } - }, child: Container( alignment: Alignment.center, @@ -124,11 +145,16 @@ class _AddWxTipState extends State { width: 100.sp, decoration: BoxDecoration( color: Colors.blue.withOpacity(0.9), - borderRadius: BorderRadius.circular(4.sp)), + borderRadius: + BorderRadius.circular(4.sp)), child: Text( - '手机号即微信', - style: - TextStyle(color: Colors.white, fontSize: 14.sp), + widget.isHidden + ? widget.isWxHidden + ? '取消隐藏微信' + : '隐藏微信' + : '手机号即微信', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), ), ), ), @@ -137,7 +163,7 @@ class _AddWxTipState extends State { onTap: () { showOKToast('为了维护站内的社交环境,微信填写必须真实哦~'); Get.back(); - Get.toNamed( + Get.toNamed( AppRoutes.Complete_materialPage, arguments: "user", ); @@ -150,11 +176,12 @@ class _AddWxTipState extends State { alignment: Alignment.center, decoration: BoxDecoration( gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(4.sp)), + borderRadius: + BorderRadius.circular(4.sp)), child: Text( - widget.isHaveWx ? ' 更新微信 ':' 填写微信 ', - style: - TextStyle(color: Colors.white, fontSize: 14.sp), + widget.isHaveWx ? ' 更新微信 ' : ' 填写微信 ', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), ), ), ), @@ -167,14 +194,13 @@ class _AddWxTipState extends State { ), ), ), - GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Get.back(); }, child: Container( - margin: EdgeInsets.only(bottom: 5.sp,top: 10.sp), + margin: EdgeInsets.only(bottom: 5.sp, top: 10.sp), alignment: Alignment.center, child: Image.asset( getHomeImage('wx_close'), @@ -196,7 +222,5 @@ class _AddWxTipState extends State { title = data1['title'] ?? ''; tip = data1['tip'] ?? ''; setState(() {}); - - } } diff --git a/circle_app/lib/common/Widgets/base_tip_widget.dart b/circle_app/lib/common/Widgets/base_tip_widget.dart index daed097..ef06e71 100644 --- a/circle_app/lib/common/Widgets/base_tip_widget.dart +++ b/circle_app/lib/common/Widgets/base_tip_widget.dart @@ -272,6 +272,6 @@ showJoinCiclePiker(String cicleId, String pirce, String oldPrice, int type, -Future showAddWxPicker(bool isHaveWx) { - return Get.bottomSheet(AddWxTip(isHaveWx),isScrollControlled: true,enableDrag: false); +Future showAddWxPicker(bool isHaveWx,{bool isHidden = false, bool isWxHidden = false}) { + return Get.bottomSheet(AddWxTip(isHaveWx,isHidden,isWxHidden),isScrollControlled: true,enableDrag: false); } \ No newline at end of file diff --git a/circle_app/lib/common/Widgets/open_vip_tip/view.dart b/circle_app/lib/common/Widgets/open_vip_tip/view.dart index da26590..069efda 100644 --- a/circle_app/lib/common/Widgets/open_vip_tip/view.dart +++ b/circle_app/lib/common/Widgets/open_vip_tip/view.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:circle_app/app/minefragment/logic.dart'; import 'package:circle_app/util/paymentUtil.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; @@ -18,6 +19,8 @@ class Open_vip_tipPage extends StatelessWidget { final logic = Get.put(Open_vip_tipLogic()); final state = Get.find().state; + final mineLogic = Get.find(); + @override Widget build(BuildContext context) { List vipFuncList = [ @@ -231,7 +234,7 @@ class Open_vip_tipPage extends StatelessWidget { Color(0xffD739EA) ])), child: Text( - '立即解锁', + mineLogic.isVip.toInt() > 0 ? '续费会员' : '立即开通', style: TextStyle(color: Colors.white, fontSize: 16.sp), ), diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index d657443..f8c0b99 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'dart:convert'; +import 'package:circle_app/app/home/logic.dart'; import 'package:circle_app/app/splash/binding.dart'; import 'package:circle_app/util/paymentUtil.dart'; import 'package:circle_app/common/values/pushconfig.dart'; @@ -110,6 +111,8 @@ loginIM(String userId, String sig) async { if (setC2CReceiveMessageOptRes.code == 0) { //设置成功 } + var logic = Get.find(); + logic.getUnreadSize(); } } @@ -475,6 +478,7 @@ class _MyAppState extends State with WidgetsBindingObserver { // [建议配置,详见此部分](https://cloud.tencent.com/document/product/269/70746#callback) listener: V2TimSDKListener(onConnectSuccess: () { print('IM登录成功'); + // loginIM(); })); } diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index 3c2470a..57fba28 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -305,5 +305,8 @@ class Api { //是否置顶圈子 static const circleTop = '/up-service/interest/top'; + //是否隐藏微信号 + static const hideWxNum = '/user-service/hideWxNum/'; + } \ 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 fa48ac2..7fe487c 100644 --- a/circle_app/lib/network/dio_manager.dart +++ b/circle_app/lib/network/dio_manager.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:circle_app/common/errorcode.dart'; import 'package:circle_app/util/util.dart'; import 'package:dio/dio.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -45,14 +46,16 @@ class DioManager { // 接收数据的最长时限 receiveTimeout: const Duration(seconds: 300), )); - _dio!.interceptors.add(LogInterceptor(responseBody: true, + _dio!.interceptors.add(LogInterceptor( + responseBody: true, )); - // _dio!.interceptors.add(ConnectivityInterceptor()); + // _dio!.interceptors.add(ConnectivityInterceptor()); } - Future download(String urlPath,String savePath,ProgressCallback progressCallback)async{ - - return await _dio!.download(urlPath, savePath, onReceiveProgress : progressCallback); + Future download(String urlPath, String savePath, + ProgressCallback progressCallback) async { + return await _dio! + .download(urlPath, savePath, onReceiveProgress: progressCallback); } /// get请求 @@ -74,14 +77,15 @@ class DioManager { } /// post 请求 - Future post({required String url, - Map? params, - bool isAddTokenInHeader = true, - bool isShowErrorToast = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress}) async { + Future post( + {required String url, + Map? params, + bool isAddTokenInHeader = true, + bool isShowErrorToast = true, + FormData? formData, + CancelToken? cancelToken, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress}) async { return await requestHttp(url, method: DioMethod.post, isShowErrorToast: isShowErrorToast, @@ -116,7 +120,6 @@ class DioManager { ); } - Future delete({ required String url, Map? params, @@ -140,18 +143,16 @@ class DioManager { ); } - - /// Dio request 方法 Future requestHttp(String url, {DioMethod method = DioMethod.get, - Map? params, - bool isShowErrorToast = true, - bool isAddTokenInHeader = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress}) async { + Map? params, + bool isShowErrorToast = true, + bool isAddTokenInHeader = true, + FormData? formData, + CancelToken? cancelToken, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress}) async { const methodValues = { DioMethod.get: 'get', DioMethod.post: 'post', @@ -160,32 +161,28 @@ class DioManager { }; var connectivityResult = await Connectivity().checkConnectivity(); - if(connectivityResult == ConnectivityResult.none){ - // showToast(""); + if (connectivityResult == ConnectivityResult.none) { + // showToast(""); return {'code': 404, 'msg': '请检查网络连接是否正常'}; } - try { Response response; var options = Options(); bool isAgreemement = await getAgreemement(); - if(isAgreemement){ - options = Options( - method: methodValues[method], headers: { + if (isAgreemement) { + options = Options(method: methodValues[method], headers: { "Authorization": await getAuthorization(), 'VersionName': await getVersionName(), 'VersionCode': await getVersionCode(), - 'Platform': Platform.isIOS ? '1' : '0', - 'OsVersion': await getDeviceId(), + 'OsVersion': await getDeviceId(), 'Imei': await getImei(), 'Brand': await getBrand(), }); - }else{ - options = Options( - method: methodValues[method], headers: { + } else { + options = Options(method: methodValues[method], headers: { "Authorization": await getAuthorization(), 'VersionName': await getVersionName(), 'VersionCode': await getVersionCode(), @@ -193,7 +190,6 @@ class DioManager { }); } - print(">>>>>$params"); /// 不同请求方法,不同的请求参数,按实际项目需求分. @@ -201,22 +197,23 @@ class DioManager { /// 注意: 只有 post 方法支持发送 FormData. switch (method) { case DioMethod.get: - response = - await _dio!.request(url, queryParameters: params, options: options); + response = await _dio! + .request(url, queryParameters: params, options: options); break; case DioMethod.post: - response = await _dio!.post( - url, data: params, cancelToken: cancelToken, options: options); + response = await _dio!.post(url, + data: params, cancelToken: cancelToken, options: options); break; case DioMethod.put: - response = await _dio!.put(url, data: json.encode(params), options: options); + response = + await _dio!.put(url, data: json.encode(params), options: options); break; case DioMethod.delete: - response = - await _dio!.delete(url, queryParameters: params, options: options); + response = await _dio! + .delete(url, queryParameters: params, options: options); break; default: - // 如果有formData参数,说明是传文件,忽略params的参数 + // 如果有formData参数,说明是传文件,忽略params的参数 if (formData != null) { response = await _dio!.post(url, data: formData, @@ -233,6 +230,24 @@ class DioManager { Map responseMap = json.decode(jsonStr); if (responseMap["code"] == 5003 || responseMap["code"] == 30003) { pushLoginPage(); + } else { + switch (responseMap["code"]) { + case 1001: + case 4000: + case 4001: + case 4002: + case 4003: + case 4004: + case 4100: + case 4101: + case 4102: + case 5002: + case 5001: + case 5000: + pushLoginPage(); + showOKToast(responseMap['msg']); + break; + } } return responseMap; // switch(responseMap["code"]){ @@ -307,12 +322,12 @@ class BaseResponse { BaseResponse({required this.code, required this.msg, required this.data}); - isSuccess(){ - return code==200; + isSuccess() { + return code == 200; } - factory BaseResponse.fromJson(Map json, - T Function(dynamic) fromJsonData) { + factory BaseResponse.fromJson( + Map json, T Function(dynamic) fromJsonData) { dynamic dataJson = json['data']; T? data; @@ -320,7 +335,7 @@ class BaseResponse { if (dataJson is String) { // 处理 dataJson 是 String 类型的情况 // 例如,可以直接将其赋值给 data 变量 - data = null; // 根据你的需求修改赋值语句 + data = null; // 根据你的需求修改赋值语句 } else if (dataJson is Map) { // 处理 dataJson 是 Map 类型的情况 if (fromJsonData != null) { @@ -330,7 +345,7 @@ class BaseResponse { } } else if (dataJson is List) { data = fromJsonData(dataJson); - }else { + } else { throw Exception('无效的数据格式。期望是 String 或 Map 类型。'); } } @@ -341,9 +356,8 @@ class BaseResponse { data: data, ); } - - } + class ConnectivityInterceptor extends Interceptor { @override Future onRequest( @@ -360,7 +374,6 @@ class ConnectivityInterceptor extends Interceptor { } } - class QnTokenData { final String token; final String cdnPrefix; @@ -374,5 +387,3 @@ class QnTokenData { ); } } - - diff --git a/circle_app/lib/util/SharedPreferencesHelper.dart b/circle_app/lib/util/SharedPreferencesHelper.dart index 078c1f9..79fee79 100644 --- a/circle_app/lib/util/SharedPreferencesHelper.dart +++ b/circle_app/lib/util/SharedPreferencesHelper.dart @@ -17,6 +17,7 @@ class SharedPreferencesHelper { static const AGREEMENT = 'agreement'; + static const String firstLogin = 'firstlogin'; static SharedPreferencesHelper? _instance; static SharedPreferences? _preferences; diff --git a/circle_app/lib/util/util.dart b/circle_app/lib/util/util.dart index 8c9aeda..003c705 100644 --- a/circle_app/lib/util/util.dart +++ b/circle_app/lib/util/util.dart @@ -174,9 +174,13 @@ pushLoginPage() async { sharedPreferences.clear(); sharedPreferences.setString(SharedPreferencesHelper.LOGINPHONE, loginPhone); sharedPreferences.setBool(SharedPreferencesHelper.AGREEMENT, agreement); + sharedPreferences.setString(SharedPreferencesHelper.firstLogin, '1'); }); - Get.offAllNamed(AppRoutes.Login); + if (AppRoutes.Login != Get.currentRoute) { + Get.offAllNamed(AppRoutes.Login); + } + } String filterSensitiveWords(String input, List sensitiveWords) { diff --git a/circle_app/lib/view/notice.dart b/circle_app/lib/view/notice.dart index 92b0970..10d115a 100644 --- a/circle_app/lib/view/notice.dart +++ b/circle_app/lib/view/notice.dart @@ -14,7 +14,7 @@ void showFloatingButtonOverlay( late OverlayEntry overlayEntry; bool showMessage = false; - int countdownSeconds = 8; // 倒计时秒数 + int countdownSeconds = 5; // 倒计时秒数 // 创建 Timer late Timer countdownTimer;