更新微信登录

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

@@ -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: