2023-06-30 21:30:04 +08:00
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Window
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Basic
|
|
|
|
|
import QtWebEngine 1.2
|
|
|
|
|
import FluentUI
|
2023-07-03 17:13:47 +08:00
|
|
|
|
import AicsKB.FileTransferManager
|
2023-07-05 20:04:43 +08:00
|
|
|
|
import SignalFileOperation 1.0
|
2023-07-04 10:17:07 +08:00
|
|
|
|
import "qrc:///AicsKnowledgeBase/qml/page"
|
2023-07-06 14:00:55 +08:00
|
|
|
|
import "qrc:///AicsKnowledgeBase/qml/component"
|
2023-07-06 15:26:51 +08:00
|
|
|
|
import "qrc:///AicsKnowledgeBase/qml/global"
|
2023-06-30 21:30:04 +08:00
|
|
|
|
|
2023-06-30 23:31:28 +08:00
|
|
|
|
FluArea {
|
2023-07-06 14:00:55 +08:00
|
|
|
|
Popup {
|
|
|
|
|
id: popup
|
|
|
|
|
modal: true //模态, 为 true后弹出窗口会叠加一个独特的背景调光效果
|
|
|
|
|
focus: true //焦点, 当弹出窗口实际接收到焦点时,activeFocus将为真
|
|
|
|
|
padding: 0
|
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
property var raiseItem: null
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
color: Qt.rgba(0, 0, 0, 0) //背景为无色
|
|
|
|
|
}
|
|
|
|
|
FluArea {
|
|
|
|
|
width: 350
|
|
|
|
|
height: 500
|
|
|
|
|
backgroundColor: "#f9f9f9"
|
|
|
|
|
NoteList {
|
|
|
|
|
id: noteList
|
|
|
|
|
onOpen: function handle(noteId) {
|
|
|
|
|
console.log("open note: " + noteId)
|
|
|
|
|
}
|
|
|
|
|
onCreateNote: function handle() {
|
|
|
|
|
console.log("create note")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-02 12:54:04 +08:00
|
|
|
|
id: content_area
|
2023-06-30 23:31:28 +08:00
|
|
|
|
paddings: 0
|
2023-07-02 15:58:02 +08:00
|
|
|
|
backgroundColor: "#f9f9f9"
|
2023-07-06 17:16:55 +08:00
|
|
|
|
// visible: false
|
2023-07-02 19:47:51 +08:00
|
|
|
|
property string type: ""
|
2023-07-03 17:13:47 +08:00
|
|
|
|
property string knowledgeFileId
|
2023-07-06 17:16:55 +08:00
|
|
|
|
signal back()
|
2023-07-02 12:54:04 +08:00
|
|
|
|
signal download(string knowledgeFileId)
|
|
|
|
|
signal clickTags(string tagName)
|
2023-06-30 21:30:04 +08:00
|
|
|
|
|
2023-06-30 23:31:28 +08:00
|
|
|
|
// paddings: {
|
|
|
|
|
// top: 10
|
|
|
|
|
// right: 0
|
|
|
|
|
// bottom: 10
|
|
|
|
|
// left: 10
|
|
|
|
|
// }
|
2023-07-05 20:04:43 +08:00
|
|
|
|
|
2023-06-30 23:31:28 +08:00
|
|
|
|
FluScrollablePage {
|
2023-07-02 12:54:04 +08:00
|
|
|
|
id: content_page
|
2023-06-30 23:31:28 +08:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
leftPadding: 10
|
|
|
|
|
topPadding: 10
|
|
|
|
|
rightPadding: 10
|
|
|
|
|
bottomPadding: 0
|
2023-06-30 21:30:04 +08:00
|
|
|
|
|
2023-07-06 15:26:51 +08:00
|
|
|
|
property string fileId
|
2023-07-06 17:16:55 +08:00
|
|
|
|
property int noteCount: 0
|
2023-06-30 23:31:28 +08:00
|
|
|
|
property int favoriteCount: 0
|
|
|
|
|
property int shareCount: 0
|
|
|
|
|
property int browsCount: 555
|
|
|
|
|
property bool isFavorite: false
|
2023-07-02 12:54:04 +08:00
|
|
|
|
property bool isDownload: false
|
2023-06-30 23:31:28 +08:00
|
|
|
|
property double fileSize: 455
|
2023-07-06 15:26:51 +08:00
|
|
|
|
property string title: "文章标题"
|
2023-06-30 23:31:28 +08:00
|
|
|
|
property list<string> tags: ["tag 1", "tag 2", "tag 3"]
|
2023-07-06 17:16:55 +08:00
|
|
|
|
property var publishTime
|
2023-06-30 23:31:28 +08:00
|
|
|
|
property string brief: "这是一个简介"
|
2023-06-30 21:30:04 +08:00
|
|
|
|
|
2023-07-06 15:26:51 +08:00
|
|
|
|
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
|
|
|
|
|
})
|
2023-07-06 17:16:55 +08:00
|
|
|
|
|
2023-07-06 15:26:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-30 23:31:28 +08:00
|
|
|
|
Component.onCompleted: {
|
2023-07-06 17:16:55 +08:00
|
|
|
|
loadFile(knowledgeFileId)
|
|
|
|
|
console.log(content_area.type)
|
|
|
|
|
}
|
2023-07-06 15:26:51 +08:00
|
|
|
|
|
2023-07-06 17:16:55 +08:00
|
|
|
|
FluIconButton {
|
|
|
|
|
iconSize: 12
|
|
|
|
|
iconSource: FluentIcons.Back
|
|
|
|
|
onClicked: {
|
|
|
|
|
emit: SignalFileOperation.back()
|
|
|
|
|
}
|
|
|
|
|
Layout.margins: -5
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
2023-06-30 23:31:28 +08:00
|
|
|
|
|
2023-07-06 17:16:55 +08:00
|
|
|
|
|
2023-06-30 23:31:28 +08:00
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
implicitHeight: 50
|
|
|
|
|
|
2023-06-30 21:30:04 +08:00
|
|
|
|
FluText {
|
2023-06-30 23:31:28 +08:00
|
|
|
|
id: text_title
|
|
|
|
|
padding: 10
|
2023-07-06 15:26:51 +08:00
|
|
|
|
text: content_page.title
|
2023-06-30 23:31:28 +08:00
|
|
|
|
font {
|
|
|
|
|
pointSize: 15
|
|
|
|
|
bold: true
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-06 14:00:55 +08:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: layout_note
|
|
|
|
|
FluIconButton {
|
|
|
|
|
id: button_note
|
|
|
|
|
iconSize: 15
|
|
|
|
|
iconSource: FluentIcons.QuickNote
|
|
|
|
|
text: "笔记"
|
|
|
|
|
onClicked: {
|
|
|
|
|
popup.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FluText {
|
2023-07-06 17:16:55 +08:00
|
|
|
|
text: content_page.noteCount
|
2023-07-06 14:00:55 +08:00
|
|
|
|
font.pointSize: 8
|
|
|
|
|
Layout.alignment: button_note.Center
|
|
|
|
|
Layout.topMargin: -5
|
|
|
|
|
}
|
|
|
|
|
anchors {
|
|
|
|
|
verticalCenter: text_title.verticalCenter
|
|
|
|
|
right: parent.right
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-30 23:31:28 +08:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: layout_share
|
|
|
|
|
FluIconButton {
|
|
|
|
|
id: button_share
|
|
|
|
|
iconSize: 15
|
|
|
|
|
iconSource: FluentIcons.Share
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: content_page.shareCount.toString()
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
FluText {
|
|
|
|
|
id: text_share
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: content_page.shareCount
|
2023-06-30 23:31:28 +08:00
|
|
|
|
font.pointSize: 8
|
2023-07-02 12:54:04 +08:00
|
|
|
|
Layout.alignment: button_share.Center
|
|
|
|
|
Layout.topMargin: -5
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
anchors {
|
|
|
|
|
verticalCenter: text_title.verticalCenter
|
2023-07-06 14:00:55 +08:00
|
|
|
|
right: layout_note.left
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
2023-06-30 23:31:28 +08:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: layout_favorite
|
|
|
|
|
FluIconButton {
|
|
|
|
|
id: button_favorite
|
|
|
|
|
iconSize: 15
|
2023-07-02 12:54:04 +08:00
|
|
|
|
iconSource: content_page.isFavorite ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
FluText {
|
|
|
|
|
id: text_favorite
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: content_page.favoriteCount
|
2023-06-30 23:31:28 +08:00
|
|
|
|
font.pointSize: 8
|
2023-07-02 12:54:04 +08:00
|
|
|
|
Layout.alignment: button_favorite.Center
|
|
|
|
|
Layout.topMargin: -5
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
2023-06-30 21:30:04 +08:00
|
|
|
|
anchors {
|
2023-06-30 23:31:28 +08:00
|
|
|
|
verticalCenter: text_title.verticalCenter
|
|
|
|
|
right: layout_share.left
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FluIconButton {
|
2023-06-30 23:31:28 +08:00
|
|
|
|
id: button_download
|
|
|
|
|
iconSize: 25
|
2023-07-02 12:54:04 +08:00
|
|
|
|
iconSource: content_page.isDownload ? FluentIcons.OEM : FluentIcons.Download
|
2023-06-30 21:30:04 +08:00
|
|
|
|
anchors {
|
2023-06-30 23:31:28 +08:00
|
|
|
|
verticalCenter: text_title.verticalCenter
|
2023-07-06 15:26:51 +08:00
|
|
|
|
right: layout_favorite.left
|
2023-06-30 23:31:28 +08:00
|
|
|
|
rightMargin: 20
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
2023-07-02 12:54:04 +08:00
|
|
|
|
onClicked: {
|
2023-07-02 19:47:51 +08:00
|
|
|
|
emit: content_area.download(content_area.knowledgeFileId)
|
2023-07-06 14:32:25 +08:00
|
|
|
|
FileTransferManager.download(content_area.knowledgeFileId)
|
2023-07-02 12:54:04 +08:00
|
|
|
|
}
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-30 23:31:28 +08:00
|
|
|
|
FluArea {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
implicitHeight: 100
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
RowLayout {
|
2023-07-06 14:00:55 +08:00
|
|
|
|
width: parent.width
|
2023-06-30 23:31:28 +08:00
|
|
|
|
FluText {
|
|
|
|
|
padding: 10
|
2023-07-06 15:26:51 +08:00
|
|
|
|
text: content_page.publishTime
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
FluText {
|
|
|
|
|
padding: 10
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: content_page.fileSize.toString() + "MB"
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
FluText {
|
|
|
|
|
padding: 10
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: content_page.browsCount.toString() + "浏览量"
|
2023-06-30 23:31:28 +08:00
|
|
|
|
}
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
2023-06-30 23:31:28 +08:00
|
|
|
|
FluText {
|
|
|
|
|
Layout.topMargin: -2
|
|
|
|
|
Layout.leftMargin: 10
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: content_page.brief
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
2023-06-30 23:31:28 +08:00
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.topMargin: 2
|
|
|
|
|
Layout.leftMargin: 5
|
|
|
|
|
Repeater {
|
2023-07-02 12:54:04 +08:00
|
|
|
|
model: content_page.tags
|
2023-06-30 23:31:28 +08:00
|
|
|
|
delegate: Button {
|
|
|
|
|
Layout.margins: 2
|
2023-07-02 12:54:04 +08:00
|
|
|
|
text: "#" + content_page.tags[index]
|
2023-06-30 23:31:28 +08:00
|
|
|
|
background: Rectangle {
|
|
|
|
|
implicitHeight: 10
|
|
|
|
|
implicitWidth: 10
|
|
|
|
|
color: FluColors.Grey20
|
|
|
|
|
radius: 10
|
|
|
|
|
}
|
2023-07-02 12:54:04 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
emit: content_area.clickTags(text)
|
|
|
|
|
}
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-04 10:17:07 +08:00
|
|
|
|
|
2023-07-06 17:16:55 +08:00
|
|
|
|
WebEngineView {
|
2023-07-02 12:54:04 +08:00
|
|
|
|
Layout.fillWidth: true
|
2023-07-06 17:16:55 +08:00
|
|
|
|
backgroundColor: "transparent"
|
|
|
|
|
implicitHeight: 200
|
|
|
|
|
settings.javascriptEnabled: true
|
|
|
|
|
settings.pluginsEnabled: true
|
|
|
|
|
url: "https://www.baidu.com"
|
2023-07-04 10:17:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-06 17:16:55 +08:00
|
|
|
|
// 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"
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2023-06-30 21:30:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|