<template>
  <view >
    <cu-custom bgColor="bg-gradual-blueness" :isBack="true" >
      <block slot="backText">返回</block>
      <block slot="content">AI报警</block>
    </cu-custom>
    <scroll-view scroll-y="false" >
      <view class="form">
        <view class="wui-form-list">
          <view class="cu-form-group group-picker">
            <view class="title">视频名称：</view>
            {{info.VIDEONAME}}
          </view>
          <view class="cu-form-group group-picker">
            <view class="title">报警类型：</view>
            {{info.TYPE}}
          </view>
          <view class="cu-form-group group-picker">
            <view class="title">报警时间：</view>
            {{info.CREATTIME}}
          </view>
          <view class="cu-form-group group-picker">
            <view class="title">报警图片：</view>
            <image :src="baseImgPath+info.IMG_PATH"  @click="ViewShowImage" style="width: 100upx;height: 100upx;"></image>
          </view>
          <view class="cu-form-group group-picker">
            <view class="title">报警视频：</view>
            <view class="de-sub-content" style="background-color: #000;width: 120upx;">
              <image src="/static/icon-apps/video.png" mode="aspectFill" @click="playVideo"
                     style="width: 120upx;height: 120upx;"></image>
            </view>
          </view>
        </view>
      </view>
    </scroll-view>
    <view :class="['cu-modal',{'show':modalShow}]" v-if="modalShow">
      <view class="cu-dialog">
        <view class="cu-bar bg-white justify-end">
          <view class="content">播放视频</view>
          <view class="action" @tap="modalShow = false">
            <text class="cuIcon-close text-red"></text>
          </view>
        </view>
        <video :src="videoSrc" :show-fullscreen-btn="false" :autoplay="true" @fullscreenchange="fullScreenHandler"></video>
        <view class="cu-bar bg-white justify-end">
          <view class="action">
            <button class="cu-btn line-green text-green" @click="modalShow = false">关闭</button>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import {
  basePath,baseImgPath
} from '@/common/tool.js';
export default {
  data() {
    return {
      baseImgPath,
      AIWARNING_ID: '',
      info:{},
      videoSrc:'',
      modalShow:false
    }
  },
  onLoad(event) {
    this.AIWARNING_ID = event.AIWARNING_ID;
    this.getData()
  },
  methods: {
    fullScreenHandler(e) {
      if (uni.getSystemInfoSync().platform == "ios") { return }
    },
    getData() {
      uni.showLoading({
        title:"加载中..."
      });//加载中动画
      uni.request({
        url: basePath + '/app/aiwarning/goEdit',
        method: 'POST',
        dataType: 'json',
        header: {
          'Content-type':'application/x-www-form-urlencoded'
        },
        data: {
          AIWARNING_ID:this.AIWARNING_ID
        },
        success: (res) => {
          uni.hideLoading();//结束加载中动画
          if (res.data != null) {
            this.info = res.data.pd
          }
        }
      })
    },
    ViewShowImage(){
      uni.previewImage({
        urls: [baseImgPath+this.info.IMG_PATH],
        current: baseImgPath+this.info.IMG_PATH
      });
    },
    playVideo() {
      this.videoSrc = baseImgPath + this.info.VIDEO_PATH
      this.modalShow = true
    }
  },
}
</script>

<style scoped>

</style>
