diff --git a/AicsKnowledgeBase/qml/MainWindow.qml b/AicsKnowledgeBase/qml/MainWindow.qml index 7e1eb3c..4146215 100644 --- a/AicsKnowledgeBase/qml/MainWindow.qml +++ b/AicsKnowledgeBase/qml/MainWindow.qml @@ -54,12 +54,6 @@ FluWindow { } } - StackView { - id: stack_view - Layout.fillHeight: true - Layout.fillWidth: true - - } ContentPage { Layout.fillHeight: true diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index fccba38..8fda1f2 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -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 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