zoukankan      html  css  js  c++  java
  • 微信小程序开发(十一)获取手机的完整详细信息

    // succ.wxml
    <view style='position:absolute; top:30%; left:35%;font-size:36rpx'>{{name}}:签到成功。{{oaid}}</view>
    <view>手机型号:{{mobileModel}}</view>
    <view>手机像素比:{{mobileePixelRatio}}</view>
    <view>窗口宽度:{{windowWidth}}</view>
    <view>窗口高度:{{windowHeight}}</view>
    <view>微信设置的语言:{{language}}</view>
    <view>微信版本号:{{version}}</view>
    <view>手机IP:{{motto.query}}</view>
    <view>手机网络状态:{{netWorkType}}</view>
    <view>WIFI ssid:{{wifissid}}</view>
    <view>WIFI bssid:{{wifiBssid}}</view>
    
    // succ.js
    var app = getApp()
    Page({
      data: {
        mobileModel: '',  // 手机型号
        mobileePixelRatio: '',  // 手机像素比
        windowWidth: '',  // 窗口宽度
        windowHeight: '',  // 窗口高度
        language: '',  // 微信设置的语言
        version: '',  // 微信版本号
        netWorkType: '',  // 手机网络状态
        name: '',  // 用户姓名
        oaid: '',  // oa账号
        netWorkType: '', // 网络类型
        wifissid: '',  // WIFI ssid
        wifiBssid: '',  // WIFI bssid
        motto: ''  // IP地址
      },
      onLoad: function (e) {  // 获取参数
        var that = this;
        this.setData({
          name: e.name,
          oaid: e.oaid
        })
        wx.getNetworkType({  // 获取网络类型
          success: function (res) {
            that.setData({
              netWorkType: res.networkType
            })
          }
        })
        wx.getConnectedWifi({
          success: function(e){
            console.log(e,"eeeeeeeee")
            console.log(e.wifi)
            that.setData({
              wifissid: e.wifi.SSID,
              wifiBssid: e.wifi.BSSID
            })
          }
        })
        wx.request({  // 获取ip
          url: 'http://ip-api.com/json',
          success: function (e) {
            that.setData({
              motto: e.data
            })
          }
        })
        wx.getLocation(
          {
            success: function (res) {
              console.log(res,'res')
              that.setData({
                hasLocation: true,
                location1: res.longitude, 
                location2:res.latitude//这里是获取经纬度
              })
            }
          })
        wx.getSystemInfo({
          success: function (res) {  // 获取手机信息
            console.log(res, 'res111111')
            that.setData({
              mobileModel: res.model,
              mobileePixelRatio: res.pixelRatio,
              windowWidth: res.windowWidth,
              windowHeight: res.windowHeight,
              language: res.language,
              version: res.version
            })
          }
        })
      }
    })
  • 相关阅读:
    【Atcoder】CODE FESTIVAL 2017 qual C D
    【BZOJ】4756: [Usaco2017 Jan]Promotion Counting
    【Luogu】P3933 Chtholly Nota Seniorious
    【BZOJ】1914: [Usaco2010 OPen]Triangle Counting 数三角形
    【算法】计算几何
    【BZOJ】1774: [Usaco2009 Dec]Toll 过路费
    【BZOJ】2200: [Usaco2011 Jan]道路和航线
    【BZOJ】1833 [ZJOI2010]count 数字计数
    【BZOJ】1731: [Usaco2005 dec]Layout 排队布局
    【BZOJ】1577: [Usaco2009 Feb]庙会捷运Fair Shuttle
  • 原文地址:https://www.cnblogs.com/aaronthon/p/11673591.html
Copyright © 2011-2022 走看看