以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 1为什么不能自动根据当前登录用户username进行变化 怎么实现一排显示 怎么防止多条相同数据的生成 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133465) |
-- 作者:李孝春 -- 发布时间:2019/4/15 10:23:00 -- 1为什么不能自动根据当前登录用户username进行变化 怎么实现一排显示 怎么防止多条相同数据的生成 麻烦老师看看 ,1、红色部分为什么不能自动根据当前登录用户username进行变化赋值呢,总是在第一次登录后名字,而不是每次登录都更新为当前登录名 2、红色部分按钮怎么实现一排显示 3、蓝色部分怎么防止多条相同数据的生成 Dim wb As New weui \'身份验证 Dim Verified As Boolean \'用于标记用户是否通过了身份验证 Dim UserName As String = e.Cookies("username") \'从cookie中获取用户名 Dim Password As String = e.Cookies("password") Dim usergroupdw As String = e.Cookies("usergroupdw") \'从cookie中获取用户密码 If e.Path = "logon.htm" \'如果是通过登录页面访问,从PostValues即可中提取用户名和密码 If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") AndAlso e.PostValues.ContainsKey("usergroupdw") Then UserName = e.PostValues("username") Password = e.PostValues("password") usergroupdw = e.PostValues("usergroupdw") End If End If If UserName <>"" AndAlso Password <>"" AndAlso usergroupdw <>"" Then Dim dr11 As DataRow dr11 = DataTables("systemuser").Find("username = \'" & username & "\'") If UserName = dr11("username") AndAlso Password = dr11("Password") AndAlso usergroupdw = dr11("所在单位")Then Verified = True End If End If If Verified AndAlso e.Path = "logon.htm" Then \'如果用户访问的是登录页,且身份验证成功 wb.AppendCookie("username",UserName) \'将用户名和密码写入cookie wb.AppendCookie("password",Password) wb.AppendCookie("usergroupdw",usergroupdw) 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","流程信息推送","") If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") AndAlso e.PostValues.ContainsKey("usergroupdw") Then \'判断是否是验证失败后的重新登录 wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If wb.AddForm("","form1","logon.htm") With wb.AddInputGroup("form1","ipg1") Dim filter11 As String = "表名 = \'干警信息\' and 列名 = \'所在单位\' and 停用 = false" Dim fdr11 As DataRow = DataTables("列项设置").Find(filter11) If fdr11 IsNot Nothing Then Dim abc11 As String=fdr11("下拉选项").replace(",", "|") .AddSelect("usergroupdw","所在单位","|"&abc11) End If \'.AddInput("usergroupdw","单位","text") .AddInput("username","户名","text") .AddInput("password","密码","password") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "登录", "button").Attribute = """ End With With wb.AddPageFooter("","pf1","Copyright © 贵州瓮安") \'.AddLink("底部链接","http://www.foxtable.com") End With e.WriteString(wb.Build) Case "exit.htm" \'退出登录 wb.DeleteCookie("username") \'清除cookie中原来的用户名和密码 wb.DeleteCookie("password") wb.DeleteCookie("usergroupdw") wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'那么直接跳转到登录页面 Case "Addglr.htm" If e.PostValues.Count = 0 Then wb.AddForm("","form1","addglr.htm") With wb.AddInputGroup("form1","ipg1","案件信息")
Dim dr11 As DataRow dr11 = DataTables("systemuser").sqlFind("username= username") .AddSelect("承办人","案件承办人",dr11("username")) \'.AddSelect("承办人","案件承办人","username") Dim filter1 As String = "承办人 = \'" & username & "\'" Dim fdr1 As DataRow = DataTables("案件基本信息").sqlFind(filter1) If fdr1 IsNot Nothing Then Dim abc1 As String=DataTables("案件基本信息").SQLGetComboListString("部门受案号",filter1) .AddSelect("部门受案号","部门受案号","|"&abc1) End If End With With wb.AddInputGroup("form1","ipg2","关联人信息") .AddInput("姓名","姓名","text") \'前一个"姓名"是ID,后一个"姓名"是标题 Dim filter11 As String = "表名 = \'人员关联表\' and 列名 = \'人员类型\' and 停用 = false" Dim fdr11 As DataRow = DataTables("列项设置").Find(filter11) If fdr11 IsNot Nothing Then Dim abc11 As String=fdr11("下拉选项").replace(",", "|") .AddSelect("人员类型","人员类型","|"&abc11) End If Dim filter As String = "表名 = \'人员关联表\' and 列名 = \'人员关系\' and 停用 = false" Dim fdr As DataRow = DataTables("列项设置").Find(filter) If fdr IsNot Nothing Then Dim abc As String=fdr("下拉选项").replace(",", "|") .AddSelect("人员关系","人员关系","|"&abc) End If Dim filter2 As String = "表名 = \'人员关联表\' and 列名 = \'人员角色\' and 停用 = false" Dim fdr2 As DataRow = DataTables("列项设置").Find(filter2) If fdr2 IsNot Nothing Then Dim abc2 As String=fdr2("下拉选项").replace(",", "|") .AddSelect("人员角色","人员角色","|"&abc2) End If .AddSelect("性别","性别","|男|女") .AddInput("手机号码","手机号码","text") .AddInput("电子邮件","电子邮件","text") .AddInput("微信号码","微信号码","text") .AddInput("QQ号码","QQ号码","text") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") .Add("btn2","取消","reset") .Add("btn3","返回首页","default.htm") 【这个地方的按钮是否可以设定为:确定 取消 返回首页 三个为一排呢 而不是为三行 谢谢】 End With e.WriteString(wb.Build) Else Dim nms() As String = {"部门受案号","姓名","手机号码","人员类别"} \'不能为空的列名数组 For Each nm As String In nms If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页 With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With e.WriteString(wb.Build) Return \'必须返回 End If Next nms = New String() {"姓名","电子邮件","性别","称谓","部门受案号","微信号码","手机号码","QQ号码","人员类别","人员关系","人员角色","嫌疑人姓名"} \'重新定义了nms数组,增加了两列. Dim dr As DataRow = DataTables("人员关联表").AddNew() For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then dr(nm) = e.PostValues(nm) End If Next 【这个地方会因为网速迟延或者网页刷新频率,导致后台增加多条一样数据的记录,有么有办法可以优化呢?】 If dr("部门受案号") <>"" Then Dim dr11 As DataRow dr11 = DataTables("案件基本信息").Find("部门受案号 = \'"&dr("部门受案号")&"\' ") dr("嫌疑人姓名")=dr11("嫌疑人姓名") \'dr("案件名称")=dr11("案件名称") dr11("是否关联")="是" End If With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") \'生成成功提示页 .AddButton("btn1","继续增加","addglr.htm") .AddButton("btn2","返回首页","default.htm") End With e.WriteString(wb.Build) End If End Select e.WriteString(wb.Build) \'生成网页
|
-- 作者:有点甜 -- 发布时间:2019/4/15 12:04:00 -- 1、dr11 = DataTables("systemuser").sqlFind("username= \'" & username & "\'")
2、参考 http://www.foxtable.com/mobilehelp/scr/0008.htm
3、addnew之前,先find查找是否已经存在对应的行 http://www.foxtable.com/webhelp/scr/0396.htm
|