From 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 21 Apr 2025 18:29:09 +0800
Subject: [PATCH] fix: 天气显示
---
src/views/Home/HomeLeft/OverviewNext.vue | 348 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 202 insertions(+), 146 deletions(-)
diff --git a/src/views/Home/HomeLeft/OverviewNext.vue b/src/views/Home/HomeLeft/OverviewNext.vue
index 21fdc80..5b090e7 100644
--- a/src/views/Home/HomeLeft/OverviewNext.vue
+++ b/src/views/Home/HomeLeft/OverviewNext.vue
@@ -1,178 +1,234 @@
<!-- 机巢概况 -->
<template>
- <common-title title="机巢概况" :style="{ marginLeft: pxToRem(14) }" @details="detailsFun"></common-title>
- <div class="overview-next">
- <MachineNestTotal @searchNickName="handleSearch" />
- <div class="table-list">
- <div class="table-header">
- <div class="name">机巢名称</div>
- <div class="status">机巢状态</div>
- </div>
- <div class="table-body" v-if="tableList.length > 0"
- infinite-scroll-distance="6"
- v-infinite-scroll="loadMore"
- :infinite-scroll-disabled="busy"
- infinite-scroll-immediate="true">
- <div class="table-item" v-for="item in tableList">
- <div class="name">
- <!-- <img class="yjzx-img" width="10" height="10" src="@/assets/images/home/homeLeft/table-zx.png" alt="" /> -->
- <img width="13" height="15" src="../../../assets/images/home/homeLeft/table-icon.png" alt="" />
- {{ item.nickname }}
- </div>
- <div class="status" :class="{
- 'active': item.status === 'WORKING',
- 'idle-active': item.status === 'LEISURE'
- }" @click="signMachineNestClick(item)">
- {{ item.status==='OFFLINE'?'离线中':(item.status==='WORKING'?'作业中':'空闲中') }}
- </div>
- </div>
- </div>
- <el-empty class="custom-empty" v-else>
- <template #description>
- <span class="custom-text">暂无数据</span>
- </template>
- </el-empty>
- </div>
- </div>
+ <common-title title="机巢概况" :style="{ marginLeft: pxToRem(14) }" @details="detailsFun"></common-title>
+ <div class="overview-next">
+ <MachineNestTotal @searchNickName="handleSearch" />
+ <div class="table-list">
+ <div class="table-header">
+ <div class="name">机巢名称</div>
+ <div class="status">机巢状态</div>
+ </div>
+ <!-- <div
+ class="table-body"
+ v-if="tableList.length > 0"
+ infinite-scroll-distance="6"
+ v-infinite-scroll="loadMore"
+ :infinite-scroll-disabled="busy"
+ infinite-scroll-immediate="true"
+ > -->
+ <div
+ class="table-body"
+ v-if="tableList.length > 0">
+ <div
+ class="table-item"
+ :class="[index % 2 === 1 ? '' : 'table-item-odd']"
+ v-for="(item, index) in tableList"
+ :key="index"
+ @click="signMachineNestClick(item)"
+
+ >
+ <div class="name">
+ <img class="imageicon" :src="overviewnextWay" alt="" />
+ <!-- <img class="yjzx-img" width="10" height="10" src="@/assets/images/home/homeLeft/table-zx.png" alt="" /> -->
+ <img width="13" height="15" src="../../../assets/images/home/homeLeft/table-icon.png" alt="" />
+ {{ item.nickname }}
+ </div>
+ <div
+ class="status"
+ :class="{
+ active: item.status === 'WORKING',
+ 'idle-active': item.status === 'LEISURE',
+ }"
+ >
+ {{ item.status === 'OFFLINE' ? '离线中' : item.status === 'WORKING' ? '作业中' : '空闲中' }}
+ </div>
+ </div>
+ </div>
+ <el-empty class="custom-empty" v-else>
+ <template #description>
+ <span class="custom-text">暂无数据</span>
+ </template>
+ </el-empty>
+ </div>
+ </div>
</template>
<script setup>
-import CommonTitle from '@/components/CommonTitle.vue';
-import MachineNestTotal from './components/MachineNestTotal.vue';
+import CommonTitle from '@/components/CommonTitle.vue'
+import MachineNestTotal from './components/MachineNestTotal.vue'
import { selectDevicePage } from '@/api/home/machineNest.js'
-import { useStore } from 'vuex';
+import { useStore } from 'vuex'
-const store = useStore();
+import overviewnextWay from '@/assets/images/home/homeLeft/overviewnext-way.png'
-const isMore = ref(true);
+const store = useStore()
+
+const isMore = ref(true)
// 控制加载状态
-const busy = ref(false);
-const searchText = ref('');
+const busy = ref(false)
+const searchText = ref('')
// 分页参数
const pageParams = ref({
- current: 1,
- size: 5,
- total: 0
-});
+ current: 1,
+ size: 99,
+ total: 0,
+})
// 机巢列表
-const tableList = ref([]);
+const tableList = ref([])
// 机巢列表数据
const getTableList = () => {
- const params = {
- nickname: searchText.value,
- current: pageParams.value.current,
- size: pageParams.value.size
- };
- selectDevicePage(params).then((res) => {
- if (res.data.code !== 0) return;
- if (res.data.data.records.length === 0) return (isMore.value = false);
- pageParams.value.current += 1;
- tableList.value = [...tableList.value, ...res.data.data.records];
- busy.value = false;
- });
+ const params = {
+ nickname: searchText.value,
+ current: pageParams.value.current,
+ size: pageParams.value.size,
+ }
+ selectDevicePage(params).then(res => {
+ if (res.data.code !== 0) return
+ if (res.data.data.records.length === 0) return (isMore.value = false)
+ // pageParams.value.current += 1
+ // pageParams.value.size += 5;
+ tableList.value = res.data.data.records;// [...tableList.value, ...res.data.data.records]
+ busy.value = false
+ })
}
// 加载更多数据
-const loadMore = async () => {
- busy.value = true;
- if (!isMore.value) return;
- getTableList();
-};
+// const loadMore = async () => {
+ // busy.value = true
+ // if (!isMore.value) return
+ // getTableList()
+// }
// 搜索数据
-const handleSearch = (name) => {
- searchText.value = name;
- pageParams.value.current = 1;
- tableList.value = [];
- isMore.value = true
- getTableList();
+const handleSearch = name => {
+ searchText.value = name
+ pageParams.value.current = 1
+ // pageParams.value.size = 5;
+ tableList.value = []
+ isMore.value = true
+ getTableList()
}
// 单个机巢详情
-const signMachineNestClick = (item) => {
- store.commit('setSingleUavHome', item);
+const signMachineNestClick = item => {
+ store.commit('setSingleUavHome', item)
}
const detailsFun = () => {
- store.commit('setMachineNestDetail', true);
-};
+ store.commit('setMachineNestDetail', true)
+}
onMounted(() => {
- getTableList();
-});
+ getTableList()
+})
</script>
<style scoped lang="scss">
.overview-next {
- font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
- margin-left: 29px;
- padding: 16px 16px;
- width: 390px;
- height: 414px;
- background: linear-gradient(
- 270deg,
- rgba(31, 62, 122, 0) 0%,
- rgba(31, 62, 122, 0.35) 21%,
- #1f3e7a 100%
- );
- border-radius: 0px 0px 0px 0px;
- opacity: 0.85;
- margin-bottom: 10px;
+ font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
+ margin-left: 29px;
+ padding: 16px 16px;
+ width: 390px;
+ height: 414px;
+ background: linear-gradient(270deg, rgba(31, 62, 122, 0) 0%, rgba(31, 62, 122, 0.35) 21%, #1f3e7a 100%);
+ border-radius: 0px 0px 0px 0px;
+ opacity: 0.85;
+ margin-bottom: 10px;
- .table-list {
- font-family: Source Han Sans CN, Source Han Sans CN;
- margin: 16px;
- font-weight: 500;
- font-size: 16px;
- height: 220px;
- .table-header,
- .table-item {
- display: flex;
- justify-content: space-between;
- height: 36px;
- line-height: 36px;
- padding: 0 20px;
- }
- .table-header {
- background: linear-gradient( 90deg, rgba(12,45,92,1) 0%, #0C3B78 50%, rgba(12,45,92,1) 100%), linear-gradient( 90deg, rgba(12,45,92,1) 0%, rgba(12,45,92,1) 50%, rgba(12,45,92,1) 100%);
- border-radius: 0px 0px 0px 0px;
- // border: 1px solid;
- }
- .table-body {
- height: 190px;
- overflow: auto;
- &::-webkit-scrollbar {
- width: 0;
- display: none;
- }
- -ms-overflow-style: none; /* IE and Edge */
- scrollbar-width: none; /* Firefox */
- }
- .table-item {
- position: relative;
- .yjzx-img {
- position: absolute;
- top: 14px;
- left: 10px;
- }
- .status {
- color: #fff;
- cursor: pointer;
- }
- .active {
- color: #8EFFAC;
- background: linear-gradient( 90deg, rgba(12,45,92,1) 0%, #154671 50%, rgba(12,45,92,1) 100%), linear-gradient( 90deg, rgba(12,45,92,1) 0%, rgba(12,45,92,1) 50%, rgba(12,45,92,1) 100%);
- }
- .idle-active {
- color: #FFA768;
- }
- }
- .custom-empty {
- margin: 16px 0;
- padding: 0;
- :deep(.el-empty__image) {
- width: 100px;
- height: 100px;
- }
- }
- }
+ .table-list {
+ font-family: Source Han Sans CN, Source Han Sans CN;
+ margin: 16px 16px 16px 0;
+ font-weight: 500;
+ font-size: 16px;
+ height: 220px;
+ .table-header,
+ .table-item {
+ display: flex;
+ justify-content: space-between;
+ height: 36px;
+ line-height: 36px;
+ padding: 0 20px 0 0;
+ }
+ .table-header {
+ height: 33px;
+ background: url('/src/assets/images/home/homeLeft/overviewnext-titlebg.png') no-repeat;
+ background-size: 100% 100%;
+ line-height: 33px;
+ margin-bottom: 13px;
+ .name {
+ margin-left: 46px;
+
+ }
+ }
+ .table-body {
+ height: 190px;
+ overflow: auto;
+ &::-webkit-scrollbar {
+ width: 0;
+ display: none;
+ }
+ -ms-overflow-style: none; /* IE and Edge */
+ scrollbar-width: none; /* Firefox */
+ }
+ .table-item-odd {
+ background: linear-gradient(90deg, rgba(0, 122, 255, 0) 0%, rgba(0, 98, 204, 0.3) 50%, rgba(0, 73, 153, 0) 100%);
+ }
+ .table-item:hover {
+ // content: url('/src/assets/images/home/homeLeft/overviewnext-way.png');
+ border-bottom: 1px solid;
+ border-top: 1px solid;
+
+ border-image: linear-gradient(
+ 90deg,
+ rgba(25, 162, 255, 0) 10%,
+ rgba(48, 176, 199, 1) 50%,
+ rgba(25, 162, 255, 0) 90%
+ )
+ 2 2 2 2;
+ }
+ .table-item:hover .imageicon {
+ opacity: 1;
+ }
+ .table-item {
+ position: relative;
+ cursor: pointer;
+ height: 38px;
+ border-radius: 0px 0px 0px 0px;
+ .yjzx-img {
+ position: absolute;
+ top: 14px;
+ left: 10px;
+ }
+ .name {
+ display: flex;
+ align-items: center;
+ gap: 8px; // 添加图片和文字之间的间距
+ img {
+ vertical-align: middle;
+ }
+ }
+ .status {
+ color: #fff;
+ cursor: pointer;
+ }
+ .active {
+ color: #ffa768;
+
+ }
+ .idle-active {
+ color: #8effac;
+ }
+ .imageicon {
+ object-fit: cover;
+ opacity: 0;
+ }
+ }
+ .custom-empty {
+ margin: 16px 0;
+ padding: 0;
+ :deep(.el-empty__image) {
+ width: 100px;
+ height: 100px;
+ }
+ }
+ }
}
</style>
--
Gitblit v1.9.3