Compare commits

..

2 Commits

3 changed files with 49 additions and 65 deletions

View File

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

View File

@ -9,6 +9,7 @@ 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 {
@ -55,6 +56,7 @@ FluArea {
target: SignalFileOperation target: SignalFileOperation
function onOpen(file) { function onOpen(file) {
content_area.visible = true content_area.visible = true
content_page.loadFile(file)
} }
} }
@ -66,27 +68,59 @@ FluArea {
rightPadding: 10 rightPadding: 10
bottomPadding: 0 bottomPadding: 0
property int likeCount: 0 property string fileId
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 date publishTime: new Date() property string publishTime: "2020-01-01"
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 {
@ -96,7 +130,7 @@ FluArea {
FluText { FluText {
id: text_title id: text_title
padding: 10 padding: 10
text: "文章标题" text: content_page.title
font { font {
pointSize: 15 pointSize: 15
bold: true bold: true
@ -163,32 +197,13 @@ 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_like.left right: layout_favorite.left
rightMargin: 20 rightMargin: 20
} }
onClicked: { onClicked: {
@ -206,7 +221,7 @@ FluArea {
width: parent.width width: parent.width
FluText { FluText {
padding: 10 padding: 10
text: content_page.publishTime.toDateString() text: content_page.publishTime
} }
FluText { FluText {
padding: 10 padding: 10
@ -278,29 +293,5 @@ 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,10 +15,9 @@ FluArea {
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
visible: false visible: false
property string type: "" property string type: ""
property string knowledgeFileId property string noteId
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: {