Foxtable(狐表)用户栏目专家坐堂 → 请教动态列表,代码在httprequset中写代码正常,但放到内部函数中调用就出不来下拉列表,请问是何原因。


  共有2243人关注过本帖树形打印复制链接

主题:请教动态列表,代码在httprequset中写代码正常,但放到内部函数中调用就出不来下拉列表,请问是何原因。

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106664 积分:542503 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/8/19 10:41:00 [显示全部帖子]

httprequest事件完整代码发上来看看

一般一个case网页使用一个函数,而不是多个网页使用一个函数

另外建议去掉事件头改为使用HttpServer.WebPath:http://www.foxtable.com/mobilehelp/topics/0276.htm

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106664 积分:542503 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/8/19 11:18:00 [显示全部帖子]

首先,没有必要一个页面一个select吧!!!合并到一起case分开即可

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
    Case "yhrz.htm"
        Functions.Execute("yhrz",e)
    Case "wdgl.htm"
        Functions.Execute("wdgl",e)
……
End Select

其次,1楼是wyyc函数吧,然后函数里有2个页面,但是下面select case只有"wyyc.htm"才能进入这个函数
Select Case e.Path
    Case "wyyc.htm"
        Functions.Execute("wyyc",e)
End Select
改为
Select Case e.Path
    Case "wyyc.htm","getProducts.htm"
        Functions.Execute("wyyc",e)
End Select

最后、身份验证应该在访问页面之前,现在放到了后面,意思是身份验证之前的这些页面不需要验证?

 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106664 积分:542503 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/8/19 16:43:00 [显示全部帖子]

一次返回中e.WriteString不能重复调用

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

 回到顶部