Browse Source

no message

dev-2.0
ZHR007 2 months ago
parent
commit
773593704b
20 changed files with 843 additions and 1047 deletions
  1. 2
      android/app/src/main/res/xml/network_security_config.xml
  2. 21
      lib/controller/discover/room_controller.dart
  3. 12
      lib/controller/mine/auth_controller.dart
  4. 120
      lib/controller/mine/league_controller.dart
  5. 11
      lib/controller/mine/mine_controller.dart
  6. 22
      lib/controller/mine/user_controller.dart
  7. 151
      lib/controller/setting/setting_controller.dart
  8. 279
      lib/controller/setting/spread_controller.dart
  9. 118
      lib/controller/setting/task_controller.dart
  10. 14
      lib/model/mine/chat_static_data.dart
  11. 42
      lib/model/mine/user_base_data.dart
  12. 6
      lib/network/api_urls.dart
  13. 9
      lib/network/user_api.dart
  14. 77
      lib/network/user_api.g.dart
  15. 6
      lib/pages/discover/discover_page.dart
  16. 69
      lib/pages/main/update_dialog.dart
  17. 13
      lib/pages/mine/mine_page.dart
  18. 225
      lib/pages/setting/match_league_page.dart
  19. 302
      lib/pages/setting/match_spread_page.dart
  20. 391
      lib/pages/setting/match_task_page.dart

2
android/app/src/main/res/xml/network_security_config.xml

@ -11,6 +11,6 @@
</tls-config>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">dating-agency-test.oss-accelerate.aliyuncs.com</domain>
<domain includeSubdomains="true">dating-agency-download-test.qniao.cn</domain>
</domain-config>
</network-security-config>

21
lib/controller/discover/room_controller.dart

@ -9,6 +9,7 @@ import 'package:dating_touchme_app/model/rtc/rtc_channel_data.dart';
import 'package:dating_touchme_app/model/rtc/rtc_channel_detail.dart';
import 'package:dating_touchme_app/network/network_service.dart';
import 'package:dating_touchme_app/pages/mine/edit_info_page.dart';
import 'package:dating_touchme_app/pages/setting/match_league_page.dart';
import 'package:dating_touchme_app/rtc/rtc_manager.dart';
import 'package:dating_touchme_app/rtc/rtm_manager.dart';
import 'package:dating_touchme_app/service/live_chat_message_service.dart';
@ -143,7 +144,6 @@ class RoomController extends GetxController with WidgetsBindingObserver {
if (isLive.value) {
return;
}
//
try {
// 使 Get.find 使 instance
@ -749,7 +749,12 @@ class RoomController extends GetxController with WidgetsBindingObserver {
}
}
void registerMatch() async {
void registerMatch(int type) async {
if (GlobalData().userData!.profilePhoto == null || GlobalData().userData!.profilePhoto!.isEmpty) {
SmartDialog.showToast('请先上传头像');
await Get.to(() => EditInfoPage());
return;
}
if (GlobalData().userData!.auditProfilePhoto != null) {
showGeneralDialog(
context: Get.context!,
@ -763,18 +768,16 @@ class RoomController extends GetxController with WidgetsBindingObserver {
);
return;
}
if (GlobalData().userData!.profilePhoto == null || GlobalData().userData!.profilePhoto!.isEmpty) {
SmartDialog.showToast('请先上传头像');
await Get.to(() => EditInfoPage());
return;
}
if(GlobalData().userData!.identityCard == null || GlobalData().userData!.identityCard!.isEmpty){
SmartDialog.showToast('请先进行实名认证');
await Get.to(() => RealNamePage(type: 1));
return;
}
await Get.to(() => MatchSpreadPage());
matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
if(type == 1){
Get.to(() => MatchLeaguePage());
} else {
await createRtcChannel();
}
}
/// RTC

12
lib/controller/mine/auth_controller.dart

@ -116,18 +116,16 @@ class AuthController extends GetxController {
GlobalData().userData!.name = name.value;
SmartDialog.showToast('认证成功');
getInfo();
final RoomController _roomController;
_roomController = Get.isRegistered<RoomController>()
final RoomController roomController = Get.isRegistered<RoomController>()
? Get.find<RoomController>()
: Get.put(RoomController());
_roomController.matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
roomController.matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
final HomeController hController = Get.find<HomeController>();
hController.refreshRecommendData();
hController.refreshNearbyData();
if(type == 1){
if(type == 1 && !GlobalData().userData!.matchmakerFlag!){
// ;
Get.off(() => MatchSpreadPage());
} else {
@ -139,13 +137,9 @@ class AuthController extends GetxController {
} catch (e) {
// SmartDialog.showToast('网络请求失败,请检查网络连接');
// SmartDialog.showToast(response.data.message);
} finally {
}
}
getInfo() async {
final result = await _userApi.getMarriageInformationDetail();
// print(result.data);

120
lib/controller/mine/league_controller.dart

@ -1,110 +1,50 @@
import 'dart:async';
import 'package:dating_touchme_app/model/mine/chat_static_data.dart';
import 'package:dating_touchme_app/pages/setting/match_spread_page.dart';
import 'package:get/get.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import '../../network/user_api.dart';
import '../../pages/setting/match_spread_page.dart';
import '../global.dart';
class LeagueController extends GetxController {
late UserApi _userApi;
final phone = ''.obs;
//
final phoneNumber = ''.obs;
//
final verificationCode = ''.obs;
//
final isSendingCode = false.obs;
//
final countdownSeconds = 0.obs;
final agree = false.obs;
final genderCode = 0.obs;
final consumption = ChatStaticData(liveDurationMins: 0).obs;
final hours = 0.obs;
final canApply = false.obs;
@override
void onInit() {
super.onInit();
// UserApi
_userApi = Get.find<UserApi>();
phone.value = GlobalData().userData!.phone!;
}
//
Future<void> getVerificationCode() async {
if (countdownSeconds.value > 0) {
return;
}
//
if (phoneNumber.value.isEmpty || phoneNumber.value.length != 11) {
SmartDialog.showToast('请输入正确的手机号');
return;
}
isSendingCode.value = true;
try {
//
final params = {
'purpose': 2, //
'verifiableAccount': phoneNumber.value,
'verifiableAccountType': 1, //
};
// UserApi中的验证码接口
final response = await _userApi.getVerificationCode(params);
//
if (response.data.isSuccess) {
// 使
SmartDialog.showToast('验证码发送成功');
//
countdownSeconds.value = 60;
startCountdown();
} else {
SmartDialog.showToast(response.data.message);
}
} catch (e) {
SmartDialog.showToast('网络请求失败,请重试');
} finally {
isSendingCode.value = false;
}
genderCode.value = GlobalData().userData!.genderCode!;
fetchData();
}
//
void startCountdown() {
Future.delayed(const Duration(seconds: 1), () {
if (countdownSeconds.value > 0) {
countdownSeconds.value--;
startCountdown();
} else {
isSendingCode.value = false;
}
});
}
fetchData() async {
try{
final response = await _userApi.getChatStaticsInfo();
if (response.data.isSuccess && response.data.data != null) {
consumption.value = response.data.data!;
}
final result = await _userApi.getMatchmakerRequirement();
if (result.data.isSuccess && result.data.data != null) {
final roseList = result.data.data!;
hours.value = roseList[0].liveDurationHours!;
}
canApply.value = consumption.value.liveDurationMins! >= hours.value * 60;
} catch (e) {
print('spread: $e');
}
}
Future<void> submitInfo() async {
if(isSendingCode.value){
return;
}
if (phoneNumber.value.isEmpty) {
SmartDialog.showToast('请输入手机号');
return;
}
if (verificationCode.value.isEmpty) {
SmartDialog.showToast('请输入验证码');
return;
}
isSendingCode.value = true;
try {
//
SmartDialog.showLoading(msg: '处理中');
final param = { 'phone': phoneNumber.value, 'captcha': verificationCode.value};
final response = await _userApi.updatePhone(param);
//
if (response.data.isSuccess) {
SmartDialog.showToast('提交成功');
Get.off(() => MatchSpreadPage());
} else {
SmartDialog.showToast(response.data.message);
}
} catch (e) {
SmartDialog.showToast('网络请求失败,请检查网络连接');
} finally {
SmartDialog.dismiss();
isSendingCode.value = true;
applyMatcher(){
if(canApply.value){
Get.off(() => MatchSpreadPage());
} else {
Get.back();
}
}

11
lib/controller/mine/mine_controller.dart

@ -9,6 +9,7 @@ import 'package:dating_touchme_app/pages/mine/real_name_page.dart';
import 'package:dating_touchme_app/pages/mine/rose_page.dart';
import 'package:dating_touchme_app/pages/mine/user_help_center_page.dart';
import 'package:dating_touchme_app/pages/setting/match_spread_page.dart';
import 'package:dating_touchme_app/pages/setting/match_task_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
@ -24,6 +25,7 @@ class MineController extends GetxController {
final countData = UserCountData(friendNum: 0, friendApplyNum: 0, visitorNum:0).obs;
late UserApi _userApi;
var matchmakerFlag = false.obs;
@override
void onInit() {
@ -31,9 +33,10 @@ class MineController extends GetxController {
userData.value = GlobalData().userData;
userId.value = GlobalData().userId;
_userApi = Get.find<UserApi>();
matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
}
void registerMatch() async {
void registerMatch(int type) async {
if (GlobalData().userData!.auditProfilePhoto != null) {
showGeneralDialog(
context: Get.context!,
@ -57,7 +60,11 @@ class MineController extends GetxController {
await Get.to(() => RealNamePage(type: 1));
return;
}
await Get.to(() => MatchSpreadPage());
if(type == 1){
await Get.to(() => MatchSpreadPage());
} else if(type == 2){
Get.to(() => MatchTaskPage());
}
}
}

22
lib/controller/mine/user_controller.dart

@ -98,10 +98,18 @@ class UserController extends GetxController {
if (result.data.isSuccess) {
if(result.data.data == null){
var information = UserData();
information.matchmakerFlag = baseInfo.matchmakerFlag;
if(information.matchmakerFlag!){
information.matchmakerType = baseInfo.matchmakerType;
if(baseInfo.liveMatchmaker != null && baseInfo.liveMatchmaker!.enable!){
information.matchmakerFlag = true;
information.matchmakerType = baseInfo.liveMatchmaker!.type;
} else {
information.matchmakerFlag = false;
}
// information.matchmakerFlag = baseInfo.matchmakerFlag;
// if(information.matchmakerFlag!){
// information.matchmakerType = baseInfo.matchmakerType;
// }
information.realName = baseInfo.realName;
information.phone = baseInfo.phone;
GlobalData().userData = information;
@ -115,9 +123,11 @@ class UserController extends GetxController {
return;
}
final information = result.data.data!;
information.matchmakerFlag = baseInfo.matchmakerFlag;
if(information.matchmakerFlag!){
information.matchmakerType = baseInfo.matchmakerType;
if(baseInfo.liveMatchmaker != null && baseInfo.liveMatchmaker!.enable!){
information.matchmakerFlag = true;
information.matchmakerType = baseInfo.liveMatchmaker!.type;
} else {
information.matchmakerFlag = false;
}
information.realName = baseInfo.realName;
information.phone = baseInfo.phone;

151
lib/controller/setting/setting_controller.dart

@ -5,6 +5,7 @@ import 'package:dating_touchme_app/controller/discover/room_controller.dart';
import 'package:dating_touchme_app/controller/overlay_controller.dart';
import 'package:dating_touchme_app/im/im_manager.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/pages/main/update_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -50,10 +51,12 @@ class SettingController extends GetxController {
Future<void> checkVersion() async {
try {
final response = await _userApi.getAppVersionInfo(os: 1, code: int.parse(buildNumber.value));
print(response);
if (response.data.isSuccess && response.data.data != null) {
AppVersion version = response.data.data!;
_showUpdateDialog(version);
showDialog(
context: Get.context!,
builder: (context) => UpdateDialog(version: version)
);
}
} catch (e) {
print('检测版本跟新失败: $e');
@ -100,149 +103,5 @@ class SettingController extends GetxController {
GlobalData().logout();
}
void updateApplication(){
}
// dialog
void _showUpdateDialog(AppVersion version){
Navigator.of(Get.context!).push(TDSlidePopupRoute(
modalBarrierColor: TDTheme.of(Get.context!).fontGyColor2,
slideTransitionFrom: SlideTransitionFrom.center,
builder: (context) {
return Material(
color: Colors.transparent,
child: Container(
color: Colors.transparent,
width: 299.w,
padding: EdgeInsets.only(top: 56.w),
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
width: 299.w,
padding: EdgeInsets.only(
top: 147.w,
left: 30.w,
right: 30.w,
bottom: 25.w
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
version.title!,
style: TextStyle(
fontSize: 16.w,
fontWeight: FontWeight.w500
),
),
SizedBox(height: 14.w,),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 204.w,
child: Text(
version.description!,
style: TextStyle(
fontSize: 12.w,
),
),
)
],
),
SizedBox(height: 32.w,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 113.w,
height: 40.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(9.w)),
color: const Color.fromRGBO(245, 245, 245, 1)
),
child: Center(
child: Text(
"暂不更新",
style: TextStyle(
fontSize: 15.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
),
).onTap((){
Navigator.of(context).pop();
}),
Container(
width: 113.w,
height: 40.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(9.w)),
color: const Color.fromRGBO(245, 245, 245, 1),
gradient: const LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight, // CSS 90deg
colors: [
Color.fromRGBO(131, 89, 255, 1), // rgba(131, 89, 255, 1)
Color.fromRGBO(61, 138, 224, 1), // rgba(61, 138, 224, 1)
],
),
),
child: Center(
child: Text(
"立即升级",
style: TextStyle(
fontSize: 15.w,
fontWeight: FontWeight.w500,
color: Colors.white
),
),
),
).onTap((){
updateApplication();
}),
],
)
],
),
),
Positioned(
left: 0,
top: -56.w,
child: Image.asset(
Assets.imagesUpdataBg,
width: 299.w,
),
),
Positioned(
left: 11.w,
top: -14.w,
child: Image.asset(
Assets.imagesUpdataIcon,
width: 36.w,
),
),
Positioned(
left: 43.w,
top: 29.w,
child: Image.asset(
Assets.imagesUpdataFont,
width: 76.w,
),
)
],
),
),
);
}));
}
}

279
lib/controller/setting/spread_controller.dart

@ -1,17 +1,17 @@
import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/model/mine/rose_data.dart';
import 'package:dating_touchme_app/model/mine/chat_static_data.dart';
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:dating_touchme_app/network/user_api.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
class SpreadController extends GetxController with WidgetsBindingObserver {
class SpreadController extends GetxController {
// UserApi实例
late UserApi _userApi;
final roseList = <RoseData>[].obs;
final roseList = <MatchmakerRequirement>[].obs;
final loading = true.obs;
final roseNum = 0.obs;
final payChecked = true.obs;
@ -20,8 +20,8 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
final enableIndex = (-1).obs;
final Fluwx fluwx = Fluwx();
final matchmakerFlag = false.obs;
final button = '去相亲'.obs;
bool canApply = false;
final button = '立即申请'.obs;
final canApply = false.obs;
String paymentOrderId = '';
final revenue = [
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
@ -29,48 +29,109 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
].obs;
final userData = GlobalData().userData.obs;
final userId = GlobalData().userId.obs;
final consumption = ChatStaticData().obs;
// final nowBankCard = BankCardData().obs;
// changePayActive(int index){
// if(index < enableIndex.value && enableIndex.value >= 0){
// return;
// }
// activePay.value = index;
// if(matchmakerFlag.value){
// if(activePay.value > enableIndex.value){
// button.value = '立即升级';
// } else if(activePay.value == 0){
// button.value = '去直播';
// } else {
// button.value = '立即续费';
// }
// } else if(activePay.value == 0){
// button.value = canApply.value ? '免费加入' : '去相亲';
// } else {
// button.value = '立即加入';
// }
// //
// if(roseList[activePay.value].type == 88804){
// revenue.value = [
// {'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
// ];
// } else if(roseList[activePay.value].type == 88803){
// revenue.value = [
// {'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'},
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'},
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
// ];
// } else if(roseList[activePay.value].type == 88802){
// revenue.value = [
// {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
// // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
// ];
// } else if(roseList[activePay.value].type == 88801){
// revenue.value = [
// {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
// // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
// ];
// }
//
// }
//
final countdownSeconds = 0.obs;
@override
void onInit() {
super.onInit();
// WidgetsBinding.instance.addObserver(this);
_userApi = Get.find<UserApi>();
if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
matchmakerFlag.value = true;
}
initDataList();
}
changePayActive(int index){
if(index < enableIndex.value && enableIndex.value >= 0){
return;
}
activePay.value = index;
if(matchmakerFlag.value){
if(activePay.value > enableIndex.value){
button.value = '立即升级';
} else if(activePay.value == 0){
button.value = '去直播';
} else {
button.value = '立即续费';
canApply.value = false;
int hours = roseList[activePay.value].liveDurationHours!;
int rose = roseList[activePay.value].liveConsumptionAmount!;
if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
if(rose <= 0){
canApply.value = true;
} else if(consumption.value.liveConsumptionAmount! >= rose){
canApply.value = true;
}
} else if(activePay.value == 0){
button.value = canApply ? '免费加入' : '去相亲';
} else {
button.value = '立即加入';
}
button.value = canApply.value ? '立即申请' : '条件不满足';
//
if(roseList[activePay.value].subCategory == 88804){
if(roseList[activePay.value].type == 1){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
} else if(roseList[activePay.value].subCategory == 88803){
} else if(roseList[activePay.value].type == 2){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
} else if(roseList[activePay.value].subCategory == 88802){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
} else if(roseList[activePay.value].subCategory == 88801){
} else if(roseList[activePay.value].type == 3){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
@ -80,85 +141,78 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
}
}
//
final countdownSeconds = 0.obs;
@override
void onInit() {
super.onInit();
WidgetsBinding.instance.addObserver(this);
_userApi = Get.find<UserApi>();
if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
matchmakerFlag.value = true;
}
initDataList();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if(state == AppLifecycleState.resumed){
if (countdownSeconds.value > 0) {
startCountdown();
}
}
}
// @override
// void didChangeAppLifecycleState(AppLifecycleState state) {
// if(state == AppLifecycleState.resumed){
// if (countdownSeconds.value > 0) {
// startCountdown();
// }
// }
// }
//
void startCountdown() async {
try{
bool audit = false;
if(matchmakerFlag.value){
//
} else {
//
final response = await _userApi.getAuditMatchmaker();
if (response.data.isSuccess && response.data.data != null) {
audit = response.data.data['needAudit'];
}
}
if(audit){
Future.delayed(const Duration(milliseconds: 300), () {
if (countdownSeconds.value > 0) {
countdownSeconds.value--;
startCountdown();
}
});
} else {
countdownSeconds.value = 0;
GlobalData().userData!.matchmakerFlag = true;
GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory;
Get.back(result: 1);
}
} catch (e) {
print('87$e');
}
}
// void startCountdown() async {
// try{
// bool audit = false;
// if(matchmakerFlag.value){
// //
//
// } else {
// //
// final response = await _userApi.getAuditMatchmaker();
// if (response.data.isSuccess && response.data.data != null) {
// audit = response.data.data['needAudit'];
// }
// }
// if(audit){
// Future.delayed(const Duration(milliseconds: 300), () {
// if (countdownSeconds.value > 0) {
// countdownSeconds.value--;
// startCountdown();
// }
// });
// } else {
// countdownSeconds.value = 0;
// GlobalData().userData!.matchmakerFlag = true;
// GlobalData().userData!.matchmakerType = roseList[activePay.value].type;
// Get.back(result: 1);
// }
// } catch (e) {
// print('87$e');
// }
// }
@override
void onClose() {
WidgetsBinding.instance.removeObserver(this);
// WidgetsBinding.instance.removeObserver(this);
super.onClose();
}
initDataList() async {
try{
final result = await _userApi.getMatchmakerFee();
loading.value = true;
final result = await _userApi.getMatchmakerRequirement();
if (result.data.isSuccess && result.data.data != null) {
roseList.value = result.data.data!.records;
roseList.value = result.data.data!;
}
final response = await _userApi.getChatStaticsInfo();
if (response.data.isSuccess && response.data.data != null) {
final data = response.data.data!;
consumption.value = response.data.data!;
if(roseList[activePay.value].liveDurationHours != null){
int hours = int.parse(roseList[activePay.value].liveDurationHours!);
if(hours > 0 && data.liveDurationMins >= 60 * hours && !matchmakerFlag.value){
canApply = true;
int hours = roseList[activePay.value].liveDurationHours!;
int rose = roseList[activePay.value].liveConsumptionAmount!;
if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
if(rose <= 0){
canApply.value = true;
} else if(consumption.value.liveConsumptionAmount! >= rose){
canApply.value = true;
}
}
}
}
if(matchmakerFlag.value){
final index = roseList.indexWhere((item) => item.subCategory == GlobalData().userData!.matchmakerType!);
final index = roseList.indexWhere((item) => item.type == GlobalData().userData!.matchmakerType!);
enableIndex.value = index >= 0 ? index : 0;
changePayActive(enableIndex.value);
} else {
@ -166,57 +220,26 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
}
} catch (e) {
print('spread: $e');
} finally {
loading.value = false;
}
}
submitOrder() async {
if(activePay.value == 0 && !canApply){
Get.back();
if(!canApply.value){
return;
}
try {
var matchmakerOrderType = 1;
var matchmakerType = roseList[activePay.value].subCategory;
if(GlobalData().userData!.matchmakerFlag!){
if(matchmakerType != GlobalData().userData!.matchmakerType){
matchmakerOrderType = 2;
} else {
matchmakerOrderType = 3;
}
} else {
await _userApi.applyMatchmaker({
"phone": GlobalData().userData!.phone,
"name": GlobalData().userData!.name
});
}
final response = await _userApi.submitMatchmakerOrder({
"productSpecId": roseList[activePay.value].productSpecId,
"matchmakerOrderType": matchmakerOrderType
final response = await _userApi.applyLiveMatchmaker({
"behavior": GlobalData().userData!.matchmakerFlag! ? 2 : 1,
"type": roseList[activePay.value].type
});
if (response.data.isSuccess && response.data.data != null) {
final data = response.data.data;
if(data!.freeSettlement!){
SmartDialog.showToast('加入成功');
GlobalData().userData!.matchmakerFlag = true;
GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory;
Get.back(result: 1);
} else {
paymentOrderId = data.paymentOrderId!;
fluwx.open(target: MiniProgram(
username: 'gh_9ea8d46add6f',
path: "pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data.paymentOrderId}&url=match-fee",
miniProgramType: WXMiniProgramType.preview
));
countdownSeconds.value = 3;
SmartDialog.showToast('开始支付');
}
} else {
//
SmartDialog.showToast(response.data.message ?? '网络异常');
if (response.data.isSuccess) {
SmartDialog.showToast('申请成功,请等待审核');
Get.back();
}
} catch (e) {
SmartDialog.showToast('下单失败');
SmartDialog.showToast('申请失败');
}
}

118
lib/controller/setting/task_controller.dart

@ -1,9 +1,6 @@
import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/model/mine/chat_static_data.dart';
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:dating_touchme_app/network/user_api.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
class TaskController extends GetxController {
@ -11,135 +8,30 @@ class TaskController extends GetxController {
// UserApi实例
late UserApi _userApi;
final roseList = <MatchmakerRequirement>[].obs;
final roseNum = 0.obs;
final payChecked = true.obs;
final activePay = 0.obs;
final enableIndex = (-1).obs;
final Fluwx fluwx = Fluwx();
final matchmakerFlag = false.obs;
final button = '立即申请'.obs;
final canApply = false.obs;
String paymentOrderId = '';
final revenue = [
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
].obs;
final userData = GlobalData().userData.obs;
final userId = GlobalData().userId.obs;
final consumption = ChatStaticData().obs;
final countdownSeconds = 0.obs;
final loading = true.obs;
@override
void onInit() {
super.onInit();
_userApi = Get.find<UserApi>();
if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
matchmakerFlag.value = true;
}
initDataList();
}
changePayActive(int index){
if(index < enableIndex.value && enableIndex.value >= 0){
return;
}
activePay.value = index;
canApply.value = false;
int hours = roseList[activePay.value].liveDurationHours!;
int rose = roseList[activePay.value].liveConsumptionAmount!;
if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
if(rose <= 0){
canApply.value = true;
} else if(consumption.value.liveConsumptionAmount! >= rose){
canApply.value = true;
}
}
button.value = canApply.value ? '立即申请' : '条件不满足';
//
if(roseList[activePay.value].type == 1){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
} else if(roseList[activePay.value].type == 2){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
} else if(roseList[activePay.value].type == 3){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
}
}
@override
void onClose() {
// WidgetsBinding.instance.removeObserver(this);
super.onClose();
}
initDataList() async {
try{
loading.value = true;
final result = await _userApi.getMatchmakerRequirement();
if (result.data.isSuccess && result.data.data != null) {
roseList.value = result.data.data!;
}
final response = await _userApi.getChatStaticsInfo();
if (response.data.isSuccess && response.data.data != null) {
consumption.value = response.data.data!;
if(roseList[activePay.value].liveDurationHours != null){
int hours = roseList[activePay.value].liveDurationHours!;
int rose = roseList[activePay.value].liveConsumptionAmount!;
if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
if(rose <= 0){
canApply.value = true;
} else if(consumption.value.liveConsumptionAmount! >= rose){
canApply.value = true;
}
}
}
}
if(matchmakerFlag.value){
final index = roseList.indexWhere((item) => item.type == GlobalData().userData!.matchmakerType!);
enableIndex.value = index >= 0 ? index : 0;
changePayActive(enableIndex.value);
} else {
changePayActive(0);
}
} catch (e) {
print('spread: $e');
} finally {
loading.value = false;
}
}
submitOrder() async {
if(!canApply.value){
return;
}
try {
final response = await _userApi.applyLiveMatchmaker({
"behavior": GlobalData().userData!.matchmakerFlag! ? 2 : 1,
"type": roseList[activePay.value].type
});
if (response.data.isSuccess) {
SmartDialog.showToast('申请成功,请等待审核');
Get.back();
}
} catch (e) {
SmartDialog.showToast('申请失败');
}

14
lib/model/mine/chat_static_data.dart

@ -1,16 +1,18 @@
//
class ChatStaticData {
final int id;
final int liveDurationMins;
final int todayCrossMicCount;
int? id;
int? liveDurationMins;
int? liveConsumptionAmount;
int? todayCrossMicCount;
ChatStaticData({required this.id, required this.liveDurationMins, required this.todayCrossMicCount});
ChatStaticData({this.id, this.liveDurationMins, this.todayCrossMicCount, this.liveConsumptionAmount});
// JSON映射创建实例
factory ChatStaticData.fromJson(Map<String, dynamic> json) {
return ChatStaticData(
id: json['id'] ?? '',
liveDurationMins: json['liveDurationMins'] ?? 0,
liveConsumptionAmount: json['liveConsumptionAmount'] ?? 0,
todayCrossMicCount: json['todayCrossMicCount'] ?? 0,
);
}
@ -21,11 +23,13 @@ class ChatStaticData {
'id': id,
'liveDurationMins': liveDurationMins,
'todayCrossMicCount': todayCrossMicCount,
'liveConsumptionAmount': liveConsumptionAmount,
};
}
@override
String toString() {
return 'LoginData(id: $id, liveDurationMins: $liveDurationMins)';
return 'LoginData(id: $id, liveDurationMins: $liveDurationMins, liveConsumptionAmount: $liveConsumptionAmount)';
}
}

42
lib/model/mine/user_base_data.dart

@ -1,3 +1,40 @@
class LiveMatchmaker {
final String? userId;
final String? remark;
final String? id;
final bool? enable;
final int? type;
LiveMatchmaker({
this.userId,
this.remark,
this.id,
this.enable,
this.type,
});
factory LiveMatchmaker.fromJson(Map<String, dynamic> json) {
return LiveMatchmaker(
userId: json['userId'] as String?,
remark: json['remark'] as String?,
id: json['id'] as String?,
enable: json['enable'] as bool?,
type: json['type'] as int?,
);
}
Map<String, dynamic> toJson() {
return {
'userId': userId,
'remark': remark,
'id': id,
'enable': enable,
'type': type,
};
}
}
//
class UserBaseData {
final bool matchmakerFlag;
@ -6,9 +43,11 @@ class UserBaseData {
final String phone;
final String realName;
final String userId;
final LiveMatchmaker? liveMatchmaker;
final int matchmakerType;
final bool? isOnline; // 线
UserBaseData({
required this.matchmakerFlag,
required this.matchmakingCornerFlag,
@ -17,6 +56,7 @@ class UserBaseData {
required this.realName,
required this.userId,
required this.matchmakerType,
this.liveMatchmaker,
this.isOnline,
});
@ -30,6 +70,7 @@ class UserBaseData {
phone: json['phone'] ?? '',
realName: json['realName'] ?? '',
userId: json['userId'] ?? '',
liveMatchmaker: json['liveMatchmaker'] != null ? LiveMatchmaker.fromJson(json['liveMatchmaker'] as Map<String, dynamic>) : null,
isOnline: json['isOnline'] as bool?,
);
}
@ -44,6 +85,7 @@ class UserBaseData {
'phone': phone,
'realName': realName,
'userId': userId,
'liveMatchmaker': liveMatchmaker?.toJson(),
'isOnline': isOnline,
};
}

6
lib/network/api_urls.dart

@ -113,6 +113,9 @@ class ApiUrls {
static const String listMatchmakerProduct =
'dating-agency-mall/user/page/product/by/matchmaker';
static const String listMatchmakerRequirement =
'dating-agency-uec/user/list/live-matchmaker-apply-requirement';
static const String auditMatchmakerResult =
'dating-agency-uec/user/need-audit/matchmaker-audit';
@ -152,4 +155,7 @@ class ApiUrls {
static const String consumeOneOnOneRtcChannel =
'dating-agency-chat-audio/user/consume/one-on-one/rtc-channel';
static const String applyLiveMatchmaker =
'dating-agency-uec/user/apply/live-matchmaker';
}

9
lib/network/user_api.dart

@ -6,6 +6,7 @@ import 'package:dating_touchme_app/model/mine/education_data.dart';
import 'package:dating_touchme_app/model/mine/friend_apply_data.dart';
import 'package:dating_touchme_app/model/mine/friend_data.dart';
import 'package:dating_touchme_app/model/mine/login_data.dart';
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:dating_touchme_app/model/mine/occupation_data.dart';
import 'package:dating_touchme_app/model/mine/payment_detail_data.dart';
import 'package:dating_touchme_app/model/mine/rose_data.dart';
@ -203,6 +204,9 @@ abstract class UserApi {
@GET(ApiUrls.listMatchmakerProduct)
Future<HttpResponse<BaseResponse<PaginatedResponse<RoseData>>>> getMatchmakerFee();
@GET(ApiUrls.listMatchmakerRequirement)
Future<HttpResponse<BaseResponse<List<MatchmakerRequirement>>>> getMatchmakerRequirement();
@GET(ApiUrls.auditMatchmakerResult)
Future<HttpResponse<BaseResponse<dynamic>>> getAuditMatchmaker();
@ -276,4 +280,9 @@ abstract class UserApi {
@Query('versionCode') required int code,
});
@POST(ApiUrls.applyLiveMatchmaker)
Future<HttpResponse<BaseResponse<dynamic>>> applyLiveMatchmaker(
@Body() Map<String, dynamic> data,
);
}

77
lib/network/user_api.g.dart

@ -1204,6 +1204,49 @@ class _UserApi implements UserApi {
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<List<MatchmakerRequirement>>>>
getMatchmakerRequirement() async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options =
_setStreamType<HttpResponse<BaseResponse<List<MatchmakerRequirement>>>>(
Options(method: 'GET', headers: _headers, extra: _extra)
.compose(
_dio.options,
'dating-agency-uec/user/list/live-matchmaker-apply-requirement',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl),
),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late BaseResponse<List<MatchmakerRequirement>> _value;
try {
_value = BaseResponse<List<MatchmakerRequirement>>.fromJson(
_result.data!,
(json) => json is List<dynamic>
? json
.map<MatchmakerRequirement>(
(i) => MatchmakerRequirement.fromJson(
i as Map<String, dynamic>,
),
)
.toList()
: List.empty(),
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<dynamic>>> getAuditMatchmaker() async {
final _extra = <String, dynamic>{};
@ -1672,6 +1715,40 @@ class _UserApi implements UserApi {
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<dynamic>>> applyLiveMatchmaker(
Map<String, dynamic> data,
) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(data);
final _options = _setStreamType<HttpResponse<BaseResponse<dynamic>>>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'dating-agency-uec/user/apply/live-matchmaker',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late BaseResponse<dynamic> _value;
try {
_value = BaseResponse<dynamic>.fromJson(
_result.data!,
(json) => json as dynamic,
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||

6
lib/pages/discover/discover_page.dart

@ -89,11 +89,7 @@ class _DiscoverPageState extends State<DiscoverPage>
theme: roomController.matchmakerFlag.value ? TDButtonTheme.danger : TDButtonTheme.primary,
textStyle: TextStyle(fontSize: 10.w),
onTap: () async {
if(roomController.matchmakerFlag.value){
await roomController.createRtcChannel();
} else {
roomController.registerMatch();
}
roomController.registerMatch(roomController.matchmakerFlag.value ? 2 : 1);
},
),
);

69
lib/pages/main/update_dialog.dart

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:ota_update/ota_update.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
class UpdateDialog extends StatefulWidget {
@ -83,6 +84,7 @@ class _UpdateDialogState extends State<UpdateDialog> {
type: TDProgressType.button,
strokeWidth: 40.w,
value: progressValue,
onTap: manualApkInstaller,
label: buttonLabel,
) :
!widget.version.isForcingUpdate! ? Row(
@ -199,30 +201,63 @@ class _UpdateDialogState extends State<UpdateDialog> {
}
downloadAndInstall(AppVersion version) async {
try {
if (mounted) {
setState(() {
updating = true;
});
//
final status = await Permission.storage.status;
if (!status.isGranted) {
final requestStatus = await Permission.storage.request();
if (!requestStatus.isGranted) {
throw Exception('需要存储权限才能下载更新');
}
Get.log('url:${version.url!}');
OtaUpdate().execute(version.url!, destinationFilename: '趣恋恋_${version.version}.apk').listen((OtaEvent event) {
print(event.value); //
print("event.value");
print(event.status); //
}
if (mounted) {
setState(() {
progressValue = 0.0;
updating = true;
});
}
Get.log('url:${version.url!}');
try {
OtaUpdate().execute(version.url!, destinationFilename: '趣恋恋_${version.version}.apk').listen(
(OtaEvent event) {
if(event.status == OtaStatus.DOWNLOADING){
setState(() {
progressValue = int.parse(event.value!) / 100;
buttonLabel = TDTextLabel('${(progressValue * 100).toInt()}%');
});
} else if(event.status == OtaStatus.INSTALLING){
setState(() {
buttonLabel = const TDTextLabel('开始安装');
});
}
},
onError: (error){
if (mounted) {
setState(() {
progressValue = 0.0;
buttonLabel = const TDTextLabel('开始');
updating = false;
});
}
},
onDone: (){
if(progressValue == 1){
setState(() {
buttonLabel = const TDTextLabel('重新安装');
});
}
}
);
} catch (e) {
if (mounted) {
setState(() {
progressValue = 0.0;
buttonLabel = const TDTextLabel('开始');
updating = false;
});
}
print('Failed to make OTA update. Details: $e');
}
}
manualApkInstaller(){
if(progressValue == 1){
downloadAndInstall(widget.version);
}
}
}

13
lib/pages/mine/mine_page.dart

@ -335,9 +335,20 @@ class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
fontSize: 14.w
),
), onClick: (cell) {
controller.registerMatch();
controller.registerMatch(1);
}
),
if(controller.matchmakerFlag.value)TDCell(arrow: true,
leftIconWidget: Image.asset('assets/images/matcher_task.png', height: 20.w, width: 18.w),
titleWidget: Text(
" 红娘任务",
style: TextStyle(
fontSize: 14.w
),
), onClick: (cell) {
controller.registerMatch(2);
}
),
],
),

225
lib/pages/setting/match_league_page.dart

@ -1,10 +1,11 @@
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import '../../components/page_appbar.dart';
import '../../controller/mine/league_controller.dart';
class MatchLeaguePage extends StatelessWidget {
@ -14,104 +15,140 @@ class MatchLeaguePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffFFFFFF),
appBar: PageAppbar(title: "填写申请资料"),
body: Column(
children: [
SizedBox(height: 12),
TDInput(
type: TDInputType.cardStyle,
inputType: TextInputType.phone,
maxLength: 11,
cardStyle: TDCardStyle.topText,
width: MediaQuery.of(context).size.width - 40,
hintText: '请输入你的手机号',
onChanged: (text) {
}
appBar: AppBar(
leading: IconButton(
icon: Icon(TDIcons.chevron_left, size: 30, color: Colors.black),
onPressed: () => Get.back(),
),
title: Obx(() => Text(
'申请${controller.genderCode.value == 0 ? '红娘' : '红娘'}',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
)),
centerTitle: true,
backgroundColor: Colors.white,
),
body: Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/matcher_apply.png'),
fit: BoxFit.cover,
),
),
SizedBox(height: 24),
TDInput(
type: TDInputType.cardStyle,
inputType: TextInputType.number,
maxLength: 6,
cardStyle: TDCardStyle.topText,
width: MediaQuery.of(context).size.width - 40,
hintText: '请输入验证码',
onChanged: (text) {
controller.verificationCode.value = text;
},
rightBtn: SizedBox(
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(right: 10),
child: Container(
width: 0.5,
height: 24,
color: TDTheme.of(context).grayColor3,
),
),
controller.countdownSeconds.value > 0 ?
TDText('${controller.countdownSeconds.value}秒后重试', textColor: TDTheme.of(context).fontGyColor4)
: TDText('获取验证码', textColor: Color(0xFF7562F9)),
),
Column(
children: [
Spacer(),
Container(
height: 320.h,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter, // 0%
end: Alignment.bottomCenter, // 100%
colors: [
Color.fromRGBO(204, 204, 204, 0),//
Color.fromRGBO(176, 224, 137, 0.9), //
Color.fromRGBO(176, 224, 137, 1), //
],
stops: [0.0, 0.2, 1.0], // CSS 0%77.53%100%
),
),
needClear: false,
onBtnTap: () {
controller.getVerificationCode();
}
),
SizedBox(height: 24),
//
Row(
crossAxisAlignment: CrossAxisAlignment.center, //
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 8),
Obx(() => Checkbox(
value: controller.agree.value,
onChanged: (value) {
controller.agree.value = value ?? false;
},
activeColor: Color(0xff7562F9),
side: const BorderSide(color: Colors.grey),
shape: const CircleBorder(),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
)),
Text('阅读并同意', style: TextStyle( fontSize: 14, color: Colors.black54 )),
Text(
'《趣招亲红娘代理协议》',
style: TextStyle( fontSize: 14, color: Color(0xFFEE811B) )
).onTap((){
}),
],
),
SizedBox(height: 32),
TDButton(
text: '下一步',
width: MediaQuery.of(context).size.width - 40,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
style: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xFF7562F9),
),
activeStyle: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xC37562F9),
)
],
),
Obx(() {
return Padding(
padding: EdgeInsets.all(12.0),
child: Column(
children: [
Spacer(),
Container(
height: 60.h,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft, // 0%
end: Alignment.centerRight, // 100%
colors: [
Color.fromRGBO(251, 74, 32, 1), //
Color.fromRGBO(242, 253, 159, 1),//
]
),
borderRadius: BorderRadius.only(topLeft: Radius.circular(12.0), topRight: Radius.circular(12.0), bottomLeft: Radius.circular(0), bottomRight: Radius.circular(0)),
),
padding: EdgeInsets.only(bottom: 12),
child: Align(
alignment: Alignment.center, //
child: Text(
'申请${controller.genderCode.value == 0 ? '红娘' : '红娘'}',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold,color: Colors.white),
),
),
),
Transform.translate(
offset: Offset(0, -12), // Y轴上移12像素
child: Container(
height: 272.h,
// width: MediaQuery.of(context).size.width - 24,
padding: EdgeInsets.only(top: 24, bottom: 24, left: 16, right: 16),
decoration: BoxDecoration(
color: Colors.white, //
borderRadius: BorderRadius.circular(12), //
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
TDTag('你已申请', style: TDTagStyle(borderRadius: BorderRadius.circular(6), backgroundColor: Color.fromRGBO(251, 76, 33, 1))),
SizedBox(width: 4),
TDText('累计连麦时长${controller.hours.value}小时即可申请红娘', style: TextStyle(fontSize: 16.w, fontWeight: FontWeight.bold))
],
),
SizedBox(height: 24),
Row(
children: [
SizedBox(width: 24),
TDText('我已累计连麦:', style: TextStyle(fontSize: 16)),
Spacer(),
Row(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment,
children: [
TDText('${controller.consumption.value.liveDurationMins}', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Color.fromRGBO(251, 78, 35, 1))),
SizedBox(width: 4),
Padding(
padding: EdgeInsets.only(top: 4),
child: TDText('分钟', style: TextStyle(fontSize: 12)),
),
],
),
SizedBox(width: 24),
],
),
Spacer(),
TDButton(
text: controller.canApply.value ? '去申请' : '去相亲',
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.white),
width: MediaQuery.of(context).size.width - 100,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
gradient: LinearGradient(colors: [Color.fromRGBO(255, 85, 78, 1), Color.fromRGBO(254, 147, 72, 1)]),
onTap: (){
controller.applyMatcher();
},
)
],
),
),
),
],
),
onTap: (){
controller.submitInfo();
},
),
],
),
);
}),
],
),
);
}

302
lib/pages/setting/match_spread_page.dart

@ -1,7 +1,9 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/model/mine/rose_data.dart';
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -17,6 +19,7 @@ class MatchSpreadPage extends StatelessWidget {
return GetX<SpreadController>(
init: SpreadController(),
builder: (controller){
controller.userData.value = GlobalData().userData;
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@ -31,71 +34,174 @@ class MatchSpreadPage extends StatelessWidget {
stops: [0.0, 0.32, 0.66, 1.0], // CSS 0%77.53%100%
),
),
child: controller.roseList.isNotEmpty ? Scaffold(
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: PageAppbar(title: "入驻加盟", backgroundColor: Colors.transparent, color: Colors.white, iconColor: Colors.white),
body: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white
),
padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w),
margin: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w),
child: Column(
children: [
SizedBox(height: 6.w,),
Row(
body: controller.loading.value ? Center(
child: TDLoading(
size: TDLoadingSize.medium,
icon: TDLoadingIcon.activity,
text: '加载中…',
axis: Axis.vertical,
duration: 500,
)
) : SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w),
child: Row(
children: [
Text(
"趣恋恋,让婚恋服务更高效",
style: TextStyle(
fontSize: 16.w,
fontWeight: FontWeight.w500
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(80.w)),
child: (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? CachedNetworkImage(
imageUrl: "${controller.userData.value?.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_120",
width: 80.w,
height: 80.w,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
) : Image.asset(
Assets.imagesUserAvatar,
width: 80.w,
height: 80.w,
)
),
SizedBox(width: 16.w,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: BoxConstraints( maxWidth: 120.w),
child: Text(
"${controller.userData.value?.nickName ?? ""}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
),
),
Text(
"ID:${controller.userId.value ?? ""}",
style: TextStyle(
fontSize: 16.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
)
],
)
],
),
SizedBox(height: 15.w,),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
...controller.roseList.asMap().entries.map((entry){
return PayItem(item: entry.value, active: controller.activePay.value, index: entry.key, changeActive: controller.changePayActive);
}),
],
),
),
SizedBox(height: 24.w),
Row(
mainAxisAlignment: MainAxisAlignment.center,
),
SizedBox(width: 12.w,),
Container(
padding: EdgeInsets.only(top: 8.w, bottom: 10.w, left: 24.w, right: 24.w),
child: Row(
children: [
Text(
"新红娘入驻权益",
style: TextStyle(
fontSize: 22.w,
color: const Color.fromRGBO(48, 48, 48, 1),
fontWeight: FontWeight.w500
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
Image.asset(Assets.imagesRoseWhite, width: 8.w, height: 15.w),
const SizedBox(width: 4),
Text('已消费玫瑰', style: TextStyle(fontSize: 14.w, color: Colors.white)),
],
),
SizedBox(height: 4,),
Row(
children: [
SizedBox(width: 12,),
Text(
"${controller.consumption.value.liveConsumptionAmount}",
style: TextStyle(
fontSize: 30.w,
color: Colors.white,
fontWeight: FontWeight.bold
),
),
],
),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
Image.asset('assets/images/timer.png', width: 15.w, height: 15.w),
const SizedBox(width: 4),
Text('已连麦时间(分钟)', style: TextStyle(fontSize: 14.w, color: Colors.white)),
],
),
SizedBox(height: 4,),
Row(
children: [
SizedBox(width: 12,),
Text(
"${controller.consumption.value.liveDurationMins}",
style: TextStyle(
fontSize: 30.w,
color: Colors.white,
fontWeight: FontWeight.bold
),
),
],
),
],
),
),
SizedBox(width: 4.w,),
Image.asset(
Assets.imagesLimitTime,
width: 30.w,
height: 16.w,
)
],
),
SizedBox(height: 16.w,),
...controller.revenue.map((entry){
return RevenueItem(item: entry);
}),
],
),
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white
),
padding: EdgeInsets.symmetric(vertical: 12.w, horizontal: 16.w),
margin: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w),
child: Column(
children: [
SizedBox(height: 12.w,),
...controller.roseList.asMap().entries.map((entry){
return PayItem(item: entry.value, active: controller.activePay.value, index: entry.key, changeActive: controller.changePayActive);
}),
Row(
children: [
SizedBox(width: 4.w),
Container(
width: 6,
height: 6,
decoration: BoxDecoration(
color: Color(0xFF999999), //
shape: BoxShape.circle, //
),
),
SizedBox(width: 4.w),
Text('仅限直播间相亲消费和连麦', style: TextStyle(fontSize: 12.w, color: Color(0xFF999999))),
],
),
SizedBox(height: 12.w),
],
),
)
],
)
),
bottomNavigationBar: SafeArea(
bottomNavigationBar: controller.roseList.isNotEmpty ? SafeArea(
child: Container(
height: 60,
padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 20.w),
@ -105,6 +211,7 @@ class MatchSpreadPage extends StatelessWidget {
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
disabled: !controller.canApply.value,
style: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xFF7562F9),
@ -113,13 +220,17 @@ class MatchSpreadPage extends StatelessWidget {
textColor: Colors.white,
backgroundColor: Color(0xC37562F9),
),
disableStyle: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xFFAAAAAA),
),
onTap: (){
controller.submitOrder();
},
),
)
),
) : null,
) : null,
),
);
},
);
@ -128,7 +239,7 @@ class MatchSpreadPage extends StatelessWidget {
class PayItem extends StatefulWidget {
final RoseData item;
final MatchmakerRequirement item;
final int active;
final int index;
final void Function(int) changeActive;
@ -144,69 +255,48 @@ class _PayItemState extends State<PayItem> {
return Stack(
children: [
Container(
width: 124.w,
height: 160.h,
margin: const EdgeInsets.only(right: 10),
// width: 124.w,
height: 108.h,
margin: EdgeInsets.only(bottom: 12.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white,
border: widget.active == widget.index ? Border.all(width: 1, color: const Color(0xFF7562F9)) : Border.all(width: 1, color: const Color(0xFFEEEEEE))
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 40.h),
SizedBox(height: 20.h),
TDText(widget.item.liveConsumptionAmount! > 0 ? '累计消费' : '累计连麦相亲', style: TextStyle(color: Color(0xFF999999))),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
widget.item.liveConsumptionAmount! > 0 ? "${widget.item.liveConsumptionAmount}" : "${widget.item.liveDurationHours}",
style: TextStyle(
fontSize: 30.w,
color: Color.fromRGBO(251, 78, 35, 1),
fontWeight: FontWeight.bold
),
),
const SizedBox(width: 2),
Container(
padding: EdgeInsets.only(bottom: 5),
padding: EdgeInsets.only(bottom: 8.h),
child: Text(
"¥",
widget.item.liveConsumptionAmount! > 0 ? '朵玫瑰' : '小时',
style: TextStyle(
fontSize: 16.w,
color: Color(0xFF7562F9),
color: Color.fromRGBO(251, 78, 35, 1),
fontWeight: FontWeight.bold
),
),
),
const SizedBox(width: 2),
Text(
"${widget.item.unitSellingPrice}",
style: TextStyle(
fontSize: 26.w,
color: Color(0xFF7562F9),
fontWeight: FontWeight.bold
),
),
],
),
TDText("${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),),
Spacer(),
SizedBox(
height: 36.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
widget.item.validityPeriodDays != null ? Text(
"有效期:${widget.item.validityPeriodDays}",
style: TextStyle(
fontSize: 14.w,
color: Color(0xFF333333),
fontWeight: FontWeight.bold
),
) : Text('+${widget.item.liveDurationHours ?? '10'}小时视频相亲',
style: TextStyle(
fontSize: 12.w,
color: Color(0xFF999999),
fontWeight: FontWeight.bold
),
)
],
),
),
// TDText("${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),),
Spacer()
],
),
),
@ -223,7 +313,7 @@ class _PayItemState extends State<PayItem> {
color: widget.active == widget.index ? const Color(0xFF7562F9) : Color(0xFFCCCCCC)
),
child: Center(
child: Text(widget.item.productTitle!.replaceAll('加盟费', ''), style: TextStyle(fontSize: 12, color: Colors.white)),
child: Text(_getNameByType(widget.item.type!), style: TextStyle(fontSize: 12, color: Colors.white)),
),
),
)
@ -232,6 +322,20 @@ class _PayItemState extends State<PayItem> {
widget.changeActive(widget.index);
});
}
String _getNameByType(int type) {
if(type == 1){
return '实习红娘';
}
if(type == 2){
return '线上红娘';
}
if(type == 3){
return '签约红娘';
}
return '实习红娘'; // HI位置
}
}

391
lib/pages/setting/match_task_page.dart

@ -1,9 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/controller/setting/task_controller.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -18,171 +15,80 @@ class MatchTaskPage extends StatelessWidget {
return GetX<TaskController>(
init: TaskController(),
builder: (controller){
controller.userData.value = GlobalData().userData;
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft, // 0%
end: Alignment.bottomCenter, // 100%
colors: [
Color.fromRGBO(172, 89, 255, 1), //
Color.fromRGBO(117, 98, 249, 1), //
Color.fromRGBO(255, 255, 255, 1),
Color.fromRGBO(255, 255, 255, 1),//
],
stops: [0.0, 0.32, 0.66, 1.0], // CSS 0%77.53%100%
),
),
child: controller.roseList.isNotEmpty ? Scaffold(
backgroundColor: Colors.transparent,
appBar: PageAppbar(title: "入驻加盟", backgroundColor: Colors.transparent, color: Colors.white, iconColor: Colors.white),
body: SingleChildScrollView(
return Scaffold(
appBar: PageAppbar(title: "红娘任务"),
body: controller.loading.value ? Center(
child: TDLoading(
size: TDLoadingSize.medium,
icon: TDLoadingIcon.activity,
text: '加载中…',
axis: Axis.vertical,
duration: 500,
)
) : SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w),
child: Row(
padding: EdgeInsets.symmetric(vertical: 12.w, horizontal: 18.w),
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(80.w)),
child: (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? CachedNetworkImage(
imageUrl: "${controller.userData.value?.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_120",
width: 80.w,
height: 80.w,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
) : Image.asset(
Assets.imagesUserAvatar,
width: 80.w,
height: 80.w,
)
),
SizedBox(width: 16.w,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Row(
children: [
ConstrainedBox(
constraints: BoxConstraints( maxWidth: 120.w),
child: Text(
"${controller.userData.value?.nickName ?? ""}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
TDText('日任务', style: TextStyle(color: Color(0xFF333333), fontWeight: FontWeight.bold, fontSize: 16.w)),
SizedBox(width: 4.w),
Container(
width: 4,
height: 4,
decoration: BoxDecoration(
color: Color(0xFF999999), //
shape: BoxShape.circle, //
),
),
Text(
"ID:${controller.userId.value ?? ""}",
style: TextStyle(
fontSize: 16.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
)
SizedBox(width: 4.w),
TDText('任务时间:截止 23:25', style: TextStyle(color: Color(0xFF666666), fontSize: 16.w)),
],
)
],
),
),
SizedBox(width: 12.w,),
Container(
padding: EdgeInsets.only(top: 8.w, bottom: 10.w, left: 24.w, right: 24.w),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
Image.asset(Assets.imagesRoseWhite, width: 8.w, height: 15.w),
const SizedBox(width: 4),
Text('已消费玫瑰', style: TextStyle(fontSize: 14.w, color: Colors.white)),
],
),
SizedBox(height: 4,),
Row(
children: [
SizedBox(width: 12,),
Text(
"${controller.consumption.value.liveConsumptionAmount}",
style: TextStyle(
fontSize: 30.w,
color: Colors.white,
fontWeight: FontWeight.bold
),
),
],
),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
Image.asset('assets/images/timer.png', width: 15.w, height: 15.w),
const SizedBox(width: 4),
Text('已连麦时间(分钟)', style: TextStyle(fontSize: 14.w, color: Colors.white)),
],
),
SizedBox(height: 4,),
Row(
children: [
SizedBox(width: 12,),
Text(
"${controller.consumption.value.liveDurationMins}",
style: TextStyle(
fontSize: 30.w,
color: Colors.white,
fontWeight: FontWeight.bold
),
),
],
),
],
),
),
],
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white
),
padding: EdgeInsets.symmetric(vertical: 12.w, horizontal: 16.w),
margin: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w),
child: Column(
children: [
SizedBox(height: 12.w,),
...controller.roseList.asMap().entries.map((entry){
return PayItem(item: entry.value, active: controller.activePay.value, index: entry.key, changeActive: controller.changePayActive);
return TaskItem(item: entry.value);
}),
SizedBox(height: 24.w,),
Row(
children: [
TDText('月任务', style: TextStyle(color: Color(0xFF333333), fontWeight: FontWeight.bold, fontSize: 16.w)),
SizedBox(width: 4.w),
Container(
width: 6,
height: 6,
width: 4,
height: 4,
decoration: BoxDecoration(
color: Color(0xFF999999), //
shape: BoxShape.circle, //
),
),
SizedBox(width: 4.w),
Text('仅限直播间相亲消费和连麦', style: TextStyle(fontSize: 12.w, color: Color(0xFF999999))),
TDText('任务时间:截止 03/15 23:59', style: TextStyle(color: Color(0xFF666666), fontSize: 16.w)),
],
),
SizedBox(height: 12.w,),
...controller.roseList.asMap().entries.map((entry){
return TaskItem(item: entry.value);
}),
SizedBox(height: 12.w,),
Row(
children: [
TDText('注意事项', style: TextStyle(color: Color(0xFF333333), fontSize: 16.w)),
],
),
SizedBox(height: 4.w,),
Row(
children: [
Text('1.月任务未通过将受到惩罚;', style: TextStyle(fontSize: 12.w, color: Color(0xFF999999))),
],
),
SizedBox(height: 4.w,),
Row(
children: [
Text('2.任务开始时间为成为红娘的那一刻起;', style: TextStyle(fontSize: 12.w, color: Color(0xFF999999))),
],
),
SizedBox(height: 12.w),
@ -191,196 +97,37 @@ class MatchTaskPage extends StatelessWidget {
)
],
)
),
bottomNavigationBar: SafeArea(
child: Container(
height: 60,
padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 20.w),
child: TDButton(
text: controller.button.value,
width: MediaQuery.of(context).size.width - 40,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
disabled: !controller.canApply.value,
style: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xFF7562F9),
),
activeStyle: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xC37562F9),
),
disableStyle: TDButtonStyle(
textColor: Colors.white,
backgroundColor: Color(0xFFAAAAAA),
),
onTap: (){
controller.submitOrder();
},
),
)
),
) : null,
)
);
},
);
}
}
class PayItem extends StatefulWidget {
class TaskItem extends StatelessWidget {
final MatchmakerRequirement item;
final int active;
final int index;
final void Function(int) changeActive;
const PayItem({super.key, required this.item, required this.active, required this.index, required this.changeActive, });
@override
State<PayItem> createState() => _PayItemState();
}
class _PayItemState extends State<PayItem> {
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
// width: 124.w,
height: 108.h,
margin: EdgeInsets.only(bottom: 12.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white,
border: widget.active == widget.index ? Border.all(width: 1, color: const Color(0xFF7562F9)) : Border.all(width: 1, color: const Color(0xFFEEEEEE))
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 20.h),
TDText(widget.item.liveConsumptionAmount! > 0 ? '累计消费' : '累计连麦相亲', style: TextStyle(color: Color(0xFF999999))),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
widget.item.liveConsumptionAmount! > 0 ? "${widget.item.liveConsumptionAmount}" : "${widget.item.liveDurationHours}",
style: TextStyle(
fontSize: 30.w,
color: Color.fromRGBO(251, 78, 35, 1),
fontWeight: FontWeight.bold
),
),
const SizedBox(width: 2),
Container(
padding: EdgeInsets.only(bottom: 8.h),
child: Text(
widget.item.liveConsumptionAmount! > 0 ? '朵玫瑰' : '小时',
style: TextStyle(
fontSize: 16.w,
color: Color.fromRGBO(251, 78, 35, 1),
fontWeight: FontWeight.bold
),
),
),
],
),
// TDText("${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),),
Spacer()
],
),
),
Positioned(
left: 0,
top: 0,
child: Container(
padding: EdgeInsets.symmetric(vertical: 4.w, horizontal: 12.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(18.w),
bottomRight: Radius.circular(18.w),
),
color: widget.active == widget.index ? const Color(0xFF7562F9) : Color(0xFFCCCCCC)
),
child: Center(
child: Text(_getNameByType(widget.item.type!), style: TextStyle(fontSize: 12, color: Colors.white)),
),
),
)
],
).onTap((){
widget.changeActive(widget.index);
});
}
String _getNameByType(int type) {
if(type == 1){
return '实习红娘';
}
if(type == 2){
return '线上红娘';
}
if(type == 3){
return '签约红娘';
}
return '实习红娘'; // HI位置
}
}
class RevenueItem extends StatefulWidget {
final dynamic item;
const RevenueItem({super.key, required this.item});
@override
State<RevenueItem> createState() => _RevenueItemState();
}
class _RevenueItemState extends State<RevenueItem> {
const TaskItem({super.key, required this.item });
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(17.w),
margin: EdgeInsets.only(bottom: 8.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16.w)),
color: const Color.fromRGBO(117, 98, 249, .1)
),
child: Row(
margin: EdgeInsets.only(bottom: 12.w, left: 8.w, top: 8.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
_getButtonImage(widget.item['icon']),
width: 26.w,
height: 26.w,
TDText(item.liveConsumptionAmount! > 0 ? '累计消费' : '累计连麦相亲', style: TextStyle(color: Color(0xFF333333), fontSize: 16.w)),
SizedBox(height: 4.w),
TDProgress(
type: TDProgressType.linear,
value: 0.5,
strokeWidth: 6,
progressLabelPosition: TDProgressLabelPosition.right,
color: Color(0xFF7562F9),
),
SizedBox(width: 14.w,),
Expanded(
child: Text(
widget.item['desc'],
style: TextStyle(
fontSize: 12.w,
color: Color(0xFF999999)
),
),
)
SizedBox(height: 2.w),
TDText('目前有效金额:22.66元', style: TextStyle(color: Color(0xFF999999), fontSize: 12.w)),
],
),
);
}
String _getButtonImage(String icon) {
if(icon == '1'){
return Assets.imagesMatchmakerIcon1;
}
if(icon == '2'){
return Assets.imagesMatchmakerIcon2;
}
if(icon == '3'){
return Assets.imagesMatchmakerIcon3;
}
return Assets.imagesMatchmakerIcon4; // HI位置
}
}
}
Loading…
Cancel
Save