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的子类
相关推荐
lincats2 天前
一步一步学习使用LiveBindings(14)TListView进阶使用(2),打造天气预报程序
delphi·livebindings·delphi 12.3·firedac·firemonkey·tlistview
lincats4 天前
一步一步学习使用LiveBindings(13) TListView的进阶使用(1)
delphi·livebindings·delphi 12.3·firemonkey·tlistview
lincats5 天前
一步一步学习使用LiveBindings(12) LiveBindings与具有动态呈现的TListView
delphi·livebindings·delphi 12.3·firemonkey
chilavert3186 天前
技术演进中的开发沉思-62 DELPHI VCL系列:VCL下的设计模式
开发语言·delphi
lincats7 天前
一步一步学习使用LiveBindings(11) 绑定到自定义外观的ListBox
list·delphi·delphi 12.3·firedac·firemonkey·tlistview
lincats8 天前
# 一步一步学习使用LiveBindings(10) LiveBindings绑定到漂亮的TCombobox
ide·delphi·livebindings·delphi 12.3
lincats9 天前
一步一步学习使用LiveBindings(9) LiveBindings图像绑定与自定义绑定方法(2)
delphi·livebindings·delphi 12.3·firedac·firemonkey
lincats11 天前
一步一步学习使用LiveBindings(8) 使用向导创建用户界面,绑定格式化入门
delphi·livebindings·delphi 12.3·firedac·firemonkey
lincats14 天前
一步一步学习使用LiveBindings(7) 实现对JSON数据的绑定
android·delphi·livebindings·delphi 12.3·firedac
lincats15 天前
一步一步学习使用LiveBindings(6) 实现Master-Detail主从关系的绑定
delphi·livebindings·delphi 12.3·firedac·firemonkey