Compare commits

..

No commits in common. "8c37bca675551ed6ffab12dc72b7687ad3d63cd0" and "d70e2266e2c6f423facccbe46d1368f7cbd184c2" have entirely different histories.

4 changed files with 41 additions and 63 deletions

View File

@ -58,7 +58,6 @@ Item {
model: noteListModel model: noteListModel
delegate: noteListItemDelegate delegate: noteListItemDelegate
} }
Component { Component {
id: noteListItemHeader id: noteListItemHeader
Item { Item {
@ -112,6 +111,5 @@ Item {
} }
function setListModel(listModel) { function setListModel(listModel) {
listView.model = listModel listView.model = listModel
//console.log(listView.model.get(0).uuid)
} }
} }

View File

@ -28,7 +28,7 @@ FluArea {
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
NoteList { NoteList {
id: noteList id: noteList
//noteListModel: content_page.noteListModel noteListModel: content_page.noteListModel
onOpen: function handle(noteId, authorId) { onOpen: function handle(noteId, authorId) {
emit: SignalFileOperation.openNote(noteId, authorId) emit: SignalFileOperation.openNote(noteId, authorId)
popup.close() popup.close()
@ -75,7 +75,7 @@ FluArea {
property double fileSize: 0 property double fileSize: 0
property string title: "文章标题" property string title: "文章标题"
property list<string> tags: ["tag 1", "tag 2", "tag 3"] property list<string> tags: ["tag 1", "tag 2", "tag 3"]
property string publishTime property var publishTime
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"
@ -95,18 +95,16 @@ FluArea {
content_area.knowledgeFileId = knowledgeFileId content_area.knowledgeFileId = knowledgeFileId
console.log(knowledgeFileId) console.log(knowledgeFileId)
Request.get("knowledge/" + knowledgeFileId + "/detailed", Request.get("knowledge/" + knowledgeFileId + "/detailed",
function (response) { function (response, data) {
console.log(response) console.log(response)
var data = JSON.parse(response) content_page.publishTime = data.createTime
content_page.publishTime = data.createTime.substring(
0, 10)
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_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.fileId)
var tagString = "" var tagString = ""
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) { for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
@ -128,30 +126,22 @@ FluArea {
} }
content_page.favoriteCount = starers.length content_page.favoriteCount = starers.length
noteList.setListModel([]) noteListModel.clear()
var notes = data.knowledgeFileAttribute.notes var notes = data.knowledgeFileAttribute.notes
noteCount = notes.length noteCount = notes.length
console.log(noteCount) for (var i = 0; i < notes.length; i++) {
var noteItems = [] noteListModel.append({
for (i = 0; i < notes.length; i++) { "uuid": notes[i].id,
var note = notes[i] "title": notes[i].title,
"brief": notes[i].content,
Request.getSearch( "author": notes[i].author.username,
"search/note/" + notes[i].id + "/content", "authorId": notes[i].author.id,
response => { "pageView": notes[i].pageView,
noteItems.push({ "stars": notes[i].starrers.length,
"uuid": note.id, "date": notes[i].createTime
"title": note.title,
"brief": response,
"author": note.author.username,
"authorId": note.author.id,
"pageView": note.pageView,
"stars": note.starers.length,
"date": note.createTime
})
}) })
} }
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(
@ -256,11 +246,10 @@ FluArea {
iconSource: content_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar iconSource: content_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
onClicked: { onClicked: {
content_page.isFavorite = !content_page.isFavorite content_page.isFavorite = !content_page.isFavorite
content_page.favoriteCount += (content_page.isFavorite ? 1 : -1) content_page.favoriteCount += 1
Request.put("knowledge/" + knowledgeFileId + "/star", Request.put("knowledge/" + knowledgeFileId + "/star", {
JSON.stringify({
"active": content_page.isFavorite "active": content_page.isFavorite
})) })
} }
} }
FluText { FluText {
@ -303,7 +292,7 @@ FluArea {
width: parent.width width: parent.width
FluText { FluText {
padding: 10 padding: 10
text: content_page.publishTime.substring(0, 10) text: content_page.publishTime
} }
FluText { FluText {
padding: 10 padding: 10

View File

@ -143,26 +143,19 @@ FluArea {
console.log(noteContent) console.log(noteContent)
console.log(knowledgeFileId) console.log(knowledgeFileId)
if (!isModifying) { if (!isModifying) {
Request.post("note", JSON.stringify({ Request.post("note", {
"title": noteTitle, "title": noteTitle,
"content": noteContent, "content": noteContent,
"tags": [], "tags": [],
"linkingKnowledgeFiles": [knowledgeFileId] "linkingKnowledgeFiles": [knowledgeFileId]
}),
response => {
console.log(response)
}, response => {
console.log(response)
}) })
SignalFileOperation.back()
} else { } else {
Request.put("note/" + noteFileId, JSON.stringify({ Request.put("note/" + noteFileId, {
"title": noteTitle, "title": noteTitle,
"content": noteContent, "content": noteContent,
"tags": [], "tags": [],
"linkingKnowledgeFiles": [knowledgeFileId] "linkingKnowledgeFiles": [knowledgeFileId]
})) })
SignalFileOperation.back()
} }
} }
} }

View File

@ -160,10 +160,9 @@ FluArea {
iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
onClicked: { onClicked: {
note_page.isFavorite = !note_page.isFavorite note_page.isFavorite = !note_page.isFavorite
Request.put("/note/" + noteFileId + "/star", Request.put("/note/" + noteFileId + "/star", {
JSON.stringify({
"active": note_page.isFavorite "active": note_page.isFavorite
})) })
} }
} }
FluText { FluText {
@ -186,10 +185,9 @@ FluArea {
iconSource: note_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart iconSource: note_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart
onClicked: { onClicked: {
note_page.isLike = !note_page.isLike note_page.isLike = !note_page.isLike
Request.put("/note/" + noteFileId + "/like", Request.put("/note/" + noteFileId + "/like", {
JSON.stringify({
"active": note_page.isLike "active": note_page.isLike
})) })
} }
} }
FluText { FluText {
@ -214,7 +212,7 @@ FluArea {
width: parent.width width: parent.width
FluText { FluText {
padding: 10 padding: 10
text: note_page.publishTime.substring(0, 10) text: note_page.publishTime
} }
FluText { FluText {
padding: 10 padding: 10