diff --git a/android/app/build.gradle b/android/app/build.gradle index 28c20a56..7ac3760d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -90,7 +90,7 @@ def mfph = [ ] android { - compileSdkVersion 30 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -106,7 +106,7 @@ android { defaultConfig { applicationId "com.zsw.huixiang" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt b/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt index 3a0174fc..babb53f4 100644 --- a/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt +++ b/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt @@ -22,7 +22,7 @@ class WXPayEntryActivity : AbsWXPayCallbackActivity() { val wechatAppId = appInfo.metaData.getString("weChatAppId") if (wechatAppId != null ){ WXAPiHandler.setupWxApi(wechatAppId, this) - WXAPiHandler.setCoolBool(true) +// WXAPiHandler.setCoolBool(true) io.flutter.Log.d("fluwx", "weChatAppId:$wechatAppId") }else { io.flutter.Log.e("fluwx", "can't load meta-data weChatAppId") diff --git a/assets/image/2x/logout.png b/assets/image/2x/logout.png new file mode 100644 index 00000000..a3d13819 Binary files /dev/null and b/assets/image/2x/logout.png differ diff --git a/assets/image/2x/logout_s.png b/assets/image/2x/logout_s.png new file mode 100644 index 00000000..15e58aac Binary files /dev/null and b/assets/image/2x/logout_s.png differ diff --git a/assets/image/3x/logout.png b/assets/image/3x/logout.png new file mode 100644 index 00000000..a2ae2c7f Binary files /dev/null and b/assets/image/3x/logout.png differ diff --git a/assets/image/3x/logout_s.png b/assets/image/3x/logout_s.png new file mode 100644 index 00000000..894718a2 Binary files /dev/null and b/assets/image/3x/logout_s.png differ diff --git a/assets/image/logout.png b/assets/image/logout.png new file mode 100644 index 00000000..398b0d8e Binary files /dev/null and b/assets/image/logout.png differ diff --git a/assets/image/logout_s.png b/assets/image/logout_s.png new file mode 100644 index 00000000..18170ae4 Binary files /dev/null and b/assets/image/logout_s.png differ diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 5ae6e106..61ea508c 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:huixiang/community/community_child_list.dart'; import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index 7cfbf095..21b0cc94 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -135,49 +135,51 @@ class _ClassDetails extends State with WidgetsBindingObserver { physics: BouncingScrollPhysics(), child: Column( children: [ - Stack( - children: [ - ClassDetailsVideo(key:videoKey,exitFull: (){setState(() {});}, - coverImg: chapterList.length > chapterIndex - ? chapterList[chapterIndex].content.coverImg - : "",isShowImg: this.isShowImg, - changeShowImg: (isShowImg){setState(() { - this.isShowImg = isShowImg; - });},heightFun: (height) { - this.height = height + - MediaQuery - .of(context) - .padding - .top + - kToolbarHeight + - 24; - if (mounted) setState(() {}); - },), - Container( - margin: EdgeInsets.only( - top: 40.h, left: 16.w, right: 16.w), - decoration: BoxDecoration( - color: Colors.transparent, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Image.asset( - "assets/image/integral_return.png", - width: 24, - height: 24, + Container( + child:Stack( + children: [ + ClassDetailsVideo(key:videoKey,exitFull: (){setState(() {});}, + coverImg: chapterList.length > chapterIndex + ? chapterList[chapterIndex].content.coverImg + : "",isShowImg: this.isShowImg, + changeShowImg: (isShowImg){setState(() { + this.isShowImg = isShowImg; + });},heightFun: (height) { + this.height = height + + MediaQuery + .of(context) + .padding + .top + + kToolbarHeight + + 24; + if (mounted) setState(() {}); + },), + Container( + margin: EdgeInsets.only( + top: 40.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop( + course != null ? course.viewers + 1 : 0); + }, ), - onTap: () { - Navigator.of(context).pop( - course != null ? course.viewers + 1 : 0); - }, - ), - ], + ], + ), ), - ), - ], + ], + ), ), Container( margin: EdgeInsets.only(bottom: 16.h), diff --git a/lib/community/order_page.dart b/lib/community/order_page.dart new file mode 100644 index 00000000..862426ea --- /dev/null +++ b/lib/community/order_page.dart @@ -0,0 +1,76 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/order/order_history_page.dart'; +import 'package:huixiang/view_widget/login_tips_dialog.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/my_tab.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class OrderPage extends StatefulWidget { + @override + State createState() { + return _OrderPage(); + } +} + +class _OrderPage extends State + with SingleTickerProviderStateMixin { + TabController tabcontroller; + + List lables = [ + "全部", + "待付款", + "未完成", + "已完成", + ]; + + @override + void initState() { + super.initState(); + + if (tabcontroller == null) + tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1); + } + + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 4, + child: Scaffold( + appBar: MyAppBar( + title: "", + leading: false, + bottom: TabBar( + // isScrollable: true, //可滚动 + indicatorColor: Color(0xff39B54A), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 17.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.normal, + ), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xffA29E9E), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text: S.of(context).quanbu), + MyTab(text: S.of(context).daifukuan), + MyTab(text: S.of(context).weiwancheng), + MyTab(text: S.of(context).yiwancheng), + ], + ), + ), + body: TabBarView( + children: [OrderHistoryList(0),OrderHistoryList(1),OrderHistoryList(2),OrderHistoryList(3), ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 5b4d213e..5c137aa4 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -85,7 +85,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { } - ///邀请成功弹窗 + ///邀请成功 inviteShowAlertDialog(invite, InterviewCouponList interviewCouponList) { //显示对话框 showDialog( diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 385bafd9..d52b2f60 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -19,7 +19,6 @@ import 'package:flutter/services.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:dio/dio.dart'; -import 'package:huixiang/view_widget/invite_success_dialog.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:photo_view/photo_view.dart'; import 'package:shared_preferences/shared_preferences.dart'; diff --git a/lib/main.dart b/lib/main.dart index c51e7055..ae8ae5d5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -48,6 +48,8 @@ import 'package:huixiang/qr/qr_code_scan.dart'; import 'package:huixiang/qr/qr_share.dart'; import 'package:huixiang/setting/about_page.dart'; import 'package:huixiang/setting/help_feedback_page.dart'; +import 'package:huixiang/setting/logout_ing.dart'; +import 'package:huixiang/setting/logout_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/treaty_page.dart'; @@ -361,4 +363,8 @@ Map routers = { ReportNotice(), '/router/report_success': (context, {arguments}) => ReportSuccess(), + '/router/logout_page': (context, {arguments}) => + LogoutPage(), + '/router/logout_ing': (context, {arguments}) => + LogoutIng(), }; diff --git a/lib/main_page.dart b/lib/main_page.dart index 8a117688..1098eaba 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -22,6 +22,8 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; +import 'community/order_page.dart'; + class MainPage extends StatefulWidget { final Map arguments; @@ -103,6 +105,7 @@ class _MainPage extends State with WidgetsBindingObserver { },invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,), // MainHomePage(), UnionPage(), + // (Theme.of(context).platform == TargetPlatform.android) ? OrderPage() :CommunityPage(), CommunityPage(), MinePage(), ]; @@ -303,7 +306,7 @@ class _MainPage extends State with WidgetsBindingObserver { // bottomNavigationBigItem(S.of(context).pinpai, 0), bottomNavigationItem(S.of(context).main_menu1, 0), bottomNavigationItem(S.of(context).main_menu2, 1), - bottomNavigationItem(S.of(context).main_menu3, 2), + bottomNavigationItem((Theme.of(context).platform == TargetPlatform.android) ? "订单" :S.of(context).main_menu3 , 2), bottomNavigationItem(S.of(context).main_menu4, 3), ], ), diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index caf983a8..d50b5e95 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -508,4 +508,8 @@ abstract class ApiService { @GET("/home/appPopup") Future> appPopup(); + ///注销会员 + @GET("/member/deleteMine") + Future deleteMine(); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 96a48e33..5706536a 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1894,4 +1894,25 @@ class _ApiService implements ApiService { ); return value; } + + @override + Future> deleteMine() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/member/deleteMine', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/setting/logout_ing.dart b/lib/setting/logout_ing.dart new file mode 100644 index 00000000..76ca6dd2 --- /dev/null +++ b/lib/setting/logout_ing.dart @@ -0,0 +1,459 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/user_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/border_text.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../main.dart'; + +class LogoutIng extends StatefulWidget { + @override + State createState() { + return _LogoutIng(); + } +} + +class _LogoutIng extends State { + final TextEditingController phoneController = TextEditingController(); + final TextEditingController provingController = TextEditingController(); + String money; + String balance; + String phone = ""; + MinApiService minService; + ApiService apiService; + var btnText = S.current.send_code; + var _sendCodeStatus = 0; + Timer _timer; + UserInfo userInfo; + + @override + void initState() { + super.initState(); + queryUserBalance(); + } + + queryUserBalance() async { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: false, + ); + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + balance = userInfo?.balance ?? "0.00"; + money = userInfo?.money ??"0.00"; + phone = userInfo?.phone ?? ""; + if (mounted) setState(() {}); + } + } + + proving(mobile) async { + if(phoneController.text != phone){ + SmartDialog.showToast("手机号码不正确", + alignment: Alignment.center); + return ; + } + if (_sendCodeStatus != 0) + return; + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: true + ); + } + BaseData baseData = await apiService.sendVerify(mobile).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + countdown(); + SmartDialog.showToast(baseData.data, + alignment: Alignment.center); + }else{ + SmartDialog.showToast(baseData.msg, + alignment: Alignment.center); + } + } + + ///注销账户 + logout() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: true + ); + } + BaseData baseData = await apiService.deleteMine().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + logOut(); + SmartDialog.showToast(baseData.data, + alignment: Alignment.center); + }else{ + SmartDialog.showToast(baseData.msg, + alignment: Alignment.center); + Navigator.of(context).pop(); + } + } + + countdown() { + if (_timer != null && _timer.isActive) return; + int countdown = 60; + _timer = Timer.periodic(Duration(seconds: 1), (timer) { + countdown--; + if (countdown == 0) { + setState(() { + btnText = S.of(context).send_code; + }); + _sendCodeStatus = 0; + _timer.cancel(); + } else { + setState(() { + btnText = S.of(context).resend_in_seconds(countdown); + }); + } + }); + } + + @override + void dispose() { + if (_timer != null && _timer.isActive) _timer.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "", + titleColor: Colors.black, + titleSize: 18.sp, + background: Colors.transparent, + leadingColor: Colors.black, + ), + body: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + margin: EdgeInsets.only(left: 16, right: 17), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 16, + bottom: 4, + ), + child: Text( + "进行帐号注销", + style: TextStyle( + fontSize: 21.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + ), + ), + Text( + "再次提醒:注销帐号后不可恢复,相关数据和信息会永久删除。", + style: TextStyle( + fontSize: 14.sp, + height: 1.5, + fontWeight: MyFontWeight.regular, + color: Color(0xFF727272), + ), + ), + Padding( + padding: EdgeInsets.only( + top: 24, + bottom: 16, + ), + child: Text( + S.of(context).shoujihao, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(0.w, 0, 20.w, 0), + alignment: Alignment.topLeft, + child: TextField( + controller: phoneController, + inputFormatters: [LengthLimitingTextInputFormatter(11)], + decoration: InputDecoration( + border: InputBorder.none, + hintText: S.of(context).qingshurushoujihao, + hintStyle: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xffA29E9E), + ), + ), + ), + ), + Container( + height: 1.h, + width: MediaQuery.of(context).size.width, + color: Color(0xFFF4F4F4), + ), + Padding( + padding: EdgeInsets.only( + top: 15, + bottom: 16, + ), + child: Text( + "验证码", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + ), + ), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.fromLTRB(0.w, 0, 20.w, 0), + alignment: Alignment.topLeft, + child: TextField( + controller: provingController, + inputFormatters: [ + LengthLimitingTextInputFormatter(6) + ], + textInputAction: TextInputAction.next, + decoration: InputDecoration( + border: InputBorder.none, + hintText: S.of(context).qingshuruyanzhengma, + hintStyle: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xffA29E9E), + ), + ), + ), + )), + GestureDetector( + onTap: (){ + if(phoneController.text == ""){ + SmartDialog.showToast("请输入手机号码", + alignment: Alignment.center); + return; + } + proving(phoneController.text); + }, + child: + Text( + btnText, + style: TextStyle( + fontSize: 14.sp, + height: 1.5, + fontWeight: MyFontWeight.medium, + color:Color(0xFF32A060), + ), + ), + ) + + ], + ), + Container( + height: 1.h, + width: MediaQuery.of(context).size.width / 1.6, + color: Color(0xFFF4F4F4), + ), + ], + ), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () { + if(phoneController.text == ""){ + SmartDialog.showToast("请输入手机号码", + alignment: Alignment.center); + }else if(provingController.text == ""){ + SmartDialog.showToast("请输入验证码", + alignment: Alignment.center); + } + if(phoneController.text != "" && provingController.text != ""){ + showDeleteDialog(); + } + }, + + child: Container( + width: double.infinity, + height: 54.h, + alignment: Alignment.center, + color: (phoneController.text == "" && + provingController.text == "") + ? Color(0xFFD8D8D8) + : Color(0xFF32A060), + child: Text( + "确认注销", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFFFFFFF), + ), + )), + )) + ], + ), + ); + } + + ///确认注销账户弹窗 + showDeleteDialog() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content:Container( + width: double.infinity, + height: 350.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: (){ + Navigator.of(context).pop(); + }, + child: Container( + alignment: Alignment.topRight, + child:Image.asset( + "assets/image/yq_qx.png", + width: 20, + height: 20, + color: Color(0xFF353535), + ), + ),), + (balance == "0.00" && money == "0.00")? + Image.asset( + "assets/image/logout.png", + width: 80, + height: 80, + ) + : + Image.asset( + "assets/image/logout_s.png", + width: 80, + height: 80, + ), + Padding( + padding: EdgeInsets.only(top: 10, bottom: 6), + child: Text( + (balance == "0.00" && money == "0.00") ? "注销账号成功!" : "注销申请提交失败!", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 13), + child: Text( + (balance == "0.00" && money == "0.00") ? "由于当于帐号已注销,系统将自动退出登录":"您的平台余额及店铺余额未使用完!", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + height: 1.2, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + ), + if(balance != "0.00" && money != "0.00" || balance != "0.00" || money != "0.00") + Text( + "平台余额:¥ $money", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + if(balance != "0.00" && money != "0.00" || balance != "0.00" || money != "0.00") + Text( + "店铺余额:¥ $balance", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + SizedBox( + height:36.h, + ), + InkWell( + child: BorderText( + text: "我知道了", + textColor: Color(0xFF32A060), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + borderColor: Color(0xFF32A060), + radius:25, + padding: EdgeInsets.all(12), + borderWidth: 1, + ), + onTap: () { + if(balance != "0.00" && money != "0.00" || balance != "0.00" || money != "0.00"){ + Navigator.of(context).pop(); + return; + } + logout(); + }, + ) + ], + ), + ), + ); + }, + ); + } + + logOut() async { + SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); + sharedPreferences.setString("token", ""); + sharedPreferences.setString("user", ""); + sharedPreferences.setString("userJson", ""); + sharedPreferences.setString("userId", ""); + sharedPreferences.setString("mobile", ""); + sharedPreferences.setString("nick", ""); + + Navigator.of(context) + .pushNamedAndRemoveUntil('/router/login_page', (route) => false); + if (xgFlutterPlugin != null) { + xgFlutterPlugin.stopXg(); + } + } +} diff --git a/lib/setting/logout_page.dart b/lib/setting/logout_page.dart new file mode 100644 index 00000000..1397d73e --- /dev/null +++ b/lib/setting/logout_page.dart @@ -0,0 +1,293 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/border_text.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/round_button.dart'; + +class LogoutPage extends StatefulWidget { + @override + State createState() { + return _LogoutPage(); + } +} + +class _LogoutPage extends State { + var controller = new ScrollController(); + var checkStatus = false; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "帐号注销说明", + titleColor: Colors.black, + titleSize: 18.sp, + background: Colors.transparent, + leadingColor: Colors.black, + ), + body: Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + // child: Column( + // children: [ + // WebView( + // initialUrl: 'http://huixiang.lotus-wallet.com/user.html', + // ), + // ], + // ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 5), + child: Align( + alignment: Alignment.center, + child: Text( + "注销协议", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + ), + ), + Padding( + padding: + EdgeInsets.only(top: 16, bottom: 8, right: 20, left: 20), + child: Text( + "特别提示", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + ), + _textRich( + "您在申请注销流程中点击同意前,应当认真阅读《帐号注销协议》(以下简称“本协议”)。特别提醒您,当您成功提交注销申请后,即表示您已充分阅读、理解并接受本协议的全部内容。阅读本协议的过程中,如果您不同意相关任何条款,请您立即停止帐号注销程序"), + Padding( + padding: + EdgeInsets.only(top: 12, bottom: 8, right: 20, left: 20), + child: Text( + "您已了解并同意帐号注销后,将要自行承担以下后果:", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + height: 1.5, + color: Color(0xFF1A1A1A), + ), + ), + ), + _textRich( + "1.账号一旦注销,您将无法登录、使用该账号(也包括无法再使用该账号作为第三方账号登录其他产品),也就是说您将无法再以此账号登录/使用/继续使用一心回乡集团旗下的相关产品与服务"), + _textRich( + "2.帐号注销说明我们将删除您的相关信息。您在该帐号下的个人信息、交易记录、业务数据、历史信息等删除后均将无法找回。"), + _textRich( + "3.账号一旦注销,您曾通过该账号登录、使用的一心回乡集团旗下的产品与服务下的所有内容、信息、数据、记录将会被删除,您也无法再检索、访问、获取、继续使用和找回,也无权要求我们找回(但法律法规另有规定或监管部门另有要求的除外),包括:" + "\n   •该账号下的个人资料(例如:头像、昵称等)及绑定信息(例如:绑定手机号);" + "\n   •该账号下的您的个人信息(同时您亦不再享有《一心回乡隐私政策》中约定的您的用户权利,但法律法规另有规定的除外);" + "\n   •该账号曾发表的所有内容(例如:音频、图片、照片、评论、互动、点赞等);" + "\n   •该账号所登录的门店小程序也将无法使用。同时,小程序内的个人信息,账户信息等也将删除"), + _textRich( + "4.您理解并同意,注销帐号后,您曾获得的充值余额、积分、优惠券及其他虚拟财产等将视为您自愿、主动放弃,无法继续使用,由此引起一切纠纷由您自行处理,我们不承担任何责任。"), + _textRich("5.请注意,注销您的帐号并不代表本帐号注销前的帐号行为和相关责任得到豁免或减轻。"), + Padding( + padding: + EdgeInsets.only(top: 12, bottom: 8, right: 20, left: 20), + child: Text( + "注销流程:", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + ), + _textRich("1.首先,保在您开始注销操作前,请先进行以下确认,保证帐号、财产完全:" + "\n   •帐号处于安全状态;" + "\n   •请确认平台余额以及店铺余额清零,否则将不予注销;" + "\n   •请确认当下无正在进行中的交易,否则无法进行注销操作;。"), + _textRich( + "2.勾选《一心回乡账号注销协议》,点击注销后,系统将判定帐号是否符合注销条件,符合后进行手机号验证,输入正确验证码后既注销完成。"), + Padding( + padding: + EdgeInsets.only(top: 12, bottom: 8, right: 20, left: 20), + child: Text( + "协议附则:", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + ), + _textRich( + "1.一心回乡有权在必要时修改本协议,您可以在相关页面查阅最新的本协议。您的任何使用本功能的行为,即视为您已经阅读并同意本协议及相应更新。"), + _textRich( + "2.本协议的拟定、解释均以中文为准。除双方另有约定外,任何有关本协议的翻译不得作为解释本协议或判定双方当事人意图之依据。"), + SizedBox( + height: 24.h, + ), + Container( + width: double.infinity, + margin: EdgeInsets.only(bottom: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Checkbox( + value: checkStatus, + onChanged: (a) { + setState(() { + checkStatus = !checkStatus; + }); + }, + checkColor: Color(0xFFFFFFFF), + fillColor: MaterialStateProperty.all(Color(0xFF32A060)), + ), + Text( + "已了解《一心回乡账号注销协议》,并自行承担相关后果", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF010101), + ), + ) + ], + ), + ), + GestureDetector( + onTap: () { + if (!checkStatus) { + SmartDialog.showToast("请勾选同意《一心回乡账号注销协议》", + alignment: Alignment.center); + return; + } + showDeleteDialog(); + }, + child: Container( + width: double.infinity, + height: 54.h, + alignment: Alignment.center, + color: checkStatus ? Color(0xFF32A060) : Color(0xFFD8D8D8), + child: Text( + "注销", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFFFFFFF), + ), + )), + ) + ], + ), + ), + ), + ); + } + + Widget _textRich(var text) { + return Padding( + padding: EdgeInsets.only(bottom: 8, right: 20, left: 20), + child: Text( + text, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + height: 1.7, + color: Colors.black), + ), + ); + } + + ///注销账户弹窗 + showDeleteDialog() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content: Container( + width: MediaQuery.of(context).size.width - 84, + height: 130.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "注销账户会清空所有的信息和数据,确认要进行注销吗?", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 17.sp, + height: 1.2, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + SizedBox( + height: 20.h, + ), + Row( + children: [ + Expanded( + child: InkWell( + child: BorderText( + text: "确认注销", + textColor: Color(0xFF32A060), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + borderColor: Color(0xFF32A060), + radius: 4, + padding: EdgeInsets.all(12), + borderWidth: 1, + ), + onTap: () { + Navigator.of(context).popAndPushNamed( + '/router/logout_ing'); + }, + ), + flex: 1, + ), + SizedBox( + width: 16.w, + ), + Expanded( + child: InkWell( + child: RoundButton( + text: "我再想想", + textColor: Colors.white, + radius: 4, + padding: EdgeInsets.all(12), + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + flex: 1, + ), + ], + ) + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/setting/setting_page.dart b/lib/setting/setting_page.dart index 1ee9fccc..314ed979 100644 --- a/lib/setting/setting_page.dart +++ b/lib/setting/setting_page.dart @@ -146,6 +146,12 @@ class _SettingPage extends State { Navigator.of(context).pushNamed('/router/about_page'); }, ), + GestureDetector( + child: settingSingleItem("注销账号"), + onTap: () { + Navigator.of(context).pushNamed('/router/logout_page'); + }, + ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.end, diff --git a/pubspec.lock b/pubspec.lock index b3474fc4..a3579962 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -222,7 +222,7 @@ packages: name: flutter_layout_grid url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.3" + version: "1.0.6" flutter_localizations: dependency: "direct main" description: flutter @@ -307,7 +307,7 @@ packages: name: fluwx url: "https://pub.flutter-io.cn" source: hosted - version: "3.6.1+4" + version: "3.8.1" font_awesome_flutter: dependency: "direct main" description: