Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

真机生成的二维码错乱 #52

Open
EverChan6 opened this issue Nov 21, 2019 · 7 comments
Open

真机生成的二维码错乱 #52

EverChan6 opened this issue Nov 21, 2019 · 7 comments

Comments

@EverChan6
Copy link

Description

真机生成的二维码错乱,导致无法识别。微信开发者工具生成的是好的。

Environment

  • Platform: [开发者工具/iOS/Andriod/Web]
    开发者工具
  • Platform version: [对应工具或者iOS或者Andriod的版本号]
    微信开发者工具 Stable v1.02.1910120
  • Wechat version: [微信版本号]
    Version 7.0.8
  • weapp-qrcode version: [在package.json里]
    v1.0.0
  • other version: [如果在某一设备下出现该问题,请填写设备号]
    华为nova3i
    Android版本:9

Reproduce

问题复现步骤:

  1. 点击该静态图片
  2. 前端生成二维码,然后用小程序api的canvasToTempFilePath来生成临时图片路径,再previewImage该二维码

期望的表现:

希望真机和开发者工具一样生成正常可用的二维码

观察到的表现:

华为手机真机测试,生成的二维码定位符错乱不完整导致无法识别

屏幕截图和动态 GIF 图
真机上生成的二维码

![复现步骤的屏幕截图和动态 GIF 图](图片的 url)

Relevant Code / Logs

<canvas class="canvas-style" :style="{width: cwidth + 'px', height: cheight + 'px'}" canvas-id="qrcode"></canvas>
data () {
    return {
         cwidth: 200,
         cheight: 200,
         tempFilePath: '',
    }
}
                       /**
			 * 展示二维码
			 * @param {Object} idx
			 */
			async showCode(idx) {
				// 绘制二维码
				await this.genQrcode(this.list[idx].url)
				// canvas转为图片
				await canvasToTempFilePath({x: 0, y: 0, width: this.cwidth, height: this.cheight, destWidth: this.cwidth, destHeight: this.cheight, canvasId: 'qrcode'}).then(res => {
					// console.log(res.tempFilePath)
					this.tempFilePath = res.tempFilePath
				}).catch(err => {
					console.log(err)
				})
				// 预览图片,并可转发分享、保存到本地等
				previewImage({current: this.tempFilePath, urls: [this.tempFilePath]}).then(res => {
					
				}).catch(err => {
					console.log(err)
				})
			},
			
			/**
			 * 生成二维码
			 */
			genQrcode(url) {
				// console.log(typeof drawQrcode)
				return new Promise((resolve, reject) => {
					try {
						drawQrcode({
							width: this.cwidth,
							height: this.cheight,
							canvasId: 'qrcode',
							// ctx: uni.createCanvasContext('qrcode'),
							text: url,
							callback: (e) => {
								console.log(e)
								resolve()
							}
						})
					} catch (e) {
						console.log(e)
						//TODO handle the exception
						reject()
					}
				})
			},
@SirusChen
Copy link

出现情况相同,猜测是二维码的定位框绘制有问题,求解决

@gjqiang
Copy link

gjqiang commented Jan 7, 2020

一样。。开发者工具可以,真机不行

@feixue1232
Copy link

整了一天确认真机大概率有问题,vivo 855 plus ,,故不得不放弃此库~~

@JBPatric
Copy link

生成的识别不了,已弃库

@coderew
Copy link

coderew commented Aug 3, 2022

生成的识别不了,已弃库

换成哪个库了?

@pandaSeven
Copy link

我也遇到了,参考这个文档在callback中设置定时器,可以解决 https://developers.weixin.qq.com/community/develop/article/doc/00002064e6c920917be96c1ed56013?page=1#comment-list

@JBPatric
Copy link

JBPatric commented Jun 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants