AicsKnowledgeBase_client/AicsKnowledgeBase/qml/MainWindow.qml

195 lines
5.5 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import SignalFileOperation 1.0
import org.wangwenx190.FramelessHelper
import "qrc:///AicsKnowledgeBase/qml/global"
import "qrc:///AicsKnowledgeBase/qml/page"
import "qrc:///AicsKnowledgeBase/qml/component"
FluWindow {
id: window
width: 1000
height: 640
CustomAppBar {
id: title_bar
title: window.title
username: UserData.username
anchors {
left: parent.left
right: parent.right
top: parent.top
leftMargin: 35
}
}
RowLayout {
anchors.fill: parent
FluNavigationView {
id: nav_view
Layout.fillHeight: true
Layout.preferredWidth: 400
Layout.bottomMargin: 4
z: 999
items: NavItems
footerItems: FooterItems
topPadding: 5
displayMode: FluNavigationView.Compact
logo: "qrc:/AicsKnowledgeBase/res/logo.png"
title: "智能客服知识库"
Behavior on rotation {
NumberAnimation {
duration: 167
}
}
transformOrigin: Item.Center
Component.onCompleted: {
NavItems.navigationView = nav_view
FooterItems.navigationView = nav_view
setCurrentIndex(0)
}
}
StackView {
id: stack_view
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: 45
Layout.bottomMargin: 4
Layout.rightMargin: 4
pushEnter: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to: 1
duration: 200
}
}
pushExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to: 0
duration: 200
}
}
popEnter: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to: 1
duration: 200
}
}
popExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to: 0
duration: 200
}
}
}
Connections {
target: SignalFileOperation
function onOpen(file) {
stack_view.clear()
UserData.viewHistory.push(file)
stack_view.push(file_view, {
"knowledgeFileId": file
})
}
function onOpenNote(note, authorId) {
console.log(note)
console.log(authorId)
stack_view.push(note_view, {
"noteFileId": note,
"authorId": authorId
})
}
function onBack() {
if (stack_view.depth > 0)
stack_view.pop()
}
function onCreateNote(file, fileType, fileTitle) {
console.log(file)
console.log(fileType)
console.log(fileTitle)
stack_view.push(create_note_view, {
"knowledgeFileId": file,
"fileType": fileType,
"fileTitle": fileTitle
})
}
function onModifyNote(file, fileType, fileTitle, note) {
stack_view.push(create_note_view, {
"knowledgeFileId": file,
"fileType": fileType,
"fileTitle": fileTitle,
"noteFileId": note,
"isModifying": true
})
}
}
Component {
id: file_view
ContentPage {}
}
Component {
id: note_view
NotePage {}
}
Component {
id: create_note_view
CreateNotePage {}
}
// ContentPage {
// Layout.fillHeight: true
// Layout.fillWidth: true
// Layout.topMargin: 45
// Layout.bottomMargin: 4
// Layout.rightMargin: 4
// type: "md"
// }
/*
FluArea {
Layout.fillHeight: true
Layout.fillWidth: true
paddings: 10
Layout.topMargin: 45
Layout.bottomMargin: 4
Layout.rightMargin: 4
FluText {
Layout.topMargin: 20
text: "Content"
}
}*/
}
FramelessHelper {
id: framless_helper
onReady: {
setTitleBarItem(title_bar)
moveWindowToDesktopCenter()
title_bar.setHitTestVisibleItems(framless_helper)
title_bar.maximizeButton.visible = true
// window.backgroundVisible = false
window.show()
}
}
}