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
            })
          }
        })
      }
    })
  • 相关阅读:
    iOS 页面间几种传值方式(属性,代理,block,单例,通知)
    iOS CocoaPods安装与使用
    iOS UIWebView截获html并修改便签内容
    block的底层实现原理?
    多线程的底层实现是什么?
    tabviewcell的删除注意
    iOS9 新特性总结!!!
    类方法加Static -------不需要初始化变量
    Warning:whose view is not in the window herarchy!
    iOS----录音:真机调试的注意
  • 原文地址:https://www.cnblogs.com/hudaxian/p/14814627.html
Copyright © 2011-2022 走看看