|
@@ -45,29 +45,60 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <div class="map-legend" :style="{ bottom: `${inviteBottom}px` }">
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="item in mapLegendItems"
|
|
|
|
|
+ :key="item.key"
|
|
|
|
|
+ class="map-legend__item"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span class="map-legend__pill" :class="item.pillClass"></span>
|
|
|
|
|
+ <span class="map-legend__text">{{ item.label }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="invite-group" :style="{ bottom: `${inviteBottom}px` }">
|
|
|
|
|
+ <div class="invite-btn">
|
|
|
|
|
+ <img class="invite-icon" src="@/assets/img/home/user-icon.png" alt="">
|
|
|
|
|
+ 邀请农服</div>
|
|
|
|
|
+ <div class="invite-btn" @click="handleInvite('farmer')">
|
|
|
|
|
+ <img class="invite-icon" src="@/assets/img/home/user-icon.png" alt="">
|
|
|
|
|
+ 邀请农户</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<crop-alert-panel
|
|
<crop-alert-panel
|
|
|
:crop-name="currentCropName"
|
|
:crop-name="currentCropName"
|
|
|
@switch-category="handleSwitchCategory"
|
|
@switch-category="handleSwitchCategory"
|
|
|
@view-detail="handleViewDetail"
|
|
@view-detail="handleViewDetail"
|
|
|
@patrol-tip="handlePatrolTip"
|
|
@patrol-tip="handlePatrolTip"
|
|
|
|
|
+ @height-change="handlePanelHeightChange"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { computed, nextTick, onActivated, onMounted, ref } from "vue";
|
|
import { computed, nextTick, onActivated, onMounted, ref } from "vue";
|
|
|
|
|
+import { useRouter } from "vue-router";
|
|
|
import { useStore } from "vuex";
|
|
import { useStore } from "vuex";
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
|
import { LocationFilled } from "@element-plus/icons-vue";
|
|
import { LocationFilled } from "@element-plus/icons-vue";
|
|
|
import { convertPointToArray } from "@/utils/index";
|
|
import { convertPointToArray } from "@/utils/index";
|
|
|
import GrowthReportMap from "./growthReportMap.js";
|
|
import GrowthReportMap from "./growthReportMap.js";
|
|
|
import CropAlertPanel from "./components/CropAlertPanel.vue";
|
|
import CropAlertPanel from "./components/CropAlertPanel.vue";
|
|
|
|
|
+import wx from "weixin-js-sdk";
|
|
|
|
|
+
|
|
|
|
|
+const router = useRouter();
|
|
|
|
|
|
|
|
const DEFAULT_MAP_POINT = "POINT(113.6142086995688 23.585836479509055)";
|
|
const DEFAULT_MAP_POINT = "POINT(113.6142086995688 23.585836479509055)";
|
|
|
const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
|
|
const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
|
|
|
|
|
|
|
|
const menuIcon = require("@/assets/img/common/farm-active.png");
|
|
const menuIcon = require("@/assets/img/common/farm-active.png");
|
|
|
|
|
|
|
|
|
|
+const mapLegendItems = computed(() => [
|
|
|
|
|
+ { key: "zone", label: "胁迫", pillClass: "map-legend__pill--zone" },
|
|
|
|
|
+ { key: "growth", label: "长势", pillClass: "map-legend__pill--growth" },
|
|
|
|
|
+ { key: "pest", label: "病虫害", pillClass: "map-legend__pill--pest" },
|
|
|
|
|
+]);
|
|
|
|
|
+
|
|
|
const store = useStore();
|
|
const store = useStore();
|
|
|
const tabBarHeight = computed(() => store.state.home.tabBarHeight);
|
|
const tabBarHeight = computed(() => store.state.home.tabBarHeight);
|
|
|
|
|
|
|
@@ -77,6 +108,8 @@ const locationName = ref("");
|
|
|
const currentCropName = ref("水稻");
|
|
const currentCropName = ref("水稻");
|
|
|
const activeStressKey = ref("hot-drought-2");
|
|
const activeStressKey = ref("hot-drought-2");
|
|
|
const activeLayerKey = ref("growth");
|
|
const activeLayerKey = ref("growth");
|
|
|
|
|
+const panelHeight = ref(280);
|
|
|
|
|
+const inviteBottom = computed(() => panelHeight.value);
|
|
|
|
|
|
|
|
const stressMenuItems = [
|
|
const stressMenuItems = [
|
|
|
{ key: "stress", line1: "胁迫", line2: "胁迫", icon: menuIcon },
|
|
{ key: "stress", line1: "胁迫", line2: "胁迫", icon: menuIcon },
|
|
@@ -118,22 +151,52 @@ const initMap = async () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleSwitchLocation = () => {
|
|
const handleSwitchLocation = () => {
|
|
|
- ElMessage.info("切换位置功能即将开放");
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+const handleInvite = (item) => {
|
|
|
|
|
+ let inviteName = "好友";
|
|
|
|
|
+ try {
|
|
|
|
|
+ const userInfo = JSON.parse(localStorage.getItem("localUserInfo") || "{}");
|
|
|
|
|
+ inviteName = userInfo.nickName || userInfo.userName || userInfo.name || inviteName;
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ // ignore
|
|
|
|
|
+ }
|
|
|
|
|
+ const query = {
|
|
|
|
|
+ askInfo: { title: "邀请完善信息", content: "是否分享该邀请给好友" },
|
|
|
|
|
+ shareText: "邀请您完善地块种植信息",
|
|
|
|
|
+ targetUrl: `entry_information`,
|
|
|
|
|
+ paramsPage: JSON.stringify({ inviteName }),
|
|
|
|
|
+ imageUrl: 'https://birdseye-img.sysuimars.com/temp/field.png',
|
|
|
|
|
+ };
|
|
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
|
|
+ url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const handleSwitchCategory = (cropName) => {
|
|
const handleSwitchCategory = (cropName) => {
|
|
|
if (!cropName) return;
|
|
if (!cropName) return;
|
|
|
currentCropName.value = cropName;
|
|
currentCropName.value = cropName;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const handleViewDetail = () => {
|
|
|
|
|
- ElMessage.info("详情功能即将开放");
|
|
|
|
|
|
|
+const handleViewDetail = (item) => {
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/alert_detail",
|
|
|
|
|
+ query: {
|
|
|
|
|
+ title: item?.title || "具体预警",
|
|
|
|
|
+ content: item?.content || "",
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handlePatrolTip = () => {
|
|
const handlePatrolTip = () => {
|
|
|
ElMessage.info("巡园要点功能即将开放");
|
|
ElMessage.info("巡园要点功能即将开放");
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const handlePanelHeightChange = (height) => {
|
|
|
|
|
+ panelHeight.value = Number(height) || 0;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getLocationName();
|
|
getLocationName();
|
|
|
initMap();
|
|
initMap();
|
|
@@ -243,6 +306,108 @@ onActivated(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ .invite-group {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ right: 16px;
|
|
|
|
|
+ z-index: 20;
|
|
|
|
|
+ pointer-events: none;
|
|
|
|
|
+ transition: bottom 0.2s ease;
|
|
|
|
|
+
|
|
|
|
|
+ .invite-btn {
|
|
|
|
|
+ pointer-events: auto;
|
|
|
|
|
+ height: 32px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.1);
|
|
|
|
|
+ gap: 4px;
|
|
|
|
|
+ padding: 0 8px;
|
|
|
|
|
+ color: #2199F8;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ .invite-icon {
|
|
|
|
|
+ width: 16px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .invite-btn + .invite-btn {
|
|
|
|
|
+ margin-top: 10px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ .map-legend {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ left: 10px;
|
|
|
|
|
+ z-index: 20;
|
|
|
|
|
+ pointer-events: none;
|
|
|
|
|
+ transition: bottom 0.2s ease;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+ padding: 4px 10px;
|
|
|
|
|
+ background: rgba(0, 0, 0, 0.46);
|
|
|
|
|
+ backdrop-filter: blur(4px);
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+
|
|
|
|
|
+ &--en {
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ align-items: flex-start;
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+ padding: 8px 10px;
|
|
|
|
|
+ background: rgba(0, 0, 0, 0.72);
|
|
|
|
|
+ border-radius: 6px;
|
|
|
|
|
+
|
|
|
|
|
+ .map-legend__item {
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .map-legend__pill {
|
|
|
|
|
+ width: 18px;
|
|
|
|
|
+ height: 4px;
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .map-legend__text {
|
|
|
|
|
+ font-size: 11px;
|
|
|
|
|
+ line-height: 1.2;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &__item {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 5px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &__pill {
|
|
|
|
|
+ width: 16px;
|
|
|
|
|
+ height: 5px;
|
|
|
|
|
+ border-radius: 10px;
|
|
|
|
|
+
|
|
|
|
|
+ &--zone {
|
|
|
|
|
+ background: #13a27f;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &--growth {
|
|
|
|
|
+ background: #ff9138;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &--pest {
|
|
|
|
|
+ background: #e62e2d;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &__text {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.report-content {
|
|
.report-content {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
height: 100%;
|
|
height: 100%;
|