Commit 55cbde3c by 高淑倩

modify: 分享

parent adb321e8
...@@ -20,7 +20,6 @@ Component({ ...@@ -20,7 +20,6 @@ Component({
value: '' value: ''
} }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
...@@ -32,7 +31,7 @@ Component({ ...@@ -32,7 +31,7 @@ Component({
}, },
attached() { attached() {
// 获取小程序二维码 url
this.getMiniCode() this.getMiniCode()
}, },
...@@ -40,7 +39,6 @@ Component({ ...@@ -40,7 +39,6 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
//下载产品图片 //下载产品图片
getAvaterInfo: function () { getAvaterInfo: function () {
wx.showLoading({ wx.showLoading({
...@@ -96,37 +94,42 @@ Component({ ...@@ -96,37 +94,42 @@ Component({
wxService.post(`/merchant/contentMobileTerminal/getAppletQrCode`, data).then(res => { wxService.post(`/merchant/contentMobileTerminal/getAppletQrCode`, data).then(res => {
const { result, data } = res.data const { result, data } = res.data
if(result == 0){
if (result == 0) {
const fsm = wx.getFileSystemManager();
const FILE_BASE_NAME = 'tmp_base64src';
const base64src = function (data) {
return new Promise((resolve, reject) => {
const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.png`;
const buffer = wx.base64ToArrayBuffer(data);
fsm.writeFile({
filePath,
data: buffer,
encoding: 'binary',
success() {
resolve(filePath);
},
fail() {
reject(new Error('ERROR_BASE64SRC_WRITE'));
},
});
});
};
base64src(data).then(res => {
console.log(res)
this.setData({ this.setData({
codeImg: res // codeImg: data.codeUrl
}) codeImg: "https://hwimagecdn.ihotwind.cn/usr/201908/miniQrCode-f00c5051fef7479395efb193431762c4.jpg"
}) })
} }
// if (result == 0) {
// const fsm = wx.getFileSystemManager();
// const FILE_BASE_NAME = 'tmp_base64src';
// const base64src = function (data) {
// return new Promise((resolve, reject) => {
// const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.png`;
// const buffer = wx.base64ToArrayBuffer(data);
// fsm.writeFile({
// filePath,
// data: buffer,
// encoding: 'binary',
// success() {
// resolve(filePath);
// },
// fail() {
// reject(new Error('ERROR_BASE64SRC_WRITE'));
// },
// });
// });
// };
// base64src(data).then(res => {
// console.log(res)
// this.setData({
// codeImg: res
// })
// })
// }
}) })
}, },
...@@ -185,7 +188,7 @@ Component({ ...@@ -185,7 +188,7 @@ Component({
ctx.setFillStyle('#fff'); ctx.setFillStyle('#fff');
ctx.fillRect(0, 0, rect.width, height); ctx.fillRect(0, 0, rect.width, height);
//头像 // 图片
if (avaterSrc) { if (avaterSrc) {
if (imgInfo) { if (imgInfo) {
var imgheght = parseFloat(imgInfo); var imgheght = parseFloat(imgInfo);
...@@ -196,21 +199,22 @@ Component({ ...@@ -196,21 +199,22 @@ Component({
ctx.setTextAlign('left'); ctx.setTextAlign('left');
} }
//产品名称 // 品牌头像
if (that.data.userAvatar) { if (that.data.userAvatar) {
console.log(imgheght) console.log(imgheght)
ctx.drawImage(that.data.userAvatar, 12, 306, 25, 25); // ctx.drawImage(that.data.userAvatar, 12, 306, 25, 25);
ctx.drawImage(that.data.userAvatar, 12, 290, 40, 40);
ctx.setFontSize(14); ctx.setFontSize(14);
ctx.setFillStyle('#d8d8d8'); ctx.setFillStyle('#d8d8d8');
ctx.setTextAlign('left'); ctx.setTextAlign('left');
// ctx.fillText(that.data.userAvatar, left - 15, imgheght + 110); //电话 // ctx.fillText(that.data.userAvatar, left - 15, imgheght + 110); //电话
} }
// title
if (that.data.productDesc){ if (that.data.productDesc){
ctx.setFontSize(9); ctx.setFontSize(12);
ctx.setFillStyle('#333333'); ctx.setFillStyle('#333333');
ctx.setTextAlign('left'); ctx.setTextAlign('left');
ctx.fillText(that.data.productDesc, 41, 312); //电话 ctx.fillText(that.data.productDesc, 61, 300);
} }
...@@ -229,7 +233,7 @@ Component({ ...@@ -229,7 +233,7 @@ Component({
// 绘制二维码 // 绘制二维码
if (codeSrc) { if (codeSrc) {
ctx.drawImage(codeSrc, 170, 281, 50, 50) ctx.drawImage(codeSrc, 190, 281, 61.5, 61.5)
ctx.setFontSize(10); ctx.setFontSize(10);
ctx.setFillStyle('#000'); ctx.setFillStyle('#000');
// ctx.fillText("微信扫码或长按保存图片", left + 165, imgheght + 110); // ctx.fillText("微信扫码或长按保存图片", left + 165, imgheght + 110);
...@@ -239,9 +243,6 @@ Component({ ...@@ -239,9 +243,6 @@ Component({
ctx.draw(); ctx.draw();
wx.hideLoading(); wx.hideLoading();
}, 1000) }, 1000)
}, },
textByteLength(text, num) { // text为传入的文本 num为单行显示的字节长度 textByteLength(text, num) { // text为传入的文本 num为单行显示的字节长度
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
overflow: hidden; overflow: hidden;
} }
.poste_content{ .poste_content{
width: 410rpx; width: 524rpx;
margin: auto; margin: auto;
overflow: hidden; overflow: hidden;
margin-top: 153rpx; margin-top: 153rpx;
......
...@@ -25,8 +25,8 @@ wxService.page({ ...@@ -25,8 +25,8 @@ wxService.page({
console.log('thtrolleySku2Bu', JSON.parse(trolleySku2Buy)) console.log('thtrolleySku2Bu', JSON.parse(trolleySku2Buy))
// 下单 && 计算优惠价 // 下单 && 计算优惠价
if(trolleySku2Buy.length){ if(trolleySku2Buy.length){
this.getBill(trolleySku2Buy) // 下单 // this.getBill(trolleySku2Buy) // 下单
// this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价 this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价
} }
}, },
// 下单 // 下单
......
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