Commit c481c265 by doszhang

dos

parent 24d38c4c
...@@ -287,61 +287,41 @@ function createPoster(name, business) { ...@@ -287,61 +287,41 @@ function createPoster(name, business) {
$('#notification_area').remove(); $('#notification_area').remove();
my_notify('正在生成海报,请稍候', 60000); my_notify('正在生成海报,请稍候', 60000);
$.ajax({
url: '/index/addNum',
data: {
name: name,
business: business
},
type: 'POST'
});
let oldPosterIndex = nowPosterIndex;
if (oldPosterIndex == '') {
nowPosterIndex = RandomNumBoth(1, 3, oldPosterIndex);
} else {
nowPosterIndex = nowPosterIndex + 1;
if (nowPosterIndex > 3) {
nowPosterIndex = 1;
}
}
console.log('nowPosterIndex:', nowPosterIndex);
$('.poster-canvas canvas').remove(); $('.poster-canvas canvas').remove();
let canvasinfo = initCanvas('.poster-canvas', 'posterCanvas', 425 * 2, 820 * 2); let canvasinfo = initCanvas('.poster-canvas', 'posterCanvas', 640 * 2, 1238 * 2);
posterCanvas = canvasinfo[0]; posterCanvas = canvasinfo[0];
posterCtx = canvasinfo[1]; posterCtx = canvasinfo[1];
var posterObj = new Image(); var posterObj = new Image();
posterObj.src = '/Public/static/image2/poster' + nowPosterIndex + '.jpg'; posterObj.src = '/Public/static/image2/poster' + level + '.jpg';
posterObj.onload = function () { posterObj.onload = function () {
posterCtx.drawImage(posterObj, 0, 0, posterCanvas.width, posterCanvas.height); posterCtx.drawImage(posterObj, 0, 0, posterCanvas.width, posterCanvas.height);
var headimgObj = new Image(); // var headimgObj = new Image();
headimgObj.src = getManBase64(uploadCanvas); // headimgObj.src = getManBase64(uploadCanvas);
headimgObj.onload = function () { // headimgObj.onload = function () {
posterCtx.beginPath(); // posterCtx.beginPath();
posterCtx.arc(214 * 2, 446 * 2, 46 * 2, 0, 2 * Math.PI); // posterCtx.arc(214 * 2, 446 * 2, 46 * 2, 0, 2 * Math.PI);
posterCtx.fillStyle = "#fff"; //填充颜色,默认是黑色 // posterCtx.fillStyle = "#fff"; //填充颜色,默认是黑色
posterCtx.fill(); //画实心圆 // posterCtx.fill(); //画实心圆
posterCtx.closePath(); // posterCtx.closePath();
posterCtx.drawImage(headimgObj, 170 * 2, 402 * 2, 88 * 2, 88 * 2); // posterCtx.drawImage(headimgObj, 170 * 2, 402 * 2, 88 * 2, 88 * 2);
drawUserInfo(name, business, 20, 'bolder'); // drawUserInfo(name, business, 20, 'bolder');
setTimeout(function () { // setTimeout(function () {
drawNum(); // drawNum();
}, 200); // }, 200);
setTimeout(function () { // setTimeout(function () {
$('.poster-canvas .posterimg').remove(); // $('.poster-canvas .posterimg').remove();
$('.poster-canvas').append('<img class="posterimg" />'); // $('.poster-canvas').append('<img class="posterimg" />');
$('.posterimg').attr('src', getManBase64(posterCanvas)); // $('.posterimg').attr('src', getManBase64(posterCanvas));
$('.page1').hide(); // $('.page1').hide();
$('.poster-page').show(); // $('.poster-page').show();
$('#notification_area').remove(); // $('#notification_area').remove();
createPosterLock = false; // createPosterLock = false;
}, 500); // }, 500);
} // }
} }
} }
......
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 sign in to comment