index.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. <template>
  2. <div class="achievement-report-page" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
  3. <!-- 天气遮罩 -->
  4. <div class="weather-mask" v-show="isExpanded" @click="handleMaskClick"></div>
  5. <!-- 组件:天气 -->
  6. <div class="weather-info-wrap">
  7. <weather-info ref="weatherInfoRef" from="growth_report" class="weather-info" :showTabMask="showTabMask"
  8. @weatherExpanded="weatherExpanded" @changeGarden="changeGarden" @changeGardenTab="changeGardenTab"
  9. @closeTabMask="closeTabMask">
  10. </weather-info>
  11. <!-- 邀请关注 -->
  12. <div class="invite-follow" v-if="currentFarmName && activeGardenTab === 'current'">
  13. <div class="invite-content">
  14. <icon name="share" />
  15. <span>邀请关注</span>
  16. </div>
  17. </div>
  18. </div>
  19. <!-- 农场列表 -->
  20. <div v-show="activeGardenTab === 'list'">
  21. <garden-list ref="gardenListRef" :garden-id="selectedGardenId" @loaded="handleGardenLoaded"
  22. @selectGarden="handleGardenSelected" />
  23. </div>
  24. <div class="report-content-wrap" v-if="hasReport && activeGardenTab === 'current'" v-loading="loading"
  25. element-loading-background="rgba(0, 0, 0, 0.1)">
  26. <!-- <div class="history-risk-report-btn" @click="handleHistoryRiskReportClick">
  27. <span class="risk-report-icon">
  28. <i></i>
  29. </span>
  30. <span class="risk-report-text">历史风险报告</span>
  31. </div> -->
  32. <div class="report-content has-report" :style="{ minHeight: `calc(100vh - ${tabBarHeight}px)` }">
  33. <!-- <img src="@/assets/img/home/qrcode.png" alt="" class="code-icon" /> -->
  34. <img class="header-img" src="@/assets/img/home/report.png" alt="" />
  35. <div class="report-header">
  36. <div class="type-tabs report-tabs">
  37. <div class="type-item" :class="{ 'type-item-active': activeReportIndex === 0 }">作物长势</div>
  38. <div class="type-item" :class="{ 'type-item-active': activeReportIndex === 1 }">历史风险</div>
  39. <div class="type-item" :class="{ 'type-item-active': activeReportIndex === 2 }">土壤改良</div>
  40. <div class="type-item" :class="{ 'type-item-active': activeReportIndex === 3 }">种植建议</div>
  41. </div>
  42. <div class="type-tabs" v-if="subjectData.length > 1">
  43. <div
  44. @click="handleTypeTabClick(item, index)"
  45. class="type-item"
  46. v-for="(item, index) in visibleSubjectData"
  47. :class="{ 'type-item-active': activeSubjectIndex === index }"
  48. :key="index">{{ item.speciesName }}</div>
  49. <div
  50. v-if="showSubjectToggle"
  51. class="subject-toggle"
  52. @click="typeTabsExpanded = !typeTabsExpanded"
  53. >
  54. {{ typeTabsExpanded ? "点击收起" : "点击展开更多" }}
  55. </div>
  56. </div>
  57. <div class="time-tag">{{ workItems?.[0]?.reportDate }}</div>
  58. <div class="report-title">{{ subjectData[activeSubjectIndex]?.speciesName }}长势报告</div>
  59. <div class="report-info">
  60. <div class="info-item">
  61. <img class="info-icon" src="@/assets/img/home/farm.png" alt="" />
  62. <span class="info-text">{{ currentFarmName }}</span>
  63. </div>
  64. </div>
  65. </div>
  66. <!-- <div class="report-box warning-bg">
  67. <div class="box-title warning">今日巡园重点</div>
  68. <div class="box-text w-100">
  69. <div class="row">
  70. <div v-for="(card, cardI) in todayPatrolFocus" :key="cardI" class="status-card"
  71. :class="'today-' + card.color" @click="handleTodayPatrolFocusClick(card)">
  72. <div class="status-title"
  73. :class="{ 'status-title-small': (card.title || '').length > 6 }">
  74. {{ card.title }}
  75. </div>
  76. <div class="status-sub">
  77. {{ card.description }}
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="report-box warning-bg">
  84. <div class="box-title warning">待执行农事</div>
  85. <div class="box-text w-100">
  86. <div class="row">
  87. <div v-for="(card, cardI) in pendingFarmWork" :key="cardI" class="status-card pending-card"
  88. :style="{ background: card.purposeColor, color: card.purposeColor === '#FFFFFF' ? '#000' : '#fff' }"
  89. :class="card.type" @click="handlePendingFarmWorkClick(card)">
  90. <div v-if="card.executionLimitDays || card.executionLimitDays === 0" class="tag-name"
  91. :style="{ borderColor: card.purposeColor, color: card.purposeColor }">限时 {{
  92. card.executionLimitDays }} 天</div>
  93. <div class="status-title"
  94. :class="{ 'status-title-small': (card.name || '').length > 6 }">
  95. {{ card.name }}
  96. </div>
  97. <div class="status-sub pending-sub"
  98. :style="{ color: card.purposeColor === '#FFFFFF' ? '#000' : '#fff' }">
  99. {{ card.purposeName }}
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div> -->
  105. <div class="report-box">
  106. <div class="box-title">气象风险</div>
  107. <div class="box-text">
  108. <div class="box-bg">
  109. <div class="types-info">
  110. 当前 <span class="text-bold">桂味、妃子笑</span> 处于为 新梢萌动<span class="text-link" @click="handleAdjustPopup">(校准物候期)</span>
  111. </div>
  112. </div>
  113. <div class="warning-part">
  114. <div class="warning-title">
  115. <div class="title-l">
  116. <div class="title-line"></div>
  117. <div class="title-block"></div>
  118. </div>
  119. <div>未来7-15天气象风险</div>
  120. <div class="title-l">
  121. <div class="title-block"></div>
  122. <div class="title-line title-line-right"></div>
  123. </div>
  124. </div>
  125. <div class="report-part" v-for="(part, partI) in 3" :key="partI">
  126. <div class="part-title">病虫风险</div>
  127. <div class="part-text">根据问题写一下需要注意的事项有哪些;简单描述农事该怎</div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="report-box">
  133. <div class="box-title">农事建议</div>
  134. <div class="box-text">
  135. <div class="warning-part" v-for="(part, partI) in 3" :key="partI">
  136. <div class="report-part">
  137. <div class="part-top">
  138. <div class="part-title">某某农事</div>
  139. <div class="part-link">
  140. <el-icon class="part-link-icon"><Link /></el-icon>
  141. <div class="text-link">查看农事</div>
  142. </div>
  143. </div>
  144. <div class="part-text">描述描述描述描述描述描述描述描述</div>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="report-box" v-for="(work, workI) in workItems" :key="workI">
  150. <div class="box-title">{{ work?.title }}</div>
  151. <div class="box-text">
  152. <div class="box-bg" v-show="work?.backgroundDesc">
  153. <span class="box-subtitle">背景描述:</span>
  154. <div class="pre-text">{{ work?.backgroundDesc }}</div>
  155. </div>
  156. <div class="box-advice" v-show="work?.suggestion">
  157. <span class="box-subtitle">对策建议:</span>
  158. <div class="pre-text">{{ work?.suggestion }}</div>
  159. </div>
  160. <div class="box-sum pre-text" v-show="work?.summary">{{ work?.summary }}</div>
  161. </div>
  162. </div>
  163. </div>
  164. <!-- <swipe ref="swipeRef" class="my-swipe" :loop="false" indicator-color="white" @change="handleSwipeChange">
  165. <swipe-item v-for="(item, index) in regionsData" :key="index">
  166. </swipe-item>
  167. </swipe> -->
  168. </div>
  169. <div v-else-if="activeGardenTab === 'current'" class="fake-report-wrap report-content-wrap">
  170. <div class="report-content">
  171. <img class="header-img" src="@/assets/img/home/report.png" alt="" />
  172. <div class="report-header" :class="{ 'no-farm': !currentFarmName }">
  173. <!-- <img class="header-book" src="@/assets/img/home/book.png" alt="" /> -->
  174. <div class="time-tag">{{ new Date().toISOString().split('T')[0] }}</div>
  175. <div class="report-title" @click="handleAddFarm">作物长势报告</div>
  176. <div class="report-info pb-4">
  177. <div class="info-item">
  178. <img class="info-icon" src="@/assets/img/home/farm.png" alt="" />
  179. <span class="info-text">示范农场</span>
  180. </div>
  181. </div>
  182. </div>
  183. <div class="fake-img">
  184. <img src="@/assets/img/home/fake.png" alt="" class="fake-img-item" />
  185. </div>
  186. <div class="lock-img">
  187. <img @click="handleLockClick" src="@/assets/img/home/lock-blue.png" alt=""
  188. class="has-click lock-img-item" />
  189. <div class="lock-text">
  190. 专属数字农场,种好卖好
  191. <div>点击解锁一键溯源增产</div>
  192. </div>
  193. <div @click="handleLockClick" class="lock-btn has-click">点击解锁</div>
  194. </div>
  195. <div class="lock-bg"></div>
  196. </div>
  197. </div>
  198. <!-- 农场列表引导 -->
  199. <div class="mask-wrap" @click="closeTabMask" v-if="showTabMask"></div>
  200. <tip-popup v-model:show="showBindSuccess" type="success" text="您的农场已绑定成功" hideBtn />
  201. <start-interact-popup ref="startInteractPopupRef" />
  202. <agri-execute-popup ref="agriExecutePopupRef" />
  203. <!-- 校准物候期 -->
  204. <adjust-popup ref="adjustPopupRef" />
  205. </div>
  206. </template>
  207. <script setup>
  208. import wx from "weixin-js-sdk";
  209. import weatherInfo from "@/components/weatherInfo.vue";
  210. import { ref, onActivated, onDeactivated, onUnmounted, computed, nextTick } from "vue";
  211. import { useRoute, useRouter } from "vue-router";
  212. import { useStore } from "vuex";
  213. import { Swipe, SwipeItem, Badge, Icon } from 'vant';
  214. import tipPopup from "@/components/popup/tipPopup.vue";
  215. import startInteractPopup from "@/components/popup/startInteractPopup.vue";
  216. import agriExecutePopup from "@/components/popup/agriExecutePopup.vue";
  217. import gardenList from "@/components/gardenList.vue";
  218. import adjustPopup from "./adjustPopup.vue";
  219. const store = useStore();
  220. const tabBarHeight = computed(() => store.state.home.tabBarHeight);
  221. const route = useRoute();
  222. const router = useRouter();
  223. const loading = ref(false);
  224. const hasReport = ref(false);
  225. const workItems = ref([]);
  226. const swipeRef = ref(null);
  227. const paramsPage = ref({});
  228. const showBindSuccess = ref(false);
  229. const startInteractPopupRef = ref(null);
  230. const agriExecutePopupRef = ref(null);
  231. const adjustPopupRef = ref(null);
  232. const handleAdjustPopup = () => {
  233. adjustPopupRef.value.open();
  234. }
  235. // 天气组件相关
  236. const isExpanded = ref(false);
  237. const weatherInfoRef = ref(null);
  238. const showTabMask = ref(false);
  239. const TAB_GUIDE_SHOWN_KEY = "GROWTH_REPORT_TAB_GUIDE_SHOWN";
  240. const weatherExpanded = (isExpandedValue) => {
  241. isExpanded.value = isExpandedValue;
  242. };
  243. // 点击遮罩时收起天气
  244. const handleMaskClick = () => {
  245. if (weatherInfoRef.value && weatherInfoRef.value.toggleExpand) {
  246. weatherInfoRef.value.toggleExpand();
  247. }
  248. };
  249. const currentFarmName = ref('');
  250. const selectedGardenId = ref(null);
  251. const gardenListRef = ref(null);
  252. const activeGardenTab = ref('current');
  253. const changeGardenTab = (tab) => {
  254. activeGardenTab.value = tab;
  255. }
  256. const handleGardenLoaded = ({ hasFarm }) => {
  257. weatherInfoRef.value?.setGardenLoaded?.(hasFarm);
  258. };
  259. const handleGardenSelected = (garden) => {
  260. selectedGardenId.value = garden?.id ?? null;
  261. weatherInfoRef.value?.setSelectedGarden?.(garden);
  262. };
  263. // 切换农场时,更新报告数据
  264. const changeGarden = async ({ id, name }) => {
  265. if (!id) return;
  266. currentFarmName.value = name;
  267. if (sessionStorage.getItem('activeSwipeIndex')) {
  268. currentIndex.value = Number(sessionStorage.getItem('activeSwipeIndex'));
  269. } else {
  270. currentIndex.value = 0;
  271. swipeRef.value && swipeRef.value.swipeTo(0, { immediate: true });
  272. }
  273. paramsPage.value = {
  274. ...(paramsPage.value || {}),
  275. subjectId: id,
  276. };
  277. // 初始化品种/大物候期转换
  278. startInteractPopupRef.value.getPhenologyInitOrConfirmStatus();
  279. await getSubjectData(id);
  280. await getRegions();
  281. };
  282. onActivated(() => {
  283. window.scrollTo(0, 0);
  284. // 从新增农场页返回时,优先用缓存中的最新选中农场
  285. const savedFarmId = localStorage.getItem("selectedFarmId");
  286. selectedGardenId.value = savedFarmId ? Number(savedFarmId) : null;
  287. gardenListRef.value?.refreshFarmList?.();
  288. // 如果路由中带有 miniJson,并且其中有 showBind,则展示绑定成功弹窗
  289. const { miniJson } = route.query || {};
  290. if (miniJson) {
  291. try {
  292. const parsed = typeof miniJson === "string" ? JSON.parse(miniJson) : miniJson;
  293. if (parsed && parsed.showBind) {
  294. showBindSuccess.value = true;
  295. // 处理完后清空路由中的 miniJson 参数,避免重复弹出
  296. const newQuery = { ...(route.query || {}) };
  297. delete newQuery.miniJson;
  298. router.replace({ path: route.path, query: newQuery });
  299. }
  300. } catch (e) {
  301. // miniJson 解析失败时忽略,不影响正常流程
  302. }
  303. }
  304. // getResultReport();
  305. });
  306. const closeTabMask = () => {
  307. showTabMask.value = false;
  308. };
  309. const userInfo = localStorage.getItem("localUserInfo");
  310. const userInfoObj = userInfo ? JSON.parse(userInfo) : {};
  311. const handleLockClick = () => {
  312. if (currentFarmName.value) {
  313. router.push("/interaction?subjectId=" + localStorage.getItem("selectedFarmId"));
  314. return;
  315. }
  316. if (userInfoObj?.tel) {
  317. router.push(`/create_farm?from=growth_report&isReload=true`);
  318. return;
  319. }
  320. wx.miniProgram.navigateTo({
  321. url: '/pages/subPages/phone_auth/index',
  322. });
  323. }
  324. const handleAddFarm = () => {
  325. router.push(`/create_farm?from=growth_report&isReload=true`);
  326. }
  327. const handleHistoryRiskReportClick = () => {
  328. router.push("/history_risk_report");
  329. }
  330. const todayPatrolFocus = ref([]);
  331. const pendingFarmWork = ref([]);
  332. const handlePendingFarmWorkClick = (card) => {
  333. router.push({
  334. path: "/work_detail",
  335. query: {
  336. miniJson: JSON.stringify({
  337. paramsPage: JSON.stringify({
  338. farmId: paramsPage.value.farmId,
  339. farmWorkLibId: card?.farmWorkLibId,
  340. recordId: card?.recordId,
  341. typeId: regionsData.value[currentIndex.value].typeId
  342. }),
  343. }),
  344. },
  345. });
  346. }
  347. // 点击今日巡园重点
  348. const handleTodayPatrolFocusClick = (card) => {
  349. if (!card.interactionTypeId) return;
  350. router.push(`/interaction_list?farmId=${paramsPage.value.farmId}&regionId=${paramsPage.value.regionId}&interactionTypeId=${card.interactionTypeId}`);
  351. }
  352. const getTodayPatrolFocus = () => {
  353. VE_API.report.todayPatrolFocus({ farmId: paramsPage.value.farmId }).then(({ data }) => {
  354. todayPatrolFocus.value = data || [];
  355. });
  356. }
  357. const getPendingFarmWork = () => {
  358. VE_API.report.pendingFarmWork({ farmId: paramsPage.value.farmId, regionId: paramsPage.value.regionId }).then(({ data }) => {
  359. pendingFarmWork.value = data || [];
  360. });
  361. }
  362. const currentIndex = ref(0);
  363. const handleSwipeChange = (index) => {
  364. currentIndex.value = index;
  365. if (paramsPage.value.regionId !== regionsData.value[index].regionId) {
  366. paramsPage.value = {
  367. ...(paramsPage.value || {}),
  368. farmId: regionsData.value[index].farmId,
  369. regionId: regionsData.value[index].regionId,
  370. };
  371. getTodayPatrolFocus();
  372. getPendingFarmWork();
  373. getDetail();
  374. }
  375. }
  376. const getDetail = () => {
  377. if (!paramsPage.value.farmId) return;
  378. loading.value = true;
  379. VE_API.report
  380. .reproductiveReport({ farmId: paramsPage.value.farmId, regionId: paramsPage.value.regionId })
  381. .then(({ data }) => {
  382. workItems.value = data || [];
  383. })
  384. .finally(() => {
  385. loading.value = false;
  386. });
  387. };
  388. const subjectData = ref([])
  389. const typeTabsExpanded = ref(false);
  390. const visibleSubjectData = computed(() => {
  391. if (typeTabsExpanded.value) {
  392. return subjectData.value;
  393. }
  394. return subjectData.value.slice(0, 4);
  395. });
  396. const showSubjectToggle = computed(() => subjectData.value.length > 4);
  397. const getSubjectData = async (id) => {
  398. const res = await VE_API.monitor.listFarmsBySubjectId({ subjectId: id });
  399. // subjectData.value = res.data || [];
  400. subjectData.value = [...res.data, ...res.data, ...res.data, ...res.data];
  401. typeTabsExpanded.value = false;
  402. }
  403. const activeReportIndex = ref(0);
  404. const activeSubjectIndex = ref(0);
  405. const handleTypeTabClick = (item, index) => {
  406. activeSubjectIndex.value = index;
  407. paramsPage.value = {
  408. ...(paramsPage.value || {}),
  409. farmId: item.farmId,
  410. };
  411. getTodayPatrolFocus();
  412. }
  413. const regionsData = ref([]);
  414. const getRegions = async () => {
  415. VE_API.monitor.listRegionsBySubjectId({
  416. subjectId: paramsPage.value.subjectId,
  417. }).then(({ data }) => {
  418. regionsData.value = data || [];
  419. if (regionsData.value.length > 0) {
  420. hasReport.value = true;
  421. const hasShownTabGuide = localStorage.getItem(TAB_GUIDE_SHOWN_KEY) === "1";
  422. // 首次进入且有分区数据:显示农场列表引导
  423. if (!hasShownTabGuide) {
  424. showTabMask.value = true;
  425. localStorage.setItem(TAB_GUIDE_SHOWN_KEY, "1");
  426. } else {
  427. showTabMask.value = false;
  428. }
  429. // 切换农场tab回到当前农场tab
  430. weatherInfoRef.value && weatherInfoRef.value.handleGardenClick('current');
  431. // 如果不是点击农情报告已生成弹窗过来的,则显示农情互动弹窗
  432. if (!route.query.hideInteraction) {
  433. agriExecutePopupRef.value.showPopup(regionsData.value[currentIndex.value].farmId);
  434. }
  435. paramsPage.value = {
  436. ...(paramsPage.value || {}),
  437. farmId: regionsData.value[currentIndex.value].farmId,
  438. regionId: regionsData.value[currentIndex.value].regionId,
  439. };
  440. getTodayPatrolFocus();
  441. getPendingFarmWork();
  442. getDetail();
  443. // 如果是新增品种后跳转过来的,等待 Swipe 实例挂载后再定位
  444. if (route.query.addVarietyCount) {
  445. const targetIndex = Number(route.query.addVarietyCount);
  446. if (!Number.isNaN(targetIndex) && targetIndex >= 0) {
  447. const safeIndex = Math.min(targetIndex, regionsData.value.length - 1);
  448. const reverseIndex = Math.min(
  449. regionsData.value.length - 1,
  450. Math.max(0, regionsData.value.length - safeIndex)
  451. );
  452. nextTick(() => {
  453. swipeRef.value?.swipeTo?.(reverseIndex, { immediate: true });
  454. });
  455. }
  456. }
  457. if (sessionStorage.getItem('activeSwipeIndex')) {
  458. nextTick(() => {
  459. swipeRef.value?.swipeTo?.(currentIndex.value, { immediate: true });
  460. });
  461. sessionStorage.removeItem('activeSwipeIndex');
  462. }
  463. } else {
  464. // 切换农场tab回到当前农场tab
  465. // weatherInfoRef.value && weatherInfoRef.value.handleGardenClick('current');
  466. showTabMask.value = false;
  467. hasReport.value = false;
  468. }
  469. });
  470. }
  471. // 清理数据的函数
  472. const clearData = () => {
  473. workItems.value = [];
  474. paramsPage.value = {};
  475. loading.value = false;
  476. };
  477. onDeactivated(() => {
  478. sessionStorage.setItem('activeSwipeIndex', currentIndex.value);
  479. clearData();
  480. });
  481. onUnmounted(() => {
  482. clearData();
  483. });
  484. </script>
  485. <style lang="scss" scoped>
  486. .mask-wrap {
  487. position: fixed;
  488. bottom: 0;
  489. left: 0;
  490. width: 100%;
  491. height: 300px;
  492. background-color: rgba(0, 0, 0, 0.52);
  493. z-index: 99999;
  494. }
  495. .achievement-report-page {
  496. width: 100%;
  497. height: 100vh;
  498. background: linear-gradient(195.35deg, #d4e4ff 16.34%, rgba(93, 189, 255, 0) 50.3%),
  499. linear-gradient(156.64deg, rgba(255, 255, 255, 0.16) 27.7%, rgba(255, 255, 255, 0) 72.82%);
  500. .weather-mask {
  501. position: fixed;
  502. top: 0;
  503. left: 0;
  504. width: 100%;
  505. height: 100%;
  506. background-color: rgba(0, 0, 0, 0.52);
  507. z-index: 11;
  508. }
  509. .weather-info-wrap {
  510. width: calc(100% - 20px);
  511. position: absolute;
  512. z-index: 12;
  513. left: 10px;
  514. top: 10px;
  515. .weather-info {
  516. width: 100%;
  517. }
  518. .invite-follow {
  519. position: absolute;
  520. right: -6px;
  521. top: 50px;
  522. .invite-content {
  523. display: flex;
  524. align-items: center;
  525. gap: 4px;
  526. font-size: 14px;
  527. font-family: "PangMenZhengDao";
  528. color: #fff;
  529. line-height: 30px;
  530. padding: 0 12px;
  531. border-radius: 20px 0 0 20px;
  532. height: 30px;
  533. cursor: pointer;
  534. background: #2199F8;
  535. position: relative;
  536. &::after {
  537. content: '';
  538. position: absolute;
  539. bottom: -6px;
  540. right: 0;
  541. width: 0px;
  542. height: 0px;
  543. border-right: 3px solid transparent;
  544. border-top: 3px solid #75a8cd;
  545. border-left: 3px solid #75a8cd;
  546. border-bottom: 3px solid transparent;
  547. }
  548. }
  549. }
  550. }
  551. .fake-report-wrap {
  552. width: 100%;
  553. .no-report-img {
  554. width: 100%;
  555. }
  556. .fake-img {
  557. position: relative;
  558. .fake-img-item {
  559. width: 100%;
  560. }
  561. }
  562. }
  563. .report-content-wrap {
  564. height: 100%;
  565. // padding-bottom: 60px;
  566. overflow: auto;
  567. box-sizing: border-box;
  568. position: relative;
  569. .history-risk-report-btn {
  570. position: absolute;
  571. right: 0px;
  572. top: 110px;
  573. z-index: 13;
  574. height: 26px;
  575. padding: 0 10px 0 8px;
  576. display: inline-flex;
  577. align-items: center;
  578. gap: 4px;
  579. color: #ffffff;
  580. font-size: 14px;
  581. border-radius: 13px 0 0 13px;
  582. background: linear-gradient(180deg, #60c2ff 0%, #2199f8 100%);
  583. box-shadow: 0 2px 6px rgba(33, 153, 248, 0.3);
  584. cursor: pointer;
  585. .risk-report-icon {
  586. width: 14px;
  587. height: 14px;
  588. border-radius: 2px;
  589. background: #ffffff;
  590. position: relative;
  591. display: inline-flex;
  592. align-items: center;
  593. justify-content: center;
  594. transform: rotate(-12deg);
  595. i {
  596. width: 8px;
  597. height: 2px;
  598. border-radius: 2px;
  599. background: #42a7ff;
  600. box-shadow: 0 3px 0 #42a7ff;
  601. }
  602. }
  603. .risk-report-text {
  604. line-height: 1;
  605. white-space: nowrap;
  606. }
  607. }
  608. .bottom-btn {
  609. z-index: 2;
  610. position: fixed;
  611. bottom: 0;
  612. left: 0;
  613. width: 100%;
  614. background: #fff;
  615. height: 60px;
  616. display: flex;
  617. align-items: center;
  618. justify-content: space-between;
  619. padding: 0 12px;
  620. box-sizing: border-box;
  621. box-shadow: 2px 2px 4.5px 0px rgba(0, 0, 0, 0.4);
  622. .btn-item {
  623. height: 40px;
  624. line-height: 40px;
  625. padding: 0 24px;
  626. border-radius: 20px;
  627. font-size: 14px;
  628. &.second {
  629. color: #666666;
  630. border: 1px solid rgba(153, 153, 153, 0.5);
  631. }
  632. &.primay {
  633. padding: 0 34px;
  634. background: linear-gradient(180deg, #76c3ff, #2199f8);
  635. color: #fff;
  636. }
  637. }
  638. }
  639. }
  640. .code-icon {
  641. position: absolute;
  642. right: 10px;
  643. top: 12px;
  644. width: 48px;
  645. }
  646. .report-content {
  647. // background: url("@/assets/img/home/report_bg.png") no-repeat center center;
  648. // background: linear-gradient(0deg, #9BCCFF, #9BCCFF),
  649. // linear-gradient(160deg, rgba(255, 255, 255, 0.16) 30%, rgba(255, 255, 255, 0) 72%);
  650. background: #abd4ff;
  651. background-size: 100% auto;
  652. background-position: top center;
  653. padding: 0 10px 26px 10px;
  654. box-sizing: border-box;
  655. position: relative;
  656. &.has-report {
  657. min-height: 100%;
  658. background: linear-gradient(0deg, #9BCCFF, #9BCCFF),
  659. linear-gradient(156.64deg, rgba(255, 255, 255, 0.16) 27.7%, rgba(255, 255, 255, 0) 72.82%);
  660. }
  661. .lock-bg {
  662. position: absolute;
  663. top: 230px;
  664. left: 0;
  665. width: 100%;
  666. height: calc(100% - 230px);
  667. background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.38) 50%, rgba(255, 255, 255, 0) 100%),
  668. linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
  669. }
  670. .lock-img {
  671. pointer-events: none;
  672. position: fixed;
  673. z-index: 10;
  674. top: 50%;
  675. left: 50%;
  676. transform: translate(-50%, -20%);
  677. width: 100%;
  678. display: flex;
  679. align-items: center;
  680. justify-content: center;
  681. flex-direction: column;
  682. gap: 16px;
  683. .lock-img-item {
  684. width: 57px;
  685. }
  686. .has-click {
  687. pointer-events: auto;
  688. }
  689. .lock-text {
  690. font-size: 14px;
  691. color: #000;
  692. padding: 5px 64px;
  693. line-height: 21px;
  694. background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 50%, rgba(255, 255, 255, 0) 100%);
  695. }
  696. .lock-btn {
  697. width: 140px;
  698. height: 40px;
  699. line-height: 40px;
  700. text-align: center;
  701. background: linear-gradient(180deg, #76C3FF 0%, #2199F8 100%);
  702. border-radius: 25px;
  703. color: #fff;
  704. font-size: 16px;
  705. }
  706. }
  707. .header-img {
  708. position: absolute;
  709. top: 0;
  710. left: 0;
  711. width: 100%;
  712. }
  713. .type-tabs {
  714. background: rgba(255, 255, 255, 0.8);
  715. display: flex;
  716. align-items: center;
  717. flex-wrap: wrap;
  718. gap: 8px;
  719. width: fit-content;
  720. border-radius: 5px;
  721. padding: 5px;
  722. margin-bottom: 22px;
  723. &.report-tabs {
  724. padding: 0 5px;
  725. height: 38px;
  726. background: none;
  727. margin-bottom: 6px;
  728. .type-item {
  729. height: 34px;
  730. line-height: 34px;
  731. font-size: 14px;
  732. color: #858585;
  733. }
  734. }
  735. .type-item {
  736. height: 28px;
  737. line-height: 28px;
  738. text-align: center;
  739. padding: 0 6px;
  740. min-width: 80px;
  741. color: #9A9A9A;
  742. background: #FFFFFF;
  743. box-sizing: border-box;
  744. border-radius: 2px;
  745. &.type-item-active {
  746. background: #2199F8;
  747. color: #fff;
  748. }
  749. }
  750. }
  751. .subject-toggle {
  752. margin-top: 4px;
  753. margin-bottom: 5px;
  754. font-size: 14px;
  755. color: rgba(0, 0, 0, 0.6);
  756. width: 100%;
  757. cursor: pointer;
  758. text-align: center;
  759. }
  760. .report-header {
  761. position: relative;
  762. padding-top: 148px;
  763. &.no-farm {
  764. padding-top: 102px;
  765. }
  766. .header-book {
  767. position: absolute;
  768. right: 0;
  769. bottom: -6px;
  770. height: 88px;
  771. z-index: 10;
  772. }
  773. .time-tag {
  774. background: #2199F8;
  775. border-radius: 5px 0 5px 0;
  776. height: 23px;
  777. line-height: 23px;
  778. font-size: 13px;
  779. font-weight: 500;
  780. color: #fff;
  781. padding: 0 9px;
  782. width: fit-content;
  783. margin-bottom: 4px;
  784. }
  785. .report-title {
  786. font-family: "PangMenZhengDao";
  787. font-size: 34px;
  788. line-height: 38px;
  789. color: #000000;
  790. }
  791. .report-info {
  792. padding: 12px 0 28px 0;
  793. &.pb-4 {
  794. padding-bottom: 4px;
  795. }
  796. .info-item {
  797. width: fit-content;
  798. display: flex;
  799. height: 33px;
  800. align-items: center;
  801. padding: 0 18px 0 6px;
  802. background: rgba(255, 255, 255, 0.58);
  803. backdrop-filter: blur(5px);
  804. border-radius: 20px;
  805. gap: 6px;
  806. .info-icon {
  807. width: 26px;
  808. height: 26px;
  809. object-fit: cover;
  810. border-radius: 50%;
  811. }
  812. .info-text {
  813. font-size: 14px;
  814. color: #000;
  815. }
  816. }
  817. .info-item+.info-item {
  818. margin-top: 5px;
  819. }
  820. }
  821. // 左滑查看更多标签
  822. .swipe-more-tag {
  823. position: absolute;
  824. bottom: 10px;
  825. right: -16px;
  826. box-sizing: border-box;
  827. width: 36px;
  828. height: 86px;
  829. // padding: 0px 10px 2px 0;
  830. background: rgba(0, 0, 0, 0.7);
  831. border-radius: 10px 0 0 10px;
  832. letter-spacing: 2px;
  833. color: #ffffff;
  834. font-size: 12px;
  835. text-align: center;
  836. line-height: 14px;
  837. writing-mode: vertical-rl;
  838. text-orientation: mixed;
  839. padding-right: 5px;
  840. }
  841. }
  842. .report-box {
  843. display: flex;
  844. align-items: center;
  845. padding: 8px 12px;
  846. // background: linear-gradient(0deg, #ffffff 86%, #2199f8 136%);
  847. background: #fff;
  848. border: 1px solid #ffffff;
  849. border-radius: 8px;
  850. gap: 5px;
  851. position: relative;
  852. &.warning-bg {
  853. background: linear-gradient(0deg, #FFFFFF 86%, #FF9B48 136%);
  854. }
  855. .report-box-item {
  856. flex: 1;
  857. background: rgba(33, 153, 248, 0.1);
  858. border-radius: 8px;
  859. min-height: 62px;
  860. box-sizing: border-box;
  861. padding: 2px 4px;
  862. display: flex;
  863. flex-direction: column;
  864. justify-content: center;
  865. .item-content {
  866. color: #2199f8;
  867. font-size: 14px;
  868. text-align: center;
  869. }
  870. .item-title {
  871. color: #000000;
  872. font-size: 10px;
  873. text-align: center;
  874. padding-top: 5px;
  875. }
  876. }
  877. .box-title {
  878. position: absolute;
  879. top: -8px;
  880. left: -1px;
  881. height: 32px;
  882. line-height: 26px;
  883. font-family: "PangMenZhengDao";
  884. font-size: 14px;
  885. padding: 0 10px;
  886. color: #ffffff;
  887. background: url("@/assets/img/home/title-bg.png") no-repeat center center / 100% 100%;
  888. &.warning {
  889. background: url("@/assets/img/home/title-bg-warning.png") no-repeat center center / 100% 100%;
  890. }
  891. }
  892. .w-100 {
  893. width: 100%;
  894. }
  895. .box-text {
  896. padding: 22px 0 8px 0;
  897. font-weight: 350;
  898. line-height: 21px;
  899. width: 100%;
  900. box-sizing: border-box;
  901. .pre-text {
  902. white-space: pre-line;
  903. word-break: break-word;
  904. }
  905. .box-subtitle {
  906. color: #000;
  907. }
  908. .box-bg {
  909. font-weight: 400;
  910. color: rgba(0, 0, 0, 0.5);
  911. margin-bottom: 8px;
  912. }
  913. .types-info {
  914. background: rgba(33, 153, 248, 0.1);
  915. color: #000000;
  916. padding: 6px;
  917. border-radius: 5px;
  918. .text-bold {
  919. font-weight: bold;
  920. }
  921. }
  922. .text-link {
  923. color: #2199F8;
  924. text-decoration: underline;
  925. }
  926. .report-part {
  927. color: rgba(0, 0, 0, 0.5);
  928. .part-title {
  929. background: #2199F8;
  930. height: 24px;
  931. line-height: 24px;
  932. padding: 0 8px;
  933. color: #fff;
  934. border-radius: 2px;
  935. width: fit-content;
  936. }
  937. .part-text {
  938. padding-top: 6px;
  939. }
  940. .part-top {
  941. display: flex;
  942. align-items: center;
  943. justify-content: space-between;
  944. .part-link {
  945. display: inline-flex;
  946. align-items: center;
  947. gap: 4px;
  948. color: #2199F8;
  949. .part-link-icon {
  950. transform: rotate(270deg);
  951. }
  952. }
  953. }
  954. }
  955. .warning-part + .warning-part {
  956. margin-top: 8px;
  957. }
  958. .report-part + .report-part {
  959. margin-top: 8px;
  960. }
  961. .warning-part {
  962. background: rgba(178, 178, 178, 0.08);
  963. border-radius: 5px;
  964. padding: 11px 6px 6px;
  965. color: rgba(0, 0, 0, 0.5);
  966. width: 100%;
  967. box-sizing: border-box;
  968. .warning-title {
  969. display: flex;
  970. align-items: center;
  971. justify-content: center;
  972. gap: 10px;
  973. padding-bottom: 13px;
  974. .title-l {
  975. display: flex;
  976. align-items: center;
  977. .title-line {
  978. width: 76px;
  979. height: 1px;
  980. background: linear-gradient(90deg, rgba(118, 118, 118, 0) 0%, rgba(118, 118, 118, 0.4) 100%);
  981. &.title-line-right {
  982. background: linear-gradient(270deg, rgba(118, 118, 118, 0) 0%, rgba(118, 118, 118, 0.4) 100%);
  983. }
  984. }
  985. .title-block {
  986. width: 6px;
  987. height: 6px;
  988. background: rgba(61, 61, 61, 0.2);
  989. transform: rotate(45deg);
  990. }
  991. }
  992. }
  993. }
  994. .box-advice {
  995. color: rgba(0, 0, 0, 0.5);
  996. padding-top: 10px;
  997. }
  998. .box-sum {
  999. margin-top: 10px;
  1000. background: rgba(33, 153, 248, 0.1);
  1001. border-radius: 5px;
  1002. padding: 10px;
  1003. line-height: 20px;
  1004. color: #2199F8;
  1005. }
  1006. &.next-info {
  1007. padding: 8px 0 8px 0;
  1008. }
  1009. }
  1010. .row {
  1011. display: grid;
  1012. grid-template-columns: repeat(3, 1fr);
  1013. gap: 6px;
  1014. .status-card {
  1015. border-radius: 2px;
  1016. padding: 7px 0;
  1017. background: #ffffff;
  1018. border: 0.5px solid #e5e6eb;
  1019. color: #000;
  1020. display: flex;
  1021. flex-direction: column;
  1022. align-items: center;
  1023. justify-content: center;
  1024. &.today-red {
  1025. background: #FF6A6A;
  1026. color: #fff;
  1027. .status-sub {
  1028. color: #fff;
  1029. }
  1030. }
  1031. &.pending-card {
  1032. color: #fff;
  1033. position: relative;
  1034. padding: 9px 0 7px 0;
  1035. .tag-name {
  1036. position: absolute;
  1037. top: -8px;
  1038. right: 0;
  1039. background: #fff;
  1040. color: #FF6A6A;
  1041. font-size: 10px;
  1042. height: 17px;
  1043. line-height: 17px;
  1044. padding: 0 3px;
  1045. border-radius: 2px;
  1046. box-sizing: border-box;
  1047. border: 0.5px solid #FF6A6A;
  1048. }
  1049. }
  1050. .status-badge {
  1051. // position: absolute;
  1052. // top: 0;
  1053. // right: 0;
  1054. }
  1055. .status-title {
  1056. font-size: 16px;
  1057. line-height: 24px;
  1058. &.status-title-small {
  1059. font-size: 13px;
  1060. line-height: 18px;
  1061. }
  1062. }
  1063. .status-sub {
  1064. font-size: 10px;
  1065. color: rgba(32, 32, 32, 0.4);
  1066. line-height: 15px;
  1067. &.pending-sub {
  1068. color: #fff;
  1069. line-height: 13px;
  1070. }
  1071. }
  1072. &.risk-strong {
  1073. background: #FF6A6A;
  1074. border-color: #FF6A6A;
  1075. .status-title,
  1076. .status-sub {
  1077. color: #ffffff;
  1078. }
  1079. }
  1080. &.danger {
  1081. background: #FFE9E9;
  1082. border-color: #ff8e8e;
  1083. .status-sub {
  1084. color: #FF6A6A;
  1085. }
  1086. }
  1087. }
  1088. }
  1089. }
  1090. .report-box+.report-box {
  1091. margin-top: 20px;
  1092. }
  1093. .report-excute {
  1094. position: relative;
  1095. margin-top: 12px;
  1096. .tag-label {
  1097. position: absolute;
  1098. top: 0;
  1099. left: 0;
  1100. padding: 4px 10px;
  1101. background: rgba(54, 52, 52, 0.8);
  1102. color: #fff;
  1103. font-size: 12px;
  1104. border-radius: 8px 0 8px 0;
  1105. z-index: 1;
  1106. }
  1107. ::v-deep {
  1108. .carousel-container .carousel-wrapper .carousel-img {
  1109. min-width: calc(100vw - 32px);
  1110. width: calc(100vw - 32px);
  1111. }
  1112. }
  1113. }
  1114. }
  1115. .download-btn {
  1116. position: fixed;
  1117. bottom: 20px;
  1118. left: 50%;
  1119. // background: #fff;
  1120. // box-shadow: 2px 2px 4.5px 0px #00000066;
  1121. // width: 100%;
  1122. transform: translateX(-50%);
  1123. }
  1124. .review-hide-box {
  1125. position: absolute;
  1126. left: 0;
  1127. width: 100%;
  1128. height: 100%;
  1129. z-index: -1;
  1130. bottom: 0;
  1131. }
  1132. .review-image {
  1133. position: relative;
  1134. display: flex;
  1135. align-items: center;
  1136. justify-content: center;
  1137. gap: 8px;
  1138. margin: 12px;
  1139. background: #fff;
  1140. border-radius: 8px;
  1141. .review-mask {
  1142. z-index: 1;
  1143. pointer-events: none;
  1144. position: absolute;
  1145. left: 0;
  1146. top: 0;
  1147. width: 100%;
  1148. height: 100%;
  1149. border-radius: 8px;
  1150. background: linear-gradient(360deg,
  1151. rgba(0, 0, 0, 0.78) 0%,
  1152. rgba(0, 0, 0, 0.437208) 19.87%,
  1153. rgba(0, 0, 0, 0) 33.99%);
  1154. display: flex;
  1155. flex-direction: column;
  1156. align-items: baseline;
  1157. justify-content: end;
  1158. padding: 12px;
  1159. box-sizing: border-box;
  1160. color: #fff;
  1161. .review-text {
  1162. font-family: "PangMenZhengDao";
  1163. font-size: 16px;
  1164. margin-bottom: 1px;
  1165. }
  1166. .review-content {
  1167. font-size: 10px;
  1168. line-height: 15px;
  1169. }
  1170. }
  1171. .vs-wrap {
  1172. position: absolute;
  1173. left: 50%;
  1174. top: 50%;
  1175. transform: translate(-50%, -50%);
  1176. width: 40px;
  1177. height: 40px;
  1178. z-index: 10;
  1179. img {
  1180. width: 100%;
  1181. height: 100%;
  1182. object-fit: cover;
  1183. }
  1184. }
  1185. .review-image-item {
  1186. position: relative;
  1187. flex: 1;
  1188. .review-image-item-title {
  1189. position: absolute;
  1190. top: 0;
  1191. left: 0;
  1192. background: rgba(54, 52, 52, 0.6);
  1193. padding: 4px 10px;
  1194. border-radius: 8px 0 8px 0;
  1195. backdrop-filter: 4px;
  1196. font-size: 12px;
  1197. color: #fff;
  1198. }
  1199. // .review-image-item-img {
  1200. // width: 100%;
  1201. // height: 250px;
  1202. // object-fit: cover;
  1203. // }
  1204. .review-image-item-img {
  1205. width: 100%;
  1206. height: 100%;
  1207. object-fit: cover;
  1208. object-position: center;
  1209. }
  1210. .left-img {
  1211. border-radius: 8px 0 0 8px;
  1212. }
  1213. .right-img {
  1214. border-radius: 0 8px 8px 0;
  1215. }
  1216. }
  1217. }
  1218. }
  1219. .cavans-popup {
  1220. width: 100%;
  1221. max-width: 100%;
  1222. max-height: 92vh;
  1223. background: none;
  1224. border-radius: 12px;
  1225. overflow: auto;
  1226. display: flex;
  1227. flex-direction: column;
  1228. backdrop-filter: 4px;
  1229. .cavans-content {
  1230. text-align: center;
  1231. padding: 0 12px;
  1232. height: fit-content;
  1233. overflow: auto;
  1234. .current-img {
  1235. width: 100%;
  1236. }
  1237. }
  1238. // 底部操作按钮
  1239. .bottom-actions {
  1240. flex-shrink: 0;
  1241. .action-buttons {
  1242. padding: 12px 0 4px 0;
  1243. display: flex;
  1244. justify-content: space-around;
  1245. .action-btn {
  1246. display: flex;
  1247. flex-direction: column;
  1248. align-items: center;
  1249. cursor: pointer;
  1250. &.text-btn {
  1251. font-size: 12px;
  1252. color: rgba(255, 255, 255, 0.7);
  1253. }
  1254. .icon-circle {
  1255. width: 48px;
  1256. height: 48px;
  1257. border-radius: 50%;
  1258. display: flex;
  1259. align-items: center;
  1260. justify-content: center;
  1261. color: #fff;
  1262. margin-bottom: 4px;
  1263. .el-icon {
  1264. color: #fff;
  1265. }
  1266. img {
  1267. width: 50px;
  1268. }
  1269. }
  1270. &.blue-btn .icon-circle {
  1271. background: #2199f8;
  1272. }
  1273. &.green-btn .icon-circle {
  1274. background: #07c160;
  1275. }
  1276. &.orange-btn .icon-circle {
  1277. background: #ff790b;
  1278. }
  1279. .btn-label {
  1280. font-size: 12px;
  1281. color: #fff;
  1282. }
  1283. }
  1284. }
  1285. .cancel-btn {
  1286. text-align: center;
  1287. font-size: 18px;
  1288. color: #fff;
  1289. cursor: pointer;
  1290. }
  1291. }
  1292. }
  1293. </style>