diff --git a/projects/IoT.Shared/Application/Models/EditNodeModel.cs b/projects/IoT.Shared/Application/Models/EditNodeModel.cs index 33ae23f6..e63fbcf3 100644 --- a/projects/IoT.Shared/Application/Models/EditNodeModel.cs +++ b/projects/IoT.Shared/Application/Models/EditNodeModel.cs @@ -35,6 +35,9 @@ namespace Application.Models [Display(Name = "模板")] public string Template { get; set; } + [Display(Name = "移动模板")] + public string MobileTemplate { get; set; } + [Display(Name = "序号")] public int DisplayOrder { get; set; } diff --git a/projects/IoTCenter/Views/Home/Node.cshtml b/projects/IoTCenter/Views/Home/Node.cshtml index 59a108de..cf07fa03 100644 --- a/projects/IoTCenter/Views/Home/Node.cshtml +++ b/projects/IoTCenter/Views/Home/Node.cshtml @@ -3,6 +3,17 @@ ViewData["IsHomePage"] = true; }
diff --git a/projects/IoTCenter/iotcenter.db b/projects/IoTCenter/iotcenter.db index 6db246fd..92245dd4 100644 Binary files a/projects/IoTCenter/iotcenter.db and b/projects/IoTCenter/iotcenter.db differ diff --git a/projects/IoTCenter/wwwroot/node.mobile.html b/projects/IoTCenter/wwwroot/node.mobile.html index 0620a8a1..2e0b21b2 100644 --- a/projects/IoTCenter/wwwroot/node.mobile.html +++ b/projects/IoTCenter/wwwroot/node.mobile.html @@ -1 +1 @@ -//复制移动端node.html的template节点内容到此,作为修改的基础 \ No newline at end of file + \ No newline at end of file diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js b/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js index 1c186035..fd934023 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/js/node.js @@ -57,11 +57,6 @@ function loadTemplate() { axios.post(url, { crossDomain: true }) .then(function (response) { var html = response.data; - $(html).each(function (i, n) { - if (n.tagName === 'STYLE') { - $('head').append(n); - } - }); $('#template').html(html); init(); }) @@ -220,29 +215,16 @@ function updateItem(list, item) { $(document).on('change', '#camera', function (e) { UpdateCamera() }); -$('body').on('mousedown touchstart', 'img.camera.ajax', function (e) { +$(document).on('mousedown touchstart', 'img.camera.ajax', function (e) { var number = $('#camera').val(); - if ($(this).hasClass('Zoomin')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Zoomin' }, 'post'); - } else if ($(this).hasClass('Zoomout')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Zoomout' }, 'post'); - } else if ($(this).hasClass('Left')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Left' }, 'post'); - } else if ($(this).hasClass('Right')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Right' }, 'post'); - } else if ($(this).hasClass('Up')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Up' }, 'post'); - } else if ($(this).hasClass('Down')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Down' }, 'post'); - } else if ($(this).hasClass('Stop')) { - ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/Stop' }, 'post'); - } + var cmd = $(this).attr('data-cmd'); + ajax('/App/ExecApi', { connectionId: connectionId, number: number, method: '/Onvif/'+cmd }, 'post'); return false; }); -$('body').on('mouseup touchend', 'img.ajax', function (e) { - console.log($(this).html()); - if (!$(this).hasClass('Stop')) { - var number = $('#camera').val(); +$(document).on('mouseup touchend', 'img.camera.ajax', function (e) { + var number = $('#camera').val(); + var cmd = $(this).attr('data-cmd'); + if (cmd!=='Stop') { setTimeout(function () { ajax('/App/ExecApi', { number: number, method: '/Onvif/Stop' }, 'post'); }, 500); @@ -287,6 +269,9 @@ function onMessage(method, json, from) { } /*vue*/ function init() { + $('#template style').each(function (i, n) { + $('head').append(n); + }); vm = new Vue({ el: '#app', data() { diff --git a/projects/IoTNode/iotnode.db b/projects/IoTNode/iotnode.db index 6501d9c1..74a26d5d 100644 Binary files a/projects/IoTNode/iotnode.db and b/projects/IoTNode/iotnode.db differ |