Compare commits

..

No commits in common. "ecff8e709ca5babace419a45c5a07db0b47cadb1" and "234c24e9f05affd9f0b2e6c4256a896ae64be942" have entirely different histories.

4 changed files with 18 additions and 67 deletions

View File

@ -95,7 +95,7 @@ FluWindow {
duration: 200 duration: 200
} }
} }
initialItem: note_view initialItem: create_note_view
} }
Connections { Connections {
@ -118,19 +118,18 @@ FluWindow {
stack_view.pop() stack_view.pop()
} }
function onCreateNote(file, fileType, fileTitle) { function onCreateNote(file, fileType, fileTitle) {
stack_view.push(create_note_view, { stack_view.push(note_view, {
"knowledgeFileId": file, "knowledgeFileId": file,
"fileType": fileType, "fileType": fileType,
"fileTitle": fileTitle "fileTitle": fileTitle
}) })
} }
function onModifyNote(file, fileType, fileTitle, note) { function onModifyNote(file, fileType, fileTitle, note) {
stack_view.push(create_note_view, { stack_view.push(note_view, {
"knowledgeFileId": file, "knowledgeFileId": file,
"fileType": fileType, "fileType": fileType,
"fileTitle": fileTitle, "fileTitle": fileTitle,
"noteId": note, "noteId": note
"isModifying": true
}) })
} }
} }

View File

@ -31,13 +31,11 @@ FluArea {
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()
} }
onCreateNote: function handle() { onCreateNote: function handle() {
emit: SignalFileOperation.createNote(content_page.fileId, emit: SignalFileOperation.createNote(
content_area.type, content_area.knowledgeFileId, content_area.type,
content_page.title) content_page.title)
popup.close()
} }
} }
} }
@ -94,9 +92,8 @@ FluArea {
function loadFile(knowledgeFileId) { function loadFile(knowledgeFileId) {
content_area.knowledgeFileId = knowledgeFileId content_area.knowledgeFileId = knowledgeFileId
console.log(knowledgeFileId) console.log(knowledgeFileId)
Request.get("knowledge/" + knowledgeFileId + "/detailed", Request.get("knowledge/" + knowledgeFileId + "/detail",
function (response, data) { function (response, data) {
console.log(response)
content_page.publishTime = data.createTime content_page.publishTime = data.createTime
content_page.title = data.name content_page.title = data.name
content_page.fileId = data.knowledgeFileAttribute.id content_page.fileId = data.knowledgeFileAttribute.id
@ -104,7 +101,7 @@ FluArea {
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.fileId) console.log(content_area.type)
var tagString = "" var tagString = ""
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) { for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
@ -248,7 +245,7 @@ FluArea {
content_page.isFavorite = !content_page.isFavorite content_page.isFavorite = !content_page.isFavorite
content_page.favoriteCount += 1 content_page.favoriteCount += 1
Request.put("knowledge/" + knowledgeFileId + "/star", { Request.put("knowledge/" + knowledgeFileId + "/star", {
"active": content_page.isFavorite "active": UserData.userId
}) })
} }
} }
@ -354,6 +351,7 @@ FluArea {
FluMediaPlayer { FluMediaPlayer {
width: parent.width width: parent.width
height: width * 9 / 16. height: width * 9 / 16.
source: "https://api.hammer-hfut.tk:233/aics/file/static/3f28fea9-27f1-4a85-9d3e-def187c4456e.mp4"
} }
} }
Component { Component {

View File

@ -25,8 +25,6 @@ FluArea {
property bool isModifying: false property bool isModifying: false
Component.onCompleted: { Component.onCompleted: {
console.log(knowledgeFileId)
isModifying = false
if (isModifying) { if (isModifying) {
Request.getSearch("/search/note/" + noteFileId + "/content", Request.getSearch("/search/note/" + noteFileId + "/content",
function (response, data) { function (response, data) {
@ -139,10 +137,7 @@ FluArea {
text: "上传" text: "上传"
onClicked: { onClicked: {
if (noteTitle.trim() !== "" && noteContent !== "") { if (noteTitle.trim() !== "" && noteContent !== "") {
console.log(noteTitle) if (isModifying) {
console.log(noteContent)
console.log(knowledgeFileId)
if (!isModifying) {
Request.post("note", { Request.post("note", {
"title": noteTitle, "title": noteTitle,
"content": noteContent, "content": noteContent,

View File

@ -18,7 +18,6 @@ FluArea {
// visible: false // visible: false
property string type: "" property string type: ""
property string noteFileId property string noteFileId
property string authorId
signal clickTags(string tagName) signal clickTags(string tagName)
// paddings: { // paddings: {
@ -47,6 +46,7 @@ FluArea {
property string publishTime: "2020-01-01" property string publishTime: "2020-01-01"
property string brief: "这是一个简介" property string brief: "这是一个简介"
property string uuid: "354"
property string fileTitle: "dfnfgf" property string fileTitle: "dfnfgf"
property string fileType: "OTHER" property string fileType: "OTHER"
@ -65,37 +65,19 @@ FluArea {
} }
Component.onCompleted: { Component.onCompleted: {
Request.getSearch("note/" + noteFileId, function (response, data) { Request.getSearch("/", function (response, data) {
note_page.fileId = data.id note_page.uuid = data.id
note_page.fileTitle = data.name note_page.fileTitle = data.name
note_page.fileType = getType(data.knowledgeFileAttribute.suffix) note_page.fileType = getType(data.knowledgeFileAttribute.suffix)
note_page.fileStars = 0 note_page.fileStars = 0
var tagString = "" var tagString = ""
for (var j = 0; j < data.tags.length; j++) { for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) {
if (j != 0) if (j != 0)
tagString = tagString + "," tagString = tagString + ","
tagString = tagString + data.tags[j].name tagString = tagString + file.knowledgeFileAttribute.tags[j].name
} }
note_page.fileTags = tagString note_page.fileTags = tagString
likeCount = data.likers.length
isLike = false
for (var j = 0; j < data.likers.length; j++) {
if (data.likers[j].id === UserData.userId) {
isLike = true
break
}
}
favoriteCount = data.starrers.length
isLike = false
for (var j = 0; j < data.starrers.length; j++) {
if (data.starrers[j].id === UserData.userId) {
isFavorite = true
break
}
}
}) })
} }
@ -121,17 +103,6 @@ FluArea {
bold: true bold: true
} }
} }
FluIconButton {
id: button_edit_note
iconSize: FluentIcons.Edit
visible: authorId === UserData.userId
onClicked: {
emit: SignalFileOperation.modifyNote(note_page.fileId,
note_page.fileType,
note_page.fileTitle,
noteFileId)
}
}
ColumnLayout { ColumnLayout {
id: layout_share id: layout_share
FluIconButton { FluIconButton {
@ -158,12 +129,6 @@ FluArea {
id: button_favorite id: button_favorite
iconSize: 15 iconSize: 15
iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar iconSource: note_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
onClicked: {
note_page.isFavorite = !note_page.isFavorite
Request.put("/note/" + noteFileId + "/star", {
"active": note_page.isFavorite
})
}
} }
FluText { FluText {
id: text_favorite id: text_favorite
@ -183,12 +148,6 @@ FluArea {
id: button_like id: button_like
iconSize: 15 iconSize: 15
iconSource: note_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart iconSource: note_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart
onClicked: {
note_page.isLike = !note_page.isLike
Request.put("/note/" + noteFileId + "/like", {
"active": note_page.isLike
})
}
} }
FluText { FluText {
id: text_like id: text_like
@ -256,7 +215,7 @@ FluArea {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onDoubleClicked: { onDoubleClicked: {
emit: SignalFileOperation.open(note_page.fileId) emit: SignalFileOperation.open(note_page.uuid)
} }
} }
RowLayout { RowLayout {