Compare commits

..

2 Commits

5 changed files with 96 additions and 69 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,67 @@ FluArea {
property string authorId
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: {
// top: 10
// right: 0
@ -42,7 +103,7 @@ FluArea {
property int browsCount: 555
property bool isLike: false
property bool isFavorite: false
property string title: "文章标题"
property string title
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
property string publishTime: "2020-01-01"
property string brief: "这是一个简介"
@ -64,41 +125,6 @@ FluArea {
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 {
iconSize: 12
iconSource: FluentIcons.Back
@ -123,14 +149,18 @@ FluArea {
}
FluIconButton {
id: button_edit_note
iconSize: FluentIcons.Edit
visible: authorId === UserData.userId
iconSource: FluentIcons.Edit
visible: note_area.authorId.toString() == UserData.userId
onClicked: {
emit: SignalFileOperation.modifyNote(note_page.fileId,
note_page.fileType,
note_page.fileTitle,
noteFileId)
}
anchors {
left: text_title.right
verticalCenter: text_title.verticalCenter
}
}
ColumnLayout {
id: layout_share
@ -216,10 +246,6 @@ FluArea {
padding: 10
text: note_page.publishTime.substring(0, 10)
}
FluText {
padding: 10
text: note_page.fileSize.toString() + "MB"
}
FluText {
padding: 10
text: note_page.browsCount.toString() + "浏览量"