以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  跳转  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=146545)

--  作者:刘林
--  发布时间:2020/2/26 10:43:00
--  跳转
\'\'
Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI \'
wb.InsertHTML("<hr>")
wb.InsertHTML("<hr>")
wb.AddPageTitle("","pageheader","教务系统","")
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then \'判断是否是验证失败后的重新登录
    wb.AddTopTips("","toptip1","用户名或密码错误或已停用!").msec = 3000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示.
End If
wb.AddForm("","form1","logon.htm")
With wb.AddInputGroup("form1","ipg1")
    Dim In1= .AddInput("username","帐户:","text")
    In1.placeholder ="身份证号"
    In1.value=e.Cookies("username")
    .AddInput("password","密码:","password").Placeholder="密码"
End With
With wb.AddButtonGroup("form1","btg1",False)
    .Add("btn1", "登录", "submit").kind=1
    .Add("btn2", "注册", "", "zc.htm").kind=1
    .Add("btn3", "APP安装","","http://47.92.95.136:8080/教务系统.apk").kind=1
    .Add("btn4", "忘记密码","","zc.htm").kind=1   (在这里跳到密码重置,在这里跳一个正常的网页跳不过去,只有zc.htm可以,请问老师问题出在哪里,)
End With
wb.InsertHTML("form1","<div style=\'width:100%;height:100px;vertical-align: middle;text-align: center;margin-top:20px;\'><img style=\'width:100px;height:100%\' src=\'./images/ewm.png\'></img><img style=\'width:100px;height:100%;\' src=\'./images/tel.png\' ></img></div>")
wb.InsertHTML("form1","<p style=\'font-size:20px;color:red;margin:30px 10px 10px;\'>温馨提示:</p>")
wb.InsertHTML("form1","<p> 1.首次手机使用请点APP安装.</p>")
wb.InsertHTML("form1","<p> 2.已有电脑端帐号请以电脑端身份信息为帐号登录.</p>")
wb.InsertHTML("form1","<p> 3.新用户注册帐号务必以自己真实身份证号为帐号.</p>")
e.WriteString(wb.Build)
e.Handled =True

--  作者:有点蓝
--  发布时间:2020/2/26 11:19:00
--  
什么样的网页?静态网页,还是代码生成的?打开浏览器开发者工具看看有没有错误
--  作者:刘林
--  发布时间:2020/2/26 18:01:00
--  
If  e.Path <> "zc.htm"  Then \'身份验证
    Dim Verified As Boolean \'用于标记用户是否通过了身份验证
    Dim UserName As String = e.Cookies("username") \'从cookie中获取用户名
    Dim Password As String = e.Cookies("password") \'从cookie中获取用户密码
    Dim js As String
    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 dr As DataRow = DataTables("用户").SQLFind("[身份证号] = \'" & UserName & "\'  And [是否可用] = \'true\'")
    If dr IsNot Nothing Then
        If password = dr("password")
            Verified = True
            js=dr("角色")
            wb.appendcookie("userjs",dr("角色"))
            dr("登录时间")= Date.Today
            wb.AppendCookie("userid",dr("_identify"))
            username=dr("身份证号")
            wb.AppendCookie("username",dr("身份证号"))
            dr.save()
        End If
    End If
    If Verified AndAlso e.Path = "logon.htm"  Then \'如果用户访问的是登录页,且身份验证成功
        wb.AppendCookie("username",dr("身份证号")) \'将用户名和密码写入cookie
        wb.AppendCookie("password",Password)
        wb.appendcookie("userdw",dr("group"))
        wb.appendcookie("userjs",dr("角色"))
        wb.appendcookie("bj",dr("班级"))
        wb.AppendCookie("userid",dr("_identify"))
        dr("登录时间")= Date.Today
        dr.save()
        If js.Contains("学生")
            Dim pr As DataRow = DataTables("学生库").sqlfind("身份证号 = \'" & username & "\'")
            If pr IsNot Nothing AndAlso pr("提请审核")=False
                wb.InsertHTML("<meta http-equiv=\'Refresh\' c>")\'
            Else
                wb.InsertHTML("<meta http-equiv=\'Refresh\' c>")\'直接跳转到首页
            End If
        Else
            wb.InsertHTML("<meta http-equiv=\'Refresh\' c>")\' \'直接跳转到首页
        End If
        e.WriteString(wb.Build) \'
        Return \'
    ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then \'如果用户身份验证失败,且访问的不是登录页面
        wb.InsertHTML("<meta http-equiv=\'Refresh\' c; url=\'logon.htm\'>") \'那么直接跳转到登录页面
        e.WriteString(wb.Build)
        Return \'
    End If
End If


老师,是不是这页上面的《》zc.htm这个有关,该怎么才对?我理解的是在logon这页,如果《》zc.htm其他的都不能跳转,因为我用了是可用的页面加在这里都不行
[此贴子已经被作者于2020/2/26 18:01:58编辑过]

--  作者:有点蓝
--  发布时间:2020/2/27 9:03:00
--  
和这个没有关系。在上面代码后面加上调试语句,看看能不能执行
--  作者:刘林
--  发布时间:2020/2/27 12:15:00
--  
老师是这个意思,我在其他地方可以调用用网页(用代码生成的),但做在1楼这个页面上就不能生成网页,只有zc.htm可以


我做了最简的
e.WriteString("Hello World")
放在那个按键跳转都不行,用静态http://baidu.com可以

[此贴子已经被作者于2020/2/27 12:40:06编辑过]

--  作者:有点蓝
--  发布时间:2020/2/27 14:14:00
--  
下面这段有问题,但是看不出什么原因,可能有隐藏的特殊字符
        wb.InsertHTML("<meta http-equiv=\'Refresh\' content=\'0\'; url=\'logon.htm\'>") \'那么直接跳转到登录页面
        e.WriteString(wb.Build)
        Return \'
改为下面的,或者重新到帮助里复制
        wb.InsertHTML("<meta http-equiv=\'Refresh\' content=\'0; url=/logon.htm\'>") \'那么直接跳转到登录页面
        e.WriteString(wb.Build) \'生成网页
        Return \'必须的
[此贴子已经被作者于2020/2/27 14:16:07编辑过]