|
- var config = require("../../config/config.js");
- var app = getApp();
- const Http = require("../../utils/HttpBasics");
- Page({
- data: {
- canIUse: wx.canIUse("button.open-type.getUserInfo")
- },
- onLoad: function(options) {
- var that = this;
- Http.get({
- url: config.api.marketicon,
- data: {
- appId: config.weapp.AppId
- }
- }).then(res => {
- console.log(res.data.mallImgUrl);
- that.setData({
- mallImgUrl: res.data.mallImgUrl
- });
- });
- },
-
- bindGetUserInfo: function(e) {
- console.log(e);
- var iv = e.detail.iv;
- var encryptedData = e.detail.encryptedData;
- console.log(iv);
- console.log(encryptedData);
- Http.post({
- url: config.api.getUserInfo,
- data: {
- encryptedData: encryptedData,
- iv: iv
- }
- }).then(
- function(res) {
- console.log(res);
- console.log("授权个人信息返回的数据")
- //返回主页
- wx.switchTab({
- url: "/pages/index/index"
- });
- },
- function(error) {
- wx.showToast({
- title: "请授权个人信息",
- icon: "none"
- });
- }
- );
- }
- });
|