function getUserInfo() {
    return wx.getStorageSync('userInfo') || null;
}

function getMobileCache() {
    const userInfo = getUserInfo()
    if (userInfo != null) {
        return userInfo.mobile || ''
    }
    return ''
}

function getPhoneNumber(e, func) {
    var encryptedData = e.detail.encryptedData;
    console.log(encryptedData);
    var iv = e.detail.iv;
    if (!encryptedData || encryptedData.length == 0 || !iv || iv.length == 0) {
      return;
    }
    //获取手机号
    getApp().doDecodePhone(encryptedData, iv, function () {
      func(getMobileCache())
    });
}

module.exports = {
    getUserInfo,
    getMobileCache,
    getPhoneNumber
}
  
