Browse Source

feat:修改bug

wangsisi 1 tuần trước cách đây
mục cha
commit
9411cb2ded

+ 11 - 1
src/views/old_mini/agri_services/components/servicesHall.vue

@@ -104,7 +104,7 @@
 
 <script setup>
 import { FloatingPanel, Icon } from "vant";
-import { computed, nextTick, onMounted, ref } from "vue";
+import { computed, nextTick, onMounted, ref,onActivated } from "vue";
 import { useStore } from "vuex";
 import IndexMap from "../map/index";
 import LocationSearch from "@/components/pageComponents/LocationSearch.vue";
@@ -117,6 +117,10 @@ const props = defineProps({
         type: Boolean,
         default: false,
     },
+    active: {
+        type: Number,
+        default: 0,
+    },
 });
 
 const store = useStore();
@@ -142,6 +146,12 @@ onMounted(() => {
     getStoreList();
 });
 
+onActivated(() => {
+    if(props.active == 1){
+        getStoreList();
+    }
+});
+
 const handleDetail = (item) => {
     router.push(`/expert_homepage?isStore=true&id=${item.id}`);
 };

+ 1 - 1
src/views/old_mini/agri_services/index.vue

@@ -6,7 +6,7 @@
                 <farm-dynamics ref="farmDynamicsRef" :active="active" />
             </tab>
             <tab title="服务大厅">
-                <services-hall ref="servicesHallRef" />
+                <services-hall ref="servicesHallRef" :active="active" />
             </tab>
         </tabs>
         <div v-else class="farm-dynamics-container">

+ 7 - 0
src/views/old_mini/agri_services/map/index.js

@@ -102,6 +102,13 @@ class IndexMap {
     this.kmap = new KMap.Map(target, level, coordinate[0], coordinate[1], null, 6, 22, isCapital ? "img" : "vec");
     this.kmap.addLayer(this.clickPointLayer.layer);
     this.kmap.addLayer(this.gardenHallLayer.layer);
+    if (isCapital) {
+      this.initData()
+      const point = ["113.61652616170711,23.58399613872042", "113.61767554789421, 23.590079887444034", "113.62757101477101, 23.590796948574365", "113.62240816252164, 23.59499176519138"]
+    } else {
+      let point = new Feature(new Point(coordinate))
+      this.clickPointLayer.addFeature(point)
+    }
     
     // 添加点击事件
     this.addGardenHallClick();

+ 1 - 1
src/views/old_mini/dev_login.vue

@@ -15,7 +15,6 @@ const store = useStore();
 let userId = route.query.userId;
 
 onMounted(async () => {
-    await getFarmList();
     const token = route.query.token
     const targetUrl = route.query.targetUrl ? route.query.targetUrl : '/home';
     if (!token) {
@@ -39,6 +38,7 @@ onMounted(async () => {
         const curRole = Array.isArray(roles) && roles.includes(2) ? 2 : 0;
         store.dispatch(`app/${SET_USER_CUR_ROLE}`, curRole);
     }
+    await getFarmList();
     localStorage.setItem("MINI_USER_LOCATION", route.query.point)
     localStorage.setItem("MINI_USER_LOCATION_POINT", `POINT(${pointXy[0]} ${pointXy[1]})`)
     store.commit("home/SET_MINI_USER_LOCATION", route.query.point);

+ 31 - 18
src/views/old_mini/home/index.vue

@@ -9,7 +9,13 @@
         <!-- 天气遮罩 -->
         <div class="weather-mask" v-show="isExpanded" @click="handleMaskClick"></div>
         <!-- 天气 -->
-        <weather-info ref="weatherInfoRef" class="weather-info" @weatherExpanded="weatherExpanded" :isGarden="false" @changeGarden="changeGarden"></weather-info>
+        <weather-info
+            ref="weatherInfoRef"
+            class="weather-info"
+            @weatherExpanded="weatherExpanded"
+            :isGarden="false"
+            @changeGarden="changeGarden"
+        ></weather-info>
         <div class="farm-monitor-container" :class="{ 'container-role': curRole == 2 }">
             <div class="farm-monitor-left" @click="handleCardClick(monitorCards.left)">
                 <div class="title">
@@ -73,18 +79,18 @@ const farmPopupType = ref("create");
 const gardenId = ref(null);
 
 const isGarden = ref(false);
-const changeGarden = ({id}) => {
+const changeGarden = ({ id }) => {
     gardenId.value = id;
     getExpertByFarmId();
-}
+};
 
 const expertInfo = ref({});
 const getExpertByFarmId = () => {
     VE_API.home.getExpertByFarmId({ farmId: gardenId.value }).then(({ data }) => {
         expertInfo.value = data || {};
-        sessionStorage.setItem('expertId',data.appUserId);
+        sessionStorage.setItem("expertId", data.appUserId);
     });
-}
+};
 
 // 监测卡片数据
 const monitorCards = ref({
@@ -109,16 +115,16 @@ const monitorCards = ref({
 
 // 卡片点击事件
 const handleCardClick = (card) => {
-    if(curRole == 0){
-        if(!isGarden.value){
+    if (curRole == 0) {
+        if (!isGarden.value) {
             showFarmPopup.value = true;
             return;
         }
     }
     if (card.route === "/pest") {
-        if(curRole == 2){
+        if (curRole == 2) {
             ElMessage.warning("该功能正在升级中,敬请期待");
-        }else{
+        } else {
             const dropdownGardenItem = ref({
                 organId: 766,
                 periodId: 1,
@@ -148,7 +154,7 @@ const handleBtn = () => {
 
 onActivated(() => {
     getBannerList();
-    isGarden.value = Boolean(localStorage.getItem('isGarden'));
+    isGarden.value = Boolean(localStorage.getItem("isGarden"));
     // 检测是否从创建农场页面成功返回
     if (route.query.showSuccess === "true") {
         farmPopupType.value = "success";
@@ -186,7 +192,7 @@ const getBannerList = () => {
     VE_API.home.warningPageList(params).then(({ data }) => {
         bannerObj.value = data[0] || {};
     });
-}
+};
 
 const isExpanded = ref(false);
 const weatherInfoRef = ref(null);
@@ -203,7 +209,7 @@ const handleMaskClick = () => {
 
 const handleBannerClick = () => {
     router.push(`/warning_detail?id=${bannerObj.value.id}`);
-}
+};
 </script>
 
 <style scoped lang="scss">
@@ -217,22 +223,29 @@ const handleBannerClick = () => {
         height: 200px;
         position: relative;
         z-index: 1;
-        .banner-img{
+        .banner-img {
             width: 100%;
             height: 100%;
             object-fit: cover;
         }
-        .banner-title{
+        .banner-title {
             position: absolute;
             bottom: 0;
             left: 0;
             width: 100%;
             padding: 10px 12px 34px 12px;
             box-sizing: border-box;
-            background-color: rgba(0, 0, 0, 0.35);
+            background: linear-gradient(
+                180deg,
+                rgba(102, 102, 102, 0) -64.3%,
+                rgba(0, 0, 0, 0.0074) -1.43%,
+                rgba(0, 0, 0, 0.684747) 39.67%,
+                rgba(0, 0, 0, 0.74) 40.09%,
+                rgba(0, 0, 0, 0.74) 83.2%
+            );
             color: #fff;
             font-weight: bold;
-            backdrop-filter: blur(4px);
+            backdrop-filter: blur(2px);
         }
     }
     .weather-mask {
@@ -314,9 +327,9 @@ const handleBannerClick = () => {
             }
         }
 
-        &.container-role{
+        &.container-role {
             height: 104px;
-            .farm-monitor-left{
+            .farm-monitor-left {
                 background: url("@/assets/img/home/farm-bg-4.png") no-repeat center center / 100% 100%;
             }
             .farm-monitor-right {