以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助] 移动开发  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=104296)

--  作者:zcgmxf
--  发布时间:2017/7/26 23:48:00
--  [求助] 移动开发

老师 下面的代码执行后会弹出如图所示 对话框,请问 单击确定按钮后如何才能返回   dlg1 对话框?谢谢!

 

Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.PostValues.Count = 0 Then
    wb.AddForm("","form1","upload.htm")
    Dim gjs As List(of String) = DataTables("项目设置").GetValues("从业类别")
    With wb.AddInputGroup("form1","ipg1","请正确填写个人信息")
        .AddInput("体检日期","体检日期","date").Value = Format(Date.Today,"yyyy-MM-dd")
        .AddInput("姓名","姓名","Text")
        .AddInput("身份证号码","身份证号码","Text").Placeholder = "请输入正确的身份证号码"
        .AddSelect("性别","性别","男|女")
        .AddInput("年龄","年龄","number")
        .AddInput("工作单位","工作单位","Text")
        .AddSelect("从业类别","从业类别","|" & String.Join("|",gjs.ToArray)).Attribute = ""  \'调用js函数.
        .AddSelect("工种","工种","")
        For Each gj As String In gjs
            wb.InsertHTML("<p hidden id=\'" & gj & "\'>" & DataTables("项目设置").GetComboListString("工种","从业类别=\'" & gj & "\'") & "</p>")
        Next
        wb.AppendHTML("<script src=\'./zizhutijiandengji/brands.js\'></script>") \'引入脚本文件
        .AddInput("联系电话","联系电话","Text")
       
        With .AddUploader("照片","照片",False)
            .TextPosition = 0 \'标题靠左
            .AllowDelete = True \'允许删除
            .Incremental = True \'允许重复选择文件或连续拍照
            .ScaleWidth = 150 \'自动压缩图片宽度为400个像素,高度等比例压缩
            .Rotate = 1
        End With
        .AddSwitch("登记完成","登记完成",False).Value = True
    End With
    With wb.AddButtonGroup("form1","btg1",False)
        .Add("btn1", "提交信息", "button").Attribute= ""
        .Attribute= "" \'调用js函数上传
        .Add("btn1", "退出", "", "default.htm")
    End With
    wb.AddToast("","tst1", "正在上传",1)
    wb.AddToast("","tst2", "上传成功",0)
    wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
    wb.AppendHTML("<script src=\'./zizhutijiandengji/scystp.js\'></script>") \'引入脚本文件
   
    With wb.AddDialog("","dlg1", "提示","登记成功,是否继续登记?") \'增加订单成功提示框
        .AddButton("btnYes","继续").Attribute = ""
        .AddButton("btnNo","退出","default.htm").Kind = 1
    End With
    With wb.AddDialog("","dlg2", "必填项目","") \'增加订单失败提示框
        .AddButton("btnOK","确定")
    End With
    wb.AppendHTML("<script src=\'./lib/dhk.js\'></script>") \'引入脚本文件
    e.WriteString(wb.Build)
Else   
    Dim nms() As String = {"姓名","身份证号码","性别","年龄","工作单位","从业类别","工种","联系电话"} \'不能为空的列名数组
    For Each nm As String In nms
        If e.PostValues.ContainsKey(nm) = False Then
            e.WriteString("<h3 align=\'center\' style=\'margin-top:5px;color:Blue\'> ""请输入:" & nm & "!"" </h3>")
            Return ""\'必须返回
        End If
    Next
   
    Dim qrs() As String = {"登记完成"} \'不能为空的列名数组
    For Each qr As String In qrs
        If e.PostValues.ContainsKey(qr) = False Then
            e.WriteString("<h3 align=\'center\' style=\'margin-top:5px;color:Blue\'> ""请确认:" & qr & "!"" </h3>")
            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
    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, "d:\\中心文件管理\\健康证照片\\Attachments\\" & dr("身份证号码") & ".bmp")
            Next
            dr("照片") = "健康证照片\\Attachments\\" & dr("身份证号码") & ".bmp"
        End If
    Next
    dr.save()
    Dim d As DataRow = DataTables("从业人员健康检查表").SQLFind("身份证号码= \'" & dr("身份证号码") & "\'")
    If d IsNot Nothing Then
         Dim str As String = dr("编号")
         Dim bh As String = str.SubString(10)
         e.WriteString("<h3 align=\'center\' style=\'margin-top:5px;color:Blue\'> 请记住您的体检编号: \'" & bh & "\' </h3>")
    End If
      e.WriteString("OK")
End If

 

 

 

 


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20170726234620.png
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2017/7/27 9:02:00
--  

贴出你js代码。

 

你要做什么?根据什么逻辑?你要弹出哪个就直接show哪个啊 show(\'dlg1\')


--  作者:zcgmxf
--  发布时间:2017/7/27 14:31:00
--  

老师, 这个是新增体检对象的函数。我想在新增完成后将该体检对象的编号通过对话框的形式返回给客户端,这个是实现了。但是

 

好像是通过错误提示对话框返回的,我想确定后 显示dlg1 提示用户继续新增或退出。不知是否正确。js函数在lib文件夹  dhk.js

 

function myfunction(){
    var result = submitAjaxForm(\'form1\',\'\',false);
    if (result ==\'OK\') {show(\'dlg1\')}
    else {showDialog(\'dlg2\',\'\',result)}
}

 

谢谢!


--  作者:有点甜
--  发布时间:2017/7/27 15:33:00
--  

function myfunction(){
    var result = submitAjaxForm(\'form1\',\'\',false);

    var ary = result.split("@");
    if (ary[0] ==\'OK\') {

          if(ary.length==2) {showDialog(\'dlg2\',\'\',ary[1])}

          show(\'dlg1\');

    }
    else {

          showDialog(\'dlg2\',\'\',ary[1])

    }
}

 

httprequest代码改一下

 

    If d IsNot Nothing Then
         Dim str As String = dr("编号")
         Dim bh As String = str.SubString(10)
         e.WriteString("OK@<h3 align=\'center\' style=\'margin-top:5px;color:Blue\'> 请记住您的体检编号: \'" & bh & "\' </h3>")
    End If
      e.WriteString("OK")

 

 


--  作者:zcgmxf
--  发布时间:2017/7/27 23:14:00
--  

老师,上面的问题是解决了,不过以前为空 的提示 成了如图。请老师指点。谢谢!

 

 


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20170727230923.png
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2017/7/27 23:19:00
--  

代码写错了,改一下

 

function myfunction(){
    var result = submitAjaxForm(\'form1\',\'\',false);

    var ary = result.split("@");
    if (ary[0] ==\'OK\') {

          if(ary.length==2) {showDialog(\'dlg2\',\'\',ary[1])}

          show(\'dlg1\');

    }
    else {

          showDialog(\'dlg2\',\'\',ary[0])

    }
}