Select Case e.Path
Case "addnew.htm"
Dim wb As New weui
wb.AddForm("","form1","receive.htm")
With wb.AddInputGroup("form1","ipg1","文件上传")
.AddInput("姓名","姓名","Text").Placeholder = "选填" '前一个"姓名"是ID,后一个"姓名"是标题
.AddInput("电话","电话","number").Placeholder = "必填"
.AddSelect("类别","类别","环境|食品|其他")
.AddInput("位置","位置","Text").Placeholder = "必填"
With .AddUploader("up1","照片",True)
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
End With
With wb.AddInputGroup("form1","ipg2","情况说明")
.AddTextArea("bz",3).Placeholder = "请输入100字以内的备注"
End With
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 "receive.htm"
Dim nms() As String = {"姓名","电话","类别","位置","情况说明"}
Dim dr As DataRow = DataTables("表A").AddNew()
For Each nm As String In nms
dr(nm) = e.PostValues(nm)
Next
For Each key As String In e.Files.Keys
If key = "up1" Then
For Each fln As String In e.Files(key)
e.SaveFile(key, fln, ProjectPath & "Attachments\" & fln)
Next
dr.Lines("照片") = e.Files(key)
End If
Next
'保存并生成增加成功提示页面
dr.save()
e.WriteString("OK")
End Select