Commit f9d5c56f by doszhang

dos

parent 6bf10bcc
...@@ -145,7 +145,7 @@ function createPoster(name, business) { ...@@ -145,7 +145,7 @@ function createPoster(name, business) {
nowPosterIndex = RandomNumBoth(1, 3, oldPosterIndex); nowPosterIndex = RandomNumBoth(1, 3, oldPosterIndex);
console.log('nowPosterIndex:', nowPosterIndex); console.log('nowPosterIndex:', nowPosterIndex);
let canvasinfo = initCanvas('.poster-canvas', 'posterCanvas', 425, 820); let canvasinfo = initCanvas('.poster-canvas', 'posterCanvas', 425 * 2, 820 * 2);
posterCanvas = canvasinfo[0]; posterCanvas = canvasinfo[0];
posterCtx = canvasinfo[1]; posterCtx = canvasinfo[1];
$('.poster-canvas').append('<img class="posterimg" />'); $('.poster-canvas').append('<img class="posterimg" />');
...@@ -158,11 +158,11 @@ function createPoster(name, business) { ...@@ -158,11 +158,11 @@ function createPoster(name, business) {
headimgObj.src = getManBase64(uploadCanvas); headimgObj.src = getManBase64(uploadCanvas);
headimgObj.onload = function () { headimgObj.onload = function () {
posterCtx.beginPath(); posterCtx.beginPath();
posterCtx.arc(214, 446, 46, 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, 402, 88, 88); posterCtx.drawImage(headimgObj, 170 * 2, 402 * 2, 88 * 2, 88 * 2);
drawUserInfo(name, business, 20, 'bolder'); drawUserInfo(name, business, 20, 'bolder');
drawNum(); drawNum();
setTimeout(function () { setTimeout(function () {
...@@ -181,7 +181,7 @@ function confirmAvatar() { ...@@ -181,7 +181,7 @@ function confirmAvatar() {
} }
function inputLength() { function inputLength() {
checkIt('name', 4); checkIt('name', 8);
} }
function bindMc(mc, ctx, myCanvas, img, imgInfo) { function bindMc(mc, ctx, myCanvas, img, imgInfo) {
...@@ -325,7 +325,7 @@ function drawNum() { ...@@ -325,7 +325,7 @@ function drawNum() {
} }
function drawUserInfo(name, business, fontsize, fontweight) { function drawUserInfo(name, business, fontsize, fontweight) {
// fontsize = fontsize * 2; fontsize = fontsize * 2;
posterCtx.font = fontweight + ' ' + fontsize + 'px normal'; posterCtx.font = fontweight + ' ' + fontsize + 'px normal';
let { let {
idX, idX,
...@@ -336,13 +336,13 @@ function drawUserInfo(name, business, fontsize, fontweight) { ...@@ -336,13 +336,13 @@ function drawUserInfo(name, business, fontsize, fontweight) {
let idObj = new Image(); let idObj = new Image();
idObj.src = '/Public/static/image2/id.png'; idObj.src = '/Public/static/image2/id.png';
idObj.onload = function () { idObj.onload = function () {
posterCtx.drawImage(idObj, idX, 497, idInfo.width, idInfo.height); posterCtx.drawImage(idObj, idX, 497 * 2, idInfo.width * 2, idInfo.height * 2);
txtDraw(posterCtx, name, '#fff', nameX, 512); txtDraw(posterCtx, name, '#fff', nameX, 512 * 2);
let noObj = new Image(); let noObj = new Image();
noObj.src = '/Public/static/image2/no.png'; noObj.src = '/Public/static/image2/no.png';
noObj.onload = function () { noObj.onload = function () {
posterCtx.drawImage(noObj, noX, 499, noInfo.width, noInfo.height); posterCtx.drawImage(noObj, noX, 499 * 2, noInfo.width * 2, noInfo.height * 2);
txtDraw(posterCtx, business, '#fff', businessX, 512); txtDraw(posterCtx, business, '#fff', businessX, 512 * 2);
}; };
}; };
} }
...@@ -351,12 +351,12 @@ function getX(name, business) { ...@@ -351,12 +351,12 @@ function getX(name, business) {
let nameWidth = posterCtx.measureText(name).width; let nameWidth = posterCtx.measureText(name).width;
let businessWidth = posterCtx.measureText(business).width; let businessWidth = posterCtx.measureText(business).width;
let totalWidth = idInfo.width + 6 + nameWidth + 21 + noInfo.width + 3 + businessWidth; let totalWidth = idInfo.width * 2 + 6 * 2 + nameWidth + 21 * 2 + noInfo.width * 2 + 3 * 2 + businessWidth;
let idX = 212 - totalWidth / 2; let idX = 212 * 2 - totalWidth / 2;
let nameX = idX + idInfo.width + 6; let nameX = idX + (idInfo.width * 2) + 6 * 2;
let noX = nameX + nameWidth + 21; let noX = nameX + nameWidth + 21 * 2;
let businessX = noX + noInfo.width + 3; let businessX = noX + noInfo.width + 3 * 2;
return { return {
idX, idX,
......
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