lxf преди 3 дни
родител
ревизия
e5c89a9945

+ 10 - 8
src/components/weatherInfo.vue

@@ -112,10 +112,11 @@ async function setFarmByGardenId(gardenIdValue) {
     
     // 先刷新农场列表,确保数据是最新的
     return new Promise((resolve) => {
-        VE_API.farm.userFarmSelectOption().then(({data}) => {
-            farmList.value = data || [];
-            if (data && data.length > 0) {
-                const targetFarm = data.find(farm => farm.id == gardenIdValue);
+        VE_API.farm.userFarmSelectOption({agriculturalQuery: false}).then(({data}) => {
+            const fullData = data.filter(item => item.userType === 2);
+            farmList.value = fullData || [];
+            if (fullData && fullData.length > 0) {
+                const targetFarm = fullData.find(farm => farm.id == gardenIdValue);
                 if (targetFarm) {
                     farmName.value = targetFarm.name;
                     farmId.value = Number(gardenIdValue);
@@ -182,10 +183,11 @@ function selectFarmFromList(data) {
 
 // 获取农场列表(不处理传入的gardenId)
 function getFarmListWithoutGardenId() {
-    VE_API.farm.userFarmSelectOption().then(({data}) => {
-        farmList.value = data || []
-        if (data && data.length > 0) {
-            selectFarmFromList(data);
+    VE_API.farm.userFarmSelectOption({agriculturalQuery: false}).then(({data}) => {
+        const fullData = data.filter(item => item.userType === 2);
+        farmList.value = fullData || [];
+        if (fullData && fullData.length > 0) {
+            selectFarmFromList(fullData);
         }
     })
 }

+ 7 - 0
src/router/globalRoutes.js

@@ -51,6 +51,13 @@ export default [
         meta: { showTabbar: true, keepAlive: true },
         component: () => import("@/views/old_mini/agri_record/index.vue"),
     },
+    // 认证身份
+    {
+        path: "/authentication",
+        name: "Authentication",
+        component: () => import("@/views/old_mini/mine/pages/authentication.vue"),
+        meta: { keepAlive: true },
+    },
     // 编辑地图
     {
         path: "/edit_map",

+ 66 - 3
src/views/old_mini/agri_record/index.vue

@@ -1,7 +1,19 @@
 <template>
     <div class="agri-record-index" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
         <div class="record-content">
-            <div>天气</div>
+            <div>
+                <!-- 天气遮罩 -->
+                <div class="weather-mask" v-show="isExpanded" @click="handleMaskClick"></div>
+                <!-- 天气 -->
+                <weather-info
+                    ref="weatherInfoRef"
+                    class="weather-info"
+                    @weatherExpanded="weatherExpanded"
+                    @changeGarden="changeGarden"
+                    :isGarden="true"
+                    :gardenId="defaultGardenId"
+                ></weather-info>
+            </div>
             <div class="record-list">
                 <div class="line-title">农事记录</div>
                 <div class="task-content" v-loading="loading">
@@ -24,6 +36,7 @@
 <script setup>
 import { ref, onMounted, computed, onActivated } from "vue";
 import { useStore } from "vuex";
+import weatherInfo from "@/components/weatherInfo.vue";
 import taskItem from "@/components/taskItem.vue";
 
 const store = useStore();
@@ -36,6 +49,7 @@ onActivated(() => {
     getRecordList();
 });
 
+const defaultGardenId = ref(null);
 const taskList = ref([]);
 const loading = ref(false);
 const noData = ref(false);
@@ -49,13 +63,37 @@ const getRecordList = () => {
         .getSimpleList(params)
         .then(({ data }) => {
             loading.value = false;
-            taskList.value = data;
+            taskList.value = [...data, ...data];
             if(data.length === 0) {
                 noData.value = true;
             }
         })
 };
 
+
+const isExpanded = ref(false);
+const weatherExpanded = (isExpandedValue) => {
+    isExpanded.value = isExpandedValue;
+};
+
+const weatherInfoRef = ref(null);
+// 点击遮罩时收起天气
+const handleMaskClick = () => {
+    if (weatherInfoRef.value && weatherInfoRef.value.toggleExpand) {
+        weatherInfoRef.value.toggleExpand();
+    }
+};
+
+const finished = ref(false);
+const gardenId = ref(store.state.home.gardenId);
+const changeGarden = ({ id }) => {
+    localStorage.setItem('isGarden', true);
+    gardenId.value = id;
+    // 更新 store 中的状态
+    store.commit("home/SET_GARDEN_ID", id);
+    finished.value = false;
+};
+
 </script>
 
 <style lang="scss" scoped>
@@ -63,7 +101,6 @@ const getRecordList = () => {
     width: 100%;
     height: 100vh;
     box-sizing: border-box;
-    padding: 10px 12px;
     background: linear-gradient(180deg, #F9F9F9 0%, #F0F8FF 31.47%, #F9F9F9 46.81%, #F9F9F9 69.38%, #F9F9F9 100%);
     .line-title {
         padding: 10px 0;
@@ -82,5 +119,31 @@ const getRecordList = () => {
             border-radius: 20px;
         }
     }
+
+    .record-content {
+        position: relative;
+        height: 100%;
+        padding: 10px 12px;
+        box-sizing: border-box;
+        overflow: auto;
+    }
+    .weather-mask {
+        position: fixed;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+        background-color: rgba(0, 0, 0, 0.52);
+        z-index: 2;
+    }
+    .weather-info {
+        width: calc(100% - 20px);
+        position: absolute;
+        z-index: 3;
+    }
+    .record-list {
+        position: relative;
+        top: 100px;
+    }
 }
 </style>

+ 6 - 2
src/views/old_mini/mine/index.vue

@@ -173,9 +173,13 @@ const cellItems = computed(() => {
     ]
     if(curRole.value === 0) {
         list.unshift({
-            title: "认证农资",
-            path: "/register?identity=NZ",
+            title: "认证身份",
+            path: "/authentication",
         });
+        // list.unshift({
+        //     title: "认证农资",
+        //     path: "/register?identity=NZ",
+        // });
     }
     return list;
 });

+ 122 - 0
src/views/old_mini/mine/pages/authentication.vue

@@ -0,0 +1,122 @@
+<template>
+    <div class="authentication-page">
+        <custom-header name="认证身份"></custom-header>
+        <div class="content">
+            <span class="text">请选择您要认证的身份</span>
+            <div class="card-group">
+                <div
+                    :class="['card-item', { active: active === index }]"
+                    v-for="(item, index) in list"
+                    :key="index"
+                    @click="handleActive(item, index)"
+                >
+                    <div class="info">
+                        <div class="name">{{ item.name }}</div>
+                        <span>{{ item.desc }}</span>
+                    </div>
+                    <img :src="require(`@/assets/img/mine/${item.icon}-icon.png`)" alt="" />
+                </div>
+            </div>
+            <div class="button" @click="handleOk">选好了</div>
+        </div>
+    </div>
+</template>
+
+<script setup>
+import customHeader from "@/components/customHeader.vue";
+import {ref} from 'vue'
+import { useRouter } from "vue-router";
+const router = useRouter();
+
+const list = [
+    {
+        name:"专家",
+        desc:"根据表型触发农事,确认农事处方",
+        icon:"figure",
+        identity:"EXPERT",
+        role:3
+    },
+    {
+        name:"农资农服",
+        desc:"巡飞地形,收集农情测报",
+        icon:"drone",
+        identity:"NZ",
+        role:2
+    },
+]
+    // {
+    //     name:"农服",
+    //     desc:"接单执行,服务农户",
+    //     icon:"shield",
+    //     identity:"NF",
+    //     role:1
+    // }
+
+const active = ref(1)
+const handleActive = (item,index) =>{
+    active.value = index
+}
+
+const handleOk = () =>{
+    // router.push(`/register?identity=${list[active.value].identity}&role=${list[active.value].role}`)
+    router.push(`/register??identity=NZ`)
+}
+</script>
+
+<style lang="scss" scoped>
+.authentication-page {
+    width: 100%;
+    height: 100vh;
+    background-color: #f5f7fb;
+    .content {
+        height: calc(100% - 40px);
+        padding: 60px 30px;
+        box-sizing: border-box;
+        .text {
+            font-size: 18px;
+        }
+        .card-group {
+            margin-top: 26px;
+            .card-item {
+                background: #fff;
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                padding: 27px 20px;
+                border-radius: 2px;
+                border: 1px solid transparent;
+                &.active {
+                    background: rgba(33, 153, 248, 0.1);
+                    border: 1px solid #2199f8;
+                }
+                .info {
+                    .name {
+                        font-size: 18px;
+                        font-weight: bold;
+                        margin-bottom: 2px;
+                    }
+                    span {
+                        color: rgba(0, 0, 0, 0.2);
+                    }
+                }
+                img {
+                    width: 42px;
+                }
+            }
+
+            .card-item + .card-item {
+                margin-top: 20px;
+            }
+        }
+        .button {
+            color: #fff;
+            border-radius: 2px;
+            background: #2199f8;
+            text-align: center;
+            font-size: 16px;
+            padding: 8px 0;
+            margin-top: 50px;
+        }
+    }
+}
+</style>