小程序接口升级:wx.getUserinfo 替换 wx.getUserProfile遇到问题

**小程序wx.getUserInfo更新wx.getUserProfile **
JS中的这段 不咋会弄
我的参考的代码例子是↓

 getUserInfo() {
        let that = this;
        wx.getSetting({
          success(res) {
            wx.showModal({
              title: '温馨提示',
              content: '正在请求您的个人信息',
              success(res) {
                if (res.confirm) {
                  wx.getUserProfile({
                    lang:'zh_CN',
                    desc: "获取你的昵称、头像、地区及性别",
                    success: res => {
                      console.log(res)
                    },
                    fail: res => {
                      //拒绝授权
                      that.showErrorModal('您拒绝了请求');
                      return;
                    }
                  })
                } else if (res.cancel) {
                  //拒绝授权 showErrorModal是自定义的提示
                  that.showErrorModal('您拒绝了请求');
                  return;
                }
              }
            })
          }
        })
      },
  

下面这些代码是我小程序中的现有代码


 getUserInfoFun: function(e) {
        var t = this;
        wx.login({
            success: function(e) {
                wx.getUserInfo({
                    success: function(n) {
                        app.util.request({
                            url: "entry/wxapp/messiopenid",
                            method: "post",
                            data: {
                                m: "cy163_yourbest",
                                code: e.code,
                                nickname: n.userInfo.nickName,
                                avatar: n.userInfo.avatarUrl,
                                gender: n.userInfo.gender,
                                shareopenid: t.data.shareopenid
                            },
                            success: function(e) {
                                wx.setStorageSync("openid", e.data.data.openid), wx.setStorageSync("nickname", n.userInfo.nickName), 
                                wx.setStorageSync("avatar", n.userInfo.avatarUrl), t.setData({
                                    openid: e.data.data.openid
                                }), t.mycenter(), t.upshare();
                            }
                        });
                    },
                    fail: function() {}
                });
            }
        });
    },

怎么调整才能完成升级登陆接口

https://mp.weixin.qq.com/s/vjpvoE6huiKjf9tV1vqheg https://mp.weixin.qq.com/s/vjpvoE6huiKjf9tV1vqheg

getuserprofile是需要用户点击直接触发的,不能放在这样的回调里