Commit f0e93793 authored by wangxuelai's avatar wangxuelai

''

parent 90532eef
......@@ -29,6 +29,9 @@ import {
import {
unlockmodesdetail,
} from '../../../service/customer/morethemeindex.js';
import {
wxGetImageInfo
} from '../../../utilities/wxApi.js';
import regexp from '../../../constants/regexp.js';
var app = getApp();
......@@ -1032,9 +1035,9 @@ Page({
})
},
generatelongimg() { // 生成日签
console.log(this.data.clock);
console.log(JSON.stringify(this.data.clock))
let baseHeight = 320;
let qrcode = '';
let clock = {
"id":100,
"school_id":4,
......@@ -1071,44 +1074,100 @@ Page({
let avatar = clock.school_student.avatar;
let nickname = clock.school_student.nickname;
let review = clock.review[1];
console.log(images);
this.getImagesInfo(images);
// wx.showLoading({
// title: '日签生成中...'
// })
// generateCustomerQrcode({
// scene: `tid=${this.data.tid}&cid=${this.data.cid}`,
// page: `src/pages/clockdetail/index`
// }).then((res) => {
// const {
// code,
// data
// } = res;
// if (code == 200) {
// qrcode = imagify(data.url);
// } else {
// qrcode = '';
// }
// this.setData({
// painting: {
// width: 750,
// height: 1334,
// views: [
// { // 二维码
// type: 'image',
// url: qrcode,
// top: 1168,
// left: 70,
// width: 120,
// height: 120
// },
// ]
// }
// })
// })
this.getImagesInfo(images, function(res) { // 将所有的图片转化成宽666 高度撑开的尺寸计算图片所占的高度
let imagesHeight = images.reduce(function (total, currentValue, currentIndex, arr) {
return total + currentValue.height;
}, 0);
imagesHeight = imagesHeight + (images.length - 1) * 20;
// let contentHeight = content /
});
wx.showLoading({
title: '日签生成中...'
})
generateCustomerQrcode({
scene: `tid=${this.data.tid}&cid=${this.data.cid}`,
page: `src/pages/clockdetail/index`
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
qrcode = imagify(data.url);
} else {
qrcode = '';
}
let painting = {
width: 375,
height: 1000,
views: [
{ // 二维码
type: 'image',
url: qrcode,
top: 1168,
left: 70,
width: 120,
height: 120
},
]
}
// this.setData({
// painting: {
// width: 750,
// height: 1000,
// views: [
// { // 二维码
// type: 'image',
// url: qrcode,
// top: 1168,
// left: 70,
// width: 120,
// height: 120
// },
// ]
// }
// })
})
},
getImagesInfo (images, callback) {
if (images.length == 0) {
callback&&callback(images);
}
let imageIndex = 0;
this.getSingleImageinfo(images, imageIndex, callback);
},
getImagesInfo (images) {
images
getSingleImageinfo(images, imageIndex, callback) {
if (imageIndex == images.length) {
callback&&callback(images)
return
}
wxGetImageInfo({
src: imagify(images[0].src)
}).then((res) => {
images[imageIndex].width = 333;
images[imageIndex].height = Math.floor((333* res.height)/(res.width) );
imageIndex = imageIndex + 1;
this.getSingleImageinfo(images, imageIndex, callback)
})
},
eventGetImage(e) {
const {
......
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 to comment