Select Case e.path
Case "wefox"
If e.Request.HttpMethod.ToUpper = "GET"
If Functions.Execute("VerifySignature",e) Then
e.WriteString(e.GetValues("echostr"))
End If
End If
Return '必须返回
Case "yhzc.htm"
Functions.Execute("yhzc",e)
Return
Case "wyyc.htm","getProducts.htm"
Functions.Execute("wyyc",e)
Return
End Select
'不需要登录验证的放到前面,否则放到后面
Dim wb As New weui
'身份验证
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim UserName As String = e.Cookies("username") '从cookie中获取用户名
Dim Password As String = e.Cookies("password") '从cookie中获取用户密码
If e.Path = "logon.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then
UserName = e.PostValues("username")
Password = e.PostValues("password")
End If
End If
Dim mmm As DataRow = DataTables("用户").find("手机号='" & UserName & "'")
If mmm IsNot Nothing AndAlso mmm("密码") = Password Then
Verified = True
End If
If Verified AndAlso e.Path = "logon.htm" Then '如果用户访问的是登录页,且身份验证成功
wb.AppendCookie("username",UserName) '将用户名和密码写入cookie
wb.AppendCookie("password",Password)
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首 页
e.WriteString(wb.Build) '生成网页
Return '必须的
ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then '如果用户身份验证失败,且访问的不是 登录页面
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到 登录页面
e.WriteString(wb.Build) '生成网页
Return '必须的
End If
'开始生成网页
Select Case e.path
Case "logon.htm" '登录页面
wb.AddPageTitle("","pageheader","众和出行","每公里1.5元+每分钟0.2元,日封顶150元")
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then '判断是否是验证失败后的重新登录
wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮 访问,则给用户一个2秒的提示.
End If
wb.AddForm("","form1","logon.htm")
With wb.AddInputGroup("form1","ipg1")
.AddInput("username","手机号","text")
.AddInput("password","密码","password")
End With
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1", "登录", "submit")
.Add("btn2", "新用户注册", "button","yhzc.htm").kind = 1 '单击这个按钮可以打开注 册页
End With
With wb.AddPageFooter("","pf1","版权属迈福铃汽车服务有限公司")
.AddLink("技术支持楚雄海子科技:","http://www.99cgt.cn")
End With
e.WriteString(wb.Build) '生成网页
Case "exit.htm" '退出登录
wb.DeleteCookie("username") '清除cookie中原来的用户名和密码
wb.DeleteCookie("password")
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳 转到登录页面
e.WriteString(wb.Build) '生成网页
Case "", "default.htm" '首页
wb.AddPageTitle("","pageheader1","众和出行","每公里1.5元+每分钟0.2元,日封顶150元")
wb.AddForm("","form2","default.htm")
' Dim sb As New StringBuilder
' sb.AppendLine("<img src='/images/abc.jpg'>")
' wb.AppendHTML("<script src='./html/txdt.html'></script>",True)
'With wb.AddButtonGroup("form2","btngrp1")
' .Add("btn3", "驾照认证", "button","yhrz.htm")
' .Add("btn4", "网点查询", "button","./html/gdwdcx.htm")
' .Add("btn5", "车辆管理", "button","clgl.htm")
'.Add("btn6", "车辆测试", "button","clcs.htm")
'End With
With wb.AddGrid("form2","g1")
.Add("c1","驾照认证", "./images/rz.png","yhrz.htm") '.Attribute = ""
.Add("c2","违章保证金", "./images/wzb.png", "wzbzj.htm")
.Add("c3","车辆分布", "./images/zc.png", "https://maplab.amap.com/share/mapv/c67444713538e5271bb01968c3ea6563")
.Add("c4","会员升级", "./images/cz.png", "hysj.htm")
.Add("c4","网点查询", "./images/cz.png", "https://maplab.amap.com/share/mapv/aae6e34a4ecef8d4978ffc3d84df886c")
.Add("c5","网点申请", "./images/sq.png", "wdgl.htm")
.Add("c5","网点履约金", "./images/sq.png", "wdlyj.htm")
.Add("c6","车辆管理", "./images/clgl.png", "clgl.htm")
.Add("c7","使用说明", "./images/wx.png", "help.htm")
.Add("c8","个人中心", "./images/cz.png", "grzx.htm")
.Add("c8","我要用车", "./images/cz.png", "wyyc.htm")
.Add("c9","退出", "./images/exit.png", "exit.htm") '退出登录
End With
With wb.AddButtonGroup("form2","btg2", False) '水平排列
.Add("btn6", "我要还车","button","/wyhc.htm").Kind = 2
End With
e.WriteString(wb.Build) '生成网页
Case "yhrz.htm"
Functions.Execute("yhrz",e)
Case "wdgl.htm"
Functions.Execute("wdgl",e)
Case "clgl.htm"
Functions.Execute("clgl",e)
Case "yhzc.htm"
Functions.Execute("yhzc",e)
Case "grzx.htm"
Functions.Execute("grzx",e)
Case "wzbzj.htm"
Functions.Execute("wzbzj",e)
Case "hysj.htm"
Functions.Execute("hysj",e)
Case "wdlyj.htm"
Functions.Execute("wdlyj",e)
Case "delete.htm"
Functions.Execute("Delete",e)
Case "wyhc.htm"
Functions.Execute("wyhc",e)
End Select