Dim e As RequestEventArgs = Args(0)
Dim wb As New weui
Dim dt As DataTable
Dim dt2 As DataTable
Dim Openid As String = Functions.Execute("Http_Get_MpOpenid2",e,wb)
If openid="" Then
e.WriteString(wb.Build)
e.Handled = True
Return ""
End If
Dim fdr As DataRow= xDataTables("Person_info").SQLFind("openidband= '" & Openid & "' and is_band='1' ") ‘xDataTables是改写过的用于异步状态的
'下面生成网页
With wb.AddTabBar("", "tb1", 0)
.AddPage("page1","首页","./images/button.png")
' If cmd.ExecuteScalar > 0 Then
If fdr IsNot Nothing Then
.AddButton("bt1","我","./images/cell.png","/userInfo.htm")
Else
.AddButton("bt1","我","./images/cell.png").Attribute = """
End If
' .AddButton("btn22","内容2").Attribute = """
End With
With wb.AddDialog("","dlg1", "","")
.AddButton("btnOK","确定","/userInfo.htm")
.AddButton("btnCancel","取消")
End With
wb.AddPageTitle("page1","ph1","培训报名","安全生产 重在落实")
If Openid >"" Then
dt =Functions.Execute("personlist",Openid,"1")
dt2 =Functions.Execute("personlist",Openid,"2")
End If
With wb.AddListGroup("page1","rdg1","培训报名信息")
If dt.DataRows.Count > 0 Then
For Each dr1 As DataRow In dt.DataRows
If dr1("peixun") =True Then
.Add( dr1("bmID"), dr1("name")+"|"+dr1("bmunit") ,"报名时间:"+dr1("createdate").tostring.SubString(0,10) ).Badge="已培训"
Else
.Add( dr1("bmID"), dr1("name")+"|"+dr1("bmunit") ,"报名时间:"+dr1("createdate").tostring.SubString(0,10) ).Badge="待培训"
End If
Next
Else
.Add("ls11" ,"未匹配报名信息!","" )
End If
End With
'
With wb.AddButtonGroup("page1","btg1",False) '垂直排列
.Add("btn3", "进入报名页面").Attribute = """
.Add("btn4", "培训表格下载", "", "/qytable.htm" ) '单击这个按钮可以打开foxtable主页
End With
With wb.AddDialog("","dlg2", "报名须知","报名后下载报名表,参加培训时携带上交,等待短信或微信通知" )
'.AddButton("btnCancel","取消").Kind = 1
.AddButton("btnOK","确定","/bmSearch.htm")
End With
With wb.AddListGroup("page1","rdg2","培训信息")
If dt2.DataRows.Count > 0 Then
For Each dr1 As DataRow In dt2.DataRows
.Add( dr1("bmID"), dr1("name")+"|"+dr1("bmunit") ,"最近培训:"+dr1("Train_Date").tostring.SubString(0,10),"http://pxbm.deqsafety.gov.cn/pInfo.aspx?bmid=" + dr1("bmID") )
Next
Else
.Add("ls12" ,"未匹配培训信息!","" )
End If
End With
e.WriteString(wb.Build)
e.Handled = True
"Http_Get_MpOpenid2" :
Dim e As RequestEventArgs = Args(0)
Dim Openid As String '微信用户Openid
Dim code As String '微信授权码
Dim state As String '开发者id
Dim wb As weui =args(1)
If e.Cookies.ContainsKey("pxopenid") Then '从cookie中获取微信用户id
Openid = e.Cookies("pxopenid")
Else
If e.host<> "127.0.0.1" Then
If String.IsNullOrEmpty(code) OrElse (e.GetValues.ContainsKey("code") AndAlso code <> e.GetValues("code")) Then
'If e.GetValues.ContainsKey("state") Then state = e.GetValues("state") 'url的值,这里存储微信用户公众号开发者id,如果只维护一个公众号,可以忽略这个
If e.GetValues.ContainsKey("code") Then 'url的值
code = e.GetValues("code")
openid =Functions.Execute("WeChat_GetOpenid_mp",code)
End If
End If
Else
Openid ="otmQFs6MaQBpfCrkihqi_XMw4V4s"
'openid="otmQFs0aNsrqwkBhvt1oUTqfman4"
End If
End If
If Openid >"" Then
wb.Appendcookie("pxopenid",openid )
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText = "Insert Into wxWeblog(host,path,CREATE_TIME,openid) Values(?,?,?,?)"
cmd.Parameters.Add("@11",e.host)
cmd.Parameters.Add("@22",e.path )
cmd.Parameters.Add("@66",now.Tostring.replace("-","").replace(" ","").replace(":",""))
cmd.Parameters.Add("@44",openid)
cmd.ExecuteNonQuery
Return openid
Else
Dim ul2 As String
If redirectUl="true" Then
ul2 ="http://es.XXXXXX.cn/get-weixin-code.html?appid={0}&scope=snsapi_base&state="+ mpCorpID +"&redirect_uri="+ UrlEncode("http://" & e.host & "/" & e.path )
Else
ul2 ="https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri="+ UrlEncode("http://" & e.host & "/" & e.path )+ "&response_type=code&scope=snsapi_base&state="+ mpCorpID +"#wechat_redirect"
End If
ul2=CExp(ul2,mpCorpID)
wb.InsertHTML("<meta http-equiv='Refresh' c>") '跳转到授权链接
Return ""
End If
[此贴子已经被作者于2019/3/8 15:08:49编辑过]