You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.1 KiB

2 years ago
// const wx = require('jweixin-module');
// // 微信调用地图
// const wexinLoction = (data, callback, errorCallback) => {
// wx.config({
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
// appId: data.appid, // 必填,公众号的唯一标识
// timestamp: data.timestamp, // 必填,生成签名的时间戳
// nonceStr: data.noncestr, // 必填,生成签名的随机串
// signature: data.signature, // 必填,签名
// jsApiList: ['checkJsApi', 'openLocation', 'scanQRCode'] // 必填需要使用的JS接口列表所有JS接口列表见附录2
// });
// wx.ready(function() {
// wx.checkJsApi({
// jsApiList: ['openLocation', 'scanQRCode'],
// success: function() {
// // if (data.type == 'sanCode') {
// // wx.scanQRCode({
// // needResult: 0, // 默认为0扫描结果由微信处理1则直接返回扫描结果
// // scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
// // success: function(res) {
// // var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
// // }
// // });
// // }
// wx.openLocation({
// latitude: parseFloat(data.lat), // 纬度浮点数范围为90 ~ -90
// longitude: parseFloat(data.lon), // 经度浮点数范围为180 ~ -180。
// name: data.name, // 位置名
// address: data.address, // 地址详情说明
// scale: 15, // 地图缩放级别,整形值,范围从1~28。默认为最大
// success: function(res) {},
// fail: function(res) {}
// });
// },
// })
// });
// wx.error(function(res) {
// console.log('通过error接口处理失败验证', res);
// // config信息验证失败会执行error函数如签名过期导致验证失败具体错误信息可以打开config的debug模式查看也可以在返回的res参数中查看对于SPA可以在这里更新签名。
// });
// }
// export default wexinLoction;