AicsKnowledgeBase_client/AicsKnowledgeBase/qml/LoginWindow.qml

144 lines
5.9 KiB
QML
Raw Normal View History

2023-06-21 21:33:52 +08:00
import QtQuick
import FluentUI
import QtQuick.Controls
import QtQuick.Window
import QtQuick.Layouts
import org.wangwenx190.FramelessHelper
2023-06-30 18:37:17 +08:00
import "qrc:///AicsKnowledgeBase/qml/global"
2023-06-21 21:33:52 +08:00
AppFluWindow {
id: window
height: 420
title: "智能客服知识库"
width: 640
Row {
anchors.fill: parent
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"
}
}
2023-07-01 15:01:36 +08:00
Rectangle {
2023-06-21 21:33:52 +08:00
width: parent.width * 0.5
height: parent.height
2023-06-30 18:37:17 +08:00
color: "#f3f3f3"
2023-06-21 21:33:52 +08:00
ColumnLayout {
id: loginRect
anchors.fill: parent
FluPivot {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Layout.margins: 20
height: 200
FluPivotItem {
id: loginItem
title: "登录"
function login(s) {
showSuccess(s)
}
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: "记住密码"
}
FluTextButton {
Layout.alignment: Qt.AlignRight
//anchors.right: parent.right
text: "忘记密码?"
}
}
FluFilledButton {
2023-07-02 15:58:02 +08:00
id: btn_login
2023-06-21 21:33:52 +08:00
anchors.horizontalCenter: parent.horizontalCenter
//normalColor: FluColors.Green.normal
//normalColor: "#ffffff"
text: "登录"
onClicked: {
2023-07-01 15:01:36 +08:00
var param = {
2023-07-06 14:00:27 +08:00
"username": "admin",
"password": "123456"
2023-06-30 18:37:17 +08:00
}
2023-07-02 15:58:02 +08:00
btn_login.disabled = true
btn_login.text = "登录中"
2023-07-01 15:01:36 +08:00
Request.post("login",
JSON.stringify(param),
function (result, data) {
console.log(result)
console.log(data)
UserData.username = param.username
2023-07-06 21:40:07 +08:00
Request.get("user",
function (res, data) {
console.log("userId:")
console.log(data.id)
UserData.userId = data.id
})
2023-07-01 15:01:36 +08:00
FluApp.navigate("/")
window.close()
}, function (p1, p2) {
console.log(p1)
console.log(p2)
2023-07-05 21:14:33 +08:00
//FluApp.navigate("/")
//window.close()
2023-07-02 15:58:02 +08:00
btn_login.disabled = false
btn_login.text = "登录"
2023-07-01 15:01:36 +08:00
})
2023-06-30 18:37:17 +08:00
2023-06-21 21:33:52 +08:00
//HttpClient.doGetRequest(
// "https://quic.aiortc.org/",
// loginItem, "login")
}
}
}
}
2023-06-30 18:37:17 +08:00
// FluPivotItem {
// title: "注册"
// Rectangle{
// anchors.fill: parent
// color: "blue"
// }
2023-06-21 21:33:52 +08:00
//}
}
}
}
}
}