合并更新
This commit is contained in:
@@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
import 'package:EasyDartModule/EasyDartModule.dart';
|
||||
import 'package:EasyDartModule/base/logger/Logger.dart';
|
||||
import 'package:EasyDartModule/base/websocket/WebSocket.dart';
|
||||
import 'package:easyweb/utils/appmanger.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -106,6 +107,8 @@ Future<void> main() async {
|
||||
// // 初始化 flutter_xupdate android app 更新
|
||||
// initXUpdate();
|
||||
|
||||
initwebService();
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
|
||||
.then((_) {
|
||||
@@ -113,6 +116,15 @@ Future<void> main() async {
|
||||
});
|
||||
}
|
||||
|
||||
void initwebService() {
|
||||
ef.kvRoot.appmanger = MiniAppManager(assetsfilePath: 'assets/file.json');
|
||||
ef.kvRoot.appmanger.register(["mhtControl"]);
|
||||
ef.kvRoot.appmanger.init().then((x) {
|
||||
//先加载,后检测更新..
|
||||
ef.kvRoot.appmanger.start("https://wyf.it.real.he-info.cn:94/apk/webapp/");
|
||||
});
|
||||
}
|
||||
|
||||
initLanguageSetting() {
|
||||
try {
|
||||
Get.put(LanguageController());
|
||||
|
||||
@@ -20,7 +20,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
// onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
|
||||
@@ -18,11 +18,22 @@ class _MhAboutUsPageState extends State<MhAboutUsPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
// pdfController.loadPdf();
|
||||
|
||||
String url;
|
||||
switch (AppConstants().ent_type) {
|
||||
case 1:
|
||||
url = "https://mp.weixin.qq.com/s/BrD3fTT2J2R-DxZrUuM4rw";
|
||||
break;
|
||||
case 2:
|
||||
url = "https://mp.weixin.qq.com/s/7BvvprVDqX1eOzM3Lms8dg";
|
||||
break;
|
||||
case 3:
|
||||
url = "https://mp.weixin.qq.com/s/BrD3fTT2J2R-DxZrUuM4rw";
|
||||
break;
|
||||
default:
|
||||
url = "https://mp.weixin.qq.com/s/BrD3fTT2J2R-DxZrUuM4rw";
|
||||
}
|
||||
widget.webView = MyWebView(
|
||||
url: AppConstants().ent_type == 1
|
||||
? "https://mp.weixin.qq.com/s/BrD3fTT2J2R-DxZrUuM4rw"
|
||||
: "https://mp.weixin.qq.com/s/7BvvprVDqX1eOzM3Lms8dg",
|
||||
url: url,
|
||||
onLoad: () {
|
||||
print('网页载入完毕');
|
||||
},
|
||||
|
||||
@@ -230,14 +230,6 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
TopSlideNotification.show(context,
|
||||
text: response.msg!);
|
||||
if (response.code == HttpStatusCodes.ok) {
|
||||
try {
|
||||
WebviewTestController webviewTestController =
|
||||
Get.find();
|
||||
webviewTestController.web.jsbridge?.dart
|
||||
.unBindDevice();
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新报错:$e");
|
||||
}
|
||||
homeController.getPersonList();
|
||||
//请求绑定设备列表
|
||||
// homeController.getSleepReport();
|
||||
@@ -254,6 +246,14 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
.getDeviceList(group: 'room')
|
||||
.then((apiResponse) {
|
||||
if (apiResponse.code != HttpStatusCodes.ok) {
|
||||
try {
|
||||
WebviewTestController webviewTestController =
|
||||
Get.find();
|
||||
webviewTestController.web.jsbridge?.dart
|
||||
.alterDevice();
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新报错:$e");
|
||||
}
|
||||
TopSlideNotification.show(
|
||||
Get.context!,
|
||||
text: apiResponse.msg!,
|
||||
|
||||
@@ -58,7 +58,8 @@ class DeviceInfoWidget extends GetView {
|
||||
children: [
|
||||
Text(
|
||||
deviceListController.model.deviceList[index]['name'] ??
|
||||
'SWES系列 01号智能一键入眠床',
|
||||
getNameByType(
|
||||
deviceListController.model.deviceList[index]),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
@@ -127,14 +128,14 @@ class DeviceInfoWidget extends GetView {
|
||||
.model.deviceList[index]
|
||||
["status"]?["status"]) ==
|
||||
1
|
||||
? '在线'
|
||||
: '离线',
|
||||
? '已绑定'
|
||||
: '已绑定',
|
||||
valueColor: (deviceListController
|
||||
.model.deviceList[index]
|
||||
["status"]?["status"]) ==
|
||||
1
|
||||
? Color(0xFF6BFDAC)
|
||||
: Color(0xFFFF7159)),
|
||||
: Color(0xFF6BFDAC)),
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
@@ -207,15 +208,12 @@ class DeviceInfoWidget extends GetView {
|
||||
try {
|
||||
WebviewTestController webviewTestController =
|
||||
Get.find();
|
||||
var future = webviewTestController
|
||||
.web.jsbridge?.dart
|
||||
.appToHtmlDevice(device);
|
||||
Future.delayed(Duration(seconds: 5), () {
|
||||
return;
|
||||
});
|
||||
await future;
|
||||
|
||||
await webviewTestController.web.jsbridge?.dart
|
||||
.pageActive(false);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
await webviewTestController.web.jsbridge?.dart
|
||||
.appToHtmlDevice(device);
|
||||
MainPageBBottomChange.jumpTo(2);
|
||||
Get.until((route) =>
|
||||
Get.currentRoute ==
|
||||
@@ -387,15 +385,17 @@ class DeviceInfoWidget extends GetView {
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "功能开发中...",
|
||||
);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "功能开发中...",
|
||||
// );
|
||||
// var a = [device["bindMacA"]];
|
||||
// if ("${device["bindMacB"]}".length > 6) {
|
||||
// a.add(device["bindMacB"]);
|
||||
// }
|
||||
// Get.toNamed("/sleepWebview", arguments: a);
|
||||
Get.toNamed("/mhtSleepReportReturnPage",
|
||||
arguments: device);
|
||||
},
|
||||
child: Container(
|
||||
height: MediaQuery.sizeOf(context).height * 0.1,
|
||||
@@ -464,4 +464,16 @@ class DeviceInfoWidget extends GetView {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
getNameByType(device) {
|
||||
if (device['device_type'] == null) {
|
||||
return '未知类型设备'.tr;
|
||||
}
|
||||
if (device['device_type'] == 2) {
|
||||
return 'SWES 智能床'.tr;
|
||||
}
|
||||
if (device['device_type'] == 3) {
|
||||
return 'SWES 智能床垫'.tr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,13 +164,13 @@ class _MHTBindDeviceTypePageState extends State<MHTBindDeviceTypePage> {
|
||||
return CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () {
|
||||
if (type == 2) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "当前类型不支持绑定".tr,
|
||||
);
|
||||
return;
|
||||
}
|
||||
// if (type == 2) {
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "当前类型不支持绑定".tr,
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
MHTBlueToothController mhtBlueToothController = Get.find();
|
||||
mhtBlueToothController.model.deviceType = type.toInt();
|
||||
Get.toNamed("/mHTBlueteethDevicePage", arguments: data);
|
||||
|
||||
@@ -79,14 +79,12 @@ class _HomeDeviceStausWidgetState extends State<HomeDeviceStausWidget> {
|
||||
try {
|
||||
var device = widget.deviceStatus;
|
||||
WebviewTestController webviewTestController = Get.find();
|
||||
var future = webviewTestController.web.jsbridge?.dart
|
||||
.appToHtmlDevice(device);
|
||||
Future.delayed(Duration(seconds: 5), () {
|
||||
return;
|
||||
});
|
||||
await future;
|
||||
|
||||
await webviewTestController.web.jsbridge?.dart
|
||||
.pageActive(false);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
await webviewTestController.web.jsbridge?.dart
|
||||
.appToHtmlDevice(device);
|
||||
MainPageBBottomChange.jumpTo(2);
|
||||
} catch (e) {
|
||||
DailyLogUtils.writeError("发生异常: $e");
|
||||
|
||||
@@ -102,6 +102,7 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
|
||||
homeController.updateAll();
|
||||
});
|
||||
}
|
||||
//themeController.currentColor.sc5,
|
||||
if (homeController.personnelList.value.length != 0)
|
||||
return Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
@@ -125,6 +126,16 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'健康报告'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color:
|
||||
themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
ScrollbarTheme(
|
||||
data: ScrollbarThemeData(
|
||||
thumbColor: MaterialStateProperty.all(
|
||||
@@ -278,6 +289,7 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
|
||||
'assets/images/new_background.png',
|
||||
'arrow': false,
|
||||
'noBackImg': true,
|
||||
'person_show': false,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:easyweb/utils/appmanger.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@@ -34,6 +37,7 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
GlobalController gloablController = Get.find();
|
||||
WeatherModelController weatherModelController = Get.find();
|
||||
// var selectedDayIndex = (6).obs;
|
||||
StreamSubscription? _newVersionSubscription;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -71,6 +75,28 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
homeController.homeSleepDays.value.length - 1;
|
||||
}
|
||||
});
|
||||
try {
|
||||
_newVersionSubscription =
|
||||
ef.kvRoot.appmanger.onAppUpdate.stream.listen((MiniAppPkg pkg) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text("发现新版本"),
|
||||
content: Text("新版本号:${pkg.version}"),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text("知道了"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
getWeekName(int i) {
|
||||
|
||||
@@ -32,22 +32,17 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
WebviewTestController() : super(WebviewTestModel()) {
|
||||
web = WebviewHelper(
|
||||
jsbridge: buildsdk(
|
||||
<<<<<<< HEAD
|
||||
// father: this,
|
||||
// clientId: '494641114',
|
||||
// dbgserverUrl: 'ws://192.168.1.2:9001',
|
||||
),
|
||||
=======
|
||||
father: this,
|
||||
clientId: '494641114',
|
||||
// dbgserverUrl: 'ws://192.168.1.2:9001',
|
||||
),
|
||||
>>>>>>> 58b2bebe936bdd7239529662ef20b531f2143de4
|
||||
settings: buildsettings(),
|
||||
params: PlatformHeadlessInAppWebViewCreationParams(
|
||||
initialUrlRequest: URLRequest(
|
||||
url: WebUri(
|
||||
'https://wyf.it.real.he-info.cn:94/goods-front/index.html'),
|
||||
// url: WebUri(
|
||||
// 'http://192.168.1.2:8888'),
|
||||
),
|
||||
onLoadStop: (controller, url) {
|
||||
setState(() => ready.value = true);
|
||||
@@ -140,19 +135,6 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
return data;
|
||||
});
|
||||
});
|
||||
web
|
||||
//.file(
|
||||
// url: 'https://wsl.it.real.he-info.cn:94/webdemo/web.zip',
|
||||
// pretag: 'https://wsl.it.real.he-info.cn:94/webdemo/',
|
||||
//)
|
||||
.network()
|
||||
.then((value) {
|
||||
if (value) {
|
||||
setState(() {
|
||||
ready.value = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (e, s) {
|
||||
ef.log('$e,$s');
|
||||
}
|
||||
@@ -271,6 +253,36 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
ws.connect();
|
||||
}
|
||||
//EasyFlutter End
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
ef.log("webview test init =>${DateTime.now()}");
|
||||
super.onInit();
|
||||
try {
|
||||
ef.kvRoot.appmanger.find("mhtControl").then((x) {
|
||||
x!.load().then((y) {
|
||||
ef.log("webview test res init loaded =>${DateTime.now()}");
|
||||
web
|
||||
.file(
|
||||
url: 'https://wyf.it.real.he-info.cn:94/goods-front/index.html',
|
||||
pretag: 'https://wyf.it.real.he-info.cn:94/goods-front/',
|
||||
raw: y,
|
||||
)
|
||||
//.network()
|
||||
.then((value) {
|
||||
if (value) {
|
||||
//资源准备完成..
|
||||
setState(() {
|
||||
ready.value = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (e, s) {
|
||||
ef.log('$e,$s');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
|
||||
@@ -178,12 +178,50 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 背景透明
|
||||
appBar: AppBar(
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: widget.data['backgroundColor'] != null
|
||||
// ? widget.data['backgroundColor'].withOpacity(0.8)
|
||||
// : themeController.currentColor.sc5,
|
||||
// automaticallyImplyLeading: false,
|
||||
// iconTheme: IconThemeData(color: themeController.currentColor.sc3),
|
||||
// titleSpacing: 0,
|
||||
// title: Container(
|
||||
// width: double.infinity,
|
||||
// height: 180.rpx,
|
||||
// child: Stack(
|
||||
// alignment: Alignment.center,
|
||||
// children: [
|
||||
// /// 居中标题
|
||||
// Text(
|
||||
// '健康报告'.tr,
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// /// 左边返回按钮
|
||||
// if (widget.data['arrow'] == null ||
|
||||
// widget.data['arrow'] == true)
|
||||
// Positioned(
|
||||
// left: 0,
|
||||
// child: returnIconButtomNew,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
appBar: (widget.data['arrow'] != null &&
|
||||
widget.data['arrow'] == false)
|
||||
? null
|
||||
: AppBar(
|
||||
backgroundColor: widget.data['backgroundColor'] != null
|
||||
? widget.data['backgroundColor'].withOpacity(0.8)
|
||||
: themeController.currentColor.sc5,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
|
||||
iconTheme:
|
||||
IconThemeData(color: themeController.currentColor.sc3),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
@@ -213,6 +251,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: SingleChildScrollView(
|
||||
@@ -551,6 +590,8 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
child: getTimeWidget(),
|
||||
),
|
||||
),
|
||||
if (widget.data['person_show'] == null ||
|
||||
widget.data['person_show'] != false)
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 51.rpx),
|
||||
|
||||
@@ -27,6 +27,7 @@ import 'package:vbvs_app/pages/mh_page/device_people_info.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/device_share_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/edit_bed.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/help/article.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page_return.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/privacy_policy.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/page/edit_userinfo_page.dart';
|
||||
@@ -110,6 +111,8 @@ var mhroutes = {
|
||||
"/shareDeviceDetail": (context) => ShareDeviceDetailWidget(),
|
||||
"/messageDetail": (context, {arguments}) =>
|
||||
MessageDetailPage(data: arguments),
|
||||
"/mhtSleepReportReturnPage": (context, {arguments}) =>
|
||||
MhtSleepReportReturnPage(data: arguments),
|
||||
};
|
||||
var mhonGenerateRoute = (RouteSettings settings) {
|
||||
final String? name = settings.name; // 获取路由名称,如 /news 或 /search
|
||||
|
||||
Reference in New Issue
Block a user