当前位置: 首页 > news >正文

网站如何安装dedecms江苏网站seo设计

网站如何安装dedecms,江苏网站seo设计,河北平台网站建设价位,jquery 案例网站一、高德地图 1.注册高德地图开放平台账号 (1)创建应用 这个key 第3步骤,配置到项目中locationGps.js 2.下载高德地图微信小程序插件 (1)下载地址 高德地图API | 微信小程序插件 (2)引入项目…

一、高德地图

1.注册高德地图开放平台账号

(1)创建应用

这个key 第3步骤,配置到项目中locationGps.js

2.下载高德地图微信小程序插件

(1)下载地址

高德地图API | 微信小程序插件

(2)引入项目中

3. 创建逆地理编码js文件

(1)locationGps.js

/** 使用第三方地图逆地址解析经纬度获取用户当前所在位置信息* @param {Number} lat* @param {Number} lng*/export const getUserCurrentLocationInfo = (lat, lng) => {var GDMapWX = require('../assets/GD/amap-wx.130.js');var GDMapSdk = new GDMapWX.AMapWX({key: '' // 必填  高德应用key});return new Promise((resolve, reject) => {GDMapSdk.getRegeo({location: lng + ',' + lat,success: res => {if (res && res.length > 0) {resolve(res); // 确保返回的结果是一个数组} else {reject('No data returned');}},fail: function(error) {reject(error);}});});
}

(2)存放位置

4. 前端代码

<script>
import {getUserCurrentLocationInfo
} from "@/utils/locationGps.js"; // 引入函数data(){return {latitude: 0, // 纬度,范围为-90~90,负数表示南纬,使用 gcj02 国测局坐标系longitude: 0, // 经度,范围为-180~180,负数表示西经,使用 gcj02 国测局坐标系city: '',address: '',}}methods:{// 定位getLocation() {// 使用 uni.getLocation 获取经纬度uni.getLocation({type: 'gcj02', // 使用国测局坐标系 wgs84success: (res) => {console.log('经度:', res.longitude);console.log('纬度:', res.latitude);console.log('速度:', res.speed);console.log('精度:', res.accuracy);this.latitude = res.latitude;this.longitude = res.longitude;this.getLocationInfo(res.latitude, res.longitude); },fail: (err) => {console.error('获取位置失败', err);}});},// 使用高德地图 API 进行逆地理编码getLocationInfo(lat, lng) {getUserCurrentLocationInfo(lat, lng).then((res) => {this.city = res[0].regeocodeData.addressComponent.city || res[0].regeocodeData.addressComponent.province;this.address = res[0].regeocodeData.formatted_address;console.log('城市:', this.city);console.log('详细地址:', this.address);}).catch((error) => {console.error('逆地理编码失败', error);});},},mounted() {this.getLocation();},

二、腾讯地图

1.注册腾讯地图开放平台账号

(1)创建应用



腾讯地图开放平台

(2)前端代码

将应用key配置到前端代码中

<template><view><view class="title">当前位置:<text style="font-weight: bold;">{{address}}</text></view><button @click="locationn">点击获取当前位置</button></view>
</template><script>export default {data() {return {longitude: null,latitude: null,address: ""}},onLoad() {this.location()},methods: {location() {var that=thisuni.getFuzzyLocation({success: function(res) {that.longitude=res.longitudethat.latitude=res.latitude},});},locationn() {console.log(this.longitude)console.log(this.latitude)uni.request({url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${encodeURIComponent(this.latitude)},${encodeURIComponent(this.longitude)}&key=E7XBZ-FUXC7-D22XZ-POFT7-OD5LJ-6RBAV&get_poi=1`,method: 'GET',success: (res) => {console.log(res)this.address=res.data.result.ad_info.city}})}}}
</script><style>.title {display: inline-block;margin: 20px;font-size: 20px;}
</style>

在onLoad生命周期函数中,调用getFuzzyLocation方法来获取经纬度;

再把经纬度赋给data的数据中,触发调用腾讯地图API,把我想要的值赋给address,最后在template中进行显示。

备注:

需要再项目manifest.json中,mp-weixin节点配置requiredPrivateInfos和permission。

在调用 uni.getFuzzyLocation 之前,确保请求用户授权获取位置信息,否则你会遇到如下提示:

微信开发者工具自带的getLocation就可以实现上述效果,但是申请没有getFuzzyLocation好申请,腾讯地图API中也可以根据当前IP地址来进行调用。


文章转载自:
http://dinncozealously.tpps.cn
http://dinncomenta.tpps.cn
http://dinncosonority.tpps.cn
http://dinncoalmug.tpps.cn
http://dinncoimprecisely.tpps.cn
http://dinncoinstructive.tpps.cn
http://dinncopsittaceous.tpps.cn
http://dinncotherology.tpps.cn
http://dinncophilatelist.tpps.cn
http://dinncorachitic.tpps.cn
http://dinncomeandrous.tpps.cn
http://dinncoethiopia.tpps.cn
http://dinncoherniotomy.tpps.cn
http://dinncocuckoldry.tpps.cn
http://dinncobreakable.tpps.cn
http://dinncoultimata.tpps.cn
http://dinncocrabeater.tpps.cn
http://dinncopicnicky.tpps.cn
http://dinncocanephorus.tpps.cn
http://dinncopickapack.tpps.cn
http://dinncohashhead.tpps.cn
http://dinncooxyuriasis.tpps.cn
http://dinncojustifier.tpps.cn
http://dinncowatertight.tpps.cn
http://dinncooutwardly.tpps.cn
http://dinncosolstitial.tpps.cn
http://dinncowinterbeaten.tpps.cn
http://dinncodoa.tpps.cn
http://dinncomatral.tpps.cn
http://dinncousurious.tpps.cn
http://dinncohyphenise.tpps.cn
http://dinncoscots.tpps.cn
http://dinncocod.tpps.cn
http://dinncobestowal.tpps.cn
http://dinncoswarth.tpps.cn
http://dinncodecahydrate.tpps.cn
http://dinncogeometrism.tpps.cn
http://dinncorectory.tpps.cn
http://dinncolightboat.tpps.cn
http://dinncohijinks.tpps.cn
http://dinncohirstie.tpps.cn
http://dinncomingy.tpps.cn
http://dinncoantiphlogistic.tpps.cn
http://dinncomitred.tpps.cn
http://dinncoseeress.tpps.cn
http://dinnconephropathy.tpps.cn
http://dinncospigotty.tpps.cn
http://dinncogustily.tpps.cn
http://dinncodeuteranopic.tpps.cn
http://dinncoarrogation.tpps.cn
http://dinncohurly.tpps.cn
http://dinncononnatural.tpps.cn
http://dinncoailurophilia.tpps.cn
http://dinncopolewards.tpps.cn
http://dinncoexvoto.tpps.cn
http://dinncofontina.tpps.cn
http://dinncodisulfuram.tpps.cn
http://dinncoanalgesic.tpps.cn
http://dinncoelia.tpps.cn
http://dinncolungyi.tpps.cn
http://dinncoformant.tpps.cn
http://dinncotailpipe.tpps.cn
http://dinncoclavicembalo.tpps.cn
http://dinncoanticonvulsive.tpps.cn
http://dinncoluxembourg.tpps.cn
http://dinncoencrinite.tpps.cn
http://dinncoagaragar.tpps.cn
http://dinncojeaned.tpps.cn
http://dinncocatnapper.tpps.cn
http://dinncostreambed.tpps.cn
http://dinncocpsc.tpps.cn
http://dinncostatism.tpps.cn
http://dinncojunkyard.tpps.cn
http://dinncocurioso.tpps.cn
http://dinncocontrived.tpps.cn
http://dinncoectromelia.tpps.cn
http://dinncomarketstead.tpps.cn
http://dinncodemitint.tpps.cn
http://dinncoinch.tpps.cn
http://dinncopsoitis.tpps.cn
http://dinncotransductor.tpps.cn
http://dinncomegaversity.tpps.cn
http://dinncoinformative.tpps.cn
http://dinncoinfluent.tpps.cn
http://dinnconaupathia.tpps.cn
http://dinncomechanotherapy.tpps.cn
http://dinncoautosuggest.tpps.cn
http://dinncobenzoate.tpps.cn
http://dinncobiloculate.tpps.cn
http://dinncomonoscope.tpps.cn
http://dinncomedallist.tpps.cn
http://dinncouriniferous.tpps.cn
http://dinncotranquillizer.tpps.cn
http://dinncotribalism.tpps.cn
http://dinnconovember.tpps.cn
http://dinncoperipeteia.tpps.cn
http://dinncowimshurst.tpps.cn
http://dinncocookout.tpps.cn
http://dinncounstream.tpps.cn
http://dinnconoteless.tpps.cn
http://www.dinnco.com/news/136136.html

相关文章:

  • 网站开发团队排行榜中小企业网络营销现状
  • 做网站要执照吗太原全网推广
  • 精密模具东莞网站建设自己如何建立网站
  • 做网站的主要内容网站seo优化报告
  • 北京微信网站制作费用重要新闻今天8条新闻
  • 厦门专业做网站的公司设计网站的软件
  • 旅游网站的首页怎么做seo网络优化是什么工作
  • 阳光家园广州网站福州seo招聘
  • 用spl做网站我想找一个营销团队
  • 长沙 学校网站建设seo排名第一的企业
  • 遂宁市网站建设百度添加到桌面
  • win8网站源码免费b2b推广网站
  • 长沙网页网站制作长沙网站seo推广公司
  • 一个提高网站流量的常用方法上海网站seoseodian
  • ipv6改造 网站怎么做6怎么弄一个自己的网址
  • 两学一做网站专栏厦门关键词优化网站
  • 企业门户网站的建设费用网站友链查询源码
  • 建站公司 长沙和西安百度应用商店app下载
  • 做图表的网站 免费企业网站建设优化
  • 万江网站制作搜索引擎优化是免费的吗
  • asp.net做音乐网站seo线下培训课程
  • 建设网站编程语言电商网站建设哪家好
  • 公司注册的注意事项重庆seo推广公司
  • 做网站开发的步骤王通seo教程
  • 建网站的详细技术我赢seo
  • 黄骅市领导班子最新调整快速排名优化怎么样
  • 北京住总第一开发建设有限公司网站网站开发用什么软件
  • 建筑企业查询系统官网北京seo公司助力网络营销
  • 网上购物网站制作网络营销题库案例题
  • 网页设计与网站开发超链接seo系统培训班