更新DEMO,添加libvlc库

TangShanKaiPing
wanggang 6 years ago
parent e06240f385
commit 3e1ad373bc

@ -49,7 +49,10 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.293080" /> <PackageReference Include="VideoLAN.LibVLC.Android">
<Version>3.1.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" /> <PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" /> <PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.1" /> <PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.1" />

@ -6125,6 +6125,9 @@ namespace Demo.Droid
// aapt resource value: 0x7f080026 // aapt resource value: 0x7f080026
public const int abc_toolbar_collapse_description = 2131230758; public const int abc_toolbar_collapse_description = 2131230758;
// aapt resource value: 0x7f08003d
public const int app_name = 2131230781;
// aapt resource value: 0x7f080034 // aapt resource value: 0x7f080034
public const int appbar_scrolling_view_behavior = 2131230772; public const int appbar_scrolling_view_behavior = 2131230772;

@ -166,7 +166,10 @@
<Reference Include="Xamarin.iOS" /> <Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.293080" /> <PackageReference Include="VideoLAN.LibVLC.iOS">
<Version>3.1.5-alpha</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup> <ItemGroup>

@ -10,9 +10,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="EmbedIO" Version="2.3.1" /> <PackageReference Include="EmbedIO" Version="2.5.0" />
<PackageReference Include="LibVLCSharp.Forms" Version="0.8.1" />
<PackageReference Include="Xam.Plugins.Notifier" Version="3.0.1" /> <PackageReference Include="Xam.Plugins.Notifier" Version="3.0.1" />
<PackageReference Include="Xamarin.Forms" Version="3.6.0.293080" /> <PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
<PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" /> <PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" />
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" /> <PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
</ItemGroup> </ItemGroup>
@ -24,5 +25,9 @@
<None Remove="wwwroot\lib\URI.js\URI.min.js" /> <None Remove="wwwroot\lib\URI.js\URI.min.js" />
<None Remove="wwwroot\lib\weui\weui.min.js" /> <None Remove="wwwroot\lib\weui\weui.min.js" />
<None Remove="wwwroot\weui.html" /> <None Remove="wwwroot\weui.html" />
</ItemGroup> </ItemGroup><ItemGroup>
<EmbeddedResource Update="OnvifPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

@ -29,6 +29,11 @@ namespace Demo
e.Cancel = true; e.Cancel = true;
CrossLocalNotifications.Current.Show("title", e.Url); CrossLocalNotifications.Current.Show("title", e.Url);
} }
else if (e.Url.Contains("rtmp://"))
{
e.Cancel = true;
this.Navigation.PushAsync(new OnvifPage(e.Url));
}
} }
private void WebView_Navigated(object sender, WebNavigatedEventArgs e) private void WebView_Navigated(object sender, WebNavigatedEventArgs e)

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:shared="clr-namespace:LibVLCSharp.Forms.Shared;assembly=LibVLCSharp.Forms"
x:Class="Demo.OnvifPage">
<ContentPage.Content>
<StackLayout>
<Grid>
<shared:VideoView x:Name="videoView" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</Grid>
</StackLayout>
</ContentPage.Content>
</ContentPage>

@ -0,0 +1,45 @@
using LibVLCSharp.Shared;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Demo
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class OnvifPage : ContentPage
{
private readonly string _url;
private readonly LibVLC _libvlc;
public OnvifPage(string url)
{
this._url = url;
InitializeComponent();
Core.Initialize();
this._libvlc = new LibVLC();
}
protected override void OnAppearing()
{
var media = new Media(_libvlc, this._url, FromType.FromLocation);
media.AddOption(new MediaConfiguration().EnableHardwareDecoding());
media.AddOption(":network-caching=0");
media.AddOption(":clock-jitter=0");
media.AddOption(":clock-synchro=0");
var player = new MediaPlayer(_libvlc);
videoView.MediaPlayer = player;
player.Play(media);
}
protected override void OnDisappearing()
{
this.videoView.MediaPlayer.Stop();
}
protected override bool OnBackButtonPressed()
{
this.videoView.MediaPlayer.Stop();
return base.OnBackButtonPressed();
}
}
}

@ -75,7 +75,7 @@
<li> <li>
<div class="item-content"> <div class="item-content">
<div class="item-inner"> <div class="item-inner">
<button type="submit" class="button button-large button-raised button-fill color-lightblue submit">确定</button> <button type="submit" class="button button-large button-large button-raised button-fill color-lightblue submit">确定</button>
</div> </div>
</div> </div>
</li> </li>
@ -155,8 +155,8 @@
<div class="block-title">场景</div> <div class="block-title">场景</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="sence in _.orderBy(Node.Sences,['DisplayOrder','Name'])" v-on:click="callSence(sence.Id)"> <div class="col-100 tablet-50 desktop-25" v-for="sence in _.orderBy(Node.Sences,['DisplayOrder','Name'])" v-on:click="callSence(sence.Id)">
<a href="javascript:;" class="button button-raised button-fill">{{sence.Name}}</a> <a href="javascript:;" class="button button-large button-raised button-fill">{{sence.Name}}</a>
</div> </div>
</div> </div>
</div> </div>
@ -165,26 +165,27 @@
<div class="block-title">监测</div> <div class="block-title">监测</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('检测器','监测器')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('检测器','监测器')">
<div class="row"> <a class="button button-large button-raised item-link item-content"
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> :href="'/device/'+device.Number+'/name/'+device.Name">
</div> {{device.DisplayName||device.Name}}
<div class="row" v-if="device.Name==='温湿度检测器'"> <template v-if="device.Name==='温湿度检测器'">
<div class="col">{{getData(device,"温度")}}</div> <span class="badge color-green">{{getData(device,"温度")}}</span>
<div class="col">{{getData(device,"湿度")}}</div> <span class="badge color-green">{{getData(device,"湿度")}}</span>
</div> </template>
<div class="row" v-else-if="device.Name==='二氧化碳监测器'"> <template class="row" v-else-if="device.Name==='二氧化碳监测器'">
<div class="col">{{getData(device,"二氧化碳")}}</div> <span class="badge color-green">{{getData(device,"二氧化碳")}}</span>
</div> </template>
<div class="row" v-else-if="device.Name==='光强检测器'"> <template class="row" v-else-if="device.Name==='光强检测器'">
<div class="col">{{getData(device,"光照强度")}}</div> <span class="badge color-green">{{getData(device,"光照强度")}}</span>
</div> </template>
<div class="row" v-else-if="device.Name==='粉尘检测器'"> <template class="row" v-else-if="device.Name==='粉尘检测器'">
<div class="col">{{getData(device,"粉尘")}}</div> <span class="badge color-green">{{getData(device,"粉尘")}}</span>
</div> </template>
<div class="row" v-else> <template class="row" v-else>
<div class="col">未定义</div> <span class="badge color-green">未定义</span>
</div> </template>
</a>
</div> </div>
</div> </div>
</div> </div>
@ -193,13 +194,12 @@
<div class="block-title">警报</div> <div class="block-title">警报</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('感应器')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('感应器')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> {{device.DisplayName||device.Name}}
</div> <span class="badge color-green" v-if="getData(device,'状态')==='正常'">正常</span>
<div class="row"> <span class="badge color-red" v-else>警告</span>
<div class="col">{{getData(device,"状态")}}</div> </a>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -208,17 +208,21 @@
<div class="block-title">主机</div> <div class="block-title">主机</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('主机')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('主机')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> {{device.DisplayName||device.Name}}/{{getData(device,"计算机名")}}
</div> </a>
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21boot')"></a>
<div class="col">{{getData(device,"计算机名")}}</div> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23shot')">截图</a>
</div> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22shutdown')"></a>
</div>
</div>
<div class="row">
<div class="col-100 tablet-50 desktop-25"></div>
<div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21boot')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('主机','21boot')">批量开</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23shot')">截图</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('主机','22shutdown')">批量关</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22shutdown')"></a>
</div> </div>
</div> </div>
</div> </div>
@ -228,17 +232,9 @@
<div class="block-title">无线AP</div> <div class="block-title">无线AP</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('AP')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('AP')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}<span class="badge color-green">{{getData(device,"连接数")}}</span></a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21dhcps')">查看连接</a>
</div>
<div class="row">
<div class="row">IP {{getData(device,"IP")}}</div>
<div class="row">连接数:{{getData(device,"连接数")}}</div>
</div>
<div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21dhcps')">设备</a>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -247,27 +243,20 @@
<div class="block-title">一路可调窗帘</div> <div class="block-title">一路可调窗帘</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('一路可调窗帘')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('一路可调窗帘')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}<span class="badge color-green">{{getData(device,"状态")}}</span></a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')"></a>
</div> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23stop')"></a>
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')"></a>
<div class="col">{{getData(device,"状态")}}</div>
</div>
<div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23stop')"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')"></a>
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路可调窗帘','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路可调窗帘','21on')">批量开</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路可调窗帘','23stop')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路可调窗帘','23stop')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路可调窗帘','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路可调窗帘','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -277,24 +266,20 @@
<div class="block-title">计量开关</div> <div class="block-title">计量开关</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('计量开关')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('计量开关')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='计量开关'"> <template v-if="device.Name==='计量开关'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('计量开关','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('计量开关','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('计量开关','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('计量开关','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -304,24 +289,20 @@
<div class="block-title">一路开关</div> <div class="block-title">一路开关</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('一路照明开关')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('一路照明开关')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='一路照明开关'"> <template v-if="device.Name==='一路照明开关'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路照明开关','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路照明开关','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路照明开关','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路照明开关','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -331,32 +312,24 @@
<div class="block-title">二路灯开关</div> <div class="block-title">二路灯开关</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('二路灯开关')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('二路灯开关')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-else-if="device.Name==='二路灯开关'"> <template v-else-if="device.Name==='二路灯开关'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')">全开</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')">全开</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')">全关</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')">全关</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23l1on')" v-if="getData(device,'L1状态')==='关'"></a>
</div> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'24l1off')" v-else></a>
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'25l2on')" v-if="getData(device,'L2状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23l1on')" v-if="getData(device,'L1状态')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'26l2off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'24l1off')" v-else></a>
</div>
<div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'25l2on')" v-if="getData(device,'L2状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'26l2off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路灯开关','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路灯开关','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路灯开关','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路灯开关','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -366,32 +339,26 @@
<div class="block-title">三路照明开关</div> <div class="block-title">三路照明开关</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('三路照明开关')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('三路照明开关')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='三路照明开关'"> <template v-if="device.Name==='三路照明开关'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')">全开</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')">全开</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')">全关</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')">全关</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23on')" v-if="getData(device,'状态4')==='关'"></a>
</div> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'24off')" v-else></a>
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'25on')" v-if="getData(device,'状态5')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'23on')" v-if="getData(device,'状态4')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'26off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'24off')" v-else></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'27on')" v-if="getData(device,'状态6')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'25on')" v-if="getData(device,'状态5')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'28off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'26off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'27on')" v-if="getData(device,'状态6')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'28off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('三路照明开关','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('三路照明开关','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('三路照明开关','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('三路照明开关','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -401,24 +368,20 @@
<div class="block-title">墙面插座</div> <div class="block-title">墙面插座</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('墙面插座')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('墙面插座')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='墙面插座'"> <template v-if="device.Name==='墙面插座'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('墙面插座','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('墙面插座','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('墙面插座','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('墙面插座','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -428,24 +391,20 @@
<div class="block-title">一路插座</div> <div class="block-title">一路插座</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('一路插座')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('一路插座')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='一路插座'"> <template v-if="device.Name==='一路插座'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路插座','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路插座','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路插座','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('一路插座','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -455,24 +414,20 @@
<div class="block-title">二路插座</div> <div class="block-title">二路插座</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('二路插座')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('二路插座')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='二路插座'"> <template v-if="device.Name==='二路插座'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21on')" v-if="getData(device,'状态')==='关'"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22off')" v-else></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路插座','21on')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路插座','21on')">批量</a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路插座','22off')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('二路插座','22off')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -482,22 +437,18 @@
<div class="block-title">密码门锁</div> <div class="block-title">密码门锁</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20" v-for="device in getDevices('密码门锁')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('密码门锁')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
</div>
<template v-if="device.Name==='密码门锁'"> <template v-if="device.Name==='密码门锁'">
<div class="row"> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21open')"></a>
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'21open')"></a>
</div>
</template> </template>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-50 tablet-33 desktop-20"></div> <div class="col-100 tablet-50 desktop-25"></div>
<div class="col-50 tablet-33 desktop-20"> <div class="col-100 tablet-50 desktop-25">
<div class="row"> <div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="callAll('密码门锁','21open')"></a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="callAll('密码门锁','21open')">批量</a>
</div> </div>
</div> </div>
</div> </div>
@ -507,17 +458,13 @@
<div class="block-title">红外转发器</div> <div class="block-title">红外转发器</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col" v-for="device in getDevices('红外转发器')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('红外转发器')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> <template v-for="data in _.orderBy(device.Data,['DisplayOrder','Name'])">
</div> <template v-if="data.Key==='code[]'">
<div class="row"> <a v-for="key in JSON.parse(data.Value)" class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22call','code='+key.value)">{{key.text}}</a>
<template v-for="data in _.orderBy(device.Data,['DisplayOrder','Name'])">
<template v-if="data.Key==='code[]'">
<a v-for="key in JSON.parse(data.Value)" class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'22call','code='+key.value)">{{key.text}}</a>
</template>
</template> </template>
</div> </template>
</div> </div>
</div> </div>
</div> </div>
@ -527,23 +474,19 @@
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col" v-for="device in getDevices('串口控制器')"> <div class="col" v-for="device in getDevices('串口控制器')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> <template v-for="data in _.orderBy(device.Data,['DisplayOrder','Name'])">
</div> <template v-if="data.Key==='code[]'">
<div class="row"> <div class="col" v-for="(value, key, index) in _.chain(JSON.parse(data.Value)).groupBy(o => o.text.split('-')[0]).value()">
<template v-for="data in _.orderBy(device.Data,['DisplayOrder','Name'])"> <div>{{key}}</div>
<template v-if="data.Key==='code[]'"> <div class="card">
<div class="col" v-for="(value, key, index) in _.chain(JSON.parse(data.Value)).groupBy(o => o.text.split('-')[0]).value()"> <a v-for="btn in value" class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'send','code='+btn.value)">
<div>{{key}}</div> {{btn.text.indexOf('-')>0?btn.text.split('-')[1]:btn.text}}
<div class="row"> </a>
<a v-for="btn in value" class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'send','code='+btn.value)">
{{btn.text.indexOf('-')>0?btn.text.split('-')[1]:btn.text}}
</a>
</div>
</div> </div>
</template> </div>
</template> </template>
</div> </template>
</div> </div>
</div> </div>
</div> </div>
@ -552,13 +495,9 @@
<div class="block-title">摄像头</div> <div class="block-title">摄像头</div>
<div class="block block-strong"> <div class="block block-strong">
<div class="row"> <div class="row">
<div class="col" v-for="device in getDevices('摄像头')"> <div class="col-100 tablet-50 desktop-25" v-for="device in getDevices('摄像头')">
<div class="row"> <a class="button button-large button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a>
<a class="button button-raised" :href="'/device/'+device.Number+'/name/'+device.Name">{{device.DisplayName||device.Name}}</a> <a class="button button-large button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'20shot')">截图</a>
</div>
<div class="row">
<a class="button button-raised button-fill" href="javascript: ;" v-on:click="call(device.Id,'20shot')">截图</a>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -570,7 +509,7 @@
<f7-navbar> <f7-navbar>
<f7-navbar :title="Device.DisplayName||Device.Name" back-link="Back"></f7-navbar> <f7-navbar :title="Device.DisplayName||Device.Name" back-link="Back"></f7-navbar>
</f7-navbar> </f7-navbar>
<div class="block-title">属性{{Device.Data.length}}</div> <div class="block-title" v-if="Device.Data.length">属性</div>
<div class="list"> <div class="list">
<ul v-if="Device.Data.length"> <ul v-if="Device.Data.length">
<template v-for="data in Device.Data"> <template v-for="data in Device.Data">
@ -599,14 +538,23 @@
</ul> </ul>
</div> </div>
<div class="block-title" v-if="Device.Apis.length">操作</div> <div class="block-title" v-if="Device.Apis.length">操作</div>
<template v-if="Device.Apis.length"> <div class="list" v-if="Device.Apis.length">
<ul>
<li>
<div class="item-content">
<div class="item-inner">
<a style='width:100%;' v-if="Device.Name==='摄像头'" class="button button-large button-fill button-outline external" :href="getUrl()">查看视频</a>
</div>
</div>
</li>
</ul>
<template v-for="api in _.orderBy(Device.Apis,['Command'])"> <template v-for="api in _.orderBy(Device.Apis,['Command'])">
<form method="get" action="/Command/Exec" v-on:submit.prevent="call" class="command"> <form method="get" action="/Command/Exec" v-on:submit.prevent="call" class="command" v-if="showApi(api)">
<input type="hidden" name="cmd" :value="api.Command" /> <input type="hidden" name="cmd" :value="api.Command" />
<input type="hidden" name="id" :value="Device.Id" /> <input type="hidden" name="id" :value="Device.Id" />
<div class="list"> <ul>
<ul> <template v-for="parameter in api.Parameters">
<template v-for="parameter in api.Parameters"> <template>
<li class="item-content item-input item-input-outline" v-if="parameter.Name!='hidden'"> <li class="item-content item-input item-input-outline" v-if="parameter.Name!='hidden'">
<div class="item-inner"> <div class="item-inner">
<div class="item-title item-floating-label">{{parameter.Description}}</div> <div class="item-title item-floating-label">{{parameter.Description}}</div>
@ -641,18 +589,18 @@
</div> </div>
</li> </li>
</template> </template>
<li> </template>
<div class="item-content"> <li>
<div class="item-inner"> <div class="item-content">
<button class="button button-fill button-outline" type="submit">{{api.Name}}</button> <div class="item-inner">
</div> <button class="button button-large button-fill button-outline" type="submit">{{api.Name}}</button>
</div> </div>
</li> </div>
</ul> </li>
</div> </ul>
</form> </form>
</template> </template>
</template> </div>
</f7-page> </f7-page>
</template> </template>
<template id="page-not-found"> <template id="page-not-found">

Loading…
Cancel
Save