From af669f195d0f9c38f1c26f9c3179f7db860f09ae Mon Sep 17 00:00:00 2001
From: wanggang <76527413@qq.com>
Date: Fri, 22 Nov 2019 10:11:53 +0800
Subject: [PATCH] update
Former-commit-id: c45e874c2ee4c1070436459522775ba38eaa18e5
---
.../Application/Models/ButtonModel.cs | 9 ++++
projects/IoTCenter/Views/Home/Device.cshtml | 20 ++++---
projects/IoTCenter/Views/Home/Node.cshtml | 54 +++++++------------
.../StreamingAssets/wwwroot/js/device.js | 13 ++---
.../Assets/StreamingAssets/wwwroot/js/node.js | 5 ++
.../Assets/StreamingAssets/wwwroot/node.html | 10 ++++
.../DeviceServices/FBee/FBeeService.cs | 4 +-
7 files changed, 63 insertions(+), 52 deletions(-)
create mode 100644 projects/IoT.Shared/Application/Models/ButtonModel.cs
diff --git a/projects/IoT.Shared/Application/Models/ButtonModel.cs b/projects/IoT.Shared/Application/Models/ButtonModel.cs
new file mode 100644
index 00000000..15fb209a
--- /dev/null
+++ b/projects/IoT.Shared/Application/Models/ButtonModel.cs
@@ -0,0 +1,9 @@
+namespace Application.Models
+{
+ public class ButtonModel
+ {
+ public string Name { get; set; }
+ public string Value { get; set; }
+ public int Order { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/projects/IoTCenter/Views/Home/Device.cshtml b/projects/IoTCenter/Views/Home/Device.cshtml
index 5487b8a4..86baef8b 100644
--- a/projects/IoTCenter/Views/Home/Device.cshtml
+++ b/projects/IoTCenter/Views/Home/Device.cshtml
@@ -343,10 +343,10 @@
-
+
温度:{{getCode1(GetDataValue('按键')).temperature+15}}℃
-
@@ -451,7 +451,7 @@
@@ -473,15 +473,19 @@
-
-
-
-
-
-
diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/device.js b/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/device.js
index 61b4191a..e1ab4f35 100644
--- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/device.js
+++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/device.js
@@ -72,7 +72,7 @@ methods = {
},
GetButtons() {
return Enumerable.from(JSON.parse(this.GetDataValue("指令")))
- //.orderBy(function (o) { return o.Value; })
+ .orderBy(function (o) { return o.Order; })
.toArray();
},
Study(code) {
@@ -83,17 +83,17 @@ methods = {
.where(function (o) { return o.Name === "指令" })
.firstOrDefault();
var buttons = this.GetButtons();
- var newBtn = { Key:"测试", Value:603};
+ var newBtn = { Name:"测试", Value:"603",Order:1};
buttons.push(newBtn);
data.Value = JSON.stringify(buttons);
},
- RemoveButton(key) {
+ RemoveButton(name) {
var data = Enumerable.from(this.model.Data)
.where(function (o) { return o.Name === "指令" })
.firstOrDefault();
var buttons = this.GetButtons();
for (var i = buttons.length - 1; i >= 0; i--) {
- if (buttons[i].Key == key) {
+ if (buttons[i].Name == name) {
buttons.splice(i, 1);
break;
}
@@ -104,8 +104,9 @@ methods = {
var buttons = [];
$('#irbuttons').find('.irbtn').each(function () {
buttons.push({
- Key: $(this).find("input[name='key']").val(),
- Value: $(this).find("input[name='value']").val()
+ Name: $(this).find("input[name='name']").val(),
+ Value: $(this).find("input[name='value']").val(),
+ Order: $(this).find("input[name='order']").val()
});
});
var value = JSON.stringify(buttons);
diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js b/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js
index 00c31628..d17f2598 100644
--- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js
+++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js
@@ -69,6 +69,11 @@ methods = {
ajax(url, null, 'get');
});
},
+ GetButtons(deviceNumber) {
+ return Enumerable.from(JSON.parse(this.GetDataValue(deviceNumber,"指令")))
+ .orderBy(function (o) { return o.Order; })
+ .toArray();
+ },
SendCode1(event) {
console.log(event.target + ',' + event.type + ',' + event.target.checked);
var form = $(event.target).parents('form');
diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html b/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html
index 109e4d19..d87c3068 100644
--- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html
+++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html
@@ -485,6 +485,16 @@