当前位置:网站首页>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
边栏推荐
- Everyone wants to eat a broken buffet. It's almost cold
- spfa AcWing 851. SPFA finding the shortest path
- JS8day(滚动事件(scroll家族),offset家族,client家族,轮播图案例(待做))
- 8A Synchronous Step-Down regulator tps568230rjer_ Specification information
- JS6day(DOM结点的查找、增加、删除。实例化时间,时间戳,时间戳的案例,重绘和回流)
- Direct control PTZ PTZ PTZ PTZ camera debugging (c)
- MySQL: Invalid GIS data provided to function st_ geometryfromtext
- 软件测试面试题-2022年大厂面试题合集
- Heap acwing 838 Heap sort
- C#修饰符
猜你喜欢

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

JS7day(事件对象,事件流,事件捕获和冒泡,阻止事件流动,事件委托,学生信息表案例)

Efficiency comparison between ArrayList and LinkedList

Browser storage scheme

Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?
![[opencv learning] [moving object detection]](/img/2e/9b437b7fe22f1d57334529eda68e37.jpg)
[opencv learning] [moving object detection]

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

自主可控三维云CAD:CrownCAD赋能企业创新设计

C#修饰符

Js3day (array operation, JS bubble sort, function, debug window, scope and scope chain, anonymous function, object, Math object)
随机推荐
Mui WebView down refresh pull-up load implementation
Async/await asynchronous function
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
一些突然迸发出的程序思想(模块化处理)
Typora+docsify quick start
PXE installation UOS prompt NFS over TCP not available from 10 x.x.x
Efficiency comparison between ArrayList and LinkedList
Execute any method of any class through reflection
(6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
Js5day (event monitoring, function assignment to variables, callback function, environment object this, select all, invert selection cases, tab column cases)
Ruby: how to copy variables without pointing to the same object- Ruby: how can I copy a variable without pointing to the same object?
OLED screen driver based on stm32
Dijkstra AcWing 850. Dijkstra finding the shortest circuit II
腾讯三面:进程写文件过程中,进程崩溃了,文件数据会丢吗?
国产免费数据仓库ETL调度自动化运维专家—TASKCTL
Everyone wants to eat a broken buffet. It's almost cold
Do you know all the interface test interview questions?
接口测试面试题目,你都会了吗?
Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)
通过反射执行任意类的任意方法