📄 jglogin.pas
字号:
unit JGLogin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Mask, AppEvnts, SOAPHTTPTrans;
type
TJGLoginGL = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Panel2: TPanel;
Label3: TLabel;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Lab_2: TLabel;
Edit2: TEdit;
Button3: TButton;
ApplicationEvents1: TApplicationEvents;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Button3Click(Sender: TObject);
procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);
private
{ Private declarations }
bXsIp: boolean;
public
{ Public declarations }
end;
var
JGLoginGL: TJGLoginGL;
implementation
{$R *.dfm}
uses UserFace, DataModule, JGLRIntf;
procedure TJGLoginGL.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TJGLoginGL.FormCreate(Sender: TObject);
begin
bXsIp := false;
Edit1.Text := ConnectServerIp(INISYSTEMTYPE);
Edit2.Text := ConnectServerPort(INISYSTEMTYPE);
panel1.Visible := false;
panel2.Top := Panel2.Top - 46;
button1.Top := button1.Top - 46;
button2.Top := button2.Top - 46;
button3.Top := button3.Top - 46;
self.Height := self.Height - 46;
// if (trim(Edit1.Text)='') then
// Button1.Enabled := False;
end;
procedure TJGLoginGL.Button1Click(Sender: TObject);
var
aIntf: IJGLR;
iret: longint;
vIP, vPort, rPort: string;
begin
if TestIp(Edit1) = false then
begin
showmessage('IP地址错误,请重新设置!');
//Edit1.SetFocus;
exit;
end;
// UseGat:= ReadIniInt(SystemPath() + INIFILENAME, 'GjjJglr', 'UseGate');
// vIp:= ReadIniStr(SystemPath() + INIFILENAME, 'GjjJglr', 'VServIp');
// vPort:= ReadIniStr(SystemPath() + INIFILENAME, 'GjjJglr', 'VServPort');
if trim(edit2.Text) = '' then
rPort := ''
else
rPort := ':' + trim(edit2.Text);
// if UseGat= 0 then
DM.HTTPRIO_LR.URL := 'http://' + trim(edit1.Text) + rPort
+ '/scripts/JGLR.dll/soap/IJGLR';
// + '/scripts/JGLR.dll/soap/IJGLR?realhost=192.168.0.16'+#38+'realport=80';
DM.HTTPRIO_SD.URL := DM.HTTPRIO_LR.URL;
WriteServerIp(INISYSTEMTYPE, trim(edit1.Text));
WriteIniStr(SystemPath() + INIFILENAME, 'GjjJglr', 'ServerPort',
trim(edit2.Text));
aIntf := DM.HttpRIO_LR as IJGLR;
aIntf.Login(trim(Edit3.Text), trim(Edit4.Text), LoginUser, LoginUserQx,
LoginUserSsds, iRet);
// if IfConnect = -1 then
IfConnect := iRet;
case iret of
-1: application.MessageBox('连接数据库失败!', MsgCaption, 16);
0:
begin
LoginUserID := trim(Edit3.Text);
LoginPassword := trim(Edit4.Text);
close;
end;
1:
begin
application.MessageBox('用户代码错误!', MsgCaption, 16);
Edit3.SetFocus;
end;
2:
begin
application.MessageBox('用户密码错误,请查询大小写是否正确!',
MsgCaption, 16);
Edit4.SetFocus;
end;
else
begin
application.MessageBox('未知系统错误!', MsgCaption, 16);
close;
end;
end;
end;
procedure TJGLoginGL.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9']) and (key <> #8) then
key := char(0);
if (length(Edit2.Text) = 5) and (key <> #8) then
key := char(0);
end;
procedure TJGLoginGL.Button3Click(Sender: TObject);
begin
bXsIp := not bXsIp;
if bXsIp = false then
begin
panel1.Visible := false;
button3.Caption:='选项<<';
panel2.Top := Panel2.Top - 46;
button1.Top := button1.Top - 46;
button2.Top := button2.Top - 46;
button3.Top := button3.Top - 46;
self.Height := self.Height - 46;
end
else
begin
panel1.Visible := true;
button3.Caption:='选项>>';
panel2.Top := Panel2.Top + 46;
button1.Top := button1.Top + 46;
button2.Top := button2.Top + 46;
button3.Top := button3.Top + 46;
self.Height := self.Height + 46;
end;
end;
procedure TJGLoginGL.ApplicationEvents1Exception(Sender: TObject;
E: Exception);
begin
if (E is ESOAPHTTPException) then
begin
showmessage('无法连接指定Web服务器,请检查设置!');
exit;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -