修改海报图片合成

This commit is contained in:
xiaoaojiao
2025-09-14 15:20:03 +08:00
parent ab2568cd29
commit 5bcd9057fd
2 changed files with 18 additions and 2 deletions

View File

@@ -70,6 +70,9 @@ const handleSuccess = (response, index) => {
uploadItems.value[index].imageUrl = response.url; uploadItems.value[index].imageUrl = response.url;
ElMessage.success('上传成功!'); ElMessage.success('上传成功!');
} }
if (response && response.message !== 'success') {
ElMessage.error(response.message);
}
}; };
// 上传失败回调 // 上传失败回调

View File

@@ -32,7 +32,6 @@ import { globalStore } from "@/globalstore";
import ModalTransition from "./ModalTransition.vue" import ModalTransition from "./ModalTransition.vue"
import { Storage, generateQR, isWeixin, isMiniPage } from "../libs/utils" import { Storage, generateQR, isWeixin, isMiniPage } from "../libs/utils"
import Haibao from "@/libs/haibao" import Haibao from "@/libs/haibao"
import userPicture from "../assets/images/home-bg.png" //TODO: globalStore.result_url 这里得图片后面要换成用户参榜的图片
import bg from "../assets/images/haibao-bg.png" import bg from "../assets/images/haibao-bg.png"
import mask from "../assets/images/haibao-mask.png" import mask from "../assets/images/haibao-mask.png"
import haibaoCoverBorder from "../assets/images/haibao-cover.png" import haibaoCoverBorder from "../assets/images/haibao-cover.png"
@@ -56,6 +55,8 @@ const handleHaibao = async () => {
} }
const loading = weui.loading() const loading = weui.loading()
const userPicture = await loadImage('https://lzlj123.oss-cn-shanghai.aliyuncs.com/face-merged/20250910/face-merge-406c6990-249c-4248-b719-ecedf6e20848.jpg')
const infos = Storage.get("userinfos") const infos = Storage.get("userinfos")
const haibaoCover = new Haibao(951, 1607) const haibaoCover = new Haibao(951, 1607)
haibaoCover.add(userPicture, 0, 0) haibaoCover.add(userPicture, 0, 0)
@@ -89,6 +90,18 @@ const handleHaibao = async () => {
}) })
} }
function loadImage (src) {
return new Promise((resolve, reject) => {
const img = new Image();
img.crossOrigin = "Anonymous";
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`无法加载图片: ${src}`));
img.src = src;
});
}
const openQiwei = (e) => { const openQiwei = (e) => {
const target = e.currentTarget const target = e.currentTarget
@@ -261,7 +274,7 @@ const handleScan = (e) => {
left: 50%; left: 50%;
bottom: -5vw; bottom: -5vw;
top: initial; top: initial;
transform: translate3d(-50%,0,0); transform: translate3d(-50%, 0, 0);
} }
.qiwei .close { .qiwei .close {