guhongwei преди 2 години
родител
ревизия
42afb63b1c
променени са 1 файла, в които са добавени 13 реда и са изтрити 3 реда
  1. 13 3
      pages/setting/basic.js

+ 13 - 3
pages/setting/basic.js

@@ -141,14 +141,24 @@ Page({
     // 账号绑定
     // 账号绑定
     scanCode2: function () {
     scanCode2: function () {
         const that = this;
         const that = this;
+        const raceuser = that.data.raceuser;
         wx.scanCode({
         wx.scanCode({
             async success(res) {
             async success(res) {
                 let arr = res.result.split('&&');
                 let arr = res.result.split('&&');
                 let parent_id = arr[0];
                 let parent_id = arr[0];
                 let type = arr[1];
                 let type = arr[1];
-                console.log(user);
-                // const aee = await app.$post(`/utbj`, { user_id: user_id, parent_id: parent_id }, 'race')
-                // console.log(aee);
+                const aee = await app.$post(`/user/utbj`, { user_id: raceuser.user_id._id, parent_id: parent_id }, 'race');
+                if (aee.errcode == '0') {
+                    wx.showModal({
+                        title: '提示',
+                        content: '裁判账号绑定成功,请退出登录',
+                        async success(res) {
+                            if (res.confirm) { wx.clearStorage(); wx.redirectTo({ url: '/pages/index/index' }) }
+                        }
+                    })
+                } else {
+                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error', duration: 2000 })
+                }
             }
             }
         })
         })
     },
     },