Dim e As RequestEventArgs = args(0) '首页
e.Resp
Dim wb As New weui
With wb.AddTabBar("", "tb1",1) '使用TabBar,增加4个按钮(注:页面可以增加,但不考虑)
.AddButton("bt1","首页","./images/a.png","/index.htm") '.Attribute = ""
.AddButton("bt2","城市","./images/b.png","/shengfen.htm?qiehcs=qiehcs")
.Addpage("bt3","当前","./images/c.png")
.AddButton("bt4","我的","./images/d.png","/personal.htm")
End With
If e.Cookies.ContainsKey("tbh") Then
wb.DeleteCookie("tbh") ’删除其他页面的cookie
End If
Dim xb As String '定义,性别
Dim i As Integer '记录首页展示人数,即for each语句循环次数
For Each key As String In e.GetValues.Keys '3种情况下,获得性别:从男女生入口获得性别|从本页后续确认性别dlg1对话框,获得性别|切换城市时,获得性别
If key = "sex" Then
xb = e.GetValues(key)
If xb = 1 Then
xb = "男"
wb.AppendCookie("querxb",xb) '这个cookie,若用户登录后,在httprequest代码判断登录处,删除(已解决)
msgbox("首页querxb:" & e.cookies("querxb")) ’这里执行并显示了cookie值,但下一个粉色cookie创建失败
ElseIf xb = 0 Then
xb = "女"
wb.AppendCookie("querxb",xb) '这个cookie,若用户登录后,在httprequest代码判断登录处,删除(已解决)
msgbox("首页querxb:" & e.cookies("querxb"))
End If
End If
Next
If xb = "" Then '这里用来第1次之后,再次访问首页时,确认游客性别(从上一段代码生成的cookie中,取性别)
xb = e.cookies("querxb") '这个cookie在本页创建,若用户登录后,在httprequest代码判断登录处,删除(已解决)
End If
If username IsNot Nothing Then '如果cookie中,有会员手机号:取已登录会员的性别|会员等级(即会员已登录,覆盖上面的定义的xb,实际上登录时,cookie:querxb已经被删除了)
xb = e.cookies("ixb") '这是登录时,在httprequest创建的cookie
'huiydj = e.cookies("idj")
End If
If xb = "" Then '性别,经过上述赋值,还是为空,弹出确认会员性别对话框
With wb.AddDialog("bt3","dlg1", "确认性别","您尚未登录,需要选择性别哦!")
.AddButton("btnNAN1","我是男生","/index.htm?sex=1")
.AddButton("btnNV1","我是女生","/index.htm?sex=0")
End With
wb.AppendHTML("<script>show('dlg1')</script>")
e.WriteString(wb.Build) '生成网页
Return "" '必须的
End If
Dim chakshi As String
chakshi = "连云港市"
wb.AppendCookie("CHAKSHI",chakshi)
msgbox("城市cookie:" & e.Cookies("CHAKSHI")) ’这里弹窗正常,但是无cookie值,测试多遍都这样,咋回事?
If e.Cookies.ContainsKey("CHAKSHI") Then
msgbox(1)
End If
一个页面,有的cookie创建成功,有的不成功,测试多遍都这样,咋回事?