以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于百度Echars的测试  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=103594)

--  作者:zhy400137
--  发布时间:2017/7/12 13:14:00
--  关于百度Echars的测试
关于百度Echars的测试,我中间加了个查询期间,并且把页面写成了内部函数就不行了,麻烦版主帮忙看看.
--  作者:zhy400137
--  发布时间:2017/7/12 13:15:00
--  
httprequest代码
Dim fl As String = "d:\\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 UserID As String = e.Cookies("userid") \'从cookie中获取用户名
Dim PassWord As String = e.Cookies("password") \'从cookie中获取用户密码
If e.Path = "logon.htm" \'如果是通过登录页面访问,从PostValues即可中提取用户名和密码
    If e.PostValues.ContainsKey("userid") AndAlso e.PostValues.ContainsKey("password")  Then
        UserID = e.PostValues("userid")
        PassWord = e.PostValues("password")
    End If
End If
\'验证密码
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
cmd.ConnectionName = DataSource
cmd.CommandText = "Select * F rom {用户管理} Where [用户编号] = \'" & UserID & "\'"
dt = cmd.ExecuteReader
If dt.DataRows.Count > 0 Then
    dr=dt.DataRows(0)
    If PassWord=DecryptText(dr("登录密码") ,"zhy","823") Then
        Verified  = True
    End If
End If

If Verified AndAlso e.Path = "logon.htm"  Then \'如果用户访问的是登录页,且身份验证成功
    wb.AppendCookie("userid",UserID) \'将用户名和密码写入cookie
    wb.AppendCookie("password",PassWord)
    wb.AppendCookie("DepName",dr("部门名称"))
    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" \'登录页面
        Functions.Execute("Weblogon",e)
    Case "exit.htm" \'退出登录
        Functions.Execute("Webexit",e)
    Case "", "default.htm" \'首页
        Functions.Execute("Webdefault",e)
    Case "salestargetquery.htm" \'目标达成查询
        Functions.Execute("SalestargetQuery",e)
    Case "salestargetlist.htm" \'目标达成清单
        Functions.Execute("SalestargetList",e)
    Case "getdata.htm" \'目标达成清单
        Functions.Execute("Getdata",e)
    Case "fsrsedit.htm"
        If e.PostValues.Count > 0 Then
            Functions.Execute("WebfsrsSave",e) \'保存表单数据
        End If
        Functions.Execute("WebfsrsEdit",e) \'生成订单编辑页面
End Select
e.WriteString(wb.Build) \'生成网页

--  作者:zhy400137
--  发布时间:2017/7/12 13:17:00
--  
SalestargetQuery 内部函数
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.AddPage("","page1") \'增加两个page
wb.AddPage("","page2")
wb.AddForm("page1","form1","SalestargetList.htm") \'表单显示在第一个页面
With wb.AddInputGroup("form1","ipg1","销售统计")
    .AddSelect("qj","期间","|" & DataTables("销售任务").SqlGetComboListString("期间")) 
End With
With wb.AddButtonGroup("form1","btg1",True)
    .Add("btn1", "统计", "button").Attribute= ""
End With
wb.AppendHTML("<script src=\'./lib/WebSalestargetForm.js\'></script>") \'引入脚本文件
e.WriteString(wb.Build)

--  作者:zhy400137
--  发布时间:2017/7/12 13:17:00
--  
WebSalestargetForm.js 代码
function Salestargettongji(){
    var result = submitAjaxForm(\'form1\',\'\',false);
    document.getElementById("page2").innerHTML=result;
    hide(\'page1\');
    show(\'page2\');
}

--  作者:zhy400137
--  发布时间:2017/7/12 13:18:00
--  
SalestargetList 内部函数
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.AppendHTML("<script src=\'http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js\'></script>",True)
wb.AppendHTML("<script src=\'http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js\'></script>",True)
wb.AppendHTML("<script src=\'http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js\'></script>",True)
wb.AppendHTML("<script src=\'http://echarts.baidu.com/gallery/vendors/echarts/map/js/china.js\'></script>",True)
With wb.AddArticle("","ar1")
    .AddTitle("h1","销售达成率")
    .AddContent("<div id=""main1"" style=""width: 600px;height:400px;""></div>")
End With
wb.AppendHTML("<script src=\'./lib/map.js\'></script>")
e.WriteString(wb.Build)

--  作者:zhy400137
--  发布时间:2017/7/12 13:19:00
--  
map.js 和 getdata 都是用 蓝版的示例
--  作者:zhy400137
--  发布时间:2017/7/12 13:20:00
--  
现在可以显标图表标题,但图表不能显示.我暂只是用蓝版的TXT测试
--  作者:有点蓝
--  发布时间:2017/7/12 14:06:00
--  
Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar",".txt"
            e.WriteFile(fl)
            Return \'这里必须返回
    End Select