Compare commits
No commits in common. "26b9016a45e1fd93d9aab854a2178f64d32545e6" and "b67075a3ba4d373403037ba9ac53945a20046d79" have entirely different histories.
26b9016a45
...
b67075a3ba
|
@ -107,30 +107,17 @@ FluWindow {
|
|||
"knowledgeFileId": file
|
||||
})
|
||||
}
|
||||
function onOpenNote(note, authorId) {
|
||||
function onOpenNote(note) {
|
||||
stack_view.push(note_view, {
|
||||
"noteFileId": note,
|
||||
"authorId": authorId
|
||||
"noteFileId": note
|
||||
})
|
||||
}
|
||||
function onBack() {
|
||||
if (stack_view.depth > 0)
|
||||
stack_view.pop()
|
||||
}
|
||||
function onCreateNote(file, fileType, fileTitle) {
|
||||
stack_view.push(note_view, {
|
||||
"knowledgeFileId": file,
|
||||
"fileType": fileType,
|
||||
"fileTitle": fileTitle
|
||||
})
|
||||
}
|
||||
function onModifyNote(file, fileType, fileTitle, note) {
|
||||
stack_view.push(note_view, {
|
||||
"knowledgeFileId": file,
|
||||
"fileType": fileType,
|
||||
"fileTitle": fileTitle,
|
||||
"noteId": note
|
||||
})
|
||||
function onCreateNote() {
|
||||
stack_view.push(create_note_view)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
import QtQuick 2.15
|
||||
import FluentUI
|
||||
import QtQuick.Layouts
|
||||
|
||||
FluArea {
|
||||
id: fileItem
|
||||
property string uuid
|
||||
property string title
|
||||
property string brief
|
||||
property string date
|
||||
property string type
|
||||
property string suffix
|
||||
property bool isDir: false
|
||||
property int size
|
||||
property int pageView
|
||||
property var tags: []
|
||||
property int stars
|
||||
property var colorList: ["blue", "green", "orange", "red", "yellow", "purple", "pink", "brown", "teal", "cyan", "gray", "darkgray"]
|
||||
signal tagClicked(string tag)
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
spacing: 10
|
||||
|
||||
ColumnLayout {
|
||||
id: clickable
|
||||
anchors.fill: parent
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onDoubleClicked: {
|
||||
fileItem.parent.doubleClicked()
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: titleRow
|
||||
Image {
|
||||
id: icon
|
||||
source: type ? "qrc:/AicsKnowledgeBase/res/" + type + ".png" : ""
|
||||
Layout.preferredHeight: 24
|
||||
Layout.preferredWidth: 24
|
||||
}
|
||||
FluText {
|
||||
id: title
|
||||
font.bold: true
|
||||
font.pointSize: 12
|
||||
text: fileItem.title
|
||||
}
|
||||
}
|
||||
|
||||
FluText {
|
||||
id: brief
|
||||
visible: !fileItem.isDir
|
||||
text: fileItem.brief
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WrapAnywhere
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 2
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
RowLayout {
|
||||
id: infoRow
|
||||
visible: !fileItem.isDir
|
||||
FluText {
|
||||
id: date
|
||||
color: "#5F5F5F"
|
||||
text: fileItem.date
|
||||
}
|
||||
FluText {
|
||||
id: size
|
||||
// cast Byte size to right text size
|
||||
color: "#5F5F5F"
|
||||
text: fileItem.size > 1024
|
||||
* 1024 ? (fileItem.size / 1024 / 1024).toFixed(
|
||||
2) + "MB" : (fileItem.size / 1024).toFixed(
|
||||
2) + "KB"
|
||||
}
|
||||
FluText {
|
||||
id: pageView
|
||||
color: "#5F5F5F"
|
||||
text: fileItem.pageView + "浏览"
|
||||
}
|
||||
FluText {
|
||||
id: stars
|
||||
color: "#5F5F5F"
|
||||
text: fileItem.stars + "收藏"
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
visible: !fileItem.isDir
|
||||
Repeater {
|
||||
model: fileItem.tags
|
||||
delegate: FluTextButton {
|
||||
text: "#" + fileItem.tags[index]
|
||||
normalColor: colorList[index % colorList.length]
|
||||
font.pixelSize: 12
|
||||
Layout.preferredWidth: 50
|
||||
onClicked: {
|
||||
emit: tagClicked(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import "qrc:///AicsKnowledgeBase/qml/global"
|
|||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
signal open(string note, string authorId)
|
||||
signal open(string note)
|
||||
signal createNote
|
||||
width: parent.width - 8
|
||||
property ListModel noteListModel: ListModel {
|
||||
|
@ -14,7 +14,6 @@ Item {
|
|||
title: "超级无敌报错"
|
||||
brief: "file:///D:/academic/2023-qtBig/AicsKnowledgeBase_client/AicsKnowledgeBase/qml/component/NoteList.qml:41:21: Unable to assign [undefined] to QString"
|
||||
author: "admin"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -24,7 +23,6 @@ Item {
|
|||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -34,7 +32,6 @@ Item {
|
|||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -44,7 +41,6 @@ Item {
|
|||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
authorId: "345"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
|
@ -91,7 +87,7 @@ Item {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
open(model.uuid, model.authorId)
|
||||
open(model.uuid)
|
||||
}
|
||||
}
|
||||
NoteListItem {
|
||||
|
@ -104,7 +100,6 @@ Item {
|
|||
brief: model.brief
|
||||
pageView: model.pageView
|
||||
author: model.author
|
||||
authorId: model.authorId
|
||||
stars: model.stars
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ FluArea {
|
|||
property int pageView
|
||||
property int stars
|
||||
property string author
|
||||
property string authorId
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
|
|
|
@ -4,8 +4,7 @@ import QtQuick
|
|||
|
||||
QtObject {
|
||||
signal open(string file)
|
||||
signal openNote(string note, string authorId)
|
||||
signal createNote(string file, string fileType, string fileTitle)
|
||||
signal modifyNote(string file, string fileType, string fileTitle, string note)
|
||||
signal openNote(string note)
|
||||
signal createNote
|
||||
signal back
|
||||
}
|
||||
|
|
|
@ -29,13 +29,11 @@ FluArea {
|
|||
NoteList {
|
||||
id: noteList
|
||||
noteListModel: content_page.noteListModel
|
||||
onOpen: function handle(noteId, authorId) {
|
||||
emit: SignalFileOperation.openNote(noteId, authorId)
|
||||
onOpen: function handle(noteId) {
|
||||
emit: SignalFileOperation.openNote(noteId)
|
||||
}
|
||||
onCreateNote: function handle() {
|
||||
emit: SignalFileOperation.createNote(
|
||||
content_area.knowledgeFileId, content_area.type,
|
||||
content_page.title)
|
||||
emit: SignalFileOperation.createNote()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +96,6 @@ FluArea {
|
|||
content_page.title = data.name
|
||||
content_page.fileId = data.knowledgeFileAttribute.id
|
||||
content_page.suffix = data.knowledgeFileAttribute.suffix
|
||||
content_page.fileSize = data.knowledgeFileAttribute.size
|
||||
|
||||
content_area.type = getType(content_page.suffix)
|
||||
console.log(content_area.type)
|
||||
|
@ -132,7 +129,6 @@ FluArea {
|
|||
"title": notes[i].title,
|
||||
"brief": notes[i].content,
|
||||
"author": notes[i].author.username,
|
||||
"authorId": notes[i].author.id,
|
||||
"pageView": notes[i].pageView,
|
||||
"stars": notes[i].starrers.length,
|
||||
"date": notes[i].createTime
|
||||
|
@ -293,10 +289,9 @@ FluArea {
|
|||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
text: content_page.fileSize > 1024
|
||||
* 1024 ? (content_page.fileSize / 1024 / 1024).toFixed(
|
||||
2) + "MB" : (content_page.fileSize / 1024).toFixed(
|
||||
2) + "KB"
|
||||
text: fileSize > 1024 * 1024 ? (fileSize / 1024 / 1024).toFixed(
|
||||
2) + "MB" : (fileSize / 1024).toFixed(
|
||||
2) + "KB"
|
||||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
|
|
|
@ -15,25 +15,17 @@ FluArea {
|
|||
id: edit_area
|
||||
paddings: 0
|
||||
backgroundColor: "#f9f9f9"
|
||||
property string knowledgeFileId
|
||||
property string uuid
|
||||
property string fileType: "OTHER"
|
||||
property string fileTitle: "dgfgf"
|
||||
property string noteFileId
|
||||
property string noteTitle: ""
|
||||
property string noteContent: ""
|
||||
property var tags: []
|
||||
property string noteId
|
||||
property string noteTitle
|
||||
property string noteContent
|
||||
property bool isModifying: false
|
||||
|
||||
Component.onCompleted: {
|
||||
if (isModifying) {
|
||||
Request.getSearch("/search/note/" + noteFileId + "/content",
|
||||
function (response, data) {
|
||||
noteTitle = data.title
|
||||
noteContent = data.content
|
||||
input_title.text = noteTitle
|
||||
input_md.contentMd = noteContent
|
||||
tags = data.tags
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
noteTitle = Qt.binding(function () {
|
||||
|
@ -60,7 +52,7 @@ FluArea {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: {
|
||||
emit: SignalFileOperation.open(note_page.knowledgeFileId)
|
||||
emit: SignalFileOperation.open(note_page.uuid)
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
|
@ -107,7 +99,6 @@ FluArea {
|
|||
padding: 10
|
||||
placeholderText: "单行输入框"
|
||||
implicitWidth: parent.width
|
||||
font.pointSize: 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,30 +127,11 @@ FluArea {
|
|||
FluFilledButton {
|
||||
text: "上传"
|
||||
onClicked: {
|
||||
if (noteTitle.trim() !== "" && noteContent !== "") {
|
||||
if (isModifying) {
|
||||
Request.post("note", {
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
})
|
||||
} else {
|
||||
Request.put("note/" + noteFileId, {
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
FluButton {
|
||||
text: "取消"
|
||||
onClicked: {
|
||||
emit: SignalFileOperation.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,20 +65,25 @@ FluArea {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Request.getSearch("/", function (response, data) {
|
||||
note_page.uuid = data.id
|
||||
note_page.fileTitle = data.name
|
||||
note_page.fileType = getType(data.knowledgeFileAttribute.suffix)
|
||||
note_page.fileStars = 0
|
||||
|
||||
var tagString = ""
|
||||
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
|
||||
if (j != 0)
|
||||
tagString = tagString + ","
|
||||
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
|
||||
}
|
||||
note_page.fileTags = tagString
|
||||
})
|
||||
// Request.get("knowledge/", function (response, data) {
|
||||
// fromFile = {
|
||||
// note_page.uuid = data.id,
|
||||
// note_page.fileTitle = data.name,
|
||||
// note_page.fileType = getType(data.knowledgeFileAttribute.suffix),
|
||||
|
||||
// }
|
||||
|
||||
// note_page.fileStars = 0
|
||||
|
||||
// var tagString = ""
|
||||
// for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
|
||||
// if (j != 0)
|
||||
// tagString = tagString + ","
|
||||
// tagString = tagString + file.knowledgeFileAttribute.tags[j].name
|
||||
// }
|
||||
// note_page.fileTags = tagString
|
||||
// })
|
||||
}
|
||||
|
||||
FluIconButton {
|
||||
|
|
Loading…
Reference in New Issue