<template>
  <view class="content">
    <uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="全部摄像头"></uni-nav-bar>
    <view class="flex-col section_8" v-for="camera in cameraList" :key="camera.id">
      <view class="flex-col items-center group_12">
        <image src="/static/imgs/digital-workshops/camera-tip-bg.png" class="image_2" @click="go2('video-play', { url: camera.videoUrl })" />
        <text class="text_18">{{ camera.address }}</text>
      </view>
    </view>
  </view>
</template>

<script>
import { go2, back } from '@/utils/hook.js'
import { getCameraListApi } from '@/apis/factoryApi'

export default {
  data() {
    return {
      cameraList: []
    }
  },
  onLoad(option) {
    this.factoryId = option.id
    this.getCameraList()
  },
  methods: {
    go2,
    back,
    // 获取摄像头列表
    getCameraList() {
      getCameraListApi({ factoryId: this.factoryId }).then((res) => {
        this.cameraList = res
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  width: 750rpx;
  .section_8 {
    margin-top: 20rpx;
    padding: 0 32rpx 33rpx;
    background-color: rgb(255, 255, 255);
    .group_11 {
      padding: 19rpx 0;
      color: rgb(51, 51, 51);
      font-size: 36rpx;
      font-weight: 500;
      line-height: 50rpx;
      white-space: nowrap;
      .image_1 {
        margin-right: 9rpx;
        align-self: center;
        width: 14rpx;
        height: 24rpx;
      }
    }
    .group_12 {
      color: rgb(255, 255, 255);
      font-size: 28rpx;
      font-weight: 500;
      line-height: 40rpx;
      white-space: nowrap;
      position: relative;
      .image_2 {
        width: 91.5vw;
        height: 51.5vw;
      }
      .text_18 {
        position: absolute;
        left: 24rpx;
        top: 16rpx;
      }
      .image_3 {
        width: 87rpx;
        height: 87rpx;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}
</style>
