Commit 077dc0d5 authored by “yiyousong”'s avatar “yiyousong”

pref:截图时候添加宽高

parent 721fb488
......@@ -392,10 +392,15 @@ export default {
if (valid) {
this.loading = true;
let conponentsId = document.getElementById("conponentsId");
let info = conponentsId.getBoundingClientRect();
let width = info.width;
let height = info.height;
html2canvas(conponentsId, {
backgroundColor: null,
useCORS: true,
dpi: window.devicePixelRatio * 4, //设备像素比
width: width,
height: height,
scale: 0.9,
})
.then(async (canvas) => {
......@@ -414,20 +419,24 @@ export default {
let { code } = res.data;
if (code === 1) {
this.formData.previewImagePath = res.data.url;
let result = await skinSave({
...this.facilityInfo,
...this.formData,
});
let { code, msg } = result.data;
if (code === 1) {
this.$message.success(msg);
this.$emit("addSkinSuccess");
this.backOne();
}
}
})
.then(async () => {
let res = await skinSave({
...this.facilityInfo,
...this.formData,
});
.catch((err) => {
this.$message.error("图片生成失败,请刷新重试");
console.log("err", err);
})
.finally(() => {
this.loading = false;
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.$emit("addSkinSuccess");
this.backOne();
}
});
}
});
......
......@@ -127,7 +127,7 @@ export default {
<style lang="less" scoped>
.window-skin-across {
width: 1000px;
height: 562.5px;
height: 562px;
padding: 20px;
background-image: linear-gradient(#26c5ff, #2c66ff);
background-repeat: no-repeat !important;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment