This commit is contained in:
@jyuhsin
2026-01-04 16:11:43 +08:00
parent 8d30f2bb4b
commit d622d70b6c
2 changed files with 32 additions and 19 deletions
@@ -44,7 +44,7 @@ public class ScanController {
@SaCheckLogin @SaCheckLogin
public Object handle(@Param("bizType") String bizType, @Param("params") String params) { public Object handle(@Param("bizType") String bizType, @Param("params") String params) {
if(StrUtil.isBlank(bizType)) { if(StrUtil.isBlank(bizType)) {
return Result.error("参数缺失"); return Result.error("请使用智慧工会系统二维码");
} }
Map<String, Object> paramsMap = Json.fromJson(Map.class, params); Map<String, Object> paramsMap = Json.fromJson(Map.class, params);
return dispatcher.dispatch(bizType, paramsMap); return dispatcher.dispatch(bizType, paramsMap);
@@ -230,29 +230,42 @@ layout("/layouts/platform_h5.html"){
}, },
async onHandle(decodedText) { async onHandle(decodedText) {
// 防重:如果正在处理,直接忽略 try {
if (this.isProcessing) return; // 防重:如果正在处理,直接忽略
if (this.isProcessing) return;
// 立即设置为处理中,并停止扫描 // 立即设置为处理中,并停止扫描
this.isProcessing = true; this.isProcessing = true;
await this.closeScan() await this.closeScan()
const { bizType, userId } = JSON.parse(decodedText) const { bizType, userId } = JSON.parse(decodedText)
this.result = await this.$axios.post('/platform/scan/handle', { this.result = await this.$axios.post('/platform/scan/handle', {
bizType: bizType, bizType: bizType,
params: JSON.stringify({ userId: userId, handle: false }), params: JSON.stringify({ userId: userId, handle: false }),
}) })
this.resultVisible = true
} catch (e) {
this.result = {
code: 99,
msg: '请使用智慧工会系统身份二维码'
}
this.resultVisible = true
}
}, },
resultConfirm() { resultConfirm() {
const { bizType, userId } = JSON.parse(this.decodedText) try {
this.$axios.post('/platform/scan/handle', { const { bizType, userId } = JSON.parse(this.decodedText)
bizType: bizType, this.$axios.post('/platform/scan/handle', {
params: JSON.stringify({ userId: userId, handle: true }), bizType: bizType,
}) params: JSON.stringify({ userId: userId, handle: true }),
this.isProcessing = false; })
this.initCamera() } catch (e) {
} finally {
this.isProcessing = false;
this.initCamera()
}
} }
}, },