完善登录页

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
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 anchors.fill: parent
Item{
Rectangle {
id: introdutcitonItem id: introdutcitonItem
height: parent.height height: parent.height
width: parent.width * 0.5 width: parent.width * 0.5
color: "#f3fbff"
//color: "transparent"
Image { Image {
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: "qrc:/AicsKnowledgeBase/res/login_background.webp" source: "qrc:/AicsKnowledgeBase/res/login_background.webp"
}
}
} ColumnLayout {
} id: loginRect
Item{
id: loginItem
height: parent.height
width: parent.width * 0.5 width: parent.width * 0.5
FluPivot{ height: parent.height
anchors.fill: parent FluPivot {
anchors.margins: 20 id: loginItem
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Layout.margins: 20
height: 200
FluPivotItem{
title: "Sign in" FluPivotItem {
contentItem:Column{ title: "登录"
anchors.fill: parent
anchors.margins: 20 contentItem: Column {
anchors.centerIn: parent anchors.margins: {
top: 10
}
anchors.top: parent.top
spacing: 12 spacing: 12
FluTextBox{
placeholderText: "Account" FluTextBox {
anchors.left: parent.left
anchors.right: parent.right
id: account id: account
placeholderText: "用户名"
} }
FluPasswordBox{ FluPasswordBox {
placeholderText: "Password" anchors.left: parent.left
anchors.right: parent.right
id: password id: password
placeholderText: "密码"
} }
Row{ RowLayout {
spacing: 25 anchors.left: parent.left
FluCheckBox{ anchors.right: parent.right
text: "Remember me" FluCheckBox {
Layout.alignment: Qt.AlignLeft
//anchors.left: parent.left
text: "记住密码"
} }
FluTextButton{ FluTextButton {
text: "Forgot your password?" Layout.alignment: Qt.AlignRight
//anchors.right: parent.right
text: "忘记密码?"
} }
} }
FluFilledButton{ FluFilledButton {
text: "Sign in"
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
normalColor: "green" normalColor: "green"
text: "登录"
}
}
}
FluPivotItem {
title: "注册"
// Rectangle{
// anchors.fill: parent
// color: "blue"
// }
}
}
} }
}
}
FluPivotItem{
title: "Register"
// Rectangle{
// 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();
//}