|
|
@@ -7,17 +7,20 @@
|
|
|
v-model:height="height"
|
|
|
:anchors="anchors"
|
|
|
:content-draggable="true"
|
|
|
+ :safe-area-inset-bottom="false"
|
|
|
@height-change="handleHeightChange"
|
|
|
>
|
|
|
<div class="floating-panel-content">
|
|
|
<div class="panel-shell" ref="panelShellRef">
|
|
|
<div class="crop-header">
|
|
|
<div class="crop-info">
|
|
|
- <el-avatar class="crop-avatar" :size="24" :src="resolvedCropAvatar" />
|
|
|
- <span class="crop-name">{{ currentCropName }}</span>
|
|
|
- <span class="crop-badge">当前作物</span>
|
|
|
+ <el-avatar class="crop-avatar" shape="square" :size="42" :src="resolvedCropAvatar" />
|
|
|
+ <div class="crop-detail">
|
|
|
+ <div class="crop-name">{{ currentCropName }}</div>
|
|
|
+ <div class="crop-subtitle">花芽分化期</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div v-if="hasFarm" class="switch-wrap">
|
|
|
+ <div class="switch-wrap">
|
|
|
<el-tooltip
|
|
|
v-model:visible="cropMenuVisible"
|
|
|
placement="bottom"
|
|
|
@@ -69,7 +72,7 @@
|
|
|
class="alert-generating"
|
|
|
v-loading="true"
|
|
|
element-loading-text="报告生成中,请稍后..."
|
|
|
- element-loading-background="rgba(255, 255, 255, 0.9)"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.5)"
|
|
|
></div>
|
|
|
<template v-else>
|
|
|
<div
|
|
|
@@ -78,23 +81,25 @@
|
|
|
class="alert-card"
|
|
|
>
|
|
|
<div class="alert-card__header">
|
|
|
- <div class="alert-card__title-wrap">
|
|
|
+ <div class="alert-card__category">
|
|
|
<img class="alert-card__icon" :src="item.icon" alt="" />
|
|
|
- <span class="alert-card__title">{{ item.title }}</span>
|
|
|
+ <span>{{ item.category }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="alert-card__level">
|
|
|
+ <span class="alert-card__level-dot"></span>
|
|
|
+ <span>{{ item.riskLevel }}</span>
|
|
|
</div>
|
|
|
- <span class="alert-card__link" @click="handleViewDetail(item)">
|
|
|
- 查看详情
|
|
|
- </span>
|
|
|
</div>
|
|
|
- <div class="alert-card__content-wrap">
|
|
|
- <span class="alert-card__content">{{ item.content }}</span>
|
|
|
- <span
|
|
|
- v-if="hasFarm && item.patrolTip && item.title !== '正常气象'"
|
|
|
- class="alert-card__patrol"
|
|
|
- @click="handlePatrolTip(item)"
|
|
|
- >
|
|
|
- <el-icon class="alert-card__patrol-icon"><Link /></el-icon>
|
|
|
- <span>{{ item.patrolTip }}</span>
|
|
|
+ <div class="alert-card__name">{{ item.title || "—" }}</div>
|
|
|
+ <div class="alert-card__metric">
|
|
|
+ <span class="alert-card__metric-num">{{ item.metricValue }}</span>
|
|
|
+ <span class="alert-card__metric-unit">{{ item.metricUnit }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="alert-card__advice">{{ item.content || "—" }}</div>
|
|
|
+ <div class="alert-card__footer">
|
|
|
+ <span class="alert-card__time">{{ item.timeText }}</span>
|
|
|
+ <span class="alert-card__link" @click="handleViewDetail(item)">
|
|
|
+ 详情 >
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -108,7 +113,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { FloatingPanel } from "vant";
|
|
|
-import { CaretBottom, Link } from "@element-plus/icons-vue";
|
|
|
+import { CaretBottom } from "@element-plus/icons-vue";
|
|
|
import { computed, nextTick, onActivated, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
|
import { useStore } from "vuex";
|
|
|
import { useI18n } from "@/i18n";
|
|
|
@@ -158,8 +163,16 @@ const activeIndex = ref(0);
|
|
|
|
|
|
const emit = defineEmits(["viewDetail", "heightChange", "zoneChange"]);
|
|
|
|
|
|
-const weatherIcon = require("@/assets/img/report/weather.png");
|
|
|
+const weatherIcon = require("@/assets/img/report/icon-weather.png");
|
|
|
+const stressIcon = require("@/assets/img/report/icon-warning.png");
|
|
|
const DEFAULT_CROP_AVATAR = "https://birdseye-img.sysuimars.com/dinggou-mini/defalut-icon.png";
|
|
|
+/** 卡片占位文案(接口字段待补) */
|
|
|
+const PLACEHOLDER = {
|
|
|
+ riskLevel: "待完善",
|
|
|
+ metricValue: "8",
|
|
|
+ metricUnit: "待完善",
|
|
|
+ timeText: "待完善待完善待完善",
|
|
|
+};
|
|
|
/** 当前作物名 → 品类图标 */
|
|
|
const CROP_ICON_MAP = {
|
|
|
水稻: require("@/assets/img/type_icon/水稻.png"),
|
|
|
@@ -167,12 +180,18 @@ const CROP_ICON_MAP = {
|
|
|
荔枝: require("@/assets/img/type_icon/荔枝.png"),
|
|
|
};
|
|
|
|
|
|
-/** 底部 tabBar 高度(含小程序安全区),优先读 DOM / store */
|
|
|
+/** 面板 bottom:取 tabBar 顶边距视口底的距离,避免 offsetHeight 偏差留缝 */
|
|
|
const resolveTabBarHeight = () => {
|
|
|
- const fromDom = document.querySelector(".van-tabbar")?.offsetHeight;
|
|
|
+ const el = document.querySelector(".van-tabbar");
|
|
|
+ if (el) {
|
|
|
+ const rect = el.getBoundingClientRect();
|
|
|
+ if (rect.height > 0) {
|
|
|
+ return Math.max(0, Math.round(window.innerHeight - rect.top));
|
|
|
+ }
|
|
|
+ }
|
|
|
const fromStore = Number(store.state.home.tabBarHeight) || 0;
|
|
|
const fromStorage = Number(localStorage.getItem("tabBarHeight")) || 0;
|
|
|
- return fromDom || fromStore || fromStorage || 50;
|
|
|
+ return fromStore || fromStorage || 50;
|
|
|
};
|
|
|
|
|
|
const tabBarHeight = ref(resolveTabBarHeight());
|
|
|
@@ -249,7 +268,7 @@ const dismissGuide = () => {
|
|
|
};
|
|
|
|
|
|
const tryShowGuide = () => {
|
|
|
- if (!hasFarm.value) return;
|
|
|
+ // if (!hasFarm.value) return;
|
|
|
if (localStorage.getItem(GUIDE_STORAGE_KEY)) return;
|
|
|
guideVisible.value = true;
|
|
|
};
|
|
|
@@ -288,8 +307,8 @@ const handleSelectCrop = (index) => {
|
|
|
fetchAlertCards();
|
|
|
};
|
|
|
|
|
|
-const PANEL_HEADER_BAR = 14; // van-floating-panel 原生 header 高度
|
|
|
-const PANEL_BOTTOM_GAP = 12;
|
|
|
+/** header 已 display:none,不再计入;留少量 buffer 避免 overflow 出滚动条 */
|
|
|
+const PANEL_HEIGHT_BUFFER = 8;
|
|
|
/** 收起态:仅作物头,高度不含 tabBar(tabBar 用 bottom 顶开) */
|
|
|
const COLLAPSED_CONTENT_HEIGHT = 72;
|
|
|
|
|
|
@@ -317,7 +336,7 @@ const syncMidAnchor = () => {
|
|
|
|
|
|
// scrollHeight 才是内容真实高度;offsetHeight 在被裁切时会偏小
|
|
|
const contentH = shell.scrollHeight;
|
|
|
- const idealMid = Math.round(contentH + PANEL_HEADER_BAR + PANEL_BOTTOM_GAP);
|
|
|
+ const idealMid = Math.round(contentH + PANEL_HEIGHT_BUFFER);
|
|
|
// 留一点顶部空间,并扣掉底部 tabBar
|
|
|
const maxMid = Math.round(window.innerHeight - tabBarHeight.value) - 48;
|
|
|
const nextMid = Math.max(collapsed + 80, Math.min(idealMid, maxMid));
|
|
|
@@ -357,19 +376,27 @@ const alertCards = ref([
|
|
|
{
|
|
|
id: CARD_ID.WARNING,
|
|
|
source: "warning",
|
|
|
+ category: "气象预警",
|
|
|
title: "",
|
|
|
icon: weatherIcon,
|
|
|
content: "",
|
|
|
- patrolTip: "",
|
|
|
+ riskLevel: PLACEHOLDER.riskLevel,
|
|
|
+ metricValue: PLACEHOLDER.metricValue,
|
|
|
+ metricUnit: PLACEHOLDER.metricUnit,
|
|
|
+ timeText: PLACEHOLDER.timeText,
|
|
|
},
|
|
|
{
|
|
|
id: CARD_ID.STRESS,
|
|
|
source: "stress",
|
|
|
type: "abnormal",
|
|
|
+ category: "未来胁迫",
|
|
|
title: "",
|
|
|
- icon: weatherIcon,
|
|
|
+ icon: stressIcon,
|
|
|
content: "",
|
|
|
- patrolTip: "异常态势巡园要点",
|
|
|
+ riskLevel: PLACEHOLDER.riskLevel,
|
|
|
+ metricValue: PLACEHOLDER.metricValue,
|
|
|
+ metricUnit: PLACEHOLDER.metricUnit,
|
|
|
+ timeText: PLACEHOLDER.timeText,
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
@@ -609,16 +636,6 @@ const handleViewDetail = (item) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const handlePatrolTip = (item) => {
|
|
|
- const isAbnormal = item?.type === "abnormal";
|
|
|
- router.push({
|
|
|
- path: isAbnormal ? "/abnormal_track" : "/growth_track",
|
|
|
- query: {
|
|
|
- id: item.id,
|
|
|
- },
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
const handleHeightChange = ({ height: nextHeight }) => {
|
|
|
isBackground.value = nextHeight < anchors.value[1];
|
|
|
emitPanelHeight(nextHeight);
|
|
|
@@ -676,12 +693,20 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
}
|
|
|
|
|
|
.floating-panel {
|
|
|
- background: transparent;
|
|
|
+ // 展开态同色铺底,避免与 tabBar 之间透出地图缝
|
|
|
+ background: #141416;
|
|
|
+ border-radius: 14px 14px 0 0;
|
|
|
+ --van-floating-panel-header-height: 0px;
|
|
|
+
|
|
|
+ &.background-panel {
|
|
|
+ background: transparent;
|
|
|
+ }
|
|
|
|
|
|
::v-deep {
|
|
|
.van-floating-panel__header {
|
|
|
background: transparent;
|
|
|
- height: 16px;
|
|
|
+ display: none;
|
|
|
+ height: 0;
|
|
|
}
|
|
|
|
|
|
.van-floating-panel__header-bar {
|
|
|
@@ -693,13 +718,12 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
|
|
|
.van-floating-panel__content {
|
|
|
background: transparent;
|
|
|
-
|
|
|
overflow-y: auto;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.floating-panel-content {
|
|
|
- width: calc(100% - 20px);
|
|
|
+ width: 100%;
|
|
|
margin: 0 auto;
|
|
|
// margin: 14px auto 0; // 补偿隐藏 header 的 10px,原本30px,整体下移
|
|
|
box-sizing: border-box;
|
|
|
@@ -707,17 +731,19 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
|
|
|
.panel-shell {
|
|
|
padding: 12px;
|
|
|
- border-radius: 16px;
|
|
|
- background: linear-gradient(180deg, #b2dbfb 0%, #cbe8ff 100%);
|
|
|
+ border-radius: 14px 14px 0 0;
|
|
|
+ background: #141416;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
.crop-header {
|
|
|
+ height: 42px;
|
|
|
+ box-sizing: border-box;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
gap: 10px;
|
|
|
- margin-bottom: 10px;
|
|
|
+ margin-bottom: 8px;
|
|
|
}
|
|
|
|
|
|
.crop-info {
|
|
|
@@ -734,9 +760,13 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
.crop-name {
|
|
|
font-size: 18px;
|
|
|
font-weight: 500;
|
|
|
- color: #000000;
|
|
|
+ color: #FFFFFF;
|
|
|
line-height: 26px;
|
|
|
}
|
|
|
+ .crop-subtitle {
|
|
|
+ color: rgba(255, 255, 255, 0.5);
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
|
|
|
.crop-badge {
|
|
|
flex-shrink: 0;
|
|
|
@@ -763,7 +793,8 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
width: 216px;
|
|
|
padding: 6px 10px;
|
|
|
border-radius: 6px;
|
|
|
- background: rgba(0, 0, 0, 0.8);
|
|
|
+ background: rgba(73, 73, 73, 0.8);
|
|
|
+ backdrop-filter: blur(4px);
|
|
|
box-sizing: border-box;
|
|
|
z-index: 20;
|
|
|
pointer-events: auto;
|
|
|
@@ -776,20 +807,20 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
height: 0;
|
|
|
border-left: 6px solid transparent;
|
|
|
border-right: 6px solid transparent;
|
|
|
- border-bottom: 6px solid rgba(0, 0, 0, 0.8);
|
|
|
+ border-bottom: 6px solid rgba(73, 73, 73, 0.8);
|
|
|
}
|
|
|
|
|
|
&__content {
|
|
|
font-size: 14px;
|
|
|
line-height: 22px;
|
|
|
- color: #fff;
|
|
|
+ color: rgba(255, 255, 255, 0.9);
|
|
|
word-break: break-all;
|
|
|
text-align: justify;
|
|
|
}
|
|
|
|
|
|
&__crop {
|
|
|
padding: 0 2px;
|
|
|
- color: #2199f8;
|
|
|
+ color: #FFD489;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -801,19 +832,18 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
height: 28px;
|
|
|
padding: 0 10px;
|
|
|
border-radius: 14px;
|
|
|
- border: 1px solid #2199f8;
|
|
|
- background: #fff;
|
|
|
- color: #2199f8;
|
|
|
+ background: rgba(255, 255, 255, 0.05);
|
|
|
+ color: #fff;
|
|
|
font-size: 12px;
|
|
|
|
|
|
- &.is-open {
|
|
|
- border-color: #2199f8;
|
|
|
- box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.15);
|
|
|
- }
|
|
|
+ // &.is-open {
|
|
|
+ // border-color: #2199f8;
|
|
|
+ // box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.15);
|
|
|
+ // }
|
|
|
|
|
|
&__icon {
|
|
|
font-size: 14px;
|
|
|
- color: #2199f8;
|
|
|
+ color: #fff;
|
|
|
transition: transform 0.3s ease;
|
|
|
}
|
|
|
.is-open-icon {
|
|
|
@@ -823,100 +853,163 @@ defineExpose({ refreshAlerts: fetchAlertCards, refreshZones: fetchZones, reloadF
|
|
|
|
|
|
.alert-list {
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
- gap: 10px;
|
|
|
+ flex-direction: row;
|
|
|
+ gap: 12px;
|
|
|
+ padding-top: 8px;
|
|
|
+ border-top: 1px solid rgba(255, 255, 255, 0.06);
|
|
|
:deep(.el-loading-spinner) {
|
|
|
top: 38%;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.alert-generating {
|
|
|
- min-height: 120px;
|
|
|
+ flex: 1;
|
|
|
+ min-height: 140px;
|
|
|
padding: 14px 12px;
|
|
|
border-radius: 12px;
|
|
|
- background: #fff;
|
|
|
+ background: #1c1c1e;
|
|
|
box-sizing: border-box;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
font-size: 14px;
|
|
|
- color: #86909c;
|
|
|
+ color: rgba(255, 255, 255, 0.5);
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.alert-card {
|
|
|
- padding: 12px;
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ padding: 10px 10px 8px;
|
|
|
border-radius: 12px;
|
|
|
- background: #fff;
|
|
|
+ border: 1px solid rgba(255, 255, 255, 0.08);
|
|
|
+ background: #1c1c1e;
|
|
|
box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
|
|
|
&__header {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
- gap: 8px;
|
|
|
+ gap: 4px;
|
|
|
}
|
|
|
|
|
|
- &__title-wrap {
|
|
|
+ &__category {
|
|
|
display: flex;
|
|
|
- align-items: flex-end;
|
|
|
- gap: 6px;
|
|
|
+ align-items: center;
|
|
|
+ gap: 4px;
|
|
|
min-width: 0;
|
|
|
+ font-size: 12px;
|
|
|
+ color: rgba(255, 255, 255, 0.6);
|
|
|
}
|
|
|
|
|
|
&__icon {
|
|
|
- width: 17px;
|
|
|
- height: 17px;
|
|
|
+ width: 12px;
|
|
|
flex-shrink: 0;
|
|
|
+ object-fit: contain;
|
|
|
}
|
|
|
|
|
|
- &__title {
|
|
|
- font-size: 14px;
|
|
|
- font-weight: 500;
|
|
|
- color: #000000;
|
|
|
+ &__level {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 4px;
|
|
|
+ flex-shrink: 0;
|
|
|
+ font-size: 12px;
|
|
|
+ color: rgba(255, 255, 255, 0.6);
|
|
|
}
|
|
|
|
|
|
- &__link {
|
|
|
+ &__level-dot {
|
|
|
+ width: 6px;
|
|
|
+ height: 6px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #FF9F5A;
|
|
|
flex-shrink: 0;
|
|
|
- font-size: 12px;
|
|
|
- color: #2199f8;
|
|
|
}
|
|
|
|
|
|
- &__content-wrap {
|
|
|
- margin-top: 8px;
|
|
|
+ &__name {
|
|
|
+ margin-top: 6px;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 24px;
|
|
|
+ color: #fff;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
|
|
|
- &__content {
|
|
|
- font-size: 14px;
|
|
|
- line-height: 21px;
|
|
|
- color: rgba(6, 6, 6, 0.5);
|
|
|
- word-break: break-all;
|
|
|
+ &__metric {
|
|
|
+ margin-top: 6px;
|
|
|
+ display: flex;
|
|
|
+ align-items: baseline;
|
|
|
+ gap: 4px;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__metric-num {
|
|
|
+ font-size: 28px;
|
|
|
+ font-weight: 700;
|
|
|
+ line-height: 34px;
|
|
|
+ color: #fff;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__metric-unit {
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 16px;
|
|
|
+ color: rgba(255, 255, 255, 0.45);
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
|
|
|
- &__patrol {
|
|
|
- padding-left: 6px;
|
|
|
- display: inline-flex;
|
|
|
+ &__advice {
|
|
|
+ margin-top: 4px;
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 18px;
|
|
|
+ color: rgba(255, 255, 255, 0.45);
|
|
|
+ // overflow: hidden;
|
|
|
+ // text-overflow: ellipsis;
|
|
|
+ // white-space: nowrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__footer {
|
|
|
+ margin-top: 8px;
|
|
|
+ padding-top: 8px;
|
|
|
+ border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
|
+ display: flex;
|
|
|
align-items: center;
|
|
|
- gap: 4px;
|
|
|
- font-size: 14px;
|
|
|
- color: #2199f8;
|
|
|
- text-decoration: underline;
|
|
|
- text-underline-offset: 4px;
|
|
|
+ justify-content: space-between;
|
|
|
+ gap: 6px;
|
|
|
}
|
|
|
|
|
|
- &__patrol-icon {
|
|
|
- font-size: 16px;
|
|
|
+ &__time {
|
|
|
+ min-width: 0;
|
|
|
+ font-size: 11px;
|
|
|
+ line-height: 16px;
|
|
|
+ color: rgba(255, 255, 255, 0.4);
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__link {
|
|
|
+ flex-shrink: 0;
|
|
|
+ font-size: 11px;
|
|
|
+ line-height: 16px;
|
|
|
+ color: rgba(255, 255, 255, 0.45);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&.background-panel {
|
|
|
|
|
|
.panel-shell {
|
|
|
- padding: 6px 10px 10px 10px;
|
|
|
- background: url("@/assets/img/report/type-bg.png");
|
|
|
- background-size: calc(100vw - 20px) 40px;
|
|
|
- background-repeat: no-repeat;
|
|
|
- background-position: center top;
|
|
|
+ // padding: 6px 10px 10px 10px;
|
|
|
+ // background: url("@/assets/img/report/type-bg.png");
|
|
|
+ // background-size: calc(100vw - 20px) 40px;
|
|
|
+ // background-repeat: no-repeat;
|
|
|
+ // background-position: center top;
|
|
|
+ height: 66px;
|
|
|
+ border-radius: 14px;
|
|
|
.crop-header {
|
|
|
// padding-bottom: 60px;
|
|
|
}
|