karlis 2023-07-07 04:58:19 +08:00
parent 8c37bca675
commit c21b9ee81a
1 changed files with 16 additions and 14 deletions

View File

@ -12,6 +12,7 @@ import "qrc:///AicsKnowledgeBase/qml/component"
import "qrc:///AicsKnowledgeBase/qml/global"
FluArea {
property ListModel noteListModel2: ListModel {}
Popup {
id: popup
modal: true // true
@ -28,7 +29,7 @@ FluArea {
backgroundColor: "#f9f9f9"
NoteList {
id: noteList
//noteListModel: content_page.noteListModel
noteListModel: noteListModel2
onOpen: function handle(noteId, authorId) {
emit: SignalFileOperation.openNote(noteId, authorId)
popup.close()
@ -79,7 +80,6 @@ FluArea {
property string brief: "这是一个简介"
property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/"
property string suffix: "md"
property ListModel noteListModel
function getType(suffix) {
if (suffix === "md")
@ -128,30 +128,32 @@ FluArea {
}
content_page.favoriteCount = starers.length
noteList.setListModel([])
var notes = data.knowledgeFileAttribute.notes
noteCount = notes.length
console.log(noteCount)
var noteItems = []
noteListModel2.clear()
for (i = 0; i < notes.length; i++) {
var note = notes[i]
Request.getSearch(
"search/note/" + notes[i].id + "/content",
response => {
noteItems.push({
"uuid": note.id,
"title": note.title,
"brief": response,
"author": note.author.username,
"authorId": note.author.id,
"pageView": note.pageView,
"stars": note.starers.length,
"date": note.createTime
})
noteListModel2.append({
"uuid": note.id,
"title": note.title,
"brief": response,
"author": note.author.username,
"authorId": note.author.id,
"pageView": note.pageView,
"stars": note.starers.length,
"date": note.createTime
})
console.log(
noteListModel2.count)
})
}
noteList.noteListModel.append(noteItems)
if (content_area.type === "MD") {
// console.log(content_area.type)
FileTransferManager.getMarkdown(