完善登录页

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 # Fody - auto-generated XML schema
FodyWeavers.xsd 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,124 +5,88 @@ import QtQuick.Window
import QtQuick.Layouts import QtQuick.Layouts
import org.wangwenx190.FramelessHelper import org.wangwenx190.FramelessHelper
FluWindow{ Row {
width: 640 anchors.fill: parent
height: 480
visible: true
title: qsTr("Hello World")
color: "transparent"
property alias titleVisible: title_bar.titleVisible Rectangle {
property bool appBarVisible: true id: introdutcitonItem
height: parent.height
width: parent.width * 0.5
color: "#f3fbff"
FluAppBar { //color: "transparent"
id: title_bar Image {
title: window.title anchors.fill: parent
visible: window.appBarVisible fillMode: Image.PreserveAspectFit
anchors { source: "qrc:/AicsKnowledgeBase/res/login_background.webp"
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){ ColumnLayout {
framless_helper.setTitleBarItem(com) id: loginRect
} width: parent.width * 0.5
Row{ height: parent.height
anchors.fill: parent FluPivot {
Item{
id: introdutcitonItem
height: parent.height
width: parent.width * 0.5
Image {
anchors.fill: parent
source: "qrc:/AicsKnowledgeBase/res/login_background.webp"
}
}
Item{
id: loginItem id: loginItem
height: parent.height Layout.fillWidth: true
width: parent.width * 0.5 Layout.alignment: Qt.AlignVCenter
FluPivot{ Layout.margins: 20
anchors.fill: parent height: 200
anchors.margins: 20
FluPivotItem{
title: "Sign in"
contentItem:Column{
anchors.fill: parent
anchors.margins: 20
anchors.centerIn: parent
spacing: 12
FluTextBox{ FluPivotItem {
placeholderText: "Account" title: "登录"
id: account
contentItem: Column {
anchors.margins: {
top: 10
}
anchors.top: parent.top
spacing: 12
FluTextBox {
anchors.left: parent.left
anchors.right: parent.right
id: account
placeholderText: "用户名"
}
FluPasswordBox {
anchors.left: parent.left
anchors.right: parent.right
id: password
placeholderText: "密码"
}
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
FluCheckBox {
Layout.alignment: Qt.AlignLeft
//anchors.left: parent.left
text: "记住密码"
} }
FluPasswordBox{ FluTextButton {
placeholderText: "Password" Layout.alignment: Qt.AlignRight
id: password //anchors.right: parent.right
text: "忘记密码?"
} }
Row{ }
spacing: 25 FluFilledButton {
FluCheckBox{ anchors.horizontalCenter: parent.horizontalCenter
text: "Remember me" normalColor: "green"
} text: "登录"
FluTextButton{
text: "Forgot your password?"
}
}
FluFilledButton{
text: "Sign in"
anchors.horizontalCenter: parent.horizontalCenter
normalColor: "green"
}
} }
} }
FluPivotItem{ }
title: "Register" FluPivotItem {
// Rectangle{ title: "注册"
// anchors.fill: parent // Rectangle{
// color: "blue" // anchors.fill: parent
// } // color: "blue"
} // }
} }
} }
} }
} }

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; QQmlApplicationEngine engine;
FramelessHelper::Quick::registerTypes(&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, QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject* obj, const QUrl& objUrl) { &app, [url](QObject* obj, const QUrl& objUrl) {
if (!obj && url == objUrl) if (!obj && url == objUrl)
@ -37,21 +37,3 @@ int main(int argc, char* argv[])
engine.load(url); engine.load(url);
return app.exec(); 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();
//}