|
@@ -30,7 +30,7 @@ Page({
|
|
|
|
|
|
uptokenURL: '',
|
|
|
domain: '',
|
|
|
- uploadURL:''
|
|
|
+ uploadURL: ''
|
|
|
|
|
|
},
|
|
|
|
|
@@ -194,18 +194,26 @@ Page({
|
|
|
|
|
|
canvas.width = this.rpxToPx(670);
|
|
|
canvas.height = this.rpxToPx(1100);
|
|
|
+ const backgroundImage2 = await this.getImageInfo('https://file-cloud.fmode.cn/qpFbRRSZrO/20250113/bt19fm050427168.png');
|
|
|
|
|
|
+
|
|
|
+ canvas.drawImage(backgroundImage2, 0, 0, width, height);
|
|
|
+
|
|
|
+ const backgroundImage1 = await this.getImageInfo('https://file-cloud.fmode.cn/qpFbRRSZrO/20250113/1r3o3q045323287.png');
|
|
|
+
|
|
|
+
|
|
|
+ canvas.drawImage(backgroundImage1, 0, 0, width, height);
|
|
|
|
|
|
- canvas.setFillStyle('#CAE1FD');
|
|
|
- canvas.fillRect(0, 0, width, height);
|
|
|
+
|
|
|
+
|
|
|
canvas.setFillStyle('#0178EE');
|
|
|
- let mainimage = await this.getImageInfo(this.data.randomImage)
|
|
|
+
|
|
|
let avatar = Parse.User.current()?.get('avatar')
|
|
|
console.log('avatar', avatar);
|
|
|
let userAvatar = await this.getImageInfo(avatar)
|
|
|
console.log('userAvatar', userAvatar);
|
|
|
|
|
|
- canvas.drawImage(mainimage, 0, 0, width, this.rpxToPx(500));
|
|
|
+
|
|
|
|
|
|
if (userAvatar) {
|
|
|
|
|
@@ -257,25 +265,26 @@ Page({
|
|
|
|
|
|
|
|
|
|
|
|
- canvas.setFontSize(this.rpxToPx(28));
|
|
|
+ canvas.setFontSize(this.rpxToPx(22));
|
|
|
|
|
|
canvas.fillText('今日排名', this.rpxToPx(40), this.rpxToPx(840));
|
|
|
|
|
|
|
|
|
- canvas.fillText('今日步数', this.rpxToPx(240), this.rpxToPx(840));
|
|
|
+ canvas.fillText('今日步数', this.rpxToPx(180), this.rpxToPx(840));
|
|
|
|
|
|
|
|
|
- canvas.fillText('公里数', this.rpxToPx(440), this.rpxToPx(840));
|
|
|
+ canvas.fillText('公里数', this.rpxToPx(320), this.rpxToPx(840));
|
|
|
|
|
|
- canvas.setFontSize(this.rpxToPx(40));
|
|
|
- canvas.fillText(rank, this.rpxToPx(80), this.rpxToPx(900));
|
|
|
- canvas.fillText(steps, this.rpxToPx(240), this.rpxToPx(900));
|
|
|
- canvas.fillText(distance + 'km', this.rpxToPx(444), this.rpxToPx(900));
|
|
|
+ canvas.setFontSize(this.rpxToPx(34));
|
|
|
+ canvas.fillText(rank, this.rpxToPx(70), this.rpxToPx(900));
|
|
|
+ canvas.fillText(steps, this.rpxToPx(180), this.rpxToPx(900));
|
|
|
+ canvas.fillText(distance + 'km', this.rpxToPx(320), this.rpxToPx(900));
|
|
|
|
|
|
-
|
|
|
- canvas.setFillStyle('#0178EE');
|
|
|
- canvas.fillRect(width - this.rpxToPx(140), height - this.rpxToPx(160), this.rpxToPx(120), this.rpxToPx(120));
|
|
|
-
|
|
|
+
|
|
|
+ const qrCodeImage = await this.getImageInfo('https://file-cloud.fmode.cn/qpFbRRSZrO/20250113/t2vst6051431547.png');
|
|
|
+
|
|
|
+
|
|
|
+ canvas.drawImage(qrCodeImage, width - this.rpxToPx(140), height - this.rpxToPx(160), this.rpxToPx(120), this.rpxToPx(120));
|
|
|
|
|
|
canvas.setFillStyle('#0178EE');
|
|
|
canvas.setFontSize(this.rpxToPx(28));
|
|
@@ -305,7 +314,7 @@ Page({
|
|
|
uploadImageToServer() {
|
|
|
const that = this;
|
|
|
const tempFilePath = this.data.saveimage;
|
|
|
-
|
|
|
+
|
|
|
qiniuUploader.upload(
|
|
|
tempFilePath,
|
|
|
(res) => {
|
|
@@ -317,15 +326,14 @@ Page({
|
|
|
},
|
|
|
(error) => {
|
|
|
console.error('上传失败:', error);
|
|
|
- },
|
|
|
- {
|
|
|
+ }, {
|
|
|
region: "SCN",
|
|
|
uploadURL: that.data.uploadURL,
|
|
|
domain: that.data.domain,
|
|
|
uptoken: that.data.uptokenURL,
|
|
|
}
|
|
|
);
|
|
|
- console.log('saveimage',this.data.saveimage);
|
|
|
+ console.log('saveimage', this.data.saveimage);
|
|
|
},
|
|
|
async getUptoken() {
|
|
|
let res = await Parse.Cloud.run('qiniu_uptoken', {
|
|
@@ -500,65 +508,65 @@ Page({
|
|
|
savepic2: function () {
|
|
|
let that = this;
|
|
|
wx.canvasToTempFilePath({
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- width: 670,
|
|
|
- height: 1100,
|
|
|
- destWidth: 670,
|
|
|
- destHeight: 1100,
|
|
|
- canvasId: 'myCanvas',
|
|
|
- success: function (result) {
|
|
|
- wx.getSetting({
|
|
|
- success(res) {
|
|
|
- if (!res.authSetting['scope.writePhotosAlbum']) {
|
|
|
- wx.authorize({
|
|
|
- scope: 'scope.writePhotosAlbum',
|
|
|
- success() {
|
|
|
-
|
|
|
-
|
|
|
- wx.saveImageToPhotosAlbum({
|
|
|
- filePath: result.tempFilePath,
|
|
|
- success(res) {
|
|
|
- wx.showToast({
|
|
|
- title: '图片已保存到相册',
|
|
|
- icon: 'success'
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- fail() {
|
|
|
- wx.showToast({
|
|
|
- title: '打开相册授权,才能保存图片哦~',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- that.setData({
|
|
|
- openSettingBtnHidden: false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
-
|
|
|
- console.log(result.tempFilePath);
|
|
|
- wx.saveImageToPhotosAlbum({
|
|
|
- filePath: result.tempFilePath,
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ width: 670,
|
|
|
+ height: 1100,
|
|
|
+ destWidth: 670,
|
|
|
+ destHeight: 1100,
|
|
|
+ canvasId: 'myCanvas',
|
|
|
+ success: function (result) {
|
|
|
+ wx.getSetting({
|
|
|
success(res) {
|
|
|
- wx.showToast({
|
|
|
- title: '图片已保存到相册',
|
|
|
- icon: 'success'
|
|
|
- });
|
|
|
+ if (!res.authSetting['scope.writePhotosAlbum']) {
|
|
|
+ wx.authorize({
|
|
|
+ scope: 'scope.writePhotosAlbum',
|
|
|
+ success() {
|
|
|
+
|
|
|
+
|
|
|
+ wx.saveImageToPhotosAlbum({
|
|
|
+ filePath: result.tempFilePath,
|
|
|
+ success(res) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '图片已保存到相册',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail() {
|
|
|
+ wx.showToast({
|
|
|
+ title: '打开相册授权,才能保存图片哦~',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ that.setData({
|
|
|
+ openSettingBtnHidden: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+
|
|
|
+ console.log(result.tempFilePath);
|
|
|
+ wx.saveImageToPhotosAlbum({
|
|
|
+ filePath: result.tempFilePath,
|
|
|
+ success(res) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '图片已保存到相册',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- console.log(res)
|
|
|
- }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
+ },
|
|
|
shar() {
|
|
|
wx.downloadFile({
|
|
|
url: this.data.saveimage,
|
|
@@ -578,7 +586,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
sharecircle() {
|
|
|
- console.log('this.data.saveimage',this.data.saveimage);
|
|
|
+ console.log('this.data.saveimage', this.data.saveimage);
|
|
|
wx.navigateTo({
|
|
|
url: '../../circle/send-circle/index?image=' + this.data.saveimage
|
|
|
});
|