diff --git a/me/components/wm-poster/wm-posterorders.vue b/me/components/wm-poster/wm-posterorders.vue index aa3c731..3e31273 100644 --- a/me/components/wm-poster/wm-posterorders.vue +++ b/me/components/wm-poster/wm-posterorders.vue @@ -5,13 +5,13 @@ :style="{ width: canvasW + 'px', height: canvasH + 'px' }"> + @longpress="saveqrcode" crossorigin="Anonymous"> + @longpress="toSave(tempFilePath)" crossorigin="Anonymous"> @@ -158,6 +158,7 @@ let _QrCode = await _this.getImageInfo({ imgSrc: _this.QrSrc }); //二维码或太阳码 + console.log(_imgInfo) let r = [_imgInfo.width, _imgInfo.height]; let q = [_QrCode.width, _QrCode.height]; let imgW = C_W - (C_P * 2.5); @@ -272,6 +273,7 @@ return new Promise((resolve, errs) => { uni.getImageInfo({ src: imgSrc, + crossOrigin: 'anonymous', success: function(image) { resolve(image); }, @@ -285,29 +287,34 @@ }); }, getNewImage() { + console.log(_this.CanvasID) uni.canvasToTempFilePath({ canvasId: _this.CanvasID, quality: 1, complete: res => { - // #ifdef H5 - let ua = navigator.userAgent.toLowerCase(); - if (ua.indexOf('micromessenger') !== -1) { + console.log(res) + if ( res.tempFilePath) { + // #ifdef H5 + let ua = navigator.userAgent.toLowerCase(); + if (ua.indexOf('micromessenger') !== -1) { + _this.tempFilePath = res.tempFilePath; + _this.$emit('success', res); + } else { + _this.$emit('successH5', res.tempFilePath); + } + // #endif + // #ifndef H5 _this.tempFilePath = res.tempFilePath; _this.$emit('success', res); - } else { - _this.$emit('successH5', res.tempFilePath); + // #endif + _this.loading = false; + uni.showToast({ + title: '长按图片保存海报', + duration: 1000, + icon: 'none' + }); } - // #endif - // #ifndef H5 - _this.tempFilePath = res.tempFilePath; - _this.$emit('success', res); - // #endif - _this.loading = false; - uni.showToast({ - title: '长按图片保存海报', - duration: 1000, - icon: 'none' - }); + uni.hideLoading() } }, diff --git a/me/invite/index.vue b/me/invite/index.vue index cb2a912..4aab0b6 100644 --- a/me/invite/index.vue +++ b/me/invite/index.vue @@ -379,11 +379,14 @@ uni.hideLoading(); }, successH5(haibaoImg) { - this.haibaoImgH5 = haibaoImg - uni.previewImage({ - urls: [haibaoImg], - current: 1, - }) + if ( haibaoImg ) { + this.haibaoImgH5 = haibaoImg + uni.previewImage({ + urls: [haibaoImg], + current: 1, + }) + } + }, showModal() { // #ifndef H5 @@ -396,6 +399,7 @@ this.modalName = 'Image'; } // #endif + // #ifdef H5 let ua = navigator.userAgent.toLowerCase(); if (ua.indexOf('micromessenger') !== -1) { @@ -420,7 +424,6 @@ current: 1, }) } - } // #endif }, @@ -476,6 +479,7 @@ //获取背景图 getBgImg() { this.$u.get('app/banner/selectBannerList?classify=5').then(res => { + console.log(res) if (res.code == 0) { this.bgImg = res.data[0].imageUrl this.tuiguang = res.data[0].describes @@ -691,6 +695,7 @@ // 保存图片 async onSaveImg() { this.showModal(); + return // #ifndef MP-WEIXIN this.showModal();