tanghaolin
2022-11-04 04ec00b941cafb30392ff20501f2abfa46bbcabe
添加摄像头告警列表
已修改3个文件
68 ■■■■ 文件已修改
bim/station/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
video/single/index.js 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
video/single/index.wxml 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
bim/station/index.js
@@ -27,19 +27,19 @@
      stationID = 3;
    }
    // console.log(stationID,userInfo.CorpID)
    var url = 'https://www.beng35.com/BIM/miniProgram/stationsimple.html?id=' + stationID + '&corpid='+ userInfo.CorpID + "&V=20221028";
    var url = 'https://www.beng35.com/BIM/miniProgram/stationsimple.html?id=' + stationID + '&corpid='+ userInfo.CorpID;
    console.log(url,31)
    this.setData({
      webViewUrl: url
    });
    console.log(this.data.webViewUrl,35)
    // console.log(this.data.webViewUrl,35)
  },
  loadMessage: function (e) {
    //console.log(e, '加载返回的消息')
  },
  loadSuccesss: function (e) {
    console.log(e, '加载成功')
    // console.log(e, '加载成功')
  },
  loadError: function (e) {
    console.log(e, '加载失败')
video/single/index.js
@@ -1,6 +1,7 @@
var Constant = require('../../utils/constant.js');
var app = getApp();
import Request  from "../../utils/api"
let Utils = require('../../utils/util');
/**
 * ifRotate:是否可旋转
 * ifFocusing:是否可调焦
@@ -42,7 +43,9 @@
    moreVideo: [],
    fullScreen: false, // 操作是否显示
    btnCmd:"",//当前操作的cmd按钮
    videoTabBarIndex:1 //当前的tabbar索引
    videoTabBarIndex:1, //当前的tabbar索引
    isLoadingDeviceAlarmList:false,//是否加载了设备告警记录
    deviceAlarmList:[],//设备告警列表
  },
  onLoad(options) {
    this.videoContext = wx.createVideoContext('myVideo')
@@ -169,9 +172,45 @@
    },
  })
},
//获取设备告警信息列表
getAlarmByDeviceList(){
  let _this = this
  // console.log(_this.data.list,175)
wx.request({
  url: Constant.YING_SHI_URL +'api/lapp/alarm/device/list',
  header: {
    'content-type': 'application/x-www-form-urlencoded'
  },
  method: 'POST',
  data:{
    accessToken:_this.data.list.ViewToken,
    deviceSerial:_this.data.list.SeriesNO,
  },
  success:res=>{
     console.log(res,188)
    if(res.data.code==200){
      let arr= []
      res.data.data.forEach(item=>{
        item.alarmTime = Utils.formatDay(new Date(item.alarmTime))
        arr.push(item)
      })
      _this.setData({
        deviceAlarmList:arr,
        isLoadingDeviceAlarmList:true
      })
    }
  },
  fail:err=>{
    console.log(err,191)
  }
})
},
//监控功能tabBar切换 
videoTabBarChange(e){
  console.log(e,173)
  // console.log(e,173)
  if(e.currentTarget.dataset.id == 2 && !this.data.isLoadingDeviceAlarmList){
      this.getAlarmByDeviceList()
  }
  this.setData({
    videoTabBarIndex:e.currentTarget.dataset.id
  })
video/single/index.wxml
@@ -54,12 +54,12 @@
<!-- 监控功能切换tabbar -->
<!-- <scroll-view scroll-x class="bg-white nav">
<scroll-view scroll-x class="bg-white nav">
  <view class='flex text-center'>
    <view class="cu-item flex-sub {{videoTabBarIndex ==1?'text-cyan cur':''}}" bindtap="videoTabBarChange" data-id="1">基本信息</view>
    <view class="cu-item flex-sub {{videoTabBarIndex ==2?'text-cyan cur':''}}" bindtap="videoTabBarChange" data-id="2">告警记录 </view>
  </view>
</scroll-view> -->
</scroll-view>
<!-- 基本信息 -->
<view class="ykt-detail-wraper" wx:if="{{list.LiveUrl && list && videoTabBarIndex == 1}}">
    <view class="ykt-head">
@@ -91,6 +91,15 @@
      </view>
</view>
<!-- 告警列表 -->
<!-- <scroll-view scroll-y>
</scroll-view> -->
<scroll-view style="height: calc(100vh - 271px);" scroll-y wx:if="{{videoTabBarIndex == 2}}">
  <view class="cu-list menu menu-avatar" style="margin-top:5rpx">
  <view class="cu-item " wx:for="{{deviceAlarmList}}" wx:for-item="alarm_item" wx:for-index="index" wx:key="index">
    <view class="cu-avatar radius lg" style="background-image:url({{alarm_item.alarmPicUrl}});"></view>
    <view class='content' style="width: 100%;">
      <view>{{alarm_item.alarmName}}</view>
      <view class='text-gray text-sm'>
        {{alarm_item.alarmTime}}</view>
    </view>
  </view>
  </view>
</scroll-view>