|
- var config = require('../../config/config.js');
- var Common = require('../../common/common.js');
- var app = getApp();
- Page({
- data: {
- canIUse: wx.canIUse('button.open-type.getUserInfo')
- },
- onLoad: function(options) {
- var that = this;
- },
-
- bindGetUserInfo: function(e) {
- console.log(e);
- var iv = e.detail.iv;
- var encryptedData = e.detail.encryptedData;
- console.log(iv)
- console.log(encryptedData)
- Common.getUserInfo(encryptedData, iv)
- .then(res => {
- console.log(res);
- /**
- * 1:用户拒绝授权
- * 0:用户同意授权
- */
- if(res.data.code == 0){
- //返回主页
- wx.redirectTo({
- url: '../index/index',
- })
- }
- else if(res.data.code == 1){
- wx.showToast({
- title: '请授权个人信息',
- icon:"none"
- })
- }
-
- })
- }
- })
|