详情界面后端接入
parent
d18183e835
commit
3de9f712ee
|
@ -54,12 +54,6 @@ FluWindow {
|
|||
}
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: stack_view
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
}
|
||||
|
||||
ContentPage {
|
||||
Layout.fillHeight: true
|
||||
|
|
|
@ -9,6 +9,7 @@ import AicsKB.FileTransferManager
|
|||
import SignalFileOperation 1.0
|
||||
import "qrc:///AicsKnowledgeBase/qml/page"
|
||||
import "qrc:///AicsKnowledgeBase/qml/component"
|
||||
import "qrc:///AicsKnowledgeBase/qml/global"
|
||||
|
||||
FluArea {
|
||||
Popup {
|
||||
|
@ -55,6 +56,7 @@ FluArea {
|
|||
target: SignalFileOperation
|
||||
function onOpen(file) {
|
||||
content_area.visible = true
|
||||
content_page.loadFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,27 +68,59 @@ FluArea {
|
|||
rightPadding: 10
|
||||
bottomPadding: 0
|
||||
|
||||
property int likeCount: 0
|
||||
property string fileId
|
||||
property int favoriteCount: 0
|
||||
property int shareCount: 0
|
||||
property int browsCount: 555
|
||||
property bool isLike: false
|
||||
property bool isFavorite: false
|
||||
property bool isDownload: false
|
||||
property double fileSize: 455
|
||||
property string title: "文章标题"
|
||||
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
|
||||
property date publishTime: new Date()
|
||||
property string publishTime: "2020-01-01"
|
||||
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: {
|
||||
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 {
|
||||
|
@ -96,7 +130,7 @@ FluArea {
|
|||
FluText {
|
||||
id: text_title
|
||||
padding: 10
|
||||
text: "文章标题"
|
||||
text: content_page.title
|
||||
font {
|
||||
pointSize: 15
|
||||
bold: true
|
||||
|
@ -163,32 +197,13 @@ FluArea {
|
|||
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 {
|
||||
id: button_download
|
||||
iconSize: 25
|
||||
iconSource: content_page.isDownload ? FluentIcons.OEM : FluentIcons.Download
|
||||
anchors {
|
||||
verticalCenter: text_title.verticalCenter
|
||||
right: layout_like.left
|
||||
right: layout_favorite.left
|
||||
rightMargin: 20
|
||||
}
|
||||
onClicked: {
|
||||
|
@ -208,7 +223,7 @@ FluArea {
|
|||
width: parent.width
|
||||
FluText {
|
||||
padding: 10
|
||||
text: content_page.publishTime.toDateString()
|
||||
text: content_page.publishTime
|
||||
}
|
||||
FluText {
|
||||
padding: 10
|
||||
|
@ -280,29 +295,5 @@ FluArea {
|
|||
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
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,9 @@ FluArea {
|
|||
backgroundColor: "#f9f9f9"
|
||||
visible: false
|
||||
property string type: ""
|
||||
property string knowledgeFileId
|
||||
property string noteId
|
||||
property string isFile: false
|
||||
property string knowledgeUrl : "aics/main/knowledge/"
|
||||
signal download(string knowledgeFileId)
|
||||
signal clickTags(string tagName)
|
||||
|
||||
// paddings: {
|
||||
|
|
Loading…
Reference in New Issue