commit
This commit is contained in:
@@ -63,7 +63,7 @@ public class SysH5ScanCodeUploadFileController {
|
|||||||
@At
|
@At
|
||||||
@SLog(tag = "文件管理", msg = "同步到PC")
|
@SLog(tag = "文件管理", msg = "同步到PC")
|
||||||
@SaCheckLogin
|
@SaCheckLogin
|
||||||
public Result syncPc(@Param("files") JSONObject[] jsonObject) {
|
public Result syncPc(@Param("files") JSONObject[] jsonObject, @Param("timestamp") String timestamp) {
|
||||||
try {
|
try {
|
||||||
if(ObjectUtil.isEmpty(jsonObject)){
|
if(ObjectUtil.isEmpty(jsonObject)){
|
||||||
return Result.error("请选择要同步的文件");
|
return Result.error("请选择要同步的文件");
|
||||||
@@ -74,7 +74,7 @@ public class SysH5ScanCodeUploadFileController {
|
|||||||
do {
|
do {
|
||||||
scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||||
for (String key : scan.getResult()) {
|
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));
|
pubSubService.fire(key, Json.toJson(data));
|
||||||
}
|
}
|
||||||
} while (!scan.isCompleteIteration());
|
} while (!scan.isCompleteIteration());
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
<div class="el-upload__text">{{ upload_text }}</div>
|
<div class="el-upload__text">{{ upload_text }}</div>
|
||||||
</div>
|
</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>
|
<QrCode :options="{ width: 126 }" :value="qrCodeAddress" class="signature-qrcode"></QrCode>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,7 +189,8 @@ module.exports = {
|
|||||||
fileAccept: null,
|
fileAccept: null,
|
||||||
dragDisabled: true,
|
dragDisabled: true,
|
||||||
qrCodeAddress: origin + "/platform/sys/h5ScanCodeUploadFile",
|
qrCodeAddress: origin + "/platform/sys/h5ScanCodeUploadFile",
|
||||||
uploadMode: "pc"
|
uploadMode: "pc",
|
||||||
|
codeLoading: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -540,7 +541,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
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)
|
console.log("ws:收到手机上传文件消息:", data)
|
||||||
const originFileList = this.fileList || []
|
const originFileList = this.fileList || []
|
||||||
console.log(data.files)
|
console.log(data.files)
|
||||||
|
|||||||
@@ -88,10 +88,13 @@
|
|||||||
],
|
],
|
||||||
// accept: "image/*",
|
// accept: "image/*",
|
||||||
accept: "*",
|
accept: "*",
|
||||||
upload_number: 9
|
upload_number: 9,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
GetQueryString(name) {
|
||||||
|
return new URLSearchParams(window.location.search).get(name)
|
||||||
|
},
|
||||||
beforeRead(file) {
|
beforeRead(file) {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
@@ -156,7 +159,8 @@
|
|||||||
.post(
|
.post(
|
||||||
"/platform/sys/h5ScanCodeUploadFile/syncPc",
|
"/platform/sys/h5ScanCodeUploadFile/syncPc",
|
||||||
{
|
{
|
||||||
files: JSON.stringify(this.fileList)
|
files: JSON.stringify(this.fileList),
|
||||||
|
timestamp: this.GetQueryString("timestamp")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user