Selaa lähdekoodia

feat:添加农场提醒转发功能

wangsisi 7 tuntia sitten
vanhempi
commit
a4965148a3

+ 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">

+ 43 - 28
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>
@@ -89,16 +89,16 @@ const router = useRouter();
 const showShareSheet = ref(false);
 const shareOptions = ref([{ name: "微信", icon: "wechat", type: "wechat" }]);
 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 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);
@@ -106,22 +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 data = JSON.parse(route.query.miniJson);
-    // }else{
-    //     if (route.query.questInfo) {
-    //         const infoObj = JSON.parse(route.query.questInfo);
-    //         questInfo.value = {
-    //             quest: infoObj.quest,
-    //             answer: JSON.parse(infoObj.answer),
-    //         };
-    //     }
-    // }
+    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 = {
@@ -138,7 +153,7 @@ onActivated(() => {
 
 const getWarningDetail = () => {
     const params = {
-        id: route.query.id,
+        id: questId.value,
     };
     VE_API.home.warningDetail(params).then((res) => {
         warningDetail.value = res.data || {};
@@ -149,7 +164,7 @@ const activeUploadPopupRef = ref(null);
 const handleAnswerClick = (item) => {
     if (item.value != 0) {
         activeUploadPopupRef.value.showPopup({
-            gardenIdVal: route.query.farmId,
+            gardenIdVal: farmId.value,
             problemTitleVal: questInfo.value.quest,
             typeVal: "question",
             arrangeIdVal: route.query.arrangeId,
@@ -167,7 +182,7 @@ const getFarmPhoto = async () => {
     try {
         // 先获取有图片的日期列表
         const dateParams = {
-            farmId: route.query.farmId,
+            farmId: farmId.value,
             pageIndex: 0,
             limit: 10,
         };
@@ -185,7 +200,7 @@ const getFarmPhoto = async () => {
         while (result.length < 3 && dateIndex < dateList.length) {
             const currentDate = dateList[dateIndex];
             const imgParams = {
-                farmId: route.query.farmId,
+                farmId: farmId.value,
                 date: currentDate,
             };
             const { data } = await VE_API.farm.getImageInfo(imgParams);
@@ -212,7 +227,7 @@ const getFarmPhoto = async () => {
 };
 
 const handleSeeMore = () => {
-    router.push(`/farm_photo?farmId=${route.query.farmId}`);
+    router.push(`/farm_photo?farmId=${farmId.value}`);
 };
 </script>
 

+ 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}&farmId=${route.query.farmId}`);
+    };
+    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;
         }
     }
 }