import QtQuick import QtQuick.Layouts import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import QtQuick.Dialogs import FluentUI import AicsKB.FileTransferManager import "qrc:///AicsKnowledgeBase/qml/component" import "qrc:///AicsKnowledgeBase/qml/global" FluArea { property string url: '' backgroundColor: "#f9f9f9" Layout.fillWidth: true Layout.fillHeight: true paddings: 10 Layout.topMargin: 20 FluText { Layout.topMargin: 20 text: "" } FluButton { text: "上传" onClicked: function () { console.log("click") fileDialog.open() } FileDialog { id: fileDialog onAccepted: function () { const size = FileTransferManager.getFileSize(selectedFile) const md5 = FileTransferManager.getFileMd5(selectedFile) if (size <= 0 || md5 === '') return var body = { "name": "test2", "brief": "brief", "size": size, "md5": md5, "tags": [], "parentId": null } console.log("begin") console.log(JSON.stringify(body)) Request.post("knowledge/file", JSON.stringify(body), function (res, data) { console.log(res) console.log(data) FileTransferManager.upload(selectedFile, data.id, data.ticket) }, function (res, data) { console.log(res) }) } } } FileList {} }