Merge remote-tracking branch 'origin/main'

This commit is contained in:
=
2025-12-20 09:32:42 +08:00
3 changed files with 25 additions and 7 deletions
@@ -63,7 +63,7 @@ public class SysH5ScanCodeUploadFileController {
@At
@SLog(tag = "文件管理", msg = "同步到PC")
@SaCheckLogin
public Result syncPc(@Param("files") JSONObject[] jsonObject) {
public Result syncPc(@Param("files") JSONObject[] jsonObject, @Param("timestamp") String timestamp) {
try {
if(ObjectUtil.isEmpty(jsonObject)){
return Result.error("请选择要同步的文件");
@@ -74,7 +74,7 @@ public class SysH5ScanCodeUploadFileController {
do {
scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
for (String key : scan.getResult()) {
NutMap data = NutMap.NEW().addv("action", "h5-scan-code-upload-file").addv("files", jsonObject);
NutMap data = NutMap.NEW().addv("action", "h5-scan-code-upload-file-" + timestamp).addv("files", jsonObject);
pubSubService.fire(key, Json.toJson(data));
}
} while (!scan.isCompleteIteration());
@@ -80,7 +80,7 @@
<div class="el-upload__text">{{ upload_text }}</div>
</div>
<div>
<div class="h5-qrcode" v-if="uploadMode === 'mobile'">
<div class="h5-qrcode" v-if="uploadMode === 'mobile'" v-loading="codeLoading">
<QrCode :options="{ width: 126 }" :value="qrCodeAddress" class="signature-qrcode"></QrCode>
</div>
</div>
@@ -189,7 +189,8 @@ module.exports = {
fileAccept: null,
dragDisabled: true,
qrCodeAddress: origin + "/platform/sys/h5ScanCodeUploadFile",
uploadMode: "pc"
uploadMode: "pc",
codeLoading: true,
}
},
computed: {
@@ -542,7 +543,20 @@ module.exports = {
},
mounted() {
webSocketPubSub.subscribe("h5-scan-code-upload-file", (data) => {
const timestamp = new Date().getTime()
this.qrCodeAddress = origin + "/platform/sys/h5ScanCodeUploadFile?timestamp=" + timestamp
console.info("qrCodeAddress:", this.qrCodeAddress)
// 可选:轮询或 watch ready 状态
const checkReady = () => {
if (webSocketPubSub.ws && webSocketPubSub.ws.readyState === WebSocket.OPEN) {
console.info("ws.readyState is open");
this.codeLoading = false;
} else {
setTimeout(checkReady, 100);
}
};
checkReady();
webSocketPubSub.subscribe("h5-scan-code-upload-file-" + timestamp, (data) => {
console.log("ws:收到手机上传文件消息:", data)
const originFileList = this.fileList || []
console.log(data.files)
@@ -88,10 +88,13 @@
],
// accept: "image/*",
accept: "*",
upload_number: 9
upload_number: 9,
}
},
methods: {
GetQueryString(name) {
return new URLSearchParams(window.location.search).get(name)
},
beforeRead(file) {
return true
},
@@ -156,7 +159,8 @@
.post(
"/platform/sys/h5ScanCodeUploadFile/syncPc",
{
files: JSON.stringify(this.fileList)
files: JSON.stringify(this.fileList),
timestamp: this.GetQueryString("timestamp")
},
{
headers: {