|
|
@ -19,14 +19,12 @@ Page({ |
|
|
}], |
|
|
}], |
|
|
txtmoment: '保存图片,分享到朋友圈', |
|
|
txtmoment: '保存图片,分享到朋友圈', |
|
|
qrImageUrl: "", |
|
|
qrImageUrl: "", |
|
|
avatarPath: '', |
|
|
|
|
|
imgPath: '', |
|
|
|
|
|
qrCodePath: '', |
|
|
|
|
|
|
|
|
bgImageUrl: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527496410439&di=54c111d35f3ca9d1e9b193834785c264&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F013c81583fa08ea8012060c864c3b7.jpg', |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onLoad: function (options) { |
|
|
onLoad: function (options) { |
|
|
this.groupNo = options.groupNo; |
|
|
|
|
|
console.log("groupNo>>" + this.groupNo); |
|
|
|
|
|
|
|
|
this.data.groupNo = options.groupNo; |
|
|
|
|
|
console.log('options>' + this.data.groupNo); |
|
|
wx.getSystemInfo({ |
|
|
wx.getSystemInfo({ |
|
|
success: (res) => { |
|
|
success: (res) => { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
@ -40,9 +38,9 @@ Page({ |
|
|
url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', |
|
|
url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', |
|
|
method: 'get', |
|
|
method: 'get', |
|
|
data: { |
|
|
data: { |
|
|
groupNo: that.groupNo, |
|
|
|
|
|
width: 120, |
|
|
|
|
|
// page: ''
|
|
|
|
|
|
|
|
|
groupNo: that.data.groupNo, |
|
|
|
|
|
width: 80, |
|
|
|
|
|
page: 'index/index' |
|
|
}, |
|
|
}, |
|
|
header: { |
|
|
header: { |
|
|
'Content-Type': 'application/x-www-form-urlencoded', |
|
|
'Content-Type': 'application/x-www-form-urlencoded', |
|
|
@ -50,7 +48,7 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
success: function (res) { |
|
|
success: function (res) { |
|
|
if (res.statusCode == 200) { |
|
|
if (res.statusCode == 200) { |
|
|
that.qrImageUrl = res.data.msg; |
|
|
|
|
|
|
|
|
that.data.qrImageUrl = res.data.msg; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
@ -67,9 +65,9 @@ Page({ |
|
|
url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', |
|
|
url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', |
|
|
method: 'get', |
|
|
method: 'get', |
|
|
data: { |
|
|
data: { |
|
|
groupNo: that.groupNo, |
|
|
|
|
|
width: 120, |
|
|
|
|
|
page: '' |
|
|
|
|
|
|
|
|
groupNo: that.data.groupNo, |
|
|
|
|
|
width: 80, |
|
|
|
|
|
page: 'index/index' |
|
|
}, |
|
|
}, |
|
|
header: { |
|
|
header: { |
|
|
'Content-Type': 'application/x-www-form-urlencoded', |
|
|
'Content-Type': 'application/x-www-form-urlencoded', |
|
|
@ -115,7 +113,8 @@ Page({ |
|
|
onShareAppMessage: function () { |
|
|
onShareAppMessage: function () { |
|
|
return { |
|
|
return { |
|
|
title: '1号家政', |
|
|
title: '1号家政', |
|
|
imageUrl: this.qrImageUrl |
|
|
|
|
|
|
|
|
imageUrl: this.data.qrImageUrl, |
|
|
|
|
|
path: '/pages/index/index', |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -233,12 +232,11 @@ Page({ |
|
|
mask: true, |
|
|
mask: true, |
|
|
}); |
|
|
}); |
|
|
console.log(getApp().globalData.userInfo); |
|
|
console.log(getApp().globalData.userInfo); |
|
|
//先从服务器获取要分享的图片,保存到本地;
|
|
|
|
|
|
|
|
|
//下载微信头像,保存到本地;
|
|
|
wx.downloadFile({ |
|
|
wx.downloadFile({ |
|
|
url: getApp().globalData.userInfo.avatarUrl, |
|
|
url: getApp().globalData.userInfo.avatarUrl, |
|
|
success: (res) => { |
|
|
success: (res) => { |
|
|
if (res.statusCode == 200 && res.tempFilePath != undefined && res.tempFilePath.length > 0) { |
|
|
if (res.statusCode == 200 && res.tempFilePath != undefined && res.tempFilePath.length > 0) { |
|
|
console.log(res); |
|
|
|
|
|
avatarPath = res.tempFilePath; |
|
|
avatarPath = res.tempFilePath; |
|
|
that.drawMomentImage(avatarPath, imgPath, qrCodePath); |
|
|
that.drawMomentImage(avatarPath, imgPath, qrCodePath); |
|
|
} else { |
|
|
} else { |
|
|
@ -251,12 +249,13 @@ Page({ |
|
|
toast = true; |
|
|
toast = true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
//下载小程序的二维码,保存到本地;
|
|
|
wx.downloadFile({ |
|
|
wx.downloadFile({ |
|
|
url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527496410439&di=54c111d35f3ca9d1e9b193834785c264&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F013c81583fa08ea8012060c864c3b7.jpg', |
|
|
|
|
|
|
|
|
url: that.data.qrImageUrl, |
|
|
success: (res) => { |
|
|
success: (res) => { |
|
|
if (res.statusCode == 200 && res.tempFilePath != undefined && res.tempFilePath.length > 0) { |
|
|
if (res.statusCode == 200 && res.tempFilePath != undefined && res.tempFilePath.length > 0) { |
|
|
console.log(res); |
|
|
console.log(res); |
|
|
imgPath = res.tempFilePath; |
|
|
|
|
|
|
|
|
qrCodePath = res.tempFilePath; |
|
|
that.drawMomentImage(avatarPath, imgPath, qrCodePath); |
|
|
that.drawMomentImage(avatarPath, imgPath, qrCodePath); |
|
|
} else { |
|
|
} else { |
|
|
that.handleErr(err, toast); |
|
|
that.handleErr(err, toast); |
|
|
@ -268,12 +267,13 @@ Page({ |
|
|
toast = true; |
|
|
toast = true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
//下载背景图片,保存到本地;
|
|
|
wx.downloadFile({ |
|
|
wx.downloadFile({ |
|
|
url: that.qrImageUrl, |
|
|
|
|
|
|
|
|
url: that.data.bgImageUrl, |
|
|
success: (res) => { |
|
|
success: (res) => { |
|
|
if (res.statusCode == 200 && res.tempFilePath != undefined && res.tempFilePath.length > 0) { |
|
|
if (res.statusCode == 200 && res.tempFilePath != undefined && res.tempFilePath.length > 0) { |
|
|
console.log(res); |
|
|
console.log(res); |
|
|
qrCodePath = res.tempFilePath; |
|
|
|
|
|
|
|
|
imgPath = res.tempFilePath; |
|
|
that.drawMomentImage(avatarPath, imgPath, qrCodePath); |
|
|
that.drawMomentImage(avatarPath, imgPath, qrCodePath); |
|
|
} else { |
|
|
} else { |
|
|
that.handleErr(err, toast); |
|
|
that.handleErr(err, toast); |
|
|
@ -285,6 +285,7 @@ Page({ |
|
|
toast = true; |
|
|
toast = true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// wx.downloadFile({
|
|
|
// wx.downloadFile({
|
|
|
// url: getApp().globalData.userInfo.avatarUrl,
|
|
|
// url: getApp().globalData.userInfo.avatarUrl,
|
|
|
// success: (aRes) => {
|
|
|
// success: (aRes) => {
|
|
|
|