当前位置:网站首页>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
边栏推荐
- Rust语言文档精简版(上)——cargo、输出、基础语法、数据类型、所有权、结构体、枚举和模式匹配
- [opencv learning] [moving object detection]
- [opencv learning] [image histogram and equalization]
- [error record] cannot open "XXX" because Apple cannot check whether it contains malware
- Oracle从入门到精通(第4版)
- Linear DP acwing 897 Longest common subsequence
- Linear DP acwing 899 Edit distance
- JS7day(事件对象,事件流,事件捕获和冒泡,阻止事件流动,事件委托,学生信息表案例)
- 通过反射执行任意类的任意方法
- 国内首款、完全自主、基于云架构的三维CAD平台——CrownCAD(皇冠CAD)
猜你喜欢
![[opencv learning] [contour detection]](/img/96/aaec61f137e4526c2c329e6fcfa1a2.jpg)
[opencv learning] [contour detection]

ArrayList与LinkedList效率的对比

Package management tools

Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)

Get started REPORT | today, talk about the microservice architecture currently used by Tencent

Finally, someone explained the supervised learning clearly

JS6day(DOM结点的查找、增加、删除。实例化时间,时间戳,时间戳的案例,重绘和回流)
![[error record] cannot open](/img/d3/0435ae698ad635be71729c7c047a22.jpg)
[error record] cannot open "XXX" because Apple cannot check whether it contains malware

Day4 operator, self increasing, self decreasing, logical operator, bit operation, binary conversion decimal, ternary operator, package mechanism, document comment

上手报告|今天聊聊腾讯目前在用的微服务架构
随机推荐
Use MySQL events to regularly perform post seven world line tasks
Jerry's weather direction coding table [chapter]
JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)
Rust language document Lite (Part 1) - cargo, output, basic syntax, data type, ownership, structure, enumeration and pattern matching
Structured data, semi-structured data and unstructured data
net share
[opencv] [image gradient]
Variable, "+" sign, data type
Js3day (array operation, JS bubble sort, function, debug window, scope and scope chain, anonymous function, object, Math object)
[opencv learning] [template matching]
Linear DP acwing 896 Longest ascending subsequence II
std::vector批量导入快速去重方法
Linear DP acwing 898 Number triangle
Browser node event loop
How can attribute mapping of entity classes be without it?
Std:: vector batch import fast de duplication method
国内首款、完全自主、基于云架构的三维CAD平台——CrownCAD(皇冠CAD)
应用LNK306GN-TL 转换器、非隔离电源
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)