增加了接口
parent
b6627ccd2c
commit
26b29d0fe5
|
@ -107,17 +107,30 @@ FluWindow {
|
||||||
"knowledgeFileId": file
|
"knowledgeFileId": file
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function onOpenNote(note) {
|
function onOpenNote(note, authorId) {
|
||||||
stack_view.push(note_view, {
|
stack_view.push(note_view, {
|
||||||
"noteFileId": note
|
"noteFileId": note,
|
||||||
|
"authorId": authorId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function onBack() {
|
function onBack() {
|
||||||
if (stack_view.depth > 0)
|
if (stack_view.depth > 0)
|
||||||
stack_view.pop()
|
stack_view.pop()
|
||||||
}
|
}
|
||||||
function onCreateNote() {
|
function onCreateNote(file, fileType, fileTitle) {
|
||||||
stack_view.push(create_note_view)
|
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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
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 {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
signal open(string note)
|
signal open(string note, string authorId)
|
||||||
signal createNote
|
signal createNote
|
||||||
width: parent.width - 8
|
width: parent.width - 8
|
||||||
property ListModel noteListModel: ListModel {
|
property ListModel noteListModel: ListModel {
|
||||||
|
@ -14,6 +14,7 @@ Item {
|
||||||
title: "超级无敌报错"
|
title: "超级无敌报错"
|
||||||
brief: "file:///D:/academic/2023-qtBig/AicsKnowledgeBase_client/AicsKnowledgeBase/qml/component/NoteList.qml:41:21: Unable to assign [undefined] to QString"
|
brief: "file:///D:/academic/2023-qtBig/AicsKnowledgeBase_client/AicsKnowledgeBase/qml/component/NoteList.qml:41:21: Unable to assign [undefined] to QString"
|
||||||
author: "admin"
|
author: "admin"
|
||||||
|
authorId: "345"
|
||||||
pageView: 123
|
pageView: 123
|
||||||
stars: 27
|
stars: 27
|
||||||
date: "2022-02-02"
|
date: "2022-02-02"
|
||||||
|
@ -23,6 +24,7 @@ Item {
|
||||||
title: "Qt布局"
|
title: "Qt布局"
|
||||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||||
author: "超级无敌长的账户名"
|
author: "超级无敌长的账户名"
|
||||||
|
authorId: "345"
|
||||||
pageView: 123
|
pageView: 123
|
||||||
stars: 27
|
stars: 27
|
||||||
date: "2022-02-02"
|
date: "2022-02-02"
|
||||||
|
@ -32,6 +34,7 @@ Item {
|
||||||
title: "Qt布局"
|
title: "Qt布局"
|
||||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||||
author: "超级无敌长的账户名"
|
author: "超级无敌长的账户名"
|
||||||
|
authorId: "345"
|
||||||
pageView: 123
|
pageView: 123
|
||||||
stars: 27
|
stars: 27
|
||||||
date: "2022-02-02"
|
date: "2022-02-02"
|
||||||
|
@ -41,6 +44,7 @@ Item {
|
||||||
title: "Qt布局"
|
title: "Qt布局"
|
||||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||||
author: "超级无敌长的账户名"
|
author: "超级无敌长的账户名"
|
||||||
|
authorId: "345"
|
||||||
pageView: 123
|
pageView: 123
|
||||||
stars: 27
|
stars: 27
|
||||||
date: "2022-02-02"
|
date: "2022-02-02"
|
||||||
|
@ -87,7 +91,7 @@ Item {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
open(model.uuid)
|
open(model.uuid, model.authorId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NoteListItem {
|
NoteListItem {
|
||||||
|
@ -100,6 +104,7 @@ Item {
|
||||||
brief: model.brief
|
brief: model.brief
|
||||||
pageView: model.pageView
|
pageView: model.pageView
|
||||||
author: model.author
|
author: model.author
|
||||||
|
authorId: model.authorId
|
||||||
stars: model.stars
|
stars: model.stars
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ FluArea {
|
||||||
property int pageView
|
property int pageView
|
||||||
property int stars
|
property int stars
|
||||||
property string author
|
property string author
|
||||||
|
property string authorId
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: row
|
id: row
|
||||||
|
|
|
@ -4,7 +4,8 @@ import QtQuick
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
signal open(string file)
|
signal open(string file)
|
||||||
signal openNote(string note)
|
signal openNote(string note, string authorId)
|
||||||
signal createNote
|
signal createNote(string file, string fileType, string fileTitle)
|
||||||
|
signal modifyNote(string file, string fileType, string fileTitle, string note)
|
||||||
signal back
|
signal back
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,13 @@ FluArea {
|
||||||
NoteList {
|
NoteList {
|
||||||
id: noteList
|
id: noteList
|
||||||
noteListModel: content_page.noteListModel
|
noteListModel: content_page.noteListModel
|
||||||
onOpen: function handle(noteId) {
|
onOpen: function handle(noteId, authorId) {
|
||||||
emit: SignalFileOperation.openNote(noteId)
|
emit: SignalFileOperation.openNote(noteId, authorId)
|
||||||
}
|
}
|
||||||
onCreateNote: function handle() {
|
onCreateNote: function handle() {
|
||||||
emit: SignalFileOperation.createNote()
|
emit: SignalFileOperation.createNote(
|
||||||
|
content_area.knowledgeFileId, content_area.type,
|
||||||
|
content_page.title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +98,7 @@ FluArea {
|
||||||
content_page.title = data.name
|
content_page.title = data.name
|
||||||
content_page.fileId = data.knowledgeFileAttribute.id
|
content_page.fileId = data.knowledgeFileAttribute.id
|
||||||
content_page.suffix = data.knowledgeFileAttribute.suffix
|
content_page.suffix = data.knowledgeFileAttribute.suffix
|
||||||
|
content_page.fileSize = data.knowledgeFileAttribute.size
|
||||||
|
|
||||||
content_area.type = getType(content_page.suffix)
|
content_area.type = getType(content_page.suffix)
|
||||||
console.log(content_area.type)
|
console.log(content_area.type)
|
||||||
|
@ -129,6 +132,7 @@ FluArea {
|
||||||
"title": notes[i].title,
|
"title": notes[i].title,
|
||||||
"brief": notes[i].content,
|
"brief": notes[i].content,
|
||||||
"author": notes[i].author.username,
|
"author": notes[i].author.username,
|
||||||
|
"authorId": notes[i].author.id,
|
||||||
"pageView": notes[i].pageView,
|
"pageView": notes[i].pageView,
|
||||||
"stars": notes[i].starrers.length,
|
"stars": notes[i].starrers.length,
|
||||||
"date": notes[i].createTime
|
"date": notes[i].createTime
|
||||||
|
@ -289,8 +293,9 @@ FluArea {
|
||||||
}
|
}
|
||||||
FluText {
|
FluText {
|
||||||
padding: 10
|
padding: 10
|
||||||
text: fileSize > 1024 * 1024 ? (fileSize / 1024 / 1024).toFixed(
|
text: content_page.fileSize > 1024
|
||||||
2) + "MB" : (fileSize / 1024).toFixed(
|
* 1024 ? (content_page.fileSize / 1024 / 1024).toFixed(
|
||||||
|
2) + "MB" : (content_page.fileSize / 1024).toFixed(
|
||||||
2) + "KB"
|
2) + "KB"
|
||||||
}
|
}
|
||||||
FluText {
|
FluText {
|
||||||
|
|
|
@ -15,17 +15,25 @@ FluArea {
|
||||||
id: edit_area
|
id: edit_area
|
||||||
paddings: 0
|
paddings: 0
|
||||||
backgroundColor: "#f9f9f9"
|
backgroundColor: "#f9f9f9"
|
||||||
property string uuid
|
property string knowledgeFileId
|
||||||
property string fileType: "OTHER"
|
property string fileType: "OTHER"
|
||||||
property string fileTitle: "dgfgf"
|
property string fileTitle: "dgfgf"
|
||||||
property string noteId
|
property string noteFileId
|
||||||
property string noteTitle
|
property string noteTitle: ""
|
||||||
property string noteContent
|
property string noteContent: ""
|
||||||
|
property var tags: []
|
||||||
property bool isModifying: false
|
property bool isModifying: false
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (isModifying) {
|
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 () {
|
noteTitle = Qt.binding(function () {
|
||||||
|
@ -52,7 +60,7 @@ FluArea {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onDoubleClicked: {
|
onDoubleClicked: {
|
||||||
emit: SignalFileOperation.open(note_page.uuid)
|
emit: SignalFileOperation.open(note_page.knowledgeFileId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -99,6 +107,7 @@ FluArea {
|
||||||
padding: 10
|
padding: 10
|
||||||
placeholderText: "单行输入框"
|
placeholderText: "单行输入框"
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
|
font.pointSize: 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,11 +136,30 @@ FluArea {
|
||||||
FluFilledButton {
|
FluFilledButton {
|
||||||
text: "上传"
|
text: "上传"
|
||||||
onClicked: {
|
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 {
|
FluButton {
|
||||||
text: "取消"
|
text: "取消"
|
||||||
|
onClicked: {
|
||||||
|
emit: SignalFileOperation.back()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,25 +65,20 @@ FluArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
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
|
||||||
|
|
||||||
// Request.get("knowledge/", function (response, data) {
|
var tagString = ""
|
||||||
// fromFile = {
|
for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
|
||||||
// note_page.uuid = data.id,
|
if (j != 0)
|
||||||
// note_page.fileTitle = data.name,
|
tagString = tagString + ","
|
||||||
// note_page.fileType = getType(data.knowledgeFileAttribute.suffix),
|
tagString = tagString + file.knowledgeFileAttribute.tags[j].name
|
||||||
|
}
|
||||||
// }
|
note_page.fileTags = tagString
|
||||||
|
})
|
||||||
// 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 {
|
FluIconButton {
|
||||||
|
|
Loading…
Reference in New Issue