Foxtable(狐表)用户栏目专家坐堂 → 新版本异步网页的问题


  共有4171人关注过本帖平板打印复制链接

主题:新版本异步网页的问题

帅哥哟,离线,有人找我吗?
rjh4078
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3355 积分:24732 威望:0 精华:0 注册:2012/3/26 21:47:00
  发帖心情 Post By:2018/7/10 9:57:00 [只看该作者]

Dim fl As String = ProjectPath & "web\"  & e.path
If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String  = fl.SubString(idx)
    Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
            e.WriteFile(fl)
            Return '这里必须返回
    End Select
End If
Dim wb As New weui

'身份验证
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim zh As String = e.Cookies("zh") '从cookie中获取用户名
Dim bh As String = e.Cookies("bh")
Dim bm As String = e.Cookies("bm")
Dim xm As String=e.Cookies("xm")
Dim mm As String =e.Cookies("mm")  '从cookie中获取用户密码
If e.Path = "logon.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码
    If e.PostValues.ContainsKey("bh") AndAlso e.PostValues.ContainsKey("mm")  Then
        bh = e.PostValues("bh")
        mm = e.PostValues("mm")        '
    End If
End If
If bh>"" AndAlso mm>"" Then
    Dim tr As DataRow=DataTables("人员表").sqlfind("编号='" & bh & "' and 启用=1 and 密码='" & EncryptText(mm,"a5","erp") & "'" )
    If tr IsNot Nothing Then
        Verified  = True
        zh=tr("姓名")
        bm=tr("部门")
    Else
        wb.AddTopTips("","toptip5","用户名或密码错误!").msec = 2000
    End If
End If
If Verified AndAlso e.Path = "logon.htm"  Then '如果用户访问的是登录页,且身份验证成功
    wb.AppendCookie("bh",bh) '将用户名和密码写入cookie
    wb.AppendCookie("mm",mm)
    wb.AppendCookie("bm",bm)
    wb.AppendCookie("xm",zh)
    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.InsertHTML("<p align='center'><img width='200' height='190'  src='" & "./images/logo.png" &  "'/></p>")
        If e.PostValues.ContainsKey("bh") AndAlso e.PostValues.ContainsKey("mm")  Then '判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form1","logon.htm")
        With wb.AddInputGroup("form1","ipg1")
            With .AddInput("bh","账号","text")
                If e.Cookies("bh")>"" Then
                    .Value=e.Cookies("bh")
                End If
            End With
            .AddInput("mm","密码","password")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "登录", "submit")
        End With
    Case "exit.htm" '退出登录
        wb.DeleteCookie("mm")
        wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
    Case  "index.htm" '首页
        wb.AddPageTitle("","pageheader","A5 ESA","授予:****")
        With wb.AddGrid("","g1")
            .Add("c1","销售订单", "./images/销售订单.png","list.htm")
            .Add("c2","上传订单图片", "./images/upload.png", "ddupload.htm")
            .Add("c3","订单查询", "./images/订单查询.png", "ordersearch.htm")
            .Add("c4","库存查询", "./images/库存查询.png", "psearch.htm")
            .Add("c5","订单图片查询", "./images/ddupload.png", "ddtpsearch.htm")
            .Add("c61","调拨单", "./images/调拨单.png", "dblist.htm")
            
            .Add("c62","调拨查询", "./images/调拨查询.png", "dbdcx.htm")
            .Add("c7","客户", "./images/客户查询.png", "custj.htm")
            .Add("c8","供应商", "./images/供应商查询.png", "suppliertj.htm")
            .Add("c9","上传产品图片", "./images/upload.png", "upload.htm")
            .Add("c12","退出", "./images/退出.png", "exit.htm") '退出登录
        End With
        Dim dr As DataRow
        dr=Functions.AsyncExecute("业务员销售统计",bh)
        If dr IsNot Nothing Then
            With wb.AddPageFooter("","pf1","Copyright &copy; 2009-2017 bhufine.com")
                .AddLink("你好," & zh & "!" & Date.now.month &"月累计销售额:" & dr("销售金额") & "元.排名第" & dr("排名") & "!","")
            End With
        Else
            With wb.AddPageFooter("","pf1","Copyright &copy; 2009-2017 toyota.com")
                .AddLink("你好," & zh & "!" & Date.now.month &"月累计销售额:0元,暂无排名!" ,"")
            End With
        End If
    Case "list.htm"
        Functions.AsyncExecute("List",e) '分页显示
    Case "edit.htm"
        If e.PostValues.Count > 0 Then
            Functions.AsyncExecute("Save",e) '保存表单数据
        End If
        Functions.AsyncExecute("Edit",e) '生成订单编辑页面
    Case "psearch.htm"
        Functions.AsyncExecute("商品查询条件",e)
    Case "cpchaxun.htm"
        Functions.AsyncExecute("psearch",e)
    Case "ordersearch.htm"
        Functions.AsyncExecute("订单明细查询条件",e)
    Case "orderesults.htm"
        Functions.AsyncExecute("订单汇总查询",e)
    Case "orderdetails.htm"
        Functions.AsyncExecute("订单明细查询",e)
    Case "upload.htm"
        Functions.AsyncExecute("upload",e)
    Case "suppliertj.htm"
        Functions.AsyncExecute("suppliertj",e)
    
   
End Select
e.WriteString(wb.Build) '生成网页

我的httprequest代码结构大概是这样 需要按照帮助 每个case前面都要加e.AsyncExecute = True 然后每个函数再去e.Handled = True?

 回到顶部
总数 48 1 2 3 4 5 下一页