feat:密码检验
This commit is contained in:
1 parent
a92732310e
commit
b94cbf5faa
5 files changed
+63
-1
No files matched your search
@@ -4,6 +4,7 @@ enum OrderPayDisplayType implements BaseEnum {
|
||||
qrCode("1", "二维码支付"),
|
||||
walletCard("2", "饭卡支付"),
|
||||
face("3", "人脸支付"),
|
||||
cash("4", "现金支付"),
|
||||
;
|
||||
|
||||
@override
|
||||
|
||||
@@ -19,4 +19,6 @@ export './order/select_pay_type_dialog.dart';
|
||||
export './order/steelyard_container.dart';
|
||||
export 'order/order_common.dart';
|
||||
|
||||
export './setting/setting_password_dialog.dart';
|
||||
|
||||
export './user/user_info.dart';
|
||||
@@ -0,0 +1,57 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
Future<bool> settingPasswordDialog(BuildContext context) async {
|
||||
final theme = FTheme.of(context);
|
||||
|
||||
TextEditingController uniqueCodeC = TextEditingController();
|
||||
|
||||
final appUserSetting = await AppSettingTool.getUserSetting();
|
||||
|
||||
final flag = await showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (context) => FDialog(
|
||||
direction: Axis.horizontal,
|
||||
title: Text('登录密码校验', style: theme.typography.xl2),
|
||||
body: FTextField.password(
|
||||
controller: uniqueCodeC,
|
||||
label: const SizedBox.shrink(),
|
||||
hint: "请输入登录密码",
|
||||
maxLines: 1,
|
||||
).width(context.width * 0.5).marginSymmetric(vertical: 20.h),
|
||||
actions: [
|
||||
FButton(
|
||||
style: FButtonStyle.outline,
|
||||
label: Text('取消', style: theme.typography.base),
|
||||
onPress: () => Navigator.of(context).pop(false),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'确定',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onPress: () async {
|
||||
final password = uniqueCodeC.text;
|
||||
if (ObjectUtil.isEmpty(password)) {
|
||||
Toast.error(msg: "请输入密码");
|
||||
return;
|
||||
}
|
||||
if (appUserSetting.password != password) {
|
||||
Toast.error(msg: "密码不正确");
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
return flag ?? false;
|
||||
}
|
||||
@@ -56,6 +56,8 @@ class PanelController extends GetxController {
|
||||
Get.toNamed(RouteNames.orderHistory);
|
||||
break;
|
||||
case PanelType.setting:
|
||||
final flag = await settingPasswordDialog(Get.context!);
|
||||
if (!flag) return;
|
||||
Get.toNamed(RouteNames.setting);
|
||||
break;
|
||||
case PanelType.cardActive:
|
||||
|
||||
@@ -20,7 +20,7 @@ Widget settingPay(BuildContext context) {
|
||||
autoHide: true,
|
||||
prefixIcon: appPrefixIcon(context, FAssets.icons.settings),
|
||||
suffixIcon: appSuffixIcon(context, FAssets.icons.audioLines),
|
||||
title: appPrefixTitle(context, "所有支付方式"),
|
||||
title: appPrefixTitle(context, "使用支付方式"),
|
||||
menuTileBuilder: (context, index) {
|
||||
if (index >= OrderPayDisplayType.values.length) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user