|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="growth-track-page">
|
|
<div class="growth-track-page">
|
|
|
<custom-header
|
|
<custom-header
|
|
|
- :name="t('agriFile.workName')"
|
|
|
|
|
|
|
+ :name="pageTitle"
|
|
|
:isGoBack="!isFromShare"
|
|
:isGoBack="!isFromShare"
|
|
|
:isClose="isFromShare"
|
|
:isClose="isFromShare"
|
|
|
:showClose="false"
|
|
:showClose="false"
|
|
@@ -32,7 +32,7 @@
|
|
|
<template v-if="!isAbnormal">
|
|
<template v-if="!isAbnormal">
|
|
|
<div class="growth-content">
|
|
<div class="growth-content">
|
|
|
<div class="growth-content__title">{{ t("agriFile.agriAssessment") }}</div>
|
|
<div class="growth-content__title">{{ t("agriFile.agriAssessment") }}</div>
|
|
|
- <div class="growth-content__desc">{{ t("agriFile.agriAssessmentDesc") }}</div>
|
|
|
|
|
|
|
+ <div class="growth-content__desc">{{ assessmentDesc }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="interact-card">
|
|
<div class="interact-card">
|
|
|
<div class="interact-card__head">
|
|
<div class="interact-card__head">
|
|
@@ -42,7 +42,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="interact-card__qa">
|
|
<div class="interact-card__qa">
|
|
|
- <div class="interact-card__question">{{ t("agriFile.interactQuestionText") }}</div>
|
|
|
|
|
|
|
+ <div class="interact-card__question">{{ interactProblem }}</div>
|
|
|
<div class="interact-card__options">
|
|
<div class="interact-card__options">
|
|
|
<div v-for="item in interactOptions" :key="item.id" class="interact-option"
|
|
<div v-for="item in interactOptions" :key="item.id" class="interact-option"
|
|
|
:class="{ selected: selectedOptionId === item.id }" @click="selectedOptionId = item.id">
|
|
:class="{ selected: selectedOptionId === item.id }" @click="selectedOptionId = item.id">
|
|
@@ -53,12 +53,21 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="interact-card__ref">
|
|
<div class="interact-card__ref">
|
|
|
<span class="interact-card__ref-label">{{ t("agriFile.referenceImage") }}</span>
|
|
<span class="interact-card__ref-label">{{ t("agriFile.referenceImage") }}</span>
|
|
|
- <img class="interact-card__ref-img" src="@/assets/img/agricultural/patrol-guide.png" alt="" />
|
|
|
|
|
|
|
+ <!-- <img class="interact-card__ref-img" :src="guideImage" alt="" /> -->
|
|
|
|
|
+ <photo-provider :photo-closable="true">
|
|
|
|
|
+ <photo-consumer :src="guideImage">
|
|
|
|
|
+ <img class="interact-card__ref-img" :src="guideImage" alt="" />
|
|
|
|
|
+ </photo-consumer>
|
|
|
|
|
+ </photo-provider>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="guide-card">
|
|
<div class="guide-card">
|
|
|
<div class="guide-title">{{ t("agriFile.patrolGuide") }}</div>
|
|
<div class="guide-title">{{ t("agriFile.patrolGuide") }}</div>
|
|
|
- <img class="guide-card__img" src="@/assets/img/agricultural/patrol-guide.png" alt="" />
|
|
|
|
|
|
|
+ <photo-provider :photo-closable="true">
|
|
|
|
|
+ <photo-consumer :src="guideImage">
|
|
|
|
|
+ <img class="guide-card__img" :src="guideImage" alt="" />
|
|
|
|
|
+ </photo-consumer>
|
|
|
|
|
+ </photo-provider>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div v-else>
|
|
<div v-else>
|
|
@@ -99,7 +108,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { computed, nextTick, onActivated, ref } from "vue";
|
|
|
|
|
|
|
+import { computed, nextTick, onActivated, onMounted, ref } from "vue";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
import { Icon } from 'vant';
|
|
import { Icon } from 'vant';
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
@@ -108,6 +117,7 @@ import albumUploadPopup from "../components/albumUploadPopup.vue";
|
|
|
import leaveConfirmPopup from "@/components/popup/leaveConfirmPopup.vue";
|
|
import leaveConfirmPopup from "@/components/popup/leaveConfirmPopup.vue";
|
|
|
import tipPopup from "@/components/popup/tipPopup.vue";
|
|
import tipPopup from "@/components/popup/tipPopup.vue";
|
|
|
import { useI18n } from "@/i18n";
|
|
import { useI18n } from "@/i18n";
|
|
|
|
|
+import { base_img_url2 } from "@/api/config";
|
|
|
import wx from "weixin-js-sdk";
|
|
import wx from "weixin-js-sdk";
|
|
|
|
|
|
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
@@ -115,6 +125,7 @@ const route = useRoute();
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
const isAbnormal = computed(() => route.query.type === "abnormal");
|
|
const isAbnormal = computed(() => route.query.type === "abnormal");
|
|
|
|
|
+const pageTitle = computed(() => route.query.pageName || "巡园要点");
|
|
|
|
|
|
|
|
function isTruthyFlag(value) {
|
|
function isTruthyFlag(value) {
|
|
|
return value === 1 || value === "1" || value === true || value === "true";
|
|
return value === 1 || value === "1" || value === true || value === "true";
|
|
@@ -141,17 +152,71 @@ const isFromShare = computed(() => {
|
|
|
return false;
|
|
return false;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-const theme = computed(() => t("agriFile.interactTheme"));
|
|
|
|
|
-const level = computed(() => t("agriFile.riskLevel2"));
|
|
|
|
|
-const reason = computed(() => t("agriFile.interactReason"));
|
|
|
|
|
-const zoneName = computed(() => t("agriFile.zoneOne"));
|
|
|
|
|
-/** 互动选项,后续由接口赋值 */
|
|
|
|
|
-const interactOptions = ref([
|
|
|
|
|
- { id: 1, name: "选项一" },
|
|
|
|
|
- { id: 2, name: "选项二" },
|
|
|
|
|
- { id: 3, name: "选项三" },
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+const DEFAULT_GUIDE_IMAGE = require("@/assets/img/agricultural/patrol-guide.png");
|
|
|
|
|
+
|
|
|
|
|
+function resolveImageUrl(path) {
|
|
|
|
|
+ if (!path) return "";
|
|
|
|
|
+ const text = String(path).trim();
|
|
|
|
|
+ if (!text) return "";
|
|
|
|
|
+ if (/^https?:\/\//i.test(text)) return text;
|
|
|
|
|
+ return base_img_url2 + text.replace(/^\//, "");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const interactTasks = ref([]);
|
|
|
|
|
+const currentTaskIndex = ref(0);
|
|
|
const selectedOptionId = ref(null);
|
|
const selectedOptionId = ref(null);
|
|
|
|
|
+
|
|
|
|
|
+const currentTask = computed(() => interactTasks.value[currentTaskIndex.value] || null);
|
|
|
|
|
+const currentContent = computed(() => currentTask.value?.interact_content || {});
|
|
|
|
|
+
|
|
|
|
|
+const theme = computed(
|
|
|
|
|
+ () => currentContent.value.interact_title || t("agriFile.interactTheme")
|
|
|
|
|
+);
|
|
|
|
|
+const reason = computed(
|
|
|
|
|
+ () => currentContent.value.interact_theme || t("agriFile.interactReason")
|
|
|
|
|
+);
|
|
|
|
|
+const level = computed(
|
|
|
|
|
+ // () => currentTask.value?.weather_risk || t("agriFile.riskLevel2")
|
|
|
|
|
+ () => t("agriFile.riskLevel2")
|
|
|
|
|
+);
|
|
|
|
|
+const zoneName = computed(() => t("agriFile.zoneOne"));
|
|
|
|
|
+const assessmentDesc = computed(
|
|
|
|
|
+ () => currentContent.value.interact_explain || t("agriFile.agriAssessmentDesc")
|
|
|
|
|
+);
|
|
|
|
|
+const interactProblem = computed(
|
|
|
|
|
+ () => currentContent.value.interact_problem || t("agriFile.interactQuestionText")
|
|
|
|
|
+);
|
|
|
|
|
+const guideImage = computed(
|
|
|
|
|
+ // () => resolveImageUrl(currentContent.value.guide_url) || DEFAULT_GUIDE_IMAGE
|
|
|
|
|
+ () => resolveImageUrl('感知_玉米_4_32.png') || DEFAULT_GUIDE_IMAGE
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+const interactOptions = computed(() => {
|
|
|
|
|
+ const options = currentContent.value.interact_options;
|
|
|
|
|
+ if (!Array.isArray(options)) return [];
|
|
|
|
|
+ return options.map((name, index) => ({
|
|
|
|
|
+ id: index + 1,
|
|
|
|
|
+ name: String(name),
|
|
|
|
|
+ }));
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const applyTaskIndex = (index) => {
|
|
|
|
|
+ currentTaskIndex.value = index;
|
|
|
|
|
+ selectedOptionId.value = null;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const fetchInternalInteractTasks = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await VE_API.questionnaire.getInternalInteractTasks({ zone_id: 42 });
|
|
|
|
|
+ const tasks = res?.data?.interact_tasks;
|
|
|
|
|
+ interactTasks.value = Array.isArray(tasks) ? tasks : [];
|
|
|
|
|
+ applyTaskIndex(0);
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.warn("[growthTrack] getInternalInteractTasks failed", e);
|
|
|
|
|
+ interactTasks.value = [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const showUploadPopup = ref(false);
|
|
const showUploadPopup = ref(false);
|
|
|
const showSuccessPopup = ref(false);
|
|
const showSuccessPopup = ref(false);
|
|
|
const showLeavePopup = ref(false);
|
|
const showLeavePopup = ref(false);
|
|
@@ -163,7 +228,7 @@ const situationList = [
|
|
|
const handleShare = () => {
|
|
const handleShare = () => {
|
|
|
const query = {
|
|
const query = {
|
|
|
askInfo: { title: "转发巡园要点", content: "是否分享给好友" },
|
|
askInfo: { title: "转发巡园要点", content: "是否分享给好友" },
|
|
|
- shareText: "速长窗口不追肥?后期发育慢人一步,直接掉队!",
|
|
|
|
|
|
|
+ shareText: reason.value || "速长窗口不追肥?后期发育慢人一步,直接掉队!",
|
|
|
targetUrl: "growth_track",
|
|
targetUrl: "growth_track",
|
|
|
paramsPage: JSON.stringify({
|
|
paramsPage: JSON.stringify({
|
|
|
id: route.query.id,
|
|
id: route.query.id,
|
|
@@ -182,6 +247,12 @@ const handleSubmit = () => {
|
|
|
ElMessage.warning(t("agriFile.pleaseSelectOption"));
|
|
ElMessage.warning(t("agriFile.pleaseSelectOption"));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ // 选第二项:切换到下一条内部感知任务
|
|
|
|
|
+ const isSecondOption = selectedOptionId.value === 2;
|
|
|
|
|
+ if (isSecondOption && currentTaskIndex.value < interactTasks.value.length - 1) {
|
|
|
|
|
+ applyTaskIndex(currentTaskIndex.value + 1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
ElMessage.success(t("agriFile.submitSuccess"));
|
|
ElMessage.success(t("agriFile.submitSuccess"));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -229,7 +300,16 @@ const confirmLeave = () => {
|
|
|
router.back();
|
|
router.back();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// onMounted(() => {
|
|
|
|
|
+// if (!isAbnormal.value) {
|
|
|
|
|
+// fetchInternalInteractTasks();
|
|
|
|
|
+// }
|
|
|
|
|
+// });
|
|
|
|
|
+
|
|
|
onActivated(() => {
|
|
onActivated(() => {
|
|
|
|
|
+ if (!isAbnormal.value) {
|
|
|
|
|
+ fetchInternalInteractTasks();
|
|
|
|
|
+ }
|
|
|
if (route.query.showUpload !== "1") return;
|
|
if (route.query.showUpload !== "1") return;
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
showUploadPopup.value = true;
|
|
showUploadPopup.value = true;
|
|
@@ -310,7 +390,7 @@ onActivated(() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
&__share {
|
|
&__share {
|
|
|
- // flex: none;
|
|
|
|
|
|
|
+ flex: none;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
gap: 4px;
|
|
gap: 4px;
|