照片上传失败
可以加入选择吗 直接拍照还是选择文件上传
Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI '定义一个基于weui框架的网页生成器
Select Case e.Path
Case "qyrzfj.htm"
Dim bm As String
Dim gw As String
Dim name As String
Dim userid = Functions.Execute("验证函数",e,"qyrzfj.htm")
If userid > "" Then
wb.AppendCookie("userid",userid) '将用户名和密码写入cookie
Dim wxdr As DataRow = DataTables("users").SQLFind("userid='" & userid & "'")
If wxdr IsNot Nothing Then
gw = wxdr("position")
name = wxdr("name")
Dim wxdr1 As DataRow = DataTables("departments").SQLFind("id='" & wxdr("department") & "'")
If wxdr1 IsNot Nothing Then
bm= wxdr1("name")
End If
'e.WriteString(name & userid & "USERID获取成功" & gw & bm)
'------------------------------------------------------------------------------------------------------------------------------
wb.AddPageTitle("","pageheader","工作日志","艾迪尔国际家居")
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","qyrz.htm")
With wb.AddInputGroup("form1","ipg1","")
With .AddInput("姓名","填报人","Text")
.value = name
.readonly = True
End With
With .AddInput("部门","所属部门","Text")
.value = bm
.readonly = True
End With
With .AddInput("岗位","岗位","Text")
.value = gw
.readonly = True
End With
'提取登陆数据
End With
With wb.AddInputGroup("form1","ipg2","日志内容")
With .AddInput("日期","填报日期*","date")
.Value = Date.Today
End With
.AddInput("汇报对象","汇报对象*","Text")
With wb.AddInputGroup("form1","ipg3","今日达成")
.AddTextArea("今日达成",5).Placeholder = "请输入您的今日达成的工作 * "
End With
With wb.AddInputGroup("form1","ipg4","明日计划")
.AddTextArea("明日计划",5).Placeholder = "请输入您的明日计划工作 * "
End With
.AddInput("营业收入","业绩收入","number")
.AddInput("今日支出","今日支出","number")
With wb.AddInputGroup("form1","ipg5","领导协助事项")
.AddTextArea("工作建议",5).Placeholder = "请输入您需要上级协助的事情,或是需要提醒您的上级的待办事项."
End With
With wb.AddInputGroup("form1","ipg6","文件上传")
With .AddUploader("up128","照片",True)
.AllowDelete = True '允许删除
.Incremental = True '允许 重复选择文件或连续拍照
End With
End With
With wb.AddInputGroup("form1","ipg7","重要资料请 tocasa@icwood.top 邮箱")
'.AddUploader("up1","客户资料",True) 'True表示允许上传多个文件
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "button").Attribute= "" '调用js函数上传
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
'Case "qyrzfj.htm"
For Each key As String In e.Files.Keys
For Each fln As String In e.Files(key)
e.SaveFile(key,fln,"d:\web\uploadfiles\" & fln) '保存接收到的文件
Next
Next
e.WriteString("OK")
'e.WriteString(wb.Build)
End With
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() {"今日达成","明日计划","日期","姓名","营业收入","工作建议","今日支出" ,"部门","岗位"} '重新定义了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
dr.save()
wb.InsertHTML("我们收到您的日志:<br/>")
For Each key As String In e.PostValues.Keys
wb.InsertHTML(key & ":" & e.PostValues(key) & "<br/>")
Next
With wb.AddMsgPage("","msgpage","提交成功", "感谢您的付出,公司的辉煌离不开您的付出") '生成成功提示页
.AddButton("btn1","查看历史","lsrz.htm")
End With
e.WriteString(wb.Build)
End If
'-----------------------------------------------------------------------------------
End If
End If
End Select