当前位置:网站首页>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
边栏推荐
- Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
- Rust语言文档精简版(上)——cargo、输出、基础语法、数据类型、所有权、结构体、枚举和模式匹配
- 阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)
- Interesting interview questions
- The coloring method determines the bipartite graph acwing 860 Chromatic judgement bipartite graph
- Linear DP acwing 896 Longest ascending subsequence II
- JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)
- js5day(事件监听,函数赋值给变量,回调函数,环境对象this,全选反选案例,tab栏案例)
- js1day(輸入輸出語法,數據類型,數據類型轉換,var和let區別)
- Browser node event loop
猜你喜欢
![[opencv learning] [Canny edge detection]](/img/8b/37694ae2f0f13f829f3c033da0605e.jpg)
[opencv learning] [Canny edge detection]

spfa AcWing 852. SPFA judgement negative ring

Floyd AcWing 854. Floyd finds the shortest path

ArrayList与LinkedList效率的对比

Unforgettable Ali, 4 skills, 5 hr additional written tests, it's really difficult and sad to walk
![Jerry's watch delete alarm clock [chapter]](/img/7f/d51b37872b4ce905a0a723a514b2dc.jpg)
Jerry's watch delete alarm clock [chapter]

Js3day (array operation, JS bubble sort, function, debug window, scope and scope chain, anonymous function, object, Math object)

难忘阿里,4面技术5面HR附加笔试面,走的真艰难真心酸

js1day(输入输出语法,数据类型,数据类型转换,var和let区别)

Linear DP acwing 895 Longest ascending subsequence
随机推荐
Ali on three sides, it's really difficult to successfully get the offer rated P7
Interview questions for software testing - a collection of interview questions for large factories in 2022
3 a VTT terminal regulator ncp51200mntxg data
js4day(DOM开始:获取DOM元素内容,修改元素样式,修改表单元素属性,setInterval定时器,轮播图案例)
Should I have a separate interface assembly- Should I have a separate assembly for interfaces?
Obtain file copyright information
绕过ObRegisterCallbacks需要驱动签名方法
[opencv learning] [Canny edge detection]
Redis introduction, scenario and data type
Hash table acwing 840 Simulated hash table
Oracle从入门到精通(第4版)
PXE installation UOS prompt NFS over TCP not available from 10 x.x.x
Counting class DP acwing 900 Integer partition
js3day(数组操作,js冒泡排序,函数,调试窗口,作用域及作用域链,匿名函数,对象,Math对象)
Jerry's watch delete alarm clock [chapter]
Variable, "+" sign, data type
[opencv] [image gradient]
JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)
Js3day (array operation, JS bubble sort, function, debug window, scope and scope chain, anonymous function, object, Math object)
Js2day (also i++ and ++i, if statements, ternary operators, switch, while statements, for loop statements)