| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <template>
- <!-- 监控管理 -->
- <view>
- <uv-navbar title="" :placeholder="true" :titleStyle="{color:'#ffffff'}" leftIconColor="#ffffff"
- bgColor="#1d345e" @leftClick="leftClick">
- <template v-slot:center>
- <view class="uv-nav-slot" style="width: 72%;">
- <uv-search v-model="monitoringAids" :actionStyle="{color:'#fff'}" placeholder="请输入设备名称"
- @search="searchWork" @custom="searchWork"></uv-search>
- </view>
- </template>
- </uv-navbar>
- <scroll-view :style="{height: `calc(100vh - ${(headTop + 44) + 'px'})`,}" :scroll-top="scrollTop"
- scroll-with-animation="true" scroll-y="true" @scrolltolower="loadMore" @scroll="handleScroll"
- :lower-threshold="50">
- <view class="camera_type_box">
- <view class="item_type_camera">
- <view class="camera_bxo_sum">
- <text class="iconfont"></text>
- <view class="sum_title_camera">总量</view>
- </view>
- <span class="sum_camera" style="color: #39ecf5;">{{totalContent }}</span>
- </view>
- <!-- <view class="item_type_camera">
- <span class="sum_title_camera">在线</span>
- <view class="center_in">
- <text class="iconfont" style="color: rgb(34, 190, 68);"></text>
- <span class="sum_camera">999</span>
- </view>
- </view>
- <view class="item_type_camera">
- <span class="sum_title_camera">离线</span>
- <view class="center_in">
- <text class="iconfont" style="color: rgb(211, 205, 85);"></text>
- <span class="sum_camera">999</span>
- </view>
- </view> -->
- </view>
- <view class="card_camera" v-if="workData.length > 0">
- <view class="camera_item" v-for="(item,index) in workData" :key="index" @click="goparticulars(item)">
- <view class="facility_cameraName">{{item.name}}</view>
- <view class="facility_code">编号:{{item.indexCode}}</view>
- <view class="facility_secondary">区域位置:{{getLocation(item.regionPathName)}}</view>
- <view class="camera_img">
- <uv-image width="100%" mode="widthFix" height="354rpx" :src="item.url">
- <template v-slot:loading>
- <uv-loading-icon color="#1599db"></uv-loading-icon>
- </template>
- <template v-slot:error>
- <view style="display: flex;flex-direction: column;align-items: center;">
- <uv-icon name="photo" size="30"></uv-icon>
- <view style="font-size: 24rpx;">加载失败</view>
- </view>
- </template>
- </uv-image>
- </view>
- </view>
- <view style="padding-bottom:20rpx" v-if="pageNo > 1">
- <uv-load-more :status="status" color="#ffffff" />
- </view>
- </view>
- <view style="margin-top: 30%;" v-else>
- <x-empty></x-empty>
- </view>
- </scroll-view>
- <view class="top-back" @click="topBack" v-if="backShow">
- <text class="iconfont icon_back_top"></text>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import { GetCameraSearch } from "@/api/monitoring";
- import { ref, nextTick } from 'vue'
- const cameraData : any = ref(10)
- import { onShow, onReady } from "@dcloudio/uni-app";
- onReady(() => {
- // #ifdef APP-PLUS
- plus.navigator.setStatusBarStyle("light");
- // #endif
- })
- onShow(() => {
- // #ifdef APP-PLUS
- plus.navigator.setStatusBarStyle("light");
- // #endif
- nextTick(() => {
- pageNo.value = 1
- workData.value = []
- getCamera()
- })
- });
- const headTop = ref(0)
- const scrollTop : any = ref(-1)
- const backShow : any = ref(false)
- const currentScrollTop = ref(0)
- const totalContent = ref(0)
- const monitoringAids = ref('')
- const status = ref('loadmore')
- const workData : any = ref([])
- const current = ref(0)
- const pageNo = ref(1)
- const pageSize = ref(10)
- const loadingMore = ref(true)
- // 防抖函数
- function debounce(func : any, wait : any) {
- let timeout : any = null
- return function executedFunction(...args : any) {
- const later = () => {
- clearTimeout(timeout)
- func(...args)
- }
- clearTimeout(timeout)
- timeout = setTimeout(later, wait)
- }
- }
- // 处理滚动事件
- const handleScroll = debounce((e : any) => {
- scrollTop.value = -1
- currentScrollTop.value = e.detail.scrollTop
- // 滚动超过200px显示返回顶部按钮
- backShow.value = e.detail.scrollTop > 200
- }, 100)
- // 返回顶部
- function topBack() {
- scrollTop.value = 0
- setTimeout(() => {
- backShow.value = false
- }, 300)
- }
- // 获取监控点列表
- const getCamera = () => {
- GetCameraSearch({
- pageNo: pageNo.value,
- pageSize: pageSize.value,
- name: monitoringAids.value,
- }).then((res : any) => {
- if (res.code == 200) {
- const data = res.data.list
- totalContent.value = res.data.total
- if (data.length > 0) {
- workData.value = workData.value.concat(data)
- }
- if (data.length < pageSize.value) {
- status.value = 'nomore'
- loadingMore.value = true
- } else {
- status.value = 'loading'
- loadingMore.value = false
- pageNo.value++
- }
- }
- })
- }
- // 加载更多数据
- const loadMore = () => {
- console.log('到底了吗');
- if (!loadingMore.value) {
- getCamera()
- }
- };
- // 获取位置/截取
- function getLocation(params) {
- if (!params) {
- return ''
- }
- const parts = params.split('/').filter(p => p)
- if (parts.length > 2) {
- return `${parts[parts.length - 2]}/${parts[parts.length - 1]}`
- }
- return parts.join(' / ')
- }
- // 搜索监控设备
- const searchWork = () => {
- pageNo.value = 1
- workData.value = []
- getCamera()
- }
- // 监控详情
- const goparticulars = (val : any) => {
- uni.navigateTo({
- url: '/pages/monitoring/particulars?indexCode=' + val.indexCode,
- })
- }
- function leftClick() {
- uni.navigateBack({
- delta: 1
- });
- }
- </script>
- <style lang="scss" scoped>
- .scroll-container {
- height: calc(100vh - 88rpx) // 减去搜索框的高度
- }
- .center_in {
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- }
- .camera_type_box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 20rpx 30rpx 0rpx 30rpx;
- }
- .item_type_camera {
- width: calc(100% - 40rpx);
- // width: calc(32% - 40rpx);
- display: flex;
- align-items: center;
- justify-content: space-between;
- // height: 200rpx;
- background-color: rgba(85, 110, 143, .3);
- border-radius: 10rpx;
- padding: 20rpx;
- }
- .sum_title_camera {
- font-size: 30rpx;
- color: #fff;
- margin-left: 20rpx;
- }
- .camera_bxo_sum {
- display: flex;
- align-items: center;
- }
- .iconfont {
- color: rgb(57, 236, 245);
- font-size: 60rpx;
- margin-bottom: 5rpx;
- }
- .sum_camera {
- color: #fff;
- font-weight: bold;
- font-size: 32rpx;
- margin-right: 10rpx;
- }
- .card_camera {
- display: flex;
- flex-direction: column;
- }
- .camera_item {
- padding: 30rpx;
- margin: 30rpx 30rpx 0rpx 30rpx;
- background-color: rgba(85, 110, 143, .3);
- border-radius: 10rpx;
- }
- .camera_img {
- margin-top: 20rpx;
- width: 100%;
- height: 350rpx;
- }
- .camera_img_video {
- width: 100%;
- height: 100%;
- }
- .facility_cameraName {
- color: #fff;
- font-size: 30rpx;
- font-weight: bold;
- }
- .facility_secondary {
- font-size: 26rpx;
- color: #DCDFE6;
- }
- .facility_code {
- margin-top: 4rpx;
- font-size: 26rpx;
- color: #DCDFE6;
- }
- .search_card {
- display: flex;
- align-items: center;
- margin: 20rpx 30rpx 0rpx 30rpx;
- }
- .top-back {
- position: fixed;
- right: 30rpx;
- bottom: 120rpx;
- width: 80rpx;
- height: 80rpx;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 50%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- color: white;
- font-size: 28rpx;
- z-index: 999;
- animation: heart 0.3s;
- @keyframes heart {
- 0% {
- right: -30rpx;
- }
- 100% {
- right: 30rpx;
- }
- }
- }
- .icon_back_top {
- color: #fff;
- font-size: 46rpx;
- }
- </style>
|