当前位置:首页 > 新闻动态 > 网站文章

微信小程序开发(十一)获取手机的完整详细信息

来源: 浏览:128 时间:2023-08-11
// succ.wxml
{{name}}:签到成功。{{oaid}}
手机型号:{{mobileModel}}
手机像素比:{{mobileePixelRatio}}
窗口宽度:{{windowWidth}}
窗口高度:{{windowHeight}}
微信设置的语言:{{language}}
微信版本号:{{version}}
手机IP:{{motto.query}}
手机网络状态:{{netWorkType}}
WIFI ssid:{{wifissid}}
WIFI bssid:{{wifiBssid}}
// 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
        })
      }
    })
  }
})

 

地址 · ADDRESS

地址:建邺区新城科技园嘉陵江东街18号2层

邮箱:309474043@qq.Com

点击查看更多案例

联系 · CALL TEL

400-8793-956

售后专线:025-65016872

业务QQ:309474043    售后QQ:1850555641

©南京安优网络科技有限公司 版权所有   苏ICP备12071769号-4  网站地图