Commit c609778e by chenwq

提交

1 parent 95ba0670
......@@ -99,9 +99,38 @@ Component({
handleCopy(e) {
var { idx } = e.currentTarget.dataset
var currentItem = this.data.orderObj.activityList[idx]
console.log(currentItem)
// console.log(wxqrcode)
wxqrcode.createQrCodeImg(currentItem.activityUrl)
var qr = wxqrcode.createQrCodeImg(currentItem.activityUrl)
const base64src = function (base64data) {
return new Promise((resolve, reject) => {
const [a, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || []
if (!format) reject(new Error('ERROR_BASE64SRC_PARSE'))
const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}`
const buffer = wx.base64ToArrayBuffer(bodyData)
wx.getFileSystemManager().writeFile({
filePath,
data: buffer,
encoding: 'binary',
success() {
resolve(filePath)
},
fail() {
reject(new Error('ERROR_BASE64SRC_WRITE'))
}
})
})
}
base64src(qr).then(res => {
wx.getImageInfo({
src: res,
success(obj) {
wx.showShareImageMenu({
path: obj.path
})
},
fail() {
}
})
})
}
}
})
......@@ -13,9 +13,9 @@ Page({
scene1: null,
scene2: null,
scene3: null,
scene4: true
scene4: null
},
sceneActive: 4,
sceneActive: 1,
scenePriceList: [{
total: 0
}, {
......
......@@ -239,16 +239,16 @@ Page({
let sceneActive;
switch (this.data.actNum) {
case 0:
sceneActive = 1.1;
sceneActive = 1;
break;
case 1:
sceneActive = 1.2;
sceneActive = 2;
break;
case 2:
sceneActive = 1.3;
sceneActive = 3;
break;
case 3:
sceneActive = 1.4;
sceneActive = 4;
break;
}
// let pMerchantId = userInfo.subLoginUser.merchantId
......
......@@ -1578,7 +1578,7 @@ var createImgTag = function(width, height, getPixel, alt) {
base64.flush();
var img = '';
img += 'data:image/gif;base64,';
img += 'data:image/png;base64,';
img += base64;
return img;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!