|
|
@@ -2,6 +2,7 @@ import QtQuick
|
|
|
import QtQuick.Layouts
|
|
|
import QtQuick.Controls
|
|
|
import "./components"
|
|
|
+import Loto
|
|
|
|
|
|
Rectangle {
|
|
|
id: control
|
|
|
@@ -15,12 +16,92 @@ Rectangle {
|
|
|
property string userType: "操作员"
|
|
|
property string userGroup: "电气维护组"
|
|
|
|
|
|
+ function showUpdatePasswordDialog(cancelCallbackFunc, confirmCallbackFunc) {
|
|
|
+ var component = Qt.createComponent("components/UpdatePasswordDialog.qml");
|
|
|
+ if (component.status === Component.Ready) {
|
|
|
+ // 创建实例并添加到场景中
|
|
|
+ var alertDialogComp = component.createObject(appAlertDialog);
|
|
|
+ alertDialogComp.parent = appAlertDialog; // 将提示对话框挂载在appAlterDialog Loader加载器上
|
|
|
+ // 处理提示对话框的事件
|
|
|
+ alertDialogComp.cancel.connect(function () { cancelCallbackFunc(alertDialogComp); });
|
|
|
+ alertDialogComp.confirm.connect(function (oldValue, newValue) { confirmCallbackFunc(alertDialogComp, oldValue, newValue); });
|
|
|
+ } else {
|
|
|
+ console.log("Error loading component:", component.errorString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function negativeDialogCallback(componentObj) {
|
|
|
+ componentObj.visible = false;
|
|
|
+ appAlertDialog.sourceComponent = null;
|
|
|
+ componentObj.destroy();
|
|
|
+ }
|
|
|
+
|
|
|
+ function opsitiveDialogCallbac(componentObj, oldValue, newValue) {
|
|
|
+ componentObj.visible = false;
|
|
|
+ httpUpdateUserPassword.oldPassword = oldValue;
|
|
|
+ httpUpdateUserPassword.newPassword = newValue;
|
|
|
+ httpUpdateUserPassword.start();
|
|
|
+ componentObj.destroy();
|
|
|
+ }
|
|
|
+
|
|
|
+ function showAlertDialog(msgTypeName, msgValue, msgIconChar, callbackFunc) {
|
|
|
+ var component = Qt.createComponent("components/AlertDialog.qml");
|
|
|
+ if (component.status === Component.Ready) {
|
|
|
+ // 创建实例并添加到场景中
|
|
|
+ var alertDialogComp = component.createObject(appAlertDialog, {
|
|
|
+ messageTypeName: msgTypeName,
|
|
|
+ messageValue: msgValue,
|
|
|
+ messageIconCharacter: msgIconChar
|
|
|
+ });
|
|
|
+ alertDialogComp.parent = appAlertDialog; // 将提示对话框挂载在appAlterDialog Loader加载器上
|
|
|
+ // 处理提示对话框的事件
|
|
|
+ alertDialogComp.confirm.connect(function () { callbackFunc(alertDialogComp); });
|
|
|
+ } else {
|
|
|
+ console.log("Error loading component:", component.errorString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function negativeAlertDialogCallback(componentObj) {
|
|
|
+ componentObj.visible = false;
|
|
|
+ appAlertDialog.sourceComponent = null;
|
|
|
+ componentObj.destroy();
|
|
|
+ }
|
|
|
+
|
|
|
+ function opsitiveAlertDialogCallback(componentObj) {
|
|
|
+ negativeAlertDialogCallback(componentObj);
|
|
|
+ }
|
|
|
+
|
|
|
+ HttpUpdateUserPassword {
|
|
|
+ id: httpUpdateUserPassword
|
|
|
+
|
|
|
+ Component.onCompleted: {
|
|
|
+ httpUpdateUserPassword.signalPutRequestData.connect(httpClientThread.slotPutRequestData);
|
|
|
+ httpClientThread.signalReponseUpdateUserPasswordUrl.connect(httpUpdateUserPassword.slotHttpResponseUpdatePassword);
|
|
|
+ }
|
|
|
+
|
|
|
+ Component.onDestruction: {
|
|
|
+ httpUpdateUserPassword.signalPutRequestData.disconnect(httpClientThread.slotPutRequestData);
|
|
|
+ httpClientThread.signalReponseUpdateUserPasswordUrl.disconnect(httpUpdateUserPassword.slotHttpResponseUpdatePassword);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Connections {
|
|
|
+ target: httpUpdateUserPassword
|
|
|
+ function onSignalUpdatePasswordReturnStat(stat, msg) {
|
|
|
+ if (stat !== 0) {
|
|
|
+ showAlertDialog("提示", msg, "\uf071", negativeAlertDialogCallback);
|
|
|
+ } else {
|
|
|
+ showAlertDialog("成功", msg, "\uf058", opsitiveAlertDialogCallback);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Rectangle {
|
|
|
id: __container
|
|
|
x: 260
|
|
|
y: 140
|
|
|
width: 1400
|
|
|
- height: 940
|
|
|
+ height: 935
|
|
|
|
|
|
color: "#0A1929"
|
|
|
radius: 16
|
|
|
@@ -44,7 +125,7 @@ Rectangle {
|
|
|
|
|
|
AvatarCard {
|
|
|
id: __userAvatar
|
|
|
- userName: userName
|
|
|
+ usernameImage: UserInfoModel.avatar
|
|
|
}
|
|
|
|
|
|
Rectangle {
|
|
|
@@ -55,11 +136,12 @@ Rectangle {
|
|
|
Text {
|
|
|
id: __userNameLabel
|
|
|
anchors.top: parent.top
|
|
|
+ anchors.topMargin: 10
|
|
|
anchors.left: parent.left
|
|
|
- text: qsTr(userName)
|
|
|
+ text: qsTr(UserInfoModel.nickname)
|
|
|
opacity: 1
|
|
|
color: "white"
|
|
|
- font.pixelSize: 44
|
|
|
+ font.pixelSize: 32
|
|
|
font.bold: true
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutCubic } }
|
|
|
@@ -69,27 +151,40 @@ Rectangle {
|
|
|
id: __userGroupBtn
|
|
|
height: 36
|
|
|
anchors.top: __userNameLabel.bottom
|
|
|
- anchors.topMargin: 10
|
|
|
+ anchors.topMargin: 30
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
buttonColor: "#1A40A9FF"
|
|
|
btnHoverEanabled: false
|
|
|
btnRadius: 10
|
|
|
|
|
|
- text: qsTr(userType)
|
|
|
+ // text: qsTr(userType)
|
|
|
textColor: "#40A9FF"
|
|
|
|
|
|
cancelMouseArea: true
|
|
|
+
|
|
|
+ Component.onCompleted: {
|
|
|
+ var userGroupName;
|
|
|
+ var roles = JSON.parse(UserInfoModel.roles)["roles"];
|
|
|
+ for (var i = 0; i < roles.length; i++) {
|
|
|
+ if (i === 0) {
|
|
|
+ userGroupName = roles[i].name;
|
|
|
+ } else {
|
|
|
+ userGroupName = userGroupName + "," + roles[i].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ __userGroupBtn.text = qsTr(userGroupName);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Text {
|
|
|
id: __emptyLabel
|
|
|
anchors.top: __userNameLabel.bottom
|
|
|
- anchors.topMargin: 10
|
|
|
+ anchors.topMargin: 30
|
|
|
anchors.left: __userGroupBtn.right
|
|
|
anchors.leftMargin: 10
|
|
|
anchors.verticalCenter: __userGroupBtn.verticalCenter
|
|
|
- text: qsTr("用户: ")
|
|
|
+ text: qsTr("公司/部门: ")
|
|
|
opacity: 1
|
|
|
color: "white"
|
|
|
font.pixelSize: 16
|
|
|
@@ -101,17 +196,21 @@ Rectangle {
|
|
|
Text {
|
|
|
id: __userGroupLabel
|
|
|
anchors.top: __userNameLabel.bottom
|
|
|
- anchors.topMargin: 10
|
|
|
+ anchors.topMargin: 30
|
|
|
anchors.left: __emptyLabel.right
|
|
|
anchors.leftMargin: 0
|
|
|
anchors.verticalCenter: __userGroupBtn.verticalCenter
|
|
|
- text: qsTr(userGroup)
|
|
|
+ // text: qsTr(userGroup)
|
|
|
opacity: 1
|
|
|
color: "#40A9FF"
|
|
|
font.pixelSize: 16
|
|
|
font.bold: true
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutCubic } }
|
|
|
+
|
|
|
+ Component.onCompleted: {
|
|
|
+ __userGroupLabel.text = qsTr(JSON.parse(UserInfoModel.dept)["dept"].name);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -142,17 +241,16 @@ Rectangle {
|
|
|
clip: true
|
|
|
|
|
|
contentWidth: width
|
|
|
- contentHeight: 1900
|
|
|
+ contentHeight: contentCol.implicitHeight
|
|
|
|
|
|
- // TODO: 插槽,填充设置表单
|
|
|
ColumnLayout {
|
|
|
id: contentCol
|
|
|
anchors.fill: parent
|
|
|
- spacing: 20
|
|
|
+ spacing: 15
|
|
|
|
|
|
UserInfoCard {
|
|
|
id: user2
|
|
|
- height: 300
|
|
|
+ height: 180
|
|
|
|
|
|
infoTypeName: "账号安全"
|
|
|
infoTypeNameIconCharactor: "\uf3ed"
|
|
|
@@ -162,29 +260,32 @@ Rectangle {
|
|
|
spacing: 10
|
|
|
|
|
|
SettingFormCard {
|
|
|
- id: setting3
|
|
|
+ id: settingPassword
|
|
|
width: parent.width
|
|
|
|
|
|
+ showUnderline: false
|
|
|
+
|
|
|
settingTypeName: "修改密码"
|
|
|
settingValue: "建议定期更换密码"
|
|
|
settingTypeNameIconCharactor: "\uf084"
|
|
|
|
|
|
iconColor: "#FFA500"
|
|
|
iconBgColor: "#1AFFA500"
|
|
|
- }
|
|
|
|
|
|
- MInput {
|
|
|
- id: message1
|
|
|
+ MouseArea {
|
|
|
+ anchors.fill: parent
|
|
|
|
|
|
- passwordVisible: true
|
|
|
- passwordField: true
|
|
|
+ onClicked: {
|
|
|
+ showUpdatePasswordDialog(control.negativeDialogCallback, control.opsitiveDialogCallbac);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
UserInfoCard {
|
|
|
id: user1
|
|
|
- height: 300
|
|
|
+ height: 390
|
|
|
|
|
|
infoTypeName: "个人信息"
|
|
|
infoTypeNameIconCharactor: "\uf007"
|
|
|
@@ -194,120 +295,38 @@ Rectangle {
|
|
|
spacing: 10
|
|
|
|
|
|
SettingFormCard {
|
|
|
- id: setting1
|
|
|
- width: parent.width
|
|
|
- }
|
|
|
- SettingFormCard {
|
|
|
- id: setting2
|
|
|
+ id: settingName
|
|
|
width: parent.width
|
|
|
|
|
|
- settingTypeName: "头像"
|
|
|
- settingValue: "点击更换头像"
|
|
|
- settingTypeNameIconCharactor: "\uf030"
|
|
|
+ settingTypeName: "姓名"
|
|
|
+ settingTypeNameIconCharactor: "\uf007"
|
|
|
+ settingValue: UserInfoModel.nickname
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- UserInfoCard {
|
|
|
- id: user3
|
|
|
- height: 300
|
|
|
-
|
|
|
- infoTypeName: "个人信息"
|
|
|
- infoTypeNameIconCharactor: "\uf007"
|
|
|
-
|
|
|
- content: ColumnLayout {
|
|
|
- width: parent.width
|
|
|
- spacing: 10
|
|
|
-
|
|
|
SettingFormCard {
|
|
|
- id: setting5
|
|
|
+ id: settingPhone
|
|
|
width: parent.width
|
|
|
- }
|
|
|
- SettingFormCard {
|
|
|
- id: setting6
|
|
|
- width: parent.width
|
|
|
-
|
|
|
- settingTypeName: "头像"
|
|
|
- settingValue: "点击更换头像"
|
|
|
- settingTypeNameIconCharactor: "\uf030"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- UserInfoCard {
|
|
|
- id: user4
|
|
|
- height: 300
|
|
|
-
|
|
|
- infoTypeName: "个人信息"
|
|
|
- infoTypeNameIconCharactor: "\uf007"
|
|
|
-
|
|
|
- content: ColumnLayout {
|
|
|
- width: parent.width
|
|
|
- spacing: 10
|
|
|
-
|
|
|
- SettingFormCard {
|
|
|
- id: setting7
|
|
|
- width: parent.width
|
|
|
- }
|
|
|
- SettingFormCard {
|
|
|
- id: setting8
|
|
|
- width: parent.width
|
|
|
-
|
|
|
- settingTypeName: "头像"
|
|
|
- settingValue: "点击更换头像"
|
|
|
- settingTypeNameIconCharactor: "\uf030"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- UserInfoCard {
|
|
|
- id: user5
|
|
|
- height: 300
|
|
|
-
|
|
|
- infoTypeName: "个人信息"
|
|
|
- infoTypeNameIconCharactor: "\uf007"
|
|
|
-
|
|
|
- content: ColumnLayout {
|
|
|
- width: parent.width
|
|
|
- spacing: 10
|
|
|
-
|
|
|
- SettingFormCard {
|
|
|
- id: setting9
|
|
|
- width: parent.width
|
|
|
+ settingTypeName: "手机号"
|
|
|
+ settingValue: UserInfoModel.mobile
|
|
|
+ settingTypeNameIconCharactor: "\uf3cd"
|
|
|
}
|
|
|
SettingFormCard {
|
|
|
- id: setting10
|
|
|
+ id: settingEmail
|
|
|
width: parent.width
|
|
|
|
|
|
- settingTypeName: "头像"
|
|
|
- settingValue: "点击更换头像"
|
|
|
- settingTypeNameIconCharactor: "\uf030"
|
|
|
+ settingTypeName: "邮箱"
|
|
|
+ settingValue: UserInfoModel.email
|
|
|
+ settingTypeNameIconCharactor: "\uf0e0"
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- UserInfoCard {
|
|
|
- id: user6
|
|
|
- height: 300
|
|
|
-
|
|
|
- infoTypeName: "个人信息"
|
|
|
- infoTypeNameIconCharactor: "\uf007"
|
|
|
-
|
|
|
- content: ColumnLayout {
|
|
|
- width: parent.width
|
|
|
- spacing: 10
|
|
|
-
|
|
|
- SettingFormCard {
|
|
|
- id: setting11
|
|
|
- width: parent.width
|
|
|
- }
|
|
|
SettingFormCard {
|
|
|
- id: setting21
|
|
|
+ id: settingSex
|
|
|
width: parent.width
|
|
|
|
|
|
- settingTypeName: "头像"
|
|
|
- settingValue: "点击更换头像"
|
|
|
- settingTypeNameIconCharactor: "\uf030"
|
|
|
+ showUnderline: false
|
|
|
+ settingTypeName: "性别"
|
|
|
+ settingValue: UserInfoModel.sex === 0 ? "男" : "女"
|
|
|
+ settingTypeNameIconCharactor: "\uf228"
|
|
|
}
|
|
|
}
|
|
|
}
|