-- 图片压缩不成功,套用异步失败,求解
Dim wb As New weui
Select Case e.Path
Case "addnew.htm"
If e.PostValues.Count = 0 Then
wb.AddToast("", "t1", "正在上传", 1) \'定义提示
wb.AddForm("", "form1", "addnew.htm").attribute = """
With wb.AddInputGroup("form1", "ipg1", "故障记录")
With .AddInput("门店名称", "门店名称", "Text") \'前一个"门店名称"是ID,后一个"门店名称"是标题
.Attribute = """
End With
.AddSelect("负责人", "负责人", "")
.AddInput("日期", "日期", "date")
.AddSelect("难易程度", "难易程度", "简单|一般|困难")
.AddSelect("耗材", "耗材", "3.5寸筒灯|4寸筒灯|6寸筒灯")
.AddTextArea("所需耗材", 5).Placeholder = "请输入故障详细所需材料"
End With
With wb.AddInputGroup("form1", "ipg2", "上传图片")
With .AddUploader("故障图片", "故障图片", True) \'True表示允许上传多个文件
.AllowDelete = True \'允许用户删除图片
.Accept = "image/*" \'微信浏览器允许使用相册和相机
.ScaleWidth = 400 \'自动压缩图片宽度为400个像素,高度等比例压缩
End With
End With
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn1", "确定", "submit")
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() {"门店名称", "负责人", "日期", "难易程度", "耗材", "所需耗材"} \'重新定义了nms数组,增加了两列.
Dim dr As DataRow = DataTables("故障记录表").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 = "故障图片" 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()
With wb.AddMsgPage("", "msgpage", "增加成功", "好好学习") \'生成成功提示页
.AddButton("btn1", "继续增加", "addnew.htm")
End With
e.WriteString(wb.Build)
End If
Case "getBrands.htm"
Dim pps As String = DataTables("门店信息").GetComboListString("负责人", "门店名称=\'" & e.PostValues("门店名称") & "\'")
e.WriteString(pps)
End Select