修改上传按钮

main
wuyize 2023-07-05 21:49:04 +08:00
parent f65f9f3dbb
commit 0014cc018a
2 changed files with 70 additions and 67 deletions

View File

@ -1,6 +1,7 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
import QtQuick.Dialogs
import "qrc:///AicsKnowledgeBase/qml/global" import "qrc:///AicsKnowledgeBase/qml/global"
import SignalFileOperation 1.0 import SignalFileOperation 1.0
@ -34,14 +35,29 @@ Item {
Component { Component {
id: fileListItemHeader id: fileListItemHeader
Item {
RowLayout {
id: fileListItemHeaderItem id: fileListItemHeaderItem
width: ListView.view.width width: ListView.view.width
height: 48 height: 48
RowLayout {
// back to folder button
FluIconButton {
Layout.alignment: Qt.AlignVCenter
id: backButton
width: 24
height: 24
iconSource: FluentIcons.ForwardCall
onClicked: {
if (header.count() > 0) {
header.items = header.items.slice(0, header.count() - 1)
}
fileListItemHeaderItem.update()
}
}
FluBreadcrumbBar { FluBreadcrumbBar {
id: header id: header
width: parent.width //width: parent.width
height: parent.height height: parent.height
separator: ">" separator: ">"
items: [] items: []
@ -54,19 +70,46 @@ Item {
fileListItemHeaderItem.update() fileListItemHeaderItem.update()
} }
} }
// back to folder button
FluIconButton { FluButton {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignRight
id: backButton text: "上传"
width: 24 onClicked: function () {
height: 24 console.log("click")
iconSource: FluentIcons.ChromeBack fileDialog.open()
onClicked: {
if (header.count() > 0) {
header.items = header.items.slice(
0, header.count() - 1)
} }
fileListItemHeaderItem.update()
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)
})
} }
} }
} }

View File

@ -23,48 +23,8 @@ FluArea {
text: "" 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 { FileList {
autoRequest: true autoRequest: true
width: parent.width
} }
} }