Compare commits

..

No commits in common. "f32bcae463a0b4aaf1b0eed29afed001be38e530" and "a65e4af382710e71b4e10acd807cf4397601cf40" have entirely different histories.

5 changed files with 69 additions and 96 deletions

View File

@ -95,6 +95,7 @@ FluWindow {
duration: 200 duration: 200
} }
} }
initialItem: note_view
} }
Connections { Connections {
@ -107,8 +108,6 @@ FluWindow {
}) })
} }
function onOpenNote(note, authorId) { function onOpenNote(note, authorId) {
console.log(note)
console.log(authorId)
stack_view.push(note_view, { stack_view.push(note_view, {
"noteFileId": note, "noteFileId": note,
"authorId": authorId "authorId": authorId
@ -119,9 +118,6 @@ FluWindow {
stack_view.pop() stack_view.pop()
} }
function onCreateNote(file, fileType, fileTitle) { function onCreateNote(file, fileType, fileTitle) {
console.log(file)
console.log(fileType)
console.log(fileTitle)
stack_view.push(create_note_view, { stack_view.push(create_note_view, {
"knowledgeFileId": file, "knowledgeFileId": file,
"fileType": fileType, "fileType": fileType,
@ -133,7 +129,7 @@ FluWindow {
"knowledgeFileId": file, "knowledgeFileId": file,
"fileType": fileType, "fileType": fileType,
"fileTitle": fileTitle, "fileTitle": fileTitle,
"noteFileId": note, "noteId": note,
"isModifying": true "isModifying": true
}) })
} }

View File

@ -263,9 +263,10 @@ FluArea {
content_page.isFavorite = !content_page.isFavorite content_page.isFavorite = !content_page.isFavorite
console.log(content_page.isFavorite) console.log(content_page.isFavorite)
content_page.favoriteCount += (content_page.isFavorite ? 1 : -1) content_page.favoriteCount += (content_page.isFavorite ? 1 : -1)
Request.put("knowledge/" + knowledgeFileId + "/star", { Request.put("knowledge/" + knowledgeFileId + "/star",
"active": content_page.isFavorite JSON.stringify({
}, response => { "active": content_page.isFavorite
}), response => {
console.log(response) console.log(response)
}, response => { }, response => {
console.log(response) console.log(response)

View File

@ -30,8 +30,10 @@ FluArea {
if (isModifying) { if (isModifying) {
Request.getSearch("/search/note/" + noteFileId + "/content", Request.getSearch("/search/note/" + noteFileId + "/content",
function (response, data) { function (response, data) {
input_title.text = data.title noteTitle = data.title
input_md.contentMd = data.content noteContent = data.content
input_title.text = noteTitle
input_md.contentMd = noteContent
tags = data.tags tags = data.tags
}) })
} }
@ -92,24 +94,22 @@ FluArea {
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: 50 implicitHeight: 50
FluText { RowLayout {
id: text_title Layout.fillWidth: true
padding: 10 FluText {
text: "标题" padding: 10
font { text: "标题"
pointSize: 15 font {
bold: true pointSize: 15
bold: true
}
} }
} FluTextBox {
FluTextBox { id: input_title
id: input_title padding: 10
padding: 10 placeholderText: "单行输入框"
placeholderText: "单行输入框" implicitWidth: parent.width
implicitWidth: parent.width font.pointSize: 12
font.pointSize: 12
anchors {
left: text_title.right
verticalCenter: text_title.verticalCenter
} }
} }
} }

View File

@ -180,6 +180,7 @@ FluArea {
id: textArea_edit id: textArea_edit
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
background: Rectangle { background: Rectangle {
color: customTextArea.focus ? "#E0E0E0" : "white"
border.color: FluColors.Grey30 border.color: FluColors.Grey30
radius: 10 radius: 10
} }
@ -196,6 +197,7 @@ FluArea {
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
textFormat: TextEdit.MarkdownText textFormat: TextEdit.MarkdownText
background: Rectangle { background: Rectangle {
color: customTextArea.focus ? "#E0E0E0" : "white"
border.color: FluColors.Grey30 border.color: FluColors.Grey30
radius: 10 radius: 10
} }

View File

@ -21,67 +21,6 @@ FluArea {
property string authorId property string authorId
signal clickTags(string tagName) signal clickTags(string tagName)
function getType(suffix) {
if (suffix === "md")
return "MD"
else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb"
|| suffix === "rm" || suffix === "wmv" || suffix === "mkv")
return "VIDEO"
else
return "OTHER"
}
function loadNote() {
console.log(noteFileId)
Request.get("note/" + noteFileId, function (response) {
var data = JSON.parse(response)
console.log(response)
note_page.fileId = data.id
note_page.fileTitle = data.knowledgeFiles[0].knowledge.name
note_page.fileType = getType(data.knowledgeFiles[0].suffix)
note_page.favoriteCount = 0
note_page.title = data.title
note_page.publishTime = data.createTime
note_page.browsCount = data.pageView
var tagString = ""
for (var j = 0; j < data.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + data.tags[j].name
}
note_page.tags = tagString.split(",")
note_page.likeCount = data.likers.length
note_page.isLike = false
for (var j = 0; j < data.likers.length; j++) {
if (data.likers[j].id === UserData.userId) {
isLike = true
break
}
}
note_page.favoriteCount = data.starers.length
note_page.isFavorite = false
for (var j = 0; j < data.starers.length; j++) {
if (data.starers[j].id === UserData.userId) {
isFavorite = true
break
}
}
Request.getSearch("search/note/" + noteFileId + "/content",
response => {
text_view.contentMd = response
note_page.brief = response
})
})
}
Component.onCompleted: {
loadNote()
}
// paddings: { // paddings: {
// top: 10 // top: 10
// right: 0 // right: 0
@ -103,7 +42,7 @@ FluArea {
property int browsCount: 555 property int browsCount: 555
property bool isLike: false property bool isLike: false
property bool isFavorite: false property bool isFavorite: false
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: "2020-01-01" property string publishTime: "2020-01-01"
property string brief: "这是一个简介" property string brief: "这是一个简介"
@ -125,6 +64,41 @@ FluArea {
note_area.noteFileId = noteFileId note_area.noteFileId = noteFileId
} }
Component.onCompleted: {
Request.getSearch("note/" + noteFileId, function (response, data) {
note_page.fileId = data.id
note_page.fileTitle = data.name
note_page.fileType = getType(data.knowledgeFileAttribute.suffix)
note_page.fileStars = 0
var tagString = ""
for (var j = 0; j < data.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + data.tags[j].name
}
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
}
}
})
}
FluIconButton { FluIconButton {
iconSize: 12 iconSize: 12
iconSource: FluentIcons.Back iconSource: FluentIcons.Back
@ -149,18 +123,14 @@ FluArea {
} }
FluIconButton { FluIconButton {
id: button_edit_note id: button_edit_note
iconSource: FluentIcons.Edit iconSize: FluentIcons.Edit
visible: note_area.authorId.toString() == UserData.userId visible: authorId === UserData.userId
onClicked: { onClicked: {
emit: SignalFileOperation.modifyNote(note_page.fileId, emit: SignalFileOperation.modifyNote(note_page.fileId,
note_page.fileType, note_page.fileType,
note_page.fileTitle, note_page.fileTitle,
noteFileId) noteFileId)
} }
anchors {
left: text_title.right
verticalCenter: text_title.verticalCenter
}
} }
ColumnLayout { ColumnLayout {
id: layout_share id: layout_share
@ -246,6 +216,10 @@ FluArea {
padding: 10 padding: 10
text: note_page.publishTime.substring(0, 10) text: note_page.publishTime.substring(0, 10)
} }
FluText {
padding: 10
text: note_page.fileSize.toString() + "MB"
}
FluText { FluText {
padding: 10 padding: 10
text: note_page.browsCount.toString() + "浏览量" text: note_page.browsCount.toString() + "浏览量"