太和e护注销登录
This commit is contained in:
349
lib/pages/login/LogoutPage.dart
Normal file
349
lib/pages/login/LogoutPage.dart
Normal file
@@ -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<ScaffoldState>();
|
||||
|
||||
@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<UserInfoController>();
|
||||
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<void> _copyToClipboard(String text) async {
|
||||
await Clipboard.setData(ClipboardData(text: text));
|
||||
}
|
||||
}
|
||||
@@ -396,7 +396,7 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
);
|
||||
} else if (obsData['bind_type'] == 2) {
|
||||
// 删除弹窗
|
||||
showDeleteDeviceConfirmDialog(
|
||||
showDeleteDeviceConfirmDialog(
|
||||
context: context,
|
||||
title: "是否进行删除?".tr,
|
||||
onConfirm: () async {
|
||||
|
||||
@@ -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>();
|
||||
// globalController.resetParmAll();
|
||||
// }
|
||||
});
|
||||
},
|
||||
text: '注销账号'.tr,
|
||||
|
||||
@@ -503,10 +503,11 @@ class _SettingPageState extends State<SettingPage> {
|
||||
borderRadius:
|
||||
AppConstants().button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "待开发功能".tr,
|
||||
);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发功能".tr,
|
||||
// );
|
||||
Get.toNamed("/deleteAccount");
|
||||
},
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user