完善登录页

main
wuyize 2023-06-18 00:06:24 +08:00
parent 88437b5fb9
commit 4528b5343e
7 changed files with 169 additions and 154 deletions

3
.gitignore vendored
View File

@ -361,3 +361,6 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
cmake-build-*/
.idea/

View File

@ -0,0 +1,18 @@
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
Window {
id: app
Component.onCompleted: {
FluApp.init(app);
FluTheme.darkMode = FluDarkMode.System;
FluApp.routes = {
"/": "qrc:/AicsKnowledgeBase/qml/MainWindow.qml"
};
FluApp.initialRoute = "/";
FluApp.run();
}
}

View File

@ -5,118 +5,81 @@ import QtQuick.Window
import QtQuick.Layouts
import org.wangwenx190.FramelessHelper
FluWindow{
width: 640
height: 480
visible: true
title: qsTr("Hello World")
color: "transparent"
property alias titleVisible: title_bar.titleVisible
property bool appBarVisible: true
FluAppBar {
id: title_bar
title: window.title
visible: window.appBarVisible
anchors {
top: parent.top
left: parent.left
right: parent.right
}
darkText: lang.dark_mode
}
Item{
id:container
anchors{
top: title_bar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
clip: true
}
FramelessHelper{
id:framless_helper
onReady: {
setTitleBarItem(title_bar)
moveWindowToDesktopCenter()
setHitTestVisible(title_bar.minimizeButton())
setHitTestVisible(title_bar.maximizeButton())
setHitTestVisible(title_bar.closeButton())
setWindowFixedSize(fixSize)
title_bar.maximizeButton.visible = !fixSize
if (blurBehindWindowEnabled)
window.backgroundVisible = false
window.show()
}
}
function setHitTestVisible(com){
framless_helper.setHitTestVisible(com)
}
function setTitleBarItem(com){
framless_helper.setTitleBarItem(com)
}
Row {
anchors.fill: parent
Item{
Rectangle {
id: introdutcitonItem
height: parent.height
width: parent.width * 0.5
color: "#f3fbff"
//color: "transparent"
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: "qrc:/AicsKnowledgeBase/res/login_background.webp"
}
}
}
}
Item{
id: loginItem
height: parent.height
ColumnLayout {
id: loginRect
width: parent.width * 0.5
height: parent.height
FluPivot {
anchors.fill: parent
anchors.margins: 20
id: loginItem
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Layout.margins: 20
height: 200
FluPivotItem {
title: "Sign in"
title: "登录"
contentItem: Column {
anchors.fill: parent
anchors.margins: 20
anchors.centerIn: parent
anchors.margins: {
top: 10
}
anchors.top: parent.top
spacing: 12
FluTextBox {
placeholderText: "Account"
anchors.left: parent.left
anchors.right: parent.right
id: account
placeholderText: "用户名"
}
FluPasswordBox {
placeholderText: "Password"
anchors.left: parent.left
anchors.right: parent.right
id: password
placeholderText: "密码"
}
Row{
spacing: 25
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
FluCheckBox {
text: "Remember me"
Layout.alignment: Qt.AlignLeft
//anchors.left: parent.left
text: "记住密码"
}
FluTextButton {
text: "Forgot your password?"
Layout.alignment: Qt.AlignRight
//anchors.right: parent.right
text: "忘记密码?"
}
}
FluFilledButton {
text: "Sign in"
anchors.horizontalCenter: parent.horizontalCenter
normalColor: "green"
text: "登录"
}
}
}
FluPivotItem {
title: "Register"
title: "注册"
// Rectangle{
// anchors.fill: parent
// color: "blue"
@ -124,5 +87,6 @@ FluWindow{
}
}
}
}
}

View File

@ -0,0 +1,76 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import org.wangwenx190.FramelessHelper
FluWindow {
property bool appBarVisible: true
function setHitTestVisible(com) {
framless_helper.setHitTestVisible(com)
}
function setTitleBarItem(com) {
framless_helper.setTitleBarItem(com)
}
id: window
//color: "transparent"
height: 420
title: "智能客服知识库"
width: 640
FluAppBar {
id: title_bar
title: window.title
visible: appBarVisible
anchors {
left: parent.left
right: parent.right
top: parent.top
}
}
/*FluIconButton {
id: refreshButton
height: 30
iconSize: 13
iconSource: FluentIcons.Sync
width: 30
z: 8
onClicked: {
showSuccess("reload")
loader.reload()
}
anchors {
top: title_bar.bottom
}
}*/
FramelessHelper {
id: framless_helper
onReady: {
setTitleBarItem(title_bar)
moveWindowToDesktopCenter()
setHitTestVisible(title_bar.minimizeButton())
setHitTestVisible(title_bar.maximizeButton())
setHitTestVisible(title_bar.closeButton())
//setHitTestVisible(refreshButton)
title_bar.maximizeButton.visible = true
//if (blurBehindWindowEnabled)
// window.backgroundVisible = false
window.show()
}
}
/* FluRemoteLoader {
id: loader
anchors.fill: parent
source: "file:///D:\\Courses\\Qt\\AicsKnowledgeBase_client\\AicsKnowledgeBase\\qml\\LoginPage.qml"
}*/
LoginPage {
anchors.fill: parent
}
}

View File

@ -1,28 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
FluArea{
Layout.fillWidth: true
height: 68
Layout.topMargin: 20
paddings: 10
FluFilledButton{
disabled:filled_button_switch.checked
text:"Filled Button"
onClicked: {}
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
}
}
}

View File

@ -28,7 +28,7 @@ int main(int argc, char* argv[])
QQmlApplicationEngine engine;
FramelessHelper::Quick::registerTypes(&engine);
const QUrl url(u"qrc:/AicsKnowledgeBase/qml/LoginPage.qml"_qs);
const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject* obj, const QUrl& objUrl) {
if (!obj && url == objUrl)
@ -37,21 +37,3 @@ int main(int argc, char* argv[])
engine.load(url);
return app.exec();
}
//int main(int argc, char *argv[])
//{
// QGuiApplication app(argc, argv);
//
// QQmlApplicationEngine engine;
// const QUrl url(u"qrc:/AicsKnowledgeBase/main.qml"_qs);
// QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
// &app, [url](QObject *obj, const QUrl &objUrl) {
// if (!obj && url == objUrl)
// QCoreApplication::exit(-1);
// }, Qt::QueuedConnection);
// engine.load(url);
//
// return app.exec();
//}