Commit 10b7dead by doszhang

Merge branch 'master' into 'release'

Master

See merge request !11
parents ef83003d 4c5df047
...@@ -13,8 +13,8 @@ return array( ...@@ -13,8 +13,8 @@ return array(
'AUTH_CLIENT_ID' => 'zhida_app', 'AUTH_CLIENT_ID' => 'zhida_app',
'AUTH_CLIENT_PASSWORD' => 'izhida', 'AUTH_CLIENT_PASSWORD' => 'izhida',
/* CDN路径配置。配置之后可以在模版文件中使用__CDN__ */ /* CDN路径配置。配置之后可以在模版文件中使用__CDN__ */
'__CDN__' => 'https://static.iacode.cn/cdn/citic-fighting/tag/dc668d2755/Public/static', // '__CDN__' => 'https://static.iacode.cn/cdn/citic-fighting/tag/dc668d2754/Public/static',
// '__CDN__' => '/Public/static', // @readme <-- 上线时修改这里 '__CDN__' => '/Public/static', // @readme <-- 上线时修改这里
'URL_MODEL' => 3, 'URL_MODEL' => 3,
'STORAGE_PATH' => WEB_ROOT_PATH . '/Data/Storage', 'STORAGE_PATH' => WEB_ROOT_PATH . '/Data/Storage',
'DEFAULT_FILTER' => '', // 默认参数过滤方法 用于I函数...。注意这块不能修改!!!! 'DEFAULT_FILTER' => '', // 默认参数过滤方法 用于I函数...。注意这块不能修改!!!!
......
No preview for this file type
// new VConsole() // new VConsole()
var loadedImages = {}; var loadedImages = {};
function preloadimages(obj, complete_cb, progress_cb) { function preloadimages (obj, complete_cb, progress_cb) {
var loaded = 0; var loaded = 0;
var toload = 0; var toload = 0;
var images = obj instanceof Array ? [] : {}; var images = obj instanceof Array ? [] : {};
...@@ -21,7 +21,7 @@ function preloadimages(obj, complete_cb, progress_cb) { ...@@ -21,7 +21,7 @@ function preloadimages(obj, complete_cb, progress_cb) {
complete_cb(images); complete_cb(images);
} }
function load() { function load () {
loadedImages[this.url] = this; loadedImages[this.url] = this;
++loaded; ++loaded;
if (progress_cb) { if (progress_cb) {
...@@ -85,7 +85,7 @@ preloadimages(preloadImageList, function () { ...@@ -85,7 +85,7 @@ preloadimages(preloadImageList, function () {
uploadCanvas = canvasinfo[0]; uploadCanvas = canvasinfo[0];
uploadCtx = canvasinfo[1]; uploadCtx = canvasinfo[1];
}, function (progress) {}); }, function (progress) { });
// const originalHeight = document.documentElement.clientHeight || document.body.clientHeight; // const originalHeight = document.documentElement.clientHeight || document.body.clientHeight;
...@@ -114,8 +114,8 @@ $(document).ready(function () { ...@@ -114,8 +114,8 @@ $(document).ready(function () {
$('.username,.company').show(); $('.username,.company').show();
var mc = new Hammer($('.touch').get(0)); var mc = new Hammer($('.touch').get(0));
bindMc(mc, uploadCtx, uploadCanvas, img, imgInfo); bindMc(mc, uploadCtx, uploadCanvas, img, imgInfo);
drawVerticalText(uploadCtx, username, '#595857',25 * 2, 82 * 2, 300 * 2, true, 5 * 2); drawVerticalText(uploadCtx, username, '#595857', 25 * 2, 82 * 2, 300 * 2, true, 5 * 2);
drawVerticalText(uploadCtx, company, '#595857',25 * 2, 82 * 2, 440 * 2, true, 5 * 2); drawVerticalText(uploadCtx, company, '#595857', 25 * 2, 82 * 2, 440 * 2, true, 5 * 2);
}, imgInfo); }, imgInfo);
return false; return false;
}); });
...@@ -134,14 +134,14 @@ $(document).ready(function () { ...@@ -134,14 +134,14 @@ $(document).ready(function () {
// $('.poster-page .btn-change').on('click', changePoster); // $('.poster-page .btn-change').on('click', changePoster);
}); });
function toUploadPage() { function toUploadPage () {
$('.page1').hide(); $('.page1').hide();
$('.upload-page').show(); $('.upload-page').show();
$('.btn-createposter').hide(); $('.btn-createposter').hide();
// $('.btn-upload-block').css('left', 200); // $('.btn-upload-block').css('left', 200);
} }
function checkInfo() { function checkInfo () {
let name = $('input[name=name]').val(); let name = $('input[name=name]').val();
let code = $('input[name=job-number]').val(); let code = $('input[name=job-number]').val();
if (name.match(/^\s*$/)) { if (name.match(/^\s*$/)) {
...@@ -190,7 +190,7 @@ function checkInfo() { ...@@ -190,7 +190,7 @@ function checkInfo() {
}) })
} }
function setShare() { function setShare () {
var link = location.origin; var link = location.origin;
var friend_title = '2021年度MDRT注册会员荣誉海报'; var friend_title = '2021年度MDRT注册会员荣誉海报';
var friend_desc = ''; var friend_desc = '';
...@@ -210,19 +210,19 @@ function setShare() { ...@@ -210,19 +210,19 @@ function setShare() {
'imgUrl': link + '/Public/static/image2/share.jpg', 'imgUrl': link + '/Public/static/image2/share.jpg',
'title': friend_title, 'title': friend_title,
'desc': friend_desc, 'desc': friend_desc,
success: function () {} success: function () { }
}; };
window.wxTimelineData = { window.wxTimelineData = {
'link': link, 'link': link,
'imgUrl': link + '/Public/static/image2/share.jpg', 'imgUrl': link + '/Public/static/image2/share.jpg',
'title': timeline_desc, 'title': timeline_desc,
success: function () {} success: function () { }
}; };
wx.onMenuShareAppMessage(wxFriendData); wx.onMenuShareAppMessage(wxFriendData);
wx.onMenuShareTimeline(wxTimelineData); wx.onMenuShareTimeline(wxTimelineData);
} }
function initPage() { function initPage () {
const displacement = parseFloat(getTranslateDistance()); const displacement = parseFloat(getTranslateDistance());
// const wrapHeight = parseFloat($('.wrap').css('height')); // const wrapHeight = parseFloat($('.wrap').css('height'));
canvasHeight = 1238; canvasHeight = 1238;
...@@ -262,13 +262,13 @@ function initPage() { ...@@ -262,13 +262,13 @@ function initPage() {
// } // }
} }
function changePoster() { function changePoster () {
let name = $('input[name=name]').val(); let name = $('input[name=name]').val();
let business = $('input[name=business]').val(); let business = $('input[name=business]').val();
createPoster(name, business); createPoster(name, business);
} }
function backToHome() { function backToHome () {
$('.poster-page').hide(); $('.poster-page').hide();
$('.page1').show(); $('.page1').show();
} }
...@@ -314,7 +314,7 @@ function backToHome() { ...@@ -314,7 +314,7 @@ function backToHome() {
// } // }
// } // }
function createPoster() { function createPoster () {
$('#notification_area').remove(); $('#notification_area').remove();
my_notify('正在生成海报,请稍候', 60000); my_notify('正在生成海报,请稍候', 60000);
...@@ -329,6 +329,8 @@ function createPoster() { ...@@ -329,6 +329,8 @@ function createPoster() {
photo.src = getManBase64(uploadCanvas); photo.src = getManBase64(uploadCanvas);
photo.onload = function () { photo.onload = function () {
posterCtx.fillStyle = '#ffffff';
posterCtx.fillRect(0, 0, posterCanvas.width, posterCanvas.height);
posterCtx.drawImage(photo, 0, 0, posterCanvas.width, posterCanvas.height); posterCtx.drawImage(photo, 0, 0, posterCanvas.width, posterCanvas.height);
var posterMask = new Image(); var posterMask = new Image();
posterMask.src = '/Public/static/image2/poster-' + level + '.png?version=3' posterMask.src = '/Public/static/image2/poster-' + level + '.png?version=3'
...@@ -336,8 +338,8 @@ function createPoster() { ...@@ -336,8 +338,8 @@ function createPoster() {
setTimeout(function () { setTimeout(function () {
posterCtx.drawImage(posterMask, 0, 0, 640 * 2, 1238 * 2); posterCtx.drawImage(posterMask, 0, 0, 640 * 2, 1238 * 2);
drawVerticalText(uploadCtx, username, '#595857',25 * 2, 82 * 2, 300 * 2, true, 5 * 2); drawVerticalText(uploadCtx, username, '#595857', 25 * 2, 82 * 2, 300 * 2, true, 5 * 2);
drawVerticalText(uploadCtx, company, '#595857',25 * 2, 82 * 2, 440 * 2, true, 5 * 2); drawVerticalText(uploadCtx, company, '#595857', 25 * 2, 82 * 2, 440 * 2, true, 5 * 2);
$('#notification_area').remove(); $('#notification_area').remove();
$('.upload-page').hide(); $('.upload-page').hide();
...@@ -350,11 +352,11 @@ function createPoster() { ...@@ -350,11 +352,11 @@ function createPoster() {
} }
} }
function filterCompanyName(str) { function filterCompanyName (str) {
return str.includes('市') ? str.replace('市', '') : str; return str.includes('市') ? str.replace('市', '') : str;
} }
function drawVerticalText(ctx, text, color, fontSize, x, y, isBold, letterSpacing) { function drawVerticalText (ctx, text, color, fontSize, x, y, isBold, letterSpacing) {
ctx.save(); // 保存当前状态 ctx.save(); // 保存当前状态
// 设置字体样式,判断是否加粗 // 设置字体样式,判断是否加粗
...@@ -383,13 +385,13 @@ function drawVerticalText(ctx, text, color, fontSize, x, y, isBold, letterSpacin ...@@ -383,13 +385,13 @@ function drawVerticalText(ctx, text, color, fontSize, x, y, isBold, letterSpacin
ctx.restore(); // 恢复之前的状态 ctx.restore(); // 恢复之前的状态
} }
function confirmAvatar() { function confirmAvatar () {
$('.regulate-block').hide(); $('.regulate-block').hide();
} }
function inputLength() {} function inputLength () { }
function bindMc(mc, ctx, myCanvas, img, imgInfo) { function bindMc (mc, ctx, myCanvas, img, imgInfo) {
console.log(imgInfo.x, imgInfo.y) console.log(imgInfo.x, imgInfo.y)
mc.get('pan').set({ mc.get('pan').set({
direction: Hammer.DIRECTION_ALL direction: Hammer.DIRECTION_ALL
...@@ -419,8 +421,8 @@ function bindMc(mc, ctx, myCanvas, img, imgInfo) { ...@@ -419,8 +421,8 @@ function bindMc(mc, ctx, myCanvas, img, imgInfo) {
imgInfo.y += movedY * 2; imgInfo.y += movedY * 2;
drawImage(ctx, myCanvas, img, imgInfo); drawImage(ctx, myCanvas, img, imgInfo);
drawVerticalText(uploadCtx, username, '#595857',25 * 2, 82 * 2, 300 * 2, true, 5 * 2); drawVerticalText(uploadCtx, username, '#595857', 25 * 2, 82 * 2, 300 * 2, true, 5 * 2);
drawVerticalText(uploadCtx, company, '#595857',25 * 2, 82 * 2, 440 * 2, true, 5 * 2); drawVerticalText(uploadCtx, company, '#595857', 25 * 2, 82 * 2, 440 * 2, true, 5 * 2);
} }
}); });
var oldScale = 1; var oldScale = 1;
...@@ -436,8 +438,8 @@ function bindMc(mc, ctx, myCanvas, img, imgInfo) { ...@@ -436,8 +438,8 @@ function bindMc(mc, ctx, myCanvas, img, imgInfo) {
oldScale = event.scale; oldScale = event.scale;
imgInfo.scale *= nowScale; imgInfo.scale *= nowScale;
drawImage(ctx, myCanvas, img, imgInfo); drawImage(ctx, myCanvas, img, imgInfo);
drawVerticalText(uploadCtx, username, '#595857',25 * 2, 82 * 2, 300 * 2, true, 5 * 2); drawVerticalText(uploadCtx, username, '#595857', 25 * 2, 82 * 2, 300 * 2, true, 5 * 2);
drawVerticalText(uploadCtx, company, '#595857',25 * 2, 82 * 2, 440 * 2, true, 5 * 2); drawVerticalText(uploadCtx, company, '#595857', 25 * 2, 82 * 2, 440 * 2, true, 5 * 2);
} }
}); });
var oldRotation = 0; var oldRotation = 0;
...@@ -453,13 +455,13 @@ function bindMc(mc, ctx, myCanvas, img, imgInfo) { ...@@ -453,13 +455,13 @@ function bindMc(mc, ctx, myCanvas, img, imgInfo) {
oldRotation = event.rotation; oldRotation = event.rotation;
imgInfo.rotation += nowRotation; imgInfo.rotation += nowRotation;
drawImage(ctx, myCanvas, img, imgInfo); drawImage(ctx, myCanvas, img, imgInfo);
drawVerticalText(uploadCtx, username, '#595857',25 * 2, 82 * 2, 300 * 2, true, 5 * 2); drawVerticalText(uploadCtx, username, '#595857', 25 * 2, 82 * 2, 300 * 2, true, 5 * 2);
drawVerticalText(uploadCtx, company, '#595857',25 * 2, 82 * 2, 440 * 2, true, 5 * 2); drawVerticalText(uploadCtx, company, '#595857', 25 * 2, 82 * 2, 440 * 2, true, 5 * 2);
} }
}); });
} }
function bindUpload(that, ctx, myCanvas, index, callback, imgInfo) { function bindUpload (that, ctx, myCanvas, index, callback, imgInfo) {
imgInfo = { imgInfo = {
x: 0, x: 0,
y: 0, y: 0,
...@@ -506,7 +508,7 @@ function bindUpload(that, ctx, myCanvas, index, callback, imgInfo) { ...@@ -506,7 +508,7 @@ function bindUpload(that, ctx, myCanvas, index, callback, imgInfo) {
}); });
} }
function drawImage(ctx, myCanvas, img, imgInfo) { function drawImage (ctx, myCanvas, img, imgInfo) {
ctx.save(); ctx.save();
ctx.clearRect(0, 0, myCanvas.width, myCanvas.height); ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);
ctx.translate(myCanvas.width / 2, myCanvas.height / 2); ctx.translate(myCanvas.width / 2, myCanvas.height / 2);
...@@ -517,7 +519,7 @@ function drawImage(ctx, myCanvas, img, imgInfo) { ...@@ -517,7 +519,7 @@ function drawImage(ctx, myCanvas, img, imgInfo) {
ctx.restore(); ctx.restore();
} }
function drawNum() { function drawNum () {
posterCtx.font = 'normal ' + '48px normal'; posterCtx.font = 'normal ' + '48px normal';
let text1 = '已有'; let text1 = '已有';
let text2 = '人发起承诺'; let text2 = '人发起承诺';
...@@ -539,7 +541,7 @@ function drawNum() { ...@@ -539,7 +541,7 @@ function drawNum() {
txtDraw(posterCtx, text2, '#fff', text2X, 557 * 2); txtDraw(posterCtx, text2, '#fff', text2X, 557 * 2);
} }
function drawUserInfo(name, business, fontsize, fontweight) { function drawUserInfo (name, business, fontsize, fontweight) {
fontsize = fontsize * 2; fontsize = fontsize * 2;
posterCtx.font = fontweight + ' ' + fontsize + 'px text'; posterCtx.font = fontweight + ' ' + fontsize + 'px text';
let { let {
...@@ -562,7 +564,7 @@ function drawUserInfo(name, business, fontsize, fontweight) { ...@@ -562,7 +564,7 @@ function drawUserInfo(name, business, fontsize, fontweight) {
}; };
} }
function getX(name, business) { 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;
...@@ -581,7 +583,7 @@ function getX(name, business) { ...@@ -581,7 +583,7 @@ function getX(name, business) {
}; };
} }
function txtDraw(ctx, content, color, x, y, fontsize, fontWeight = 'normal') { function txtDraw (ctx, content, color, x, y, fontsize, fontWeight = 'normal') {
ctx.font = fontWeight + ' ' + fontsize + 'px zkkh'; ctx.font = fontWeight + ' ' + fontsize + 'px zkkh';
var width = ctx.measureText(content).width; var width = ctx.measureText(content).width;
var cx = x - width / 2; var cx = x - width / 2;
...@@ -589,18 +591,18 @@ function txtDraw(ctx, content, color, x, y, fontsize, fontWeight = 'normal') { ...@@ -589,18 +591,18 @@ function txtDraw(ctx, content, color, x, y, fontsize, fontWeight = 'normal') {
ctx.fillText(content, cx, y); ctx.fillText(content, cx, y);
} }
function txtDrawLeft(ctx, content, color, x, y, fontsize, fontWeight = 'normal') { function txtDrawLeft (ctx, content, color, x, y, fontsize, fontWeight = 'normal') {
ctx.font = fontWeight + ' ' + fontsize + 'px zkkh'; ctx.font = fontWeight + ' ' + fontsize + 'px zkkh';
var cx = x; var cx = x;
ctx.fillStyle = color; ctx.fillStyle = color;
ctx.fillText(content, cx, y); ctx.fillText(content, cx, y);
} }
function getManBase64(canvas) { function getManBase64 (canvas) {
return canvas.toDataURL('image/png'); return canvas.toDataURL('image/png');
} }
function initCanvas(target, id, canvasWidth, canvasHeight, useRem = false) { function initCanvas (target, id, canvasWidth, canvasHeight, useRem = false) {
if (useRem) { if (useRem) {
canvasWidth = pxToRem(canvasWidth); canvasWidth = pxToRem(canvasWidth);
canvasHeight = pxToRem(canvasHeight); canvasHeight = pxToRem(canvasHeight);
...@@ -614,7 +616,7 @@ function initCanvas(target, id, canvasWidth, canvasHeight, useRem = false) { ...@@ -614,7 +616,7 @@ function initCanvas(target, id, canvasWidth, canvasHeight, useRem = false) {
return [canvas, ctx]; return [canvas, ctx];
} }
function getTranslateDistance(cardinal = 0, abs = false) { function getTranslateDistance (cardinal = 0, abs = false) {
let wrapHeight = parseFloat($('.wrap').css('height')); let wrapHeight = parseFloat($('.wrap').css('height'));
let wrapInnerHeight = parseFloat($('.wrap-inner').css('height')); let wrapInnerHeight = parseFloat($('.wrap-inner').css('height'));
return (wrapHeight - wrapInnerHeight) / 2 + cardinal + 'px'; return (wrapHeight - wrapInnerHeight) / 2 + cardinal + 'px';
...@@ -623,7 +625,7 @@ function getTranslateDistance(cardinal = 0, abs = false) { ...@@ -623,7 +625,7 @@ function getTranslateDistance(cardinal = 0, abs = false) {
//获取随机数方法 //获取随机数方法
//min 最小值 //min 最小值
//max 最大值 //max 最大值
function RandomNumBoth(Min, Max, exclude = '') { function RandomNumBoth (Min, Max, exclude = '') {
var Range = Max - Min; var Range = Max - Min;
var Rand = Math.random(); var Rand = Math.random();
var num = Min + Math.round(Rand * Range); //四舍五入 var num = Min + Math.round(Rand * Range); //四舍五入
...@@ -636,7 +638,7 @@ function RandomNumBoth(Min, Max, exclude = '') { ...@@ -636,7 +638,7 @@ function RandomNumBoth(Min, Max, exclude = '') {
} }
} }
function checkIt(bind, maxNum) { function checkIt (bind, maxNum) {
var v = document.getElementById(bind).value; var v = document.getElementById(bind).value;
if (v == "") { if (v == "") {
return []; return [];
...@@ -659,7 +661,7 @@ function checkIt(bind, maxNum) { ...@@ -659,7 +661,7 @@ function checkIt(bind, maxNum) {
return true; return true;
} }
function timest() { function timest () {
var tmp = Date.parse(new Date()).toString(); var tmp = Date.parse(new Date()).toString();
tmp = tmp.substr(0, 10); tmp = tmp.substr(0, 10);
return tmp; return tmp;
......
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