|
|
|
|
|
|
|
|
posterBg:[false,false,false],//海报背景 |
|
|
posterBg:[false,false,false],//海报背景 |
|
|
qrCodeUrl:"",//二维码图片 |
|
|
qrCodeUrl:"",//二维码图片 |
|
|
userHead: app.globalData.userInfoData ? app.globalData.userInfoData.avatarUrl : null,//用户头像 |
|
|
userHead: app.globalData.userInfoData ? app.globalData.userInfoData.avatarUrl : null,//用户头像 |
|
|
rankNum: '0000',//缓存数字 |
|
|
|
|
|
|
|
|
rankNum: '0',//缓存数字 |
|
|
windowScale:0,//屏幕缩放比 |
|
|
windowScale:0,//屏幕缩放比 |
|
|
windowW: 0,//屏幕宽度 |
|
|
windowW: 0,//屏幕宽度 |
|
|
windowH: 0,//屏幕高度 |
|
|
windowH: 0,//屏幕高度 |
|
|
|
|
|
|
|
|
userInfoData: app.globalData.userInfoData, |
|
|
userInfoData: app.globalData.userInfoData, |
|
|
posterState:false,//海报是否合成完毕 |
|
|
posterState:false,//海报是否合成完毕 |
|
|
posterBottom:null, |
|
|
posterBottom:null, |
|
|
selectType:1 |
|
|
|
|
|
|
|
|
selectType:1, |
|
|
|
|
|
numBg:["","","",""], |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
wx.getImageInfo({//缓存数字背景 |
|
|
|
|
|
src: this.data.imgUrl + '/images/posterNum.png?v=004', |
|
|
|
|
|
|
|
|
// wx.getImageInfo({//缓存数字背景 |
|
|
|
|
|
// src: this.data.imgUrl + '/images/posterNum.png?v=004', |
|
|
|
|
|
// success: res => { |
|
|
|
|
|
// this.data.numBg = res.path; |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
wx.getImageInfo({//缓存数字背景1 |
|
|
|
|
|
src: this.data.imgUrl + '/newImages3/posterNum1.png?v=004', |
|
|
success: res => { |
|
|
success: res => { |
|
|
this.data.numBg = res.path; |
|
|
|
|
|
|
|
|
this.data.numBg[0] = res.path; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
wx.getImageInfo({//缓存数字背景2 |
|
|
|
|
|
src: this.data.imgUrl + '/newImages3/posterNum2.png?v=004', |
|
|
|
|
|
success: res => { |
|
|
|
|
|
this.data.numBg[1] = res.path; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
wx.getImageInfo({//缓存数字背景3 |
|
|
|
|
|
src: this.data.imgUrl + '/newImages3/posterNum3.png?v=004', |
|
|
|
|
|
success: res => { |
|
|
|
|
|
this.data.numBg[2] = res.path; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
wx.getImageInfo({//缓存数字背景4 |
|
|
|
|
|
src: this.data.imgUrl + '/newImages3/51.png?v=005', |
|
|
|
|
|
success: res => { |
|
|
|
|
|
this.data.numBg[3] = res.path; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wx.getImageInfo({//缓存海报底部图片 |
|
|
wx.getImageInfo({//缓存海报底部图片 |
|
|
src: this.data.imgUrl + "/newImages/posterBottom.png?v=002", |
|
|
src: this.data.imgUrl + "/newImages/posterBottom.png?v=002", |
|
|
success: res => { |
|
|
success: res => { |
|
|
|
|
|
|
|
|
ctx.setTextAlign('left'); |
|
|
ctx.setTextAlign('left'); |
|
|
ctx.fillText(app.globalData.userInfoData ? app.globalData.userInfoData.nickName : "", scale * 174, scale *960); |
|
|
ctx.fillText(app.globalData.userInfoData ? app.globalData.userInfoData.nickName : "", scale * 174, scale *960); |
|
|
//我是第XXX星探 |
|
|
//我是第XXX星探 |
|
|
ctx.drawImage(this.data.numBg, scale * 86, scale * 1010, scale * 563, scale * 124); |
|
|
|
|
|
|
|
|
// ctx.drawImage(this.data.numBg, scale * 86, scale * 1010, scale * 563, scale * 124); |
|
|
|
|
|
ctx.drawImage(this.data.numBg[0], scale * 86, scale * 1016, scale * 172, scale * 55); |
|
|
|
|
|
ctx.drawImage(this.data.numBg[1], scale * (303+this.data.rankNum.length*58), scale * 1016, scale * 111, scale * 54); |
|
|
|
|
|
ctx.drawImage(this.data.numBg[2], scale * 86, scale * 1098, scale * 308, scale * 32); |
|
|
//排名数字 |
|
|
//排名数字 |
|
|
ctx.drawImage(this.data.rankNum[0], scale * 286, scale * 1012, scale * 52, scale * 70); |
|
|
|
|
|
ctx.drawImage(this.data.rankNum[1], scale * 343, scale * 1012, scale * 52, scale * 70); |
|
|
|
|
|
ctx.drawImage(this.data.rankNum[2], scale * 401, scale * 1012, scale * 52, scale * 70); |
|
|
|
|
|
ctx.drawImage(this.data.rankNum[3], scale * 459, scale * 1012, scale * 52, scale * 70); |
|
|
|
|
|
|
|
|
for(let i=0;i<this.data.rankNum.length;i++){ |
|
|
|
|
|
ctx.drawImage(this.data.numBg[3], scale * (283+i*58), scale * 1010, scale * 58, scale * 77); |
|
|
|
|
|
ctx.drawImage(this.data.rankNum[i], scale * (285+i*59), scale * 1012, scale * 52, scale * 70); |
|
|
|
|
|
} |
|
|
//二维码 |
|
|
//二维码 |
|
|
ctx.drawImage(this.data.posterBottom, 0, scale * 1213, scale * 750, scale * 167); |
|
|
ctx.drawImage(this.data.posterBottom, 0, scale * 1213, scale * 750, scale * 167); |
|
|
ctx.drawImage(this.data.qrCodeUrl, scale * 566, scale * 1220, scale * 140, scale * 140); |
|
|
ctx.drawImage(this.data.qrCodeUrl, scale * 566, scale * 1220, scale * 140, scale * 140); |
|
|
|
|
|
|
|
|
if(res.code==200){ |
|
|
if(res.code==200){ |
|
|
if(res.data){ |
|
|
if(res.data){ |
|
|
if (res.data.certificationNum){ |
|
|
if (res.data.certificationNum){ |
|
|
if (res.data.certificationNum<10){ |
|
|
|
|
|
this.data.rankNum = ("000" + res.data.certificationNum.toString()).split(""); |
|
|
|
|
|
} else if (res.data.certificationNum < 100) { |
|
|
|
|
|
this.data.rankNum = ("00" + res.data.certificationNum.toString()).split(""); |
|
|
|
|
|
} else if (res.data.certificationNum < 1000) { |
|
|
|
|
|
this.data.rankNum = ("0" + res.data.certificationNum.toString()).split(""); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
res.data.certificationNum = 9990; |
|
|
this.data.rankNum = res.data.certificationNum.toString().split(""); |
|
|
this.data.rankNum = res.data.certificationNum.toString().split(""); |
|
|
} |
|
|
|
|
|
|
|
|
// console.log(this.data.rankNum); |
|
|
|
|
|
// } |
|
|
}else{ |
|
|
}else{ |
|
|
this.data.rankNum = "0000".split(""); |
|
|
|
|
|
|
|
|
this.data.rankNum = "0".split(""); |
|
|
} |
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
this.data.rankNum = "0000".split(""); |
|
|
|
|
|
|
|
|
this.data.rankNum = "0".split(""); |
|
|
} |
|
|
} |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
rankNum: this.data.rankNum |
|
|
rankNum: this.data.rankNum |