网站虚拟主持人,8个页面的网站怎么做,外贸网站模版,可以自己做网站卖东西新建项目#xff0c;因为我的Main页面做了其他的东西#xff0c;所以我在这里新建一个form
File - New - From(Unigui) - 登录窗体
添加组件#xff1a;FDConnection#xff0c;FDQuery#xff0c;DataSource#xff0c;Unipanel和几个uniedit#xff0c;…新建项目因为我的Main页面做了其他的东西所以我在这里新建一个form
File - New - From(Unigui) - 登录窗体
添加组件FDConnectionFDQueryDataSourceUnipanel和几个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设为密码 添加验证码可见文章unigui 图形验证码-CSDN博客为按钮UniButton1添加登录事件,其中这段代码中为密码做了MD5加密处理
MD5加密可看文章MD5加密-CSDN博客
procedure TUniLoginForm1.UniButton1Click(Sender: TObject);
beginFDQuery1.Close;tryFDQuery1.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;finallyend;if uniedit3.text captchastring thenbeginshowmessage(验证码错误);uniimage1click(sender);endelse if FDQuery1.RecordCount1 thenbeginshowmessage(账号或密码错误);end elsemessagebox(Handle,登陆成功,成功,MB_OK);end;
我的数据库登录表的结构是在wldy数据库中创建logon表
use wldy
create table logon
(
id int primary key,
passwords varchar(255)
)
将form设为和浏览器大小相同并且Unipanel永远在浏览器的中心
procedure TUniLoginForm1.UniLoginFormScreenResize(Sender: TObject; AWidth,AHeight: Integer);
beginuniloginform1.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是名称点击确定 .paneladd {border-radius: 10px; /* 设置内容区域的圆角半径为10px */
}
回到页面中UniPanel1 - LayoutConfig - Cls - 添加paneladd 添加unipanel。点击unipanel1添加一个unipanel这样能够使新添加的unipanel是unipanel1的子类