xhj环境新增设置—微信公众号推送功能
This commit is contained in:
parent
282bae9f7c
commit
9d6259cf4c
@ -5,6 +5,7 @@ import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/weChatQRCodeEntity.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
@ -20,7 +21,8 @@ class MineSetLogic extends BaseGetXController {
|
||||
final MineSetState state = MineSetState();
|
||||
//用户信息
|
||||
Future<void> userSettingsInfoRequest() async {
|
||||
var entity = await ApiRepository.to.userSettingsInfo();
|
||||
final UserSettingInfoEntity entity =
|
||||
await ApiRepository.to.userSettingsInfo();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.userInfoData.value = entity.data!;
|
||||
state.userSetting.value = entity.data!.userSettings!;
|
||||
@ -51,21 +53,22 @@ class MineSetLogic extends BaseGetXController {
|
||||
|
||||
//更新提示音
|
||||
Future<void> updatePrompToneRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
final ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setAlertMode('1', state.isPrompTone.value == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功".tr);
|
||||
showToast('设置成功'.tr);
|
||||
userSettingsInfoRequest();
|
||||
}
|
||||
}
|
||||
|
||||
//设置微信公众号推送
|
||||
Future<void> setMpWechatPushSwitchRequest(BuildContext widgetContext) async {
|
||||
VersionUndateEntity entity = await ApiRepository.to.setMpWechatPushSwitch(
|
||||
mpWechatPushSwitch:
|
||||
state.isWechatPublicAccountPush.value == true ? 1 : 2);
|
||||
final VersionUndateEntity entity = await ApiRepository.to
|
||||
.setMpWechatPushSwitch(
|
||||
mpWechatPushSwitch:
|
||||
state.isWechatPublicAccountPush.value == true ? 1 : 2);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功".tr);
|
||||
showToast('设置成功'.tr);
|
||||
userSettingsInfoRequest();
|
||||
} else if (entity.errorCode! == 421) {
|
||||
if (state.isWechatPublicAccountPush.value == true) {
|
||||
@ -77,15 +80,18 @@ class MineSetLogic extends BaseGetXController {
|
||||
|
||||
//获取微信公众号二维码
|
||||
Future<void> getMpWechatQrCodeRequest(BuildContext widgetContext) async {
|
||||
GetWechatQrCodeEntity entity = await ApiRepository.to.getMpWechatQrCode();
|
||||
final GetWechatQrCodeEntity entity =
|
||||
await ApiRepository.to.getMpWechatQrCode();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.qrCodeUrl.value = entity.data!.qrCodeUrl!;
|
||||
state.qrCodeText.value = entity.data!.mpName ?? '';
|
||||
showQRImageAlert(state.qrCodeUrl.value, widgetContext);
|
||||
}
|
||||
}
|
||||
|
||||
void showQRImageAlert(String qrCodeUrl, BuildContext widgetContext) {
|
||||
ShowCupertinoAlertView().showQRImageAlert(widgetContext, qrCodeUrl);
|
||||
ShowCupertinoAlertView()
|
||||
.showQRImageAlert(widgetContext, qrCodeUrl, state.qrCodeText.value);
|
||||
}
|
||||
|
||||
//退出登录请求
|
||||
@ -117,7 +123,7 @@ class MineSetLogic extends BaseGetXController {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setTouchUnlockFlag(state.isTouchUnlock.value == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功".tr);
|
||||
showToast('设置成功'.tr);
|
||||
userSettingsInfoRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,18 +191,18 @@ class _MineSetPageState extends State<MineSetPage>
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(_isPushNotificationSwitch))),
|
||||
if (F.appFlavor == Flavor.sky)
|
||||
CommonItem(
|
||||
leftTitel: '微信公众号推送'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(_isWechatPublicAccountPushSwitch)))
|
||||
else
|
||||
Container(),
|
||||
// if (F.appFlavor == Flavor.sky)
|
||||
CommonItem(
|
||||
leftTitel: '微信公众号推送'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(_isWechatPublicAccountPushSwitch))),
|
||||
// else
|
||||
// Container(),
|
||||
SizedBox(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
|
||||
|
||||
@ -11,6 +11,7 @@ class MineSetState {
|
||||
var isPushNotification = false.obs; //消息推送
|
||||
var isWechatPublicAccountPush = false.obs; //微信公众号推送
|
||||
var qrCodeUrl = ''.obs; //二维码地址
|
||||
var qrCodeText = ''.obs; //二维码提示语
|
||||
|
||||
var lockScreen = 2.obs; //锁屏
|
||||
var hideExpiredAccessFlag = 2.obs; //隐藏无效开锁
|
||||
|
||||
@ -28,16 +28,19 @@ class GetWechatQrCodeEntity {
|
||||
|
||||
class Data {
|
||||
String? qrCodeUrl;
|
||||
String? mpName;
|
||||
|
||||
Data({this.qrCodeUrl});
|
||||
Data({this.qrCodeUrl, this.mpName});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
qrCodeUrl = json['qrCodeUrl'];
|
||||
mpName = json['mpName'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['qrCodeUrl'] = qrCodeUrl;
|
||||
data['mpName'] = mpName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,19 +13,20 @@ class ShowCupertinoAlertView {
|
||||
bool isSystemEmailSelected = true; // 默认选中系统邮件
|
||||
|
||||
//微信公众号二维码弹窗
|
||||
void showQRImageAlert(BuildContext widgetContext, String qrCodeUrl) {
|
||||
void showQRImageAlert(
|
||||
BuildContext widgetContext, String qrCodeUrl, String qrCodeText) {
|
||||
showCupertinoModalPopup(
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoActionSheet(
|
||||
actions: [
|
||||
actions: <Widget>[
|
||||
Container(
|
||||
color: Colors.white, // 设置底色为白色
|
||||
child: CupertinoActionSheetAction(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
),
|
||||
@ -40,7 +41,7 @@ class ShowCupertinoAlertView {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 60.w, right: 60.w),
|
||||
child: Text(
|
||||
'开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置'.tr,
|
||||
'开启微信接收报警消息需要先关注$qrCodeText微信公众号,请保存二维码并使用微信扫一扫设置',
|
||||
style:
|
||||
TextStyle(fontSize: 24.sp, color: Colors.black),
|
||||
)),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user