wuyize 2023-07-07 05:54:18 +08:00
commit f32bcae463
3 changed files with 71 additions and 55 deletions

View File

@ -1,5 +1,7 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Window
import FluentUI import FluentUI
import "qrc:///AicsKnowledgeBase/qml/global" import "qrc:///AicsKnowledgeBase/qml/global"
@ -50,68 +52,67 @@ Item {
date: "2022-02-02" date: "2022-02-02"
} }
} }
ListView {
id: listView RowLayout {
anchors.fill: parent height: 48
spacing: 8 anchors.left: parent.left
header: noteListItemHeader anchors.right: parent.right
model: noteListModel anchors.leftMargin: 10
delegate: noteListItemDelegate anchors.rightMargin: 10
FluText {
text: "笔记列表"
font.pixelSize: 18
font.bold: true
}
FluButton {
id: createNoteButton
text: "新建笔记"
Layout.alignment: Qt.AlignRight
onClicked: {
createNote()
}
}
} }
Component { FluScrollablePage {
id: noteListItemHeader anchors.fill: parent
Item { anchors.topMargin: 50
id: noteListItemHeaderItem ColumnLayout {
width: ListView.view.width Layout.fillWidth: true
height: 48 spacing: 8
RowLayout { Repeater {
width: parent.width id: repeater
FluText { model: noteListModel
text: "笔记列表" delegate: Rectangle {
font.pixelSize: 18 id: noteListItemRect
font.bold: true Layout.fillWidth: true
} height: 150
FluButton { MouseArea {
id: createNoteButton anchors.fill: parent
text: "新建笔记" onClicked: {
Layout.alignment: Qt.AlignRight open(model.uuid, model.authorId)
onClicked: { }
createNote() }
NoteListItem {
id: noteListItem
uuid: model.uuid
width: parent.width
height: parent.height
title: model.title
date: model.date
brief: model.brief
pageView: model.pageView
author: model.author
authorId: model.authorId
stars: model.stars
} }
} }
} }
} }
} }
Component {
id: noteListItemDelegate
Rectangle {
id: noteListItemRect
width: ListView.view.width
height: 150
MouseArea {
anchors.fill: parent
onClicked: {
open(model.uuid, model.authorId)
}
}
NoteListItem {
id: noteListItem
uuid: model.uuid
width: parent.width
height: parent.height
title: model.title
date: model.date
brief: model.brief
pageView: model.pageView
author: model.author
authorId: model.authorId
stars: model.stars
}
}
}
function setListModel(listModel) { function setListModel(listModel) {
listView.model = listModel repeater.model = listModel
//console.log(listView.model.get(0).uuid) //console.log(listView.model.get(0).uuid)
} }
} }

View File

@ -70,6 +70,18 @@ QtObject {
xhr.send(arg) xhr.send(arg)
} }
function putForm(url, arg, success, failure) {
var xhr = new XMLHttpRequest
xhr.open("POST", baseUrl + url)
xhr.setRequestHeader("Content-Length", arg.length)
xhr.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded;")
xhr.onreadystatechange = function () {
handleResponse(xhr, success, failure)
}
xhr.send(arg)
}
/* function post(url, arg, success, failure) { /* function post(url, arg, success, failure) {
var xhr = new XMLHttpRequest var xhr = new XMLHttpRequest

View File

@ -14,6 +14,8 @@ import "qrc:///AicsKnowledgeBase/qml/global"
FluArea { FluArea {
property ListModel noteListModel2: ListModel {} property ListModel noteListModel2: ListModel {}
Popup { Popup {
x: parent.width - width
implicitHeight: parent.height
id: popup id: popup
modal: true // true modal: true // true
focus: true //, activeFocus focus: true //, activeFocus
@ -24,12 +26,13 @@ FluArea {
color: Qt.rgba(0, 0, 0, 0) // color: Qt.rgba(0, 0, 0, 0) //
} }
FluArea { FluArea {
width: 350 width: 350
height: 500 height: 500
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
NoteList { NoteList {
id: noteList id: noteList
noteListModel: noteListModel2 //noteListModel: noteListModel2
onOpen: function handle(noteId, authorId) { onOpen: function handle(noteId, authorId) {
emit: SignalFileOperation.openNote(noteId, authorId) emit: SignalFileOperation.openNote(noteId, authorId)
popup.close() popup.close()