Merge branch 'release' of https://gitee.com/starlock-cn/app-starlock into release

This commit is contained in:
魏少阳 2024-07-09 18:04:34 +08:00
commit 834fdc80d7
83 changed files with 1670 additions and 1898 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
ios/.DS_Store vendored

Binary file not shown.

View File

@ -337,12 +337,12 @@ SPEC CHECKSUMS:
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
fluwx: c18fd6c16b03a2187cd07d6e48e32a7801962849
google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18
ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1
JCore: 05f0f3489672ea3fa55338bae4866224bc092b1f
JPush: 76668b765fcfd7c15f86b05ca0e5cdc01945ce23
@ -367,4 +367,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc
COCOAPODS: 1.15.2
COCOAPODS: 1.14.3

View File

@ -188,9 +188,6 @@ import 'mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.d
import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart';
import 'mine/supportStaff/supportStaff_page.dart';
import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart';
import 'mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart';
import 'mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart';
import 'mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart';
import 'mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart';
import 'mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart';
import 'mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart';
@ -367,8 +364,6 @@ abstract class Routers {
'/NewSMSTemplatePage'; // -
static const String valueAddedServicesListEmailTemplatePage =
'/ValueAddedServicesListEmailTemplatePage'; // -
static const String valueAddedServicesAddEmailTemplatePage =
'/ValueAddedServicesAddEmailTemplatePage'; // -
static const String valueAddedServicesBuyAndUseRecordManagePage =
'/ValueAddedServicesBuyAndUseRecordManagePage'; // -使
@ -889,18 +884,6 @@ abstract class AppRouters {
name: Routers.newSMSTemplatePage,
page: () => const NewSMSTemplatePage(),
),
GetPage<dynamic>(
name: Routers.valueAddedServicesListEmailTemplatePage,
page: () => const ValueAddedServicesListEmailTemplatePage(),
),
GetPage<dynamic>(
name: Routers.valueAddedServicesAddEmailTemplatePage,
page: () => const ValueAddedServicesAddEmailTemplatePage(),
),
GetPage<dynamic>(
name: Routers.valueAddedServicesBuyAndUseRecordManagePage,
page: () => const ValueAddedServicesBuyAndUseRecordManagePage(),
),
GetPage<dynamic>(
name: Routers.lockScreenPage,
page: () => const LockScreenPage(),

View File

@ -65,67 +65,62 @@ class OTAUpgradeCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
// id 40
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
//platform 2
int platform0 = (platform! & 0xFF00) >> 8;
int platform1 = platform! & 0xFF;
final int platform0 = (platform! & 0xFF00) >> 8;
final int platform1 = platform! & 0xFF;
data.add(platform0);
data.add(platform1);
//product 2
// int product0 = (product! & 0xFF00) >> 8;
// int product1 = product! & 0xFF;
// data.add(product0);
// data.add(product1);
data.addAll([0, 1]); // 01
data.addAll(<int>[0, 1]); // 01
//HwVersion 20
int hwVersionLength = utf8.encode(hwVersion!).length;
final int hwVersionLength = utf8.encode(hwVersion!).length;
data.addAll(utf8.encode(hwVersion!));
data = getFixedLengthList(data, 20 - hwVersionLength);
//FwVersion 20
int fwVersionLength = utf8.encode(fwVersion!).length;
final int fwVersionLength = utf8.encode(fwVersion!).length;
data.addAll(utf8.encode(fwVersion!));
data = getFixedLengthList(data, 20 - fwVersionLength);
//fwSize 4
ByteData bytes = ByteData(4); // 4
final ByteData bytes = ByteData(4); // 4
bytes.setInt32(0, fwSize!);
List<int> byteList = bytes.buffer.asUint8List();
final List<int> byteList = bytes.buffer.asUint8List();
data.addAll(byteList);
// 16
Uint8List result = Uint8List(16);
final Uint8List result = Uint8List(16);
// 4
for (int i = 0; i < fwMD5!.length; i += 2) {
String hex = fwMD5!.substring(i, i + 2);
int byteValue = int.parse(hex, radix: 16);
final String hex = fwMD5!.substring(i, i + 2);
final int byteValue = int.parse(hex, radix: 16);
result[i ~/ 2] = byteValue;
}
data.addAll(result);
@ -135,7 +130,7 @@ class OTAUpgradeCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -144,19 +139,19 @@ class OTAUpgradeCommand extends SenderProtocol {
authCodeData.addAll(utf8.encode(userID!));
//token 4 Token 0
authCodeData.addAll(token??[]);
authCodeData.addAll(token ?? <int>[]);
authCodeData.addAll(signKey??[]);
authCodeData.addAll(signKey ?? <int>[]);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -164,7 +159,6 @@ class OTAUpgradeCommand extends SenderProtocol {
printLog(data);
if (encrypt) {
// LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
@ -176,7 +170,7 @@ class OTAUpgradeCommand extends SenderProtocol {
}
class OTAUpgradeReply extends Reply {
List<int> token = [];
List<int> token = <int>[];
OTAUpgradeReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {

View File

@ -231,16 +231,17 @@ class _StarLockForgetPasswordPageState
Obx(() {
return SubmitBtn(
btnName:
"${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}",
'${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}',
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
? () async {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ??
false;
if (!isNetWork) {
return;
}

View File

@ -188,9 +188,10 @@ class _StarLockForgetPasswordPageState
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
? () async {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ??
false;
if (!isNetWork) {
return;
}

View File

@ -146,7 +146,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
),
),
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),

View File

@ -5,11 +5,10 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart';
import 'package:star_lock/tools/NativeInteractionTool.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
@ -244,7 +243,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
//
Future<void> keyCheckFace() async {
final AdvancedFunctionRecordEntity entity =
final ValueAddedServicesHighFunctionEntity entity =
await ApiRepository.to.keyCheckFace(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
);

View File

@ -364,7 +364,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
'receiver': state.emailOrPhoneController.text,
'channelType':
state.emailOrPhoneController.text.contains('@') ? 2 : 1,
'keyId': logic.keyId
'keyId': logic.keyId,
'unlockType': 1,
});
},
),
@ -501,18 +502,37 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
);
}
void _openModalBottomSheet() {
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 270.h),
constraints: BoxConstraints(maxHeight: 323.h),
builder: (BuildContext context) {
return Column(
children: <Widget>[
SizedBox(
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16.h, bottom: 16.h),
width: ScreenUtil().screenWidth,
height: 180.h,
child: Center(
child: Text(
'分享',
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w500),
),
),
),
const Divider(
height: 1,
color: AppColors.greyLineColor,
),
Container(
width: ScreenUtil().screenWidth,
height: 160.h,
color: Colors.white,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
@ -521,18 +541,23 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
Container(
color: Colors.white,
margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0),
width: ScreenUtil().screenWidth,
child: TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
@ -600,7 +625,14 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
case 2:
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
Get.toNamed(Routers.sendEmailNotificationPage,
arguments: <String, Object?>{
'receiver': state.emailOrPhoneController.text,
'channelType':
state.emailOrPhoneController.text.contains('@') ? 2 : 1,
'keyId': logic.keyId,
'unlockType': 1,
});
}
break;
case 3:

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -43,11 +42,13 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
children: <Widget>[
Obx(() => CommonItem(
leftTitel:
'${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}',
'${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}',
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () {
Obx(() => lockDataListItem(
TranslationLoader.lanKeys!.name!.tr, state.typeName.value,
() {
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
@ -63,12 +64,11 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})),
Obx(() => Visibility(
visible: state.keyType.value == 4 ||
state.keyType.value == 2 ||
state.keyType.value == 1,
state.keyType.value == 2 ||
state.keyType.value == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h,
@ -76,26 +76,32 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
isHaveDirection: true,
isHaveLine: true,
action: () async {
if(state.keyType.value == 2 || state.keyType.value == 1){
if (state.keyType.value == 2 || state.keyType.value == 1) {
//
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData': state.fingerprintItemData.value,
});
if(data != null) {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeDatePage,
arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData':
state.fingerprintItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data['beginTimeTimestamp'];
state.endDate.value = data['endTimeTimestamp'];
state.keyType.value = 2;
});
}
}else if(state.keyType.value == 4){
} else if (state.keyType.value == 4) {
//
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData': state.fingerprintItemData.value,
});
if(data != null) {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData':
state.fingerprintItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data['starDate'];
state.endDate.value = data['endDate'];
@ -114,11 +120,14 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
isHaveDirection: true,
isHaveLine: true,
action: () async {
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData': state.fingerprintItemData.value,
});
if(data != null) {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData':
state.fingerprintItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data['starDate'];
state.endDate.value = data['endDate'];
@ -132,14 +141,18 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
visible: state.keyType.value == 4,
child: Obx(() => CommonItem(
leftTitel: '有效时间'.tr,
rightTitle: '${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
rightTitle:
'${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData': state.fingerprintItemData.value,
});
if(data != null) {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: <String, Object>{
'pushType': 0,
'fingerprintItemData':
state.fingerprintItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data['starDate'];
state.endDate.value = data['endDate'];
@ -182,11 +195,12 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
rightTitle: '',
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 2,
'id': state.fingerprintItemData.value.cardId.toString(),
'recordName': state.fingerprintItemData.value.cardName
});
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: <String, Object?>{
'type': 2,
'id': state.fingerprintItemData.value.cardId.toString(),
'recordName': state.fingerprintItemData.value.cardName
});
}),
// SizedBox(height: 40.h),
// addControlsBtn(type),
@ -195,15 +209,18 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
btnName: TranslationLoader.lanKeys!.delete!.tr,
isDelete: true,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onClick: () async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr,
() async {
state.isDeletCard.value = true;
logic.senderAddICCard();
});
@ -213,12 +230,14 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
Widget lockDataListItem(
String leftTitle, String conentStr, Function()? action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
padding:
EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
@ -226,15 +245,17 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
)),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
child: Text(conentStr,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp,
))),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
@ -282,6 +303,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
@override
void didChangeDependencies() {
super.didChangeDependencies();
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -70,7 +69,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -145,8 +145,10 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
motion: const ScrollMotion(),
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onPressed: (BuildContext context) async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ??
false;
if (!isNetWork) {
return;
}

View File

@ -6,7 +6,6 @@ import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
import 'checkingInAddStaffSelectKey_entity.dart';
class CheckingInAddStaffState {
CheckingInAddStaffState() {
final Map<dynamic, dynamic> map = Get.arguments;
getKeyInfosData.value = map['getKeyInfosData'];
@ -43,8 +42,15 @@ class CheckingInAddStaffState {
} else {
appUnHaveAccount.value = true;
}
if ((staffListItemData.value.cardStatus ?? 0) == 1) {
//
appUnHaveAccount.value = true;
attendanceWayNumber.value = '';
}
}
}
final Rx<LockListInfoItemEntity> getKeyInfosData =
LockListInfoItemEntity().obs;
final RxString companyId = ''.obs;

View File

@ -72,7 +72,8 @@ class DoorLockLogDataItem {
this.videoUrl,
this.headUrl,
this.userid,
this.keyboardPwd});
this.keyboardPwd,
this.recordStr});
DoorLockLogDataItem.fromJson(Map<String, dynamic> json) {
recordId = json['recordId'];
@ -87,6 +88,7 @@ class DoorLockLogDataItem {
headUrl = json['headUrl'];
userid = json['userid'];
keyboardPwd = json['keyboardPwd'];
recordStr = json['recordStr'];
}
int? recordId;
int? lockId;
@ -100,6 +102,7 @@ class DoorLockLogDataItem {
String? headUrl;
String? userid;
String? keyboardPwd;
String? recordStr;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -115,6 +118,7 @@ class DoorLockLogDataItem {
data['headUrl'] = headUrl;
data['userid'] = userid;
data['keyboardPwd'] = keyboardPwd;
data['recordStr'] = recordStr;
return data;
}
}

View File

@ -281,7 +281,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}操作" : ""}${timelineData.recordTypeName}',
// '$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}操作" : ""}${timelineData.recordTypeName}',
timelineData.recordStr ?? '',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
@ -6,7 +5,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
@ -148,7 +147,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Future<void> checkRealNameStatus(int realNameAuthStatus) async {
//
if (realNameAuthStatus == 1) {
final AdvancedFunctionRecordEntity entity =
final ValueAddedServicesHighFunctionEntity entity =
await ApiRepository.to.keyCheckFace(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
);
@ -397,7 +396,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> keyCheckFace() async {
final AdvancedFunctionRecordEntity entity =
final ValueAddedServicesHighFunctionEntity entity =
await ApiRepository.to.keyCheckFace(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
);

View File

@ -69,7 +69,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -5,7 +5,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/NativeInteractionTool.dart';
import 'package:star_lock/tools/baseGetXController.dart';
@ -205,7 +205,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
//
Future<void> keyCheckFace() async {
final AdvancedFunctionRecordEntity entity =
final ValueAddedServicesHighFunctionEntity entity =
await ApiRepository.to.keyCheckFace(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
);

View File

@ -424,7 +424,8 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
arguments: <String, Object?>{
'receiver': logic.emailOrPhone,
'channelType': logic.state.userNameType.value,
'keyId': logic.keyId
'keyId': logic.keyId,
'unlockType': 1
});
},
),
@ -582,18 +583,37 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
);
}
Future<void> _openModalBottomSheet() async {
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 270.h),
constraints: BoxConstraints(maxHeight: 323.h),
builder: (BuildContext context) {
return Column(
children: [
SizedBox(
children: <Widget>[
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16.h, bottom: 16.h),
width: ScreenUtil().screenWidth,
height: 180.h,
child: Center(
child: Text(
'分享',
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w500),
),
),
),
const Divider(
height: 1,
color: AppColors.greyLineColor,
),
Container(
width: ScreenUtil().screenWidth,
height: 160.h,
color: Colors.white,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
@ -602,18 +622,23 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
Container(
color: Colors.white,
margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0),
width: ScreenUtil().screenWidth,
child: TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
@ -675,7 +700,8 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
break;
case 2:
//
Get.toNamed(Routers.sendEmailNotificationPage);
Get.toNamed(Routers.sendEmailNotificationPage,
arguments: <String, Object?>{'unlockType': 1});
break;
case 3:
//

View File

@ -13,12 +13,18 @@ class SendEmailNotificationLogic extends BaseGetXController {
// 1 2
Future<void> getKeyNoticeTemplate() async {
final SendEmailNotificationEntity entity =
await ApiRepository.to.getKeyNoticeTemplate(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
keyId: state.getKeyId.value,
channelType: state.channelType.value,
);
final SendEmailNotificationEntity entity;
if (state.unlockType.value == 1) {
entity = await ApiRepository.to.getKeyNoticeTemplate(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
keyId: state.getKeyId.value,
channelType: state.channelType.value);
} else {
entity = await ApiRepository.to.getPwdNoticeTemplate(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
keyboardPwdId: state.getKeyId.value,
channelType: state.channelType.value);
}
if (entity.errorCode!.codeIsSuccessful) {
state.emailTemplateList.value =
entity.data?.list ?? <EmailNotificationItem>[];
@ -37,17 +43,32 @@ class SendEmailNotificationLogic extends BaseGetXController {
showToast('请输入接收者');
return;
}
final SendEmailNotificationEntity entity =
await ApiRepository.to.keyNoticeSubmit(
receiverName: state.getReceiver.value.isEmpty
? state.receiverController.text
: state.getReceiver.value,
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
keyId: state.getKeyId.value,
channelType: state.channelType.value,
openDoorType: 1,
templateType: state.currentNotifyItem.value.type ?? '',
);
final SendEmailNotificationEntity entity;
if (state.unlockType.value == 1) {
entity = await ApiRepository.to.keyNoticeSubmit(
receiverName: state.getReceiver.value.isEmpty
? state.receiverController.text
: state.getReceiver.value,
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
keyId: state.getKeyId.value,
channelType: state.channelType.value,
openDoorType: state.unlockType.value,
templateType: state.currentNotifyItem.value.type ?? '',
countryCode: state.countryCode.value,
);
} else {
entity = await ApiRepository.to.pwdNoticeSubmit(
receiverName: state.getReceiver.value.isEmpty
? state.receiverController.text
: state.getReceiver.value,
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
keyboardPwdId: state.getKeyId.value,
channelType: state.channelType.value,
openDoorType: state.unlockType.value,
templateType: state.currentNotifyItem.value.type ?? '',
countryCode: state.countryCode.value,
);
}
if (entity.errorCode!.codeIsSuccessful) {
showToast('发送成功');
Get.back();

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
@ -82,52 +84,77 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
},
)),
Container(
height: 360.h,
// height: 360.h,
color: Colors.white,
padding: EdgeInsets.only(
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
child: TextField(
maxLines: 8,
maxLength: 1000,
textAlign: TextAlign.start,
controller: state.templateContentController,
style: TextStyle(
color: Colors.black,
fontSize: 22.sp,
),
decoration: InputDecoration(
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
child: Column(
children: [
TextField(
maxLines: 8,
maxLength: 1000,
textAlign: TextAlign.start,
controller: state.templateContentController,
style: TextStyle(
color: Colors.black,
fontSize: 22.sp,
),
decoration: InputDecoration(
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 0.5,
///
width: 0.5,
),
),
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 1,
),
),
),
),
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 1,
),
),
),
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(
text: state.templateContentController.text));
EasyLoading.showToast('复制成功'.tr);
},
child: Container(
margin: EdgeInsets.only(left: 20.w, top: 0),
child: const Icon(
Icons.copy,
color: Colors.blue,
),
),
)
],
)
],
),
),
Container(height: 40.h),
_buildNewTemplateBtn(),
SizedBox(height: 40.h),
SubmitBtn(
btnName: '发送'.tr,
fontSize: 28.sp,
@ -144,7 +171,42 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
],
),
),
); }
);
}
Widget _buildNewTemplateBtn() {
return GestureDetector(
child: Container(
height: 60.h,
margin: EdgeInsets.only(left: 0.w, right: 0.w),
color: Colors.white,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'images/icon_btn_add.png',
width: 28.w,
height: 28.w,
),
SizedBox(
width: 6.w,
),
Text(
'新建模版',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.bold),
)
],
),
),
onTap: () {
Get.toNamed(Routers.newSMSTemplatePage);
},
);
}
Widget _buildReceiverItemWidget() {
return Container(
@ -165,7 +227,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Obx(() => Text(
'+${state.countryCode.value}',
'+${state.countryCode.value.toString()}',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 20.sp),
@ -183,7 +245,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryCode.value = int.parse(result['code']);
state.countryName.value = result['countryName'];
}
},
@ -191,6 +253,32 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
else
Container(),
getReceiverTFWidget(),
Container(
width: 32.w,
height: 32.w,
decoration: const BoxDecoration(
color: Colors.white,
image: DecorationImage(
image: AssetImage('images/icon_addressBook.png'),
fit: BoxFit.fill),
),
alignment: Alignment.center,
child: InkWell(
onTap: () async {
final Contact? currentContact =
await logic.state.contactPicker.selectContact();
logic.state.contact = currentContact!;
if (currentContact.phoneNumbers!.isNotEmpty) {
logic.state.receiverController.text = currentContact
.phoneNumbers![0]
.replaceAll(RegExp(r'\s+\b|\b\s'), '');
}
// if (currentContact.fullName!.isNotEmpty) {
// logic.state.keyNameController.text = currentContact.fullName!;
// }
},
),
)
],
),
);
@ -210,7 +298,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
LengthLimitingTextInputFormatter(50),
],
autofocus: false,
textAlign: TextAlign.end,

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
@ -12,6 +13,10 @@ class SendEmailNotificationState {
getKeyId.value = Get.arguments['keyId'];
}
if (Get.arguments['unlockType'] != null) {
unlockType.value = Get.arguments['unlockType'];
}
if (Get.arguments['channelType'] != null) {
channelType.value = Get.arguments['channelType'];
updateNotifyTypeText();
@ -29,8 +34,11 @@ class SendEmailNotificationState {
<EmailNotificationItem>[].obs;
Rx<EmailNotificationItem> currentNotifyItem = EmailNotificationItem().obs;
RxInt getKeyId = 0.obs; //keyId
RxString countryCode = '86'.obs;
RxInt countryCode = 86.obs;
RxString countryName = '中国'.obs;
late Contact contact;
final FlutterContactPicker contactPicker = FlutterContactPicker();
RxInt unlockType = 0.obs; // 1: 2
Future<void> updateNotifyTypeText() async {
if (channelType.value == 1) {

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -207,8 +206,9 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onClick: () async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -68,7 +67,8 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -115,11 +115,11 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
btnName:
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
onClick: () async {
final data =
await Get.toNamed(Routers.addFaceTypePage, arguments: <String, int>{
'lockId': state.lockId.value,
'fromType': 1 // 1 2
});
final data = await Get.toNamed(Routers.addFaceTypePage,
arguments: <String, int>{
'lockId': state.lockId.value,
'fromType': 1 // 1 2
});
if (data != null) {
logic.pageNo = 1;
getHttpData();
@ -158,10 +158,10 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
getFaceItemData.faceName!,
logic.getKeyType(getFaceItemData),
logic.getKeyDateType(getFaceItemData), () async {
final data =
await Get.toNamed(Routers.faceDetailPage, arguments: <String, FingerprintItemData>{
'faceItemData': getFaceItemData,
});
final data = await Get.toNamed(Routers.faceDetailPage,
arguments: <String, FingerprintItemData>{
'faceItemData': getFaceItemData,
});
if (data != null) {
logic.pageNo = 1;
getHttpData();
@ -184,8 +184,9 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
Widget _buildDeleteBtn(FingerprintItemData faceItemData) {
return GestureDetector(
onTap: () {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onTap: () async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -43,11 +43,13 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
children: <Widget>[
Obx(() => CommonItem(
leftTitel:
'${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}',
'${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}',
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.typeName.value, () {
Obx(() => lockDataListItem(
TranslationLoader.lanKeys!.name!.tr, state.typeName.value,
() {
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
@ -66,8 +68,8 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
})),
Obx(() => Visibility(
visible: state.keyType.value == 4 ||
state.keyType.value == 2 ||
state.keyType.value == 1,
state.keyType.value == 2 ||
state.keyType.value == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h,
@ -149,7 +151,8 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
Routers.otherTypeKeyChangeValidityDatePage,
arguments: <String, Object>{
'pushType': 1,
'fingerprintItemData': state.fingerprintItemData.value,
'fingerprintItemData':
state.fingerprintItemData.value,
});
if (data != null) {
setState(() {
@ -195,11 +198,14 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
isHaveDirection: true,
action: () {
//
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 3,
'id': state.fingerprintItemData.value.fingerprintId.toString(),
'recordName': state.fingerprintItemData.value.fingerprintName
});
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: <String, Object?>{
'type': 3,
'id': state.fingerprintItemData.value.fingerprintId
.toString(),
'recordName':
state.fingerprintItemData.value.fingerprintName
});
}),
// SizedBox(height: 40.h),
// addControlsBtn(type),
@ -211,8 +217,9 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onClick: () async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -228,12 +235,14 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
Widget lockDataListItem(
String leftTitle, String conentStr, Function()? action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
padding:
EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
@ -241,15 +250,17 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
)),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
child: Text(conentStr,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp,
))),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',

View File

@ -70,7 +70,8 @@ class _FingerprintListPageState extends State<FingerprintListPage>
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -144,11 +145,14 @@ class _FingerprintListPageState extends State<FingerprintListPage>
extentRatio: 0.2,
motion: const ScrollMotion(),
children: <Widget>[
SlidableAction(onPressed: (BuildContext context) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
SlidableAction(
onPressed: (BuildContext context) async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ??
false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'确定要删除吗?'.tr, () async {
state.isDeletAll = false;

View File

@ -46,7 +46,7 @@ class _IrisListPageState extends State<IrisListPage> {
final isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -1345,7 +1345,8 @@ class _LockDetailPageState extends State<LockDetailPage>
final double textSizeWidth = textPainter.size.width; //
if (textSizeWidth > 358.w * 2 - 20) {
lockAlias = '${lockAlias.substring(0, 25)}...';
lockAlias =
'${lockAlias.substring(0, lockAlias.length > 25 ? 25 : lockAlias.length)}...';
}
return Center(
child: Stack(
@ -1430,11 +1431,11 @@ class _LockDetailPageState extends State<LockDetailPage>
}
}
void startOpenLock() {
Future<void> startOpenLock() async {
if (state.openLockBtnState.value == 1) {
return;
}
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
final bool isNetWork = await LockMainLogic.to()?.judgeTheNetwork() ?? false;
final bool isOpenLockNeedOnline = state.isOpenLockNeedOnline.value == 0;
if (!isOpenLockNeedOnline && !isNetWork) {
return;

View File

@ -76,7 +76,7 @@ class LockEscalationLogic extends BaseGetXController {
}
// ota
void blueOTAUpgrade(Map data, List<int> token) {
void blueOTAUpgrade(Map<dynamic, dynamic> data, List<int> token) {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
@ -92,8 +92,8 @@ class LockEscalationLogic extends BaseGetXController {
lockID: BlueManage().connectDeviceName,
userID: uid,
keyID: BlueManage().connectDeviceName,
platform: int.tryParse(data['platform']) ?? 0,
product: int.tryParse(data['product']) ?? 0,
platform: int.tryParse(data['platform'] ?? '0') ?? 0,
product: int.tryParse(data['product'] ?? '0') ?? 0,
hwVersion: data['hwVersion'],
fwVersion: data['fwVersion'],
fwSize: data['fwSize'],

View File

@ -182,17 +182,7 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
height: 20.h,
),
Text(
'${'机型'.tr}${logic.headJson?['platform']}-${logic.headJson?['product']}',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 22.sp,
fontWeight: FontWeight.w600),
),
SizedBox(
height: 10.h,
),
Text(
'${'硬件版本'.tr}${logic.headJson?['hwVersion']}',
'${'机型'.tr}${logic.headJson?['platform']}',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 22.sp,

View File

@ -158,13 +158,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.delete!.tr,
isDelete: true,
onClick: () {
onClick: () async {
// logic.deletUserAction();
// logic.deletLockInfoData();
// showDeletAlertDialog(context);
// showDeletPasswordAlertDialog(context);
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -35,9 +35,9 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
TranslationLoader.lanKeys!.reset!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
onPressed: () async {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -46,7 +46,7 @@ class _PalmListPageState extends State<PalmListPage> {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -106,7 +106,7 @@ class _PalmListPageState extends State<PalmListPage> {
//
if (index < state.faceItemListData.value.length) {
return LeftSlideActions(
tag:getFaceItemData.faceName!,
tag: getFaceItemData.faceName!,
key: Key(getFaceItemData.faceName!),
actionsWidth: 60,
actions: [

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -48,7 +47,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
height: 30.h,
width: 30.w,
),
onPressed: openModalBottomSheet,
onPressed: _openModalBottomSheet,
),
],
),
@ -86,9 +85,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
// showCupertinoAlertDialog(
// context, state.inputNameController);
// })),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.keyboardPwdName.value, (){
showCupertinoAlertDialog(context, state.inputNameController);
})),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,
state.keyboardPwdName.value, () {
showCupertinoAlertDialog(
context, state.inputNameController);
})),
Obx(() => CommonItem(
leftTitel: '有效期',
rightTitle: logic.getUseDateStr(),
@ -243,8 +244,9 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onClick: () async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -295,12 +297,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
Widget lockDataListItem(
String leftTitle, String conentStr, Function()? action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
padding:
EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
@ -308,15 +312,17 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
)),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
child: Text(conentStr,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp,
))),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
@ -387,18 +393,37 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
);
}
Future<void> openModalBottomSheet() async {
Future<void> _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 270.h),
constraints: BoxConstraints(maxHeight: 323.h),
builder: (BuildContext context) {
return Column(
children: <Widget>[
SizedBox(
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16.h, bottom: 16.h),
width: ScreenUtil().screenWidth,
child: Center(
child: Text(
'分享',
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w500),
),
),
),
const Divider(
height: 1,
color: AppColors.greyLineColor,
),
Container(
width: ScreenUtil().screenWidth,
height: 160.h,
color: Colors.white,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
@ -407,18 +432,23 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
Container(
color: Colors.white,
margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0),
width: ScreenUtil().screenWidth,
child: TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
@ -480,7 +510,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
arguments: <String, Object?>{
'receiver': '',
'channelType': itemIndex == 1 ? 1 : 2,
'keyId': CommonDataManage().currentKeyInfo.keyId,
'keyId': state.itemData.value.keyboardPwdId,
'unlockType': 2
});
break;
case 3: //

View File

@ -68,7 +68,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
@ -154,8 +155,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
motion: const ScrollMotion(),
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context) {
final bool isNetWork = LockMainLogic.to()?.judgeTheNetwork() ?? false;
onPressed: (BuildContext context) async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ??
false;
if (!isNetWork) {
return;
}

View File

@ -146,6 +146,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
state.pwdController.text = '';
if (entity.data != null) {
state.getPwdStr.value = entity.data!.keyboardPwd!;
state.getPwdID.value = entity.data!.keyboardPwdId!;
}
eventBus.fire(GetPasswordListRefreshUI());
}

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -660,13 +661,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 270.h),
constraints: BoxConstraints(maxHeight: 323.h),
builder: (BuildContext context) {
return Column(
children: <Widget>[
SizedBox(
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16.h, bottom: 16.h),
width: ScreenUtil().screenWidth,
child: Center(
child: Text(
'分享',
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w500),
),
),
),
const Divider(
height: 1,
color: AppColors.greyLineColor,
),
Container(
width: ScreenUtil().screenWidth,
height: 160.h,
color: Colors.white,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
@ -675,18 +695,23 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
Container(
color: Colors.white,
margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0),
width: ScreenUtil().screenWidth,
child: TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
@ -805,7 +830,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
arguments: <String, Object?>{
'receiver': '',
'channelType': itemIndex == 1 ? 1 : 2,
'keyId': CommonDataManage().currentKeyInfo.keyId,
'keyId': state.getPwdID.value,
'unlockType': 2
});
break;
case 3: //

View File

@ -4,7 +4,6 @@ import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/tools/dateTool.dart';
class PasswordKeyPerpetualState {
PasswordKeyPerpetualState() {
Map map = Get.arguments;
if (map['keyInfo'] != null) {
@ -30,7 +29,8 @@ class PasswordKeyPerpetualState {
RxInt loopEndHours = DateTime.now().hour.obs;
RxString loopModeStr = '周末'.obs; //
RxString customBeginTime = DateTool().getNowDateWithType(2).obs; //
RxString customBeginTime =
DateTool().getNowDateWithType(2).obs; //
RxString customEndTime = DateTool().getNowDateWithType(2).obs; //
final RxInt widgetType = 0.obs;
@ -42,4 +42,5 @@ class PasswordKeyPerpetualState {
RxInt pwdNumber = 0.obs; //
late TabController tabController;
RxInt getPwdID = 0.obs; // ID
}

View File

@ -46,7 +46,7 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/flavors.dart';
import '../../../app_settings/app_colors.dart';
import '../entity/lockListInfo_entity.dart';
@ -34,7 +35,7 @@ class _LockListGroupViewState extends State<LockListGroupView> {
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
children: <Widget>[
Container(
color: widget.backgroundColor ?? Colors.white,
height: 80.h,
@ -54,23 +55,34 @@ class _LockListGroupViewState extends State<LockListGroupView> {
}
List<Widget> _buildExpandRowList() {
List<Widget> widgetList = [];
final List<Widget> widgetList = <Widget>[];
widgetList.add(GestureDetector(
child: Container(
width: ScreenUtil().screenWidth,
color: widget.backgroundColor ?? Colors.white,
child: Row(
children: [
children: <Widget>[
SizedBox(width: 40.w),
Text(
widget.groupItem.groupName ?? '',
style: widget.textStyle ??
TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
),
Expanded(
child: SizedBox(
F.sw(
skyCall: () => Text(
widget.groupItem.groupName ?? '',
style: widget.textStyle ??
TextStyle(
color: AppColors.blackColor, fontSize: 22.sp),
),
xhjCall: () => Expanded(
child: Text(
widget.groupItem.groupName ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: widget.textStyle ??
TextStyle(
color: AppColors.blackColor, fontSize: 22.sp),
),
)),
SizedBox(
width: 10.w,
)),
),
AnimatedRotation(
turns: _isExpanded ? -0.5 : 0,
duration: _animationDuration,

View File

@ -110,15 +110,15 @@ class LockMainLogic extends BaseGetXController {
//
state.networkConnectionStatus.value = 1;
getStarLockInfo(isUnShowLoading: true);
}else if(result == ConnectivityResult.none){
} else if (result == ConnectivityResult.none) {
state.networkConnectionStatus.value = 0;
}
});
}
///
bool judgeTheNetwork() {
final bool isNetwork = state.networkConnectionStatus.value == 1;
Future<bool> judgeTheNetwork() async {
final bool isNetwork = await isConnected();
if (!isNetwork) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
}

View File

@ -45,12 +45,13 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
showAppBar: false,
showDrawer: false,
),
SafeArea(
bottom: false,
child: LockMallPage(
allowReturn: false,
),
),
// xhj
// SafeArea(
// bottom: false,
// child: LockMallPage(
// allowReturn: false,
// ),
// ),
SafeArea(
bottom: false,
child: MessageListXHJPage(
@ -84,9 +85,10 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
child: Row(
children: <Widget>[
navigationBarItem(logic, Icons.key, '设备'.tr, 0),
navigationBarItem(logic, Icons.shopping_cart, '商城'.tr, 1),
navigationBarItem(logic, Icons.message, '消息'.tr, 2),
navigationBarItem(logic, Icons.account_circle, '我的'.tr, 3),
// xhj
// navigationBarItem(logic, Icons.shopping_cart, '商城'.tr, 1),
navigationBarItem(logic, Icons.message, '消息'.tr, 1),
navigationBarItem(logic, Icons.account_circle, '我的'.tr, 2),
],
),
),

View File

@ -7,22 +7,19 @@ import 'package:star_lock/mine/addLock/addLock/addLock_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/widget/permission/permission_dialog.dart';
class AddLockLogic extends BaseGetXController {
final AddLockState state = AddLockState();
//
Future<void> getNearByLimits() async {
if (!Platform.isIOS) {
bool bluetoothRequest = await PermissionDialog.requestBluetooth();
bool locationRequest = await PermissionDialog.request(Permission.location);
final bool locationRequest = await PermissionDialog.request(Permission.location);
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
if (!bluetoothRequest || !locationRequest) {
return;
}
}
Get.toNamed(Routers.nearbyLockPage);
}
}

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@ -9,6 +8,7 @@ import 'package:date_format/date_format.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart';
import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart';
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
@ -45,15 +45,8 @@ class NearbyLockLogic extends BaseGetXController {
//
void connect(String deviceName) {
showTitleEasyLoading('获取锁信息 1/3');
// if(state.sureBtnState.value == 1){
// return;
// }
// state.sureBtnState.value = 1;
// showEasyLoading();
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
// state.sureBtnState.value = 0;
});
BlueManage().blueSendData(deviceName,
(BluetoothConnectionState state) async {
@ -71,7 +64,7 @@ class NearbyLockLogic extends BaseGetXController {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is GetPublicKeyReply) {
_replyGetPublicKey(reply);
_replyGetPublicKey(reply);
}
if (reply is GetPrivateKeyReply) {
@ -103,8 +96,6 @@ class NearbyLockLogic extends BaseGetXController {
}
Future<void> _replyGetPublicKey(Reply reply) async {
// dismissEasyLoading();
//
switch (reply.status) {
case 0x00:
@ -127,7 +118,6 @@ class NearbyLockLogic extends BaseGetXController {
needAuthor: 1);
break;
default:
// state.sureBtnState.value = 0;
AppLog.log('获取公钥失败');
break;
}
@ -142,7 +132,8 @@ class NearbyLockLogic extends BaseGetXController {
//
final List<int> privateKey = reply.data.sublist(0, 16);
final List<String> savePrivateKeyList = changeIntListToStringList(privateKey);
final List<String> savePrivateKeyList =
changeIntListToStringList(privateKey);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey
@ -160,7 +151,6 @@ class NearbyLockLogic extends BaseGetXController {
_getStarLockStatus();
break;
default:
// state.sureBtnState.value = 0;
break;
}
}
@ -170,7 +160,7 @@ class NearbyLockLogic extends BaseGetXController {
final int status = reply.data[2];
switch (status) {
case 0x00:
//
//
AppLog.log('获取锁状态成功');
//
int index = 3;
@ -196,14 +186,14 @@ class NearbyLockLogic extends BaseGetXController {
AppLog.log('产品名称 mmodelStr:$modelStr');
//
final List<int> fwVersion = reply.data.sublist(index, index+20);
final List<int> fwVersion = reply.data.sublist(index, index + 20);
final String fwVersionStr = utf8String(fwVersion);
state.lockInfo['fwVersion'] = fwVersionStr;
index = index + 20;
AppLog.log('软件版本 fwVersionStr:$fwVersionStr');
//
final List<int> hwVersion = reply.data.sublist(index, index+20);
final List<int> hwVersion = reply.data.sublist(index, index + 20);
final String hwVersionStr = utf8String(hwVersion);
state.lockInfo['hwVersion'] = hwVersionStr;
index = index + 20;
@ -245,16 +235,18 @@ class NearbyLockLogic extends BaseGetXController {
//
final List<int> restoreCounter = reply.data.sublist(index, index + 2);
state.lockInfo['restoreCount'] = restoreCounter[0] * 256 + restoreCounter[1];
state.lockInfo['restoreCount'] =
restoreCounter[0] * 256 + restoreCounter[1];
index = index + 2;
AppLog.log('重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}');
AppLog.log(
'重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}');
//
final List<int> restoreDate = reply.data.sublist(index, index + 4);
final int restoreDateValue = (0xff & restoreDate[0]) << 24 |
(0xff & restoreDate[1]) << 16 |
(0xff & restoreDate[2]) << 8 |
(0xFF & restoreDate[3]);
(0xff & restoreDate[1]) << 16 |
(0xff & restoreDate[2]) << 8 |
(0xFF & restoreDate[3]);
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
state.lockInfo['restoreDate'] = restoreDateValue * 1000;
index = index + 4;
@ -270,9 +262,9 @@ class NearbyLockLogic extends BaseGetXController {
//
final List<int> indate = reply.data.sublist(index, index + 4);
final int indateValue = (0xff & indate[0]) << 24 |
(0xff & indate[1]) << 16 |
(0xff & indate[2]) << 8 |
(0xFF & indate[3]);
(0xff & indate[1]) << 16 |
(0xff & indate[2]) << 8 |
(0xFF & indate[3]);
// String indateStr = DateTool().dateToYMDHNSString("$indateValue");
state.lockInfo['indate'] = indateValue * 1000;
index = index + 4;
@ -286,7 +278,8 @@ class NearbyLockLogic extends BaseGetXController {
AppLog.log('mac地址 macAddressStr:$macAddressStr');
//
state.lockInfo['timezoneOffset'] = DateTime.now().timeZoneOffset.inSeconds;
state.lockInfo['timezoneOffset'] =
DateTime.now().timeZoneOffset.inSeconds;
//
final int featureValueLength = reply.data[index];
@ -300,7 +293,8 @@ class NearbyLockLogic extends BaseGetXController {
showToast('锁数据异常,请重试');
return;
}
final List<int> featureValue = reply.data.sublist(index, index + featureValueLength);
final List<int> featureValue =
reply.data.sublist(index, index + featureValueLength);
final String featureValueStr = asciiString(featureValue);
state.featureValue = featureValueStr;
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
@ -319,7 +313,8 @@ class NearbyLockLogic extends BaseGetXController {
showToast('锁数据异常,请重试');
return;
}
final List<int> featureEnVal = reply.data.sublist(index, index + featureEnValLength);
final List<int> featureEnVal =
reply.data.sublist(index, index + featureEnValLength);
final String featureEnValStr = asciiString(featureEnVal);
state.featureSettingValue = featureEnValStr;
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
@ -344,14 +339,11 @@ class NearbyLockLogic extends BaseGetXController {
break;
case 0x06:
//
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// IoSenderManage.senderGetLockStatu(
// lockID:BlueManage().connectDeviceName,
// userID:await Storage.getUid(),
// privateKey:getPrivateKeyList,
// );
//
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
@ -362,8 +354,7 @@ class NearbyLockLogic extends BaseGetXController {
);
break;
default:
//
// state.sureBtnState.value = 0;
//
break;
}
}
@ -376,12 +367,16 @@ class NearbyLockLogic extends BaseGetXController {
// dismissEasyLoading();
AppLog.log('开始获取锁状态');
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final String getUTCDate = formatDate(DateTime.fromMillisecondsSinceEpoch(state.serverTime*1000), <String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
final String getLocalDate = formatDate(DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000), <String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
final String getUTCDate = formatDate(
DateTime.fromMillisecondsSinceEpoch(state.serverTime * 1000),
<String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
final String getLocalDate = formatDate(
DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000),
<String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
AppLog.log('state.serverTime:${state.serverTime} getUTCDate:$getUTCDate '
'getLocalTime:${getLocalTime()} getLocalDate:$getLocalDate '
@ -394,10 +389,6 @@ class NearbyLockLogic extends BaseGetXController {
isBeforeAddUser: true,
privateKey: getPrivateKeyList,
);
// } else if (state == BluetoothConnectionState.disconnected) {
// dismissEasyLoading();
// }
// }, isAddEquipment: true);
}
void startScanBlueList() {
@ -490,7 +481,7 @@ class NearbyLockLogic extends BaseGetXController {
).packageData());
} else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {}
},isAddEquipment: true);
}, isAddEquipment: true);
}
//
@ -536,7 +527,7 @@ class NearbyLockLogic extends BaseGetXController {
logic: this,
),
barrierDismissible: false)
.then((value) => state.oTAProgressDialog = false);
.then((dynamic value) => state.oTAProgressDialog = false);
}
// ata
@ -632,9 +623,10 @@ class NearbyLockLogic extends BaseGetXController {
}
//
Future<void> getServerDatetime() async{
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false);
if(entity.errorCode!.codeIsSuccessful){
Future<void> getServerDatetime() async {
final GetServerDatetimeEntity entity =
await ApiRepository.to.getServerDatetimeData(isUnShowLoading: false);
if (entity.errorCode!.codeIsSuccessful) {
state.serverTime = entity.data!.date! ~/ 1000;
if (state.otaState.value) {
@ -642,12 +634,10 @@ class NearbyLockLogic extends BaseGetXController {
} else {
connect(state.selectLockName.value);
}
// state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
}
}
int getLocalTime(){
int getLocalTime() {
final DateTime now = DateTime.now();
final Duration timeZoneOffset = now.timeZoneOffset;
AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
@ -657,9 +647,7 @@ class NearbyLockLogic extends BaseGetXController {
@override
void onReady() {
super.onReady();
_initReplySubscription();
state.ifCurrentScreen.value = true;
startScanBlueList();
getNearByLimits();
}
@override
@ -672,4 +660,18 @@ class NearbyLockLogic extends BaseGetXController {
super.onClose();
_replySubscription?.cancel();
}
Future<void> getNearByLimits() async {
if (!Platform.isIOS) {
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
final bool locationRequest =
await PermissionDialog.request(Permission.location);
if (!bluetoothRequest || !locationRequest) {
return;
}
}
_initReplySubscription();
state.ifCurrentScreen.value = true;
startScanBlueList();
}
}

View File

@ -6,7 +6,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';

View File

@ -1,10 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/mine/starLockMine_state.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/customer_tool.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -204,6 +205,12 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
Get.back();
Get.toNamed(Routers.lockMallPage);
}),
if (F.isSKY)
mineItem('images/mine/icon_mine_main_shoppingcart.png',
TranslationLoader.lanKeys!.supportStaff!.tr, () {
Get.back();
CustomerTool.openCustomerService();
}),
mineItem('images/mine/icon_mine_main_about.png',
TranslationLoader.lanKeys!.about!.tr, () {
Get.back();

View File

@ -70,7 +70,8 @@ class _AddAuthorizedAdministratorPageState
: state.lockIdList.value.length.toString(),
isHaveDirection: true,
action: () async {
final result = await Get.toNamed(Routers.massSendLockGroupListPage,
final result = await Get.toNamed(
Routers.massSendLockGroupListPage,
arguments: <String, Object>{
'keyLimits': '1',
'lockIdList': state.lockIdList.value
@ -94,7 +95,8 @@ class _AddAuthorizedAdministratorPageState
isHaveRightWidget: true,
isTipsImg: true,
tipsImgAction: () {
ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr);
ShowTipView()
.showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr);
},
rightWidget: SizedBox(
width: 60.w,
@ -128,7 +130,8 @@ class _AddAuthorizedAdministratorPageState
: state.lockIdList.value.length.toString(),
isHaveDirection: true,
action: () async {
final result = await Get.toNamed(Routers.massSendLockGroupListPage,
final result = await Get.toNamed(
Routers.massSendLockGroupListPage,
arguments: <String, Object>{
'keyLimits': '1',
'lockIdList': state.lockIdList.value
@ -153,7 +156,8 @@ class _AddAuthorizedAdministratorPageState
isHaveRightWidget: true,
isTipsImg: true,
tipsImgAction: () {
ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr);
ShowTipView()
.showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr);
},
rightWidget: SizedBox(
width: 60.w,
@ -217,7 +221,8 @@ class _AddAuthorizedAdministratorPageState
}
//
Widget getTFWidget(bool isHaveBtn, String tfStr, TextEditingController editController) {
Widget getTFWidget(
bool isHaveBtn, String tfStr, TextEditingController editController) {
return SizedBox(
height: 65.h,
width: 300.w,
@ -487,7 +492,8 @@ class _AddAuthorizedAdministratorPageState
'receiver': state.emailOrPhoneController.text,
'channelType':
state.emailOrPhoneController.text.contains('@') ? 2 : 1,
'keyId': state.getKeyId.value
'keyId': state.getKeyId.value,
'unlockType': 1
});
},
),
@ -576,7 +582,13 @@ class _AddAuthorizedAdministratorPageState
case 2:
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
Navigator.pushNamed(context, Routers.sendEmailNotificationPage,
arguments: <String, Object?>{
'receiver': state.emailOrPhoneController.text,
'channelType': 2,
'keyId': state.getKeyId.value,
'unlockType': 1
});
}
break;
case 3:

View File

@ -313,7 +313,6 @@ class _MineSetPageState extends State<MineSetPage>
Navigator.pushNamed(
context, Routers.aPPUnlockNeedMobileNetworkingLockPage);
}),
// if (!F.isLite)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
@ -354,12 +353,13 @@ class _MineSetPageState extends State<MineSetPage>
action: () {
logic.showToast('功能暂未开放'.tr);
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr,
isHaveLine: widget.showAbout,
isHaveDirection: true,
action: CustomerTool.openCustomerService,
),
if (F.isXHJ)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr,
isHaveLine: widget.showAbout,
isHaveDirection: true,
action: CustomerTool.openCustomerService,
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.about!.tr,

View File

@ -16,9 +16,6 @@ class AdvancedFeaturesWebPage extends StatefulWidget {
}
class _AdvancedFeaturesWebPageState extends State<AdvancedFeaturesWebPage> {
final AdvancedFeaturesWebLogic logic = Get.put(AdvancedFeaturesWebLogic());
final AdvancedFeaturesWebState state =
Get.find<AdvancedFeaturesWebLogic>().state;
@override
Widget build(BuildContext context) {
@ -32,18 +29,13 @@ class _AdvancedFeaturesWebPageState extends State<AdvancedFeaturesWebPage> {
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle: state.webBuyTitle.value,
barTitle: logic.state.webBuyTitle.value,
haveBack: true,
backgroundColor: AppColors.mainColor,
backAction: () => logic.canGoBack(false),
),
body: Obx(() => Column(
children: <Widget>[
PopScope(
onPopInvoked: logic.canGoBack,
canPop: false,
child: const SizedBox(),
),
Container(
padding: EdgeInsets.only(bottom: 10.w),
child: LinearProgressIndicator(

View File

@ -1,132 +0,0 @@
class AdvancedFunctionRecordEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
AdvancedFunctionRecordEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
AdvancedFunctionRecordEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
int? pageNo;
int? pageSize;
int? total;
List<RecordItem>? recordList;
Data({this.pageNo, this.pageSize, this.total, this.recordList});
Data.fromJson(Map<String, dynamic> json) {
pageNo = json['pageNo'];
pageSize = json['pageSize'];
total = json['total'];
if (json['list'] != null) {
recordList = <RecordItem>[];
json['list'].forEach((v) {
recordList!.add(RecordItem.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['total'] = total;
if (recordList != null) {
data['list'] = recordList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class RecordItem {
int? id;
int? userId;
String? orderNumber;
String? type;
int? recordType;
int? smsCount;
int? emailCount;
int? cloudauthCount;
int? vipLockCount;
int? vipYear;
String? amount;
String? createdAt;
String? updatedAt;
String? useDate;
String? buyDate;
RecordItem(
{this.id,
this.userId,
this.orderNumber,
this.type,
this.recordType,
this.smsCount,
this.emailCount,
this.cloudauthCount,
this.vipLockCount,
this.vipYear,
this.amount,
this.createdAt,
this.updatedAt,
this.useDate,
this.buyDate});
RecordItem.fromJson(Map<String, dynamic> json) {
id = json['id'];
userId = json['user_id'];
orderNumber = json['order_number'];
type = json['type'];
recordType = json['record_type'];
smsCount = json['sms_count'];
emailCount = json['email_count'];
cloudauthCount = json['cloudauth_count'];
vipLockCount = json['vip_lock_count'];
vipYear = json['vip_year'];
amount = json['amount'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
useDate = json['useDate'];
buyDate = json['buyDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['user_id'] = userId;
data['order_number'] = orderNumber;
data['type'] = type;
data['record_type'] = recordType;
data['sms_count'] = smsCount;
data['email_count'] = emailCount;
data['cloudauth_count'] = cloudauthCount;
data['vip_lock_count'] = vipLockCount;
data['vip_year'] = vipYear;
data['amount'] = amount;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
data['useDate'] = useDate;
data['buyDate'] = buyDate;
return data;
}
}

View File

@ -1,8 +1,8 @@
import 'dart:async';
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart';
@ -28,8 +28,7 @@ class AdvancedFunctionRecordLogic extends BaseGetXController {
if (!load) {
buyPageNo = 1;
}
AdvancedFunctionRecordEntity entity =
await ApiRepository.to.getBuyRecordList(
UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList(
type: type,
recordType: 10,
pageNo: buyPageNo,

View File

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../tools/titleAppBar.dart';
@ -44,7 +44,7 @@ class _AdvancedFunctionRecordPageState
));
}
Widget _recordKeyItem(RecordItem itemData) {
Widget _recordKeyItem(UseItemData itemData) {
return Container(
color: Colors.white,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),

View File

@ -1,6 +1,6 @@
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
class AdvancedFunctionRecordState {
var buyRecordList = <RecordItem>[].obs;
var buyRecordList = <UseItemData>[].obs;
}

View File

@ -1,32 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'valueAddedServicesBuyAndUseRecordManage_tabbar.dart';
class ValueAddedServicesBuyAndUseRecordManagePage extends StatefulWidget {
const ValueAddedServicesBuyAndUseRecordManagePage({Key? key}) : super(key: key);
@override
State<ValueAddedServicesBuyAndUseRecordManagePage> createState() => _ValueAddedServicesBuyAndUseRecordManagePageState();
}
class _ValueAddedServicesBuyAndUseRecordManagePageState extends State<ValueAddedServicesBuyAndUseRecordManagePage> {
var index=0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.sendKey!.tr, haveBack:true, backgroundColor: AppColors.mainColor),
body: Column(
children: [
ValueAddedServicesBuyAndUseRecordManageTabbar(initialIndex: index,),
],
),
);
}
}

View File

@ -1,111 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../valueAddedServicesBuyAndUseRecord_page.dart';
class ValueAddedServicesBuyAndUseRecordManageTabbar extends StatefulWidget {
var initialIndex = 1;
ValueAddedServicesBuyAndUseRecordManageTabbar(
{Key? key, required this.initialIndex})
: super(key: key);
@override
State<ValueAddedServicesBuyAndUseRecordManageTabbar> createState() =>
_ValueAddedServicesBuyAndUseRecordManageTabbarState();
}
class _ValueAddedServicesBuyAndUseRecordManageTabbarState
extends State<ValueAddedServicesBuyAndUseRecordManageTabbar>
with SingleTickerProviderStateMixin {
late TabController _tabController;
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: "购买记录", type: "0"),
ItemView(title: "使用记录", type: "1")
// ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
// ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"),
];
@override
void initState() {
// TODO: implement initState
super.initState();
_tabController = TabController(
vsync: this,
length: _itemTabs.length,
initialIndex: widget.initialIndex);
}
@override
Widget build(BuildContext context) {
return Expanded(
child: Column(
children: [
_tabBar(),
_pageWidget(),
],
));
}
TabBar _tabBar() {
return TabBar(
controller: _tabController,
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
unselectedLabelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
),
automaticIndicatorColorAdjustment: true,
labelColor: AppColors.mainColor,
labelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
indicator: CustomUnderlineTabIndicator(
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
strokeCap: StrokeCap.round,
width: 30.w),
);
}
Tab _tab(ItemView item) {
return Tab(
// text: item.title,
child: Container(
width: 1.sw / 4,
margin: EdgeInsets.all(10.w),
// color: Colors.red,
child: Text(
item.title,
textAlign: TextAlign.center,
),
),
);
}
Widget _pageWidget() {
return Expanded(
child: TabBarView(
controller: _tabController,
children: _itemTabs
.map((ItemView item) => ValueAddedServicesBuyAndUseRecordPage(
type: item.type,
))
.toList(),
),
);
}
}
class ItemView {
const ItemView({required this.title, required this.type});
final String title;
final String type;
}

View File

@ -1,111 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/app_settings/app_colors.dart';
class ValueAddedServicesBuyAndUseRecordPage extends StatefulWidget {
final String type;
const ValueAddedServicesBuyAndUseRecordPage({Key? key, required this.type})
: super(key: key);
@override
State<ValueAddedServicesBuyAndUseRecordPage> createState() =>
_ValueAddedServicesBuyAndUseRecordPageState();
}
class _ValueAddedServicesBuyAndUseRecordPageState
extends State<ValueAddedServicesBuyAndUseRecordPage> {
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: 20,
itemBuilder: (c, index) {
if (index % 2 == 0) {
return _dateItem("2023-06-29");
} else {
return _operatingRecordItem('images/controls_user.png', "张三",
"2023.6.21 11.15", "2023.6.21 11.15", () {
// Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
});
}
});
}
Widget _dateItem(String lockDate) {
return Container(
height: 60.h,
color: AppColors.mainBackgroundColor,
padding: EdgeInsets.only(left: 20.h, right: 20.h),
child: Row(
children: [
Text(
lockDate,
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
),
],
),
);
}
Widget _operatingRecordItem(String lockTypeIcon, String lockTypeTitle,
String beginTime, String endTime, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
height: 90.h,
// padding: EdgeInsets.only(left: 20.w, right: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
lockTypeIcon,
width: 50.w,
height: 50.w,
),
SizedBox(
width: 20.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Text(
lockTypeTitle,
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
],
),
SizedBox(height: 10.h),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"2023.6.21 11.15",
style: TextStyle(
fontSize: 20.sp,
color: AppColors.darkGrayTextColor),
),
],
),
),
SizedBox(width: 20.h),
],
),
),
SizedBox(width: 20.h),
],
),
),
);
}
}

View File

@ -1,329 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/showBottomSheetTool.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
//
final TextStyle highStyle =
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
//
final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp);
//-
InlineSpan emailPasswardSpan = TextSpan(children: [
TextSpan(
text:
'${TranslationLoader.lanKeys!.hello!.tr}${TranslationLoader.lanKeys!.yourRoomIs!.tr}',
style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.roomName!.tr}', style: highStyle),
TextSpan(
text: '${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}',
style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle),
TextSpan(
text: '${TranslationLoader.lanKeys!.periodValidity!.tr}',
style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}',
style: highStyle),
TextSpan(
text: '${TranslationLoader.lanKeys!.templateTip1!.tr}',
style: defaultStyle),
]);
//-
InlineSpan emailPasswardTipSpan = TextSpan(children: [
TextSpan(
text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.roomName!.tr}}', style: highStyle),
TextSpan(text: '', style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle),
TextSpan(text: TranslationLoader.lanKeys!.and!.tr, style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}',
style: highStyle),
TextSpan(
text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr,
style: defaultStyle),
]);
String emaiPasswardStr =
"${TranslationLoader.lanKeys!.hello!.tr}${TranslationLoader.lanKeys!.yourRoomIs!.tr}{${TranslationLoader.lanKeys!.roomName!.tr}}${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}{${TranslationLoader.lanKeys!.password!.tr}}。${TranslationLoader.lanKeys!.periodValidity!.tr}{${TranslationLoader.lanKeys!.periodValidity!.tr}}。${TranslationLoader.lanKeys!.templateTip1!.tr}";
//-
InlineSpan emailElectronicKeySpan = TextSpan(children: [
TextSpan(
text: TranslationLoader.lanKeys!.templateTip2!.tr, style: defaultStyle),
TextSpan(text: 'https://abc.com/bcd', style: highStyle)
]);
//-
InlineSpan emailElectronicKeyTipSpan = TextSpan(children: [
TextSpan(
text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle),
TextSpan(
text: '{${TranslationLoader.lanKeys!.downloadLink!.tr}',
style: highStyle),
TextSpan(
text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr,
style: defaultStyle),
]);
String emailElectronicKeyStr =
"${TranslationLoader.lanKeys!.templateTip2!.tr}\n{${TranslationLoader.lanKeys!.downloadLink!.tr}}";
class ValueAddedServicesAddEmailTemplatePage extends StatefulWidget {
const ValueAddedServicesAddEmailTemplatePage({Key? key}) : super(key: key);
@override
State<ValueAddedServicesAddEmailTemplatePage> createState() =>
_ValueAddedServicesAddEmailTemplatePageState();
}
class _ValueAddedServicesAddEmailTemplatePageState
extends State<ValueAddedServicesAddEmailTemplatePage> {
final _templateOneTf = TextEditingController();
final _templateNameTf = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
_templateOneTf.text = emailElectronicKeyStr;
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.customMailTemplate!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: ListView(
children: [
_buildEditTopInfo(),
SizedBox(
height: 10.h,
),
_buildEditTemplate(),
SizedBox(
height: 10.h,
),
_buildpreview(),
SizedBox(height: 42.h),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr,
borderRadius: 10.w,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
// Navigator.pushNamed(context, Routers.sendElectronicKeyManagePage);
}),
],
));
}
Widget _buildEditTopInfo() {
return Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
_templateNameTf, TranslationLoader.lanKeys!.pleaseEnter!.tr)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.type!.tr,
rightTitle: TranslationLoader.lanKeys!.password!.tr,
isHaveLine: false,
action: () {
_showSelectTemplateType();
}),
],
);
}
Widget _buildEditTemplate() {
return Container(
color: Colors.white,
child: Column(
children: [
Row(
children: [
Padding(
padding: EdgeInsets.only(
left: 25.w, top: 25.h, bottom: 25.h, right: 25.w),
child: Text(
TranslationLoader.lanKeys!.templateContent!.tr,
style:
TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w600),
),
),
],
),
Container(
margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h),
height: 100,
child: TextField(
maxLines: 8,
// maxLength:1000,
textAlign: TextAlign.start,
controller: _templateOneTf,
style: TextStyle(
color: Colors.black,
fontSize: 28.sp,
),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 0.5,
),
),
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 1,
),
),
),
),
),
Container(
padding: EdgeInsets.only(
top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
margin: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h),
decoration: BoxDecoration(
color: const Color(0xFFFbF9EC),
borderRadius: BorderRadius.circular(10.h)),
child: RichText(text: emailElectronicKeyTipSpan),
)
],
),
);
}
Widget _buildpreview() {
return Column(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 20.h),
child: Column(
children: [
Column(
children: [
Row(
children: [
Padding(
padding: EdgeInsets.only(
left: 25.w,
top: 25.h,
bottom: 25.h,
right: 25.w),
child: Text(
TranslationLoader.lanKeys!.preview!.tr,
style: TextStyle(fontSize: 20.sp),
),
),
],
),
Container(
margin: EdgeInsets.only(
left: 25.w, right: 25.w, bottom: 20.h),
padding: EdgeInsets.only(
left: 20.w, top: 20.h, right: 20.w, bottom: 20.h),
decoration: BoxDecoration(
color: const Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(10.h),
),
child: RichText(text: emailElectronicKeySpan),
)
],
),
],
))
]);
}
Widget getTFWidget(TextEditingController tfController, String tfStr) {
return Container(
height: 50.h,
width: 500.w,
child: Row(
children: [
Expanded(
child: TextField(
//
maxLines: 1,
controller: tfController,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
//线
border: InputBorder.none,
),
),
),
],
),
);
}
void _showSelectTemplateType() {
var list = [
TranslationLoader.lanKeys!.electronicKey!.tr,
TranslationLoader.lanKeys!.password!.tr
];
ShowBottomSheetTool().showSingleRowPicker(
//
context,
//
normalIndex: 0,
title: TranslationLoader.lanKeys!.type!.tr,
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
//
//
//adapter: PickerAdapter(),
data: list,
//
clickCallBack: (int index, var str) {});
}
}

View File

@ -1,164 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart';
class ValueAddedServicesListEmailTemplatePage extends StatefulWidget {
const ValueAddedServicesListEmailTemplatePage({Key? key}) : super(key: key);
@override
State<ValueAddedServicesListEmailTemplatePage> createState() =>
_ValueAddedServicesListEmailTemplatePageState();
}
class _ValueAddedServicesListEmailTemplatePageState
extends State<ValueAddedServicesListEmailTemplatePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '自定义邮件模版'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
_topTipWidget(),
Expanded(child: _buildMainUI()),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.creatingANewTemplate!.tr,
borderRadius: 20.w,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
Navigator.pushNamed(
context, Routers.valueAddedServicesAddEmailTemplatePage);
}),
SizedBox(
height: 64.h,
)
],
),
);
}
Widget _topTipWidget() {
return Container(
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w),
padding:
EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: Column(
children: [
Text(TranslationLoader.lanKeys!.customTemplatesTip!.tr),
SizedBox(
height: 15.h,
),
Container(
padding: EdgeInsets.only(
top: 15.h, left: 15.w, right: 15.w, bottom: 15.h),
decoration: BoxDecoration(
color: const Color(0xFFFbF9EC),
borderRadius: BorderRadius.circular(10.h)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w,
// margin: EdgeInsets.only(top:15.h, left: 15.w, right: 15.w, bottom: 15.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${TranslationLoader.lanKeys!.currentState!.tr}${TranslationLoader.lanKeys!.onTrial!.tr}",
style: TextStyle(
fontSize: 20.sp, fontWeight: FontWeight.w600),
),
Text(TranslationLoader.lanKeys!.unHaveOpenedTip2!.tr,
style: TextStyle(
fontSize: 20.sp, fontWeight: FontWeight.w600))
],
),
),
GestureDetector(
onTap: () {
Navigator.pushNamed(
context, Routers.valueAddedServicesHighFunctionPage);
},
child: Container(
width: 100.w,
height: 50.h,
decoration: BoxDecoration(
color: const Color(0xFFCAB68D),
borderRadius: BorderRadius.circular(35.h)),
child: Center(
child: Text(
TranslationLoader.lanKeys!.goToTheOpen!.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontSize: 20.sp)))),
),
],
),
)
],
));
}
Widget _buildMainUI() {
return ListView.builder(
itemCount: 10,
itemBuilder: (c, index) {
return _valueAddedServicesListSMSTemplateItem(
'images/icon_lock.png', "张三", () {
// Navigator.pushNamed(context, Routers.valueAddedServicesAddSMSTemplatePage);
});
});
}
Widget _valueAddedServicesListSMSTemplateItem(
String title, String content, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 100.h,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 30.h, top: 30.h, bottom: 20.h),
child: Text(
"101",
style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500),
),
),
Container(
margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h),
decoration: BoxDecoration(
color: const Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(10.h),
),
child: Padding(
padding: EdgeInsets.only(
left: 20.w, top: 20.h, right: 20.w, bottom: 20.h),
child: RichText(text: emailElectronicKeySpan)),
),
],
),
),
);
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_logic.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_state.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart';
import '../../../appRouters.dart';
@ -20,8 +21,10 @@ class ValueAddedServicesHighFunctionPage extends StatefulWidget {
class _ValueAddedServicesHighFunctionPageState
extends State<ValueAddedServicesHighFunctionPage> {
final logic = Get.put(ValueAddedServicesHighFunctionLogic());
final state = Get.find<ValueAddedServicesHighFunctionLogic>().state;
final ValueAddedServicesHighFunctionLogic logic =
Get.put(ValueAddedServicesHighFunctionLogic());
final ValueAddedServicesHighFunctionState state =
Get.find<ValueAddedServicesHighFunctionLogic>().state;
@override
initState() {
@ -35,16 +38,16 @@ class _ValueAddedServicesHighFunctionPageState
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: "高级功能".tr,
barTitle: '高级功能'.tr,
haveBack: true,
iconColor: Colors.black,
titleColor: Colors.black,
backgroundColor: Colors.white),
body: Column(
children: [
children: <Widget>[
Expanded(
child: ListView(
children: [
children: <Widget>[
_topShowState(),
_benefitsContent(),
Container(height: 20.h, color: const Color(0xFFF5F5F5)),
@ -69,60 +72,89 @@ class _ValueAddedServicesHighFunctionPageState
topRight: Radius.circular(30.h),
),
),
child: GestureDetector(
onTap: () {
Get.toNamed(Routers.advancedFunctionRecordPage,
arguments: UseRecordListArg.vip);
},
child: Container(
color: Colors.transparent,
child: Stack(
alignment: AlignmentDirectional.centerStart,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"当前状态:已开通".tr,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600),
),
SizedBox(height: 5.h),
Obx(() => Text(
"${TranslationLoader.lanKeys!.periodValidity!.tr}:${state.vipExpireDate.value}",
style: TextStyle(
fontSize: 20.sp, fontWeight: FontWeight.w600),
)),
], //
),
],
),
Positioned(
bottom: 0.h,
right: 0.w,
child: Container(
width: 90.w,
height: 50.h,
decoration: BoxDecoration(
color: const Color(0xFFBDCDDF),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.h),
bottomLeft: Radius.circular(30.h),
child: Container(
color: Colors.transparent,
child: Stack(
alignment: AlignmentDirectional.centerStart,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'当前状态:已开通'.tr,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600),
),
SizedBox(height: 5.h),
Obx(() => Text(
'${TranslationLoader.lanKeys!.periodValidity!.tr}:${state.vipExpireDate.value}',
style: TextStyle(
fontSize: 20.sp, fontWeight: FontWeight.w600),
)),
], //
),
],
),
Positioned(
bottom: 0.h,
right: 0.w,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
GestureDetector(
onTap: () {
Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: <String, int>{
'webBuyType': XSConstantMacro.webBuyTypeVip,
});
},
child: Container(
width: 110.w,
height: 50.h,
decoration: BoxDecoration(
color: const Color(0xFFBDCDDF),
borderRadius: BorderRadius.all(Radius.circular(30.h)),
),
child: Center(
child: Text(
TranslationLoader.lanKeys!.buy!.tr,
style: TextStyle(fontSize: 22.sp),
)),
),
),
child: Center(
child: Text(
TranslationLoader.lanKeys!.record!.tr,
style: TextStyle(fontSize: 22.sp),
)),
)),
],
),
SizedBox(
width: 10.w,
),
GestureDetector(
onTap: () {
Get.toNamed(Routers.advancedFunctionRecordPage,
arguments: UseRecordListArg.vip);
},
child: Container(
width: 90.w,
height: 50.h,
decoration: BoxDecoration(
color: const Color(0xFFBDCDDF),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.h),
bottomLeft: Radius.circular(30.h),
),
),
child: Center(
child: Text(
TranslationLoader.lanKeys!.record!.tr,
style: TextStyle(fontSize: 22.sp),
)),
),
),
],
)),
],
),
),
);
@ -130,35 +162,42 @@ class _ValueAddedServicesHighFunctionPageState
Widget _benefitsContent() {
return Column(
children: [
children: <Widget>[
Container(
// color: Colors.red,
margin: EdgeInsets.only(left: 130.w, top: 50.h, right: 130.w),
padding: EdgeInsets.only(left: 30.w),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Image.asset('images/mine/icon_mine_highFunctionContent_left.png',
width: 30.w, height: 30.w),
Expanded(
child: Text(
TranslationLoader
.lanKeys!.advancedFeaturesAndBenefitsContent!.tr,
textAlign: TextAlign.center,
style:
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600)),
),
Image.asset('images/mine/icon_mine_highFunctionContent_right.png',
width: 30.w, height: 30.w)
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'images/mine/icon_mine_highFunctionContent_left.png',
width: 30.w,
height: 30.w),
Expanded(
child: Text(
TranslationLoader
.lanKeys!.advancedFeaturesAndBenefitsContent!.tr,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600)),
),
Image.asset(
'images/mine/icon_mine_highFunctionContent_right.png',
width: 30.w,
height: 30.w)
]),
),
SizedBox(
height: 10.h,
),
GestureDetector(
onTap: () {
Navigator.pushNamed(context, Routers.webviewShowPage, arguments: {
"url": XSConstantMacro.vipServiceDetailURL,
"title": '权益内容'.tr
});
Navigator.pushNamed(context, Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.vipServiceDetailURL,
'title': '权益内容'.tr
});
},
child: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
@ -184,25 +223,25 @@ class _ValueAddedServicesHighFunctionPageState
crossAxisSpacing: 8.h,
// childAspectRatio: 1 / 0.5,
physics: const NeverScrollableScrollPhysics(),
children: [
_buildItem("images/mine/icon_mine_highFunctionContent_dxmb.png",
children: <Widget>[
_buildItem('images/mine/icon_mine_highFunctionContent_dxmb.png',
TranslationLoader.lanKeys!.smsTemplate!.tr),
_buildItem("images/mine/icon_mine_highFunctionContent_yjmb.png",
_buildItem('images/mine/icon_mine_highFunctionContent_yjmb.png',
TranslationLoader.lanKeys!.emailTemplate!.tr),
_buildItem("images/mine/icon_mine_highFunctionContent_sqgly.png",
_buildItem('images/mine/icon_mine_highFunctionContent_sqgly.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr),
_buildItem("images/mine/icon_mine_highFunctionContent_sfz.png",
_buildItem('images/mine/icon_mine_highFunctionContent_sfz.png',
TranslationLoader.lanKeys!.lockGroup!.tr),
_buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
_buildItem('images/mine/icon_mine_highFunctionContent_bjft.png',
TranslationLoader.lanKeys!.sendGroupKey!.tr),
// _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
// TranslationLoader.lanKeys!.markedHouseState!.tr),
_buildItem("images/mine/icon_mine_highFunctionContent_fkgj.png",
_buildItem('images/mine/icon_mine_highFunctionContent_fkgj.png',
TranslationLoader.lanKeys!.cardIssuingtool!.tr),
_buildItem(
"images/mine/icon_mine_highFunctionContent_fkgj.png", '推送'),
'images/mine/icon_mine_highFunctionContent_fkgj.png', '推送'),
_buildItem(
"images/mine/icon_mine_highFunctionContent_fkgj.png", '考勤'),
'images/mine/icon_mine_highFunctionContent_fkgj.png', '考勤'),
],
),
),
@ -221,7 +260,7 @@ class _ValueAddedServicesHighFunctionPageState
),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Image.asset(
img,
width: 70.w,
@ -231,7 +270,7 @@ class _ValueAddedServicesHighFunctionPageState
height: 10.h,
),
Column(
children: [
children: <Widget>[
Text(
title,
style: TextStyle(fontSize: 22.sp),
@ -246,30 +285,36 @@ class _ValueAddedServicesHighFunctionPageState
Widget _buyNotes() {
return Column(
children: [
children: <Widget>[
Container(
// color: Colors.red,
margin: EdgeInsets.only(left: 110.w, top: 50.h, right: 110.w),
padding: EdgeInsets.only(left: 30.w),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Image.asset('images/mine/icon_mine_highFunctionContent_left.png',
width: 40.w, height: 40.w),
SizedBox(
width: 10.w,
),
Expanded(
child: Text(
TranslationLoader
.lanKeys!.titleForBuyingAdvancedFeatures!.tr,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600))),
SizedBox(
width: 10.w,
),
Image.asset('images/mine/icon_mine_highFunctionContent_right.png',
width: 40.w, height: 40.w)
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'images/mine/icon_mine_highFunctionContent_left.png',
width: 40.w,
height: 40.w),
SizedBox(
width: 10.w,
),
Expanded(
child: Text(
TranslationLoader
.lanKeys!.titleForBuyingAdvancedFeatures!.tr,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600))),
SizedBox(
width: 10.w,
),
Image.asset(
'images/mine/icon_mine_highFunctionContent_right.png',
width: 40.w,
height: 40.w)
]),
),
SizedBox(height: 20.h),
Container(
@ -295,7 +340,7 @@ class _ValueAddedServicesHighFunctionPageState
return Container(
margin: EdgeInsets.only(top: 30.h, bottom: 30.h),
child: Row(
children: [
children: <Widget>[
Visibility(
child: Container(
height: 70.h,

View File

@ -49,13 +49,13 @@ class _ValueAddedServicesPageListState
Image.asset('images/mine/icon_mine_valueAddedServices_note.png'),
TranslationLoader.lanKeys!.note!.tr, () {
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
arguments: {'type': 1});
arguments: <String, int>{'type': 1});
}),
_valueAddedServicesItem(
Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
TranslationLoader.lanKeys!.mail!.tr, () {
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
arguments: {'type': 2});
arguments: <String, int>{'type': 2});
}),
_valueAddedServicesItem(
Image.asset(

View File

@ -114,7 +114,7 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
onTap: () {
Navigator.pushNamed(
context, Routers.customSMSTemplateListPage,
arguments: <String, int>{'type': type});
arguments: <String, int>{'channelType': type});
},
child: Row(
children: <Widget>[

View File

@ -1,9 +1,4 @@
class BuyRecordListEntity {
int? errorCode;
String? description;
String? errorMsg;
BuyRecordListData? data;
BuyRecordListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
@ -14,6 +9,10 @@ class BuyRecordListEntity {
data =
json['data'] != null ? BuyRecordListData.fromJson(json['data']) : null;
}
int? errorCode;
String? description;
String? errorMsg;
BuyRecordListData? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -28,11 +27,6 @@ class BuyRecordListEntity {
}
class BuyRecordListData {
int? pageNo;
int? pageSize;
int? total;
List<BuyRecordItem>? buyRecordlist;
BuyRecordListData(
{this.pageNo, this.pageSize, this.total, this.buyRecordlist});
@ -47,6 +41,10 @@ class BuyRecordListData {
});
}
}
int? pageNo;
int? pageSize;
int? total;
List<BuyRecordItem>? buyRecordlist;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -61,21 +59,6 @@ class BuyRecordListData {
}
class BuyRecordItem {
int? id;
int? userId;
String? orderNumber;
String? type;
int? recordType;
int? smsCount;
int? emailCount;
int? cloudauthCount;
int? vipLockCount;
int? vipYear;
int? isApply;
String? money;
String? createdAt;
String? updatedAt;
BuyRecordItem(
{this.id,
this.userId,
@ -108,6 +91,20 @@ class BuyRecordItem {
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
int? id;
int? userId;
String? orderNumber;
String? type;
int? recordType;
int? smsCount;
int? emailCount;
int? cloudauthCount;
int? vipLockCount;
int? vipYear;
int? isApply;
String? money;
String? createdAt;
String? updatedAt;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -1,14 +1,14 @@
class UseRecordListArg {
static Map<String, String> sms = {
static Map<String, String> sms = <String, String>{
'type': 'sms',
};
static Map<String, String> vip = {
static Map<String, String> vip = <String, String>{
'type': 'vip',
};
static Map<String, String> email = {
static Map<String, String> email = <String, String>{
'type': 'email',
};
static Map<String, String> cloudauth = {
static Map<String, String> cloudauth = <String, String>{
'type': 'cloudauth',
};
}

View File

@ -1,9 +1,4 @@
class UseRecordListEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
UseRecordListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
@ -13,6 +8,10 @@ class UseRecordListEntity {
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
int? errorCode;
String? description;
String? errorMsg;
Data? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -27,51 +26,37 @@ class UseRecordListEntity {
}
class Data {
int? pageNo;
int? pageSize;
int? total;
List<UseItemData>? useRecordList;
Data({this.pageNo, this.pageSize, this.total, this.useRecordList});
Data({this.pageNo, this.pageSize, this.total, this.recordList});
Data.fromJson(Map<String, dynamic> json) {
pageNo = json['pageNo'];
pageSize = json['pageSize'];
total = json['total'];
if (json['list'] != null) {
useRecordList = <UseItemData>[];
recordList = <UseItemData>[];
json['list'].forEach((v) {
useRecordList!.add(UseItemData.fromJson(v));
recordList!.add(UseItemData.fromJson(v));
});
}
}
int? pageNo;
int? pageSize;
int? total;
List<UseItemData>? recordList;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['total'] = total;
if (useRecordList != null) {
data['list'] = useRecordList!.map((v) => v.toJson()).toList();
if (recordList != null) {
data['list'] = recordList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class UseItemData {
int? id;
int? userId;
String? type;
String? receiverAccount;
String? realName;
int? authStatus;
int? lockId;
String? lockName;
int? consCount;
String? createdAt;
String? updatedAt;
String? useDate;
UseItemData(
{this.id,
this.userId,
@ -83,7 +68,17 @@ class UseItemData {
this.lockName,
this.consCount,
this.createdAt,
this.updatedAt});
this.updatedAt,
this.useDate,
this.orderNumber,
this.recordType,
this.smsCount,
this.emailCount,
this.cloudauthCount,
this.vipLockCount,
this.vipYear,
this.amount,
this.buyDate});
UseItemData.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -98,7 +93,37 @@ class UseItemData {
createdAt = json['created_at'];
updatedAt = json['updated_at'];
useDate = json['useDate'];
orderNumber = json['order_number'];
recordType = json['record_type'];
smsCount = json['sms_count'];
emailCount = json['email_count'];
cloudauthCount = json['cloudauth_count'];
vipLockCount = json['vip_lock_count'];
vipYear = json['vip_year'];
amount = json['amount'];
buyDate = json['buyDate'];
}
int? id;
int? userId;
String? type;
String? receiverAccount;
String? realName;
int? authStatus;
int? lockId;
String? lockName;
int? consCount;
String? createdAt;
String? updatedAt;
String? useDate;
String? orderNumber;
int? recordType;
int? smsCount;
int? emailCount;
int? cloudauthCount;
int? vipLockCount;
int? vipYear;
String? amount;
String? buyDate;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -114,6 +139,15 @@ class UseItemData {
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
data['useDate'] = useDate;
data['order_number'] = orderNumber;
data['record_type'] = recordType;
data['sms_count'] = smsCount;
data['email_count'] = emailCount;
data['cloudauth_count'] = cloudauthCount;
data['vip_lock_count'] = vipLockCount;
data['vip_year'] = vipYear;
data['amount'] = amount;
data['buyDate'] = buyDate;
return data;
}
}

View File

@ -1,12 +1,9 @@
import 'dart:async';
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../network/api_repository.dart';
class ValueAddedServicesRecordLogic extends BaseGetXController {
ValueAddedServicesRecordLogic();
@ -25,6 +22,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
return;
}
type = data['type'];
loadBuyRecordList(false);
}
//
@ -32,16 +30,21 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
if (!load) {
buyPageNo = 1;
}
final AdvancedFunctionRecordEntity entity =
await ApiRepository.to.getBuyRecordList(
final UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList(
type: type,
recordType: 10,
pageNo: buyPageNo,
);
if (entity.errorCode!.codeIsSuccessful) {
state.buyRecordList.value = entity.data!.recordList!;
if (load) {
state.buyRecordList.addAll(entity.data!.recordList!);
} else {
state.buyRecordList.value = entity.data!.recordList!;
}
state.buyRecordList.refresh();
}
loadUseRecordList(false);
}
//使
@ -54,27 +57,34 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
pageNo: buyPageNo,
);
if (entity.errorCode!.codeIsSuccessful) {
state.useRecordList.value = entity.data!.useRecordList!;
if (load) {
state.useRecordList.addAll(entity.data!.recordList!);
} else {
state.useRecordList.value = entity.data!.recordList!;
}
state.useRecordList.refresh();
}
}
String getBuyRecordListTitle(RecordItem itemData) {
void getBuyAndUserInfoStr(UseItemData itemData) {
if (itemData.type == UseRecordListArg.sms['type']) {
return '${itemData.smsCount}';
state.buyCountStr.value = '${itemData.smsCount}';
state.useCountStr.value =
'${itemData.receiverAccount ?? ""} ${itemData.consCount}';
state.buyAmountStr.value = '${itemData.amount}';
} else if (itemData.type == UseRecordListArg.email['type']) {
return '${itemData.emailCount}';
state.buyCountStr.value = '${itemData.emailCount}';
state.useCountStr.value =
'${itemData.receiverAccount ?? ""} ${itemData.consCount}';
state.buyAmountStr.value = '${itemData.amount}';
} else if (itemData.type == UseRecordListArg.cloudauth['type']) {
return '实名认证/${itemData.cloudauthCount}';
state.buyCountStr.value = '实名认证/${itemData.cloudauthCount}';
state.useCountStr.value =
'${itemData.lockName ?? ""} ${itemData.realName ?? ""}';
state.buyAmountStr.value = '${itemData.amount}';
}
return '';
}
@override
void onReady() {
super.onReady();
loadBuyRecordList(false);
loadUseRecordList(false);
state.buyCountStr.refresh();
state.useCountStr.refresh();
state.buyAmountStr.refresh();
}
}

View File

@ -2,7 +2,6 @@ import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart';
import 'package:star_lock/tools/noData.dart';
@ -19,85 +18,84 @@ class ValueAddedServicesRecordPage extends StatefulWidget {
class _ValueAddedServicesRecordPageState
extends State<ValueAddedServicesRecordPage> {
final ValueAddedServicesRecordLogic logic =
Get.put(ValueAddedServicesRecordLogic());
@override
Widget build(BuildContext context) {
return GetBuilder<ValueAddedServicesRecordLogic>(
init: ValueAddedServicesRecordLogic(),
builder: (ValueAddedServicesRecordLogic logic) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '记录'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: DefaultTabController(
length: 2,
child: Column(
children: [
TabBar(
tabs: [tabTextItem('购买记录'.tr), tabTextItem('使用记录'.tr)],
indicatorColor: AppColors.mainColor,
indicatorSize: TabBarIndicatorSize.label,
labelColor: AppColors.mainColor,
unselectedLabelColor: AppColors.darkGrayTextColor,
),
Expanded(
child: Obx(() => TabBarView(children: [
_PurchaseRecords(
buyRecordList: logic.state.buyRecordList.value,
),
_UseRecordsTable(
useRecordList: logic.state.useRecordList.value,
),
])),
),
],
),
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '记录'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: DefaultTabController(
length: 2,
child: Column(
children: [
TabBar(
tabs: [tabTextItem('购买记录'.tr), tabTextItem('使用记录'.tr)],
indicatorColor: AppColors.mainColor,
indicatorSize: TabBarIndicatorSize.label,
labelColor: AppColors.mainColor,
unselectedLabelColor: AppColors.darkGrayTextColor,
),
);
});
Expanded(
child: TabBarView(
children: [
_PurchaseRecords(
buyRecordList: logic.state.buyRecordList, logic: logic),
_UseRecordsTable(
useRecordList: logic.state.useRecordList, logic: logic),
],
)),
],
),
),
);
}
}
Widget tabTextItem(String tabText) {
return Container(
margin: EdgeInsets.symmetric(vertical: 16.h),
child: Text(
tabText,
style: TextStyle(fontSize: 24.sp),
),
);
Widget tabTextItem(String tabText) {
return Container(
margin: EdgeInsets.symmetric(vertical: 16.h),
child: Text(
tabText,
style: TextStyle(fontSize: 24.sp),
),
);
}
}
//
class _PurchaseRecords extends StatelessWidget {
const _PurchaseRecords({required this.buyRecordList});
final List buyRecordList;
const _PurchaseRecords({required this.buyRecordList, required this.logic});
final List<UseItemData> buyRecordList;
final ValueAddedServicesRecordLogic logic;
@override
Widget build(BuildContext context) {
return GetBuilder<ValueAddedServicesRecordLogic>(
builder: (ValueAddedServicesRecordLogic logic) {
return EasyRefresh(
return EasyRefresh(
onRefresh: () async {
logic.loadBuyRecordList(false);
},
onLoad: () async {
logic.loadBuyRecordList(true);
},
child: buyRecordList.isNotEmpty
? ListView.builder(
itemCount: buyRecordList.length,
itemBuilder: (BuildContext context, int index) {
return _recordKeyItem(buyRecordList[index], logic);
})
: NoData(),
);
});
child: Obx(
() => buyRecordList.isNotEmpty
? ListView.builder(
itemCount: buyRecordList.length,
itemBuilder: (BuildContext context, int index) {
logic.getBuyAndUserInfoStr(buyRecordList[index]);
return _recordKeyItem(buyRecordList[index], logic);
})
: NoData(),
));
}
Widget _recordKeyItem(
RecordItem itemData, ValueAddedServicesRecordLogic logic) {
UseItemData itemData, ValueAddedServicesRecordLogic logic) {
return Container(
color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
@ -115,7 +113,7 @@ class _PurchaseRecords extends StatelessWidget {
fontWeight: FontWeight.bold),
),
Expanded(child: Container()),
Text('${itemData.amount}',
Text(logic.state.buyAmountStr.value,
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
@ -123,7 +121,7 @@ class _PurchaseRecords extends StatelessWidget {
],
),
SizedBox(height: 8.h),
Text(logic.getBuyRecordListTitle(itemData),
Text(logic.state.buyCountStr.value,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
],
@ -134,32 +132,33 @@ class _PurchaseRecords extends StatelessWidget {
// 使
class _UseRecordsTable extends StatelessWidget {
const _UseRecordsTable({required this.useRecordList});
final List useRecordList;
const _UseRecordsTable({required this.useRecordList, required this.logic});
final List<UseItemData> useRecordList;
final ValueAddedServicesRecordLogic logic;
@override
Widget build(BuildContext context) {
return GetBuilder<ValueAddedServicesRecordLogic>(
builder: (ValueAddedServicesRecordLogic logic) {
return EasyRefresh(
return EasyRefresh(
onRefresh: () async {
logic.loadUseRecordList(false);
},
onLoad: () async {
logic.loadUseRecordList(true);
},
child: useRecordList.isNotEmpty
? ListView.builder(
itemCount: useRecordList.length,
itemBuilder: (BuildContext context, int index) {
return _recordKeyItem(useRecordList[index]);
})
: NoData(),
);
});
child: Obx(
() => useRecordList.isNotEmpty
? ListView.builder(
itemCount: useRecordList.length,
itemBuilder: (BuildContext context, int index) {
logic.getBuyAndUserInfoStr(useRecordList[index]);
return _recordKeyItem(useRecordList[index], logic);
})
: NoData(),
));
}
Widget _recordKeyItem(UseItemData itemData) {
Widget _recordKeyItem(
UseItemData itemData, ValueAddedServicesRecordLogic logic) {
return Container(
color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
@ -170,7 +169,7 @@ class _UseRecordsTable extends StatelessWidget {
Row(
children: <Widget>[
Text(
'${itemData.lockName ?? ""} ${itemData.realName ?? ""}',
logic.state.useCountStr.value,
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,

View File

@ -1,7 +1,12 @@
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
class ValueAddedServicesRecordState {
int index = 0;
var buyRecordList = [].obs; //
var useRecordList = [].obs; //使
RxList<UseItemData> buyRecordList = <UseItemData>[].obs; //
RxList<UseItemData> useRecordList = <UseItemData>[].obs; //使
RxString buyCountStr = ''.obs;
RxString useCountStr = ''.obs;
RxString receiverUserStr = ''.obs;
RxString buyAmountStr = ''.obs;
}

View File

@ -1,6 +1,153 @@
import 'dart:convert';
class NewSMSTemplateEntity {
NewSMSTemplateEntity(
{this.errorCode, this.description, this.errorMsg, this.dataList});
NewSMSTemplateEntity({
this.errorCode,
this.description,
this.errorMsg,
this.dataList,
});
NewSMSTemplateEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
if (json['data'] != null) {
dataList = <LangData>[];
json['data'].forEach((v) {
dataList!.add(LangData.fromJson(v));
});
}
}
int? errorCode;
String? description;
String? errorMsg;
List<LangData>? dataList;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (dataList != null) {
data['data'] = dataList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LangData {
LangData({
this.langType,
this.langName,
this.templates,
});
LangData.fromJson(Map<String, dynamic> json) {
langType = json['langType'];
langName = json['langName'];
if (json['templates'] != null) {
templates = <TemplateData>[];
json['templates'].forEach((v) {
templates!.add(TemplateData.fromJson(v));
});
}
}
int? langType;
String? langName;
List<TemplateData>? templates;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['langType'] = langType;
data['langName'] = langName;
if (templates != null) {
data['templates'] = templates!.map((v) => v.toJson()).toList();
}
return data;
}
}
class TemplateData {
TemplateData({
this.langType,
this.langName,
this.templateType,
this.templateName,
this.template,
this.templatePreviewCode,
});
TemplateData.fromJson(Map<String, dynamic> json) {
langType = json['langType'];
langName = json['langName'];
templateType = json['templateType'];
templateName = json['templateName'];
template = json['template'];
templatePreviewCode = json['templatePreviewCode'] != null
? jsonEncode(json['templatePreviewCode'])
: null;
}
int? langType;
String? langName;
int? templateType;
String? templateName;
String? template;
String? fixedKey;
String? templatePreviewCode; // Changed to String
String? regards = '';
String? tips = '';
int? id;
String? name;
int? channelType;
bool? isUpdate = false;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['langType'] = langType;
data['langName'] = langName;
data['templateType'] = templateType;
data['templateName'] = templateName;
data['template'] = template;
if (templatePreviewCode != null) {
data['templatePreviewCode'] = jsonDecode(templatePreviewCode!);
}
return data;
}
// New method to replace template variables with values from templatePreviewCode
String generatePreview() {
if (template == null || templatePreviewCode == null) {
return '';
}
// Decode the templatePreviewCode string back to a map
final Map<String, String> previewCodeMap =
Map<String, String>.from(jsonDecode(templatePreviewCode!));
String previewTemplate = template!;
previewCodeMap.forEach((String key, String value) {
previewTemplate = previewTemplate.replaceAll(
key, value + (value.length > 2 ? '\n' : ''));
});
return previewTemplate;
}
}
/*
class NewSMSTemplateEntity {
NewSMSTemplateEntity({
this.errorCode,
this.description,
this.errorMsg,
this.dataList,
});
NewSMSTemplateEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
@ -12,6 +159,7 @@ class NewSMSTemplateEntity {
});
}
}
int? errorCode;
String? description;
String? errorMsg;
@ -30,18 +178,29 @@ class NewSMSTemplateEntity {
}
class SMSTemplateData {
SMSTemplateData(
{this.contentType, this.typeName, this.template, this.fixedKey});
SMSTemplateData({
this.contentType,
this.typeName,
this.template,
this.fixedKey,
this.templatePreviewCode,
});
SMSTemplateData.fromJson(Map<String, dynamic> json) {
contentType = json['content_type'];
typeName = json['typeName'];
template = json['template'];
fixedKey = json['fixed_key'];
templatePreviewCode = json['template_preview_code'] != null
? jsonEncode(json['template_preview_code'])
: null;
}
int? contentType;
String? typeName;
String? template;
String? fixedKey;
String? templatePreviewCode; // Changed to String
String? regards = '';
String? tips = '';
int? id;
@ -55,6 +214,29 @@ class SMSTemplateData {
data['typeName'] = typeName;
data['template'] = template;
data['fixed_key'] = fixedKey;
if (templatePreviewCode != null) {
data['template_preview_code'] = jsonDecode(templatePreviewCode!);
}
return data;
}
// New method to replace template variables with values from templatePreviewCode
String generatePreview() {
if (template == null || templatePreviewCode == null) {
return '';
}
// Decode the templatePreviewCode string back to a map
final Map<String, String> previewCodeMap =
Map<String, String>.from(jsonDecode(templatePreviewCode!));
String previewTemplate = template!;
previewCodeMap.forEach((String key, String value) {
previewTemplate = previewTemplate.replaceAll(
key, value + (value.length > 2 ? '\n' : ''));
});
return previewTemplate;
}
}
*/

View File

@ -14,14 +14,19 @@ class NewSMSTemplateLogic extends BaseGetXController {
//-- 1: 2:
Future<void> getDefaultTemplate() async {
final NewSMSTemplateEntity entity = await ApiRepository.to
.getDefaultTemplate(type: state.templateType.value);
final NewSMSTemplateEntity entity =
await ApiRepository.to.getDefaultTemplate();
if (entity.errorCode!.codeIsSuccessful) {
state.templateList.value = entity.dataList ?? <SMSTemplateData>[];
state.langTemplateList.value = entity.dataList ?? <LangData>[];
state.templateList.value =
entity.dataList![state.selectedLangIndex.value].templates ??
<TemplateData>[];
if (state.templateList.isNotEmpty) {
state.currentTemplate.value = state.templateList.firstWhere(
(SMSTemplateData element) =>
element.name == state.templateList[0].name,
(TemplateData element) =>
element.name ==
state.templateList[state.selectedTemplateIndex.value].name,
);
state.currentTemplate.refresh();
}
@ -35,12 +40,13 @@ class NewSMSTemplateLogic extends BaseGetXController {
return;
}
final LoginEntity entity = await ApiRepository.to.addTemplateService(
type: state.templateType.value,
name: state.templateNameTf.text,
fixedKey: state.currentTemplate.value.fixedKey ?? '',
contentType: state.currentTemplate.value.contentType ?? 0,
regards: state.templateOneTf.text,
tips: state.templateTwoTf.text);
channelType: state.channelType.value,
name: state.templateNameTf.text,
langType: state.currentTemplate.value.langType ?? 0,
regards: state.templateOneTf.text,
tips: state.templateTwoTf.text,
templateType: state.currentTemplate.value.templateType ?? 0,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('添加成功');
Get.back(result: true);
@ -60,12 +66,10 @@ class NewSMSTemplateLogic extends BaseGetXController {
}
//
void updateSmsCost(String template) {
state.smsCost.value = calculateSmsCost(template);
}
int calculateSmsCost(String template) {
final int smsCount = template.length;
int calculateSmsCost() {
final String smsText =
'${state.templateOneTf.text}\n${state.currentTemplate.value.template}\n${state.templateTwoTf.text}';
final int smsCount = smsText.length;
if (smsCount <= 70) {
return 1;
} else {
@ -75,15 +79,6 @@ class NewSMSTemplateLogic extends BaseGetXController {
//
List<TextSpan> buildElectronicKeySpan({required bool isPreview}) {
//
if (state.templateType.value == 1) {
return _buildSMSElectronicKey(isPreview);
} else {
return _buildEmailElectronicKey(isPreview);
}
}
List<TextSpan> _buildSMSElectronicKey(bool isPreview) {
final List<TextSpan> textSpans = <TextSpan>[];
//
if (isPreview) {
@ -94,6 +89,36 @@ class NewSMSTemplateLogic extends BaseGetXController {
),
);
}
if (isPreview) {
if (state.currentTemplate.value.generatePreview().isNotEmpty) {
textSpans.add(
TextSpan(
text: state.currentTemplate.value.generatePreview(),
style: state.defaultStyle,
),
);
} else {
textSpans.addAll(_buildDefaultTemplate(isPreview));
}
} else {
textSpans.addAll(_buildDefaultTemplate(isPreview));
}
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}\n',
style: state.defaultStyle,
),
);
}
return textSpans;
}
List<TextSpan> _buildDefaultTemplate(bool isPreview) {
final List<TextSpan> textSpans = <TextSpan>[];
//
final List<String> textFragments = state.currentTemplate.value.template
?.split(RegularExpression.urlRegExp) ??
@ -129,71 +154,6 @@ class NewSMSTemplateLogic extends BaseGetXController {
}
}
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
return textSpans;
}
List<TextSpan> _buildEmailElectronicKey(bool isPreview) {
final List<TextSpan> textSpans = <TextSpan>[];
//
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '${state.templateOneTf.text}\n',
style: state.defaultStyle,
),
);
} else {
String template = state.currentTemplate.value.template ?? '';
template = template.replaceAll('', '\n');
// ${}
final RegExp variableRegExp = RegExp(r'\{([^}]+)\}');
final Iterable<Match> matches = variableRegExp.allMatches(template);
int start = 0;
for (final Match match in matches) {
//
if (match.start > start) {
textSpans.add(
TextSpan(
text: template.substring(start, match.start),
style: state.defaultStyle,
),
);
}
//
textSpans.add(
TextSpan(
text: match.group(0),
style: state.highStyle,
),
);
start = match.end;
}
//
if (start < template.length) {
textSpans.add(
TextSpan(
text: template.substring(start),
style: state.defaultStyle,
),
);
}
}
return textSpans;
}
@ -209,69 +169,85 @@ class NewSMSTemplateLogic extends BaseGetXController {
),
);
}
//
if (state.templateType == 1 ||
(state.templateType == 2 && isPreview == false)) {
// ${}
final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}');
final String template = state.currentTemplate.value.template ?? '';
//
int startIndex = 0;
for (final Match match in variableRegExp.allMatches(template)) {
//
final String nonVariableText =
template.substring(startIndex, match.start);
//
final String replacedNonVariableText =
nonVariableText.replaceAllMapped(RegExp(r'|。'), (Match match) {
return '${match.group(0)}\n';
});
if (isPreview) {
if (state.currentTemplate.value.generatePreview().isNotEmpty) {
textSpans.add(
TextSpan(
text: replacedNonVariableText,
text: state.currentTemplate.value.generatePreview(),
style: state.defaultStyle,
),
);
//
final String variableText = match.group(0) ?? '';
textSpans.add(
TextSpan(
text: variableText,
style: state.highStyle,
),
);
//
startIndex = match.end;
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
}
return textSpans;
}
//
final String remainingText = template.substring(startIndex);
// ${}
final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}');
final String template = state.currentTemplate.value.template ?? '';
//
int startIndex = 0;
for (final Match match in variableRegExp.allMatches(template)) {
//
final String nonVariableText =
template.substring(startIndex, match.start);
//
final String replacedRemainingText =
remainingText.replaceAllMapped(RegExp(r'|。'), (Match match) {
final String replacedNonVariableText =
nonVariableText.replaceAllMapped(RegExp(r'|。'), (Match match) {
return '${match.group(0)}\n';
});
textSpans.add(
TextSpan(
text: replacedRemainingText,
text: replacedNonVariableText,
style: state.defaultStyle,
),
);
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
//
final String variableText = match.group(0) ?? '';
textSpans.add(
TextSpan(
text: variableText,
style: state.highStyle,
),
);
//
startIndex = match.end;
}
//
final String remainingText = template.substring(startIndex);
//
final String replacedRemainingText =
remainingText.replaceAllMapped(RegExp(r'|。'), (Match match) {
return '${match.group(0)}\n';
});
textSpans.add(
TextSpan(
text: replacedRemainingText,
style: state.defaultStyle,
),
);
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
return textSpans;
@ -281,8 +257,8 @@ class NewSMSTemplateLogic extends BaseGetXController {
Future<void> onReady() async {
super.onReady();
if (state.currentTemplate.value.isUpdate == false) {
getDefaultTemplate();
}
// if (state.currentTemplate.value.isUpdate == false) {
getDefaultTemplate();
// }
}
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
@ -28,7 +29,13 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: state.templateType == 1 ? '新建短信模版'.tr : '新建邮件模版'.tr,
barTitle: state.isUpdate.value == false
? state.channelType.value == 1
? '新建短信模版'.tr
: '新建邮件模版'.tr
: state.channelType.value == 1
? '编辑短信模版'.tr
: '编辑邮件模版'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
@ -74,15 +81,24 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
TranslationLoader.lanKeys!.pleaseEnter!.tr,
),
),
Obx(
() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.type!.tr,
rightTitle: state.currentTemplate.value.typeName ?? '',
isHaveLine: false,
isHaveDirection: true,
action: _showSelectTemplateType,
),
),
Obx(() => state.isUpdate.value == false
? CommonItem(
leftTitel: TranslationLoader.lanKeys!.type!.tr,
rightTitle: state.currentTemplate.value.templateName ?? '',
isHaveLine: true,
isHaveDirection: true,
action: _showSelectTemplateType,
)
: Container()),
Obx(() => state.isUpdate.value == false
? CommonItem(
leftTitel: '模版类型',
rightTitle: state.currentTemplate.value.langName ?? '',
isHaveLine: false,
isHaveDirection: true,
action: _showSelectLangType,
)
: Container()),
],
);
}
@ -112,21 +128,20 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
Obx(() => Container(
width: 1.sw - 50.w,
margin: EdgeInsets.only(left: 25.w, right: 25.w),
padding: EdgeInsets.only(bottom: 20.h),
child: _buildTemplateWithType(isPreview: false),
)),
SizedBox(height: 10.h),
Obx(() => Visibility(
visible: state.templateType.value == 1,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h),
height: 100,
child: Stack(
alignment: Alignment.bottomRight,
children: <Widget>[
_buildTextField(state.templateTwoTf),
],
),
))),
Container(
margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h),
height: 100,
child: Stack(
alignment: Alignment.bottomRight,
children: <Widget>[
_buildTextField(state.templateTwoTf),
],
),
)
],
),
);
@ -151,6 +166,8 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
),
Obx(() => Container(
width: 1.sw - 50.w,
// margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 20.h),
// padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h),
margin: EdgeInsets.only(left: 25.w, right: 25.w),
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
decoration: BoxDecoration(
@ -159,20 +176,25 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
),
child: _buildTemplateWithType(isPreview: true),
)),
Padding(
padding: EdgeInsets.only(
left: 25.w,
top: 25.h,
bottom: 25.h,
),
child: Text(
'预计产生短信条数:${state.smsCost.value}',
style: TextStyle(
color: Colors.grey,
fontSize: 20.sp,
if (state.channelType.value == 1)
Padding(
padding: EdgeInsets.only(
left: 25.w,
top: 25.h,
bottom: 25.h,
),
),
),
child: Text(
'预计产生短信条数:${logic.calculateSmsCost()}',
style: TextStyle(
color: Colors.grey,
fontSize: 20.sp,
),
),
)
else
SizedBox(
height: 20.h,
)
],
),
);
@ -186,7 +208,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
} else {
return RichText(
text: TextSpan(
children: state.currentTemplate.value.typeName == '电子钥匙'
children: state.currentTemplate.value.templateName == '电子钥匙'
? logic.buildElectronicKeySpan(isPreview: isPreview)
: logic.buildPasswordSpan(isPreview: isPreview),
),
@ -212,43 +234,46 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
),
),
onChanged: (String value) {
setState(() {
controller.text = value;
logic.updateSmsCost(value); //
});
setState(logic.calculateSmsCost);
},
);
}
Widget getTFWidget(TextEditingController tfController, String tfStr) {
return SizedBox(
height: 50.h,
width: 300.w,
child: Row(
children: <Widget>[
Expanded(
child: TextField(
maxLines: 1,
controller: tfController,
autofocus: false,
textAlign: TextAlign.end,
style: TextStyle(fontSize: 22.sp),
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
border: InputBorder.none,
),
),
),
height: 65.h,
width: 320.w,
child: TextField(
controller: tfController, //
maxLines: 3,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
],
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(
borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(
borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: EdgeInsets.only(top: 20.h, bottom: 0)),
style:
TextStyle(fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
),
);
}
void _showSelectTemplateType() {
final List<String> titleList = state.templateList
.map((SMSTemplateData template) => template.typeName ?? '')
.map((TemplateData template) => template.templateName ?? '')
.toList();
ShowBottomSheetTool().showSingleRowPicker(
context,
@ -258,8 +283,35 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
data: titleList,
clickCallBack: (int index, Object str) {
state.selectedTemplateIndex.value = index;
state.currentTemplate.value = state.templateList[index];
state.currentTemplate.value.typeName = str.toString();
state.currentTemplate.value.templateName = str.toString();
state.selectedTemplateIndex.refresh();
state.currentTemplate.refresh();
},
);
}
void _showSelectLangType() {
// langName
final List<String> langNames = state.langTemplateList
.map((LangData langData) => langData.langName ?? '')
.toList();
ShowBottomSheetTool().showSingleRowPicker(
context,
normalIndex: 0,
title: TranslationLoader.lanKeys!.type!.tr,
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
data: langNames,
clickCallBack: (int index, Object str) {
state.selectedLangIndex.value = index;
state.currentTemplate.value = state
.langTemplateList[state.selectedLangIndex.value]
.templates![state.selectedTemplateIndex.value];
state.currentTemplate.value.langName = str.toString();
state.selectedLangIndex.refresh();
state.currentTemplate.refresh();
},
);

View File

@ -12,7 +12,8 @@ class NewSMSTemplateState {
templateNameTf.text = currentTemplate.value.name ?? '';
templateOneTf.text = currentTemplate.value.regards ?? '';
templateTwoTf.text = currentTemplate.value.tips ?? '';
templateType.value = currentTemplate.value.type ?? 0;
channelType.value = currentTemplate.value.channelType ?? 0;
isUpdate.value = map['isUpdate'];
}
}
@ -29,9 +30,13 @@ class NewSMSTemplateState {
final TextEditingController templateNameTf = TextEditingController();
RxBool isVip = false.obs;
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs; //
RxList<TemplateData> templateList = <TemplateData>[].obs;
Rx<TemplateData> currentTemplate = TemplateData().obs; //
RxList<LangData> langTemplateList = <LangData>[].obs; //
RxInt selectedLangIndex = 0.obs; //
RxInt selectedTemplateIndex = 0.obs; //
RxBool isShowDate = false.obs; //
RxInt templateType = 0.obs; //1 2
RxInt smsCost = 0.obs; //
RxInt channelType = 0.obs; //1 2
RxString preContent = ''.obs; //
RxBool isUpdate = false.obs; //
}

View File

@ -29,7 +29,7 @@ class CustomSMSTemplateListEntity {
class CustomSMSTemplateListData {
CustomSMSTemplateListData(
{this.type,
{this.channelType,
this.list,
this.pageNo,
this.pageSize,
@ -37,7 +37,7 @@ class CustomSMSTemplateListData {
this.total});
CustomSMSTemplateListData.fromJson(Map<String, dynamic> json) {
type = json['type'];
channelType = json['channelType'];
if (json['list'] != null) {
list = <CustomSMSTemplateItem>[];
json['list'].forEach((v) {
@ -49,7 +49,7 @@ class CustomSMSTemplateListData {
pages = json['pages'];
total = json['total'];
}
int? type;
int? channelType;
List<CustomSMSTemplateItem>? list;
int? pageNo;
int? pageSize;
@ -58,7 +58,7 @@ class CustomSMSTemplateListData {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['type'] = type;
data['channelType'] = channelType;
if (list != null) {
data['list'] = list!.map((v) => v.toJson()).toList();
}
@ -73,58 +73,51 @@ class CustomSMSTemplateListData {
class CustomSMSTemplateItem {
CustomSMSTemplateItem(
{this.id,
this.userId,
this.type,
this.contentType,
this.channelType,
this.templateType,
this.name,
this.regards,
this.tips,
this.fixedKey,
this.createdAt,
this.updatedAt,
this.template,
this.fixedTemplate});
this.langType,
this.template});
CustomSMSTemplateItem.fromJson(Map<String, dynamic> json) {
id = json['id'];
userId = json['user_id'];
type = json['type'];
contentType = json['content_type'];
channelType = json['channelType'];
templateType = json['templateType'];
name = json['name'];
regards = json['regards'];
tips = json['tips'];
fixedKey = json['fixed_key'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
langType = json['langType'];
template = json['template'];
fixedTemplate = json['fixed_template'];
}
int? id;
int? userId;
int? type;
int? contentType;
int? channelType;
int? templateType;
String? name;
String? regards;
String? tips;
String? fixedKey;
String? createdAt;
String? updatedAt;
int? langType;
String? template;
String? fixedTemplate;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['user_id'] = userId;
data['type'] = type;
data['content_type'] = contentType;
data['channelType'] = channelType;
data['templateType'] = templateType;
data['name'] = name;
data['regards'] = regards;
data['tips'] = tips;
data['fixed_key'] = fixedKey;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
data['langType'] = langType;
data['template'] = template;
data['fixed_template'] = fixedTemplate;
return data;
}
}

View File

@ -20,7 +20,7 @@ class CustomSMSTemplateListLogic extends BaseGetXController {
}
final CustomSMSTemplateListEntity entity = await ApiRepository.to
.getSMSTemplateList(
type: state.type.value,
channelType: state.channelType.value,
pageNo: pageNo,
pageSize: int.parse(pageSize));
if (entity.errorCode!.codeIsSuccessful) {

View File

@ -42,7 +42,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: state.type.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
barTitle: state.channelType.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: EasyRefreshTool(
@ -66,14 +66,15 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () async {
final SMSTemplateData templateData = SMSTemplateData();
templateData.type = state.type.value;
final TemplateData templateData = TemplateData();
templateData.channelType = state.channelType.value;
templateData.isUpdate = false;
templateData.typeName =
templateData.contentType == 1 ? '电子钥匙' : '密码';
templateData.templateName =
templateData.templateType == 1 ? '电子钥匙' : '密码';
final result = await Get.toNamed(Routers.newSMSTemplatePage,
arguments: <String, SMSTemplateData>{
'currentTemplate': templateData
arguments: {
'currentTemplate': templateData,
'isUpdate': false
});
if (result != null) {
logic.getSMSTemplateListRequest(isRefresh: true);
@ -196,20 +197,19 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
CustomSMSTemplateItem itemData) {
return GestureDetector(
onTap: () async {
final SMSTemplateData templateData = SMSTemplateData();
final TemplateData templateData = TemplateData();
templateData.name = itemData.name;
templateData.regards = itemData.regards;
templateData.tips = itemData.tips;
templateData.id = itemData.id;
templateData.template = itemData.template;
templateData.contentType = itemData.contentType;
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
templateData.type = itemData.type;
templateData.templateType = itemData.templateType;
templateData.templateName =
templateData.templateName == 1 ? '电子钥匙' : '密码';
templateData.channelType = itemData.channelType;
templateData.isUpdate = true;
final result = await Get.toNamed(Routers.newSMSTemplatePage,
arguments: <String, SMSTemplateData>{
'currentTemplate': templateData
});
arguments: {'currentTemplate': templateData, 'isUpdate': true});
if (result != null) {
logic.getSMSTemplateListRequest(isRefresh: true);
}
@ -241,7 +241,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
padding: EdgeInsets.only(left: 20.w, top: 20.h, bottom: 20.h),
child: RichText(
text: TextSpan(
children: itemData.contentType == 1
children: itemData.templateType == 1
? logic.buildElectronicKeySpan(templateData: itemData)
: logic.buildPasswordSpan(templateData: itemData),
),

View File

@ -6,7 +6,7 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/
class CustomSMSTemplateListState {
CustomSMSTemplateListState() {
if (Get.arguments != null) {
type.value = Get.arguments['type'];
channelType.value = Get.arguments['channelType'];
}
}
//
@ -19,5 +19,5 @@ class CustomSMSTemplateListState {
RxBool isVip = false.obs;
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
RxInt type = 0.obs;
RxInt channelType = 0.obs;
}

View File

@ -243,9 +243,7 @@ abstract class Api {
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //
final String appGetAppInfoURL = '/app/getAppInfo'; //APP基本信息
final String appGetFwVersionURL = '/app/getFwVersion'; //
final String smsTemplateListURL = '/v2/service/listTemplate'; //
final String emailTemplateListURL =
'/v2/service/listEmailTemplate'; //
final String haveTemplateListURL = '/v2/service/listTemplate'; //
final String getDefaultTemplateURL =
'/v2/service/getDefaultTemplate'; //
final String addTemplateServiceURL = '/v2/service/addTemplate'; //
@ -255,7 +253,7 @@ abstract class Api {
final String checkIpURL = '/checkIp/ip';
final String keyNoticeTemplateURL = '/key/getNoticeTemplate'; //
final String keyNoticeSubmitURL = '/key/noticeSubmit'; //
final String keyNoticeSubmitURL = '/v2/key/noticeSubmit'; //
final String lockUpdateLockInfo = '/lock/updateLockInfo'; //
final String exportLockRecordsURL = '/lockRecords/export'; //
}

View File

@ -2191,19 +2191,19 @@ class ApiProvider extends BaseProvider {
);
//
Future<Response<dynamic>> getDefaultTemplate(int type) => post(
Future<Response<dynamic>> getDefaultTemplate() => post(
getDefaultTemplateURL.toUrl,
jsonEncode(<String, dynamic>{'type': type}),
jsonEncode(<String, dynamic>{}),
isUnShowLoading: true,
);
//
Future<Response<dynamic>> getSMSTemplateList(
int type, int pageNo, int pageSize) =>
int channelType, int pageNo, int pageSize) =>
post(
smsTemplateListURL.toUrl,
haveTemplateListURL.toUrl,
jsonEncode(<String, dynamic>{
'type': type,
'channelType': channelType,
'pageNo': pageNo,
'pageSize': pageSize
}),
@ -2211,17 +2211,17 @@ class ApiProvider extends BaseProvider {
);
//
Future<Response<dynamic>> addTemplateService(int type, String name,
int contentType, String regards, String tips, String fixedKey) =>
Future<Response<dynamic>> addTemplateService(int channelType, String name,
int langType, String regards, String tips, int templateType) =>
post(
addTemplateServiceURL.toUrl,
jsonEncode(<String, dynamic>{
'type': type,
'channelType': channelType,
'name': name,
'content_type': contentType,
'langType': langType,
'regards': regards,
'tips': tips,
'fixed_key': fixedKey
'templateType': templateType
}),
isUnShowLoading: true,
);
@ -2258,13 +2258,31 @@ class ApiProvider extends BaseProvider {
jsonEncode(<String, dynamic>{
'lockId': lockId,
'keyId': keyId,
'channelType': channelType
'channelType': channelType,
}),
isUnShowLoading: true,
);
Future<Response<dynamic>> keyNoticeSubmit(String receiverName, int lockId,
int keyId, int channelType, int openDoorType, String templateType) =>
Future<Response<dynamic>> getPwdNoticeTemplate(
int lockId, int keyboardPwdId, int channelType) =>
post(
keyNoticeTemplateURL.toUrl,
jsonEncode(<String, dynamic>{
'lockId': lockId,
'keyboardPwdId': keyboardPwdId,
'channelType': channelType,
}),
isUnShowLoading: true,
);
Future<Response<dynamic>> keyNoticeSubmit(
String receiverName,
int lockId,
int keyId,
int channelType,
int openDoorType,
String templateType,
int countryCode) =>
post(
keyNoticeSubmitURL.toUrl,
jsonEncode(<String, dynamic>{
@ -2274,6 +2292,29 @@ class ApiProvider extends BaseProvider {
'channelType': channelType,
'openDoorType': openDoorType,
'templateType': templateType,
'countryCode': countryCode
}),
isUnShowLoading: true,
);
Future<Response<dynamic>> pwdNoticeSubmit(
String receiverName,
int lockId,
int keyboardPwdId,
int channelType,
int openDoorType,
String templateType,
int countryCode) =>
post(
keyNoticeSubmitURL.toUrl,
jsonEncode(<String, dynamic>{
'receiverName': receiverName,
'lockId': lockId,
'keyboardPwdId': keyboardPwdId,
'channelType': channelType,
'openDoorType': openDoorType,
'templateType': templateType,
'countryCode': countryCode
}),
isUnShowLoading: true,
);

View File

@ -36,10 +36,8 @@ import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyList
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
import 'package:star_lock/mine/mineSet/mineSet/weChatQRCodeEntity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_entity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/face_authentication_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
@ -1001,8 +999,7 @@ class ApiRepository {
required int endTime,
required int remoteUnlockSwitch,
required int keyRight,
required bool isShowNetworkErrorMsg
}) async {
required bool isShowNetworkErrorMsg}) async {
final res = await apiProvider.batchSendKey(
lockIds,
createUser,
@ -1017,8 +1014,7 @@ class ApiRepository {
endTime,
remoteUnlockSwitch,
keyRight,
isShowNetworkErrorMsg
);
isShowNetworkErrorMsg);
return KeyDetailEntity.fromJson(res.body);
}
@ -2114,7 +2110,7 @@ class ApiRepository {
}
//
Future<AdvancedFunctionRecordEntity> getBuyRecordList({
Future<UseRecordListEntity> getBuyRecordList({
required String type,
required int pageNo,
required int recordType,
@ -2122,7 +2118,7 @@ class ApiRepository {
}) async {
final res =
await apiProvider.getBuyRecordList(type, recordType, pageNo, pageSize);
return AdvancedFunctionRecordEntity.fromJson(res.body);
return UseRecordListEntity.fromJson(res.body);
}
// 使
@ -2148,11 +2144,11 @@ class ApiRepository {
}
//
Future<AdvancedFunctionRecordEntity> keyCheckFace({
Future<ValueAddedServicesHighFunctionEntity> keyCheckFace({
required int lockId,
}) async {
final res = await apiProvider.keyCheckFace(lockId);
return AdvancedFunctionRecordEntity.fromJson(res.body);
return ValueAddedServicesHighFunctionEntity.fromJson(res.body);
}
// certifyId
@ -2221,29 +2217,31 @@ class ApiRepository {
}
//
Future<NewSMSTemplateEntity> getDefaultTemplate({required int type}) async {
final Response<dynamic> res = await apiProvider.getDefaultTemplate(type);
Future<NewSMSTemplateEntity> getDefaultTemplate() async {
final Response<dynamic> res = await apiProvider.getDefaultTemplate();
return NewSMSTemplateEntity.fromJson(res.body);
}
//
Future<CustomSMSTemplateListEntity> getSMSTemplateList(
{required int type, required int pageNo, required int pageSize}) async {
{required int channelType,
required int pageNo,
required int pageSize}) async {
final Response<dynamic> res =
await apiProvider.getSMSTemplateList(type, pageNo, pageSize);
await apiProvider.getSMSTemplateList(channelType, pageNo, pageSize);
return CustomSMSTemplateListEntity.fromJson(res.body);
}
//
Future<LoginEntity> addTemplateService(
{required int type,
{required int channelType,
required String name,
required int contentType,
required int langType,
required String regards,
required String tips,
required String fixedKey}) async {
required int templateType}) async {
final Response<dynamic> res = await apiProvider.addTemplateService(
type, name, contentType, regards, tips, fixedKey);
channelType, name, langType, regards, tips, templateType);
return LoginEntity.fromJson(res.body);
}
@ -2281,17 +2279,54 @@ class ApiRepository {
return SendEmailNotificationEntity.fromJson(res.body);
}
//
Future<SendEmailNotificationEntity> keyNoticeSubmit({
required String receiverName,
//
Future<SendEmailNotificationEntity> getPwdNoticeTemplate({
required int lockId,
required int keyId,
required int keyboardPwdId,
required int channelType,
required int openDoorType,
required String templateType,
}) async {
final Response<dynamic> res = await apiProvider.getPwdNoticeTemplate(
lockId, keyboardPwdId, channelType);
return SendEmailNotificationEntity.fromJson(res.body);
}
//
Future<SendEmailNotificationEntity> keyNoticeSubmit(
{required String receiverName,
required int lockId,
required int keyId,
required int channelType,
required int openDoorType,
required String templateType,
required int countryCode}) async {
final Response<dynamic> res = await apiProvider.keyNoticeSubmit(
receiverName, lockId, keyId, channelType, openDoorType, templateType);
receiverName,
lockId,
keyId,
channelType,
openDoorType,
templateType,
countryCode);
return SendEmailNotificationEntity.fromJson(res.body);
}
//
Future<SendEmailNotificationEntity> pwdNoticeSubmit(
{required String receiverName,
required int lockId,
required int keyboardPwdId,
required int channelType,
required int openDoorType,
required String templateType,
required int countryCode}) async {
final Response<dynamic> res = await apiProvider.pwdNoticeSubmit(
receiverName,
lockId,
keyboardPwdId,
channelType,
openDoorType,
templateType,
countryCode);
return SendEmailNotificationEntity.fromJson(res.body);
}

View File

@ -68,8 +68,8 @@ class EmailNotifyTypeSelectAlert extends StatelessWidget {
alignment: Alignment.centerLeft,
child: Text(
isEmail
? '邮件将从软件平台直接发给用户,请根据需要在软件里购买邮件数量'
: '短信将从软件平台直接发给用户,请根据需要在软件里购买短信数量',
? '邮件将从软件平台直接发给用户,请根据需要在软件里购买邮件数量'
: '短信将从软件平台直接发给用户,请根据需要在软件里购买短信数量',
style: TextStyle(fontSize: 18.sp),
textAlign: TextAlign.left,
),

View File

@ -66,13 +66,14 @@ class _LoginInputState extends State<LoginInput> {
border: Border(bottom: BorderSide(width: 0.5.h, color: Colors.grey)),
),
child: Row(
children: [
widget.isHaveLeftWidget == true
? widget.leftWidget ?? const SizedBox()
: SizedBox(
width: 20.w,
height: 40.w,
),
children: <Widget>[
if (widget.isHaveLeftWidget == true)
widget.leftWidget ?? const SizedBox()
else
SizedBox(
width: 20.w,
height: 40.w,
),
Expanded(
child: Stack(
children: [
@ -122,8 +123,7 @@ class _LoginInputState extends State<LoginInput> {
if (isPwd)
Padding(
padding: EdgeInsets.only(
top:
F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)),
top: F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)),
child: Text(
pwd,
style: TextStyle(

View File

@ -3,7 +3,6 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/translations/trans_lib.dart';
class PermissionDialog {
static Map<Permission, String> titles = <Permission, String>{

View File

@ -10,7 +10,7 @@
# 设置
environment="xhj"
main_file="lib/main_xhj_full.dart"
version_string="1.0.67"
version_string="1.0.69"
file_path="lib/network/api.dart"
###############################################################

View File

@ -75,8 +75,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.65+2024061801xhj 线上环境,提交测试:回归 bug
# 1.0.66+2024061802xhj 线上环境,提交测试:回归 bug
# 1.0.67+2024062501xhj 线上环境,提交测试:回归 测试部门bug
# 1.0.69+2024070301xhj 线上环境,提交测试:周常 bug 修复
# 1.0.69+2024070302xhj 线上环境,提交测试:周常 bug 修复
version: 1.0.68+2024062601
version: 1.0.69+2024070302
environment:
sdk: '>=2.12.0 <3.0.0'