123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534 |
- <template>
- <view :style="'padding-top:'+nvaHeight+'px;'">
- <view class="navbox">
- <uni-nav-bar color="#ffffff" leftWidth="200rpx" title="实时监控" :background-color="backgroundColor" :border="false" statusBar='true' fixed="true">
- <block slot="left">
- <picker range-key='name' :value="adridx" :range="adrlist" @change='bindDateChangea'>
- <view class="chekt">
- <view class="over">{{address|| ""}}</view>
- <image :src="upimg"></image>
- </view>
- </picker>
- </block>
- </uni-nav-bar>
- </view>
- <image :src="navbg" class="navbg"></image>
- <view class="zxmain">
- <view class="vidbox mb18">
- <!-- #ifdef APP-PLUS -->
- <video :src="videourl" id="myvideo" autoplay controls></video>
- <!-- #endif -->
- <!-- #ifdef H5 -->
- <view id="myPlayer" ref="myPlayer"></view>
- <!-- #endif -->
- <!-- #ifdef MP-WEIXIN -->
- <!-- #endif -->
- <!-- 监控 -->
- <view class="control">
- <view class="contop flexcc">
- <image :src="videoimg"></image>
- <view>监控切换</view>
- </view>
- <view class="flex1 overa conbox">
- <view class="contit over" :class="indexCode==ite.indexCode?'act':''" v-for="(ite,idx) in adrlist" :key="ite.indexCode" @click="getCodeFn(ite)">
- {{ite.name}}
- <image :src="videobg" v-if="indexCode==ite.indexCode" class="videobg"></image>
- </view>
- </view>
-
- </view>
- <!-- <image :src="mjimg"></image>
- <view class="vidfot flexc">
- <view class="flex1 vtit">2024/06/21 星期五 15:59:12</view>
- <view class="vimgs">
- <image :src="voiceimg" class="imga"></image>
- </view>
- <view class="vimgs">
- <image :src="bigimg" class="imgb"></image>
- </view>
- </view> -->
- </view>
- <view class="openbox flexcj">
- <view class="btns bga" @click="getOpenFn" v-if="checkPermi(['system:camera:openDz'])">
- <image :src="openimg"></image>
- 开门
- </view>
- <view class="btns bgb" @click="getCloseFn" v-if="checkPermi(['system:camera:closeDz'])">
- <image :src="openimg"></image>
- 关门
- </view>
- </view>
- <!-- 列表 -->
- <block v-if="checkPermi(['system:door:list'])">
- <view class="vlisttop flexcj">
- <view class="vlleft flexc" @click="getResetFn">
- <image :src="mjimg"></image>门禁记录
- </view>
- <picker mode="date" @change='bindDateChangeb'>
- <view class="rlleft flexc">
- <view>{{daytime||"请选择日期"}}</view>
- <image :src="hupimg"></image>
- </view>
- </picker>
- </view>
- <!-- 表格 -->
- <view class="table" :style="tabflag?'height:calc(100vh - '+tabscheight+'rpx)':''">
- <zb-table
- :show-header="true"
- :columns="column1"
- :stripe="true"
- :fit="true"
- :isShowLoadMore="reachflag"
- :parameter="parameter"
- :data="list"></zb-table>
- <!-- @rowClick="rowClick"
- @toggleRowSelection="toggleRowSelection"
- @toggleAllSelection="toggleAllSelection" -->
- </view>
- </block>
-
- </view>
-
- <!-- 第一道;手机号,发送验证码,门就开,记录车牌号,直接进
- 第二种:需要审核,预约
- 办公人员,配置进门区域,
- 访客配置 进门区域 -->
-
- <footers v-if="isfootflag" :footerindex="footerindex"></footers>
- </view>
- </template>
- <script>
- import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
- import self from '@/utils/location.js';
- import yList from "@/components/order/list.vue"
- let { calendar } = require("@/components/lunc-calendar/calendar.js");
- import {getCameraList,getCameraVideo,getVideoOpenDz,getVideoCloseDz,getDoorList} from "@/api/mine/order.js"
- import {column1} from '@/components/zb-table/all.js'
- import {getDictionaryFn} from "@/api/mine/register.js"
- import footers from '@/components/footer/footer.vue'
- import zbTable from "@/components/zb-table/zb-tables.vue"
- // #ifdef H5
- import flvjs from 'flv.js';
- // #endif
-
- export default {
- components:{yList,footers,zbTable},
- data(){
- return{
- column1,
- footerindex:'video',
- isfootflag:true,
- navbg:require("@/static/images/vibg.png"),
- upimg:require("@/static/images/order/up.png"),
- hupimg:require("@/static/images/order/hup.png"),
- mjimg:require("@/static/images/order/control.png"),
- bigimg:require("@/static/images/order/pre.png"),
- voiceimg:require("@/static/images/order/voice.png"),
- openimg:require("@/static/images/order/open.png"),
- closeimg:require("@/static/images/order/close.png"),
- resetimg:require('@/static/images/order/reset.png'),
- wresetimg:require('@/static/images/order/wreset.png'),
- videoimg:require('@/static/images/order/video.png'),
- videobg:require('@/static/images/order/videobg.png'),
- backgroundColor: "transparent",
- list:[
- //{entranceGuardName:'后门抓拍一体机1',controlsTime:'2024-08-22 11:21:44',type:'1',pictureUrl:"/profile/upload/2024/08/22/cardr_20240822145636A001.png,/profile/upload/2024/08/22/a_20240822151219A002.png"},
- ],
- pageSize: 15,
- pageNum: 1,
- reachflag: false,
- wtdt:'',
- parameter:{
- kgmlist:[],
- },
- adridx:0,
- address:'',
- adrlist:[{name:"后门抓拍一体…",indexCode:"1"},{name:"IPCamera34",indexCode:"2"},{name:"ZXY-工地走廊",indexCode:"3"},],//
- indexCode:'',
- fixedflag:false,
- videourl:'',
- nvaHeight:44,
- marTop:0,//距离顶部的距离
- stubarHeight:0,//
- tabtop:0,//表格距离顶部的距离
- daytime:'',//时间
- tabflag:false,
- tabscheight:0,//减去的部分
- autoplay:true,
- controls:true,
- enableProgressGesture: false,
- showPlayBtn: false,
- showCenterPlayBtn: false,
- showFullscreenBtn: false,
- windowWidth: '',
- windowHeight: '',
- flvPlayer: null,
- player: null,
- isloading:false,
- }
- },
- onPageScroll(e) {
- var scrollTop = Number(e.scrollTop);
- if (scrollTop > 0) {
- this.backgroundColor = '#0491FD'
- } else {
- this.backgroundColor = 'transparent'
- }
- if(scrollTop<this.tabtop){
- this.tabflag=false;
- }else{
- this.tabflag=true;
- }
- },
- onLoad: function() {
- // uni.$on('refreshdatalist',(e) => {
- // this.reachflag=false;
- // this.pageNum=1;
- // this.list=[];
- // this.getDataFn();
- // })
- this.time()
- if(checkPermi(['system:camera:list'])){
- this.getCameraList()
- }
- this.init()
- // this.getDataFn()
- uni.getSystemInfo({
- success: (e) => {
- this.stubarHeight=Number(e.statusBarHeight);
- this.nvaHeight = Number(e.statusBarHeight)+44;
- this.tabscheight=Number(this.nvaHeight)*2+100;
- }
- })
- },
- onUnload() {
- uni.$off('refreshdatalist')
- // #ifdef H5
- this.flv_destroy();
- // #endif
-
- },
- onShow() {
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods:{
- checkPermi, checkRole,
- getOpenFn(){
- var that=this
- if(this.isloading){
- return
- }
- this.isloading=true;
- var params={
- equipmentName:this.address
- }
- getVideoOpenDz(params).then(res=>{
- this.isloading=false
- if(res.code==200){
- this.$toast('已开门')
- }
- }).catch(error=>{
- this.isloading=false
- })
- },
- getCloseFn(){
- var that=this
- if(this.isloading){
- return
- }
- this.isloading=true;
- var params={
- equipmentName:this.address
- }
- getVideoCloseDz(params).then(res=>{
- this.isloading=false
- if(res.code==200){
- this.$toast('已关门')
- }
- }).catch(error=>{
- this.isloading=false
- })
- },
- time() {
- var date = new Date();
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- var d = date.getDate();
- // var h = date.getHours();
- // var min = date.getMinutes();
- // var s = date.getSeconds();
- // var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
- // var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
- this.daytime = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
- // var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
- // '0' + s) : s);
- if(checkPermi(['system:door:list'])){
- this.getDataFn()
- }
- },
- getLivePlayer() {
- uni.showLoading({
- mask: true,
- title: 'loading...'
- });
- // 生成需要的video 组件
- // var player = document.getElementById('videoElement');
- var player = document.createElement('video');
- player.id = 'video';
- player.style = 'width: 100%;height: 211px';
- player.enableProgressGesture = this.enableProgressGesture;
- player.controls = this.controls;
- player.muted = true;
- player.showCenterPlayBtn = this.showCenterPlayBtn;
- player.showPlayBtn = this.showPlayBtn;
- player.showFullscreenBtn = this.showFullscreenBtn;
- player.x5VideoPlayerType = 'h5-page';
- player.x5VideoPlayerFullscreen = 'false';
- player.autoplay = this.autoplay; // 以上均为 video标签的属性配置
- var myPlayer= document.getElementById('myPlayer')
- // console.log(myPlayer.childNodes,1)
- myPlayer.innerHTML=''
- myPlayer.appendChild(player);
- if (flvjs.isSupported()) {
- this.flvPlayer = flvjs.createPlayer({
- type: 'flv',
- isLive: true, //<====直播的话,加个这个
- url: this.videourl//直播流地址
- });
- this.flvPlayer.attachMediaElement(player);
- this.flvPlayer.load(); //加载
-
- // setTimeout(() => {
- // var player2 = document.createElement('video');
- // player2.play();
- // }, 2000);
- this.player = player;
- this.flvPlayer.on(flvjs.Events.ERROR, (errorType, errorDetail, errorInfo) => {
- console.log('播放错误');
- this.flv_destroy();
-
- });
- uni.hideLoading();
- }
- },
- flv_start() {
- //开始
- console.log(this.player);
- this.player.play();
- },
- flv_pause() {
- //暂停
- this.player.pause();
- },
- flv_destroy() {
- // console.log(23)
- //停止
- if(this.flvPlayer){
- this.flvPlayer.pause();
- this.flvPlayer.unload();
- this.flvPlayer.detachMediaElement();
- this.flvPlayer.destroy();
- this.flvPlayer = null;
- this.player=null;
- }
-
- },
- flv_seekto() {
- // 复制其他人的 我还没用这个
- this.player.currentTime = parseFloat(document.getElementsByName('seekpoint')[0].value);
- },
- bindDateChangea(e){
- var val=e.detail.value;
- this.adridx=val
- this.address=this.adrlist[val].name;
- this.indexCode=this.adrlist[val].indexCode;
- // 获取直播视频
- this.getCameraVideo()
- },
- getCodeFn(ite){
- this.address=ite.name;
- this.indexCode=ite.indexCode;
- // 获取直播视频
- this.getCameraVideo()
- },
- getCameraVideo(){
- // 设备
- getCameraVideo(this.indexCode).then(res=>{
- if(res.code==200){
- var data=res.data.data;
- if(data){
- this.videourl=data.url;
- // #ifdef H5
- this.getLivePlayer()
- // #endif
- }
- }else{
- this.$toast(res.msg)
- }
- })
- },
- getResetFn(){
- // 重置
- this.daytime='';
- this.getrefreshData()
- },
- bindDateChangeb(e){
- this.daytime=e.detail.value;
- this.getrefreshData()
- },
- getrefreshData(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getCameraList(){
- // 设备
- var params={
- pageSize:1000,
- pageNo: 1,
- }
- getCameraList(params).then(res=>{
- if(res.code==200){
- var data=res.data.data;
- if(data&&data.list&&data.list.length>0){
- this.adrlist =data.list;
- this.address=data.list[0].name;
- this.indexCode=data.list[0].indexCode;
- if(checkPermi(['system:camera:video'])){
- this.getCameraVideo()
- }
-
- }
- }else{
- this.$toast(res.msg)
- }
- })
- },
- init(){
- // 开关门类型
- getDictionaryFn('is_open').then(res=>{
- if(res.code==200){
- this.parameter.kgmlist = res.data.map(v => {
- return {
- label: v.dictLabel,
- value: v.dictValue
- }
- })
- }
- })
- },
- getDataFn(){
- var params={
- pageSize:this.pageSize,
- pageNum: this.pageNum,
- }
- if(this.daytime){
- params.controlsTime=this.daytime
- }
- getDoorList(params).then(res=>{
- if(res.code==200){
- if (res.rows.length < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- } else {
- var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
- if (num < res.total) {
- this.reachflag = true
- this.wtdt = '上拉加载更多'
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- }
- }
- if (this.pageNum == 1) {
- this.list = res.rows;
- } else {
- this.list = this.list.concat(res.rows)
- }
- }else{
- this.$toast(res.msg)
- }
- })
-
- },
- },
-
- }
- </script>
- <style>
- page{background: #ffffff;}
- </style>
- <style lang="scss" scoped>
- .navbox /deep/ .uni-navbar__header-container {align-items: center;padding-left: 0;}
- .navbox /deep/ uni-picker{flex: 1;}
- .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4;
- }
- .chekt{font-weight: bold;font-size: 30rpx;color: #FFFFFF;display: flex;align-items: center;width: 200rpx;
- view{flex: 0 1 auto;min-width: 100rpx;}
- image{width: 16rpx;height: 10rpx;margin-left: 10rpx;flex: 0 0 auto;}
- }
- .reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
- image{width: 26rpx;height: 30rpx;}
- }
- .navbg{width: 100%;height: 692rpx;z-index: 0;}
- .vidbox{overflow: hidden;
- border-radius: 14rpx;box-sizing: border-box;width:100%;position: relative;display: flex;align-items: center;overflow: auto;flex-wrap: nowrap;
- video{width: 100%;height: 450rpx;flex: 1;}
- .vidfot{padding: 0 20rpx 0 30rpx;
- height: 76rpx;background: rgba(0, 0, 0, 0.5);position: absolute;left: 0;right: 0;bottom: 0;
- .vtit{font-weight: 500;font-size: 22rpx;color: #FFFFFF;}
- .vimgs{width: 50rpx;height: 50rpx;display: flex;align-items: center;justify-content: center;margin-left: 28rpx;
- .imga{width: 30rpx;height: 22rpx;}
- .imgb{width: 30rpx;height: 30rpx;}
- }
- }
- .control{width: 210rpx;flex: 0 0 auto;background: #FFFFFF;border-radius: 14rpx;height: 450rpx;padding: 18rpx 0 4rpx;box-sizing: border-box;display: flex;flex-direction: column;margin-left: 16rpx;
- .contop{font-weight: bold;font-size:26rpx;color: #161616;margin-bottom: 10rpx;flex: 0 0 auto;
- image{width: 26rpx;height: 20rpx;margin-right: 12rpx;}
- }
- .conbox{
- mask:linear-gradient(#fff,#fff,#fff,transparent);
- -webkit-mask: linear-gradient(#fff,#fff,#fff,transparent);
- }
- .contit{font-size: 22rpx;height: 48rpx;line-height: 48rpx;text-align: center;
- color: #161616;position: relative;
- &.act{font-weight: bold;color: #FFFFFF;}
- }
- .videobg{position: absolute;left: 0;right: 0;top: 0;bottom: 0;width: 100%;height: 48rpx;z-index: -1;}
- }
- }
- .openbox{margin-bottom: 36rpx;
- .btns{width: 320rpx;height: 98rpx;border-radius: 14rpx;display: flex;align-items: center;justify-content: center;
- font-weight: bold;font-size: 28rpx;color: #FFFFFF;
- image{width: 24rpx;height: 20rpx;margin-right: 14rpx;}
-
- &.bga{background: #0391FD;}
- &.bgb{background: #58CA5C;}
- }
- }
- .vlisttop{font-weight: bold;font-size: 30rpx;color: #161616;padding: 16rpx 0;margin-bottom: 20rpx;
- .vlleft{flex: 1;
- image{width: 26rpx;height: 26rpx;margin-right: 12rpx;}
- }
- .rlleft{
- view{font-weight: bold;font-size: 26rpx;color: #0391FD;min-width: 152rpx;}
- image{width: 18rpx;height: 10rpx;margin-left: 12rpx;}
- }
- }
- .table{
- // height: calc();
- overflow: auto;
- }
- .zxmain{position: relative;padding: 0 32rpx;
-
- }
- </style>
|