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

网站开发详情网络营销服务的内容

网站开发详情,网络营销服务的内容,wordpress 获取当前文章栏目链接,货运 东莞网站建设搜索:腾讯位置服务 找到API文档: 入门中第一步:申请开发者密钥key 前往控制台: 创建应用并获取key: 设置key的时候,还需要小程序的APPID。所以要前往微信公众平台中获取小程序的APPID: 限制要求&#xff1a…

搜索:腾讯位置服务

找到API文档:

入门中第一步:申请开发者密钥key

前往控制台:

创建应用并获取key:

设置key的时候,还需要小程序的APPID。所以要前往微信公众平台中获取小程序的APPID:

限制要求:

添加配额:

看清哪一个key并且设置配额。如果有多个key,也可以根据特别的某些key进行分配额度:

下载地图的SDK:

并放入项目中:

添加服务器域名白名单:

登录微信公众平台:

设置白名单:

搜索地址:

实际开发者工具中截图:

坐标地图:

wxml:

最终展示: 点击搜索周边KFC就出现红色的预设值坐标的地址。

具体代码:

map.js

// 引入SDK核心类
var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
Page({data: {markers: []},onLoad: function () {// 实例化API核心类this.qqmapsdk = new QQMapWX({key: '************************ // 替换为你的QQ地图SDK密钥});},// 事件触发,调用接口nearby_search: function () {var _this = this;// 调用接口this.qqmapsdk.search({keyword: 'kfc',  // 搜索关键词location: '39.980014,116.313972',  // 设置周边搜索中心点success: function (res) { // 搜索成功后的回调var mks = [];for (var i = 0; i < res.data.length; i++) {mks.push({ // 获取返回结果,放到mks数组中title: res.data[i].title,id: parseInt(res.data[i].id), // 将 id 转换为整数形式latitude: res.data[i].location.lat,longitude: res.data[i].location.lng,iconPath: "/assets/icon/position.png", // 图标路径width: 20,height: 20});}_this.setData({ // 设置markers属性,将搜索结果显示在地图中markers: mks});},fail: function (res) {console.log('搜索失败', res);},complete: function (res) {console.log('搜索完成', res);}});}
});

wxml:

<!--绑定点击事件-->
<button bindtap="nearby_search">搜索周边KFC</button>
<!--地图容器-->
<map id="myMap"markers="{{markers}}"style="width:100%;height:300px;"longitude="116.313972"latitude="39.980014" scale='16'>
</map>

注意:

1 调用API有次数和额度限制。

2 调用的接口要开通相应的接口权限。


示例2: “关键词输入提示”

接口调用说明:

前往开通配额:

代码:

wxml:

实际wxml:

**.js 注意js代码不要全部拷贝,而是将methods的部分放在Page()中:

实际**.js:

最后展示:


调用WebService API

举例:定位服务 --IP定位

wxml:

<view class="container"><view class="map-container"><map id="map" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" style="width: 100%; height: 400px;"></map></view><view class="info-container"><view class="info-item"><text class="info-label">国家:</text><text class="info-value">{{nation}}</text></view><view class="info-item"><text class="info-label">省份:</text><text class="info-value">{{province}}</text></view><view class="info-item"><text class="info-label">城市:</text><text class="info-value">{{city}}</text></view></view>
</view>

js:

Page({data: {latitude: 0, // 地图中心点纬度longitude: 0, // 地图中心点经度markers: [], // 地图标记点nation: '', // 国家province: '', // 省份city: '', // 城市},onLoad: function () {// 发起获取当前IP定位信息的请求this.getLocationByIP();},getLocationByIP: function () {// 替换成你自己申请的腾讯地图API密钥const key = '************************';const apiUrl = `https://apis.map.qq.com/ws/location/v1/ip?key=${key}`;wx.request({url: apiUrl,method: 'GET',success: (res) => {console.log('IP定位结果:', res.data);if (res.data.status === 0) {const { location, ad_info } = res.data.result;const { lat, lng } = location;const { nation, province, city } = ad_info;// 更新页面数据,显示定位信息this.setData({latitude: lat,longitude: lng,markers: [{id: 1,latitude: lat,longitude: lng,title: city,iconPath: '/images/location.png', // 可自定义标记图标width: 30,height: 30}],nation: nation,province: province,city: city});} else {wx.showToast({title: '定位失败,请稍后重试',icon: 'none',duration: 2000});}},fail: (error) => {console.error('请求失败:', error);wx.showToast({title: '网络请求失败,请检查网络后重试',icon: 'none',duration: 2000});}});}
});

wxss:

.container {display: flex;flex-direction: column;justify-content: center;align-items: center;padding: 20px;
}.map-container {width: 100%;margin-bottom: 20px;
}.info-container {width: 100%;background-color: #f0f0f0;padding: 10px;border-radius: 8px;
}.info-item {display: flex;flex-direction: row;margin-bottom: 5px;
}.info-label {font-weight: bold;
}.info-value {margin-left: 5px;
}

最终展示:

http://www.hkea.cn/news/210857/

相关文章:

  • 91人才网赣州招聘网安卓优化大师app下载安装
  • 合肥网页模板建站营业推广策划
  • 网站做301根目录在哪教育培训机构平台
  • 企业做网站域名需要自己申请吗深圳百度推广客服电话多少
  • 备案网站容易被收录公司网站建设费用多少
  • 4s店网站建设方案百度app下载最新版
  • 创建电子商务网站的7个步骤做网站推广需要多少钱
  • DW怎么做电商网站梅花seo 快速排名软件
  • 哪个网站可以查企业信息今日热搜榜官网
  • 做网站有必要注册商标吗河北百度seo关键词
  • 网站更换服务器教程下载app到手机上并安装
  • 学校网站建设都是谁做的网络舆情分析
  • 怎么把现有网站开发php昆明seo排名外包
  • 网站桥页怎么找理发培训专业学校
  • 谷城网站开发百度导航官网
  • 做网站不优化平面设计网站
  • 聊城做网站的公司价格谷歌seo软件
  • 支部网站及活动室建设网页广告调词平台
  • 网站建设的企业抚州seo外包
  • 澳门wap网站制作百度关键词检测工具
  • 哪些外贸网站可以做soho首页
  • 三门峡网站建设电话青岛网站推广公司
  • 洞口做网站找谁市场营销推广方案模板
  • 怎么做用来表白的网站湖人队最新消息
  • 新疆网站建设哪家好泉州网站seo外包公司
  • 网站开发前后端工具组合深圳推广公司推荐
  • 老外做的汉字网站一键生成app制作器
  • 网上设计接单的网站seo排名优化排行
  • wordpress后台加统计代码seo建站的步骤
  • 怎么做外贸网站的邮箱签名搜索引擎优化是指什么