const app = getApp()
const OneID = require('../../utils/gtoneid-wx-min')
Page({
    data: {
        appid: 'rA2G1vfKeE7NlXKPHZrr73',
        version: '',
        oneid: '',
    },
    onLoad: function () {
        let that = this
        this.setData({version:OneID.getVersion()})
        OneID.init({
            appId: 'rA2G1vfKeE7NlXKPHZrr73',
            onSuccess: function (res) {
              let r = JSON.stringify(res)
              console.log('OneID init success', r)
              that.setData({ oneid: 'OneID init success' + r })
            },
            onFailure: function (res) {
              console.log('OneID init failure', res)
              that.setData({ oneid: 'OneID init failure' + res })
            }
        })
    },
    queryLbs() {
      OneID.queryLBS(5, {
        onSuccess: function (res) {
          let r = JSON.stringify(res)
          console.log('OneID queryLBS success', r)
        },
        onFailure: function (res) {
          let r = JSON.stringify(res)
          console.log('OneID queryLBS failure', r)
        }
      })
    }, 
    getLocation() {
      wx.getLocation({
        type: 'wgs84',
        success(res) {
          console.log("loc success ", res['latitude'])
        }
      })
    },

})
