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