2025-06-07 10:45:09 +08:00
|
|
|
from PySide6.QtWidgets import (
|
|
|
|
|
QWidget, QLabel, QLineEdit, QPushButton, QComboBox, QGridLayout, QHBoxLayout, QVBoxLayout
|
|
|
|
|
)
|
|
|
|
|
from PySide6.QtGui import QFont
|
|
|
|
|
from PySide6.QtCore import Qt
|
|
|
|
|
|
|
|
|
|
class LoginUI(QWidget):
|
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
|
super().__init__(parent)
|
|
|
|
|
self.setWindowTitle("用户登录")
|
|
|
|
|
self.resize(350, 220)
|
|
|
|
|
self.init_ui()
|
|
|
|
|
|
|
|
|
|
def init_ui(self):
|
|
|
|
|
font_title = QFont("微软雅黑", 18, QFont.Bold)
|
|
|
|
|
font_label = QFont("微软雅黑", 12)
|
|
|
|
|
font_input = QFont("微软雅黑", 12)
|
|
|
|
|
font_version = QFont("微软雅黑", 8)
|
|
|
|
|
|
|
|
|
|
# 标题
|
2025-07-01 15:32:40 +08:00
|
|
|
self.label_title = QLabel("MES管理系统")
|
2025-06-07 10:45:09 +08:00
|
|
|
self.label_title.setFont(font_title)
|
|
|
|
|
self.label_title.setStyleSheet("color: #1a237e;")
|
|
|
|
|
self.label_title.setAlignment(Qt.AlignCenter)
|
|
|
|
|
self.label_title.setFixedHeight(40)
|
|
|
|
|
|
|
|
|
|
# 工号
|
|
|
|
|
self.label_user = QLabel("工号:")
|
|
|
|
|
self.label_user.setFont(font_label)
|
|
|
|
|
self.label_user.setFixedWidth(50)
|
|
|
|
|
self.edit_user = QLineEdit()
|
|
|
|
|
self.edit_user.setFont(font_input)
|
|
|
|
|
self.edit_user.setFixedHeight(28)
|
|
|
|
|
|
|
|
|
|
# 密码
|
|
|
|
|
self.label_pwd = QLabel("密码:")
|
|
|
|
|
self.label_pwd.setFont(font_label)
|
|
|
|
|
self.label_pwd.setFixedWidth(50)
|
|
|
|
|
self.edit_pwd = QLineEdit()
|
|
|
|
|
self.edit_pwd.setFont(font_input)
|
|
|
|
|
self.edit_pwd.setEchoMode(QLineEdit.Password)
|
|
|
|
|
self.edit_pwd.setFixedHeight(28)
|
|
|
|
|
|
|
|
|
|
# 按钮
|
|
|
|
|
self.btn_login = QPushButton("登陆")
|
|
|
|
|
self.btn_close = QPushButton("关闭")
|
|
|
|
|
self.btn_login.setFixedWidth(90)
|
|
|
|
|
self.btn_close.setFixedWidth(90)
|
|
|
|
|
self.btn_login.setFixedHeight(30)
|
|
|
|
|
self.btn_close.setFixedHeight(30)
|
|
|
|
|
|
|
|
|
|
btn_layout = QHBoxLayout()
|
|
|
|
|
btn_layout.addStretch(1)
|
|
|
|
|
btn_layout.addWidget(self.btn_login)
|
|
|
|
|
btn_layout.addSpacing(30)
|
|
|
|
|
btn_layout.addWidget(self.btn_close)
|
|
|
|
|
btn_layout.addStretch(1)
|
|
|
|
|
|
|
|
|
|
# 版本标签
|
|
|
|
|
self.version_label = QLabel("版本: 1.0.0")
|
|
|
|
|
self.version_label.setFont(font_version)
|
|
|
|
|
self.version_label.setStyleSheet("color: #666666;")
|
|
|
|
|
self.version_label.setAlignment(Qt.AlignRight)
|
|
|
|
|
|
|
|
|
|
# 表单布局
|
|
|
|
|
form_layout = QGridLayout()
|
|
|
|
|
form_layout.setHorizontalSpacing(10)
|
|
|
|
|
form_layout.setVerticalSpacing(18)
|
|
|
|
|
form_layout.addWidget(self.label_user, 1, 0)
|
|
|
|
|
form_layout.addWidget(self.edit_user, 1, 1)
|
|
|
|
|
form_layout.addWidget(self.label_pwd, 2, 0)
|
|
|
|
|
form_layout.addWidget(self.edit_pwd, 2, 1)
|
|
|
|
|
|
|
|
|
|
# 主布局
|
|
|
|
|
main_layout = QVBoxLayout()
|
|
|
|
|
main_layout.addSpacing(8)
|
|
|
|
|
main_layout.addWidget(self.label_title)
|
|
|
|
|
main_layout.addSpacing(5)
|
|
|
|
|
main_layout.addLayout(form_layout)
|
|
|
|
|
main_layout.addSpacing(10)
|
|
|
|
|
main_layout.addLayout(btn_layout)
|
|
|
|
|
main_layout.addStretch(1)
|
|
|
|
|
main_layout.addWidget(self.version_label)
|
|
|
|
|
main_layout.addSpacing(5)
|
|
|
|
|
self.setLayout(main_layout)
|