|
|
@ -9,14 +9,12 @@
|
|
|
|
<title>会议大屏</title>
|
|
|
|
<title>会议大屏</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/webs/resourse/iconfont.css" />
|
|
|
|
<link rel="stylesheet" type="text/css" href="/webs/resourse/iconfont.css" />
|
|
|
|
<!-- <script src="/webs/resourse/fabric.js"></script> -->
|
|
|
|
<!-- <script src="/webs/resourse/fabric.js"></script> -->
|
|
|
|
<!-- <script src="/webs/resourse/fabric_3_6_2.js"></script>
|
|
|
|
|
|
|
|
<script src="/webs/resourse/moment.js"></script>
|
|
|
|
|
|
|
|
<script src="/webs/resourse/html2canvas.min.js"></script> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script src="/webs/resourse/fabric_3_6_2.js"></script>
|
|
|
|
<script src="/webs/resourse/fabric_3_6_2.js"></script>
|
|
|
|
<script src="/webs/resourse/moment.js"></script>
|
|
|
|
<script src="/webs/resourse/moment.js"></script>
|
|
|
|
<script src="/webs/resourse/html2canvas.min.js"></script>
|
|
|
|
<script src="/webs/resourse/html2canvas.min.js"></script>
|
|
|
|
|
|
|
|
<!-- <script src="/webs/resourse/fabric_3_6_2.js"></script>
|
|
|
|
|
|
|
|
<script src="/webs/resourse/moment.js"></script>
|
|
|
|
|
|
|
|
<script src="/webs/resourse/html2canvas.min.js"></script> -->
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
body {
|
|
|
|
margin: 0;
|
|
|
|
margin: 0;
|
|
|
@ -275,7 +273,7 @@
|
|
|
|
img.setSrc(
|
|
|
|
img.setSrc(
|
|
|
|
image && image.imagePath
|
|
|
|
image && image.imagePath
|
|
|
|
? `http://localhost:9999/${image.imagePath}`
|
|
|
|
? `http://localhost:9999/${image.imagePath}`
|
|
|
|
: ImageControl,
|
|
|
|
: "",
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
// 默认
|
|
|
|
// 默认
|
|
|
|
let scaleY = 1;
|
|
|
|
let scaleY = 1;
|
|
|
@ -1038,13 +1036,28 @@
|
|
|
|
? (grid.height - parseInt(grid.lineWidth) * grid.rowCount) /
|
|
|
|
? (grid.height - parseInt(grid.lineWidth) * grid.rowCount) /
|
|
|
|
grid.rowCount
|
|
|
|
grid.rowCount
|
|
|
|
: 50;
|
|
|
|
: 50;
|
|
|
|
|
|
|
|
|
|
|
|
let index = 0;
|
|
|
|
let index = 0;
|
|
|
|
|
|
|
|
|
|
|
|
let loadImages = text.map((item) => {
|
|
|
|
let list = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Array.from({ length: rowCount * colCount }).map((_, i) => {
|
|
|
|
|
|
|
|
if (i < text.length) {
|
|
|
|
|
|
|
|
list.push(text[i]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const obj = {
|
|
|
|
|
|
|
|
formid: "",
|
|
|
|
|
|
|
|
perimage: "",
|
|
|
|
|
|
|
|
pername: "",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list.push(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let loadImages = list.map((item) => {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
fabric.Image.fromURL(
|
|
|
|
fabric.Image.fromURL(
|
|
|
|
`http://localhost:9999/${item.perimage}`,
|
|
|
|
item.perimage ? `http://localhost:9999/${item.perimage}` : "",
|
|
|
|
(img) => {
|
|
|
|
(img) => {
|
|
|
|
// 设置图片在Group内的相对位置
|
|
|
|
// 设置图片在Group内的相对位置
|
|
|
|
const scaleX = gridImgWidth / img.width;
|
|
|
|
const scaleX = gridImgWidth / img.width;
|
|
|
@ -1075,14 +1088,12 @@
|
|
|
|
let gridTop = (y - 1) * gridHeigth + parseInt(grid.lineWidth);
|
|
|
|
let gridTop = (y - 1) * gridHeigth + parseInt(grid.lineWidth);
|
|
|
|
let gridLeft = (x - 1) * gridWidth + parseInt(grid.lineWidth);
|
|
|
|
let gridLeft = (x - 1) * gridWidth + parseInt(grid.lineWidth);
|
|
|
|
|
|
|
|
|
|
|
|
if (text.length > index && text[index].perimage) {
|
|
|
|
|
|
|
|
child[index].set({
|
|
|
|
child[index].set({
|
|
|
|
top: gridTop,
|
|
|
|
top: gridTop,
|
|
|
|
left: gridLeft,
|
|
|
|
left: gridLeft,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
index++;
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const border = new fabric.Rect({
|
|
|
|
const border = new fabric.Rect({
|
|
|
|
width: gridWidth,
|
|
|
|
width: gridWidth,
|
|
|
@ -1153,6 +1164,7 @@
|
|
|
|
lockMovementY: true, //Y轴是否可被移动(true为不可)
|
|
|
|
lockMovementY: true, //Y轴是否可被移动(true为不可)
|
|
|
|
hasControls: false,
|
|
|
|
hasControls: false,
|
|
|
|
hasBorders: false,
|
|
|
|
hasBorders: false,
|
|
|
|
|
|
|
|
objectCaching: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 添加到画布
|
|
|
|
// 添加到画布
|
|
|
@ -1161,6 +1173,71 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let handleSetPhoto2 = (left, top, grid) => {
|
|
|
|
|
|
|
|
console.log("修改照片列表", grid);
|
|
|
|
|
|
|
|
const text =
|
|
|
|
|
|
|
|
grid && grid.text && Array.isArray(grid.text) ? grid.text : [];
|
|
|
|
|
|
|
|
const gridImgWidth = grid
|
|
|
|
|
|
|
|
? (grid.width - parseInt(grid.lineWidth) * grid.colCount) /
|
|
|
|
|
|
|
|
grid.colCount
|
|
|
|
|
|
|
|
: 100;
|
|
|
|
|
|
|
|
const gridImgHeigth = grid
|
|
|
|
|
|
|
|
? (grid.height - parseInt(grid.lineWidth) * grid.rowCount) /
|
|
|
|
|
|
|
|
grid.rowCount
|
|
|
|
|
|
|
|
: 50;
|
|
|
|
|
|
|
|
const rowCount = grid ? grid.rowCount : 5;
|
|
|
|
|
|
|
|
const colCount = grid ? grid.colCount : 1;
|
|
|
|
|
|
|
|
const list = canvas.getObjects();
|
|
|
|
|
|
|
|
let list2 = [];
|
|
|
|
|
|
|
|
Array.from({ length: rowCount * colCount }).map((_, i) => {
|
|
|
|
|
|
|
|
if (i < text.length) {
|
|
|
|
|
|
|
|
list2.push(text[i]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const obj = {
|
|
|
|
|
|
|
|
formid: "",
|
|
|
|
|
|
|
|
perimage: "",
|
|
|
|
|
|
|
|
pername: "",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
list2.push(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
list.forEach((obj) => {
|
|
|
|
|
|
|
|
if (obj.cvalue.id === grid.id) {
|
|
|
|
|
|
|
|
const count = obj._objects.length / 2;
|
|
|
|
|
|
|
|
let loadImagesStatus = obj._objects.map((item, index) => {
|
|
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
|
|
if (item.isType("image")) {
|
|
|
|
|
|
|
|
item.setSrc(
|
|
|
|
|
|
|
|
list2[index].perimage !== ""
|
|
|
|
|
|
|
|
? `http://localhost:9999/${list2[index].perimage}`
|
|
|
|
|
|
|
|
: "",
|
|
|
|
|
|
|
|
(img) => {
|
|
|
|
|
|
|
|
console.log(111111111111, item.left);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const scaleX = gridImgWidth / img.width;
|
|
|
|
|
|
|
|
const scaleY = gridImgHeigth / img.height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
img.set({
|
|
|
|
|
|
|
|
scaleX: scaleX,
|
|
|
|
|
|
|
|
scaleY: scaleY,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
canvas.renderAll();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ crossOrigin: "anonymous" }
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 所有图片加载完成后创建Group
|
|
|
|
|
|
|
|
Promise.all(loadImagesStatus).then((status) => {
|
|
|
|
|
|
|
|
canvas.renderAll();
|
|
|
|
|
|
|
|
canvas.requestRenderAll();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
//添加照片列表end============================
|
|
|
|
//添加照片列表end============================
|
|
|
|
|
|
|
|
|
|
|
|
//添加代表团列表start====================
|
|
|
|
//添加代表团列表start====================
|
|
|
@ -2162,15 +2239,20 @@
|
|
|
|
//添加时间控件列表start====================
|
|
|
|
//添加时间控件列表start====================
|
|
|
|
let timer = null;
|
|
|
|
let timer = null;
|
|
|
|
let handleSetSjkj = (left, top, grid) => {
|
|
|
|
let handleSetSjkj = (left, top, grid) => {
|
|
|
|
|
|
|
|
const dataTime = grid.text ? grid.text : Date.now();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let date = grid ? moment(Date.now()).format(grid.formatPar) : moment(Date.now()).format('YYYY年MM月DD日')
|
|
|
|
let date = grid
|
|
|
|
let date = grid
|
|
|
|
? moment(Date.now()).format(grid.formatPar)
|
|
|
|
? moment(dataTime, grid.formatPar).format(grid.formatPar)
|
|
|
|
: moment(Date.now()).format("YYYY年MM月DD日");
|
|
|
|
: moment(Date.now()).format("YYYY年MM月DD日");
|
|
|
|
|
|
|
|
|
|
|
|
const textWidth = grid ? parseInt(grid.width) : 200;
|
|
|
|
const textWidth = grid ? parseInt(grid.width) : 200;
|
|
|
|
const textHeight = grid ? parseInt(grid.height) : 100;
|
|
|
|
const textHeight = grid ? parseInt(grid.height) : 100;
|
|
|
|
let textTop = 0;
|
|
|
|
let textTop = 0;
|
|
|
|
|
|
|
|
// let textbox = new fabric.Textbox(grid ? moment(Date.now()).format(grid.formatPar) : moment(Date.now()).format("YYYY年MM月DD日"), {
|
|
|
|
let textbox = new fabric.Textbox(
|
|
|
|
let textbox = new fabric.Textbox(
|
|
|
|
grid
|
|
|
|
grid
|
|
|
|
? moment(Date.now()).format(grid.formatPar)
|
|
|
|
? moment(dataTime, grid.formatPar).format(grid.formatPar)
|
|
|
|
: moment(Date.now()).format("YYYY年MM月DD日"),
|
|
|
|
: moment(Date.now()).format("YYYY年MM月DD日"),
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fill:
|
|
|
|
fill:
|
|
|
@ -2225,10 +2307,19 @@
|
|
|
|
hasBorders: false,
|
|
|
|
hasBorders: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
canvas.add(group);
|
|
|
|
canvas.add(group);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let date2 = grid ? moment(dataTime, grid.formatPar) : moment(Date.now());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("date2", date2);
|
|
|
|
timer = setInterval(() => {
|
|
|
|
timer = setInterval(() => {
|
|
|
|
|
|
|
|
// 每秒更新并显示时间
|
|
|
|
|
|
|
|
date2.add(1, "seconds"); // 增加1秒
|
|
|
|
|
|
|
|
// console.log(date2.format(grid.formatPar));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// group.item(1).set({ text: grid ? moment(Date.now()).format(grid.formatPar) : moment(Date.now()).format(bjctDate) });
|
|
|
|
group.item(1).set({
|
|
|
|
group.item(1).set({
|
|
|
|
text: grid
|
|
|
|
text: grid
|
|
|
|
? moment(Date.now()).format(grid.formatPar)
|
|
|
|
? date2.format(grid.formatPar)
|
|
|
|
: moment(Date.now()).format(bjctDate),
|
|
|
|
: moment(Date.now()).format(bjctDate),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
canvas.renderAll();
|
|
|
|
canvas.renderAll();
|
|
|
@ -2603,7 +2694,7 @@
|
|
|
|
case "7": //照片列表
|
|
|
|
case "7": //照片列表
|
|
|
|
console.log("删除图片", item);
|
|
|
|
console.log("删除图片", item);
|
|
|
|
|
|
|
|
|
|
|
|
canvas.remove(item);
|
|
|
|
// canvas.remove(item)
|
|
|
|
|
|
|
|
|
|
|
|
let imageObj = {};
|
|
|
|
let imageObj = {};
|
|
|
|
for (
|
|
|
|
for (
|
|
|
@ -2620,7 +2711,7 @@
|
|
|
|
let imageLIst = Object.assign({}, imageObj, {
|
|
|
|
let imageLIst = Object.assign({}, imageObj, {
|
|
|
|
text: result.ScreenData[key],
|
|
|
|
text: result.ScreenData[key],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
handleSetPhoto(imageLIst.top, imageLIst.left, imageLIst);
|
|
|
|
handleSetPhoto2(imageLIst.top, imageLIst.left, imageLIst);
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "8": //代表团列表
|
|
|
|
case "8": //代表团列表
|
|
|
@ -2760,6 +2851,7 @@
|
|
|
|
element.style.cssText = "";
|
|
|
|
element.style.cssText = "";
|
|
|
|
yt_content.style.cssText = "";
|
|
|
|
yt_content.style.cssText = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clearInterval(timer);
|
|
|
|
updateCanvas(result);
|
|
|
|
updateCanvas(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|