zhaoxiaohai 3 سال پیش
والد
کامیت
c6d0ffa618
1فایلهای تغییر یافته به همراه39 افزوده شده و 74 حذف شده
  1. 39 74
      pages/tabbar/mine/index.js

+ 39 - 74
pages/tabbar/mine/index.js

@@ -9,7 +9,6 @@ Page({
         userMsg: {},
         pathList: [], //功能权限
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
@@ -43,7 +42,8 @@ Page({
                         pathList.push({
                             name: "绑定微信",
                             icon: "icon-a-wodebangdingweixin",
-                            color: "var(--success)"
+                            color: "var(--success)",
+                            path: `#`
                         })
                         break;
                 }
@@ -61,6 +61,7 @@ Page({
             "method": "queryUserMsg",
             "content": {}
         }).then(res => {
+            console.log("个人信息", res)
             if (res.msg != '成功') return wx.showToast({
                 title: res.data,
                 icon: "none"
@@ -70,54 +71,12 @@ Page({
             })
         })
     },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
     /**
      * 生命周期函数--监听页面显示
      */
     onShow() {
         this.getTabBar().init();
     },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    },
     /* 退出登录 */
     outLogin() {
         _Http.logout().then(res => {
@@ -147,37 +106,43 @@ Page({
             item
         } = e.currentTarget.dataset;
         const that = this;
-        if (item.name == '绑定微信') return wx.showModal({
-            title: "提示",
-            content: "是否使用当前微信绑定此账号?",
-            success: res => {
-                if (res.confirm) {
-                    wx.login({
-                        success(res) {
-                            if (res.code) _Http.basic({
-                                "classname": "common.usercenter.usercenter",
-                                "method": "WechatBinding",
-                                "content": {
-                                    "wechat_code": res.code,
-                                    isbinging: 1 // 0解绑 1绑定
-                                }
-                            }).then(res => {
-                                console.log(res)
-                                if (res.code == 0) return wx.showToast({
-                                    title: res.msg,
-                                    icon: "none"
-                                });
-                                wx.showToast({
-                                    title: '绑定成功',
-                                })
-                                that.setData({
-                                    "userMsg.iswechatbinding": true
-                                })
+        if (item.name == '绑定微信') return wx.getUserProfile({
+            desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+            success: ({
+                userInfo
+            }) => {
+                wx.login({
+                    success(res) {
+                        if (res.code) _Http.basic({
+                            "classname": "common.usercenter.usercenter",
+                            "method": "WechatBinding",
+                            content: {
+                                "wechat_code": res.code,
+                                isbinging: 1, // 0解绑 1绑定
+                                wechatuserinfo: userInfo
+                            }
+                        }).then(res => {
+                            console.log(res)
+                            if (res.code == 0) return wx.showToast({
+                                title: res.data,
+                                icon: "none"
+                            });
+                            wx.showToast({
+                                title: '绑定成功',
                             })
-                        }
-                    })
-                }
+                            that.setData({
+                                "userMsg.iswechatbinding": true
+                            })
+                        })
+                    }
+                })
+            },
+            fail: () => {
+                wx.showToast({
+                    title: '绑定失败,未获得授权',
+                    icon: "none"
+                })
             }
-        });
+        })
     }
 })