AicsKnowledgeBase_client/AicsKnowledgeBase/qml/page/FilePage.qml

69 lines
1.9 KiB
QML
Raw Normal View History

2023-06-21 21:33:52 +08:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Dialogs
2023-06-21 21:33:52 +08:00
import FluentUI
import AicsKB.FileTransferManager
2023-06-30 23:31:28 +08:00
import "qrc:///AicsKnowledgeBase/qml/component"
2023-07-05 21:14:33 +08:00
import "qrc:///AicsKnowledgeBase/qml/global"
2023-06-21 21:33:52 +08:00
2023-07-01 08:56:14 +08:00
FluArea {
2023-06-21 21:33:52 +08:00
property string url: ''
2023-07-02 15:58:02 +08:00
backgroundColor: "#f9f9f9"
2023-06-21 21:33:52 +08:00
Layout.fillWidth: true
Layout.fillHeight: true
paddings: 10
Layout.topMargin: 20
2023-07-01 08:56:14 +08:00
FluText {
2023-06-21 21:33:52 +08:00
Layout.topMargin: 20
2023-07-01 08:56:14 +08:00
text: ""
2023-06-21 21:33:52 +08:00
}
2023-07-02 15:58:02 +08:00
FluButton {
text: "上传"
onClicked: function () {
console.log("click")
fileDialog.open()
}
FileDialog {
id: fileDialog
onAccepted: function () {
2023-07-05 21:14:33 +08:00
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)
})
}
}
2023-07-02 15:58:02 +08:00
}
2023-07-01 08:56:14 +08:00
FileList {}
2023-06-21 21:33:52 +08:00
}