Commit b6da89b8 by hank

图片跨域

parent d252a9eb
...@@ -365,6 +365,8 @@ export default { ...@@ -365,6 +365,8 @@ export default {
ctx.drawImage(img, 0,0,960, 1338) ctx.drawImage(img, 0,0,960, 1338)
var img2 = new Image() var img2 = new Image()
img2.src = imgUrl || require('../../static/upload.jpg') img2.src = imgUrl || require('../../static/upload.jpg')
img.setAttribute("crossOrigin",'Anonymous')
img2.setAttribute("crossOrigin",'Anonymous')
img2.onload = function (param) { img2.onload = function (param) {
ctx.drawImage(img2, 293,640,377, 377) ctx.drawImage(img2, 293,640,377, 377)
_this.shareCode = canvas.toDataURL() _this.shareCode = canvas.toDataURL()
...@@ -377,6 +379,20 @@ export default { ...@@ -377,6 +379,20 @@ export default {
share() { share() {
var _this = this var _this = this
// alert('share') // alert('share')
axios.post('/weixin/getcode', {
scene: _this.$route.query.id,
pages: 'pages/webview/webview'
}).then(res => {
// _this.shareCode = res.data.data.weixinCode
if(res.data.data.weixinCode) {
_this.getCanvasDrawImage(res.data.data.weixinCode)
_this.shareOnoff2 = true
} else {
_this.getCanvasDrawImage()
}
// alert(JSON.stringify(res.data.data))
})
window.wx.miniProgram.getEnv(function (res) { window.wx.miniProgram.getEnv(function (res) {
if (res.miniprogram) { if (res.miniprogram) {
// todo // todo
...@@ -393,7 +409,7 @@ export default { ...@@ -393,7 +409,7 @@ export default {
_this.shareOnoff2 = true _this.shareOnoff2 = true
} }
alert(JSON.stringify(res.data.data)) // alert(JSON.stringify(res.data.data))
}) })
} else { } else {
_this.shareOnoff = true; _this.shareOnoff = true;
......
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 sign in to comment