解决了FileListItem的警告

main
wuyize 2023-07-07 01:57:39 +08:00
parent b6627ccd2c
commit e10fddb188
4 changed files with 80 additions and 114 deletions

View File

@ -164,47 +164,8 @@ Item {
} }
} }
} }
FluButton { UploadButton {
id: uploadIcon
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: "上传"
onClicked: function () {
console.log("click")
fileDialog.open()
}
FileDialog {
id: fileDialog
onAccepted: function () {
let name = FileTransferManager.getFileName(
selectedFile)
const size = FileTransferManager.getFileSize(
selectedFile)
const md5 = FileTransferManager.getFileMd5(
selectedFile)
if (size <= 0 || md5 === '')
return
var body = {
"name": name,
"brief": "brief",
"size": size,
"md5": md5,
"tags": [],
"parentId": header.items.length !== 0 ? header.items[header.items.length - 1].uuid : null
}
console.log("begin")
Request.post("knowledge/file",
JSON.stringify(body),
function (res, data) {
console.log(res)
console.log(data)
FileTransferManager.upload(
selectedFile, data.id,
data.ticket, name)
}, function (res, data) {
console.log(res)
})
}
}
} }
} }
RowLayout { RowLayout {

View File

@ -84,17 +84,8 @@ FluArea {
} }
} }
ColumnLayout {
id: row
anchors.fill: parent
anchors.margins: 10
spacing: 10
ColumnLayout {
id: clickable
anchors.fill: parent
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: row
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onDoubleClicked: { onDoubleClicked: {
fileItem.parent.doubleClicked() fileItem.parent.doubleClicked()
@ -105,6 +96,11 @@ FluArea {
} }
} }
} }
ColumnLayout {
id: clickable
anchors.fill: row
RowLayout { RowLayout {
id: titleRow id: titleRow
Image { Image {
@ -161,6 +157,13 @@ FluArea {
} }
} }
} }
ColumnLayout {
id: row
anchors.fill: parent
anchors.margins: 10
spacing: 10
RowLayout { RowLayout {
visible: !fileItem.isDir visible: !fileItem.isDir
Repeater { Repeater {

View File

@ -14,7 +14,8 @@ FluButton {
text: "上传" text: "上传"
onClicked: function () { onClicked: function () {
console.log("click") console.log("click")
fileDialog.open() //fileDialog.open()
popup.open()
} }
FileDialog { FileDialog {
id: fileDialog id: fileDialog
@ -52,7 +53,7 @@ FluButton {
} }
} }
Row { Column {
id: content id: content
topPadding: 14 topPadding: 14
leftPadding: 20 leftPadding: 20
@ -68,6 +69,7 @@ FluButton {
width: parent.width - parent.leftPadding - parent.rightPadding width: parent.width - parent.leftPadding - parent.rightPadding
placeholderText: "请输入简介" placeholderText: "请输入简介"
} }
Tag {}
} }
Rectangle { Rectangle {

View File

@ -11,7 +11,7 @@ FileTransferListModel::FileTransferListModel(QObject *parent)
m_roleName.insert(kSpeedRole, "speed"); m_roleName.insert(kSpeedRole, "speed");
m_roleName.insert(kPausedRole, "paused"); m_roleName.insert(kPausedRole, "paused");
m_data.append({true, "id", "name", 30, 100, 30}); //m_data.append({true, "id", "name", 30, 100, 30});
} }