mirror of
https://git.oceanpay.cc/danial/kami_itunes_june.git
synced 2025-12-18 22:31:24 +00:00
414 lines
13 KiB
C#
414 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Net;
|
|
using System.Text.RegularExpressions;
|
|
using System.Windows.Forms;
|
|
using AppleBatch_June.Properties;
|
|
using DotNet.Utilities;
|
|
|
|
namespace AppleBatch_June
|
|
{
|
|
public class FromReg : Form
|
|
{
|
|
private bool isMouseDown;
|
|
|
|
private Point mouseOffset;
|
|
|
|
private IContainer components;
|
|
|
|
private Button button1;
|
|
|
|
private TextBox txtPwd;
|
|
|
|
private Label label2;
|
|
|
|
private TextBox txtUser;
|
|
|
|
private Label label1;
|
|
|
|
private TextBox txtMoblie;
|
|
|
|
private Label label3;
|
|
|
|
private PictureBox pictureBox1;
|
|
|
|
private Button button2;
|
|
|
|
private TextBox txtReferralCode;
|
|
|
|
private Label label4;
|
|
|
|
public FromReg()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FromReg_Load(object sender, EventArgs e)
|
|
{
|
|
txtMoblie.ForeColor = SystemColors.MenuHighlight;
|
|
txtUser.ForeColor = SystemColors.MenuHighlight;
|
|
txtPwd.ForeColor = SystemColors.MenuHighlight;
|
|
txtReferralCode.ForeColor = SystemColors.MenuHighlight;
|
|
}
|
|
|
|
private void FromReg_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Button == MouseButtons.Left)
|
|
{
|
|
isMouseDown = true;
|
|
mouseOffset = new Point(-e.X, -e.Y);
|
|
}
|
|
}
|
|
|
|
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Button == MouseButtons.Left)
|
|
{
|
|
isMouseDown = true;
|
|
mouseOffset = new Point(-e.X, -e.Y);
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
button1.Enabled = false;
|
|
if (txtUser.Text.Length >= 3)
|
|
{
|
|
if (txtUser.Text.Length <= 12)
|
|
{
|
|
if (txtPwd.Text.Length > 4)
|
|
{
|
|
if (txtMoblie.Text.Length == 11)
|
|
{
|
|
if (!IsHasCHZN(txtUser.Text))
|
|
{
|
|
Dictionary<string, object> postData = new Dictionary<string, object>
|
|
{
|
|
{
|
|
"userName",
|
|
txtUser.Text.Trim()
|
|
},
|
|
{ "userPwd", txtPwd.Text },
|
|
{ "moblie", txtMoblie.Text },
|
|
{ "ReferralCode", txtReferralCode.Text }
|
|
};
|
|
HttpResult httpResult = new ApiNetReq().doPost(postData, "ApiRegister");
|
|
if (httpResult.StatusCode == HttpStatusCode.OK)
|
|
{
|
|
dynamic val = Tools.Todejosn<object>(httpResult.Html);
|
|
if (!((val["Code"] == "0000") ? true : false))
|
|
{
|
|
MessageBox.Show(val["Message"]);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(val["Message"]);
|
|
base.DialogResult = DialogResult.OK;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("请求错误,请检测网络");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("用户名不能有汉字,请输入英文或者数字");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("手机号码不正确");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码至少4个字符");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("用户在11个字符以内");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("用户至少3个字符");
|
|
}
|
|
button1.Enabled = true;
|
|
}
|
|
|
|
public bool IsHasCHZN(string inputData)
|
|
{
|
|
return new Regex("[一-龥]").Match(inputData).Success;
|
|
}
|
|
|
|
private void txtUser_Enter(object sender, EventArgs e)
|
|
{
|
|
if (txtUser.Text == "用户名,请用英文或者数字")
|
|
{
|
|
txtUser.Text = "";
|
|
txtUser.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void txtUser_Leave(object sender, EventArgs e)
|
|
{
|
|
if (txtUser.Text.Length == 0)
|
|
{
|
|
txtUser.Text = "用户名,请用英文或者数字";
|
|
txtUser.ForeColor = SystemColors.MenuHighlight;
|
|
}
|
|
}
|
|
|
|
private void txtMoblie_Enter(object sender, EventArgs e)
|
|
{
|
|
if (txtMoblie.Text == "手机号码,用于找回密码")
|
|
{
|
|
txtMoblie.Text = "";
|
|
txtMoblie.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void txtMoblie_Leave(object sender, EventArgs e)
|
|
{
|
|
if (txtMoblie.Text.Length == 0)
|
|
{
|
|
txtMoblie.Text = "手机号码,用于找回密码";
|
|
txtMoblie.ForeColor = SystemColors.MenuHighlight;
|
|
}
|
|
}
|
|
|
|
private void txtPwd_Enter(object sender, EventArgs e)
|
|
{
|
|
if (txtPwd.Text == "密码")
|
|
{
|
|
txtPwd.Text = "";
|
|
txtPwd.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void txtPwd_Leave(object sender, EventArgs e)
|
|
{
|
|
if (txtPwd.Text.Length == 0)
|
|
{
|
|
txtPwd.Text = "密码";
|
|
txtPwd.ForeColor = SystemColors.MenuHighlight;
|
|
}
|
|
}
|
|
|
|
private void txtReferralCode_Leave(object sender, EventArgs e)
|
|
{
|
|
if (txtReferralCode.Text.Length == 0)
|
|
{
|
|
txtReferralCode.Text = "推荐码,可不填";
|
|
txtReferralCode.ForeColor = SystemColors.MenuHighlight;
|
|
}
|
|
}
|
|
|
|
private void txtReferralCode_Enter(object sender, EventArgs e)
|
|
{
|
|
if (txtReferralCode.Text == "推荐码,可不填")
|
|
{
|
|
txtReferralCode.Text = "";
|
|
txtReferralCode.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
|
|
private void FromReg_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
if (isMouseDown)
|
|
{
|
|
Point mousePosition = Control.MousePosition;
|
|
mousePosition.Offset(mouseOffset.X, mouseOffset.Y);
|
|
base.Location = mousePosition;
|
|
}
|
|
}
|
|
|
|
private void FromReg_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Button == MouseButtons.Left)
|
|
{
|
|
isMouseDown = false;
|
|
}
|
|
}
|
|
|
|
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
if (isMouseDown)
|
|
{
|
|
Point mousePosition = Control.MousePosition;
|
|
mousePosition.Offset(mouseOffset.X, mouseOffset.Y);
|
|
base.Location = mousePosition;
|
|
}
|
|
}
|
|
|
|
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Button == MouseButtons.Left)
|
|
{
|
|
isMouseDown = false;
|
|
}
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppleBatch_June.FromReg));
|
|
this.button1 = new System.Windows.Forms.Button();
|
|
this.txtPwd = new System.Windows.Forms.TextBox();
|
|
this.label2 = new System.Windows.Forms.Label();
|
|
this.txtUser = new System.Windows.Forms.TextBox();
|
|
this.label1 = new System.Windows.Forms.Label();
|
|
this.txtMoblie = new System.Windows.Forms.TextBox();
|
|
this.label3 = new System.Windows.Forms.Label();
|
|
this.button2 = new System.Windows.Forms.Button();
|
|
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
|
this.txtReferralCode = new System.Windows.Forms.TextBox();
|
|
this.label4 = new System.Windows.Forms.Label();
|
|
((System.ComponentModel.ISupportInitialize)this.pictureBox1).BeginInit();
|
|
base.SuspendLayout();
|
|
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.button1.ForeColor = System.Drawing.Color.Orange;
|
|
this.button1.Location = new System.Drawing.Point(117, 391);
|
|
this.button1.Margin = new System.Windows.Forms.Padding(4);
|
|
this.button1.Name = "button1";
|
|
this.button1.Size = new System.Drawing.Size(251, 36);
|
|
this.button1.TabIndex = 4;
|
|
this.button1.Text = "注册账号";
|
|
this.button1.UseVisualStyleBackColor = true;
|
|
this.button1.Click += new System.EventHandler(button1_Click);
|
|
this.txtPwd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtPwd.Location = new System.Drawing.Point(117, 302);
|
|
this.txtPwd.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
|
|
this.txtPwd.Name = "txtPwd";
|
|
this.txtPwd.Size = new System.Drawing.Size(250, 23);
|
|
this.txtPwd.TabIndex = 3;
|
|
this.txtPwd.Text = "密码";
|
|
this.txtPwd.Enter += new System.EventHandler(txtPwd_Enter);
|
|
this.txtPwd.Leave += new System.EventHandler(txtPwd_Leave);
|
|
this.label2.AutoSize = true;
|
|
this.label2.Location = new System.Drawing.Point(62, 304);
|
|
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
this.label2.Name = "label2";
|
|
this.label2.Size = new System.Drawing.Size(43, 17);
|
|
this.label2.TabIndex = 7;
|
|
this.label2.Text = "密 码:";
|
|
this.txtUser.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtUser.Location = new System.Drawing.Point(118, 213);
|
|
this.txtUser.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
|
|
this.txtUser.Name = "txtUser";
|
|
this.txtUser.Size = new System.Drawing.Size(250, 23);
|
|
this.txtUser.TabIndex = 1;
|
|
this.txtUser.Text = "用户名,请用英文或者数字";
|
|
this.txtUser.Enter += new System.EventHandler(txtUser_Enter);
|
|
this.txtUser.Leave += new System.EventHandler(txtUser_Leave);
|
|
this.label1.AutoSize = true;
|
|
this.label1.Location = new System.Drawing.Point(63, 215);
|
|
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
this.label1.Name = "label1";
|
|
this.label1.Size = new System.Drawing.Size(47, 17);
|
|
this.label1.TabIndex = 5;
|
|
this.label1.Text = "用户名:";
|
|
this.txtMoblie.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtMoblie.Location = new System.Drawing.Point(117, 259);
|
|
this.txtMoblie.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
|
|
this.txtMoblie.Name = "txtMoblie";
|
|
this.txtMoblie.Size = new System.Drawing.Size(250, 23);
|
|
this.txtMoblie.TabIndex = 2;
|
|
this.txtMoblie.Text = "手机号码,用于找回密码";
|
|
this.txtMoblie.Enter += new System.EventHandler(txtMoblie_Enter);
|
|
this.txtMoblie.Leave += new System.EventHandler(txtMoblie_Leave);
|
|
this.label3.AutoSize = true;
|
|
this.label3.Location = new System.Drawing.Point(47, 261);
|
|
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
this.label3.Name = "label3";
|
|
this.label3.Size = new System.Drawing.Size(59, 17);
|
|
this.label3.TabIndex = 10;
|
|
this.label3.Text = "手机号码:";
|
|
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.button2.Location = new System.Drawing.Point(117, 452);
|
|
this.button2.Margin = new System.Windows.Forms.Padding(4);
|
|
this.button2.Name = "button2";
|
|
this.button2.Size = new System.Drawing.Size(251, 27);
|
|
this.button2.TabIndex = 5;
|
|
this.button2.Text = "关闭";
|
|
this.button2.UseVisualStyleBackColor = false;
|
|
this.button2.Click += new System.EventHandler(button2_Click);
|
|
this.pictureBox1.Image = AppleBatch_June.Properties.Resources.QQ截图20190402024037;
|
|
this.pictureBox1.Location = new System.Drawing.Point(-8, -8);
|
|
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
|
|
this.pictureBox1.Name = "pictureBox1";
|
|
this.pictureBox1.Size = new System.Drawing.Size(460, 194);
|
|
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
|
this.pictureBox1.TabIndex = 14;
|
|
this.pictureBox1.TabStop = false;
|
|
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(pictureBox1_MouseDown);
|
|
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(pictureBox1_MouseMove);
|
|
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(pictureBox1_MouseUp);
|
|
this.txtReferralCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtReferralCode.Location = new System.Drawing.Point(117, 343);
|
|
this.txtReferralCode.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
|
|
this.txtReferralCode.Name = "txtReferralCode";
|
|
this.txtReferralCode.Size = new System.Drawing.Size(250, 23);
|
|
this.txtReferralCode.TabIndex = 4;
|
|
this.txtReferralCode.Text = "推荐码,可不填";
|
|
this.txtReferralCode.Enter += new System.EventHandler(txtReferralCode_Enter);
|
|
this.txtReferralCode.Leave += new System.EventHandler(txtReferralCode_Leave);
|
|
this.label4.AutoSize = true;
|
|
this.label4.Location = new System.Drawing.Point(58, 345);
|
|
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
this.label4.Name = "label4";
|
|
this.label4.Size = new System.Drawing.Size(47, 17);
|
|
this.label4.TabIndex = 16;
|
|
this.label4.Text = "推荐码:";
|
|
base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 17f);
|
|
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
base.ClientSize = new System.Drawing.Size(443, 526);
|
|
base.Controls.Add(this.txtReferralCode);
|
|
base.Controls.Add(this.label4);
|
|
base.Controls.Add(this.button2);
|
|
base.Controls.Add(this.pictureBox1);
|
|
base.Controls.Add(this.txtMoblie);
|
|
base.Controls.Add(this.label3);
|
|
base.Controls.Add(this.button1);
|
|
base.Controls.Add(this.txtPwd);
|
|
base.Controls.Add(this.label2);
|
|
base.Controls.Add(this.txtUser);
|
|
base.Controls.Add(this.label1);
|
|
this.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold);
|
|
this.ForeColor = System.Drawing.Color.DarkSlateGray;
|
|
base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
|
|
base.Margin = new System.Windows.Forms.Padding(4);
|
|
base.Name = "FromReg";
|
|
base.ShowIcon = false;
|
|
base.ShowInTaskbar = false;
|
|
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
this.Text = "账号注册";
|
|
base.Load += new System.EventHandler(FromReg_Load);
|
|
base.MouseDown += new System.Windows.Forms.MouseEventHandler(FromReg_MouseDown);
|
|
base.MouseMove += new System.Windows.Forms.MouseEventHandler(FromReg_MouseMove);
|
|
base.MouseUp += new System.Windows.Forms.MouseEventHandler(FromReg_MouseUp);
|
|
((System.ComponentModel.ISupportInitialize)this.pictureBox1).EndInit();
|
|
base.ResumeLayout(false);
|
|
base.PerformLayout();
|
|
}
|
|
}
|
|
}
|