Commit c609778e by chenwq

提交

1 parent 95ba0670
...@@ -99,9 +99,38 @@ Component({ ...@@ -99,9 +99,38 @@ Component({
handleCopy(e) { handleCopy(e) {
var { idx } = e.currentTarget.dataset var { idx } = e.currentTarget.dataset
var currentItem = this.data.orderObj.activityList[idx] var currentItem = this.data.orderObj.activityList[idx]
console.log(currentItem) var qr = wxqrcode.createQrCodeImg(currentItem.activityUrl)
// console.log(wxqrcode) const base64src = function (base64data) {
wxqrcode.createQrCodeImg(currentItem.activityUrl) 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({ ...@@ -13,9 +13,9 @@ Page({
scene1: null, scene1: null,
scene2: null, scene2: null,
scene3: null, scene3: null,
scene4: true scene4: null
}, },
sceneActive: 4, sceneActive: 1,
scenePriceList: [{ scenePriceList: [{
total: 0 total: 0
}, { }, {
......
...@@ -239,16 +239,16 @@ Page({ ...@@ -239,16 +239,16 @@ Page({
let sceneActive; let sceneActive;
switch (this.data.actNum) { switch (this.data.actNum) {
case 0: case 0:
sceneActive = 1.1; sceneActive = 1;
break; break;
case 1: case 1:
sceneActive = 1.2; sceneActive = 2;
break; break;
case 2: case 2:
sceneActive = 1.3; sceneActive = 3;
break; break;
case 3: case 3:
sceneActive = 1.4; sceneActive = 4;
break; break;
} }
// let pMerchantId = userInfo.subLoginUser.merchantId // let pMerchantId = userInfo.subLoginUser.merchantId
......
...@@ -1578,7 +1578,7 @@ var createImgTag = function(width, height, getPixel, alt) { ...@@ -1578,7 +1578,7 @@ var createImgTag = function(width, height, getPixel, alt) {
base64.flush(); base64.flush();
var img = ''; var img = '';
img += 'data:image/gif;base64,'; img += 'data:image/png;base64,';
img += base64; img += base64;
return img; return img;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!