当前位置:网站首页>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
边栏推荐
- Package management tools
- Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?
- Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)
- Jerry's watch gets the default ringtone selection list [article]
- Jerry's watch ringtone audition [article]
- About the loading of layer web spring layer components, the position of the layer is centered
- JSON serialization and parsing
- Js1day (input / output syntax, data type, data type conversion, VaR and let differences)
- 腾讯三面:进程写文件过程中,进程崩溃了,文件数据会丢吗?
- Structured data, semi-structured data and unstructured data
猜你喜欢
js1day(输入输出语法,数据类型,数据类型转换,var和let区别)
Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
自主可控三维云CAD:CrownCAD赋能企业创新设计
JDBC 预防sql注入问题与解决方法[PreparedStatement]
The coloring method determines the bipartite graph acwing 860 Chromatic judgement bipartite graph
JS iterator generator asynchronous code processing promise+ generator - > await/async
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
js3day(数组操作,js冒泡排序,函数,调试窗口,作用域及作用域链,匿名函数,对象,Math对象)
Everyone wants to eat a broken buffet. It's almost cold
Jerry's watch modifies the alarm clock [chapter]
随机推荐
Execute any method of any class through reflection
Jerry's weather code table [chapter]
NTMFS4C05NT1G N-CH 30V 11.9A MOS管,PDF
Wechat official account payment prompt MCH_ ID parameter format error
How can attribute mapping of entity classes be without it?
Package management tools
3 a VTT terminal regulator ncp51200mntxg data
MySQL: Invalid GIS data provided to function st_ geometryfromtext
软件测试面试题-2022年大厂面试题合集
三面阿里,有惊无险成功拿到offer定级P7,只能说是真的难
[error record] cannot open "XXX" because Apple cannot check whether it contains malware
Js8day (rolling event (scroll family), offset family, client family, carousel map case (to be done))
C modifier
Ltc3307ahv meets EMI standard, step-down converter qca7005-al33 phy
移动式布局(流式布局)
Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
上海交大教授:何援军——包围盒(包容体/包围盒子)
Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)
Hash table acwing 840 Simulated hash table
Interval DP acwing 282 Stone merging