201711671137 校内综合实训DAY3:微信小程序——轮播图、地图功能、获取用户信息

微信小程序功能实现与参考
该博客围绕微信小程序展开,介绍了地图功能、获取用户头像名称、位置信息、设备信息的参考链接,还展示了通过微信开发者工具实现图片轮播,利用小程序open - data获取用户公开信息,通过API获取设备及位置信息,用地图组件查看地图及显示位置等功能。

Content

Results

  • 通过微信开发者工具实现了图片轮播的功能
  • 通过小程序open-data实现获取用户公开的个人信息
  • 通过API实现获取用户的手机设备信息及位置信息
  • 通过地图组件实现了在小程序内查看地图及显示所在位置的功能

Homework

// pages/classify/classify.js
Page({
  data: {
    latitude: 0,
    longitude: 0
  },
  onReady: function () {
    // console.log(this)
    var _this = this;
    wx.getLocation({
      success:function(res){
        console.log(res);
        _this.setData({
          longitude: res.longitude,
          latitude: res.latitude
        })
      }
    })
  }
})
<!--pages/classify/classify.wxml-->
<map id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="14" show-location style="width: 100%; height: 100vb;"></map>

// pages/mine/mine.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    mobileBrand: "",
    mobileModel: "",
    mobileSystem: "",
    mobileScreenWidth: "",
    mobileScreenHeight: ""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    var _this=this;
    wx.getSystemInfo({
      success: function(res) {
        _this.setData({
        mobileBrand: res.brand,
        mobileModel: res.model,
        mobileSystem: res.system,
        mobileScreenWidth: res.screenWidth,
        mobileScreenHeight: res.screenHeight
        })
      }
    })
  }
})
<!--pages/mine/mine.wxml-->
  <view><open-data type="userAvatarUrl"></open-data></view>
  <view><open-data type="userNickName" lang="zh_CN"></open-data></view>
  <view>手机型号:{{mobileBrand}} {{mobileModel}}</view>
  <view>手机系统:{{mobileSystem}}</view>
  <view>分辨率:{{mobileScreenWidth}}*{{mobileScreenHeight}}</view>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值