更新未登录时候头像报错
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
[
|
[
|
||||||
"assets/miniapp/mhtControl_1.0.40.zip"
|
"assets/miniapp/mhtControl_1.0.44.zip"
|
||||||
]
|
]
|
||||||
Binary file not shown.
@@ -117,6 +117,7 @@ class _MinePageState extends State<NewMinePage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
|
userInfoController.model.login!;
|
||||||
return Container(
|
return Container(
|
||||||
width: 120.rpx,
|
width: 120.rpx,
|
||||||
height: 120.rpx,
|
height: 120.rpx,
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
List personList = [];
|
List personList = [];
|
||||||
List instantData = [];
|
List instantData = [];
|
||||||
RxBool initFlag = false.obs;
|
RxBool initFlag = false.obs;
|
||||||
|
Timer? _resourceLoadTimer;
|
||||||
|
Widget webviewWidget = Container();
|
||||||
|
|
||||||
WebviewTestController() : super(WebviewTestModel()) {
|
WebviewTestController() : super(WebviewTestModel()) {
|
||||||
web = WebviewHelper(
|
web = WebviewHelper(
|
||||||
@@ -44,10 +46,14 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
settings: buildsettings(),
|
settings: buildsettings(),
|
||||||
params: PlatformHeadlessInAppWebViewCreationParams(
|
params: PlatformHeadlessInAppWebViewCreationParams(
|
||||||
onLoadStop: (controller, url) {
|
onLoadStop: (controller, url) {
|
||||||
setState(() => ready.value = true);
|
setState(() {
|
||||||
// MHTHomeController deviceController = Get.find();
|
ready.value = true;
|
||||||
// web.jsbridge!.dart
|
});
|
||||||
// .updateDeviceList(deviceController.deviceList.values);
|
},
|
||||||
|
onLoadResource: (controller, resource) {
|
||||||
|
sourceTime = web.requestTimestamp;
|
||||||
|
ef.log("[请求资源时间]${web.requestTimestamp}");
|
||||||
|
_startMonitoringIfNeeded();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -236,6 +242,8 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
late WebviewHelper web;
|
late WebviewHelper web;
|
||||||
var ready = false.obs;
|
var ready = false.obs;
|
||||||
var cnt = 0.obs;
|
var cnt = 0.obs;
|
||||||
|
var loadRecource = false.obs;
|
||||||
|
int sourceTime = 0;
|
||||||
|
|
||||||
Future<void> queryPersonInfoByMac() async {
|
Future<void> queryPersonInfoByMac() async {
|
||||||
UserInfoController userInfoController = Get.find();
|
UserInfoController userInfoController = Get.find();
|
||||||
@@ -352,7 +360,6 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
ef.log("webview test init =>${DateTime.now()}");
|
ef.log("webview test init =>${DateTime.now()}");
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
web.runApp('mhtControl').then((x) {
|
web.runApp('mhtControl').then((x) {
|
||||||
ready.value = true;
|
ready.value = true;
|
||||||
@@ -366,6 +373,25 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
ef.log('$e,$s');
|
ef.log('$e,$s');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _startMonitoringIfNeeded() {
|
||||||
|
// 如果定时器已启动,则无需重新启动
|
||||||
|
if (_resourceLoadTimer != null) return;
|
||||||
|
|
||||||
|
_resourceLoadTimer = Timer.periodic(Duration(seconds: 1), (timer) {
|
||||||
|
int now = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
|
||||||
|
if (sourceTime == 0) return; // 还未加载任何资源
|
||||||
|
|
||||||
|
if (now - sourceTime > 3000) {
|
||||||
|
ef.log("[资源加载完成] 当前时间: $now, 上次请求时间: $sourceTime");
|
||||||
|
_resourceLoadTimer?.cancel();
|
||||||
|
_resourceLoadTimer = null;
|
||||||
|
loadRecource.value = true;
|
||||||
|
updateAll();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WebviewTestView extends GetComponent<WebviewTestController> {
|
class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||||
@@ -385,102 +411,9 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
|||||||
return ef.kvRoot.WebviewTestController;
|
return ef.kvRoot.WebviewTestController;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// UserInfoController userInfoController = Get.find();
|
|
||||||
// MHTHomeController deviceController = Get.find();
|
|
||||||
// deviceController.getDeviceList().then((x) {
|
|
||||||
// if (controller.web.jsbridge!.inited) {
|
|
||||||
// //发送测试消息给webview
|
|
||||||
// // controller.web.jsbridge!.dart
|
|
||||||
// // .updateDeviceList(deviceController.deviceList.values);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// return Scaffold(
|
|
||||||
// backgroundColor: Colors.transparent,
|
|
||||||
// body: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// mainAxisSize: MainAxisSize.max,
|
|
||||||
// mainAxisAlignment: (userInfoController.model.login! != null &&
|
|
||||||
// userInfoController.model.login! == 1)
|
|
||||||
// ? MainAxisAlignment.start
|
|
||||||
// : MainAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Obx(() {
|
|
||||||
// return Visibility(
|
|
||||||
// visible: userInfoController.model.login! == null ||
|
|
||||||
// userInfoController.model.login! == 0,
|
|
||||||
// child: Center(
|
|
||||||
// child: InkWell(
|
|
||||||
// onTap: () => Get.toNamed("/loginPage"),
|
|
||||||
// child: RichText(
|
|
||||||
// text: TextSpan(
|
|
||||||
// children: [
|
|
||||||
// TextSpan(
|
|
||||||
// text: "请先".tr,
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white,
|
|
||||||
// fontSize: 30.rpx,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// WidgetSpan(
|
|
||||||
// child: Stack(
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// "登录".tr,
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: stringToColor("#84F5FF"),
|
|
||||||
// fontSize: 30.rpx,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Positioned(
|
|
||||||
// bottom: 0, // 控制下划线与文字的间距
|
|
||||||
// left: 0,
|
|
||||||
// right: 0,
|
|
||||||
// child: Container(
|
|
||||||
// height: 1, // 下划线粗细
|
|
||||||
// color: stringToColor("#84F5FF"),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// TextSpan(
|
|
||||||
// text: "后,再进行设备控制".tr,
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white,
|
|
||||||
// fontSize: 30.rpx,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
// Obx(() {
|
|
||||||
// return Visibility(
|
|
||||||
// visible: userInfoController.model.login! != null &&
|
|
||||||
// userInfoController.model.login! == 1,
|
|
||||||
// child: Expanded(
|
|
||||||
// child: Align(
|
|
||||||
// alignment: Alignment.topLeft,
|
|
||||||
// child: Obx(() {
|
|
||||||
// return controller.ready.value
|
|
||||||
// ? controller.web.build()
|
|
||||||
// : Container();
|
|
||||||
// }),
|
|
||||||
// ),
|
|
||||||
// ));
|
|
||||||
// }),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// controller.webviewWidget = controller.web.build();
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
UserInfoController userInfoController = Get.find();
|
UserInfoController userInfoController = Get.find();
|
||||||
MHTHomeController deviceController = Get.find();
|
MHTHomeController deviceController = Get.find();
|
||||||
@@ -578,7 +511,7 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: stringToColor("#84F5FF"),
|
color: stringToColor("#84F5FF"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -604,9 +537,9 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
|||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
return controller.ready.value
|
return (controller.ready.value)
|
||||||
? controller.web.build()
|
?controller.web.build()
|
||||||
: Container();
|
: Center(child: CircularProgressIndicator());
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ dependency_overrides:
|
|||||||
geolocator: 13.0.3
|
geolocator: 13.0.3
|
||||||
geolocator_android: 4.4.1
|
geolocator_android: 4.4.1
|
||||||
geocoding: 4.0.0
|
geocoding: 4.0.0
|
||||||
|
fluwx: 5.5.2
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
Reference in New Issue
Block a user