diff --git a/src/main/java/com/budwk/app/zhgh/scan/controller/ScanController.java b/src/main/java/com/budwk/app/zhgh/scan/controller/ScanController.java index 360d660..45ed809 100644 --- a/src/main/java/com/budwk/app/zhgh/scan/controller/ScanController.java +++ b/src/main/java/com/budwk/app/zhgh/scan/controller/ScanController.java @@ -44,7 +44,7 @@ public class ScanController { @SaCheckLogin public Object handle(@Param("bizType") String bizType, @Param("params") String params) { if(StrUtil.isBlank(bizType)) { - return Result.error("参数缺失"); + return Result.error("请使用智慧工会系统二维码"); } Map paramsMap = Json.fromJson(Map.class, params); return dispatcher.dispatch(bizType, paramsMap); diff --git a/src/main/resources/views/platform/zhghh5/scan/index.html b/src/main/resources/views/platform/zhghh5/scan/index.html index 8deb6fd..96e3ee5 100644 --- a/src/main/resources/views/platform/zhghh5/scan/index.html +++ b/src/main/resources/views/platform/zhghh5/scan/index.html @@ -230,29 +230,42 @@ layout("/layouts/platform_h5.html"){ }, async onHandle(decodedText) { - // 防重:如果正在处理,直接忽略 - if (this.isProcessing) return; + try { + // 防重:如果正在处理,直接忽略 + if (this.isProcessing) return; - // 立即设置为处理中,并停止扫描 - this.isProcessing = true; - await this.closeScan() + // 立即设置为处理中,并停止扫描 + this.isProcessing = true; + await this.closeScan() - const { bizType, userId } = JSON.parse(decodedText) - this.result = await this.$axios.post('/platform/scan/handle', { - bizType: bizType, - params: JSON.stringify({ userId: userId, handle: false }), - }) - this.resultVisible = true + const { bizType, userId } = JSON.parse(decodedText) + this.result = await this.$axios.post('/platform/scan/handle', { + bizType: bizType, + params: JSON.stringify({ userId: userId, handle: false }), + }) + + } catch (e) { + this.result = { + code: 99, + msg: '请使用智慧工会系统身份二维码' + } + this.resultVisible = true + } }, resultConfirm() { - const { bizType, userId } = JSON.parse(this.decodedText) - this.$axios.post('/platform/scan/handle', { - bizType: bizType, - params: JSON.stringify({ userId: userId, handle: true }), - }) - this.isProcessing = false; - this.initCamera() + try { + const { bizType, userId } = JSON.parse(this.decodedText) + this.$axios.post('/platform/scan/handle', { + bizType: bizType, + params: JSON.stringify({ userId: userId, handle: true }), + }) + } catch (e) { + + } finally { + this.isProcessing = false; + this.initCamera() + } } },