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