Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim uuid As String = Guid.NewGuid.TOstring()
If e.PostValues.Count = 0 Then
wb.Title = "test"
wb.AddForm("","form1","valid.htm").Attrib ute="ons ubmit='return validit()'"
With wb.AddArticle("form1","ar1")
.AddImage("./images/2.jpg")
With wb.AddInputGroup("form1","ipg212","")
With .AddInput("举报类型","举报类型","text")
.Placeholder = "请准确输入线索描述……"
.Readonly=True
.Value="环境污染"
End With
.AddInput("线索地点","线索地点","text").PlaceHolder = "请输入准确的地址"
.AddInput("位置描述","位置描述*","text").PlaceHolder = "请输入地址辅助性说明"
End With
With wb.AddInputGroup("form1","ipg22","线索描述")
With .AddTextArea("bz",5)
.Placeholder = "请准确输入线索描述……"
End With
End With
With wb.AddInputGroup("form1","ipg2","图片或视频上传") '文件上传
With.AddUploader("up1","",True) 'True表示允许上传多个文件
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
.ScaleWidth = 1024
End With
End With
Dim rdg As ExWeUI.ExRadioGroup = ExWeUI.WebUI.AddRadioGroup("form1","rdg1","是否实名举报</span>")
rdg.add("rd1","实名举报").Attribute = "onch ange='jubaoxianshi()'"
rdg.add("rd2","匿名举报",True).enabled = True
wb.InsertHTML("form1",rdg.BuildHtml)
With wb.AddInputGroup("form1","ipg100","")
With .AddInputCell("ic3") '通过InputCell增加输入框
.AddLabel("ljbr","举报人",0) '增加标签,0显示在左边
.AddInput("jbr","text",1).PlaceHolder = "请输入真实姓名" '增加输入框,1表示显示在中间
End With
With .AddInputCell("ic4") '通过InputCell增加输入框
.AddLabel("lsj","联系电话",0) '增加标签,0显示在左边
.AddInput("sjh","text",1).PlaceHolder = "请输入联系电话" '增加输入框,1表示显示在中间
.AddVcodeButton("vyz","获取验证码",2).At tribute="on click='getNum()'"
End With
With .AddInputCell("ic5") '通过InputCell增加输入框
.AddLabel("lyzm","验证码",0) '增加标签,0显示在左边
.AddInput("yzm","text",1).PlaceHolder = "请输入短信中的验证码" '增加输入框,1表示显示在中间
End With
End With
With wb.AddInputGroup("form1","ipg12","")
With .AddInputCell("ic6") '通过InputCell增加输入框
.AddLabel("lsj","联系电话",0) '增加标签,0显示在左边
.AddInput("sjh","text",1).PlaceHolder = "请输入联系电话" '增加输入框,1表示显示在中间
.AddVcodeButton("vyz","获取验证码",2).Attr ibute="onc lick='getNum()'"
End With
With .AddInputCell("ic7") '通过InputCell增加输入框
.AddLabel("lyzm","验证码",0) '增加标签,0显示在左边
.AddInput("yzm","text",1).PlaceHolder = "请输入短信中的验证码" '增加输入框,1表示显示在中间
End With
End With
Dim rdg1 As ExWeUI.ExRadioGroup = ExWeUI.WebUI.AddRadioGroup("form1","rdg2","是否申请奖励</span>")
rdg1.add("rd11","申请奖励").Attrib ute = "onch ange='jianglixianshi()'"
rdg1.add("rd21","不申请奖励",True).enabled = True
wb.InsertHTML("form1",rdg1.BuildHtml)
Dim bt As String ="根据《奖励办法(试行)》对符合条件的线索进行奖励,点击获取《奖励办法(试行)》详情.注:领取奖励需要实名"
With wb.AddInputGroup("form1","ipg222","申请奖励须知")
With .AddTextArea("bz1",3)
.Readonly=True
.Value= bt
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
End With
wb.AppendHTML("<script>" & vars("yanzhengma") & "</script>") '引入脚本文件
wb.AppendHTML("<script>" & vars("jubao") & "</script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
Else
Dim cmd As New SQ LCommand
cmd.Connecti
cmd.Comma ndText = "Inse rt Into 线索举报 (uuid,举报类型,线索地点,位置描述,线索描述,实名举报,匿名举报,联系人,联系电话,验证码,申请奖励,不申请奖励,举报时间) Values(?,?,?,?,?,?,?,?,?,?,?,?,?)"
cmd.Parameters.Add("@uuid", uuid)
cmd.Parameters.Add("@举报类型", e.PostValues("举报类型"))
cmd.Parameters.Add("@线索地点", e.PostValues("线索地点"))
cmd.Parameters.Add("@位置描述", e.PostValues("位置描述"))
cmd.Parameters.Add("@线索描述", e.PostValues("线索描述"))
cmd.Parameters.Add("@实名举报", e.PostValues("rd1"))
cmd.Parameters.Add("@匿名举报", e.PostValues("rd2"))
cmd.Parameters.Add("@联系人", e.PostValues("jbr"))
cmd.Parameters.Add("@联系电话", e.PostValues("sjh"))
cmd.Parameters.Add("@验证码", e.PostValues("yzm"))
cmd.Parameters.Add("@申请奖励", e.PostValues("rd11"))
cmd.Parameters.Add("@不申请奖励", e.PostValues("rd12"))
cmd.Parameters.Add("@举报时间",Date.now)
cmd.ExecuteNonQuery
e.WriteString("OK")
End If
2、运行test页面之后,填写相关数据,并验证了验证码正确的情况下 页面返回到valid 页面 提示OK,当前数据并没有写入数据库中。麻烦老师指导下!怎么实现点击确定之后,当前页面填写的写入数据库表中,并且又返回到test页面。
此主题相关图片如下:13.gif
valid验证验证码代码:
Dim e As RequestEventArgs = args(0)
Dim sjh As String = e.Values("sjh")
Dim yzm As String = e.Values("yzm")
If e.Cookies.ContainsKey(sjh) = False Then
e.WriteString("请点击发送验证码")
Return ""
End If
If e.Cookies(sjh) <> yzm Then
e.WriteString("验证码不正确")
Return ""
End If
e.WriteString("ok")
发送验证码短信代码:
Dim e As RequestEventArgs = args(0)
Dim yzm As String = Rand.Next(100000, 999999)
Dim shoujihao As String = e.PlainText
Dim url As String
url = "http://service.winic.org:8009/sys_port/gateway/?id=wuzhan588&pwd=wuzhan588&to=" & shoujihao & "&c&time="
Dim hc As New HttpClient(url)
Dim result As String = "000000" 'hc.GetData()
If result.split("/")(0) = "000000" Then
e.AppendCookie(shoujihao, yzm)
e.WriteString("当前验证码已经发送至:【" & shoujihao & "】,请查收!如果60秒后没有收到短信请重新获取验证码!")
Else
e.WriteString("发送失败,稍后重试")
End If