Former-commit-id: adc4a2c22706184be6da8972f597256f56f9cd5f
Former-commit-id: cc5c6bdb4bb5a2f603b893c7d6427bf541a9f965
1.0
wanggang 4 years ago
parent 7f8e1eec5f
commit f7ee58e5bc

@ -5,7 +5,7 @@
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<GenerateAssemblyProductAttribute>true</GenerateAssemblyProductAttribute>
<Version>1.0.0.0-rc.4</Version>
<Version>1.0.0.0-rc.6</Version>
<UserSecretsId>13a75881-1072-47ca-88e9-4d78bd678d65</UserSecretsId>
</PropertyGroup>

@ -171,6 +171,7 @@ function InitControls() {
if ($(this).attr('data-allow-input') === 'True') {
$(this).select2({
tags: true,
maximumInputLength: 20,
theme: "bootstrap4",
language: "zh-CN",
placeholder: '请选择',

@ -316,14 +316,14 @@ $('#WorkingTime').change(function () {
try {
var now = new Date();
var values = $(this).val().split('-');
var year = values[0];
var month = values[1];
var day = values[2];
var year = parseInt(values[0]);
var month = parseInt(values[1]);
var day = parseInt(values[2]);
var years = now.getFullYear() - new Date(year, month, day).getFullYear();
$('#JobAgeYearDisplay').text(years);
var months = years * 12 + (now.getMonth()-month);
var months = years * 12 + (now.getMonth() + 1 - month);
$('#JobAgeMonthDisplay').text(months);
return;
} catch (e) {

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

@ -9,9 +9,9 @@ namespace IoTNode.DeviceServices.FBee
static DeviceId()
{
List.Add(new DeviceId { RawDeviceId = 0x0002, Name = "开关", CategoryName = "照明", CategoryNumber = "30", Icon = "switch" });
List.Add(new DeviceId { RawDeviceId = 0x0009, Name = "插座", CategoryName = "电器", CategoryNumber = "20", Icon = "socket" });
List.Add(new DeviceId { RawDeviceId = 0x0009, Name = "智能插座", CategoryName = "电器", CategoryNumber = "20", Icon = "socket" });
List.Add(new DeviceId { RawDeviceId = 0x000a, Name = "门锁", CategoryName = "安防", CategoryNumber = "10", Icon = "door" });
List.Add(new DeviceId { RawDeviceId = 0x0051, Name = "智能插座", CategoryName = "电器", CategoryNumber = "20", Icon = "socket" });
List.Add(new DeviceId { RawDeviceId = 0x0051, Name = "计量插座", CategoryName = "电器", CategoryNumber = "20", Icon = "plug" });
List.Add(new DeviceId { RawDeviceId = 0x0106, Name = "光强检测器", CategoryName = "监测", CategoryNumber = "40", Icon = "light" });
List.Add(new DeviceId { RawDeviceId = 0x0163, Name = "红外转发器", CategoryName = "电器", CategoryNumber = "20", Icon = "control" });
List.Add(new DeviceId { RawDeviceId = 0x0202, Name = "窗帘电机", CategoryName = "电器", CategoryNumber = "20", Icon = "curtain" });

@ -824,11 +824,11 @@ namespace IoTNode.DeviceServices.FBee
private string GetPathByDeviceName(string deviceName)
{
if (deviceName == "插座")
if (deviceName == "智能插座")
{
return "/Socket/";
}
else if (deviceName == "智能插座")
else if (deviceName == "计量插座")
{
return "/Socket/";
}

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1588125179839" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2796" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="1024"><defs><style type="text/css"></style></defs><path d="M961.995752 0.729345H59.68029C26.780212 0.729345 0 27.509557 0 60.409635v902.318777c0 32.911681 26.778555 59.68029 59.68029 59.68029h902.31712c32.908366 0 59.68029-26.765294 59.68029-59.68029V60.409635C1021.676042 27.509557 994.900803 0.729345 961.995752 0.729345z m1.728879 945.608702c-0.009946 10.005284-8.115618 18.112613-18.120901 18.125874H76.075628c-9.998653-0.013261-18.104325-8.117275-18.117586-18.125874V76.796685c0.013261-9.996996 8.117275-18.097695 18.117586-18.115929h869.529759c10.001968 0.004973 18.110956 8.118933 18.120902 18.115929l-0.001658 869.541362z m-607.139705-342.26159h40.094069v-152.726444h-40.094069v152.726444z m-165.967366 124.61352l101.21813 101.216472 28.348304-28.340015-101.2115-101.224761-28.354934 28.348304z m330.948459-258.244393c-1.117224 0-2.166485 0.038125-3.17928 0.102771v-19.191712h-40.092411v152.726444h40.092411V584.884745c1.012795 0.071277 2.065372 0.104429 3.17928 0.104429 31.636985 0 57.271795-25.639782 57.271795-57.271795s-25.64144-57.271795-57.271795-57.271795zM433.081585 801.558146l28.341673 28.346646 101.21813-101.216473-28.351619-28.351619-101.208184 101.221446zM231.687956 584.980886c1.135457 0 2.183061-0.033152 3.194199-0.097799v19.190055h40.080808V451.348355H234.882155v19.198343a43.525304 43.525304 0 0 0-3.187568-0.102772c-31.630355 0-57.270137 25.63481-57.270137 57.270138 0 31.63367 25.639782 57.266822 57.263506 57.266822z m493.769697 233.431753h101.799949V463.581456h-101.799949v354.831183z m15.266512-339.569645h71.276871l-1.650971 324.308107h-69.6259V478.842994z m16.499767 307.906138h36.881637V495.062626h-36.881637v291.686506zM486.834292 338.95799c-13.472986 13.472986-13.472986 34.536131 0 48.009117 13.472986 13.471329 34.537788 13.471329 48.005801 0 13.474644-13.472986 13.474644-34.536131 0-48.009117-14.323336-13.516084-35.384823-13.516084-48.005801 0z m-93.120746-54.843408l34.53613 39.610049c45.492877-52.231028 120.492722-52.231028 165.9856 0l34.53613-39.610049c-65.704015-74.144522-170.164413-74.144522-235.05786 0z m-59.817871-68.260037l35.389795 40.460399c78.366434-90.176845 204.743642-90.176845 283.110075 0l35.389796-40.460399c-96.918311-111.196892-256.167418-111.196892-353.889666 0z" fill="#07C160" p-id="2797"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -0,0 +1,264 @@
<template>
<div class="card camera" style="box-sizing:border-box;height:490px;margin:10px;">
<div class="card-header">
{{device.displayName}}
</div>
<div class="card-body" style="padding:0;">
<div class="row video-container" style="width:320px;height:240px;margin: 0 auto;background-color:#333;position:relative;">
<video controls muted autoplay :class="device.number" @volumechange="volumeChange($event)" style="width:100%;height:100%;object-fit:contain;"></video>
</div>
<div style="box-sizing: border-box;width: 320px;margin: 5px auto;" :class="'row ptz '+ device.number">
<table style="width: 100%; height:100px; text-align: center;">
<tr>
<td colspan="2" style="text-align:center;"><button class="btn btn-default px-2 btn-sm" @click="execApi(device.number,'/Onvif/StartPush')">启动推流</button></td>
<td></td>
<td colspan="2" style="text-align:center;"><button class="btn btn-default px-2 btn-sm" @click="execApi(device.number,'/Onvif/StopPush')">停止推流</button></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;"><button class="btn btn-default px-2 btn-sm" @click="execApi(device.number,'/Onvif/StartRecord')">开始录像</button></td>
<td></td>
<td colspan="2" style="text-align:center;"><button class="btn btn-default px-2 btn-sm" @click="execApi(device.number,'/Onvif/StopRecord')">停止录像</button></td>
</tr>
<template v-if="ptz">
<tr>
<td></td>
<td></td>
<td><img @click="execApi(device.number,'/Onvif/Up')" src="images/up.svg" style="width:32px;" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td><img @click="execApi(device.number,'/Onvif/Zoomin')" src="images/zoomin.svg" class="pointer" /></td>
<td><img @click="execApi(device.number,'/Onvif/Left')" src="images/left.svg" class="pointer" /></td>
<td><img @click="execApi(device.number,'/Onvif/Stop')" src="images/stop.svg" class="pointer" /></td>
<td><img @click="execApi(device.number,'/Onvif/Right')" src="images/right.svg" class="pointer" /></td>
<td><img @click="execApi(device.number,'/Onvif/Zoomout')" src="images/zoomout.svg" class="pointer" /></td>
</tr>
<tr>
<td></td>
<td></td>
<td><img @click="execApi(device.number,'/Onvif/Down')" src="images/down.svg" style="width:32px;" /></td>
<td></td>
<td></td>
</tr>
</template>
</table>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['device', 'edit'],
data() {
return {
muted: true,
volume: 0.5,
timer: null,
flvPlayer: null,
decodedFrames: null,
wxInlinePlayer: null,
playing: false
};
},
mounted: function () {
if (this.isFlvSupported) {
this.playByFlvJs();
}
else {
this.playHls();
}
},
destroyed: function () {
this.stopFlvPlayer();
this.stopWxInlinePlayer();
},
methods: {
play: function () {
if (this.playing) {
this.wxInlinePlayer.stop();
}
else {
this.wxInlinePlayer.play();
}
},
playHls: function () {
$('video.' + this.device.number).attr('src', this.url);
},
playByFlvJs: function () {
var videoElement = $('video.' + this.device.number)[0];
var push = Enumerable.from(this.device.data).where(o => o.name === '推流').firstOrDefault();
if (push && push.value === '是') {
try {
this.stopFlvPlayer();
this.flvPlayer = flvjs.createPlayer({
type: 'flv',
url: this.url,
isLive: true,
cors: true
}, {
enableWorker: true,
enableStashBuffer: false,
stashInitialSize: 1,
fixAudioTimestampGap: false
});
this.flvPlayer.attachMediaElement(videoElement);
this.flvPlayer.load();
this.flvPlayer.volume = this.volume;
this.flvPlayer.muted = this.muted;
var vm = this;
this.timer = setInterval(function () {
console.log('.');
if (vm.flvPlayer.statisticsInfo.speed === 0) {
console.log('reload1');
clearInterval(vm.timer);
vm.playByFlvJs();
}
else if (vm.decodedFrames && vm.flvPlayer.statisticsInfo.decodedFrames <= vm.decodedFrames) {
console.log('reload2');
clearInterval(vm.timer);
vm.playByFlvJs();
}
else if (vm.flvPlayer.buffered.length > 0 && vm.flvPlayer.buffered.end(0) - vm.flvPlayer.currentTime > 2) {
console.log('reset currentTime');
vm.flvPlayer.currentTime = vm.flvPlayer.buffered.end(0) - 0.001;
}
vm.decodedFrames = vm.flvPlayer.statisticsInfo.decodedFrames;
}, 30 * 1000);
} catch (e) {
console.log('error:');
console.log(e);
}
}
},
stopFlvPlayer: function () {
if (this.timer) {
clearInterval(this.timer);
}
if (this.flvPlayer) {
try {
this.flvPlayer.pause();
} catch (e) {
console.error(e);
}
this.flvPlayer.unload();
this.flvPlayer.detachMediaElement();
try {
this.flvPlayer.destroy();
} catch (e) {
console.error(e);
}
this.flvPlayer = null;
}
},
volumeChange: function (e) {
this.muted = e.target.muted;
this.volume = e.target.volume;
},
playByWXInlinePlayer: function () {
var videoElement = $('canvas.' + this.device.number)[0];
var vm = this;
WXInlinePlayer.ready().then(function () {
vm.wxInlinePlayer = new WXInlinePlayer({
url: vm.url,
$container: videoElement,
hasVideo: true,
hasAudio: true,
volume: 0.5,
muted: true,
autoplay: true,
loop: false,
isLive: true,
chunkSize: 128 * 1024,
preloadTime: 5e2,
bufferingTime: 1e3,
cacheSegmentCount: 64,
customLoader: null
});
vm.wxInlinePlayer.on('loadError', e => {
console.log('>>>>> load error happend: ', e);
});
vm.wxInlinePlayer.on('loadSuccess', () => {
console.log('>>>>> load success');
});
vm.wxInlinePlayer.on('playing', () => {
vm.playing = true;
});
vm.wxInlinePlayer.on('stopped', () => {
vm.playing = false;
});
vm.wxInlinePlayer.on('mediaInfo', mediaInfo => {
const { onMetaData } = mediaInfo;
videoElement.height = onMetaData.height || 720;
videoElement.width = onMetaData.width || 1080;
for (let i = 0; i < onMetaData.length; i++) {
if ('height' in onMetaData[i]) {
videoElement.height = onMetaData[i].height;
} else if ('width' in onMetaData[i]) {
videoElement.width = onMetaData[i].width;
}
}
});
});
},
stopWxInlinePlayer: function () {
if (this.wxInlinePlayer) {
this.wxInlinePlayer.stop();
this.wxInlinePlayer.destroy();
this.wxInlinePlayer = null;
}
},
showControls: function (e) {
$('.control.' + this.device.number).toggle();
},
mute: function () {
this.muted = !this.muted;
this.wxInlinePlayer.mute(this.muted);
},
volumeChange2: function (e) {
this.volume = e.target.value;
this.wxInlinePlayer.volume(e.target.value);
},
fullScreen: function () {
var videoElement = $('canvas.' + this.device.number)[0];
var container = $(videoElement).parents('.video-container')[0];
if (document.fullscreen || document.webkitFullscreenElement) {
if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
else {
document.exitFullscreen();
}
}
else {
if (container.webkitRequestFullScreen) {
container.webkitRequestFullScreen();
}
else {
container.requestFullscreen();
}
}
}
},
computed: {
url: function () {
if (this.isFlvSupported) {
return location.protocol + '//' + location.hostname + '/live/' + this.device.number + '.flv';
}
else {
return location.protocol + '//' + location.hostname + '/live/' + this.device.number + '.m3u8';
}
//return getDeviceDataValue(this.device, 'flv');
},
isFlvSupported: function () {
return flvjs.isSupported() && window.navigator.userAgent.indexOf('iPhone') === -1;//AppleWebKit
},
ptz: function () {
if (this.getDeviceDataValue(this.device, '云台地址')) {
return true;
}
return false;
}
}
};</script>

@ -0,0 +1,59 @@
<template>
<div class="card device-component">
<div class="card-header">
<h3 class="card-title">
{{device.displayName}}
<i v-if="device.isOnline" class="text-success ion ion-ios-wifi"></i>
<i v-else class="text-danger ion ion-ios-wifi"></i>
</h3>
<div class="card-tools">
<span @click="visible = true" title="操作"><i class="ion ion-md-settings"></i></span>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-4 align-self-center">
<img class="device-image" :src="device.ioTProduct.image" style="width:48px;" />
</div>
<div class="col-8 align-self-center">
<div class="row">
<span>
状态:{{status}}
</span>
</div>
<div class="row">
<span>电功:{{electricity}} kW‧h</span>
</div>
<div class="row">
<span>功率:{{power}} W</span>
</div>
</div>
</div>
</div>
<a-modal v-model="visible" :title="device.displayName" :footer="null">
<img style="height:32px;" v-if="status==='开'" v-on:click="execApi(device.number,'/Socket/Off')" src="/platform/images/on.svg" />
<img style="height:32px;" v-else v-on:click="execApi(device.number,'/Socket/On')" src="/platform/images/off.svg" />
</a-modal>
</div>
</template>
<script>
({
props: ['device'],
data: function () {
return {
visible: false
}
},
computed: {
status: function () {
return getIoTDataValue(this.device, '状态') === '1' ? '开' : '关';
},
electricity: function () {
return parseFloat(getIoTDataValue(this.device, '电量') || 0).toFixed(2);
},
power: function () {
return parseFloat(getIoTDataValue(this.device, '功率') || 0).toFixed(2);
}
}
});
</script>

@ -16,29 +16,11 @@
<img class="device-image" :src="device.ioTProduct.image" style="width:48px;" />
</div>
<div class="col-8 align-self-center">
<template v-if="isSmart">
<div class="row">
<span>
状态:{{status}}
</span>
</div>
<div class="row">
<span>电功:{{electricity}} kW‧h</span>
</div>
<div class="row">
<span>功率:{{power}} W</span>
</div>
</template>
<template v-else>
<div class="row">
<span> </span>
</div>
<div class="row">
<span>
状态:{{status}}
</span>
</div>
</template>
<div class="row">
<span>
状态:{{status}}
</span>
</div>
</div>
</div>
</div>
@ -59,15 +41,6 @@
computed: {
status: function () {
return getIoTDataValue(this.device, '状态') === '1' ? '开' : '关';
},
isSmart: function () {
return Enumerable.from(this.device.data).any(function (o) { return o.name === "电量"; });
},
electricity: function () {
return parseFloat(getIoTDataValue(this.device, '电量') || 0).toFixed(2);
},
power: function () {
return parseFloat(getIoTDataValue(this.device, '功率') || 0).toFixed(2);
}
}
});

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1588125179839" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2796" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="1024"><defs><style type="text/css"></style></defs><path d="M961.995752 0.729345H59.68029C26.780212 0.729345 0 27.509557 0 60.409635v902.318777c0 32.911681 26.778555 59.68029 59.68029 59.68029h902.31712c32.908366 0 59.68029-26.765294 59.68029-59.68029V60.409635C1021.676042 27.509557 994.900803 0.729345 961.995752 0.729345z m1.728879 945.608702c-0.009946 10.005284-8.115618 18.112613-18.120901 18.125874H76.075628c-9.998653-0.013261-18.104325-8.117275-18.117586-18.125874V76.796685c0.013261-9.996996 8.117275-18.097695 18.117586-18.115929h869.529759c10.001968 0.004973 18.110956 8.118933 18.120902 18.115929l-0.001658 869.541362z m-607.139705-342.26159h40.094069v-152.726444h-40.094069v152.726444z m-165.967366 124.61352l101.21813 101.216472 28.348304-28.340015-101.2115-101.224761-28.354934 28.348304z m330.948459-258.244393c-1.117224 0-2.166485 0.038125-3.17928 0.102771v-19.191712h-40.092411v152.726444h40.092411V584.884745c1.012795 0.071277 2.065372 0.104429 3.17928 0.104429 31.636985 0 57.271795-25.639782 57.271795-57.271795s-25.64144-57.271795-57.271795-57.271795zM433.081585 801.558146l28.341673 28.346646 101.21813-101.216473-28.351619-28.351619-101.208184 101.221446zM231.687956 584.980886c1.135457 0 2.183061-0.033152 3.194199-0.097799v19.190055h40.080808V451.348355H234.882155v19.198343a43.525304 43.525304 0 0 0-3.187568-0.102772c-31.630355 0-57.270137 25.63481-57.270137 57.270138 0 31.63367 25.639782 57.266822 57.263506 57.266822z m493.769697 233.431753h101.799949V463.581456h-101.799949v354.831183z m15.266512-339.569645h71.276871l-1.650971 324.308107h-69.6259V478.842994z m16.499767 307.906138h36.881637V495.062626h-36.881637v291.686506zM486.834292 338.95799c-13.472986 13.472986-13.472986 34.536131 0 48.009117 13.472986 13.471329 34.537788 13.471329 48.005801 0 13.474644-13.472986 13.474644-34.536131 0-48.009117-14.323336-13.516084-35.384823-13.516084-48.005801 0z m-93.120746-54.843408l34.53613 39.610049c45.492877-52.231028 120.492722-52.231028 165.9856 0l34.53613-39.610049c-65.704015-74.144522-170.164413-74.144522-235.05786 0z m-59.817871-68.260037l35.389795 40.460399c78.366434-90.176845 204.743642-90.176845 283.110075 0l35.389796-40.460399c-96.918311-111.196892-256.167418-111.196892-353.889666 0z" fill="#07C160" p-id="2797"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -26,8 +26,10 @@ addVueComponents({
'smoke',
'switch1',
'socket',
'plug',
'curtain',
'door',
'camera',
]
});

Loading…
Cancel
Save