Dim wb电脑端 As New weui
wb电脑端.AppendHTML("<link href=""//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"" rel=""stylesheet"">", True)
'身份验证
Dim Verified电脑端 As Boolean '用于标记用户是否通过了身份验证
Dim UserName电脑端 As String = e.Cookies("username") '从cookie中获取用户名
Dim Password电脑端 As String = e.Cookies("password") '从cookie中获取用户密码
If e.Path = "电脑端登录页面.htm" Then'如果是通过登录页面访问,从PostValues即可中提取用户名和密码
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then
UserName电脑端 = e.PostValues("username")
Password电脑端 = e.PostValues("password")
End If
End If
If UserName电脑端 = "张三" AndAlso Password电脑端 = "888" Then '实际使用的时候,请改为从数据库读取用户名和密码进行比较
Verified电脑端 = True
ElseIf Username电脑端 = "李四" AndAlso Password电脑端 = "999" Then
Verified电脑端 = True
End If
If Verified电脑端 AndAlso e.Path = "电脑端登录页面.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 <> "电脑端登录页面.htm" Then '如果用户身份验证失败,且访问的不是登录页面
wb电脑端.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
e.WriteString(wb电脑端.Build) '生成网页
Return '必须的
End If
Select Case e.path
Case "电脑端登录页面.htm" '登录页面
wb电脑端.title = "登录页面"
wb电脑端.AppendHTML("<link rel='stylesheet' href='./动态/styles.css'/>", True)
wb电脑端.AppendHTML("<canvas id='canvas1'></canvas>")
wb电脑端.AppendHTML("<script src='./动态/particles.js'></script>")
Dim k加产品 As String = " <span class='k加产品'><i class=""fa fa-user-circle-o fa-5x""></i></span>"
wb电脑端.AppendHTML("<style>.k加产品 { left: 40%;top: -10%;position: absolute;color: #2838ff;}</style>", True)
wb电脑端.InsertHTML("", "<div style='width:20%;height: 300px;position: absolute;top: 28%;margin: 2% 5% 5em 70%;border-radius: 50px;background-color: #ffffff;' > " & k加产品 & "</div> ")
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")
End With
wb电脑端.AppendHTML("<style>.weui_cells {margin-top:0em;width: 15%;margin: 2% 7.5% 5em 72.5%;border-radius: 5px;top: 40%;position: absolute;z-index:500;}</style>", True)
wb电脑端.AppendHTML("<style>.fox_h_button_group {margin: 5% 7.5% 0em 72.5%;position: absolute;top: 45%;width: 15%;z-index:500;}</style>", True)
e.WriteString(wb电脑端.Build)
Case "", "123.htm" '首页
wb电脑端.AddPageTitle("", "pageheader", "销售系统", "由湛江辉迅基于Foxtable开发")
With wb电脑端.AddGrid("", "g1")
.Add("c1", "增加订单", "./images/button.png").Attribute = ""
.Add("c2", "客户管理", "./images/cell.png", "http://www.foxtable.com")
.Add("c3", "销售统计", "./images/toast.png", "http://www.foxtable.com")
.Add("c4", "Dialog", "./images/dialog.png", "http://www.foxtable.com")
.Add("c5", "Progress", "./images/progress.png", "http://www.foxtable.com")
.Add("c6", "Msg", "./images/msg.png", "http://www.foxtable.com")
.Add("c7", "Article", "./images/article.png", "http://www.foxtable.com")
.Add("c8", "ActionSheet", "./images/actionSheet.png", "http://www.foxtable.com")
.Add("c9", "Icons", "./images/icons.png", "http://www.foxtable.com")
.Add("c10", "Panel", "./images/panel.png", "http://www.foxtable.com")
.Add("c11", "Tab", "./images/tab.png", "http://www.foxtable.com")
.Add("c12", "退出", "./images/exit.png", "exit.htm") '退出登录
End With
e.WriteString(wb电脑端.Build)
End Select