Compare commits
No commits in common. "8c37bca675551ed6ffab12dc72b7687ad3d63cd0" and "d70e2266e2c6f423facccbe46d1368f7cbd184c2" have entirely different histories.
8c37bca675
...
d70e2266e2
|
@ -58,7 +58,6 @@ Item {
|
|||
model: noteListModel
|
||||
delegate: noteListItemDelegate
|
||||
}
|
||||
|
||||
Component {
|
||||
id: noteListItemHeader
|
||||
Item {
|
||||
|
@ -112,6 +111,5 @@ Item {
|
|||
}
|
||||
function setListModel(listModel) {
|
||||
listView.model = listModel
|
||||
//console.log(listView.model.get(0).uuid)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ FluArea {
|
|||
backgroundColor: "#f9f9f9"
|
||||
NoteList {
|
||||
id: noteList
|
||||
//noteListModel: content_page.noteListModel
|
||||
noteListModel: content_page.noteListModel
|
||||
onOpen: function handle(noteId, authorId) {
|
||||
emit: SignalFileOperation.openNote(noteId, authorId)
|
||||
popup.close()
|
||||
|
@ -75,7 +75,7 @@ FluArea {
|
|||
property double fileSize: 0
|
||||
property string title: "文章标题"
|
||||
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
|
||||
property string publishTime
|
||||
property var publishTime
|
||||
property string brief: "这是一个简介"
|
||||
property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/"
|
||||
property string suffix: "md"
|
||||
|
@ -95,18 +95,16 @@ FluArea {
|
|||
content_area.knowledgeFileId = knowledgeFileId
|
||||
console.log(knowledgeFileId)
|
||||
Request.get("knowledge/" + knowledgeFileId + "/detailed",
|
||||
function (response) {
|
||||
function (response, data) {
|
||||
console.log(response)
|
||||
var data = JSON.parse(response)
|
||||
content_page.publishTime = data.createTime.substring(
|
||||
0, 10)
|
||||
content_page.publishTime = data.createTime
|
||||
content_page.title = data.name
|
||||
content_page.fileId = data.knowledgeFileAttribute.id
|
||||
content_page.suffix = data.knowledgeFileAttribute.suffix
|
||||
content_page.fileSize = data.knowledgeFileAttribute.size
|
||||
|
||||
content_area.type = getType(content_page.suffix)
|
||||
console.log(content_area.type)
|
||||
console.log(content_area.fileId)
|
||||
|
||||
var tagString = ""
|
||||
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
|
||||
|
@ -128,30 +126,22 @@ FluArea {
|
|||
}
|
||||
content_page.favoriteCount = starers.length
|
||||
|
||||
noteList.setListModel([])
|
||||
noteListModel.clear()
|
||||
var notes = data.knowledgeFileAttribute.notes
|
||||
noteCount = notes.length
|
||||
console.log(noteCount)
|
||||
var noteItems = []
|
||||
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
|
||||
})
|
||||
})
|
||||
for (var i = 0; i < notes.length; i++) {
|
||||
noteListModel.append({
|
||||
"uuid": notes[i].id,
|
||||
"title": notes[i].title,
|
||||
"brief": notes[i].content,
|
||||
"author": notes[i].author.username,
|
||||
"authorId": notes[i].author.id,
|
||||
"pageView": notes[i].pageView,
|
||||
"stars": notes[i].starrers.length,
|
||||
"date": notes[i].createTime
|
||||
})
|
||||
}
|
||||
noteList.noteListModel.append(noteItems)
|
||||
|
||||
if (content_area.type === "MD") {
|
||||
// console.log(content_area.type)
|
||||
FileTransferManager.getMarkdown(
|
||||
|
@ -256,11 +246,10 @@ FluArea {
|
|||
iconSource: content_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
|
||||
onClicked: {
|
||||
content_page.isFavorite = !content_page.isFavorite
|
||||
content_page.favoriteCount += (content_page.isFavorite ? 1 : -1)
|
||||
Request.put("knowledge/" + knowledgeFileId + "/star",
|
||||
JSON.stringify({
|
||||
"active": content_page.isFavorite
|
||||
}))
|
||||
content_page.favoriteCount += 1
|
||||
Request.put("knowledge/" + knowledgeFileId + "/star", {
|
||||
"active": content_page.isFavorite
|
||||
})
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
|
@ -303,7 +292,7 @@ FluArea {
|
|||
width: parent.width
|
||||
FluText {
|
||||
padding: 10
|
||||
text: content_page.publishTime.substring(0, 10)
|
||||
text: content_page.publishTime
|
||||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
|
|
|
@ -143,26 +143,19 @@ FluArea {
|
|||
console.log(noteContent)
|
||||
console.log(knowledgeFileId)
|
||||
if (!isModifying) {
|
||||
Request.post("note", JSON.stringify({
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
}),
|
||||
response => {
|
||||
console.log(response)
|
||||
}, response => {
|
||||
console.log(response)
|
||||
Request.post("note", {
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
})
|
||||
SignalFileOperation.back()
|
||||
} else {
|
||||
Request.put("note/" + noteFileId, JSON.stringify({
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
}))
|
||||
SignalFileOperation.back()
|
||||
Request.put("note/" + noteFileId, {
|
||||
"title": noteTitle,
|
||||
"content": noteContent,
|
||||
"tags": [],
|
||||
"linkingKnowledgeFiles": [knowledgeFileId]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,10 +160,9 @@ FluArea {
|
|||
iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
|
||||
onClicked: {
|
||||
note_page.isFavorite = !note_page.isFavorite
|
||||
Request.put("/note/" + noteFileId + "/star",
|
||||
JSON.stringify({
|
||||
"active": note_page.isFavorite
|
||||
}))
|
||||
Request.put("/note/" + noteFileId + "/star", {
|
||||
"active": note_page.isFavorite
|
||||
})
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
|
@ -186,10 +185,9 @@ FluArea {
|
|||
iconSource: note_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart
|
||||
onClicked: {
|
||||
note_page.isLike = !note_page.isLike
|
||||
Request.put("/note/" + noteFileId + "/like",
|
||||
JSON.stringify({
|
||||
"active": note_page.isLike
|
||||
}))
|
||||
Request.put("/note/" + noteFileId + "/like", {
|
||||
"active": note_page.isLike
|
||||
})
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
|
@ -214,7 +212,7 @@ FluArea {
|
|||
width: parent.width
|
||||
FluText {
|
||||
padding: 10
|
||||
text: note_page.publishTime.substring(0, 10)
|
||||
text: note_page.publishTime
|
||||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
|
|
Loading…
Reference in New Issue