zhaoxiaohai пре 3 година
родитељ
комит
186742ef2b
3 измењених фајлова са 49 додато и 18 уклоњено
  1. 23 16
      pages/tabbar/mine/index.js
  2. 18 0
      pages/tabbar/mine/index.scss
  3. 8 2
      pages/tabbar/mine/index.wxml

+ 23 - 16
pages/tabbar/mine/index.js

@@ -119,24 +119,31 @@ Page({
         } = e.currentTarget.dataset;
         console.log(name)
         if (name == '绑定微信') {
-            wx.login({
-                success(res) {
-                    if (res.code) {
-                        _Http.basic({
-                            "classname": "common.usercenter.usercenter",
-                            "method": "WechatBinding",
-                            "content": {
-                                "wechat_code": res.code
+            wx.showModal({
+                title: "提示",
+                content: "是否使用当前微信绑定此账号?",
+                success: res => {
+                    console.log(res)
+                    if (res.confirm) {
+                        wx.login({
+                            success(res) {
+                                if (res.code) _Http.basic({
+                                    "classname": "common.usercenter.usercenter",
+                                    "method": "WechatBinding",
+                                    "content": {
+                                        "wechat_code": res.code
+                                    }
+                                }).then(res => {
+                                    if (res.code == 0) return wx.showToast({
+                                        title: res.msg,
+                                        icon: "none"
+                                    });
+                                    wx.showToast({
+                                        title: '绑定成功',
+                                    })
+                                })
                             }
-                        }).then(res => {
-                            console.log(res)
-                           /*  if (res.code == 0) return wx.showToast({
-                                title: res.msg,
-                                icon: "none"
-                            }) */
                         })
-                    } else {
-                        console.log('登录失败!' + res.errMsg)
                     }
                 }
             })

+ 18 - 0
pages/tabbar/mine/index.scss

@@ -127,7 +127,25 @@
     .item:last-child .con {
         border-bottom: 0;
     }
+
+    .item-right {
+        display: flex;
+        align-items: center;
+        line-height: 20rpx;
+    }
+
+    .tips {
+        font-size: 24rpx !important;
+        margin-top: -4rpx;
+        margin-right: 10rpx;
+        color: #333333;
+    }
+
+    .right-false {
+        color: var(--error);
+    }
 }
+
 /* 退出登录 */
 .out-login {
     width: 500rpx;

+ 8 - 2
pages/tabbar/mine/index.wxml

@@ -29,11 +29,17 @@
                 <text class="iconfont {{item.icon}}" style="color: {{item.color}};" />
                 {{item.name}}
             </view>
-            <van-icon size='30rpx' name="arrow" />
+            <view class="item-right">
+                <view wx:if="{{item.name=='绑定微信'}}" class="tips {{userMsg.iswechatbinding?'':'right-false'}}">
+                    {{userMsg.iswechatbinding?'已绑定':'未绑定'}}
+                </view>
+                <van-icon size='30rpx' name="arrow" />
+            </view>
+
         </view>
     </navigator>
 </My_card>
-
+<!-- iswechatbinding -->
 <view style="width: 100vw;text-align: center;margin-top: 200rpx;">
     <van-button custom-class='out-login' color="#CCC" bindtap="outLogin" plain>退出登录</van-button>
 </view>