浏览代码

Merge branch 'supplies' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 into supplies

lxf 2 周之前
父节点
当前提交
44457dfa2c
共有 2 个文件被更改,包括 26 次插入12 次删除
  1. 5 0
      src/api/modules/home.js
  2. 21 12
      src/views/old_mini/home/index.vue

+ 5 - 0
src/api/modules/home.js

@@ -128,4 +128,9 @@ module.exports = {
         url: config.base_dev_url + "container_phenology_interaction/uploadAnswerData",
         type: "post",
     },
+    //获取农资用户所有农场
+    listByUserId: {
+        url: config.base_dev_url + "farm_subject/listByUserId",
+        type: "get",
+    },
 }

+ 21 - 12
src/views/old_mini/home/index.vue

@@ -19,12 +19,12 @@
         </div>
 
         <!-- 农场信息卡片 -->
-        <div class="farm-card">
+        <div class="farm-card" v-for="farm in farmList" :key="farm.id">
             <div class="farm-header">
                 <div class="farm-header-left">
                     <div class="farm-title">
-                        <span>{{ farmInfo.name }}</span>
-                        <div class="title-tags" @click="handleTitleTagClick(farmInfo.id)">
+                        <span>{{ farm.name }}</span>
+                        <div class="title-tags" @click="handleTitleTagClick(farm.id)">
                             <div class="title-tag tag-danger">
                                 <span>干旱预警</span>
                                 <el-icon>
@@ -33,7 +33,7 @@
                             </div>
                         </div>
                     </div>
-                    <div class="farm-subtitle">{{ farmInfo.address }}</div>
+                    <div class="farm-subtitle">xxxxx</div>
                 </div>
                 <div class="farm-more" @click="handleMoreClick">详情</div>
             </div>
@@ -94,12 +94,23 @@
 </template>
 
 <script setup>
-import { ref } from "vue";
+import { ref, onMounted } from "vue";
 import { Badge, ActionSheet } from 'vant';
 import { useRouter } from "vue-router";
 import wx from "weixin-js-sdk";
 const router = useRouter();
 
+onMounted(() => {
+    fetchListByUserId();
+});
+
+
+const farmList = ref([]);
+const fetchListByUserId = async () => {
+    const { data } = await VE_API.home.listByUserId();
+    farmList.value = data || [];
+};
+
 const showAddClient = ref(false);
 const handleAddClientSelf = () => {
     showAddClient.value = false;
@@ -125,7 +136,7 @@ const handleAddClient = () => {
 };
 
 
-const isShowPl = ref(false);
+const isShowPl = ref(true);
 const value = ref('')
 const options = [
     {
@@ -150,12 +161,6 @@ const options = [
     },
 ]
 
-const farmInfo = ref({
-    id: 98113,
-    name: "从化荔博园合作社",
-    address: "广东省广州市从化区某某街道",
-});
-
 const rows = ref([
     {
         label: "农情",
@@ -442,6 +447,10 @@ const handleInviteClick = (subjectId) => {
         }
     }
 
+    .farm-card + .farm-card{
+        margin-top: 12px;
+    }
+
     .custom-bottom-fixed-btns {
         &.center-btn {
             justify-content: center;