diff --git a/projects/IoTClient/Assets/StreamingAssets/IoT.Resources.csproj b/projects/IoTClient/Assets/StreamingAssets/IoT.Resources.csproj index 1692dab5..cd818903 100644 --- a/projects/IoTClient/Assets/StreamingAssets/IoT.Resources.csproj +++ b/projects/IoTClient/Assets/StreamingAssets/IoT.Resources.csproj @@ -11,5 +11,7 @@ + + \ No newline at end of file diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/images/temperature.png b/projects/IoTClient/Assets/StreamingAssets/wwwroot/images/temperature.png new file mode 100644 index 00000000..775fd69d Binary files /dev/null and b/projects/IoTClient/Assets/StreamingAssets/wwwroot/images/temperature.png differ diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/index2.html b/projects/IoTClient/Assets/StreamingAssets/wwwroot/index2.html index c08ab415..d8418f59 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/index2.html +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/index2.html @@ -26,6 +26,7 @@ + @@ -88,6 +89,7 @@ + @@ -99,6 +101,7 @@ + @@ -133,6 +136,7 @@ + @@ -140,6 +144,7 @@ + @@ -150,10 +155,11 @@ + - + @@ -750,142 +756,12 @@ + - + - 属性 - - - - - - info - - {{data.Name}} - - - {{data.Value}} - - - - {{data.Unit}} - - - - {{data.Description}} - - - - - - - - - - - - - - - - 操作 - - - - - 预览 - 预览 - - - - - - - - - - - - - {{parameter.Description}} - - - - 请选择 - {{option.text}} - - - - - - - - - - - - - - - - - - - - - - {{api.Name}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1300,6 +1176,92 @@ } }); + Vue.component('page-device', { + template: '#page-device', + data() { + return { + Device: { + Number: null, + Name: null, + Data: [], + Apis: [] + } + } + }, + mounted() { + var number = this.$f7route.params.number; + vm.Device = _.first(_.filter(vm.Node.Devices, function (o) { return o.Number == number; })); + }, + methods: { + isSelect: function (device, key) { + return _.filter(device.Data, function (o) { return o.Key == key + '[]' }).length > 0; + }, + getSelect: function (device, key) { + var data = _.first(_.filter(device.Data, function (o) { return o.Key == key + '[]' })).Value; + var result = JSON.parse(data); + return result; + }, + getParameter: function (name) { + console.log(name); + var prop = _.chain(this.Device.Data).filter(function (o) { return o.Key == name; }).first().value(); + return prop ? prop.Value : ''; + }, + call: function (e) { + if (!$(e.target).valid()) { + return; + } + var url = vm.IoTServer + '/App/Exec/?connectionId=' + vm.ConnectionId + '&node=' + this.getNodeNumber(this.Device.NodeId) + '&' + $(e.target).serialize(); + ajax(url); + }, + getNodeNumber(nodeId) { + return _.chain(vm.Nodes).filter(function (o) { + return o.Id === nodeId; + }).first().value().Number; + }, + showData(name) { + if (name === 'hidden' || name.indexOf('rtsp') != -1 || name.indexOf('rtmp') != -1 || name.indexOf('flv') != -1 || name.indexOf('hls') != -1) { + return false; + } + return true; + }, + showApi(api) { + if (this.Device.Name === '摄像头') { + if (this.getParameter('Ptz3DZoomSupport') === '否') { + if (api.Name !== '截屏') { + return false; + } + } + } + return true; + }, + getUrl(type) { + var url = _.chain(this.Device.Data).filter(function (o) { return o.Name === (type + '2'); }).first().value().Value; + url += '?id=' + this.Device.Id; + url += '&host=' + encodeURIComponent(vm.IoTServer); + url += '&node=' + _.chain(vm.Nodes).filter(function (o) { return o.Id === device.Device.NodeId; }).first().value().Number; + if (this.getParameter('Ptz3DZoomSupport') !== '否') { + url += '&ptz=true'; + } + return url; + }, + flv() { + this.$f7router.navigate('/camera/', { + props: { + name: this.Device.DisplayName || this.Device.Name, + url: this.getParameter('flv2'), + ptz: this.getParameter('Ptz3DZoomSupport') !== '否', + node: this.getNodeNumber(this.Device.NodeId), + id: this.Device.Id, + hls: this.getParameter('hls2') + } + }); + } + }, + destroyed() { + device = null; + }, + }); + Vue.component('page-not-found', { template: '#page-not-found' }); @@ -1326,6 +1288,10 @@ path: '/node/:number/name/:name', component: 'page-node' }, + { + path: '/device/:number/name/:name', + component: 'page-device' + }, { path: '(.*)', component: 'page-not-found',