uni.scanCode({
success: res => {
let url = ""
if (this.isJSON(res.result.trim())) {
const result = JSON.parse(res.result.trim())
if (result.t === 'ADP') {
let config = {
isPreview: 1,
moduleId: result.id,
previewType: result.previewType
}
url = '/pages/apply/dynamicModel/index?config=' + this.jnpf.base64.encode(JSON
.stringify(config))
}
if (result.t === 'DFD') {
url = '/pages/apply/dynamicModel/scanForm?config=' + JSON.stringify(result)
}
if (result.t === 'WFP') {
url = '/pages/workFlow/scanForm/index?config=' + JSON.stringify(result)
}
if (result.t === 'report') {
let url =
${this.report}/preview.html?id=${result.id}&token=${this.token}&page=1&from=menu
url = '/pages/apply/externalLink/index?url=' + encodeURIComponent(url) +
'&fullName= ' + result.fullName
}
if (result.t === 'portal') {
url = '/pages/portal/scanPortal/index?id=' + result.id
}
if (result.t === 'login') {
url = '/pages/login/scanLogin?id=' + result.id
}
} else {
url = '/pages/my/scanResult/index?result=' + res.result
}
uni.navigateTo({
url,
fail: (err) => {
this.$u.toast("暂无此页面")
}
})
}
});
- 发布:2024-04-23 14:34
- 更新:2024-04-23 14:34
- 阅读:721
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 10
HBuilderX类型: 正式
HBuilderX版本号: 4.12
手机系统: Android
手机系统版本号: Android 13
手机厂商: 小米
手机机型: redmi note 11
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
{"t":"DFD","id":"552399864701387973","mid":"550301774058103557","mt":2,"fid":"","pid":"","ftid":""}
{"t":"DFD","id":"552399864701387973","mid":"550301774058103557","mt":2,"fid":"","pid":"","ftid":""}
实际结果:
{"scanType":"UPC_E","path":"","charSet":"utf8","result":"06475325","errMsg":"scanCode:ok"}
{"scanType":"UPC_E","path":"","charSet":"utf8","result":"06475325","errMsg":"scanCode:ok"}
bug描述:
调用uni.scanCode扫描二维码,返回的结果不正确。相同二维码其它扫码方式返回就是正确的
错误:{"scanType":"UPC_E","path":"","charSet":"utf8","result":"06475325","errMsg":"scanCode:ok"}
正确: {"t":"DFD","id":"552399864701387973","mid":"550301774058103557","mt":2,"fid":"","pid":"","ftid":""}