更新微信登录

This commit is contained in:
wyf
2025-08-19 18:00:51 +08:00
parent b2cd46bc7a
commit 2cca7c7716
11 changed files with 211 additions and 76 deletions

View File

@@ -1,8 +1,8 @@
class ServiceConstant {
// static const String baseHost = "zhmht.swes.com.cn:27021"; //服务地址 眠花糖测试地址
// static const String baseHost = "zhmht.swes.com.cn:27020"; //服务地址 眠花糖正式地址
// static const String baseHost = "vsbs-test.he-info.cn"; //服务地址 本地测试地址
static const String baseHost = "vsbst-api.he-info.cn";//服务地址
static const String baseHost = "vsbs-test.he-info.cn"; //服务地址 本地测试地址
// static const String baseHost = "vsbst-api.he-info.cn";//服务地址
// static const String service_address = "http://$baseHost";
static const String service_address = "https://$baseHost";

View File

@@ -33,7 +33,7 @@ class DeviceStatusInfoWidget extends StatelessWidget {
print('点击了 $title 模块');
},
child: Container(
width: MediaQuery.sizeOf(context).width * 0.32,
width: MediaQuery.sizeOf(context).width * 0.36,
constraints: BoxConstraints(
minWidth: 201.rpx,
minHeight: 182.rpx,

View File

@@ -48,7 +48,7 @@ class _InstantBodyPageState extends State<InstantBodyPage>
// String snores = "否".tr;
// int heartrate = 0;
String breathState = "-";
String inBed ="-";
String inBed = "-";
String onlineState = "离线".tr;
Timer? _onlineTimer; // 添加 Timer 引用
int bodyMotion = -1;
@@ -109,9 +109,9 @@ class _InstantBodyPageState extends State<InstantBodyPage>
inBed = "-";
bodyMotion = -1;
heartrate = -1;
snores ="-";
snores = "-";
breathrate = -1;
breathState ="-";
breathState = "-";
});
}
});
@@ -252,7 +252,7 @@ class _InstantBodyPageState extends State<InstantBodyPage>
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 120.rpx),
30.rpx, 0.rpx, 30.rpx, 100.rpx),
child: ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController
@@ -426,7 +426,7 @@ class _InstantBodyPageState extends State<InstantBodyPage>
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
66.rpx, 0, 66.rpx, 0),
30.rpx, 0, 30.rpx, 0),
child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(

View File

@@ -373,6 +373,16 @@ class _DeviceShareListPageState extends State<DeviceShareListPage> {
),
ClickableContainer(
onTap: () async {
if (deviceShareListController.selectedShareInfo ==
null ||
deviceShareListController
.selectedShareInfo.isEmpty) {
TopSlideNotification.show(context,
text: "删除错误提示".tr,
textColor:
themeController.currentColor.sc9);
return;
}
showConfirmDialog(context, Container(), "删除提示".tr,
onConfirm: () async {
if (deviceShareListController

View File

@@ -267,6 +267,7 @@ class _EPageState extends State<DeviceTypePage> {
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),

View File

@@ -3,8 +3,10 @@ import 'dart:convert';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
@@ -12,6 +14,7 @@ import 'package:vbvs_app/controller/device/device_type_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/enum/LoginStatus.dart';
import 'package:vbvs_app/model/api_response.dart';
@@ -23,7 +26,7 @@ class EPage extends StatefulWidget {
State<EPage> createState() => _EPageState();
}
class _EPageState extends State<EPage> {
class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
@@ -34,6 +37,9 @@ class _EPageState extends State<EPage> {
RxList deviceList = [].obs;
RxString finalUri = RxString('');
@override
bool get wantKeepAlive => true; // 保持页面状态
@override
void initState() {
super.initState();
@@ -48,6 +54,7 @@ class _EPageState extends State<EPage> {
@override
Widget build(BuildContext context) {
super.build(context); // ⚠️必须调用,保证 keepAlive 生效
bool isLoggedIn = userInfoController.model.login == LoginStatus.LOGIN.code;
return LayoutBuilder(
@@ -73,7 +80,7 @@ class _EPageState extends State<EPage> {
alignment: Alignment.center,
children: [
Text(
'小e'.tr,
'菜单.小e'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
@@ -226,7 +233,24 @@ class _EPageState extends State<EPage> {
finalUri.value = widget.sleepUri;
}
}
String? language = "";
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
}
if (language != null && language.isNotEmpty) {
if (finalUri.value.contains("?")) {
finalUri.value += "&lang=$language";
} else {
finalUri.value += "?lang=$language";
}
}
ef.log("msg");
}
}

View File

@@ -68,11 +68,11 @@ class MainPageBottomChange extends GetView<MainPageController> {
);
}
List arr = [
List<Widget> arr = [
HomePage(),
// SleepReportPage(),
// EPage(),
EPage(sleepUri:"https://xiaoe.he-info.cn/"),
EPage(sleepUri: "https://xiaoe.he-info.cn/"),
MessagePage(),
MinePage(),
];
@@ -81,7 +81,7 @@ class MainPageBottomChange extends GetView<MainPageController> {
final getStorage = GetStorage();
@override
Widget build(BuildContext context) {
Future.delayed(const Duration(milliseconds: 0), () {
Future.delayed(const Duration(milliseconds: 0), () {
String? isShowYingShiDialog = getStorage.read("isShowYingShiDialog");
if (isShowYingShiDialog == null || isShowYingShiDialog != "true") {
String btnName = "同意".tr;
@@ -134,7 +134,13 @@ class MainPageBottomChange extends GetView<MainPageController> {
() {
if (globalController.model.hideBottomNavigationBar == true) {
return Scaffold(
body: arr[controller.model.currentIndex],
// body: arr[controller.model.currentIndex],
body: IndexedStack(
// ✅ 改成 IndexedStack
index: controller.model.currentIndex,
children:
arr.map((page) => SizedBox.expand(child: page)).toList(),
),
floatingActionButtonAnimator:
FloatingActionButtonAnimator.noAnimation,
floatingActionButton: Container(),
@@ -150,6 +156,13 @@ class MainPageBottomChange extends GetView<MainPageController> {
child: Scaffold(
backgroundColor: Colors.transparent,
body: arr[controller.model.currentIndex],
// body: IndexedStack(
// // ✅ 改成 IndexedStack
// index: controller.model.currentIndex,
// children: arr
// .map((page) => SizedBox.expand(child: page))
// .toList(),
// ),
floatingActionButtonAnimator:
FloatingActionButtonAnimator.noAnimation,
floatingActionButtonLocation:

View File

@@ -1751,64 +1751,132 @@ class MHTLoginPage extends GetView<MHTLoginController> {
),
);
}),
Divider(
color: stringToColor("#495A67"), // 线的颜色
thickness: 1.rpx, // 线的粗细
height: 20, // 垂直方向的占位高度
indent: 16, // 左边缩进
endIndent: 16, // 右边缩进
),
Text(
"其他登录方式".tr,
style: TextStyle(
color: Colors.white,
fontSize: AppConstants()
.normal_text_fontSize),
),
SizedBox(
height: 30.rpx,
),
ClickableContainer(
backgroundColor: Colors.white, // 背景色
highlightColor: Colors.grey, // 点击水波纹颜色
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () async {
// loginController.model.isIos == true &&
MHTRegisterController registerController =
Get.find();
if (registerController
.model.register_agree ==
null ||
registerController
.model.register_agree !=
true) {
TopSlideNotification.show(
context,
text: "需要同意协议".tr,
textColor:
themeController.currentColor.sc9,
);
return;
}
MHTLoginController loginController =
Get.find();
await loginController.wxLoginSendAuth();
// TopSlideNotification.show(context,
// text: "测试阶段,暂不支持".tr);
},
child: Container(
width: 90.rpx,
height: 90.rpx,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/wechat.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
// Divider(
// color: stringToColor("#495A67"), // 线的颜色
// thickness: 1.rpx, // 线的粗细
// height: 20, // 垂直方向的占位高度
// indent: 16, // 左边缩进
// endIndent: 16, // 右边缩进
// ),
// Text(
// "其他登录方式".tr,
// style: TextStyle(
// color: Colors.white,
// fontSize: AppConstants()
// .normal_text_fontSize),
// ),
// SizedBox(
// height: 30.rpx,
// ),
// ClickableContainer(
// backgroundColor: Colors.white, // 背景色
// highlightColor: Colors.grey, // 点击水波纹颜色
// borderRadius: 999.rpx,
// padding: EdgeInsets.zero,
// onTap: () async {
// // loginController.model.isIos == true &&
// MHTRegisterController registerController =
// Get.find();
// if (registerController
// .model.register_agree ==
// null ||
// registerController
// .model.register_agree !=
// true) {
// TopSlideNotification.show(
// context,
// text: "需要同意协议".tr,
// textColor:
// themeController.currentColor.sc9,
// );
// return;
// }
// MHTLoginController loginController =
// Get.find();
// await loginController.wxLoginSendAuth();
// // TopSlideNotification.show(context,
// // text: "测试阶段,暂不支持".tr);
// },
// child: Container(
// width: 90.rpx,
// height: 90.rpx,
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage(
// 'assets/images/wechat.png'), // 本地图片
// fit: BoxFit.fill, // 填满整个 Container
// ),
// ),
// ),
// ),
Obx(() {
// 条件iOS 且微信未安装
if (controller.model.isIos == true &&
controller.model.isWeChatNotInstalled ==
true) {
return SizedBox.shrink(); // 不显示任何内容
}
MHTRegisterController
mhtRegisterController = Get.find();
// 显示其他登录方式
return Column(
children: [
Divider(
color:
stringToColor("#495A67"), // 线的颜色
thickness: 1.rpx, // 线的粗细
height: 20, // 垂直方向的占位高度
indent: 16, // 左边缩进
endIndent: 16, // 右边缩进
),
),
),
),
Text(
"其他登录方式".tr,
style: TextStyle(
color: Colors.white,
fontSize: AppConstants()
.normal_text_fontSize,
),
),
SizedBox(height: 30.rpx),
ClickableContainer(
backgroundColor: Colors.white, // 背景色
highlightColor:
Colors.grey, // 点击水波纹颜色
borderRadius: 999.rpx,
padding: EdgeInsets.zero,
onTap: () async {
if (mhtRegisterController
.model.register_agree !=
true) {
TopSlideNotification.show(
context,
text: "需要同意协议".tr,
textColor: themeController
.currentColor.sc9,
);
return;
}
final loginController =
Get.find<MHTLoginController>();
await loginController
.wxLoginSendAuth();
},
child: Container(
width: 90.rpx,
height: 90.rpx,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/wechat.png'),
fit: BoxFit.fill,
),
),
),
),
],
);
})
],
),
),