Explorar o código

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

lxf hai 5 horas
pai
achega
53897a3c9c

+ 1 - 1
src/components/pageComponents/FarmWorkPlanTimeline.vue

@@ -43,7 +43,7 @@
                                         <span class="tag-standard">标准农事</span>
                                     </div>
                                     <div class="header-right">
-                                        {{ fw.isFollow == 1 ? "已关注" : fw.isFollow == 2 ? "托管农事" : "取消关注" }}
+                                        {{ fw.isFollow == 1 ? "已关注" : fw.isFollow == 2 ? "托管农事" : "" }}
                                     </div>
                                 </div>
                                 <div class="card-content">

+ 176 - 9
src/views/old_mini/home/subPages/warningDetail.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="warning-detail">
-        <custom-header name="查看详情"></custom-header>
+        <custom-header name="查看详情" :isClose="route.query.miniJson ? true : false"></custom-header>
         <div class="article-content" :class="{ 'is-link': isLink }">
             <div class="article-header">
                 <div class="title">{{ warningDetail.title }}</div>
@@ -42,6 +42,30 @@
                 <span v-html="warningDetail.content"></span>
             </div>
 
+            <div class="photo-img-wrap-container" v-if="cropAlbum.length">
+                <div class="photo-img-wrap-title">
+                    <div class="title-text">
+                        <span>作物相册</span>
+                        <span class="count">({{ cropAlbum.length }})</span>
+                    </div>
+                    <span class="more" @click="handleSeeMore">查看更多</span>
+                </div>
+                <div class="photo-img-wrap">
+                    <photo-provider :photo-closable="true">
+                        <photo-consumer
+                            v-for="(src, index) in cropAlbum"
+                            intro="执行照片"
+                            :key="index"
+                            :src="base_img_url2 + src.filename"
+                        >
+                            <div class="photo-img">
+                                <img :src="base_img_url2 + src.filename + resize_300" />
+                            </div>
+                        </photo-consumer>
+                    </photo-provider>
+                </div>
+            </div>
+
             <div class="custom-bottom-fixed-btns" v-if="!isLink">
                 <div class="bottom-btn primary-btn" @click="showShareSheet = true">转发</div>
             </div>
@@ -54,17 +78,27 @@
 <script setup>
 import customHeader from "@/components/customHeader.vue";
 import { ref, onActivated } from "vue";
+import { base_img_url2, resize_300 } from "@/api/config";
 import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
 import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
-import { useRoute } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
+import wx from "weixin-js-sdk";
 
 const route = useRoute();
-
+const router = useRouter();
 const showShareSheet = ref(false);
 const shareOptions = ref([{ name: "微信", icon: "wechat", type: "wechat" }]);
-const handleShareSelect = (option) => {
-    console.log("option", option);
-
+const handleShareSelect = () => {
+    const query = {
+        askInfo: { title: "提醒客户", content: "是否分享该提醒给好友" },
+        shareText: warningDetail.value.title,
+        targetUrl: `warning_detail`,
+        paramsPage: JSON.stringify(route.query),
+        imageUrl: "https://birdseye-img.sysuimars.com/birdseye-look-mini/invite_bg.png",
+    };
+    wx.miniProgram.navigateTo({
+        url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
+    });
 };
 
 const isLink = ref(true);
@@ -72,10 +106,37 @@ const questInfo = ref({});
 const warningDetail = ref({});
 const showImage = ref(false);
 
+const questId = ref(null);
+const farmId = ref(null);
 onActivated(() => {
     showImage.value = route.query.showImage === "true" ? true : false;
     isLink.value = localStorage.getItem("SET_USER_CUR_ROLE") == 2 ? false : true;
     // isLink.value = true;
+    console.log("route.query", route.query);
+    if(route.query.miniJson){
+        const miniJson = JSON.parse(route.query.miniJson);
+        const data = JSON.parse(miniJson.paramsPage);
+        console.log("data", data);
+        questId.value = data.id;
+        farmId.value = data.farmId;
+        if (data.questInfo) {
+            const infoObj = JSON.parse(data.questInfo);
+            questInfo.value = {
+                quest: infoObj.quest,
+                answer: JSON.parse(infoObj.answer),
+            };
+        }
+    }else{
+        questId.value = route.query.id;
+        farmId.value = route.query.farmId;
+        if (route.query.questInfo) {
+            const infoObj = JSON.parse(route.query.questInfo);
+            questInfo.value = {
+                quest: infoObj.quest,
+                answer: JSON.parse(infoObj.answer),
+            };
+        }
+    }
     if (route.query.questInfo) {
         const infoObj = JSON.parse(route.query.questInfo);
         questInfo.value = {
@@ -83,12 +144,16 @@ onActivated(() => {
             answer: JSON.parse(infoObj.answer),
         };
     }
+    if(isLink.value){
+        // 获取图片数据
+        getFarmPhoto();
+    }
     getWarningDetail();
 });
 
 const getWarningDetail = () => {
     const params = {
-        id: route.query.id,
+        id: questId.value,
     };
     VE_API.home.warningDetail(params).then((res) => {
         warningDetail.value = res.data || {};
@@ -97,9 +162,9 @@ const getWarningDetail = () => {
 
 const activeUploadPopupRef = ref(null);
 const handleAnswerClick = (item) => {
-    if(item.value != 0) {
+    if (item.value != 0) {
         activeUploadPopupRef.value.showPopup({
-            gardenIdVal: route.query.farmId,
+            gardenIdVal: farmId.value,
             problemTitleVal: questInfo.value.quest,
             typeVal: "question",
             arrangeIdVal: route.query.arrangeId,
@@ -110,6 +175,60 @@ const handleAnswerClick = (item) => {
 const handleUploadSuccess = (data) => {
     console.log("data", data);
 };
+
+const cropAlbum = ref([]);
+// 获取作物相册的三张照片(参考 patrolPhoto 的获取逻辑)
+const getFarmPhoto = async () => {
+    try {
+        // 先获取有图片的日期列表
+        const dateParams = {
+            farmId: farmId.value,
+            pageIndex: 0,
+            limit: 10,
+        };
+        const { data: dateData } = await VE_API.farm.findHasImagesDate(dateParams);
+        const dateList = Array.isArray(dateData) ? dateData : [];
+        if (!dateList.length) {
+            cropAlbum.value = [];
+            return;
+        }
+
+        const result = [];
+        let dateIndex = 0;
+
+        // 按日期依次取图片,直到凑够 3 张或没有更多日期
+        while (result.length < 3 && dateIndex < dateList.length) {
+            const currentDate = dateList[dateIndex];
+            const imgParams = {
+                farmId: farmId.value,
+                date: currentDate,
+            };
+            const { data } = await VE_API.farm.getImageInfo(imgParams);
+            const images = (data && Array.isArray(data.images)) ? data.images : [];
+
+            images.forEach((item) => {
+                if (result.length < 3) {
+                    // 统一存成 filename 字段,供模板使用
+                    result.push({
+                        ...item,
+                        filename: item.resFilename || item.filename,
+                    });
+                }
+            });
+
+            dateIndex += 1;
+        }
+
+        cropAlbum.value = result;
+    } catch (e) {
+        console.error("获取农场相册失败", e);
+        cropAlbum.value = [];
+    }
+};
+
+const handleSeeMore = () => {
+    router.push(`/farm_photo?farmId=${farmId.value}`);
+};
 </script>
 
 <style scoped lang="scss">
@@ -171,6 +290,54 @@ const handleUploadSuccess = (data) => {
             }
         }
 
+        .photo-img-wrap-container{
+            padding: 10px;
+            border-radius: 5px;
+            border: 1px solid rgba(233, 233, 233, 0.5);
+            .photo-img-wrap-title{
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                font-size: 16px;
+                margin-bottom: 10px;
+                .title-text{
+                    display: flex;
+                    align-items: center;
+                    gap: 4px;
+                }
+                .more{
+                    color: rgba(0, 0, 0, 0.6);
+                    font-size: 12px;
+                }
+            }
+            .photo-img-wrap {
+                display: flex;
+                flex-wrap: wrap;
+                gap: 10px;
+                ::v-deep {
+                    .PhotoConsumer {
+                        width: 31%;
+                        height: 92px;
+                    }
+                }
+                .photo-img {
+                    width: 100%;
+                    height: 100%;
+                    position: relative;
+                    box-sizing: border-box;
+                    border: 2px solid transparent;
+                    border-radius: 8px;
+                    overflow: hidden;
+                    img {
+                        width: 100%;
+                        height: 100%;
+                        border-radius: 8px;
+                        object-fit: cover;
+                    }
+                }
+            }
+        }
+
         .article-box {
             margin-bottom: 12px;
             border-radius: 8px;

+ 0 - 2
src/views/old_mini/mine/pages/teamManage.vue

@@ -385,9 +385,7 @@ const handleShare = () => {
     const query = {
         askInfo: { title: "分享团队", content: "是否邀请好友加入团队" },
         shareText: "邀请您加入我的团队,快来查看吧~",
-        // farmId: 766,
         targetUrl: `user_info`,
-        // goBack: true,
         paramsPage: JSON.stringify({
             storeId: teamList.value[0]?.storeId || '',
         }),

+ 1 - 1
src/views/old_mini/modify_work/modify.vue

@@ -127,7 +127,7 @@
                         </div>
                     </div>
                     <div v-else class="interact-content">
-                        {{ detailData?.warmReminder }}
+                        {{ interactFormData?.interactionQuestion }}
                         <!-- <span class="edit-tag" @click="handleEditInteract(detailData)">点击编辑</span> -->
                     </div>
                 </div>

+ 43 - 33
src/views/old_mini/monitor/subPages/plan.vue

@@ -3,7 +3,12 @@
         <custom-header :name="pageType === 'plant' ? '种植方案' : '农事规划'"></custom-header>
         <div class="plan-content">
             <div class="plan-content-header" v-if="pageType === 'plant'">
-                <el-select class="select-item" v-model="specieValue" placeholder="选择品类" @change="() => getListMySchemes('left')">
+                <el-select
+                    class="select-item"
+                    v-model="specieValue"
+                    placeholder="选择品类"
+                    @change="() => getListMySchemes('left')"
+                >
                     <el-option
                         v-for="item in options"
                         :key="item.id"
@@ -20,18 +25,21 @@
                     @change="handleTabChange"
                 />
             </div>
-            <farm-work-plan-timeline
-                class="timeline-container"
+            <div
+                class="timeline-wrap"
                 :class="{
-                    'timeline-container-plant': pageType == 'plant',
-                    'timeline-container-no-permission': !hasPlanPermission,
+                    'timeline-container-plant-wrap': pageType == 'plant',
+                    'timeline-container-no-permission-wrap': !hasPlanPermission,
                 }"
-                :pageType="pageType"
-                :farmId="route.query.farmId"
-                :containerId="containerIdData"
-                @row-click="handleRowClick"
-                :disableClick="!hasPlanPermission"
-            />
+            >
+                <farm-work-plan-timeline
+                    :pageType="pageType"
+                    :farmId="route.query.farmId"
+                    :containerId="containerIdData"
+                    @row-click="handleRowClick"
+                    :disableClick="!hasPlanPermission"
+                />
+            </div>
         </div>
         <div class="custom-bottom-fixed-btns" v-has-permission="'农事规划'">
             <div class="bottom-btn-group">
@@ -101,7 +109,7 @@ import FarmWorkPlanTimeline from "@/components/pageComponents/FarmWorkPlanTimeli
 import { useRouter, useRoute } from "vue-router";
 import detailDialog from "@/components/detailDialog.vue";
 import eventBus from "@/api/eventBus";
-import { ElMessage,ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 const router = useRouter();
 const route = useRoute();
 
@@ -134,7 +142,7 @@ const getSpecieList = () => {
     VE_API.farm.fetchSpecieList({ agriculturalId: userInfo.agriculturalId }).then(({ data }) => {
         options.value = data || [];
         specieValue.value = data[0].defaultContainerId;
-        getListMySchemes('left');
+        getListMySchemes("left");
     });
 };
 
@@ -176,7 +184,7 @@ const getPhenologyList = async () => {
         containerSpaceTimeId: containerSpaceTimeId.value,
         agriculturalId: userInfo.agriculturalId,
         farmId: route.query.farmId,
-    }
+    };
     const res = await VE_API.monitor.listPhenology(params);
     if (res.code === 0) {
         mergedReproductiveList.value = res.data || [];
@@ -252,7 +260,7 @@ const handleCancelCopyPlan = () => {
                     if (code === 0) {
                         showCopyPlan.value = false;
                         ElMessage.success("删除成功");
-                        getListMySchemes('left');
+                        getListMySchemes("left");
                     }
                 });
         });
@@ -272,25 +280,27 @@ const handleConfirmCopyPlan = () => {
                 sourceSchemeId: active.value,
                 schemeName: copyPlanName.value,
             })
-            .then(({ code,data }) => {
+            .then(({ code, data }) => {
                 if (code === 0) {
                     showCopyPlan.value = false;
                     ElMessage.success("复制成功");
-                    getListMySchemes('right');
-                    currentTab.value = data
+                    getListMySchemes("right");
+                    currentTab.value = data;
+                }
+            });
+    } else {
+        VE_API.monitor
+            .renameScheme({
+                schemeId: active.value,
+                name: copyPlanName.value,
+            })
+            .then(({ code }) => {
+                if (code === 0) {
+                    showCopyPlan.value = false;
+                    ElMessage.success("修改成功");
+                    getListMySchemes("auto");
                 }
             });
-    }else{
-        VE_API.monitor.renameScheme({
-            schemeId: active.value,
-            name: copyPlanName.value,
-        }).then(({ code }) => {
-            if (code === 0) {
-                showCopyPlan.value = false;
-                ElMessage.success("修改成功");
-                getListMySchemes('auto');
-            }
-        });
     }
 };
 
@@ -353,14 +363,14 @@ const handleRowClick = (item) => {
             }
         }
 
-        .timeline-container {
+        .timeline-wrap {
             height: calc(100vh - 40px - 73px);
-            padding: 0 12px;
-            &.timeline-container-plant {
+            padding-left: 12px;
+            &.timeline-container-plant-wrap {
                 height: calc(100vh - 40px - 73px - 38px);
             }
             // 没有权限时,底部按钮不显示,高度增加 73px
-            &.timeline-container-no-permission {
+            &.timeline-container-no-permission-wrap {
                 height: calc(100vh - 40px - 18px);
             }
         }

+ 45 - 16
src/views/old_mini/task_condition/components/remindCustomer.vue

@@ -9,7 +9,7 @@
                         <div class="title van-multi-ellipsis--l2">{{ item.postInfo.title }}</div>
                         <div class="date">{{ formatDate(item.postInfo.createTime) }}</div>
                     </div>
-                    <div class="forward-btn" @click.stop="showShareSheet = true">转发</div>
+                    <div class="forward-btn" @click.stop="handleShare(item)">转发</div>
                 </div>
             </div>
         </div>
@@ -23,17 +23,42 @@
 import { ref, onMounted } from "vue";
 import customHeader from "@/components/customHeader.vue";
 import { useRouter, useRoute } from "vue-router";
+import wx from "weixin-js-sdk";
 import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
 const router = useRouter();
 const route = useRoute();
 // 服务记录列表数据
 const recordList = ref([]);
 const showShareSheet = ref(false);
-const shareOptions = ref([
-    { name: "微信", icon: "wechat", type: "wechat" },
-]);
-const handleShareSelect = (option) => {
-    console.log("option", option);
+const shareOptions = ref([{ name: "微信", icon: "wechat", type: "wechat" }]);
+const handleShareSelect = () => {
+    const query = {
+        askInfo: { title: "提醒客户", content: "是否分享该提醒给好友" },
+        shareText: shareParams.value.title,
+        targetUrl: `warning_detail`,
+        paramsPage: JSON.stringify(shareParams.value),
+        imageUrl: "https://birdseye-img.sysuimars.com/birdseye-look-mini/invite_bg.png",
+    };
+    wx.miniProgram.navigateTo({
+        url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
+    });
+};
+
+const shareParams = ref({});
+const handleShare = (item) => {
+    console.log("item", item);
+    shareParams.value = {
+        title: item.postInfo.title,
+        id: item.postInfo.postId,
+        questInfo: JSON.stringify({
+            quest: item.quest,
+            answer: item.answerOptions,
+        }),
+        arrangeId: item.arrangeId,
+        farmId: route.query.farmId,
+    };
+    console.log("shareParams", shareParams.value);
+    showShareSheet.value = true;
 };
 
 onMounted(() => {
@@ -41,9 +66,9 @@ onMounted(() => {
 });
 
 const getListWithAnswer = async () => {
-    const { data } = await VE_API.user.listWithAnswer({farmId:route.query.farmId});
+    const { data } = await VE_API.user.listWithAnswer({ farmId: route.query.farmId });
     if (data.length) {
-        recordList.value = data
+        recordList.value = data;
     }
 };
 const formatDate = (dateStr) => {
@@ -61,8 +86,12 @@ const handleItemClick = (data) => {
     const questInfo = {
         quest: data.quest,
         answer: data.answerOptions,
-    }
-    router.push(`/warning_detail?id=${data.postInfo.postId}&questInfo=${JSON.stringify(questInfo)}&arrangeId=${data.arrangeId}`);
+    };
+    router.push(
+        `/warning_detail?id=${data.postInfo.postId}&questInfo=${JSON.stringify(questInfo)}&arrangeId=${
+            data.arrangeId
+        }&farmId=${route.query.farmId}`
+    );
 };
 </script>
 <style lang="scss" scoped>
@@ -97,7 +126,7 @@ const handleItemClick = (data) => {
             display: flex;
             align-items: center;
             justify-content: space-between;
-            .card-body-left{
+            .card-body-left {
                 width: calc(100% - 62px - 12px);
                 height: 95%;
                 display: flex;
@@ -105,7 +134,7 @@ const handleItemClick = (data) => {
                 justify-content: space-between;
                 .date {
                     font-size: 13px;
-                    color: #86909C;
+                    color: #86909c;
                     margin-top: 4px;
                 }
             }
@@ -113,17 +142,17 @@ const handleItemClick = (data) => {
         .forward-btn {
             padding: 6px 19px;
             background: rgba(33, 153, 248, 0.1);
-            color: #2199F8;
+            color: #2199f8;
             border-radius: 25px;
             font-size: 12px;
         }
     }
-    .empty-wrap{
+    .empty-wrap {
         padding-top: 40px;
         text-align: center;
-        .empty-text{
+        .empty-text {
             font-size: 14px;
-            color: #86909C;
+            color: #86909c;
         }
     }
 }