多语言
This commit is contained in:
@@ -68,13 +68,13 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
await queryPersonInfoByMac();
|
||||
if (selectDevice != null &&
|
||||
selectDevice.isNotEmpty &&
|
||||
selectDevice['mac'] != null &&
|
||||
(selectDevice['mac'] != args[0]['mac'])) {
|
||||
selectDevice['mac'.tr] != null &&
|
||||
(selectDevice['mac'.tr] != args[0]['mac'.tr])) {
|
||||
lastSelectDevice = selectDevice;
|
||||
}
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(
|
||||
WebSocketMessage(path: "/smartbed/connect", type: 5, data: {
|
||||
'mac': selectDevice['mac'],
|
||||
'mac'.tr: selectDevice['mac'.tr],
|
||||
})));
|
||||
dealInstantData(selectDevice);
|
||||
} catch (e) {
|
||||
@@ -201,7 +201,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
"${serviceAddress}${serviceName}${serviceApi}?mac=${selectDevice['mac']}";
|
||||
try {
|
||||
final res = await requestWithLog(
|
||||
logTitle: "查询设备绑定人员列表",
|
||||
logTitle: "查询设备绑定人员列表".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -229,14 +229,14 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
} else if (data is Map<String, dynamic>) {
|
||||
tmp = data; // 直接用
|
||||
} else {
|
||||
print("未知数据格式");
|
||||
print("未知数据格式".tr);
|
||||
}
|
||||
if (tmp['data'] != null && tmp['data'] is Map) {
|
||||
var newData = tmp['data'];
|
||||
var mac = newData['mac'];
|
||||
var mac = newData['mac'.tr];
|
||||
if (mac != null) {
|
||||
// 删除已有的同 mac 项
|
||||
instantData.removeWhere((element) => element['mac'] == mac);
|
||||
instantData.removeWhere((element) => element['mac'.tr] == mac);
|
||||
// 添加新的数据
|
||||
instantData.add(newData);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
bool success = ws.send({
|
||||
"type": 2,
|
||||
"path": "/vsbs/web/rt/marttress",
|
||||
"data": {"mac": mac},
|
||||
"data": {"mac".tr: mac},
|
||||
});
|
||||
if (success) {
|
||||
ef.log("✅ 已取消监听:$mac");
|
||||
@@ -282,7 +282,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
bool success = ws.send({
|
||||
"type": 1,
|
||||
"path": "/vsbs/web/rt/marttress",
|
||||
"data": {"mac": mac},
|
||||
"data": {"mac".tr: mac},
|
||||
});
|
||||
if (success) {
|
||||
ef.log("✅ 开始监听新设备:$mac");
|
||||
@@ -329,10 +329,12 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
@override
|
||||
WebviewTestController newinstance() {
|
||||
if (ef.kvRoot.WebviewTestController == null) {
|
||||
|
||||
ef.kvRoot.WebviewTestController = WebviewTestController();
|
||||
if (Get.isRegistered<WebviewTestController>() == false) {
|
||||
Get.put<WebviewTestController>(ef.kvRoot.WebviewTestController);
|
||||
WebviewTestController webviewTestController = Get.find();
|
||||
webviewTestController.global=true;
|
||||
return webviewTestController;
|
||||
}
|
||||
}
|
||||
@@ -346,8 +348,8 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
deviceController.getDeviceList().then((x) {
|
||||
if (controller.web.jsbridge!.inited) {
|
||||
//发送测试消息给webview
|
||||
controller.web.jsbridge!.dart
|
||||
.updateDeviceList(deviceController.deviceList.values);
|
||||
// controller.web.jsbridge!.dart
|
||||
// .updateDeviceList(deviceController.deviceList.values);
|
||||
}
|
||||
});
|
||||
return Scaffold(
|
||||
@@ -371,7 +373,7 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "请先",
|
||||
text: "请先".tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 30.rpx,
|
||||
@@ -381,7 +383,7 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
child: Stack(
|
||||
children: [
|
||||
Text(
|
||||
"登录",
|
||||
"登录".tr,
|
||||
style: TextStyle(
|
||||
color: stringToColor("#84F5FF"),
|
||||
fontSize: 30.rpx,
|
||||
@@ -400,7 +402,7 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "后,再进行设备控制",
|
||||
text: "后,再进行设备控制".tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 30.rpx,
|
||||
|
||||
Reference in New Issue
Block a user