Compare commits

..

No commits in common. "eadca3e91ffdb0f38cde2eb62c6ba7f47daa79a2" and "c5b7ee4a63cfb8b8c09b9a0b179e5441c44bca80" have entirely different histories.

3 changed files with 4 additions and 197 deletions

View File

@ -2,7 +2,6 @@ import QtQuick 2.15
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
import QtQuick.Dialogs import QtQuick.Dialogs
import QtQuick.Controls
import "qrc:///AicsKnowledgeBase/qml/global" import "qrc:///AicsKnowledgeBase/qml/global"
import SignalFileOperation 1.0 import SignalFileOperation 1.0
import AicsKB.FileTransferManager import AicsKB.FileTransferManager
@ -45,79 +44,10 @@ Item {
"uuid": uuid "uuid": uuid
}]) }])
} }
RowLayout { UploadButton {
Layout.preferredWidth: parent.width header: header
Item {
Layout.alignment: Qt.AlignRight
height: 28
width: 28
InputDialog {
id: dialog
title: "新建文件夹"
buttonFlags: FluContentDialog.PositiveButton
| FluContentDialog.NegativeButton
negativeText: "取消"
positiveText: "确定"
message: "请输入文件夹名称"
onPositiveClicked: text => {
console.log(text)
}
} }
Image {
source: "qrc:/AicsKnowledgeBase/res/createFolder.png"
anchors.fill: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
dialog.open()
}
}
}
FluButton {
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")
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, name)
}, function (res, data) {
console.log(res)
})
}
}
}
}
RowLayout { RowLayout {
id: fileListItemHeaderItem id: fileListItemHeaderItem
width: ListView.view.width width: ListView.view.width
@ -185,7 +115,6 @@ Item {
=== 0 ? "null" : header.items[header.items.length - 1].uuid === 0 ? "null" : header.items[header.items.length - 1].uuid
Request.get("/knowledge/" + uuid, function (response) { Request.get("/knowledge/" + uuid, function (response) {
var data = JSON.parse(response) var data = JSON.parse(response)
console.log(response)
console.log(data.knowledgeFileAttribute) console.log(data.knowledgeFileAttribute)
fileListModel.clear() fileListModel.clear()
var files = data.children var files = data.children
@ -221,7 +150,7 @@ Item {
} }
fileListModel.append(modelItem) fileListModel.append(modelItem)
} }
console.log(fileListModel.count) console.log(fileListModel)
listView.currentIndex = -1 listView.currentIndex = -1
}) })
} }

View File

@ -1,122 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Window
import FluentUI
FluPopup {
id: popup
property string title: "Title"
property string message: "Message"
property string neutralText: "Neutral"
property string negativeText: "Negative"
property string positiveText: "Positive"
signal neutralClicked
signal negativeClicked
signal positiveClicked(string text)
enum ButtonFlag {
NegativeButton = 1,
NeutralButton = 2,
PositiveButton = 4
}
property int buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
property var minWidth: {
if (Window.window == null)
return 400
return Math.min(Window.window.width, 400)
}
focus: true
Rectangle {
id: layout_content
anchors.fill: parent
implicitWidth: minWidth
implicitHeight: text_title.height + text_message.height + layout_actions.height
color: 'transparent'
radius: 5
FluText {
id: text_title
font: FluTextStyle.TitleLarge
text: title
topPadding: 20
leftPadding: 20
rightPadding: 20
wrapMode: Text.WrapAnywhere
anchors {
top: parent.top
left: parent.left
right: parent.right
}
}
FluTextBox {
id: text_message
font: FluTextStyle.Body
wrapMode: Text.WrapAnywhere
placeholderText: message
topPadding: 14
leftPadding: 20
rightPadding: 20
bottomPadding: 14
anchors {
top: text_title.bottom
left: parent.left
right: parent.right
}
}
Rectangle {
id: layout_actions
height: 68
radius: 5
color: FluTheme.dark ? Qt.rgba(
32 / 255, 32 / 255, 32 / 255,
blurBackground ? blurOpacity - 0.4 : 1) : Qt.rgba(
243 / 255, 243 / 255, 243 / 255,
blurBackground ? blurOpacity - 0.4 : 1)
anchors {
top: text_message.bottom
left: parent.left
right: parent.right
}
RowLayout {
anchors {
centerIn: parent
margins: spacing
fill: parent
}
spacing: 15
FluButton {
id: neutral_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags & FluContentDialog.NeutralButton
text: neutralText
onClicked: {
popup.close()
neutralClicked()
}
}
FluButton {
id: negative_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags & FluContentDialog.NegativeButton
text: negativeText
onClicked: {
popup.close()
negativeClicked()
}
}
FluFilledButton {
id: positive_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags & FluContentDialog.PositiveButton
text: positiveText
onClicked: {
popup.close()
positiveClicked(text_message.text)
}
}
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB