Просмотр исходного кода

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

wangsisi 3 дней назад
Родитель
Сommit
e7c0a3adfd

+ 9 - 2
src/components/album_compoents/albumCarouselItem.vue

@@ -99,7 +99,10 @@
             <!-- 底部操作按钮 -->
             <!-- 底部操作按钮 -->
             <div class="bottom-actions" @click.stop="showPopup = false">
             <div class="bottom-actions" @click.stop="showPopup = false">
                 <div class="action-buttons">
                 <div class="action-buttons">
-                    <div class="action-btn green-btn" @click.stop="handleWechat">
+                    <div class="action-btn text-btn">
+                        &lt;&lt;长按图片保存或转发&gt;&gt;
+                    </div>
+                    <!-- <div class="action-btn green-btn" @click.stop="handleWechat">
                         <div class="icon-circle">
                         <div class="icon-circle">
                             <img src="@/assets/img/home/wechat.png" alt="" />
                             <img src="@/assets/img/home/wechat.png" alt="" />
                         </div>
                         </div>
@@ -110,7 +113,7 @@
                             <el-icon :size="24"><Download /></el-icon>
                             <el-icon :size="24"><Download /></el-icon>
                         </div>
                         </div>
                         <span class="btn-label">保存图片</span>
                         <span class="btn-label">保存图片</span>
-                    </div>
+                    </div> -->
                 </div>
                 </div>
                 <div class="cancel-btn" @click="handleCancel">取消</div>
                 <div class="cancel-btn" @click="handleCancel">取消</div>
             </div>
             </div>
@@ -526,6 +529,10 @@ const getPhotoSrc = (photo) => {
                 flex-direction: column;
                 flex-direction: column;
                 align-items: center;
                 align-items: center;
                 cursor: pointer;
                 cursor: pointer;
+                &.text-btn {
+                    font-size: 12px;
+                    color: rgba(255, 255, 255, 0.7);
+                }
 
 
                 .icon-circle {
                 .icon-circle {
                     width: 48px;
                     width: 48px;

+ 10 - 2
src/components/album_compoents/albumDrawBox.vue

@@ -24,7 +24,11 @@
         <!-- 底部操作按钮 -->
         <!-- 底部操作按钮 -->
         <div class="bottom-actions" @click.stop="showPopup = false">
         <div class="bottom-actions" @click.stop="showPopup = false">
             <div class="action-buttons">
             <div class="action-buttons">
-                <div class="action-btn green-btn" @click.stop="handleWechat">
+                
+                <div class="action-btn text-btn">
+                    &lt;&lt;长按图片保存或转发&gt;&gt;
+                </div>
+                <!-- <div class="action-btn green-btn" @click.stop="handleWechat">
                     <div class="icon-circle">
                     <div class="icon-circle">
                         <img src="@/assets/img/home/wechat.png" alt="" />
                         <img src="@/assets/img/home/wechat.png" alt="" />
                     </div>
                     </div>
@@ -35,7 +39,7 @@
                         <el-icon :size="24"><Download /></el-icon>
                         <el-icon :size="24"><Download /></el-icon>
                     </div>
                     </div>
                     <span class="btn-label">保存图片</span>
                     <span class="btn-label">保存图片</span>
-                </div>
+                </div> -->
             </div>
             </div>
             <div class="cancel-btn" @click="handleCancel">取消</div>
             <div class="cancel-btn" @click="handleCancel">取消</div>
         </div>
         </div>
@@ -759,6 +763,10 @@ canvas {
                 flex-direction: column;
                 flex-direction: column;
                 align-items: center;
                 align-items: center;
                 cursor: pointer;
                 cursor: pointer;
+                &.text-btn {
+                    font-size: 12px;
+                    color: rgba(255, 255, 255, 0.7);
+                }
 
 
                 .icon-circle {
                 .icon-circle {
                     width: 48px;
                     width: 48px;

+ 174 - 23
src/views/old_mini/achievement_report/index.vue

@@ -69,7 +69,7 @@
 
 
             <div class="bottom-btn">
             <div class="bottom-btn">
                 <div class="btn-item second" @click="handleDownload">保存图片</div>
                 <div class="btn-item second" @click="handleDownload">保存图片</div>
-                <div class="btn-item primay">转发</div>
+                <div class="btn-item primay" @click="handleDownload">转发</div>
             </div>
             </div>
         </div>
         </div>
 
 
@@ -103,6 +103,22 @@
             </div>
             </div>
         </div>
         </div>
     </div>
     </div>
+
+    <popup class="cavans-popup" v-model:show="showPopup">
+        <div class="cavans-content">
+            <img class="current-img" :src="pageImg" alt="" />
+        </div>
+        <!-- 底部操作按钮 -->
+        <div class="bottom-actions" @click.stop="showPopup = false">
+            <div class="action-buttons">
+                
+                <div class="action-btn text-btn">
+                    &lt;&lt;长按图片保存或转发&gt;&gt;
+                </div>
+            </div>
+            <div class="cancel-btn" @click="handleCancel">取消</div>
+        </div>
+    </popup>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
@@ -113,13 +129,15 @@ import html2canvas from "html2canvas";
 import { uploadBase64 } from "@/common/uploadImg";
 import { uploadBase64 } from "@/common/uploadImg";
 import { detectRuntimeEnvironment } from "@/common/commonFun";
 import { detectRuntimeEnvironment } from "@/common/commonFun";
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
+import { Popup } from "vant";
 import { base_img_url2 } from "@/api/config";
 import { base_img_url2 } from "@/api/config";
+import wx from "weixin-js-sdk";
 import AlbumDrawBox from "@/components/album_compoents/albumDrawBox.vue";
 import AlbumDrawBox from "@/components/album_compoents/albumDrawBox.vue";
 
 
 const route = useRoute();
 const route = useRoute();
 const loading = ref(false);
 const loading = ref(false);
 const workItem = ref({});
 const workItem = ref({});
-
+const showPopup = ref(false);
 function formatArea(val) {
 function formatArea(val) {
     const num = typeof val === "number" ? val : parseFloat(val);
     const num = typeof val === "number" ? val : parseFloat(val);
     if (Number.isNaN(num)) return val;
     if (Number.isNaN(num)) return val;
@@ -129,7 +147,6 @@ const paramsPage = ref({});
 onActivated(() => {
 onActivated(() => {
     window.scrollTo(0, 0);
     window.scrollTo(0, 0);
     paramsPage.value = route.query.miniJson ? JSON.parse(route.query.miniJson) : {};
     paramsPage.value = route.query.miniJson ? JSON.parse(route.query.miniJson) : {};
-    console.log('paramsPage', paramsPage.value);
     getDetail();
     getDetail();
     getResultReport();
     getResultReport();
 });
 });
@@ -158,6 +175,7 @@ const getDetail = () => {
 
 
 const isDowload = ref(true);
 const isDowload = ref(true);
 const reportDom = ref(null);
 const reportDom = ref(null);
+const pageImg = ref(null);
 
 
 async function handleDownload() {
 async function handleDownload() {
     isDowload.value = false;
     isDowload.value = false;
@@ -178,32 +196,20 @@ async function handleDownload() {
 
 
             // 转换为图片并下载
             // 转换为图片并下载
             const image = canvas.toDataURL("image/png");
             const image = canvas.toDataURL("image/png");
-            const process = detectRuntimeEnvironment();
-            if (process === "wechat-webview") {
-                const imgUrl = await uploadBase64(image, false);
-                const params = {
-                    miniUserId: 766,
-                    key: "report",
-                };
-                // VE_API.garden.editPopSave({ ...params, text: imgUrl }).then((res) => {
-                //     if (res.success) {
-                //         wx.miniProgram.navigateTo({
-                //             url: `/pages/subPages/report_page/index`,
-                //         });
-                //     } else {
-                //         ElMessage.error("保存失败");
-                //     }
-                // });
-            } else {
-                downloadImage(image, "成果报告");
-            }
-            isDowload.value = true;
+            pageImg.value = image;
+            nextTick(() => {
+                showPopup.value = true;
+            })
         } catch (error) {
         } catch (error) {
             isDowload.value = true;
             isDowload.value = true;
         }
         }
     });
     });
 }
 }
 
 
+const handleCancel = () => {
+    showPopup.value = false;
+};
+
 function downloadImage(dataUrl, filename) {
 function downloadImage(dataUrl, filename) {
     const link = document.createElement("a");
     const link = document.createElement("a");
     link.href = dataUrl;
     link.href = dataUrl;
@@ -304,6 +310,65 @@ function coverImageToBase64HD(imgUrl, cssWidth, cssHeight) {
     });
     });
 }
 }
 
 
+
+const userInfoStr = localStorage.getItem("localUserInfo");
+const userInfo = userInfoStr ? JSON.parse(userInfoStr) : {};
+
+async function handleForward() {
+    setTimeout(async () => {
+        // 获取要截图的DOM元素
+        const element = reportDom.value;
+
+        try {
+            const canvas = await html2canvas(element, {
+                scrollY: -window.scrollY, // 处理滚动条位置
+                allowTaint: true, // 允许跨域图片
+                useCORS: true, // 使用CORS
+                scale: 2, // 提高分辨率(2倍)
+                height: element.scrollHeight, // 设置完整高度
+                width: element.scrollWidth, // 设置完整宽度
+                logging: true, // 开启日志(调试用)
+            });
+
+            // 转换为图片并下载
+            const image = canvas.toDataURL("image/png");
+            const process = detectRuntimeEnvironment();
+            // if (process === "wechat-webview") {
+                const imgUrl = await uploadBase64(image, false);
+                const params = {
+                    val: 'share',
+                    key: "report",
+                };
+                VE_API.mine.saveSessionStore({ ...params, text: imgUrl }).then((res) => {
+                    if (res.success) {
+                        wx.miniProgram.navigateTo({
+                            url: `/pages/subPages/report_page/index`,
+                        });
+                    }
+                });
+            // }
+            isDowload.value = true;
+        } catch (error) {
+            isDowload.value = true;
+        }
+    });
+
+
+    // const image = await handleDownload(true);
+    // const imgUrl = await uploadBase64(image, false);
+    // const params = {
+    //     miniUserId: 766,
+    //     key: "report",
+    // };
+    // VE_API.mine.saveSessionStore({ ...params, text: imgUrl }).then((res) => {
+    //     if (res.success) {
+    //         wx.miniProgram.navigateTo({
+    //             url: `/pages/subPages/report_page/index`,
+    //         });
+    //     }
+    // });
+}
+
 watch(
 watch(
     () => [workItem.value.executeEvidence, workItem.value.reviewImage],
     () => [workItem.value.executeEvidence, workItem.value.reviewImage],
     ([preImgs, reviewImgs]) => {
     ([preImgs, reviewImgs]) => {
@@ -623,4 +688,90 @@ onUnmounted(() => {
         }
         }
     }
     }
 }
 }
+
+
+.cavans-popup {
+    width: 100%;
+    max-width: 100%;
+    max-height: 92vh;
+    background: none;
+    border-radius: 12px;
+    overflow: auto;
+    display: flex;
+    flex-direction: column;
+    backdrop-filter: 4px;
+    .cavans-content {
+        text-align: center;
+        padding: 0 12px;
+        height: fit-content;
+        overflow: auto;
+        .current-img {
+            width: 100%;
+        }
+    }
+
+    // 底部操作按钮
+    .bottom-actions {
+        flex-shrink: 0;
+
+        .action-buttons {
+            padding: 12px 0 4px 0;
+            display: flex;
+            justify-content: space-around;
+
+            .action-btn {
+                display: flex;
+                flex-direction: column;
+                align-items: center;
+                cursor: pointer;
+                &.text-btn {
+                    font-size: 12px;
+                    color: rgba(255, 255, 255, 0.7);
+                }
+
+                .icon-circle {
+                    width: 48px;
+                    height: 48px;
+                    border-radius: 50%;
+                    display: flex;
+                    align-items: center;
+                    justify-content: center;
+                    color: #fff;
+                    margin-bottom: 4px;
+
+                    .el-icon {
+                        color: #fff;
+                    }
+                    img {
+                        width: 50px;
+                    }
+                }
+
+                &.blue-btn .icon-circle {
+                    background: #2199f8;
+                }
+
+                &.green-btn .icon-circle {
+                    background: #07c160;
+                }
+
+                &.orange-btn .icon-circle {
+                    background: #ff790b;
+                }
+
+                .btn-label {
+                    font-size: 12px;
+                    color: #fff;
+                }
+            }
+        }
+
+        .cancel-btn {
+            text-align: center;
+            font-size: 18px;
+            color: #fff;
+            cursor: pointer;
+        }
+    }
+}
 </style>
 </style>

+ 1 - 0
src/views/old_mini/create_farm/index.vue

@@ -127,6 +127,7 @@
                                         <el-select class="select-item" v-model="ruleForm.userType" placeholder="请选择">
                                         <el-select class="select-item" v-model="ruleForm.userType" placeholder="请选择">
                                             <el-option label="普通用户" :value="1" />
                                             <el-option label="普通用户" :value="1" />
                                             <el-option label="托管用户" :value="2" />
                                             <el-option label="托管用户" :value="2" />
+                                            <el-option label="优质客户" :value="3" />
                                         </el-select>
                                         </el-select>
                                     </el-form-item>
                                     </el-form-item>
                                     <el-form-item label="农场名称" prop="name">
                                     <el-form-item label="农场名称" prop="name">

+ 11 - 0
src/views/old_mini/home/components/farmInfoPopup.vue

@@ -19,6 +19,11 @@
                             <span>{{ farmInfo.speciesName }}-{{ farmInfo.typeName }}</span>
                             <span>{{ farmInfo.speciesName }}-{{ farmInfo.typeName }}</span>
                         </template>
                         </template>
                     </field>
                     </field>
+                    <field v-model="farmInfo.userType" readonly label="客户类型">
+                        <template #input>
+                            <span>{{ userTypeMap[farmInfo.userType] }}</span>
+                        </template>
+                    </field>
                     <field v-model="farmInfo.fzr" readonly label="联系人" />
                     <field v-model="farmInfo.fzr" readonly label="联系人" />
                     <field v-model="farmInfo.tel" readonly label="联系电话" />
                     <field v-model="farmInfo.tel" readonly label="联系电话" />
                     <field class="address-field" v-model="farmInfo.address" readonly label="农场位置" />
                     <field class="address-field" v-model="farmInfo.address" readonly label="农场位置" />
@@ -40,6 +45,12 @@ import { useRouter } from "vue-router";
 import IndexMap from "../map/index.js";
 import IndexMap from "../map/index.js";
 import { useStore } from "vuex";
 import { useStore } from "vuex";
 
 
+const userTypeMap = {
+    1: '普通用户',
+    2: '托管用户',
+    3: '优质客户',
+};
+
 const props = defineProps({
 const props = defineProps({
     farmId: {
     farmId: {
         type: [Number, String],
         type: [Number, String],

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

@@ -379,7 +379,7 @@ onActivated(() => {
 });
 });
 
 
 const getButtonText = () => {
 const getButtonText = () => {
-    return agriculturalRole.value === 1 || workItem.value.executorUserId != userId.value;
+    return (agriculturalRole.value === 1 || workItem.value.executorUserId != userId.value) && !workItem.value?.reviewImage?.length;
 };
 };
 
 
 const getDetail = () => {
 const getDetail = () => {

+ 3 - 3
src/views/old_mini/user/index.vue

@@ -34,12 +34,12 @@
                             userType: ele.userType || '托管客户',
                             userType: ele.userType || '托管客户',
                             variety: ele.speciesName,
                             variety: ele.speciesName,
                             address: ele.address,
                             address: ele.address,
-                            maxWidth: '90px',
+                            maxWidth: '100%',
                             customRight: 'tag-right',
                             customRight: 'tag-right',
                         }"
                         }"
                         @click="handleItemClick(ele)"
                         @click="handleItemClick(ele)"
                     >
                     >
-                        <template #right>
+                        <!-- <template #right>
                             <el-popover title="" :popper-style="'min-width: 110px;'" :width="110" placement="left-start" trigger="click">
                             <el-popover title="" :popper-style="'min-width: 110px;'" :width="110" placement="left-start" trigger="click">
                                 <div class="tag-list">
                                 <div class="tag-list">
                                     <div class="tag-item">全托管</div>
                                     <div class="tag-item">全托管</div>
@@ -51,7 +51,7 @@
                                     <div class="title-tag add-tag">标记为</div>
                                     <div class="title-tag add-tag">标记为</div>
                                 </template>
                                 </template>
                             </el-popover>
                             </el-popover>
-                        </template>
+                        </template> -->
                         <template #footerData>
                         <template #footerData>
                             <div class="footer-data">
                             <div class="footer-data">
                                 <div class="footer-l">
                                 <div class="footer-l">