From 101b60611a2bcc8d0d2273aeb8d10b60e740486a Mon Sep 17 00:00:00 2001 From: czz <862977248@qq.com> Date: Mon, 11 Aug 2025 16:22:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=AA=E5=92=8Ce=E6=8A=A4=E6=B3=A8=E9=94=80?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/langs/en_US.json | 19 +- assets/langs/zh_CN.json | 29 ++- assets/langs/zh_TW.json | 19 +- lib/pages/login/LogoutPage.dart | 349 ++++++++++++++++++++++++++ lib/pages/mh_page/bluetooth.dart | 2 +- lib/pages/mh_page/delete_account.dart | 17 -- lib/pages/user/setting_page.dart | 9 +- lib/routers/routers.dart | 3 + 8 files changed, 417 insertions(+), 30 deletions(-) create mode 100644 lib/pages/login/LogoutPage.dart diff --git a/assets/langs/en_US.json b/assets/langs/en_US.json index fc00fde..ecbb97b 100644 --- a/assets/langs/en_US.json +++ b/assets/langs/en_US.json @@ -437,5 +437,22 @@ "获得位置信息,连接附近的蓝牙设备与推荐附近门店": "Obtain location information, connect to nearby Bluetooth devices, and recommend nearby stores", "蓝牙权限说明": "Bluetooth Permission Description", "搜索链接附近的蓝牙设备": "Search and connect to nearby Bluetooth devices", - "附近设备权限说明": "Nearby Device Permission Description" + "附近设备权限说明": "Nearby Device Permission Description", + "注销账号": "Delete Account", + "申请注销账号": "Request Account Deletion", + "注意!账号注销后,你将无法使用以下功能,": "Note! After account deletion, you will no longer be able to use the following features.", + "并且当前有绑定体征监测设备、智能床/床垫、AI摄像头等设备的账号不能注销,": "Accounts with bound vital sign monitoring devices, smart beds/mattresses, AI cameras, etc. cannot be deleted.", + "可先进行解绑后再进行注销操作。": "Please unbind these devices first before deleting your account.", + "无法查询睡眠报告": "Unable to access sleep reports", + "注销账号后你将无法查看体征消息,您以前的睡报告等数据记录也将被清空。": "After account deletion, you will no longer receive vital sign messages, and your previous sleep reports and data will be cleared.", + "无法控制智能设备": "Unable to control smart devices", + "你将无法控制你的": "You will no longer be able to control your", + "体征监测设备、智能床/床垫、AI摄像头": "vital sign monitoring devices, smart beds/mattresses, AI cameras,", + "等设备,以及与其相关的各种操作。": "and other related devices and operations.", + "无法使用的其他功能": "Other unavailable features", + "包含设备报修记录、AI大模型分析记录等": "Including device repair records, AI model analysis records, etc.", + "是否确认注销?": "Are you sure you want to delete your account?", + "注销账号成功": "Account deletion successful", + "注销账号失败": "Account deletion failed", + "已知晓,确定注销": "Understood, confirm deletion" } \ No newline at end of file diff --git a/assets/langs/zh_CN.json b/assets/langs/zh_CN.json index b9d04d6..d09130e 100644 --- a/assets/langs/zh_CN.json +++ b/assets/langs/zh_CN.json @@ -445,10 +445,27 @@ "年龄": "年龄", "设备ID": "设备ID", "体重": "体重", - "分":"分", - "位置权限说明":"位置权限说明", - "获得位置信息,连接附近的蓝牙设备与推荐附近门店":"获得位置信息,连接附近的蓝牙设备与推荐附近门店", - "蓝牙权限说明":"蓝牙权限说明", - "搜索链接附近的蓝牙设备":"搜索链接附近的蓝牙设备", - "附近设备权限说明":"附近设备权限说明" + "分": "分", + "位置权限说明": "位置权限说明", + "获得位置信息,连接附近的蓝牙设备与推荐附近门店": "获得位置信息,连接附近的蓝牙设备与推荐附近门店", + "蓝牙权限说明": "蓝牙权限说明", + "搜索链接附近的蓝牙设备": "搜索链接附近的蓝牙设备", + "附近设备权限说明": "附近设备权限说明", + "注销账号": "注销账号", + "申请注销账号": "申请注销账号", + "注意!账号注销后,你将无法使用以下功能,": "注意!账号注销后,你将无法使用以下功能,", + "并且当前有绑定体征监测设备、智能床/床垫、AI摄像头等设备的账号不能注销,": "并且当前有绑定体征监测设备、智能床/床垫、AI摄像头等设备的账号不能注销,", + "可先进行解绑后再进行注销操作。": "可先进行解绑后再进行注销操作。", + "无法查询睡眠报告": "无法查询睡眠报告", + "注销账号后你将无法查看体征消息,您以前的睡报告等数据记录也将被清空。": "注销账号后你将无法查看体征消息,您以前的睡报告等数据记录也将被清空。", + "无法控制智能设备": "无法控制智能设备", + "你将无法控制你的": "你将无法控制你的", + "体征监测设备、智能床/床垫、AI摄像头": "体征监测设备、智能床/床垫、AI摄像头", + "等设备,以及与其相关的各种操作。": "等设备,以及与其相关的各种操作。", + "无法使用的其他功能": "无法使用的其他功能", + "包含设备报修记录、AI大模型分析记录等": "包含设备报修记录、AI大模型分析记录等", + "是否确认注销?": "是否确认注销?", + "注销账号成功": "注销账号成功", + "注销账号失败": "注销账号失败", + "已知晓,确定注销": "已知晓,确定注销" } \ No newline at end of file diff --git a/assets/langs/zh_TW.json b/assets/langs/zh_TW.json index efedd01..bd7059e 100644 --- a/assets/langs/zh_TW.json +++ b/assets/langs/zh_TW.json @@ -436,5 +436,22 @@ "获得位置信息,连接附近的蓝牙设备与推荐附近门店": "獲得位置信息,連接附近的藍牙設備與推薦附近門店", "蓝牙权限说明": "藍牙權限說明", "搜索链接附近的蓝牙设备": "搜索連接附近的藍牙設備", - "附近设备权限说明": "附近設備權限說明" + "附近设备权限说明": "附近設備權限說明", + "注销账号": "註銷帳號", + "申请注销账号": "申請註銷帳號", + "注意!账号注销后,你将无法使用以下功能,": "注意!帳號註銷後,你將無法使用以下功能,", + "并且当前有绑定体征监测设备、智能床/床垫、AI摄像头等设备的账号不能注销,": "並且當前有綁定體徵監測設備、智能床/床墊、AI攝像頭等設備的帳號不能註銷,", + "可先进行解绑后再进行注销操作。": "可先進行解绑後再進行註銷操作。", + "无法查询睡眠报告": "無法查詢睡眠報告", + "注销账号后你将无法查看体征消息,您以前的睡报告等数据记录也将被清空。": "註銷帳號後你將無法查看體徵消息,您以前的睡報告等數據記錄也將被清空。", + "无法控制智能设备": "無法控制智能設備", + "你将无法控制你的": "你將無法控制你的", + "体征监测设备、智能床/床垫、AI摄像头": "體徵監測設備、智能床/床墊、AI攝像頭", + "等设备,以及与其相关的各种操作。": "等設備,以及與其相關的各種操作。", + "无法使用的其他功能": "無法使用的其他功能", + "包含设备报修记录、AI大模型分析记录等": "包含設備報修記錄、AI大模型分析記錄等", + "是否确认注销?": "是否確認註銷?", + "注销账号成功": "註銷帳號成功", + "注销账号失败": "註銷帳號失敗", + "已知晓,确定注销": "已知曉,確定註銷" } \ No newline at end of file diff --git a/lib/pages/login/LogoutPage.dart b/lib/pages/login/LogoutPage.dart new file mode 100644 index 0000000..05b2d34 --- /dev/null +++ b/lib/pages/login/LogoutPage.dart @@ -0,0 +1,349 @@ +import 'package:ef/ef.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutterflow_ui/flutterflow_ui.dart'; +import 'package:get_storage/get_storage.dart'; + +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/color/appFontsize.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/login/login_controller.dart'; +import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; +import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; +import 'package:vbvs_app/controller/user_info_controller.dart'; +import 'package:vbvs_app/pages/common/selectDialog.dart'; +import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart'; + +class LogoutPage extends GetView { + BoxConstraints? bodysize; + final scaffoldKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return LayoutBuilder(builder: (context, cc) { + bodysize = cc; + + return GestureDetector( + // onTap: () => FocusScope.of(context).unfocus(),, + child: Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/img/bgNoImg.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), + ), + child: Scaffold( + appBar: AppBar( + backgroundColor: themeController.currentColor.sc17, + automaticallyImplyLeading: false, + iconTheme: const IconThemeData(color: Colors.white), + titleSpacing: 0, + title: SizedBox( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + // 中间居中的标题 + Text( + '注销账号'.tr, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, + ), + ), + // 左侧图标 + Positioned( + left: 0.rpx, + child: returnIconButtom, + ), + ], + ), + ), + centerTitle: false, + ), + key: scaffoldKey, + backgroundColor: Colors.transparent, + body: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 1, + decoration: const BoxDecoration(), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Container( + width: MediaQuery.sizeOf(context).width, + height: 100, + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0, 33, 0, 0), + child: Container( + width: MediaQuery.sizeOf(context).width, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 38.rpx, 0, 39.rpx, 0), + child: Container( + width: MediaQuery.sizeOf(context).width, + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Container( + width: 50, + height: 50, + child: Image.asset( + 'assets/images/delete_account.png', + fit: BoxFit.cover, + color: themeController + .currentColor.sc3, + ), + ), + Text( + "申请注销账号".tr, + style: TextStyle( + fontSize: 20, // 设置字体大小 + color: Color(0xFFFFFFFF), + // decoration: TextDecoration.underline, // 添加下划线 + ), + ), + Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + RichText( + text: TextSpan( + text: "注意!账号注销后,你将无法使用以下功能,".tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, // 设置字体大小 + color: themeController + .currentColor + .sc3 // 默认颜色 + ), + children: [ + TextSpan( + text: + "并且当前有绑定体征监测设备、智能床/床垫、AI摄像头等设备的账号不能注销," + .tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, + color: themeController + .currentColor + .sc14 // 设置为#E45E91的颜色 + ), + ), + TextSpan( + text: "可先进行解绑后再进行注销操作。".tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, + color: themeController + .currentColor.sc3), + ), + ], + ), + ), + const SizedBox( + height: 24, + ), + Text( + "无法查询睡眠报告".tr, + style: TextStyle( + fontSize: AppFontsize + .title_size, // 设置字体大小 + color: themeController + .currentColor.sc14), + ), + const SizedBox( + height: 6, + ), + Text( + "注销账号后你将无法查看体征消息,您以前的睡报告等数据记录也将被清空。" + .tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, // 设置字体大小 + color: themeController + .currentColor.sc3), + ), + const SizedBox( + height: 24, + ), + Text( + "无法控制智能设备".tr, + style: TextStyle( + fontSize: AppFontsize + .title_size, // 设置字体大小 + color: themeController + .currentColor.sc14), + ), + const SizedBox( + height: 6, + ), + RichText( + text: TextSpan( + text: "你将无法控制你的".tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, // 设置字体大小 + color: themeController + .currentColor + .sc3 // 默认颜色 + ), + children: [ + TextSpan( + text: "体征监测设备、智能床/床垫、AI摄像头" + .tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, + color: themeController + .currentColor + .sc14 // 设置为#E45E91的颜色 + ), + ), + TextSpan( + text: "等设备,以及与其相关的各种操作。".tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, + color: themeController + .currentColor.sc3), + ), + ], + ), + ), + const SizedBox( + height: 24, + ), + Text( + "无法使用的其他功能".tr, + style: TextStyle( + fontSize: AppFontsize + .title_size, // 设置字体大小 + color: themeController + .currentColor.sc14, + ), + ), + const SizedBox( + height: 6, + ), + Text( + "包含设备报修记录、AI大模型分析记录等".tr, + style: TextStyle( + fontSize: AppFontsize + .normal_text_size, // 设置字体大小 + color: themeController + .currentColor.sc3), + ), + ], + )), + ] + .divide(const SizedBox(height: 24)) + .addToStart( + const SizedBox(height: 14)) + .addToEnd(const SizedBox(height: 17)), + ), + ), + ), + ), + ), + ), + ], + ), + ), + ), + ), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 100.rpx, 0, 100.rpx, 60.rpx), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.056, + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + ), + child: FFButtonWidget( + onPressed: () async { + showCustomConfirmDialog(context, "是否确认注销?".tr) + .then((v) async { + if (v != "confirm") { + return; + } + MHTLoginController loginController = Get.find(); + UserInfoController userInfoController = + Get.find(); + int code = await loginController.deletedAccount(); + if (code == 1) { + userInfoController.logOut(); + Get.offAllNamed("/mianPageBottomChange"); + TopSlideNotification.show(context, + text: "注销账号成功".tr, + textColor: themeController.currentColor.sc2); + } else { + TopSlideNotification.show(context, + text: "注销账号失败".tr, + textColor: themeController.currentColor.sc9); + } + }); + }, + text: '已知晓,确定注销'.tr, + options: FFButtonOptions( + height: 40, + padding: const EdgeInsetsDirectional.fromSTEB( + 24, 0, 24, 0), + iconPadding: + const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0), + color: themeController.currentColor.sc14, + textStyle: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + fontSize: AppFontsize.normal_text_size, + letterSpacing: 0, + ), + elevation: 0, + borderSide: const BorderSide( + color: Colors.transparent, + width: 1, + ), + borderRadius: BorderRadius.circular( + AppConstants().button_container_radius), + ), + ), + ), + ), + ), + ], + ), + ), + ), + )); + }); + } + + Future _copyToClipboard(String text) async { + await Clipboard.setData(ClipboardData(text: text)); + } +} diff --git a/lib/pages/mh_page/bluetooth.dart b/lib/pages/mh_page/bluetooth.dart index 305adb0..d11ecd5 100644 --- a/lib/pages/mh_page/bluetooth.dart +++ b/lib/pages/mh_page/bluetooth.dart @@ -396,7 +396,7 @@ class _BluetoothPageState extends State { ); } else if (obsData['bind_type'] == 2) { // 删除弹窗 - showDeleteDeviceConfirmDialog( + showDeleteDeviceConfirmDialog( context: context, title: "是否进行删除?".tr, onConfirm: () async { diff --git a/lib/pages/mh_page/delete_account.dart b/lib/pages/mh_page/delete_account.dart index 5d74b0a..2bf1ad4 100644 --- a/lib/pages/mh_page/delete_account.dart +++ b/lib/pages/mh_page/delete_account.dart @@ -263,10 +263,6 @@ class DeletedAccountPage extends GetView { ), child: FFButtonWidget( onPressed: () async { - // TopSlideNotification.show( - // context, - // text: "待开发功能".tr, - // ); showCustomConfirmDialog(context, "是否确认注销?".tr) .then((v) async { if (v != "confirm") { @@ -287,19 +283,6 @@ class DeletedAccountPage extends GetView { text: "注销账号失败".tr, textColor: themeController.currentColor.sc9); } - - // if (code != null && code == 1) { - // final box = GetStorage(); - // box.remove('user'); - // box.remove('token'); - // userInfoController.model.token = null; - // userInfoController.model.user = null; - // userInfoController.model.login = 0; - // userInfoController.model.message = 0; - // GlobalController globalController = - // Get.find(); - // globalController.resetParmAll(); - // } }); }, text: '注销账号'.tr, diff --git a/lib/pages/user/setting_page.dart b/lib/pages/user/setting_page.dart index d901cd9..efbf04d 100644 --- a/lib/pages/user/setting_page.dart +++ b/lib/pages/user/setting_page.dart @@ -503,10 +503,11 @@ class _SettingPageState extends State { borderRadius: AppConstants().button_container_radius, // 圆角半径 onTap: () { - TopSlideNotification.show( - context, - text: "待开发功能".tr, - ); + // TopSlideNotification.show( + // context, + // text: "待开发功能".tr, + // ); + Get.toNamed("/deleteAccount"); }, colors: [ Colors.transparent, diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart index 1a661eb..12bb063 100644 --- a/lib/routers/routers.dart +++ b/lib/routers/routers.dart @@ -22,6 +22,7 @@ import 'package:vbvs_app/pages/device_bind/device_type.dart'; import 'package:vbvs_app/pages/device_bind/device_type_list.dart'; import 'package:vbvs_app/pages/device_bind/wifi_page.dart'; import 'package:vbvs_app/pages/device_bind/wifi_page_person.dart'; +import 'package:vbvs_app/pages/login/LogoutPage.dart'; import 'package:vbvs_app/pages/login/other_login.dart'; import 'package:vbvs_app/pages/main_bottom/e_page.dart'; import 'package:vbvs_app/pages/main_bottom/follow_page.dart'; @@ -104,6 +105,8 @@ var routes = { "/afterWifiPagePerson": (contxt, {arguments}) => AfterWifiPagePerson( type: arguments, ), + "/deleteAccount": (context, {arguments}) =>LogoutPage(), + }; var onGenerateRoute = (RouteSettings settings) {