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
}
}
initialItem: note_view
}
Connections {
@ -107,8 +108,6 @@ FluWindow {
})
}
function onOpenNote(note, authorId) {
console.log(note)
console.log(authorId)
stack_view.push(note_view, {
"noteFileId": note,
"authorId": authorId
@ -119,9 +118,6 @@ 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,
@ -133,7 +129,7 @@ FluWindow {
"knowledgeFileId": file,
"fileType": fileType,
"fileTitle": fileTitle,
"noteFileId": note,
"noteId": note,
"isModifying": true
})
}

View File

@ -263,9 +263,10 @@ 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", {
"active": content_page.isFavorite
}, response => {
Request.put("knowledge/" + knowledgeFileId + "/star",
JSON.stringify({
"active": content_page.isFavorite
}), response => {
console.log(response)
}, response => {
console.log(response)

View File

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

View File

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

View File

@ -21,67 +21,6 @@ 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
@ -103,7 +42,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: "这是一个简介"
@ -125,6 +64,41 @@ 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
@ -149,18 +123,14 @@ FluArea {
}
FluIconButton {
id: button_edit_note
iconSource: FluentIcons.Edit
visible: note_area.authorId.toString() == UserData.userId
iconSize: FluentIcons.Edit
visible: authorId === 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
@ -246,6 +216,10 @@ 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() + "浏览量"