From 36250d9615c1c37136843002130d15102fd29f95 Mon Sep 17 00:00:00 2001 From: wuyize Date: Thu, 6 Jul 2023 19:43:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/global/UserData.qml | 8 ++ AicsKnowledgeBase/qml/global/qmldir | 3 +- AicsKnowledgeBase/qml/page/ContentPage.qml | 102 ++++++++++-------- AicsKnowledgeBase/qml/page/CreateNotePage.qml | 10 ++ AicsKnowledgeBase/src/FileTransferManager.cpp | 2 - 5 files changed, 75 insertions(+), 50 deletions(-) create mode 100644 AicsKnowledgeBase/qml/global/UserData.qml create mode 100644 AicsKnowledgeBase/qml/page/CreateNotePage.qml diff --git a/AicsKnowledgeBase/qml/global/UserData.qml b/AicsKnowledgeBase/qml/global/UserData.qml new file mode 100644 index 0000000..771ac90 --- /dev/null +++ b/AicsKnowledgeBase/qml/global/UserData.qml @@ -0,0 +1,8 @@ +pragma Singleton + +import QtQuick + +QtObject { + property string username + property string userId +} diff --git a/AicsKnowledgeBase/qml/global/qmldir b/AicsKnowledgeBase/qml/global/qmldir index b7fda2e..37230fd 100644 --- a/AicsKnowledgeBase/qml/global/qmldir +++ b/AicsKnowledgeBase/qml/global/qmldir @@ -1,3 +1,4 @@ singleton NavItems 1.0 NavItems.qml singleton FooterItems 1.0 FooterItems.qml -singleton Request 1.0 Request.qml \ No newline at end of file +singleton Request 1.0 Request.qml +singleton UserData 1.0 UserData.qml \ No newline at end of file diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index cc29e35..0ad56ed 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -29,7 +29,7 @@ FluArea { NoteList { id: noteList onOpen: function handle(noteId) { - console.log("open note: " + noteId) + emit: SignalFileOperation.openNote(noteId) } onCreateNote: function handle() { console.log("create note") @@ -40,10 +40,10 @@ FluArea { id: content_area paddings: 0 backgroundColor: "#f9f9f9" -// visible: false + // visible: false property string type: "" property string knowledgeFileId - signal back() + signal back signal download(string knowledgeFileId) signal clickTags(string tagName) @@ -53,7 +53,6 @@ FluArea { // bottom: 10 // left: 10 // } - FluScrollablePage { id: content_page anchors.fill: parent @@ -107,11 +106,23 @@ FluArea { 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++) { + // var starers = data.knowledgeFileAttribute.starers + // for (var i = 0; i < starers.length; i++) { + // } + // content_page.favoriteCount = starers.length + if (content_area.type === "MD") { + + } else if (content_area.type === "VIDEO") { + + } else { + Request.get("knowledge/" + knowledgeFileId + "/preview/external", + function (res) { + content_view.push(other_view, { + "url": res + }) + }) } - content_page.favoriteCount = starers.length }) } @@ -129,7 +140,6 @@ FluArea { Layout.margins: -5 } - Item { Layout.fillWidth: true implicitHeight: 50 @@ -268,47 +278,45 @@ FluArea { } } - WebEngineView { + // WebEngineView { + // Layout.fillWidth: true + // backgroundColor: "transparent" + // implicitHeight: 200 + // settings.javascriptEnabled: true + // settings.pluginsEnabled: true + // url: "https://www.baidu.com" + // } + StackView { + id: content_view Layout.fillWidth: true - backgroundColor: "transparent" - implicitHeight: 200 - settings.javascriptEnabled: true - settings.pluginsEnabled: true - url: "https://www.baidu.com" + implicitHeight: 400 } -// StackView { -// id: content_view -// Layout.fillWidth: true -// implicitHeight: 400 -// initialItem: other_view -// } - -// Component { -// id: video_view -// FluMediaPlayer { -// width: parent.width -// implicitHeight: width * 9 / 16. -// } -// } -// Component { -// id: text_view -// NoteEditPage { -// noteId: "255454" -// width: parent.width -// implicitHeight: 400 -// } -// } -// Component { -// id: other_view -// WebEngineView { -// width: parent.width -// backgroundColor: "transparent" -// implicitHeight: 200 -// settings.javascriptEnabled: true -// settings.pluginsEnabled: true -// url: "https://www.baidu.com" -// } -// } + Component { + id: video_view + FluMediaPlayer { + width: parent.width + implicitHeight: width * 9 / 16. + } + } + Component { + id: text_view + NoteEditPage { + noteId: "255454" + width: parent.width + implicitHeight: 400 + } + } + Component { + id: other_view + WebEngineView { + width: parent.width + backgroundColor: "transparent" + implicitHeight: 200 + settings.javascriptEnabled: true + settings.pluginsEnabled: true + url: "https://www.baidu.com" + } + } } } diff --git a/AicsKnowledgeBase/qml/page/CreateNotePage.qml b/AicsKnowledgeBase/qml/page/CreateNotePage.qml new file mode 100644 index 0000000..a6583fe --- /dev/null +++ b/AicsKnowledgeBase/qml/page/CreateNotePage.qml @@ -0,0 +1,10 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Controls.Basic +import QtWebEngine 1.2 +import FluentUI +import AicsKB.FileTransferManager +import SignalFileOperation 1.0 + diff --git a/AicsKnowledgeBase/src/FileTransferManager.cpp b/AicsKnowledgeBase/src/FileTransferManager.cpp index 9e1ed6d..9720d88 100644 --- a/AicsKnowledgeBase/src/FileTransferManager.cpp +++ b/AicsKnowledgeBase/src/FileTransferManager.cpp @@ -361,8 +361,6 @@ void FileTransferManager::download(const QString &fileId, const QString &fileNam auto res = httpDownload(fileUrl, savePath, item); qDebug() << "End Get" << res; }); - - } void FileTransferManager::pause(const QString &fileId)