wx.ready(function () {
document.getElementById('btn1').onclick = function () {
wx.getLocation({
type: 'gcj02',
success: function (res) {
res.latitude = document.getElementById('number').value;
res.longtitude = document.getElementById('product').value;
wx.openLocation({
latitude : res.latitude, // 纬度,浮点数,范围为90 ~ -90
longitude : res.longtitude, // 经度,浮点数,范围为180 ~ -180。
name : '', // 位置名
address : '', // 地址详情说明
scale : 6, // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl : '' // 在查看位置界面底部显示的超链接,可点击跳转(测试好像不可用)
});
}
});
};
});
wx.error(function (res) {
//alert(res.errMsg);
});
Case "maplist1.htm",""
wb.AppendHTML("<script src='http://res.wx.qq.com/open/js/jweixin-1.2.0.js'></script>",True) '引入JS-SDK库
wb.AppendHTML("<script src='./lib/jssdk1.js'></script>") '引入脚本文件
'在页面注入权限验证配置
Dim st As New Date(1970,1,1,8,0,0)
Dim appid As String = "wxf411b4d9008f11a0" '开发者ID
Dim timestamp As Integer = CInt((Date.Now - st).TotalSeconds()) '时间戳
Dim noncestr As String = Rand.NextString(16) '随机字符
Dim url As String = e.Request.URL.ToString '当前页面地址
Dim signature As String = Functions.Execute("GetJsSignature", noncestr, timestamp, url) '生成权限验证签名
Dim cfg As String = "wx.config({appId:'{0}',timestamp:{1},nonceStr:'{2}',signature:'{3}',jsApiList:['openLocation']});"
wb.AppendHTML("<script>" & CExp(cfg,appid,timestamp,noncestr,signature) & "</script>",True)
'开始正常生成网页内容
Dim PrimaryKey As Integer = e.GetValues("key")
Dim dr01 As DataRow = DataTables("跟踪表").SQLFind("[_Identify]= " & PrimaryKey)
If dr01 IsNot Nothing Then
wb.addform("","form1","maplist1.htm?key=" & PrimaryKey)
With wb.AddInputGroup("form1","ipg1","在途查询")
.AddInput("product","经度","text").Value = dr01("经度")
.AddInput("number","纬度","text").Value = dr01("纬度")
End With
With wb.AddButtonGroup("form1","btg1",True)
.add("btn1","确定","submit")
End With
End If