From e48b5f25485617d41251e7b71dd1960767058ad7 Mon Sep 17 00:00:00 2001 From: ChenNyan Date: Fri, 27 Mar 2026 09:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 10244 -> 10244 bytes lib/controller/home/home_controller.dart | 2 - lib/controller/home/real_home_controller.dart | 26 +++- lib/controller/home/timeline_controller.dart | 18 ++- lib/controller/mine/login_controller.dart | 21 +++ lib/pages/home/report_page.dart | 46 +++---- lib/pages/home/send_timeline.dart | 16 +-- lib/pages/home/user_information_page.dart | 98 ++++++++++++++ lib/pages/mine/open_webview.dart | 45 +++++++ lib/pages/mine/phone_login_page.dart | 120 ++++++++++++++++++ lib/pages/setting/deactivate_page.dart | 36 +++--- 11 files changed, 374 insertions(+), 54 deletions(-) diff --git a/.DS_Store b/.DS_Store index d5d2d42c7b7bc743c42f3d15143baa9f094464d3..df3cf3c164b89d7b621c67b10012dd357282383c 100644 GIT binary patch delta 63 zcmZn(XbG6$&nUYwU^hRb>}DQ;zpU)$mL@t1CPtG5#Jo4h2;X7c93XaqeKWfP6C0Y; GN=5)!LJ_|J delta 62 zcmZn(XbG6$&nUAoU^hRb%w`^ezpU)01_n9`CKi(g#Jo2 !blockList.contains(user.userId)) + .toList(); + recommendFeed.value = result; + final result1 = postList + .where((user) => !blockList.contains(user.userId)) + .toList(); + postList.value = result1; + update(); + } + getListData() async { try { var response = await _homeApi.getMarriageList( @@ -41,10 +55,14 @@ class RealHomeController extends GetxController { .map((item) => MarriageData.fromJson(item as Map)) .toList(); + final blockList = GetStorage().read('blockList') ?? []; // 过滤掉直播类型的项 final records = allRecords!.where((item) => !item.isLive).toList(); + final result = records + .where((user) => !blockList.contains(user.userId)) + .toList(); recommendFeed.clear(); - recommendFeed.addAll(records); + recommendFeed.addAll(result); update(); } else { // 响应失败,抛出异常 @@ -72,8 +90,12 @@ class RealHomeController extends GetxController { ); if (response.data.isSuccess && response.data.data != null) { final data = response.data.data?.records ?? []; + final blockList = GetStorage().read('blockList') ?? []; + final result = data + .where((user) => !blockList.contains(user.userId)) + .toList(); - postList.addAll(data.toList()); + postList.addAll(result); if((data.length ?? 0) == size.value){ listRefreshController.finishLoad(IndicatorResult.success); diff --git a/lib/controller/home/timeline_controller.dart b/lib/controller/home/timeline_controller.dart index 6d1beee..9227805 100644 --- a/lib/controller/home/timeline_controller.dart +++ b/lib/controller/home/timeline_controller.dart @@ -2,6 +2,7 @@ import 'package:dating_touchme_app/model/home/marriage_data.dart'; import 'package:dating_touchme_app/network/home_api.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; import '../../model/home/post_data.dart'; @@ -49,6 +50,17 @@ class TimelineController extends GetxController { loadPostList(); } + + + clearData() async { + final blockList = GetStorage().read('blockList') ?? []; + final result1 = postList + .where((user) => !blockList.contains(user.userId)) + .toList(); + postList.value = result1; + update(); + } + loadPostList() async { if (recommendIsLoading.value || !recommendHasMore.value) return; try{ @@ -59,8 +71,12 @@ class TimelineController extends GetxController { ); if (response.data.isSuccess && response.data.data != null) { final data = response.data.data?.records ?? []; + final blockList = GetStorage().read('blockList') ?? []; + final result1 = data + .where((user) => !blockList.contains(user.userId)) + .toList(); - postList.addAll(data.toList()); + postList.addAll(result1); if((data.length ?? 0) == size.value){ hasMore.value = true; } else { diff --git a/lib/controller/mine/login_controller.dart b/lib/controller/mine/login_controller.dart index e646912..184bde9 100644 --- a/lib/controller/mine/login_controller.dart +++ b/lib/controller/mine/login_controller.dart @@ -53,9 +53,14 @@ class LoginController extends GetxController with WidgetsBindingObserver { } final isSend = false.obs; + final checked = false.obs; // 获取验证码 Future getVerificationCode() async { + if(!checked.value){ + SmartDialog.showToast('请先同意用户协议和隐私协议'); + return; + } // 验证手机号格式 if (phoneNumber.value.isEmpty || phoneNumber.value.length != 11) { SmartDialog.showToast('请输入正确的手机号'); @@ -127,13 +132,29 @@ class LoginController extends GetxController with WidgetsBindingObserver { // 登录方法 Future login() async { + if(!checked.value){ + SmartDialog.showToast('请先同意用户协议和隐私协议'); + passwordController.value.value = TextEditingValue( + text: "", + selection: TextSelection.fromPosition(TextPosition(offset: 0)), + ); + return; + } // 验证输入 if (phoneNumber.value.isEmpty || phoneNumber.value.length != 11) { + passwordController.value.value = TextEditingValue( + text: "", + selection: TextSelection.fromPosition(TextPosition(offset: 0)), + ); SmartDialog.showToast('请输入正确的手机号'); return; } if (verificationCode.value.isEmpty) { + passwordController.value.value = TextEditingValue( + text: "", + selection: TextSelection.fromPosition(TextPosition(offset: 0)), + ); SmartDialog.showToast('请输入验证码'); return; } diff --git a/lib/pages/home/report_page.dart b/lib/pages/home/report_page.dart index 56cc797..fb6e5cb 100644 --- a/lib/pages/home/report_page.dart +++ b/lib/pages/home/report_page.dart @@ -472,29 +472,29 @@ class ReportPage extends StatelessWidget { }, ), ), - SizedBox(height: 16.w ,), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "同时加入黑名单", - style: TextStyle( - fontSize: 13.w, - color: const Color.fromRGBO(51, 51, 51, 1), - fontWeight: FontWeight.w500 - ), - ), - TDSwitch( - isOn: controller.blockUser.value, - trackOnColor: const Color.fromRGBO(117, 98, 249, 1), - onChanged: (bool e){ - print(e); - controller.blockUser.value = e; - return e; - }, - ), - ], - ), + // SizedBox(height: 16.w ,), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Text( + // "同时加入黑名单", + // style: TextStyle( + // fontSize: 13.w, + // color: const Color.fromRGBO(51, 51, 51, 1), + // fontWeight: FontWeight.w500 + // ), + // ), + // TDSwitch( + // isOn: controller.blockUser.value, + // trackOnColor: const Color.fromRGBO(117, 98, 249, 1), + // onChanged: (bool e){ + // print(e); + // controller.blockUser.value = e; + // return e; + // }, + // ), + // ], + // ), SizedBox(height: 53.w ,), Container( width: 325.w, diff --git a/lib/pages/home/send_timeline.dart b/lib/pages/home/send_timeline.dart index e99646d..e867ab7 100644 --- a/lib/pages/home/send_timeline.dart +++ b/lib/pages/home/send_timeline.dart @@ -163,14 +163,14 @@ class _SendTimelineState extends State { Future handleCameraCapture() async { try { // 请求相机权限 - final ok = await _ensurePermission( - Permission.camera, - denyToast: '相机权限被拒绝,请在设置中允许访问相机', - ); - if (!ok) return; - - // 请求麦克风权限(部分设备拍照/录像会一并请求建议预授权) - await _ensurePermission(Permission.microphone, denyToast: '麦克风权限被拒绝'); + // final ok = await _ensurePermission( + // Permission.camera, + // denyToast: '相机权限被拒绝,请在设置中允许访问相机', + // ); + // if (!ok) return; + // + // // 请求麦克风权限(部分设备拍照/录像会一并请求建议预授权) + // await _ensurePermission(Permission.microphone, denyToast: '麦克风权限被拒绝'); // 权限通过后拍照 final ImagePicker picker = ImagePicker(); diff --git a/lib/pages/home/user_information_page.dart b/lib/pages/home/user_information_page.dart index 79ce1e7..f4d312f 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -1,5 +1,8 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dating_touchme_app/controller/global.dart'; +import 'package:dating_touchme_app/controller/home/home_controller.dart'; +import 'package:dating_touchme_app/controller/home/real_home_controller.dart'; +import 'package:dating_touchme_app/controller/home/timeline_controller.dart'; import 'package:dating_touchme_app/controller/home/user_information_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; @@ -14,6 +17,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; +import 'package:get_storage/get_storage.dart'; import 'package:tdesign_flutter/tdesign_flutter.dart'; class UserInformationPage extends StatelessWidget { @@ -663,6 +667,100 @@ class UserInformationPage extends StatelessWidget { Get.to(() => ReportPage(id: userId,)); } else if (v == 'block') { print("拉黑"); + + + SmartDialog.dismiss(); + // 弹出解除连麦对话框 + SmartDialog.show( + onDismiss: (){ + SmartDialog.dismiss(); + }, + builder: (context) { + return Material( + borderRadius: BorderRadius.all(Radius.circular(16.w)), + child: Container( + width: 311.w, + height: 165.w, + padding: EdgeInsets.only( + top: 50.w, + bottom: 20.w, + left: 20.w, + right: 20.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(16.w)), + + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "请确认是否拉黑该用户", + ), + Spacer(), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 125.w, + height: 40.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(12.w)), + color: const Color.fromRGBO(237, 237, 237, 1) + ), + child: Center( + child: Text( + "取消", + style: TextStyle( + fontSize: 15.w + ), + ), + ), + ).onTap((){ + SmartDialog.dismiss(); + + }), + Container( + width: 125.w, + height: 40.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(12.w)), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Text( + "确定", + style: TextStyle( + fontSize: 15.w, + color: Colors.white + ), + ), + ), + ).onTap((){ + final blockList = GetStorage().read('blockList') ?? []; + blockList.add(controller.userData.value.miUserId); + + GetStorage().write('blockList', blockList); + SmartDialog.dismiss(); + Get.until((route) => route.isFirst); + if (Get.isRegistered()) { + final homeController = Get.find(); + homeController.clearData(); + } + + if (Get.isRegistered()) { + final timelineController = Get.find(); + timelineController.clearData(); + } + }), + ], + ) + ], + ), + ), + ); + }, + ); } }, child: Container( diff --git a/lib/pages/mine/open_webview.dart b/lib/pages/mine/open_webview.dart index a3dd9a5..3c70766 100644 --- a/lib/pages/mine/open_webview.dart +++ b/lib/pages/mine/open_webview.dart @@ -22,10 +22,55 @@ class _OpenWebViewState extends State { controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) ..setBackgroundColor(const Color(0x00000000)) + ..setNavigationDelegate( + NavigationDelegate( + onPageFinished: (url) async { + await controller.runJavaScript(_replaceTextJs()); + }, + ), + ) ..loadRequest(Uri.parse(Uri.decodeComponent(widget.url))); + + super.initState(); } + + String _replaceTextJs() { + return r""" +(function() { + const replaceMap = { + '趣恋恋': '星球奇遇记', + }; + + function walk(node) { + if (node.nodeType === Node.TEXT_NODE) { + let text = node.nodeValue; + if (!text) return; + + Object.keys(replaceMap).forEach(key => { + text = text.split(key).join(replaceMap[key]); + }); + + node.nodeValue = text; + return; + } + + if ( + node.nodeType === Node.ELEMENT_NODE && + !['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA'].includes(node.tagName) + ) { + for (let i = 0; i < node.childNodes.length; i++) { + walk(node.childNodes[i]); + } + } + } + + walk(document.body); +})(); +"""; + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/pages/mine/phone_login_page.dart b/lib/pages/mine/phone_login_page.dart index a190afa..58b9430 100644 --- a/lib/pages/mine/phone_login_page.dart +++ b/lib/pages/mine/phone_login_page.dart @@ -1,5 +1,6 @@ import 'package:dating_touchme_app/controller/mine/login_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; +import 'package:dating_touchme_app/pages/mine/open_webview.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -95,6 +96,64 @@ class PhoneLoginPage extends StatelessWidget { ? null : controller.getVerificationCode(); }), + + + // 协议同意复选框 + Row( + children: [ + Checkbox( + value: controller.checked.value, + onChanged: (value) { + controller.checked.value = value ?? false; + }, + activeColor: const Color.fromRGBO(117, 98, 249, 1), + side: const BorderSide(color: Colors.grey), + shape: const CircleBorder(), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + ), + const Text( + '我已阅读并同意', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(153, 153, 153, 1), + ), + ), + GestureDetector( + onTap: () { + // 跳转到用户协议页面 + Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/privacy.html")); + }, + child: const Text( + '《用户协议》', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(74, 99, 235, 1), + ), + ), + ), + const Text( + '和', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(153, 153, 153, 1), + ), + ), + GestureDetector( + onTap: () { + // 跳转到隐私政策页面 + Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/information.html")); + }, + child: const Text( + '《隐私政策》', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(74, 99, 235, 1), + ), + ), + ), + ], + ), ], ), ) : Container( @@ -159,6 +218,67 @@ class PhoneLoginPage extends StatelessWidget { ? null : controller.getVerificationCode(); }), + + + + const SizedBox(height: 24), + + // 协议同意复选框 + Row( + children: [ + Checkbox( + value: controller.checked.value, + onChanged: (value) { + controller.checked.value = value ?? false; + }, + activeColor: const Color.fromRGBO(117, 98, 249, 1), + side: const BorderSide(color: Colors.grey), + shape: const CircleBorder(), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + ), + const Text( + '我已阅读并同意', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(153, 153, 153, 1), + ), + ), + GestureDetector( + onTap: () { + // 跳转到用户协议页面 + Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/privacy.html")); + }, + child: const Text( + '《用户协议》', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(74, 99, 235, 1), + ), + ), + ), + const Text( + '和', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(153, 153, 153, 1), + ), + ), + GestureDetector( + onTap: () { + // 跳转到隐私政策页面 + Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/information.html")); + }, + child: const Text( + '《隐私政策》', + style: TextStyle( + fontSize: 11, + color: Color.fromRGBO(74, 99, 235, 1), + ), + ), + ), + ], + ), ], ), ), diff --git a/lib/pages/setting/deactivate_page.dart b/lib/pages/setting/deactivate_page.dart index 4f9c720..76fe573 100644 --- a/lib/pages/setting/deactivate_page.dart +++ b/lib/pages/setting/deactivate_page.dart @@ -35,7 +35,7 @@ class DeactivatePage extends StatelessWidget { ), SizedBox(height: 35.w,), Text( - "申请注销趣恋恋账号前,趣恋恋将进行以下验证,以保证你的账号安全、财产安全。", + "申请注销星球奇遇记账号前,星球奇遇记将进行以下验证,以保证你的账号安全、财产安全。", style: TextStyle( fontSize: 13.w, fontWeight: FontWeight.w500, @@ -44,7 +44,7 @@ class DeactivatePage extends StatelessWidget { ), SizedBox(height: 15.w,), Container( - height: 104.w, + // height: 104.w, padding: EdgeInsets.symmetric( vertical: 20.w, horizontal: 17.w @@ -73,22 +73,22 @@ class DeactivatePage extends StatelessWidget { ) ], ), - Row( - children: [ - Image.asset( - Assets.imagesErrorIcon, - width: 15.w, - ), - SizedBox(width: 9.w,), - Text( - "钱包余额未结清", - style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500 - ), - ) - ], - ), + // Row( + // children: [ + // Image.asset( + // Assets.imagesErrorIcon, + // width: 15.w, + // ), + // SizedBox(width: 9.w,), + // Text( + // "钱包余额未结清", + // style: TextStyle( + // fontSize: 13.w, + // fontWeight: FontWeight.w500 + // ), + // ) + // ], + // ), ], ), ),