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

做网站用的背景图微信营销的案例

做网站用的背景图,微信营销的案例,旅游景区宣传软文,中山做网站费用需求 有个表单需要一键获取对应位置 并显示出来效果如下&#xff1a; 点击一键获取获取对应位置 显示在 picker 默认选中 前端 代码如下: <view class"box_7 {{ showChange1? change-style: }}"><view class"box_11"><view class"…

需求 有个表单需要一键获取对应位置 并显示出来效果如下:

点击一键获取获取对应位置 显示在  picker 默认选中

前端  代码如下:

     <view class="box_7  {{ showChange==1? 'change-style':'' }}"><view class="box_11"><view class="text-wrapper_6 {{ showChange==1? 'change-style-postiona':'' }}"><text lines="1" class="text_29">考试地址</text><text lines="1" class="text_30" /><text lines="1" class="text_31">*</text></view><picker class="region-select" mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}"><view class="picker">{{region[0]}}   {{region[1]}}     {{region[2]}}</view></picker><button  bindtap="getUserLocation" class="get-position {{ showChange==1? 'change-style-postion':''}}">一键获取</button></view></view>

一定注意:小程序中要配置,不然获取位置不生效。

  "permission": {"scope.userLocation": {"desc": "你的位置信息将用于小程序位置接口的效果展示"}},"requiredPrivateInfos" : [ "getLocation" ],

小程序js如下:注意 获取到 经纬度之后 请求腾讯 api key 要进行申请 ,申请很快

申请地址 腾讯位置服务 - 立足生态,连接未来

getUserLocation: function () {let that = this;wx.getSetting({success: (res) => {if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {//如果没有授权就提示需要授权wx.showModal({title: '请求授权当前位置',content: '需要获取您的地理位置,请确认授权',success: function (res) {if (res.cancel) {wx.showToast({title: '拒绝授权',icon: 'none',duration: 1000})} else if (res.confirm) {wx.openSetting({success: function (dataAu) {if (dataAu.authSetting["scope.userLocation"] == true) {wx.showToast({title: '授权成功',icon: 'success',duration: 1000})//再次授权,调用wx.getLocation的APIthat.getLocations();} else {wx.showToast({title: '授权失败',icon: 'none',duration: 1000})}}})}}})} else if (res.authSetting['scope.userLocation'] == undefined) {that.getLocations();}else {that.getLocations();}}})
},
//获取经纬度getLocations()
{let that = this;wx.getLocation({type: 'wgs84',success (res) {const latitude = res.latitudeconst longitude = res.longitudewx.request({url: 'https://apis.map.qq.com/ws/geocoder/v1/',data: {location: `${latitude},${longitude}`,key: that.data.key,get_poi: 0},success(res) {if(res.statusCode==200){const addressComponent = res.data.result.address_component;const province = addressComponent.province;const city = addressComponent.city;const district = addressComponent.district;var showChange =0;if((province+city+district).length>=12){showChange =1;}var result = [province, city, district];that.setData({region: result,showChange: showChange,addressSelect:1,})}else{wx.showToast({title: '定位获取失败,请手动选择~',icon: 'none'})}}})}})
},

http://www.hrbkazy.com/news/40852.html

相关文章:

  • 南宁做网站哪家好百度指数官网
  • 织梦做的网站如何去掉index百度公司销售卖什么的
  • 做网站 指导seo排名软件
  • seo站长博客参考网是合法网站吗?
  • 做电商网站用什么语言360推广怎么收费
  • 福州企业高端网站建设制作哪家好危机舆情公关公司
  • 去年做哪些网站能致富5151app是交友软件么
  • 建站的注意事项广州seo和网络推广
  • 构建动态网站设计的理解什么是搜索关键词
  • 网站在线问答怎么做百度入驻绍兴
  • ui做的好的公司网站如何建网站赚钱
  • 北京 网站设计公司网页seo
  • 做奢侈品的网站重庆seo杨洋
  • shopify独立站怎么做营销策划方案模板范文
  • 网站建设常见的问题抖音关键词查询工具
  • 专门做加盟的网站重庆企业网站排名优化
  • 哈尔滨网页设计招聘优化大师tv版
  • 网站建设北京公司上海网络推广团队
  • 网站备案是一年一次吗有域名后如何建网站
  • 外国做美食视频网站网站推广方式
  • 做素材类的网站赚钱吗关键词歌词任然
  • 如何用织梦程序制作多个页面网站网络营销技巧培训
  • 杭州的网站建设公司哪家好网站推广的常用方法有哪些
  • 图书馆网站建设调查问卷网站优化排名易下拉软件
  • 现代农业园网站建设方案2022最近的新闻大事10条
  • 广西南宁网站设计自媒体怎么赚钱
  • 做银行设计有好的网站参考吗企业新闻稿发布平台
  • 成都 网站备案 幕布拍摄点福建搜索引擎优化
  • 做网站和微信公众号如何招生如何设计企业网站
  • 微网站开发需求宁波seo推广优化哪家强