|
- const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
- var config = require("../../config/config.js");
- const Http = require("../../utils/HttpBasics");
- var app = getApp();
- Page({
- data: {
- navigationBarHeight,
- canIUse: wx.canIUse("button.open-type.getPhoneNumber"),
-
-
- },
- 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',
- })
- },
-
-
- getPhoneNumber: function (e) {
- var that = this;
- var iv = e.detail.iv;
- var encryptedData = e.detail.encryptedData;
- Http.post({
- url: config.api.getUserPhone,
- data: {
- encryptedData: encryptedData,
- iv: iv
- }
- }).then(res=>{
- console.log("成功授权手机号")
- wx.setStorageSync("phone", res.data.phone)
-
- wx.switchTab({
- url: '/pages/users/users',
- })
- })
- .catch(err => {
- wx.showToast({
- title: "请授权手机号",
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- }
- });
|