|
- const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
- var config = require("../../config/config.js");
- var app = getApp();
- const Http = require("../../utils/HttpBasics");
- Page({
- data: {
- navigationBarHeight,
- canIUse: wx.canIUse("button.open-type.getUserInfo"),
- curPhone:'',
- },
- onLoad: function(options) {
- var that = this;
-
- Http.get({
- url: config.api.marketicon,
- data: {
- appId: config.weapp.AppId
- }
- }).then(res => {
- that.setData({
- mallImgUrl: res.data.mallImgUrl
- });
- wx.setNavigationBarTitle({
- title: res.data.mallName
- })
- })
- .catch(err => {
- wx.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- },
-
- backHome: function () {
- wx.switchTab({
- url: '/pages/index/index',
- })
- },
-
- bindGetUserInfo: function (e) {
- let that = this;
- var iv = e.detail.iv;
- var encryptedData = e.detail.encryptedData;
- wx.getUserInfo({
- success: function (res) {
- Http.post({
- url: config.api.getUserInfo,
- data: {
- encryptedData: encryptedData,
- iv: iv
- }
- })
- .then(
- function (res) {
- console.log("授权成功")
-
- wx.switchTab({
- url: `/pages/users/users`
- })
- },
- function (error) {
- console.log(error)
- wx.showToast({
- title: "请授权个人信息",
- icon: "none"
- });
- }
- )
- .catch(err => {
- wx.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
-
-
- }
- })
- },
- });
|