unigui 登陆界面

  • 新建项目,因为我的Main页面做了其他的东西,所以我在这里新建一个form

File -> New -> From(Unigui) -> 登录窗体

  • 添加组件:FDConnection,FDQuery,DataSource,Unipanel和几个uniedit,一个unibutton

首先连接数据库:FDConnection1 -> Connection Editor

Database:数据库名称

User_Name:用户名

PassWord:用户名的密码

Server:服务器,其中127.0.0.1默认为本地

点击Connection1的属性active,当active显示为true数据库连接成功

然后,FDQuery1 -> Connection -> FDConnection1

最后,DataSource -> DataSet -> FDQuery1

  • 为输入账号的Uniedit1设置FieldLabel属性为用户名: ,同理将输入密码的UniEdit2设为密码:

MD5加密可看文章:MD5加密-CSDN博客

Delphi 复制代码
procedure TUniLoginForm1.UniButton1Click(Sender: TObject);
begin
  FDQuery1.Close;
  try
  FDQuery1.SQL.Text:='select * from logon where id=:aid and passwords=:apasswords';
  FDQuery1.Params.ParamByName('aid').Value:=uniedit1.Text;
  FDQuery1.Params.ParamByName('apasswords').Value:=THashMD5.GetHashString(uniedit2.Text);
  FDQuery1.open;
  finally
  end;
  if uniedit3.text <> captchastring then
  begin
    showmessage('验证码错误');
    uniimage1click(sender);
  end
  else if FDQuery1.RecordCount<1 then
  begin
    showmessage('账号或密码错误!');
  end else
    messagebox(Handle,'登陆成功!','成功',MB_OK);

end;

我的数据库登录表的结构是在wldy数据库中创建logon表

sql 复制代码
use wldy
create table logon
(
id int primary key,
passwords varchar(255)
)
  • 将form设为和浏览器大小相同,并且Unipanel永远在浏览器的中心
Delphi 复制代码
procedure TUniLoginForm1.UniLoginFormScreenResize(Sender: TObject; AWidth,
  AHeight: Integer);
begin
  uniloginform1.Height:=AHeight;
  uniloginform1.Width:=AWidth; //设form和浏览器一个大小
  unipanel1.Left:=(AWidth - unipanel1.width ) div 2;
  unipanel1.Top:=((AHeight - unipanel1.Height) div 2)+12; //unipanel在浏览器的中间
end;
  • 将unipanel1设为圆角

在serverModule中CustomCSS中输入变圆角的代码,其中paneladd是名称,点击确定

css 复制代码
.paneladd {
  border-radius: 10px; /* 设置内容区域的圆角半径为10px */
}

回到页面中,UniPanel1 -> LayoutConfig -> Cls -> 添加paneladd

  • 添加unipanel。点击unipanel1,添加一个unipanel,这样能够使新添加的unipanel是unipanel1的子类
相关推荐
BillKu1 天前
在 Delphi 5 中获取 Word 文档页数的方法
word·delphi
BillKu4 天前
Delphi 5 中操作 Word 表格时禁用鼠标交互
word·delphi
看那山瞧那水5 天前
DELPHI 利用OpenSSL实现加解密,证书(X.509)等功能
delphi·openssl
lincats14 天前
一步一步学习使用FireMonkey动画(6) 用实例理解动画的运行状态
ide·delphi·livebindings·delphi 12.3·firemonkey
lincats15 天前
一步一步学习使用FireMonkey动画(3) 使用Delphi的基本动画组件类
ide·delphi·delphi 12.3·firemonkey
lincats16 天前
一步一步学习使用FireMonkey动画(1) 使用动画组件为窗体添加动态效果
android·ide·delphi·livebindings·delphi 12.3·firemonkey
lincats20 天前
一步一步学习使用LiveBindings(16)使用代码创建LiveBindings绑定
delphi·livebindings·delphi 12.3·firedac·firemonkey
lincats23 天前
一步一步学习使用LiveBindings(14)TListView进阶使用(2),打造天气预报程序
delphi·livebindings·delphi 12.3·firedac·firemonkey·tlistview
lincats24 天前
一步一步学习使用LiveBindings(13) TListView的进阶使用(1)
delphi·livebindings·delphi 12.3·firemonkey·tlistview
lincats25 天前
一步一步学习使用LiveBindings(12) LiveBindings与具有动态呈现的TListView
delphi·livebindings·delphi 12.3·firemonkey