当前位置:网站首页>Uniapp develops wechat applet Tencent map function and generates sig signature of location cloud
Uniapp develops wechat applet Tencent map function and generates sig signature of location cloud
2022-07-02 13:05:00 【Gongsun yuaner】
<script>
import {
Utils } from '@/libs/util/mapsig.js'
const appConfig = uni.getStorageSync('setAppConfig')
console.log(' Global configuration information :', appConfig)
const table_id = appConfig.workOrderTableId
const key = appConfig.mapKey
const radius = '10000'
const location = this.latitude+','+ this.longitude
const repair_userId = appConfig.repairUserId
const filter = 'x.repair_user=' + repair_userId // My custom parameters , Please modify according to the actual situation
const sk = appConfig.mapSk // Map sk, Please get it from Tencent map management platform
const data = {
table_id,
key,
radius,
location,
filter,
}
const sig = Utils.getSig(data, sk, 'search')
// Here I pass in one 'search',( actual magsig.js It is judged in this way :
// if (feature == 'search') { sig = '/place_cloud/search/nearby?' + requestArr.join('&') + sk })
const data2 = {
table_id,
key,
radius,
location,
filter,
sig
}
// Initiate network request
wx.request({
url: 'https://apis.map.qq.com/place_cloud/search/nearby',
method: 'GET',
data: data2,
success: res=> {
console.log(' Location cloud returns :',res.data)
const data = this.processData(res.data.result.data)
console.log('marker Data presentation :', data)
setTimeout(()=> {
this.markers = data
uni.hideLoading()
}, 1000)
},
complete: res=>{
uni.hideLoading()
}
})
For example, the suffix of your request address is /user/aa/people, Then please mapsig.js In the file
if (feature == 'search') {
sig = '/place_cloud/search/nearby?' + requestArr.join('&') + sk }
Change to ( And then pass it on search go in ):
if (feature == 'search') {
sig = '/user/aa/people?' + requestArr.join('&') + sk }
Or write another one by yourself if sentence , Pass your logo in .
sig File download , Click here to
Official documents :https://lbs.qq.com/faq/serverFaq/webServiceKey
边栏推荐
- JS iterator generator asynchronous code processing promise+ generator - > await/async
- 通过反射执行任意类的任意方法
- Structured data, semi-structured data and unstructured data
- Ltc3307ahv meets EMI standard, step-down converter qca7005-al33 phy
- Execute any method of any class through reflection
- js2day(又是i++和++i,if语句,三元运算符,switch、while语句,for循环语句)
- Linear DP acwing 897 Longest common subsequence
- Redis bloom filter
- Hundreds of web page special effects can be used. Don't you come and have a look?
- ADB basic commands
猜你喜欢
![[opencv learning] [image histogram and equalization]](/img/e7/b8dc55a9febf2b2949fce3a7ac21f9.jpg)
[opencv learning] [image histogram and equalization]

Unity SKFramework框架(十九)、POI 兴趣点/信息点

阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)

(7) Web security | penetration testing | how does network security determine whether CND exists, and how to bypass CND to find the real IP

bellman-ford AcWing 853. Shortest path with side limit

Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.

C modifier

Day4 operator, self increasing, self decreasing, logical operator, bit operation, binary conversion decimal, ternary operator, package mechanism, document comment
![Jerry's watch delete alarm clock [chapter]](/img/7f/d51b37872b4ce905a0a723a514b2dc.jpg)
Jerry's watch delete alarm clock [chapter]

Js1day (syntaxe d'entrée / sortie, type de données, conversion de type de données, Var et let différenciés)
随机推荐
Redis introduction, scenario and data type
Js8day (rolling event (scroll family), offset family, client family, carousel map case (to be done))
Unforgettable Ali, 4 skills, 5 hr additional written tests, it's really difficult and sad to walk
Redis bloom filter
About the loading of layer web spring layer components, the position of the layer is centered
About wechat enterprise payment to change x509certificate2 read certificate information, publish to the server can not access the solution
Interview questions for software testing - a collection of interview questions for large factories in 2022
PXE installation UOS prompt NFS over TCP not available from 10 x.x.x
Interesting interview questions
Hundreds of web page special effects can be used. Don't you come and have a look?
Unity SKFramework框架(十九)、POI 兴趣点/信息点
Package management tools
Oracle从入门到精通(第4版)
Jerry's watch gets the default ringtone selection list [article]
Ali on three sides, it's really difficult to successfully get the offer rated P7
Efficiency comparison between ArrayList and LinkedList
Analog to digital converter (ADC) ade7913ariz is specially designed for three-phase energy metering applications
Finally, someone explained the supervised learning clearly
Floyd AcWing 854. Floyd finds the shortest path
上海交大教授:何援军——包围盒(包容体/包围盒子)