From d27ed8ede04c85281682a53c3fdaae2e5817f3b1 Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Fri, 7 Jul 2023 00:24:17 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qml/component/FileListItem.qml | 15 +- AicsKnowledgeBase/qml/page/AudioPage.qml | 75 ++++++++- AicsKnowledgeBase/qml/page/DocumentPage.qml | 74 +++++++++ AicsKnowledgeBase/qml/page/NotePage.qml | 37 ----- AicsKnowledgeBase/qml/page/SearchPage.qml | 154 +++++++++++------- AicsKnowledgeBase/qml/page/VideoPage.qml | 74 +++++++++ 6 files changed, 329 insertions(+), 100 deletions(-) diff --git a/AicsKnowledgeBase/qml/component/FileListItem.qml b/AicsKnowledgeBase/qml/component/FileListItem.qml index f8e89ce..68c7053 100644 --- a/AicsKnowledgeBase/qml/component/FileListItem.qml +++ b/AicsKnowledgeBase/qml/component/FileListItem.qml @@ -37,12 +37,15 @@ FluArea { message: fileItem.title onPositiveClicked: text => { var param = { - "name": text, - "parentId": fuuid + "parentId": fileItem.fuuid, + "name": text } - Request.post("/knowledge", - JSON.stringify(param)) - refresh() + console.log(JSON.stringify(param)) + Request.put( + "/knowledge/" + fileItem.uuid, + JSON.stringify(param), () => { + refresh() + }) } } } @@ -63,6 +66,7 @@ FluArea { "parentId": uuid, "name": fileItem.title } + console.log(JSON.stringify(param)) Request.put( "/knowledge/" + fileItem.uuid, JSON.stringify(param), () => { @@ -114,6 +118,7 @@ FluArea { font.bold: true font.pointSize: 12 text: fileItem.title + textFormat: Text.RichText } } diff --git a/AicsKnowledgeBase/qml/page/AudioPage.qml b/AicsKnowledgeBase/qml/page/AudioPage.qml index b58495f..91b533c 100644 --- a/AicsKnowledgeBase/qml/page/AudioPage.qml +++ b/AicsKnowledgeBase/qml/page/AudioPage.qml @@ -4,18 +4,91 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import FluentUI +import "qrc:///AicsKnowledgeBase/qml/component" +import "qrc:///AicsKnowledgeBase/qml/global" FluArea { property string url: '' backgroundColor: "#f9f9f9" - Layout.fillWidth: true Layout.fillHeight: true paddings: 10 Layout.topMargin: 20 FluText { + id: title Layout.topMargin: 20 text: "Audio" } + FileList { + anchors.top: title.bottom + disableHeader: true + width: parent.width + dataModel: listModel + } + ListModel { + id: listModel + } + Component.onCompleted: { + Request.get("/knowledge?type=AUDIO", response => { + var files = JSON.parse(response) + listModel.clear() + for (var i = 0; i < files.length; i++) { + var file = files[i] + console.log(file.name) + var modelItem = { + "title": file.name, + "uuid": file.id, + "date"// cut time after 'T' + : file.createTime.substring(0, 10), + "fuuid": "0" + } + if (file.knowledgeFileAttribute === null) { + modelItem.type = "folder" + modelItem.isDir = true + modelItem.size = 0 + } else { + modelItem.isDir = false + modelItem.type = getType( + file.knowledgeFileAttribute.suffix) + modelItem.size = file.knowledgeFileAttribute.size + modelItem.brief = file.knowledgeFileAttribute.brief + modelItem.pageView = file.knowledgeFileAttribute.pageView + modelItem.stars = 0 + var tagString = "" + for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) { + if (j != 0) + tagString = tagString + "," + tagString = tagString + file.knowledgeFileAttribute.tags[j].name + } + modelItem.tags = tagString + } + listModel.append(modelItem) + } + }) + } + function getType(suffix) { + if (suffix === "ppt" || suffix === "pptx") + return "PPT" + else if (suffix === "doc" || suffix === "docx") + return "WORD" + else if (suffix === "pdf") + return "PDF" + else if (suffix === "txt") + return "TXT" + else if (suffix === "xls" || suffix === "xlsx") + return "EXCEL" + else if (suffix === "zip" || suffix === "rar") + return "ZIP" + else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg" + || suffix === "gif") + return "IMAGE" + else if (suffix === "mp3" || suffix === "wav") + return "AUDIO" + else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb" + || suffix === "rm" || suffix === "wmv" || suffix === "mkv") + return "VIDEO" + else + return "OTHER" + } } diff --git a/AicsKnowledgeBase/qml/page/DocumentPage.qml b/AicsKnowledgeBase/qml/page/DocumentPage.qml index b4939f9..929b5eb 100644 --- a/AicsKnowledgeBase/qml/page/DocumentPage.qml +++ b/AicsKnowledgeBase/qml/page/DocumentPage.qml @@ -4,6 +4,8 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import FluentUI +import "qrc:///AicsKnowledgeBase/qml/component" +import "qrc:///AicsKnowledgeBase/qml/global" FluArea { property string url: '' @@ -14,7 +16,79 @@ FluArea { Layout.topMargin: 20 FluText { + id: title Layout.topMargin: 20 text: "Document" } + FileList { + anchors.top: title.bottom + disableHeader: true + width: parent.width + dataModel: listModel + } + ListModel { + id: listModel + } + Component.onCompleted: { + Request.get("/knowledge?type=DOCUMENT", response => { + var files = JSON.parse(response) + listModel.clear() + for (var i = 0; i < files.length; i++) { + var file = files[i] + console.log(file.name) + var modelItem = { + "title": file.name, + "uuid": file.id, + "date"// cut time after 'T' + : file.createTime.substring(0, 10), + "fuuid": "0" + } + if (file.knowledgeFileAttribute === null) { + modelItem.type = "folder" + modelItem.isDir = true + modelItem.size = 0 + } else { + modelItem.isDir = false + modelItem.type = getType( + file.knowledgeFileAttribute.suffix) + modelItem.size = file.knowledgeFileAttribute.size + modelItem.brief = file.knowledgeFileAttribute.brief + modelItem.pageView = file.knowledgeFileAttribute.pageView + modelItem.stars = 0 + var tagString = "" + for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) { + if (j != 0) + tagString = tagString + "," + tagString = tagString + file.knowledgeFileAttribute.tags[j].name + } + modelItem.tags = tagString + } + listModel.append(modelItem) + } + }) + } + function getType(suffix) { + if (suffix === "ppt" || suffix === "pptx") + return "PPT" + else if (suffix === "doc" || suffix === "docx") + return "WORD" + else if (suffix === "pdf") + return "PDF" + else if (suffix === "txt") + return "TXT" + else if (suffix === "xls" || suffix === "xlsx") + return "EXCEL" + else if (suffix === "zip" || suffix === "rar") + return "ZIP" + else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg" + || suffix === "gif") + return "IMAGE" + else if (suffix === "mp3" || suffix === "wav") + return "AUDIO" + else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb" + || suffix === "rm" || suffix === "wmv" || suffix === "mkv") + return "VIDEO" + else + return "OTHER" + } } diff --git a/AicsKnowledgeBase/qml/page/NotePage.qml b/AicsKnowledgeBase/qml/page/NotePage.qml index 2540182..d2fe8c5 100644 --- a/AicsKnowledgeBase/qml/page/NotePage.qml +++ b/AicsKnowledgeBase/qml/page/NotePage.qml @@ -46,7 +46,6 @@ FluArea { property list tags: ["tag 1", "tag 2", "tag 3"] property string publishTime: "2020-01-01" property string brief: "这是一个简介" - property var fromFile function getType(suffix) { if (suffix === "md") @@ -63,29 +62,7 @@ FluArea { } Component.onCompleted: { - Request.get("knowledge/", function (response, data) { - fromFile = { - "uuid": data.id, - "fuuid": data.knowledgeFileAttribute.id, - "title": data.name, - "date": data.createTime, - "brief": data.knowledgeFileAttribute.brief, - "suffix": data.knowledgeFileAttribute.suffix, - "type": getType(data.knowledgeFileAttribute.suffix), - "pageView": data.knowledgeFileAttribute.pageView, - "size": data.knowledgeFileAttribute.size - } - fromFile.stars = 0 - - var tagString = "" - for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) { - if (j != 0) - tagString = tagString + "," - tagString = tagString + file.knowledgeFileAttribute.tags[j].name - } - fromFile.tags = tagString - }) } FluIconButton { @@ -222,19 +199,5 @@ FluArea { width: parent.width implicitHeight: 400 } - // FistListItem { - // id: fileListItem - // uuid: fromFile.uuid - // fuuid: fromFile.fuuid - // title: fromFile.title - // date: fromFile.date - // brief: fromFile.brief - // type: fromFile.type - // pageView: fromFile.pageView - // size: fromFile.size - // stars: fromFile.stars - // tags: fromFile.tags === null || fromFile.tags === undefined - // || fromFile.tags === "" ? [] : fromFile.tags.split(",") - // } } } diff --git a/AicsKnowledgeBase/qml/page/SearchPage.qml b/AicsKnowledgeBase/qml/page/SearchPage.qml index 56cad27..773c728 100644 --- a/AicsKnowledgeBase/qml/page/SearchPage.qml +++ b/AicsKnowledgeBase/qml/page/SearchPage.qml @@ -8,6 +8,7 @@ import "qrc:///AicsKnowledgeBase/qml/global" import "qrc:///AicsKnowledgeBase/qml/component" FluArea { + id: searchPage property string url: '' backgroundColor: "#f9f9f9" Layout.fillHeight: true @@ -19,14 +20,17 @@ FluArea { // Layout.topMargin: 20 // text: "Search" // } + + /* 按标题,内容搜索 */ - ColumnLayout{ + ColumnLayout { width: parent.width - RowLayout{ - width:parent.width + RowLayout { + width: parent.width + // FluDropDownButton{ // id:select_model // Layout.alignment: Qt.AlignLeft @@ -52,105 +56,100 @@ FluArea { // } // ] // } - - FluTextBox{ - placeholderText:"对标题进行搜索……" + FluTextBox { + placeholderText: "对标题进行搜索……" Layout.fillWidth: true - } - FluIconButton{ + FluIconButton { Layout.alignment: Qt.AlignRight - iconSource:FluentIcons.Search - onClicked:{ + iconSource: FluentIcons.Search + onClicked: { var allTags = inputTags.getAllTags(tags.tagList) - var allTagId =[] + var allTagId = [] console.log(allTags) for (var i = 0; i < allTags.length; i++) { var url = "?name=" url = url + allTags[i] console.log(url) - Request.get(url, - function(result, data){ - allTagId.push() - } - - ) + Request.get(url, function (result, data) { + allTagId.push() + }) } } } - } - FluCheckBox{ - id:searchTitleAndContent - text:"同时搜索简介和内容" + FluCheckBox { + id: searchTitleAndContent + text: "同时搜索简介和内容" } //按文件类型 - RowLayout{ - id:selectFormat - width:parent.width - FluText{ + RowLayout { + id: selectFormat + width: parent.width + FluText { Layout.alignment: Qt.AlignLeft - text:"类型: " + text: "类型: " } - FluCheckBox{ - id:selectAllFormat - text:"all" - Component.onCompleted:{ + FluCheckBox { + id: selectAllFormat + text: "all" + Component.onCompleted: { clicked() } - onClicked:{ - selectVideo.checked=true - selectDoc.checked=true - selectAudio.checked=true + onClicked: { + selectVideo.checked = true + selectDoc.checked = true + selectAudio.checked = true } } - FluCheckBox{ - id:selectVideo - text:"Video" - onClicked:{ + FluCheckBox { + id: selectVideo + text: "Video" + onClicked: { selectFormat.setAllStatus() } } - FluCheckBox{ - id:selectDoc - text:"Doc" - onClicked:{ + FluCheckBox { + id: selectDoc + text: "Doc" + onClicked: { selectFormat.setAllStatus() } } - FluCheckBox{ - id:selectAudio - text:"Audio" - onClicked:{ + FluCheckBox { + id: selectAudio + text: "Audio" + onClicked: { selectFormat.setAllStatus() } } function setAllStatus() { - selectAllFormat.checked = selectVideo.checked && selectDoc.checked && selectAudio.checked + selectAllFormat.checked = selectVideo.checked + && selectDoc.checked && selectAudio.checked } } - RowLayout{ - id:inputTags - width:parent.width + RowLayout { + id: inputTags + width: parent.width height: 32 - FluText{ + FluText { Layout.alignment: Qt.AlignLeft - text:"标签: " + text: "标签: " } - Tag{ - id:tags + Tag { + id: tags width: 290 } - function getAllTags(tagList){ - var allTags=[]; + function getAllTags(tagList) { + var allTags = [] for (var i = 0; i < tagList.count; i++) { - var item = tagList.get(i); + var item = tagList.get(i) allTags.push(item.tag) } return allTags @@ -200,4 +199,45 @@ FluArea { } } } + function getKnowledgeDetail(uuid, title, brief, tags) { + var raw = Request.getAwait("/knowledget/" + uuid) + var data = JSON.parse(raw) + var item = { + "uuid": uuid, + "title": title, + "brief": brief, + "isDir": false, + "date": data.createTime, + "fuuid": data.parent.id, + "pageView": data.knowledgeFileAttribute.pageView, + "stars": data.knowledgeFileAttribute.stars, + "size": data.knowledgeFileAttribute.size, + "type": getType(data.knowledgeFileAttribute.suffix), + "tags": tags + } + } + function getType(suffix) { + if (suffix === "ppt" || suffix === "pptx") + return "PPT" + else if (suffix === "doc" || suffix === "docx") + return "WORD" + else if (suffix === "pdf") + return "PDF" + else if (suffix === "txt") + return "TXT" + else if (suffix === "xls" || suffix === "xlsx") + return "EXCEL" + else if (suffix === "zip" || suffix === "rar") + return "ZIP" + else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg" + || suffix === "gif") + return "IMAGE" + else if (suffix === "mp3" || suffix === "wav") + return "AUDIO" + else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb" + || suffix === "rm" || suffix === "wmv" || suffix === "mkv") + return "VIDEO" + else + return "OTHER" + } } diff --git a/AicsKnowledgeBase/qml/page/VideoPage.qml b/AicsKnowledgeBase/qml/page/VideoPage.qml index 52d56b9..ebb20fe 100644 --- a/AicsKnowledgeBase/qml/page/VideoPage.qml +++ b/AicsKnowledgeBase/qml/page/VideoPage.qml @@ -4,6 +4,8 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import FluentUI +import "qrc:///AicsKnowledgeBase/qml/component" +import "qrc:///AicsKnowledgeBase/qml/global" FluArea { property string url: '' @@ -14,7 +16,79 @@ FluArea { Layout.topMargin: 20 FluText { + id: title Layout.topMargin: 20 text: "Video" } + FileList { + anchors.top: title.bottom + disableHeader: true + width: parent.width + dataModel: listModel + } + ListModel { + id: listModel + } + Component.onCompleted: { + Request.get("/knowledge?type=VIDEO", response => { + var files = JSON.parse(response) + listModel.clear() + for (var i = 0; i < files.length; i++) { + var file = files[i] + console.log(file.name) + var modelItem = { + "title": file.name, + "uuid": file.id, + "date"// cut time after 'T' + : file.createTime.substring(0, 10), + "fuuid": "0" + } + if (file.knowledgeFileAttribute === null) { + modelItem.type = "folder" + modelItem.isDir = true + modelItem.size = 0 + } else { + modelItem.isDir = false + modelItem.type = getType( + file.knowledgeFileAttribute.suffix) + modelItem.size = file.knowledgeFileAttribute.size + modelItem.brief = file.knowledgeFileAttribute.brief + modelItem.pageView = file.knowledgeFileAttribute.pageView + modelItem.stars = 0 + var tagString = "" + for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) { + if (j != 0) + tagString = tagString + "," + tagString = tagString + file.knowledgeFileAttribute.tags[j].name + } + modelItem.tags = tagString + } + listModel.append(modelItem) + } + }) + } + function getType(suffix) { + if (suffix === "ppt" || suffix === "pptx") + return "PPT" + else if (suffix === "doc" || suffix === "docx") + return "WORD" + else if (suffix === "pdf") + return "PDF" + else if (suffix === "txt") + return "TXT" + else if (suffix === "xls" || suffix === "xlsx") + return "EXCEL" + else if (suffix === "zip" || suffix === "rar") + return "ZIP" + else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg" + || suffix === "gif") + return "IMAGE" + else if (suffix === "mp3" || suffix === "wav") + return "AUDIO" + else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb" + || suffix === "rm" || suffix === "wmv" || suffix === "mkv") + return "VIDEO" + else + return "OTHER" + } } From b9a89c8db755ab8e5eb9030c11dc62a72b12a4fe Mon Sep 17 00:00:00 2001 From: wuyize Date: Fri, 7 Jul 2023 00:48:58 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E3=80=81=E4=B8=8B=E8=BD=BD=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/MainWindow.qml | 1 + .../qml/component/TransferListPopup.qml | 96 ++++++++++++------ AicsKnowledgeBase/qml/global/UserData.qml | 2 + AicsKnowledgeBase/res/download.png | Bin 0 -> 3104 bytes AicsKnowledgeBase/res/upload.png | Bin 0 -> 3017 bytes .../src/FileTransferListModel.cpp | 2 + AicsKnowledgeBase/src/FileTransferManager.cpp | 14 +-- AicsKnowledgeBase/src/FileTransferManager.h | 1 + 8 files changed, 80 insertions(+), 36 deletions(-) create mode 100644 AicsKnowledgeBase/res/download.png create mode 100644 AicsKnowledgeBase/res/upload.png diff --git a/AicsKnowledgeBase/qml/MainWindow.qml b/AicsKnowledgeBase/qml/MainWindow.qml index be9e4dc..9763a23 100644 --- a/AicsKnowledgeBase/qml/MainWindow.qml +++ b/AicsKnowledgeBase/qml/MainWindow.qml @@ -102,6 +102,7 @@ FluWindow { target: SignalFileOperation function onOpen(file) { stack_view.clear() + UserData.viewHistory.push(file) stack_view.push(file_view, { "knowledgeFileId": file }) diff --git a/AicsKnowledgeBase/qml/component/TransferListPopup.qml b/AicsKnowledgeBase/qml/component/TransferListPopup.qml index 7c13c78..b5a990c 100644 --- a/AicsKnowledgeBase/qml/component/TransferListPopup.qml +++ b/AicsKnowledgeBase/qml/component/TransferListPopup.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts import Qt5Compat.GraphicalEffects import FluentUI import AicsKB.FileTransferManager +import "qrc:///AicsKnowledgeBase/qml/global" Popup { id: transfer_popup @@ -18,6 +19,15 @@ Popup { FluShadow {} } + Connections { + target: FileTransferManager + onTransferComplete: (download, fileId, fileName) => { + console.log("onTransferComplete") + UserData.downloadedFiles.push(fileId) + console.log(UserData.downloadedFiles) + } + } + contentItem: FluScrollablePage { anchors.fill: parent anchors.topMargin: 10 @@ -30,42 +40,65 @@ Popup { Layout.fillWidth: true height: 50 - ColumnLayout { + Item { anchors.fill: parent - anchors.margins: 5 - spacing: 2 - Text { - text: name + anchors.topMargin: 5 + anchors.bottomMargin: 5 + anchors.leftMargin: 0 + Image { + id: icon + anchors.verticalCenter: parent.verticalCenter + width: 32 + height: 32 + source: download ? "qrc:/AicsKnowledgeBase/res/download.png" : "qrc:/AicsKnowledgeBase/res/upload.png" } - FluProgressBar { - Layout.fillWidth: true - progress: completedSize / totalSize - indeterminate: false - } + ColumnLayout { + anchors.left: icon.right + anchors.right: parent.right + anchors.leftMargin: 5 + spacing: 2 + Text { + text: name + } + Text { + visible: completedSize >= totalSize + text: "已完成" + color: FluColors.Grey130 + } + FluProgressBar { + Layout.fillWidth: true + progress: completedSize / totalSize + indeterminate: false + visible: completedSize < totalSize + } - Text { - color: FluColors.Grey130 - text: formatSize(speed) + "/s - " + formatSize( - completedSize) + "/" + formatSize( - totalSize) + Text { + visible: completedSize < totalSize + color: FluColors.Grey130 + text: formatSize(speed) + "/s - " + formatSize( + completedSize) + "/" + formatSize( + totalSize) - /** - * 格式化文件大小, 输出成带单位的字符串 - * @param {Number} size 文件大小 - * @param {Number} [pointLength=1] 精确到的小数点数。 - * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。 - * 如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. - */ - function formatSize(size, pointLength, units) { - var unit - units = units || ['B', 'KB', 'MB', 'GB', 'TB'] - while ((unit = units.shift()) && size > 1024) { - size = size / 1024 + /** + * 格式化文件大小, 输出成带单位的字符串 + * @param {Number} size 文件大小 + * @param {Number} [pointLength=1] 精确到的小数点数。 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 单位数组。从字节,到千字节,一直往上指定。 + * 如果单位数组里面只指定了到了K(千字节),同时文件大小大于M, 此方法的输出将还是显示成多少K. + */ + function formatSize(size, pointLength, units) { + var unit + units = units + || ['B', 'KB', 'MB', 'GB', 'TB'] + while ((unit = units.shift()) + && size > 1024) { + size = size / 1024 + } + return (unit === 'B' ? size : size.toFixed( + pointLength === undefined ? 1 : pointLength)) + ' ' + unit } - return (unit === 'B' ? size : size.toFixed( - pointLength === undefined ? 1 : pointLength)) + ' ' + unit } } } @@ -73,7 +106,10 @@ Popup { MouseArea { anchors.fill: parent hoverEnabled: true - onEntered: file_buttons.visible = true + onEntered: { + if (completedSize < totalSize) + file_buttons.visible = true + } onExited: file_buttons.visible = false LinearGradient { diff --git a/AicsKnowledgeBase/qml/global/UserData.qml b/AicsKnowledgeBase/qml/global/UserData.qml index 771ac90..4d7845f 100644 --- a/AicsKnowledgeBase/qml/global/UserData.qml +++ b/AicsKnowledgeBase/qml/global/UserData.qml @@ -5,4 +5,6 @@ import QtQuick QtObject { property string username property string userId + property var viewHistory: [] + property var downloadedFiles: [] } diff --git a/AicsKnowledgeBase/res/download.png b/AicsKnowledgeBase/res/download.png new file mode 100644 index 0000000000000000000000000000000000000000..3bd31e82d1543fd60bcb039cc4ca32ed4c6401ca GIT binary patch literal 3104 zcma)8c{CJ$_x{WnV=ywNv86$3Y|)5>Y?GxSM3zuwNy?s(CCfyGgptZJ8A4K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owledgeBase/res/upload.png b/AicsKnowledgeBase/res/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..136a60ff815c7a9a03ebb47c66d7a64d2a0b0f2c GIT binary patch literal 3017 zcmb7Gc{CLI7yr(Ju@5nJ2G7{HNkg)XF%ONkA|*uDyg}I#Lo+D5R@s-762*HS!dRxV z8@m|Gvm|>GifNIb-|w8?-@o%a=id9d=bm%#J@=1$?$2Rgq6Ea4m=oOgF*P0k9jf`!oz{`-uX~T@ zWB;iE$zy>o>c?)Xp(6I4us-z-FlS_B>t{BM2AGG^-=b(VusN`|*Wl+{c)idMu~qe0 zv^b;R#7VxyEor?d5S0h?>-r85UvSo;B+*$X{kde(%Jp#AkS}7m; z_)UgWi<++HQRFkHC*gKOscAn%Ep&zaKs03(@%d@3Q9*Hs0_z-}7{i?Aopb4i7Rr~% z`^qNJy!h>;W9*l@%b(Z=HYUnaquPHO9MPop6~R1Dp?k0ylf;2Anjq%yQd9W*5oP5^ za1SQEDJSnaQ#8X5Zt*sKx7E z*aUCgwI?C=`)5bkzm#7%0EbsR`{W%LBr1_`?#;-pzS;F|{-311$Xd=hSD)3FZscI_ zsF;4|<-%i{*4vrwPc1Yvw}o+GU{YO9pE^`pN z2jl!QA%jqAK*JrS&sxa*s#kGofX>wnVA>Iqy+US5;ueK{->|TX)La!ndsxHo9#tr>A5;I2@N*z&!U- z!80&MIHD9=`Xeqw`w9qn*l^_P)`hVg1pOYw9H|1f{xtnMdu=c)o&l1A*-y28Me-`l zWHb5TAztDL;B`AHdNKt7OrQVd328USudxEIybxGc13|- z)HRl*r1u;u>uP(S42QURH+j>w#J28Y9GeGUd+C?X_s}1)nZBc1FjJDB^~LSp)L@`D zyGASeqJBmDqdR3?VW#nOFq0BI$s5`-fgarUuB)FF+zfLYYH{Otr;(m63 zYfK29{1T+`(YdMSO7)tsyY1MBT91=j{G0Xi|X{+M8L}J zc_=$3OI^Zhv6PzyM%ANVrkDm@xQ4LsU>4*Ue{OPiF^DjdgREt~iRI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naC41zOK^KfNN|Z@2zwLtS3LtV-w04Qc}Zm|-?=vu74x#< z6pQTml>G#-3r9|AWXv8H`b;mh3BKrWDsuvN{DI<~L5M{x?~B@)xISE;;MdN_+HO2{ z+3KDiug2p3K)HIG$eC9DQR~XGYMULk@zZ=O|31B&$#{s4+o3416S^Ue<4KD!m!) z*Psqi2FvQt^z*Z;@6nbS#fkgL4XQ8?k+`3nzLU~VSdHI!wr^EAeIh}`3zT)7k@LzP z;*Fx6%aPeMr&aRhs)1O{u_|dQ2EIrbL(gOnt8;vx@z~50{nYG{F_9&y4rz zi$|S^$l?OV+sTfcDSMwNxi6tn-zl65yC5?%%!yIi_qVM;h2+9- zT(b_&B;A2SK6R}>r@5goJ?(I|P=O&ugMWXsF4<-18*PA|2B43dPGiDx?A=~o+Xn?ZeH9U6BE zFdl|@=k(qAYvT0)S5A!?(^(0Z>QH?%rJWjkXDDx*9jvqs*xH`;#%&;h9y>hL39PKe zgJ8N~zOpFni!K-zzBP47QtQ{1Wn%cKH3{=LBncompletedSize += dlnow; fileTrans->speed = speed; - qDebug() << std::format("Downloading: {} / {}, Speed: {}", fileTrans->completedSize, fileTrans->totalSize, - speed).c_str(); + //qDebug() << std::format("Downloading: {} / {}, Speed: {}", fileTrans->completedSize, fileTrans->totalSize, + // speed).c_str(); auto item = static_cast(*fileTrans); QTimer::singleShot(0, qApp, [item]() { @@ -96,8 +96,8 @@ static int uploadInfo(void *p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t curl_easy_getinfo(fileTrans->curlHandle, CURLINFO_SPEED_UPLOAD_T, &speed); fileTrans->completedSize += ulnow; fileTrans->speed = speed; - qDebug() << std::format("Uploading: {} / {}, Speed: {}", fileTrans->completedSize, fileTrans->totalSize, - speed).c_str(); + //qDebug() << std::format("Uploading: {} / {}, Speed: {}", fileTrans->completedSize, fileTrans->totalSize, + // speed).c_str(); auto item = static_cast(*fileTrans); QTimer::singleShot(0, qApp, [item]() { @@ -359,6 +359,10 @@ void FileTransferManager::download(const QString &fileId, const QString &fileNam auto fileUrl = std::format("File/{}?rangeStart={}&rangeEnd={}", fileId.toStdString(), completedSize, size); auto res = httpDownload(fileUrl, savePath, item); + + if (QFileInfo(QString::fromLocal8Bit(savePath.c_str())).size() == size) + emit transferComplete(true, fileId, fileName); + qDebug() << "End Get" << res; }); } @@ -398,8 +402,6 @@ QString FileTransferManager::getFileName(const QUrl &fileUrl) } - - void FileTransferManager::getMarkdown(const QString &fileId) { QtConcurrent::run([fileId, this] { diff --git a/AicsKnowledgeBase/src/FileTransferManager.h b/AicsKnowledgeBase/src/FileTransferManager.h index 0e1c3ad..571e693 100644 --- a/AicsKnowledgeBase/src/FileTransferManager.h +++ b/AicsKnowledgeBase/src/FileTransferManager.h @@ -33,6 +33,7 @@ public: Q_INVOKABLE void getMarkdown(const QString &fileId); signals: + void transferComplete(bool download, QString fileId, QString fileName); void markdownData(QString data); private: From ddc67c9f65fb13915d957259df21c9e238d4f329 Mon Sep 17 00:00:00 2001 From: shmily744 <1527550984@qq.com> Date: Fri, 7 Jul 2023 00:56:12 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=AE=8C=E6=88=90tag=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/component/Tag.qml | 49 +++++-- AicsKnowledgeBase/qml/page/SearchPage.qml | 153 ++++++++++++++-------- 2 files changed, 131 insertions(+), 71 deletions(-) diff --git a/AicsKnowledgeBase/qml/component/Tag.qml b/AicsKnowledgeBase/qml/component/Tag.qml index 47cb448..5a609ab 100644 --- a/AicsKnowledgeBase/qml/component/Tag.qml +++ b/AicsKnowledgeBase/qml/component/Tag.qml @@ -4,6 +4,8 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import FluentUI +import QtQml +import "qrc:///AicsKnowledgeBase/qml/global" Rectangle { id: input @@ -13,10 +15,32 @@ Rectangle { radius: 5 clip: true - border.color: textInput.activeFocus ? "#268CDC":"#979592" //gray100 + ListModel { id: tagListModel } property ListModel tagList: tagListModel + property var tagMap:[] + property var presetsTags:[] + property var presetsTagsItem:[] + Component.onCompleted: { + Request.get("tag?name", + function(result, data){ +// console.log("success") +// console.log(result) +// console.log(data.length) + for(var i =0;i Date: Fri, 7 Jul 2023 01:02:48 +0800 Subject: [PATCH 4/8] history --- AicsKnowledgeBase/qml/page/HistoryPage.qml | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/AicsKnowledgeBase/qml/page/HistoryPage.qml b/AicsKnowledgeBase/qml/page/HistoryPage.qml index b674143..79c99c7 100644 --- a/AicsKnowledgeBase/qml/page/HistoryPage.qml +++ b/AicsKnowledgeBase/qml/page/HistoryPage.qml @@ -4,6 +4,8 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import FluentUI +import "qrc:///AicsKnowledgeBase/qml/component" +import "qrc:///AicsKnowledgeBase/qml/global" FluArea { property string url: '' @@ -17,4 +19,75 @@ FluArea { Layout.topMargin: 20 text: "History" } + FileList { + anchors.top: title.bottom + disableHeader: true + width: parent.width + dataModel: listModel + } + ListModel { + id: listModel + } + Component.onCompleted: { + listModel.clear() + for (var i = 0; i < history.length; i++) { + Request.get("/knowledge/" + history[i] + "/detailed", response => { + var file = JSON.parse(response) + + var modelItem = { + "title": file.name, + "uuid": file.id, + "date"// cut time after 'T' + : file.createTime.substring(0, 10), + "fuuid": "" + } + if (file.knowledgeFileAttribute === null) { + modelItem.type = "folder" + modelItem.isDir = true + modelItem.size = 0 + } else { + modelItem.isDir = false + modelItem.type = getType( + file.knowledgeFileAttribute.suffix) + modelItem.size = file.knowledgeFileAttribute.size + modelItem.brief = file.knowledgeFileAttribute.brief + modelItem.pageView = file.knowledgeFileAttribute.pageView + modelItem.stars = 0 + // merge file.knowledgeFileAttribute.tags array to a string + var tagString = "" + for (var j = 0; j < file.knowledgeFileAttribute.tags.length; j++) { + if (j != 0) + tagString = tagString + "," + tagString = tagString + file.knowledgeFileAttribute.tags[j].name + } + modelItem.tags = tagString + } + listModel.append(modelItem) + }) + } + } + function getType(suffix) { + if (suffix === "ppt" || suffix === "pptx") + return "PPT" + else if (suffix === "doc" || suffix === "docx") + return "WORD" + else if (suffix === "pdf") + return "PDF" + else if (suffix === "txt") + return "TXT" + else if (suffix === "xls" || suffix === "xlsx") + return "EXCEL" + else if (suffix === "zip" || suffix === "rar") + return "ZIP" + else if (suffix === "png" || suffix === "jpg" || suffix === "jpeg" + || suffix === "gif") + return "IMAGE" + else if (suffix === "mp3" || suffix === "wav") + return "AUDIO" + else if (suffix === "mp4" || suffix === "avi" || suffix === "rmvb" + || suffix === "rm" || suffix === "wmv" || suffix === "mkv") + return "VIDEO" + else + return "OTHER" + } } From bfb2adb7f960b88b3abc4849593862cc1467feec Mon Sep 17 00:00:00 2001 From: wuyize Date: Fri, 7 Jul 2023 01:05:12 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=A8=8B=E5=BA=8F=E6=89=93=E5=BC=80=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/CMakeLists.txt | 2 +- AicsKnowledgeBase/src/FileTransferManager.cpp | 6 ++++++ AicsKnowledgeBase/src/FileTransferManager.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AicsKnowledgeBase/CMakeLists.txt b/AicsKnowledgeBase/CMakeLists.txt index d0c1ff4..69e1ce2 100644 --- a/AicsKnowledgeBase/CMakeLists.txt +++ b/AicsKnowledgeBase/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 20) -find_package(Qt6 COMPONENTS Quick WebEngineQuick REQUIRED) +find_package(Qt6 COMPONENTS Gui Quick WebEngineQuick REQUIRED) #遍历所有Cpp文件 file(GLOB_RECURSE CPP_FILES src/*.cpp src/*.h) diff --git a/AicsKnowledgeBase/src/FileTransferManager.cpp b/AicsKnowledgeBase/src/FileTransferManager.cpp index df0d6ca..b34b871 100644 --- a/AicsKnowledgeBase/src/FileTransferManager.cpp +++ b/AicsKnowledgeBase/src/FileTransferManager.cpp @@ -8,6 +8,7 @@ #include #include #include +#include static const std::string baseUrl = "https://api.hammer-hfut.tk:233/aics/file/"; //static const std::string baseUrl = "http://127.0.0.1:4523/m1/2914957-0-6e5f2db1/"; @@ -426,3 +427,8 @@ void FileTransferManager::getMarkdown(const QString &fileId) }); } +void FileTransferManager::openLocalFile(const QString &fileName) +{ + QDesktopServices::openUrl(QUrl::fromLocalFile("D:\\Downloads\\"+ fileName)); +} + diff --git a/AicsKnowledgeBase/src/FileTransferManager.h b/AicsKnowledgeBase/src/FileTransferManager.h index 571e693..3b73e4b 100644 --- a/AicsKnowledgeBase/src/FileTransferManager.h +++ b/AicsKnowledgeBase/src/FileTransferManager.h @@ -32,6 +32,8 @@ public: Q_INVOKABLE void getMarkdown(const QString &fileId); + Q_INVOKABLE void openLocalFile(const QString &fileName); + signals: void transferComplete(bool download, QString fileId, QString fileName); void markdownData(QString data); From 986b45a4501fc90a2d5a73a8029887fef5a75418 Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Fri, 7 Jul 2023 01:11:30 +0800 Subject: [PATCH 6/8] history --- AicsKnowledgeBase/qml/page/HistoryPage.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AicsKnowledgeBase/qml/page/HistoryPage.qml b/AicsKnowledgeBase/qml/page/HistoryPage.qml index 79c99c7..19e1695 100644 --- a/AicsKnowledgeBase/qml/page/HistoryPage.qml +++ b/AicsKnowledgeBase/qml/page/HistoryPage.qml @@ -29,6 +29,8 @@ FluArea { id: listModel } Component.onCompleted: { + var history = UserData.viewHistory + console.log(history) listModel.clear() for (var i = 0; i < history.length; i++) { Request.get("/knowledge/" + history[i] + "/detailed", response => { From 3a79d7b0d2cf15dac38da32f373c94894f052c6c Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Fri, 7 Jul 2023 01:22:06 +0800 Subject: [PATCH 7/8] =?UTF-8?q?Search=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/global/Request.qml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/AicsKnowledgeBase/qml/global/Request.qml b/AicsKnowledgeBase/qml/global/Request.qml index 9b91baa..98cdc73 100644 --- a/AicsKnowledgeBase/qml/global/Request.qml +++ b/AicsKnowledgeBase/qml/global/Request.qml @@ -6,6 +6,7 @@ QtObject { id: request property string baseUrl: "https://api.hammer-hfut.tk:233/aics/main/" + property string searchUrl: "https://api.hammer-hfut.tk:233/aics/query" //property string baseUrl: "http://192.168.156.74:8080/" // GET @@ -17,7 +18,26 @@ QtObject { } xhr.send() } - + // GET in searchUrl + function getSearch(url, success, failure) { + var xhr = new XMLHttpRequest + xhr.open("GET", searchUrl + url) + xhr.onreadystatechange = function () { + handleResponse(xhr, success, failure) + } + xhr.send() + } + // PUT in searchUrl + function putSearch(url, arg, success, failure) { + var xhr = new XMLHttpRequest + xhr.open("PUT", searchUrl + url) + xhr.setRequestHeader('Content-Type', 'application/json') + xhr.withCredentials = true + xhr.onreadystatechange = function () { + handleResponse(xhr, success, failure) + } + xhr.send(arg) + } function getAwait(url) { var xhr = new XMLHttpRequest xhr.open("GET", baseUrl + url, false) From b8581ba3df0301268ba1b87557e71a302d69e60b Mon Sep 17 00:00:00 2001 From: wuyize Date: Fri, 7 Jul 2023 01:36:34 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=A8=8B=E5=BA=8F=E6=89=93=E5=BC=80=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/component/CustomAppBar.qml | 15 +++++++++++++++ AicsKnowledgeBase/qml/page/ContentPage.qml | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/AicsKnowledgeBase/qml/component/CustomAppBar.qml b/AicsKnowledgeBase/qml/component/CustomAppBar.qml index 56ead21..6285759 100644 --- a/AicsKnowledgeBase/qml/component/CustomAppBar.qml +++ b/AicsKnowledgeBase/qml/component/CustomAppBar.qml @@ -117,6 +117,20 @@ Rectangle { Layout.rightMargin: 10 iconSource: FluentIcons.PenPalette iconSize: 14 + onClicked: { + note_menu.open() + } + FluMenu { + id: note_menu + x: parent ? (parent.width - width) / 2 : 0 + y: parent ? parent.height : 0 + FluMenuItem { + text: "收藏的笔记" + } + FluMenuItem { + text: "我的笔记" + } + } } Text { @@ -218,5 +232,6 @@ Rectangle { frameless_helper.setHitTestVisible(btn_maximize) frameless_helper.setHitTestVisible(btn_close) frameless_helper.setHitTestVisible(btn_transfer) + frameless_helper.setHitTestVisible(btn_note) } } diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index f2a72d5..7b721d5 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -66,7 +66,7 @@ FluArea { property int shareCount: 0 property int browsCount: 555 property bool isFavorite: false - property bool isDownload: false + property bool isDownload: UserData.downloadedFiles.indexOf(fileId) != -1 property double fileSize: 0 property string title: "文章标题" property list tags: ["tag 1", "tag 2", "tag 3"] @@ -249,7 +249,7 @@ FluArea { FileTransferManager.download(content_page.fileId, content_page.title) else { - + FileTransferManager.openLocalFile(content_page.title) } } }