Foxtable(狐表)用户栏目专家坐堂 → [求助]手机程序开发自己加入的页面怎么不好用?


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

主题:[求助]手机程序开发自己加入的页面怎么不好用?

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


加好友 发短信
等级:八尾狐 帖子:1959 积分:15526 威望:0 精华:0 注册:2011/7/16 20:59:00
[求助]手机程序开发自己加入的页面怎么不好用?  发帖心情 Post By:2017/5/4 9:36:00 [只看该作者]

Static UserTable As DataTable '定义一个变量,用于存储用户随机身份ID,以及最后一次活动时间.
Static ClearTime As Date
If UserTable Is Nothing Then '创建用于记录登录信息的临时表
    ClearTime = Date.Now()
    Dim dtb As New DataTableBuilder("UserInfos")
    dtb.AddDef("UserName", Gettype(String), 16)
    dtb.AddDef("UserID",Gettype(String),16)
    dtb.AddDef("ActiveTime",Gettype(Date))
    UserTable = dtb.Build(True)
End If
If (Date.Now - ClearTime).TotalMinutes >= 30 Then '清除超过30分钟没有操作的登录信息
    UserTable.DeleteFor("ActiveTime < #" & Date.Now.AddMinutes(-30) & "#")
    ClearTime = Date.Now()
End If
'通用事件头
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 UserName As String
Dim Password As String
Dim UserID As String
If e.Path = "logon.htm" '验证用户名和密码
    If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then
        Dim Verified As Boolean '用于标记用户是否通过了身份验证
        UserName = e.PostValues("username")
        Password = e.PostValues("password")
        If UserName = "张三" AndAlso Password = "888" Then  '实际使用的时候,请改为从数据库读取用户名和密码进行比较
            Verified  = True
        ElseIf Username = "李四" AndAlso Password="999" Then
            Verified  = True
        End If
        If Verified Then
            UserID = Rand.NextString(16) '生成随机用户ID
            UserName = EncryptText(UserName,"123","123") '将用户名加密.
            Dim dr As DataRow = UserTable.Find("UserName = '" & UserName & "'")
            If  dr IsNot Nothing Then '如果是重复登录,删除以前的登录信息
                dr.Delete()
            End If
            dr = UserTable.AddNew()
            dr("UserName") = UserName
            dr("UserID") = UserId
            dr("ActiveTime") = Date.Now '记录登录时间
            wb.AppendCookie("username",UserName) '将用户名和密码写入cookie
            wb.AppendCookie("userid",UserID)
            wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
            e.WriteString(wb.Build) '生成网页
            Return '必须的
        End If
    End If
Else '其它页面从Cookie提取登录信息进行验证
    UserName = e.Cookies("username")  '从cookie中获取用户名
    UserID = e.Cookies("userid")  '从cookie中获取 随机ID
    Dim dr As DataRow = UserTable.Find("UserName = '" & UserName & "'")
    If dr IsNot Nothing AndAlso dr("UserID") = UserID Then  '如果通过验证,更新活动时候,继续访问其它页面.
        dr("ActiveTime") = Date.Now '更新活动时间
    Else '如果验证失败
        wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
        e.WriteString(wb.Build) '生成网页
        Return '必须的
    End If
End If
'开始生成网页
Select Case e.path
    Case "logon.htm","" '登录页面
        wb.AddPageTitle("","pageheader","销售系统","由湛江辉迅基于Foxtable开发")
        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("btn0", "修改密码", "botton","xgmm.htm")
            .Add("btn1", "登录", "submit")
        End With
    Case "exit.htm" '退出登录
        wb.DeleteCookie("username") '清除cookie中原来的用户名和密码
        wb.DeleteCookie("password")
        wb.InsertHTML("<meta http-equiv='Refresh' c>") '然后直接跳转到登录页面
    Case "", "default.htm" '首页
        wb.AddPageTitle("","pageheader","销售系统","由湛江辉迅基于Foxtable开发")
        With wb.AddGrid("","g1")
            .Add("c1","增加订单", "./images/105.png").Attribute = ""
            .Add("c2","客户管理", "./images/120.png", "http://www.foxtable.com")
            .Add("c3","销售统计", "./images/121.png").Attribute = ""
            .Add("c4","Dialog", "./images/130.png", "http://www.foxtable.com")
            .Add("c5","Progress", "./images/123.png", "http://www.foxtable.com")
            .Add("c6","Msg", "./images/124.png", "http://www.foxtable.com")
            .Add("c7","Article", "./images/125.png", "http://www.foxtable.com")
            .Add("c8","ActionSheet", "./images/126.png", "http://www.foxtable.com")
            .Add("c9","Icons", "./images/127.png", "http://www.foxtable.com")
            .Add("c10","Panel", "./images/128.png", "http://www.foxtable.com")
            .Add("c11","Tab", "./images/129.png", "http://www.foxtable.com")
            .Add("c12","退出", "./images/147.png", "exit.htm") '退出登录
           
        End With
    Case "xgmm"
       
        wb.AddPageTitle("","pageheader","修改密码","由湛江辉迅基于Foxtable开发")
        If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then '判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form2","xgmm.htm")
        With wb.AddInputGroup("form1","ipgx1")
            .AddInput("ymm","原密码","password")
            .AddInput("xmm","新密码","password")
            .AddInput("yzmm","验证密码","password")
           
        End With
       '    With wb.AddButtonGroup("form2","btg1",False)
       
End Select
e.WriteString(wb.Build) '生成网页

 

 

 

这是教材中的一个例子。红笔处是自己修改的。怎么不好用呢?一点修改密码就回到了登陆界面。怎么回事?谢谢

[此贴子已经被作者于2017/5/4 9:37:13编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/5/4 9:53:00 [只看该作者]

Case "xgmm.htm"

 回到顶部
帅哥哟,离线,有人找我吗?
新福星
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1959 积分:15526 威望:0 精华:0 注册:2011/7/16 20:59:00
  发帖心情 Post By:2017/5/4 11:09:00 [只看该作者]

按这个改过来了,仍然不行!

在这下面这个位置,按修改密码按钮,显示的是  logon.htm

 

MessageBox.Show(e.path)

'开始生成网页
Select Case e.path
Case "logon.htm","" '登录页面
wb.AddPageTitle("","pageheader","销售系统","由湛江辉迅基于Foxtable开发")


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/5/4 11:29:00 [只看该作者]

处理逻辑有问题。要登录后才能修改密码,不然验证不通过当然又跳回登录页面了。把修改密码按钮放到首页中

 回到顶部