Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim UserName As String
Dim yzm1 As String
Dim yzm2 As String
Dim dt As DataTable
Dim dr As DataRow
Dim drbianh As String = DataTables("会员权限设置").SQL Compute("Sum(联系电话 + 20181112)")
e.AppendCookie("drbianhao",drbianh) '在客户端存储Cookie(保存新增的学员编号)
Dim Products As List(Of String) = DataTables("内部属性配置").SQL GetValues("AttributeValue","","AttributeValue")
wb.Title = Products(1) '添加页面标题
wb.InsertHTML("","<h3 style='text-align:center;background-color: #A9A9A9;background: #A9A9A9; height: 40px;line-height: 40px;font-size: 16px;padding: 0 20px 0 10px;margin: 0;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;position: relative;'><a href='#' style='color: #000000;'>个人注册</a></h3>")
If e.PostValues.ContainsKey("username") Then '表单的值
UserName = e.PostValues("username")
End If
If e.PostValues.ContainsKey("验证码") Then yzm1 = e.PostValues("验证码").ToLower '提供的验证码
If e.PostValues.ContainsKey("yzm") Then yzm2 = e.PostValues("yzm").ToLower '用户输入的验证码
If UserName > "" And yzm1 = yzm2
Dim sql = "sel ect * fr om [会员权限设置] where 用户账号='" & UserName & "'"
dt = Functions.Execute("GetOuterDataTable","在线视频观赏源",sql,True)
If dt.DataRows.Count = 0 Then
dr = dt.AddNew() '增加一条注册信息
dr("用户账号") = UserName
dr("姓名") = e.PostValues("姓名")
dr("性别") = e.PostValues("性别")
dr("联系电话") = UserName
dr("学历") = e.PostValues("学历")
dr("身份证号") = e.PostValues("身份证号")
dr("企业名称") = e.PostValues("企业名称")
dr("职位") = e.PostValues("职位")
dr("学号") = drbianh
dr("行政区域") = e.PostValues("xzqy")
dr("用户密码") = "6666"
dr("注册时间") = Format(Date.Now, "yyyy-MM-dd HH:mm:ss")
dr("LoginState") = True
dr("openid") = drbianh
dr.Save
DataTables ("会员权限设置").Load()
With wb.AddMsgPage("","msgpage","注册成功", "请进入登录界面") '生成成功提示页
.AddButton("btn1","注册成功","UserLogin.htm")
End With
e.WriteString(wb.Build)
Return "" '必须的
'wb.AppendHtml("<meta http-equiv='refresh' c>",True)
'wb.AddToast("","t1", "注册成功",0).Visible = True
'e.WriteString(wb.Build)
'Return "" '必须的
End If
End If
If dt IsNot Nothing AndAlso dt.DataRows.Count > 0 Then '用户名重复
wb.AddToptips("","toptip1","此用户名已存在!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
MessageBox.Show("此用户名已存在")
ElseIf yzm1 > "" And yzm1 <> yzm2 '如果验证码不正确
wb.AddToptips("","toptip1","验证码不正确!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
MessageBox.Show("验证码不正确!")
End If
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","PersonalRegistration.htm")
With wb.AddInputGroup("form1","ipg1")
Dim rtxt As String = Rand.NextString(4) '生成随机的验证码
.AddHiddenValue("验证码",rtxt)
.AddInput("姓名","姓 名","text").placeholder="请输入姓名"
.AddSelect("性别","性 别","男|女")
.AddInput("username","联系电话","number").placeholder="请输入联系电话"
With .AddInput("xzqy","地 区","text")
.placeholder="请选择省市区县"
.Attribute=""
End With
.AddSelect("学历","学 历","中专|大专|本科|其他")
.AddInput("身份证号","身份证号","number").placeholder="请输入身份证号"
.AddInput("企业名称","企业名称","text").placeholder="请输入企业名称"
.AddSelect("职位","职 位","员工|总经理|高层|店长")
With .AddInputCell("ic1") '通过InputCell增加输入框
.AddLabel("lyzm","验证码",0) '增加标签,0显示在左边
.AddInput("yzm","text",1).PlaceHolder= "请输验证码" '增加输入框,1表示显示在中间
.AddLabel("ryzm",rtxt,2) ''增加标签,2表示显示在右边
End With
End With
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1","立即注册","submit")
End With
wb.InsertHTML("<br/>")
With wb.AddButtonGroup("","btg2",True)
.Add("btn2","返回登录","button","UserLogin.htm").Kind = 1
End With
wb.InsertHTML("<script src='https://libs.baidu.com/jquery/1.10.2/jquery.min.js'></script>")
wb.InsertHTML("<script src='./JavaScript/jquery-weui.min.js'></script>")
wb.InsertHTML("<script src='./JavaScript/city-picker.min.js'></script>")
wb.InsertHTML("<script src='./JavaScript/ssxsjld.js'></script>")
Else
Dim nms() As String = {"姓名","username","xzqy","身份证号","企业名称","yzm"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
With wb.AddMsgPage("","msgpage","增加失败", nm & "不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1","返回").Attribute = ""
End With
e.WriteString(wb.Build)
Return "" '必须返回
End If
Next
End If
e.WriteString(wb.Build) '生成网页