当前位置:网站首页>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
边栏推荐
- Direct control PTZ PTZ PTZ PTZ camera debugging (c)
- Linear DP acwing 902 Shortest editing distance
- Js10day (API phased completion, regular expression introduction, custom attributes, filtering sensitive word cases, registration module verification cases)
- [error record] cannot open "XXX" because Apple cannot check whether it contains malware
- Hash table acwing 840 Simulated hash table
- MySQL: Invalid GIS data provided to function st_ geometryfromtext
- Hash table acwing 841 String hash
- Package management tools
- Direct control PTZ PTZ PTZ PTZ camera debugging (c)
- Everyone wants to eat a broken buffet. It's almost cold
猜你喜欢

Js5day (event monitoring, function assignment to variables, callback function, environment object this, select all, invert selection cases, tab column cases)
![Jerry's watch stops ringing [article]](/img/28/8a225b77b19360d2b0077a2b8c4b6d.jpg)
Jerry's watch stops ringing [article]
![[opencv learning] [common image convolution kernel]](/img/15/d1e8b8aa3c613755e64edb8c9a0f54.jpg)
[opencv learning] [common image convolution kernel]
![Jerry's watch ringtone audition [article]](/img/18/905c4b64443f4efca55188e36f4b28.jpg)
Jerry's watch ringtone audition [article]

Js2day (also i++ and ++i, if statements, ternary operators, switch, while statements, for loop statements)

Js6day (search, add and delete DOM nodes. Instantiation time, timestamp, timestamp cases, redrawing and reflow)

Linear DP acwing 897 Longest common subsequence

日本赌国运:Web3.0 ,反正也不是第一次失败了!

Interesting interview questions

Hash table acwing 840 Simulated hash table
随机推荐
JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)
模数转换器(ADC) ADE7913ARIZ 专为三相电能计量应用而设计
About asp Net MVC project in local vs running response time is too long to access, the solution!
[opencv learning] [image filtering]
3 A VTT端接 稳压器 NCP51200MNTXG资料
[opencv learning] [Canny edge detection]
. Net wechat message template push
[opencv learning] [common image convolution kernel]
Linear DP acwing 895 Longest ascending subsequence
Jerry's watch gets the default ringtone selection list [article]
Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
Day4 operator, self increasing, self decreasing, logical operator, bit operation, binary conversion decimal, ternary operator, package mechanism, document comment
Oracle从入门到精通(第4版)
Obtain file copyright information
Do you know all the interface test interview questions?
[200 opencv routines] 100 Adaptive local noise reduction filter
std::vector批量导入快速去重方法
自主可控三维云CAD:CrownCAD赋能企业创新设计
Rust language document Lite (Part 1) - cargo, output, basic syntax, data type, ownership, structure, enumeration and pattern matching
Jerry's watch reads the alarm clock [chapter]