{"size": 630, "ext": "js", "max_stars_repo_path": "miniprogram/page/cloud/pages/user-authentication/user-authentication.js", "max_stars_repo_name": "berlin75/miniprogram-demo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "miniprogram/page/cloud/pages/user-authentication/user-authentication.js", "max_issues_repo_name": "berlin75/miniprogram-demo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "miniprogram/page/cloud/pages/user-authentication/user-authentication.js", "max_forks_repo_name": "berlin75/miniprogram-demo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 15.3658536585, "max_line_length": 70, "alphanum_fraction": 0.4857142857}
const app = getApp()

Page({
  onShareAppMessage() {
    return {
      title: '用户鉴权',
      path: 'page/cloud/pages/user-authentication/user-authentication'
    }
  },

  data: {
    openid: '',
    appid: '',
    loading: false
  },

  onGetOpenid() {
    this.setData({
      loading: true
    })
    app.getUserOpenIdViaCloud()
      .then(res => {
        this.setData({
          openid:res.openid,
          appid:res.appid,
          loading: false
        })
        return res.openid
      })
      .catch(err => {
        console.error(err)
      })
  },

  clear() {
    this.setData({
      openid: '',
    })
  }
})
