以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]如何将这些信息回传到调用的Htm里呢  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=159932)

--  作者:fczhaobo
--  发布时间:2021/1/14 11:42:00
--  [求助]如何将这些信息回传到调用的Htm里呢
Dim e As RequestEventArgs = args(0)
Dim yzm As String = Rand.Next(2001,9999) \'生成200到300之间的随机整数
Dim sjh As String = e.postvalues("sjh")

Dim i As Integer=DataTables("短信服务").SQLCompute("Count(*)","接收号=\'" & sjh & "\' and DateDiff(n, 发送时间, GetDate()) <= 5")
If i > 0 Then
    e.WriteString(sjh & "五钟以内已经发送过验证码!")
    Return  Nothing
Else
    Dim product As String = "Dysmsapi" \'无需更改,官方名称
    Dim domain As String = "dysmsapi.aliyuncs.com" \'无需更改,官方名称
    Dim accessId As String = "*********" \'更换为您的AccessKey
    Dim accessSecret As String = "G*********" \'更换为您的AccessSecret
    Dim regionIdForPop As String = "cn-hangzhou" \'无需更改,官方名称
    
    Dim profile As Aliyun.Acs.Core.Profile.IClientProfile =  Aliyun.Acs.Core.Profile.DefaultProfile.GetProfile(regionIdForPop, accessId,  accessSecret)
    Aliyun.Acs.Core.Profile.DefaultProfile.AddEndpoint(regionIdForPop, regionIdForPop,  product, domain)
    Dim acsClient As Aliyun.Acs.Core.IAcsClient = New Aliyun.Acs.Core.DefaultAcsClient (profile)
    Dim request As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsRequest = New  Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsRequest()
    Dim response As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsResponse = Nothing
    
    Try
        request.PhoneNumbers = sjh
        request.SignName = "逸飞书画学校" \'更换为您备案的短信签名
        request.TemplateCode = "SMS_209173007" \'更换您备案的短信模板
        request.TemplateParam = "{""code"":""" & yzm & """}" \' \'如果您有可 替换的标签,可以设置设置json,也可以注释掉
        response = acsClient.GetAcsResponse(request)
        
        Dim dr As DataRow =DataTables("短信服务").AddNew
        dr("接收号") = sjh
        dr("发送类型") = "验证码"
        dr("发送时间") = Date.Now
        dr("发送内容") = yzm
        dr.Save        
        e.WriteString("ok") \'传递验证码参数
    Catch ex As Exception
        e.WriteString("短信代码有问题,请联系技术员")
    End Try
    
End If

//调用的网页
wb.AddTopTips("","toptip1","") \'用于显示动态错误提示
        wb.AddForm("","form1","wxyz.htm?openid=" & openid)
        \'.Attribute=""
        With wb.AddInputGroup("form1","ipg1","请输入学员报名时登记的联系电话")
            With .AddInputCell("ic1")  \'通过InputCell增加输入框(1表示突出显示,2表示红色警示图标)
                .AddLabel("ljh","手机",0)  \'增加标签(0显示在左边)
                .AddInput("sjh","text",1).PlaceHolder= "请输入手机号"  \'增加输入框(0靠左显示,1居中显示,2靠右显示)
                .AddVcodeButton("vyz","获取验证码",2).Attri-bute="onc-lick=\'getUser()\'"   \'sjh(是个input输入值)和yzm(是个变量)都用需要进行替换
            End With
            With .AddInputCell("ic2")
                .AddLabel("lyz","验证",0)
                .AddInput("iyz","text",1).PlaceHolder= "请输入验证码"
            End With
        End With
                With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "submit")
        End With
        wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") \'引入脚本文件
        e.WriteString(wb.Build)


//JS代码
function getUser(){      
    var result= submitAjaxFileds(\'faduanxin.htm\',\'\',\'sjh\',false);
    
}





[此贴子已经被作者于2021/1/14 11:42:08编辑过]

--  作者:有点蓝
--  发布时间:2021/1/14 11:49:00
--  

function getUser(){      
    var result= submitAjaxFileds(\'faduanxin.htm\',\'\',\'sjh\',false);
    if(result == "OK"){
showDialog(\'dlg1\',\'恭喜\',\'恭喜您抽中大奖,记得及时领奖哦!\')
}
else{
showDialog(\'dlg1\',\'提示\',result)
}
}