|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="achievement-report-page">
|
|
<div class="achievement-report-page">
|
|
|
<custom-header name="生成成果报告"></custom-header>
|
|
<custom-header name="生成成果报告"></custom-header>
|
|
|
- <div class="report-content">
|
|
|
|
|
|
|
+ <div ref="reportDom" class="report-content">
|
|
|
<div class="report-header">
|
|
<div class="report-header">
|
|
|
<img class="header-book" src="@/assets/img/home/book.png" alt="">
|
|
<img class="header-book" src="@/assets/img/home/book.png" alt="">
|
|
|
<div class="time-tag">2025.12.15</div>
|
|
<div class="time-tag">2025.12.15</div>
|
|
@@ -47,6 +47,8 @@
|
|
|
></album-carousel> -->
|
|
></album-carousel> -->
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ <el-button class="download-btn" type="primary" @click="handleDownload">转发</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -54,6 +56,9 @@
|
|
|
import CustomHeader from "@/components/customHeader.vue";
|
|
import CustomHeader from "@/components/customHeader.vue";
|
|
|
import AlbumCarousel from "@/components/album_compoents/albumCarousel";
|
|
import AlbumCarousel from "@/components/album_compoents/albumCarousel";
|
|
|
import { ref } from "vue";
|
|
import { ref } from "vue";
|
|
|
|
|
+import html2canvas from "html2canvas";
|
|
|
|
|
+import { uploadBase64 } from "@/common/uploadImg";
|
|
|
|
|
+import { detectRuntimeEnvironment } from "@/common/commonFun";
|
|
|
|
|
|
|
|
const reportBoxList = ref([
|
|
const reportBoxList = ref([
|
|
|
{
|
|
{
|
|
@@ -81,9 +86,9 @@ const executeViewImage = ref([
|
|
|
"baseMap": "https://birdseye-img.sysuimars.com/birdseye-look-mini/base_map/v2/111594.jpg",
|
|
"baseMap": "https://birdseye-img.sysuimars.com/birdseye-look-mini/base_map/v2/111594.jpg",
|
|
|
"blueZoneId": null,
|
|
"blueZoneId": null,
|
|
|
"district": "东莞市",
|
|
"district": "东莞市",
|
|
|
-// "filename": "birdseye-look-mini/91429/1763371316207.jpg",
|
|
|
|
|
|
|
+ "filename": "birdseye-look-mini/91429/1763371316207.jpg",
|
|
|
// "filename": "birdseye-look-mini/91429/1763461501781.png",
|
|
// "filename": "birdseye-look-mini/91429/1763461501781.png",
|
|
|
- "filename": "3f27e127-6497-4175-8efb-ba18d703852b/b1f6d99e-826d-4468-a6dd-83f9e7a12ea3/DJI_202512131000_001_b1f6d99e-826d-4468-a6dd-83f9e7a12ea3/DJI_20251213100724_0070_V_code-ws0fsmghvf91.jpeg",
|
|
|
|
|
|
|
+// "filename": "3f27e127-6497-4175-8efb-ba18d703852b/b1f6d99e-826d-4468-a6dd-83f9e7a12ea3/DJI_202512131000_001_b1f6d99e-826d-4468-a6dd-83f9e7a12ea3/DJI_20251213100724_0070_V_code-ws0fsmghvf91.jpeg",
|
|
|
"fosterCode": "LCGW-DGJH-GLY0253",
|
|
"fosterCode": "LCGW-DGJH-GLY0253",
|
|
|
"gardenId": null,
|
|
"gardenId": null,
|
|
|
"gardenName": "莞荔园",
|
|
"gardenName": "莞荔园",
|
|
@@ -119,6 +124,65 @@ const executeViewImage = ref([
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
const executeViewImage2 = ref(["birdseye-look-mini/91754/1763373487891.png"]);
|
|
const executeViewImage2 = ref(["birdseye-look-mini/91754/1763373487891.png"]);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const isDowload = ref(true);
|
|
|
|
|
+const reportDom = ref(null);
|
|
|
|
|
+
|
|
|
|
|
+async function handleDownload() {
|
|
|
|
|
+ isDowload.value = false;
|
|
|
|
|
+ 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 = {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ isDowload.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function downloadImage(dataUrl, filename) {
|
|
|
|
|
+ const link = document.createElement("a");
|
|
|
|
|
+ link.href = dataUrl;
|
|
|
|
|
+ link.download = filename;
|
|
|
|
|
+ document.body.appendChild(link);
|
|
|
|
|
+ link.click();
|
|
|
|
|
+ document.body.removeChild(link);
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -239,5 +303,14 @@ const executeViewImage2 = ref(["birdseye-look-mini/91754/1763373487891.png"]);
|
|
|
margin-top: 12px;
|
|
margin-top: 12px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ .download-btn {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ bottom: 20px;
|
|
|
|
|
+ left: 50%;
|
|
|
|
|
+ // background: #fff;
|
|
|
|
|
+ // box-shadow: 2px 2px 4.5px 0px #00000066;
|
|
|
|
|
+ // width: 100%;
|
|
|
|
|
+ transform: translateX(-50%);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|