|
|
@@ -67,7 +67,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="invite-group">
|
|
|
- <div class="invite-btn">
|
|
|
+ <div class="invite-btn" @click="handleLocateToCenter">
|
|
|
<img class="current-icon" src="@/assets/img/home/current.png" alt="">
|
|
|
</div>
|
|
|
<div class="invite-btn" @click="handleInvite('service')">
|
|
|
@@ -92,17 +92,13 @@
|
|
|
@zone-change="handleZoneChange" @height-change="handlePanelHeightChange" />
|
|
|
</div>
|
|
|
|
|
|
- <!-- 录入信息邀请弹窗:分享链接带 showInviteEntry 时展示 -->
|
|
|
- <invite-entry-popup ref="invitePopupRef" />
|
|
|
-
|
|
|
-
|
|
|
<!-- 恢复种植弹窗 -->
|
|
|
<restore-planting-popup />
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { computed, nextTick, onActivated, onMounted, ref } from "vue";
|
|
|
-import { useRoute, useRouter } from "vue-router";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
import { useStore } from "vuex";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { ArrowRight, Close, LocationFilled } from "@element-plus/icons-vue";
|
|
|
@@ -110,14 +106,12 @@ import { convertPointToArray } from "@/utils/index";
|
|
|
import { fetchRegeo, toLocationParam } from "@/utils/tiandituLocation";
|
|
|
import GrowthReportMap from "./growthReportMap.js";
|
|
|
import CropAlertPanel from "./components/CropAlertPanel.vue";
|
|
|
-import inviteEntryPopup from "@/views/old_mini/entry_information/components/inviteEntryPopup.vue";
|
|
|
import wx from "weixin-js-sdk";
|
|
|
|
|
|
import { base_img_url3 } from "@/api/config";
|
|
|
import restorePlantingPopup from "@/components/popup/restorePlantingPopup.vue";
|
|
|
|
|
|
const router = useRouter();
|
|
|
-const route = useRoute();
|
|
|
|
|
|
const DEFAULT_MAP_POINT = "POINT(113.6142086995688 23.585836479509055)";
|
|
|
const LOCATION_SESSION_KEY = "GROWTH_REPORT_LOCATION";
|
|
|
@@ -162,7 +156,6 @@ const activeMenuKey = ref("");
|
|
|
const activeLegendUrl = ref("");
|
|
|
const panelHeight = ref(280);
|
|
|
const inviteBottom = computed(() => panelHeight.value);
|
|
|
-const invitePopupRef = ref(null);
|
|
|
/** 防止切换农场/分区时旧请求回写 */
|
|
|
let mapCalcToken = 0;
|
|
|
|
|
|
@@ -701,6 +694,18 @@ function syncMapFromSelectedFarm() {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+/** 定位按钮:地图回到农场 / 用户点位中心 */
|
|
|
+const handleLocateToCenter = () => {
|
|
|
+ if (!growthReportMap.kmap) return;
|
|
|
+ const point = resolveMapCenterPoint() || currentMapPoint.value;
|
|
|
+ if (!point) return;
|
|
|
+ saveCurrentMapPoint(point);
|
|
|
+ const coordinate = convertPointToArray(point)?.map(Number);
|
|
|
+ if (coordinate?.length === 2) {
|
|
|
+ growthReportMap.setMapPosition(coordinate);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const handleSwitchFarm = () => {
|
|
|
router.push("/all_garden");
|
|
|
};
|
|
|
@@ -748,104 +753,15 @@ const handleInvite = (type) => {
|
|
|
const query = {
|
|
|
askInfo: { title: "邀请完善信息", content: "是否分享该邀请给好友" },
|
|
|
shareText: isService ? "邀请您完善农服信息" : "邀请您完善地块种植信息",
|
|
|
- targetUrl: `growth_report`,
|
|
|
- paramsPage: JSON.stringify({ inviteName, showInviteEntry: 1, inviteType, adminId }),
|
|
|
- imageUrl: 'https://birdseye-img.sysuimars.com/temp/field.png',
|
|
|
+ targetUrl: `invite_welcome`,
|
|
|
+ paramsPage: JSON.stringify({ inviteName, inviteType, adminId }),
|
|
|
+ imageUrl: 'https://birdseye-img.sysuimars.com/farm-h5/field.png',
|
|
|
};
|
|
|
wx.miniProgram.navigateTo({
|
|
|
url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function isTruthyFlag(value) {
|
|
|
- return value === 1 || value === "1" || value === true || value === "true";
|
|
|
-}
|
|
|
-
|
|
|
-function parseMaybeJson(value) {
|
|
|
- if (!value) return null;
|
|
|
- if (typeof value === "object") return value;
|
|
|
- try {
|
|
|
- return JSON.parse(value);
|
|
|
- } catch {
|
|
|
- return null;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function getInviteTypeFromRoute() {
|
|
|
- const candidates = [
|
|
|
- route.query.inviteType,
|
|
|
- parseMaybeJson(route.query.paramsPage)?.inviteType,
|
|
|
- parseMaybeJson(route.query.miniJson)?.inviteType,
|
|
|
- parseMaybeJson(parseMaybeJson(route.query.miniJson)?.paramsPage)?.inviteType,
|
|
|
- ];
|
|
|
- return candidates.find((item) => item === "service" || item === "farmer") || "farmer";
|
|
|
-}
|
|
|
-
|
|
|
-function getAdminIdFromRoute() {
|
|
|
- const candidates = [
|
|
|
- route.query.adminId,
|
|
|
- parseMaybeJson(route.query.paramsPage)?.adminId,
|
|
|
- parseMaybeJson(route.query.miniJson)?.adminId,
|
|
|
- parseMaybeJson(parseMaybeJson(route.query.miniJson)?.paramsPage)?.adminId,
|
|
|
- ];
|
|
|
- return candidates.find((item) => item != null && item !== "") || "";
|
|
|
-}
|
|
|
-
|
|
|
-function shouldShowInviteEntryPopup() {
|
|
|
- if (isTruthyFlag(route.query.showInviteEntry)) return true;
|
|
|
-
|
|
|
- const miniJson = parseMaybeJson(route.query.miniJson);
|
|
|
- if (miniJson) {
|
|
|
- if (isTruthyFlag(miniJson.showInviteEntry)) return true;
|
|
|
- const nested = parseMaybeJson(miniJson.paramsPage);
|
|
|
- if (isTruthyFlag(nested?.showInviteEntry)) return true;
|
|
|
- }
|
|
|
-
|
|
|
- const paramsPage = parseMaybeJson(route.query.paramsPage);
|
|
|
- if (isTruthyFlag(paramsPage?.showInviteEntry)) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
-function clearInviteEntryQuery() {
|
|
|
- if (!shouldShowInviteEntryPopup()) return;
|
|
|
- const newQuery = { ...(route.query || {}) };
|
|
|
- delete newQuery.showInviteEntry;
|
|
|
- delete newQuery.adminId;
|
|
|
- if (newQuery.paramsPage) {
|
|
|
- const paramsPage = parseMaybeJson(newQuery.paramsPage);
|
|
|
- if (paramsPage && typeof paramsPage === "object") {
|
|
|
- delete paramsPage.showInviteEntry;
|
|
|
- newQuery.paramsPage = JSON.stringify(paramsPage);
|
|
|
- }
|
|
|
- }
|
|
|
- if (newQuery.miniJson) {
|
|
|
- const miniJson = parseMaybeJson(newQuery.miniJson);
|
|
|
- if (miniJson && typeof miniJson === "object") {
|
|
|
- delete miniJson.showInviteEntry;
|
|
|
- if (miniJson.paramsPage) {
|
|
|
- const nested = parseMaybeJson(miniJson.paramsPage);
|
|
|
- if (nested && typeof nested === "object") {
|
|
|
- delete nested.showInviteEntry;
|
|
|
- miniJson.paramsPage = JSON.stringify(nested);
|
|
|
- }
|
|
|
- }
|
|
|
- newQuery.miniJson = JSON.stringify(miniJson);
|
|
|
- }
|
|
|
- }
|
|
|
- router.replace({ path: route.path, query: newQuery });
|
|
|
-}
|
|
|
-
|
|
|
-function tryOpenInviteEntryPopup() {
|
|
|
- if (!shouldShowInviteEntryPopup()) return;
|
|
|
- const inviteType = getInviteTypeFromRoute();
|
|
|
- const adminId = getAdminIdFromRoute();
|
|
|
- nextTick(() => {
|
|
|
- invitePopupRef.value?.open(inviteType, adminId);
|
|
|
- clearInviteEntryQuery();
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
const handlePanelHeightChange = (height) => {
|
|
|
panelHeight.value = Number(height) || 0;
|
|
|
};
|
|
|
@@ -857,7 +773,6 @@ onMounted(() => {
|
|
|
// initMap();
|
|
|
// fetchFarmRangeStatus();
|
|
|
// fetchInteractTask();
|
|
|
- // tryOpenInviteEntryPopup();
|
|
|
});
|
|
|
onActivated(() => {
|
|
|
syncSelectedFarmId();
|
|
|
@@ -866,7 +781,6 @@ onActivated(() => {
|
|
|
initMap();
|
|
|
fetchFarmRangeStatus();
|
|
|
// fetchInteractTask();
|
|
|
- tryOpenInviteEntryPopup();
|
|
|
});
|
|
|
</script>
|
|
|
|