|
|
@@ -83,7 +83,7 @@ export default {
|
|
|
}
|
|
|
)
|
|
|
.exec();
|
|
|
- let ctxBg = '/index/static/img/zs.png'; //画布背景
|
|
|
+ let ctxBg = '/index/static/img/zszs.png'; //画布背景
|
|
|
let src = '/index/static/icon/erweima.jpg'; // 二维码
|
|
|
|
|
|
let context = uni.createCanvasContext('qrShareBox');
|
|
|
@@ -110,110 +110,193 @@ export default {
|
|
|
context.setFontSize(38* obj.ratio);
|
|
|
context.setFillStyle('#F5D0A2');
|
|
|
// context.fillText('感谢信', ((750 - obj.size) * obj.ratio) / 2, 260 * obj.ratio)
|
|
|
- context.setFontSize(30 * obj.ratio);
|
|
|
-
|
|
|
- if(obj.userName.length<=10){
|
|
|
- context.fillText('感谢 ' , 273 * obj.ratio, 500 * obj.ratio);
|
|
|
- context.fillText(obj.userName , 340 * obj.ratio, 500 * obj.ratio);
|
|
|
- context.fillText('您的爱心捐赠和善心!' , 273 * obj.ratio, 540 * obj.ratio);
|
|
|
- }else if(10< obj.userName.length && obj.userName.length <= 20){
|
|
|
- let center = Math.floor(obj.userName.length/2)
|
|
|
- let str1 = obj.userName.slice(0,center)
|
|
|
- let str2 = obj.userName.slice(center,)
|
|
|
- let des = 5*(20-obj.userName.length)
|
|
|
- context.fillText('感谢 ' , 260 * obj.ratio, 500 * obj.ratio);
|
|
|
+ context.setFontSize(40 * obj.ratio);
|
|
|
+ context.fillText('感谢 ' , 100 * obj.ratio, 460* obj.ratio)
|
|
|
+ let name = obj.userName
|
|
|
+ if(name.length <= 12) {
|
|
|
+ context.fillText(name, 200* obj.ratio, 460* obj.ratio)
|
|
|
+ }else if(name.length <= 18) {
|
|
|
+ let name1 = name.slice(0,9)
|
|
|
+ let name2 = name.slice(9,)
|
|
|
+ context.fillText(name1, 200* obj.ratio, 434* obj.ratio)
|
|
|
context.setTextAlign('center')
|
|
|
- context.fillText(str1 , (490 - des) * obj.ratio, 480 * obj.ratio);
|
|
|
-
|
|
|
-
|
|
|
- context.fillText(str2 , (490 - des) * obj.ratio, 520 * obj.ratio);
|
|
|
+ context.fillText(name2, 380* obj.ratio, 483* obj.ratio)
|
|
|
context.setTextAlign('left')
|
|
|
- context.fillText('您的爱心捐赠和善心!' , 260 * obj.ratio, 560 * obj.ratio);
|
|
|
- }else if(20< obj.userName.length && obj.userName.length <= 30){
|
|
|
-
|
|
|
- let str1 = obj.userName.slice(0,10)
|
|
|
- let str2 = obj.userName.slice(10,20)
|
|
|
- let str3 = obj.userName.slice(20,)
|
|
|
- context.fillText('感谢 ' , 260 * obj.ratio, 500 * obj.ratio);
|
|
|
- context.setFontSize(24* obj.ratio)
|
|
|
- context.fillText(str1 , 340 * obj.ratio, 460 * obj.ratio);
|
|
|
-
|
|
|
- context.fillText(str2 , 340 * obj.ratio, 490 * obj.ratio);
|
|
|
+ }else if(name.length <= 24) {
|
|
|
+ let name1 = name.slice(0,12)
|
|
|
+ let name2 = name.slice(12,)
|
|
|
+ context.fillText(name1, 200* obj.ratio, 434* obj.ratio)
|
|
|
context.setTextAlign('center')
|
|
|
- context.fillText(str3 , 460 * obj.ratio, 520 * obj.ratio);
|
|
|
- context.setFontSize(38* obj.ratio)
|
|
|
+ context.fillText(name2, 438* obj.ratio, 483* obj.ratio)
|
|
|
+ context.setTextAlign('left')
|
|
|
+ }else if(name.length <= 30) {
|
|
|
+ let name1 = name.slice(0,12)
|
|
|
+ let name2 = name.slice(12,22)
|
|
|
+ let name3 = name.slice(22,)
|
|
|
+ context.fillText(name1, 200* obj.ratio, 400* obj.ratio)
|
|
|
+ context.setTextAlign('center')
|
|
|
+ context.fillText(name2, 438* obj.ratio, 450* obj.ratio)
|
|
|
+ context.fillText(name3, 438* obj.ratio, 500* obj.ratio)
|
|
|
+ context.setTextAlign('left')
|
|
|
+ }else if(name.length <= 36) {
|
|
|
+ let name1 = name.slice(0,12)
|
|
|
+ let name2 = name.slice(12,24)
|
|
|
+ let name3 = name.slice(24,)
|
|
|
+ context.fillText(name1, 200* obj.ratio, 400* obj.ratio)
|
|
|
+ context.setTextAlign('center')
|
|
|
+ context.fillText(name2, 438* obj.ratio, 450* obj.ratio)
|
|
|
+ context.fillText(name3, 438* obj.ratio, 500* obj.ratio)
|
|
|
context.setTextAlign('left')
|
|
|
- context.fillText('您的爱心捐赠和善心!' , 260 * obj.ratio, 565 * obj.ratio);
|
|
|
- }
|
|
|
- context.setTextAlign('center')
|
|
|
- context.setFontSize(40* obj.ratio);
|
|
|
- context.setFillStyle('#321C0A');
|
|
|
- if(obj.userName.length <= 10){
|
|
|
- context.fillText(obj.userName , (750/2)* obj.ratio, 700 * obj.ratio);
|
|
|
- }else if(obj.userName.length <= 20){
|
|
|
- if(obj.userName.length <= 13){
|
|
|
- context.setFontSize(28* obj.ratio)
|
|
|
- context.fillText(obj.userName , (750/2)* obj.ratio, 700 * obj.ratio);
|
|
|
- }else {
|
|
|
- let center = Math.floor(obj.userName.length/2)
|
|
|
- console.log(center,'this.obj.userName.length.center')
|
|
|
- let str5 = obj.userName.slice(0,center)
|
|
|
- let str6 = obj.userName.slice(center,)
|
|
|
- context.setFontSize(28* obj.ratio)
|
|
|
- context.fillText(str5 , (750/2)* obj.ratio, 675 * obj.ratio);
|
|
|
- context.fillText(str6 , (750/2)* obj.ratio, 710 * obj.ratio);
|
|
|
- context.setFontSize(38* obj.ratio)
|
|
|
- }
|
|
|
-
|
|
|
- }else if(obj.userName.length <= 30){
|
|
|
- let str5 = obj.userName.slice(0,15)
|
|
|
- let str6 = obj.userName.slice(15,)
|
|
|
- context.setFontSize(24* obj.ratio)
|
|
|
- context.fillText(str5 , (750/2)* obj.ratio, 675 * obj.ratio);
|
|
|
- context.fillText(str6 , (750/2)* obj.ratio, 710 * obj.ratio);
|
|
|
- context.setFontSize(38* obj.ratio)
|
|
|
}
|
|
|
|
|
|
- //感谢您于2021年1月1日对于“关爱关心留守儿童”的爱心捐赠。特发此证书,以示感谢!红会博爱送温暖 爱康关怀暖人心
|
|
|
- context.setTextAlign('left')
|
|
|
- context.setFillStyle('#533113');
|
|
|
- context.setFontSize(30* obj.ratio);
|
|
|
-
|
|
|
- if(this.pid != 0){
|
|
|
- if(obj.itemName.length <= 6){
|
|
|
- context.fillText('感谢您于 ' + obj.showtime , 198* obj.ratio, 940 * obj.ratio);
|
|
|
- context.setTextAlign('center')
|
|
|
- context.fillText('对'+'"'+obj.itemName+'"'+ '的爱心捐赠。',(750/2+20)* obj.ratio,980 * obj.ratio)
|
|
|
- context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1025 * obj.ratio)
|
|
|
- }else if(obj.itemName.length > 6 && obj.itemName.length <= 20){
|
|
|
- let str1 = obj.itemName.slice(0,13)
|
|
|
- let str2 = obj.itemName.slice(13,)
|
|
|
- context.setFontSize(24* obj.ratio)
|
|
|
+ context.setFontSize(38 * obj.ratio);
|
|
|
+ context.fillText("感谢您于" + obj.showtime + "对于", 180* obj.ratio, 560* obj.ratio)
|
|
|
+ let str = '“' + obj.itemName + "”" + '的爱心捐赠。'
|
|
|
+ if(str.length < 15) {
|
|
|
+ context.fillText(str ,90* obj.ratio, 615* obj.ratio )
|
|
|
+ context.setTextAlign('center')
|
|
|
+ context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,695 * obj.ratio)
|
|
|
+ context.setTextAlign('left')
|
|
|
+
|
|
|
+ }else if(str.length < 30) {
|
|
|
+ if(str.length == 17) {
|
|
|
+ context.fillText(str ,85* obj.ratio, 615* obj.ratio )
|
|
|
context.setTextAlign('center')
|
|
|
- context.fillText('感谢您于 ' + obj.showtime + '对于', (750/2)* obj.ratio, 940 * obj.ratio);
|
|
|
- context.fillText('"'+str1,(750/2)* obj.ratio,970 * obj.ratio)
|
|
|
- context.fillText(str2+'"' + '的爱心捐赠。',(750/2)* obj.ratio,1000 * obj.ratio)
|
|
|
- context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1030 * obj.ratio)
|
|
|
-
|
|
|
- }else if(obj.itemName.length > 20 && obj.itemName.length <= 30){
|
|
|
- let str1 = obj.itemName.slice(0,18)
|
|
|
- let str2 = obj.itemName.slice(18,)
|
|
|
- context.setFontSize(22* obj.ratio)
|
|
|
+ context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,695 * obj.ratio)
|
|
|
+ context.setTextAlign('left')
|
|
|
+ }else {
|
|
|
+ let str1 = str.slice(0,16)
|
|
|
+ let str2 = str.slice(16,)
|
|
|
+ context.fillText(str1 ,85* obj.ratio, 615* obj.ratio )
|
|
|
+ context.fillText(str2 ,100* obj.ratio, 670* obj.ratio )
|
|
|
context.setTextAlign('center')
|
|
|
- context.fillText('感谢您于 ' + obj.showtime + '对于', (750/2)* obj.ratio, 940 * obj.ratio);
|
|
|
- context.fillText('"'+str1,(750/2)* obj.ratio,970 * obj.ratio)
|
|
|
- context.fillText(str2+'"'+'的爱心捐赠。',(750/2)* obj.ratio,1000 * obj.ratio)
|
|
|
- context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1030 * obj.ratio)
|
|
|
+ context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,750 * obj.ratio)
|
|
|
+ context.setTextAlign('left')
|
|
|
}
|
|
|
-
|
|
|
- }else {
|
|
|
- context.fillText('感谢您于 ' + obj.showtime , 198* obj.ratio, 940 * obj.ratio);
|
|
|
+ }else if(str.length < 48) {
|
|
|
+ let str1 = str.slice(0,16)
|
|
|
+ let str2 = str.slice(16,31)
|
|
|
+ let str3 = str.slice(31,)
|
|
|
+ context.fillText(str1 ,85* obj.ratio, 615* obj.ratio )
|
|
|
+ context.fillText(str2 ,100* obj.ratio, 670* obj.ratio )
|
|
|
+ context.fillText(str3 ,100* obj.ratio, 725* obj.ratio )
|
|
|
+ context.setTextAlign('center')
|
|
|
+ context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,805 * obj.ratio)
|
|
|
context.setTextAlign('left')
|
|
|
- context.fillText('的爱心捐赠。',198* obj.ratio,980 * obj.ratio)
|
|
|
+ }else if(str.length < 63) {
|
|
|
+ let str1 = str.slice(0,16)
|
|
|
+ let str2 = str.slice(16,31)
|
|
|
+ let str3 = str.slice(31,46)
|
|
|
+ let str4 = str.slice(46,)
|
|
|
+ context.fillText(str1 ,85* obj.ratio, 615* obj.ratio )
|
|
|
+ context.fillText(str2 ,100* obj.ratio, 670* obj.ratio )
|
|
|
+ context.fillText(str3 ,100* obj.ratio, 725* obj.ratio )
|
|
|
+ context.fillText(str4 ,100* obj.ratio, 780* obj.ratio )
|
|
|
context.setTextAlign('center')
|
|
|
- context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1025 * obj.ratio)
|
|
|
+ context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,860 * obj.ratio)
|
|
|
+ context.setTextAlign('left')
|
|
|
}
|
|
|
|
|
|
+ // if(obj.userName.length<=10){
|
|
|
+ // context.fillText('感谢 ' , 273 * obj.ratio, 500 * obj.ratio);
|
|
|
+ // context.fillText(obj.userName , 340 * obj.ratio, 500 * obj.ratio);
|
|
|
+ // context.fillText('您的爱心捐赠和善心!' , 273 * obj.ratio, 540 * obj.ratio);
|
|
|
+ // }else if(10< obj.userName.length && obj.userName.length <= 20){
|
|
|
+ // let center = Math.floor(obj.userName.length/2)
|
|
|
+ // let str1 = obj.userName.slice(0,center)
|
|
|
+ // let str2 = obj.userName.slice(center,)
|
|
|
+ // let des = 5*(20-obj.userName.length)
|
|
|
+ // context.fillText('感谢 ' , 260 * obj.ratio, 500 * obj.ratio);
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.fillText(str1 , (490 - des) * obj.ratio, 480 * obj.ratio);
|
|
|
+ // context.fillText(str2 , (490 - des) * obj.ratio, 520 * obj.ratio);
|
|
|
+ // context.setTextAlign('left')
|
|
|
+ // context.fillText('您的爱心捐赠和善心!' , 260 * obj.ratio, 560 * obj.ratio);
|
|
|
+ // }else if(20< obj.userName.length && obj.userName.length <= 30){
|
|
|
+
|
|
|
+ // let str1 = obj.userName.slice(0,10)
|
|
|
+ // let str2 = obj.userName.slice(10,20)
|
|
|
+ // let str3 = obj.userName.slice(20,)
|
|
|
+ // context.fillText('感谢 ' , 260 * obj.ratio, 500 * obj.ratio);
|
|
|
+ // context.setFontSize(24* obj.ratio)
|
|
|
+ // context.fillText(str1 , 340 * obj.ratio, 460 * obj.ratio);
|
|
|
+
|
|
|
+ // context.fillText(str2 , 340 * obj.ratio, 490 * obj.ratio);
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.fillText(str3 , 460 * obj.ratio, 520 * obj.ratio);
|
|
|
+ // context.setFontSize(38* obj.ratio)
|
|
|
+ // context.setTextAlign('left')
|
|
|
+ // context.fillText('您的爱心捐赠和善心!' , 260 * obj.ratio, 565 * obj.ratio);
|
|
|
+ // }
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.setFontSize(40* obj.ratio);
|
|
|
+ // context.setFillStyle('#F5D0A2');
|
|
|
+ // if(obj.userName.length <= 10){
|
|
|
+ // context.fillText(obj.userName , (750/2)* obj.ratio, 700 * obj.ratio);
|
|
|
+ // }else if(obj.userName.length <= 20){
|
|
|
+ // if(obj.userName.length <= 13){
|
|
|
+ // context.setFontSize(28* obj.ratio)
|
|
|
+ // context.fillText(obj.userName , (750/2)* obj.ratio, 700 * obj.ratio);
|
|
|
+ // }else {
|
|
|
+ // let center = Math.floor(obj.userName.length/2)
|
|
|
+ // console.log(center,'this.obj.userName.length.center')
|
|
|
+ // let str5 = obj.userName.slice(0,center)
|
|
|
+ // let str6 = obj.userName.slice(center,)
|
|
|
+ // context.setFontSize(28* obj.ratio)
|
|
|
+ // context.fillText(str5 , (750/2)* obj.ratio, 675 * obj.ratio);
|
|
|
+ // context.fillText(str6 , (750/2)* obj.ratio, 710 * obj.ratio);
|
|
|
+ // context.setFontSize(38* obj.ratio)
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }else if(obj.userName.length <= 30){
|
|
|
+ // let str5 = obj.userName.slice(0,15)
|
|
|
+ // let str6 = obj.userName.slice(15,)
|
|
|
+ // context.setFontSize(24* obj.ratio)
|
|
|
+ // context.fillText(str5 , (750/2)* obj.ratio, 675 * obj.ratio);
|
|
|
+ // context.fillText(str6 , (750/2)* obj.ratio, 710 * obj.ratio);
|
|
|
+ // context.setFontSize(38* obj.ratio)
|
|
|
+ // }
|
|
|
+
|
|
|
+ // //感谢您于2021年1月1日对于“关爱关心留守儿童”的爱心捐赠。特发此证书,以示感谢!红会博爱送温暖 爱康关怀暖人心
|
|
|
+ // context.setTextAlign('left')
|
|
|
+ // context.setFillStyle('#F5D0A2');
|
|
|
+ // context.setFontSize(30* obj.ratio);
|
|
|
+
|
|
|
+ // if(this.pid != 0){
|
|
|
+ // if(obj.itemName.length <= 6){
|
|
|
+ // context.fillText('感谢您于 ' + obj.showtime , 198* obj.ratio, 940 * obj.ratio);
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.fillText('对'+'"'+obj.itemName+'"'+ '的爱心捐赠。',(750/2+20)* obj.ratio,980 * obj.ratio)
|
|
|
+ // context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1025 * obj.ratio)
|
|
|
+ // }else if(obj.itemName.length > 6 && obj.itemName.length <= 20){
|
|
|
+ // let str1 = obj.itemName.slice(0,13)
|
|
|
+ // let str2 = obj.itemName.slice(13,)
|
|
|
+ // context.setFontSize(24* obj.ratio)
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.fillText('感谢您于 ' + obj.showtime + '对于', (750/2)* obj.ratio, 940 * obj.ratio);
|
|
|
+ // context.fillText('"'+str1,(750/2)* obj.ratio,970 * obj.ratio)
|
|
|
+ // context.fillText(str2+'"' + '的爱心捐赠。',(750/2)* obj.ratio,1000 * obj.ratio)
|
|
|
+ // context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1030 * obj.ratio)
|
|
|
+
|
|
|
+ // }else if(obj.itemName.length > 20 && obj.itemName.length <= 30){
|
|
|
+ // let str1 = obj.itemName.slice(0,18)
|
|
|
+ // let str2 = obj.itemName.slice(18,)
|
|
|
+ // context.setFontSize(22* obj.ratio)
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.fillText('感谢您于 ' + obj.showtime + '对于', (750/2)* obj.ratio, 940 * obj.ratio);
|
|
|
+ // context.fillText('"'+str1,(750/2)* obj.ratio,970 * obj.ratio)
|
|
|
+ // context.fillText(str2+'"'+'的爱心捐赠。',(750/2)* obj.ratio,1000 * obj.ratio)
|
|
|
+ // context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1030 * obj.ratio)
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }else {
|
|
|
+ // context.fillText('感谢您于 ' + obj.showtime , 198* obj.ratio, 940 * obj.ratio);
|
|
|
+ // context.setTextAlign('left')
|
|
|
+ // context.fillText('的爱心捐赠。',198* obj.ratio,980 * obj.ratio)
|
|
|
+ // context.setTextAlign('center')
|
|
|
+ // context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1025 * obj.ratio)
|
|
|
+ // }
|
|
|
+
|
|
|
|
|
|
// context.fillText('衷心感谢您对荆州市红十字事业的信任与支持', 155 * obj.ratio, 460 * obj.ratio);
|
|
|
// context.fillText('!我们已收到您的捐款', 40 * obj.ratio, 515 * obj.ratio);
|
|
|
@@ -376,12 +459,12 @@ page {
|
|
|
.content {
|
|
|
// background-color: pink;
|
|
|
width: 100%;
|
|
|
- height: 100vh;
|
|
|
+ // height: 100vh;
|
|
|
position: relative;
|
|
|
// overflow: hidden;
|
|
|
.image {
|
|
|
width: 100%;
|
|
|
- height: 100%;
|
|
|
+ height: 100vh;
|
|
|
}
|
|
|
.bgimg {
|
|
|
width: 100%;
|
|
|
@@ -394,18 +477,26 @@ page {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .tki-qrcode-canvas {
|
|
|
- width: 750rpx;
|
|
|
- height: 100vh;
|
|
|
- margin: 0 auto;
|
|
|
- // background-color: pink;
|
|
|
- }
|
|
|
+ // .tki-qrcode-canvas {
|
|
|
+ // width: 750rpx;
|
|
|
+ // height: 100vh;
|
|
|
+ // margin: 0 auto;
|
|
|
+ // // background-color: pink;
|
|
|
+ // }
|
|
|
|
|
|
.box {
|
|
|
|
|
|
color: #ffffff;
|
|
|
width: 100%;
|
|
|
height: 100vh;
|
|
|
+ .tki-qrcode-canvas {
|
|
|
+ // width: 700rpx;
|
|
|
+ // height: 1245rpx;
|
|
|
+ width: 750rpx;
|
|
|
+ // padding: 32rpx;
|
|
|
+ height: 1350rpx;
|
|
|
+ margin: 0 auto;
|
|
|
+ }
|
|
|
// background-color: pink;
|
|
|
|
|
|
// .music {
|