|
|
@@ -69,7 +69,7 @@
|
|
|
|
|
|
<div class="bottom-btn">
|
|
|
<div class="btn-item second" @click="handleDownload">保存图片</div>
|
|
|
- <div class="btn-item primay">转发</div>
|
|
|
+ <div class="btn-item primay" @click="handleForward">转发</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -114,6 +114,7 @@ import { uploadBase64 } from "@/common/uploadImg";
|
|
|
import { detectRuntimeEnvironment } from "@/common/commonFun";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import { base_img_url2 } from "@/api/config";
|
|
|
+import wx from "weixin-js-sdk";
|
|
|
import AlbumDrawBox from "@/components/album_compoents/albumDrawBox.vue";
|
|
|
|
|
|
const route = useRoute();
|
|
|
@@ -159,7 +160,7 @@ const getDetail = () => {
|
|
|
const isDowload = ref(true);
|
|
|
const reportDom = ref(null);
|
|
|
|
|
|
-async function handleDownload() {
|
|
|
+async function handleDownload(isShare = false) {
|
|
|
isDowload.value = false;
|
|
|
setTimeout(async () => {
|
|
|
// 获取要截图的DOM元素
|
|
|
@@ -304,6 +305,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(
|
|
|
() => [workItem.value.executeEvidence, workItem.value.reviewImage],
|
|
|
([preImgs, reviewImgs]) => {
|