| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
- <!-- 可视监控 -->
- <view class="camera-panel">
- <view class="camera-list">
- <!-- 监控列表 -->
- <block v-for="(item,index) in cameraList" :key="index">
- <view class="camera-item" @click="openCameraDetails(item.device_id)">
- <image class="pic" mode="aspectFill" :src="item.jk_live_img">
- </image>
- <view class="row-between p-10">
- <text class="text">{{item.device_name}}</text>
- <text class="tips" :calss="item.status?'':'close'"></text>
- </view>
- </view>
- </block>
- <!-- 监控列表end -->
- </view>
- <ui-empty v-if="cameraList.length==0"></ui-empty>
- </view>
- </template>
- <script>
- import {
- getCameraList
- } from '@/api/camera.js'
- export default {
- data() {
- return {
- params: {
- page: 1,
- page_size: 10,
- // device_id:
- },
- // 监控列表
- cameraList: [],
- total: 0, // 设备总数
- };
- },
- async onLoad() {
- await this.$onLaunched;
- this.getCameraList();
- },
- onReachBottom(e) {
- if (this.cameraList.length >= this.total) {
- return;
- }
- this.params.page += 1;
- this.getCameraList();
- },
- methods: {
- // 获取监控列表
- async getCameraList() {
- this.$api.loading('加载中...');
- const {
- data,
- counts
- } = await getCameraList(this.params);
- this.$api.hide();
- this.cameraList = [...this.cameraList, ...data];
- this.total = counts;
- },
- /**
- * 打开监控详情
- * @param {string} id 设备id
- */
- openCameraDetails(id) {
- uni.navigateTo({
- url: `details?id=${id}`
- })
- }
- }
- }
- </script>
- <style lang="scss">
- // 可视监控面板
- .camera-panel {
- padding: 24rpx;
- margin-top: 24rpx;
- background-color: #fff;
- }
- .camera-list {
- display: flex;
- flex-wrap: wrap;
- }
- // 可视列表项
- .camera-item {
- width: 336rpx;
- margin-right: 28rpx;
- margin-bottom: 24rpx;
- border-radius: 12rpx;
- border: 1rpx solid #F1F1F1;
- &:nth-child(2n) {
- margin-right: 0;
- }
- .pic {
- display: block;
- width: 336rpx;
- height: 255rpx;
- border-radius: 4rpx;
- }
- .text {
- font-size: 20rpx;
- color: #666666;
- }
- .tips {
- width: 24rpx;
- height: 24rpx;
- background: #07F546;
- border-radius: 100%;
- &.close {
- background: #e93f27;
- }
- }
- }
- </style>
|