Compare commits

..

No commits in common. "f85d98082ef9af2e211618e2af02726c519406f1" and "eadca3e91ffdb0f38cde2eb62c6ba7f47daa79a2" have entirely different histories.

3 changed files with 65 additions and 49 deletions

View File

@ -54,6 +54,12 @@ FluWindow {
} }
} }
StackView {
id: stack_view
Layout.fillHeight: true
Layout.fillWidth: true
}
ContentPage { ContentPage {
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -9,7 +9,6 @@ import AicsKB.FileTransferManager
import SignalFileOperation 1.0 import SignalFileOperation 1.0
import "qrc:///AicsKnowledgeBase/qml/page" import "qrc:///AicsKnowledgeBase/qml/page"
import "qrc:///AicsKnowledgeBase/qml/component" import "qrc:///AicsKnowledgeBase/qml/component"
import "qrc:///AicsKnowledgeBase/qml/global"
FluArea { FluArea {
Popup { Popup {
@ -56,7 +55,6 @@ FluArea {
target: SignalFileOperation target: SignalFileOperation
function onOpen(file) { function onOpen(file) {
content_area.visible = true content_area.visible = true
content_page.loadFile(file)
} }
} }
@ -68,59 +66,27 @@ FluArea {
rightPadding: 10 rightPadding: 10
bottomPadding: 0 bottomPadding: 0
property string fileId property int likeCount: 0
property int favoriteCount: 0 property int favoriteCount: 0
property int shareCount: 0 property int shareCount: 0
property int browsCount: 555 property int browsCount: 555
property bool isLike: false
property bool isFavorite: false property bool isFavorite: false
property bool isDownload: false property bool isDownload: false
property double fileSize: 455 property double fileSize: 455
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 date publishTime: new Date()
property string brief: "这是一个简介" property string brief: "这是一个简介"
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 loadFile(knowledgeFileId) {
content_area.knowledgeFileId = knowledgeFileId
console.log(knowledgeFileId)
Request.get("knowledge/" + knowledgeFileId, function (response, data) {
content_page.publishTime = data.createTime
content_page.title = data.name
content_page.fileId = data.knowledgeFileAttribute.id
content_area.type = data.knowledgeFileAttribute.suffix
var tagString = ""
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
if (j != 0)
tagString = tagString + ","
tagString = tagString + data.knowledgeFileAttribute.tags[j].name
}
content_page.tags = tagString.split(",")
content_page.brief = data.knowledgeFileAttribute.brief
content_page.browsCount = data.knowledgeFileAttribute.pageView
var starers = data.knowledgeFileAttribute.starers
for(var i=0; i<starers.length; i++) {
}
content_page.favoriteCount = starers.length
})
}
Component.onCompleted: { Component.onCompleted: {
console.log(content_area.type)
if (content_area.type == "video") {
content_view.sourceComponent = video_view
} else if (content_area.type == "md") {
content_view.sourceComponent = text_view
} else {
content_view.sourceComponent = other_view
}
} }
Item { Item {
@ -130,7 +96,7 @@ FluArea {
FluText { FluText {
id: text_title id: text_title
padding: 10 padding: 10
text: content_page.title text: "文章标题"
font { font {
pointSize: 15 pointSize: 15
bold: true bold: true
@ -197,13 +163,32 @@ FluArea {
right: layout_share.left right: layout_share.left
} }
} }
ColumnLayout {
id: layout_like
FluIconButton {
id: button_like
iconSize: 15
iconSource: content_page.isLike ? FluentIcons.HeartFill : FluentIcons.Heart
}
FluText {
id: text_like
text: content_page.favoriteCount
font.pointSize: 8
Layout.alignment: button_like.Center
Layout.topMargin: -5
}
anchors {
verticalCenter: text_title.verticalCenter
right: layout_favorite.left
}
}
FluIconButton { FluIconButton {
id: button_download id: button_download
iconSize: 25 iconSize: 25
iconSource: content_page.isDownload ? FluentIcons.OEM : FluentIcons.Download iconSource: content_page.isDownload ? FluentIcons.OEM : FluentIcons.Download
anchors { anchors {
verticalCenter: text_title.verticalCenter verticalCenter: text_title.verticalCenter
right: layout_favorite.left right: layout_like.left
rightMargin: 20 rightMargin: 20
} }
onClicked: { onClicked: {
@ -221,7 +206,7 @@ FluArea {
width: parent.width width: parent.width
FluText { FluText {
padding: 10 padding: 10
text: content_page.publishTime text: content_page.publishTime.toDateString()
} }
FluText { FluText {
padding: 10 padding: 10
@ -293,5 +278,29 @@ FluArea {
url: "https://www.baidu.com" url: "https://www.baidu.com"
} }
} }
// Item {
// Layout.fillWidth: true
// implicitHeight: 50
// FluText {
// id: text_note
// text: ""
// padding: 10
// font {
// pointSize: 15
// bold: true
// }
// }
// FluTextButton {
// id: button_publish
// text: ""
// hoverColor: "blue"
// normalColor: "black"
// anchors {
// verticalCenter: text_note.verticalCenter
// right: parent.right
// }
// }
// }
} }
} }

View File

@ -15,9 +15,10 @@ FluArea {
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
visible: false visible: false
property string type: "" property string type: ""
property string noteId property string knowledgeFileId
property string isFile: false property string isFile: false
property string knowledgeUrl : "aics/main/knowledge/" property string knowledgeUrl : "aics/main/knowledge/"
signal download(string knowledgeFileId)
signal clickTags(string tagName) signal clickTags(string tagName)
// paddings: { // paddings: {